Commit 1349db15 authored by Chun-LiangChang's avatar Chun-LiangChang Committed by Alex Deucher

drm/amd/display: Add params of set_abm_event for VB Scaling

[Why]
Add parameters for set_abm_event to enable varibright scaling.
VariBright Scaling is a feature to refer to system states like

1. Power mode
2. Battery Life percent
3. FullScreen video
4. Backlight slider

to adjust variBright strength to get low power or user experience.

[How]
Add parameters of set_abm_event for VB Scaling
Reviewed-by: default avatarJun Lei <jun.lei@amd.com>
Acked-by: default avatarZaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: default avatarChun-LiangChang <chuchang@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent e86e8798
......@@ -297,3 +297,21 @@ bool dmub_abm_set_backlight_level(struct abm *abm,
return true;
}
bool dmub_abm_set_event(struct abm *abm, unsigned int scaling_enable, unsigned int scaling_strength_map,
unsigned int panel_inst)
{
union dmub_rb_cmd cmd;
struct dc_context *dc = abm->ctx;
memset(&cmd, 0, sizeof(cmd));
cmd.abm_set_event.header.type = DMUB_CMD__ABM;
cmd.abm_set_event.header.sub_type = DMUB_CMD__ABM_SET_EVENT;
cmd.abm_set_event.abm_set_event_data.vb_scaling_enable = scaling_enable;
cmd.abm_set_event.abm_set_event_data.vb_scaling_strength_mapping = scaling_strength_map;
cmd.abm_set_event.abm_set_event_data.panel_mask = (1<<panel_inst);
cmd.abm_set_event.header.payload_bytes = sizeof(struct dmub_cmd_abm_set_event_data);
dc_wake_and_execute_dmub_cmd(dc, &cmd, DM_DMUB_WAIT_TYPE_WAIT);
return true;
}
......@@ -49,4 +49,6 @@ bool dmub_abm_set_backlight_level(struct abm *abm,
unsigned int backlight_pwm_u16_16,
unsigned int frame_ramp,
unsigned int panel_inst);
bool dmub_abm_set_event(struct abm *abm, unsigned int scaling_enable, unsigned int scaling_strength_map,
unsigned int panel_inst);
#endif
......@@ -3911,6 +3911,11 @@ enum dmub_cmd_abm_type {
* Query ABM caps.
*/
DMUB_CMD__ABM_QUERY_CAPS = 8,
/**
* Set ABM Events
*/
DMUB_CMD__ABM_SET_EVENT = 9,
};
struct abm_ace_curve {
......@@ -4469,6 +4474,51 @@ struct dmub_rb_cmd_abm_save_restore {
struct dmub_cmd_abm_init_config_data abm_init_config_data;
};
/**
* Data passed from driver to FW in a DMUB_CMD__ABM_SET_EVENT command.
*/
struct dmub_cmd_abm_set_event_data {
/**
* VB Scaling Init. Strength Mapping
* Byte 0: 0~255 for VB level 0
* Byte 1: 0~255 for VB level 1
* Byte 2: 0~255 for VB level 2
* Byte 3: 0~255 for VB level 3
*/
uint32_t vb_scaling_strength_mapping;
/**
* VariBright Scaling Enable
*/
uint8_t vb_scaling_enable;
/**
* Panel Control HW instance mask.
* Bit 0 is Panel Control HW instance 0.
* Bit 1 is Panel Control HW instance 1.
*/
uint8_t panel_mask;
/**
* Explicit padding to 4 byte boundary.
*/
uint8_t pad[2];
};
/**
* Definition of a DMUB_CMD__ABM_SET_EVENT command.
*/
struct dmub_rb_cmd_abm_set_event {
/**
* Command header.
*/
struct dmub_cmd_header header;
/**
* Data passed from driver to FW in a DMUB_CMD__ABM_SET_EVENT command.
*/
struct dmub_cmd_abm_set_event_data abm_set_event_data;
};
/**
* Data passed from driver to FW in a DMUB_CMD__QUERY_FEATURE_CAPS command.
*/
......@@ -5008,6 +5058,11 @@ union dmub_rb_cmd {
*/
struct dmub_rb_cmd_abm_query_caps abm_query_caps;
/**
* Definition of a DMUB_CMD__ABM_SET_EVENT command.
*/
struct dmub_rb_cmd_abm_set_event abm_set_event;
/**
* Definition of a DMUB_CMD__DP_AUX_ACCESS command.
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment