[PATCH 05/32] drm/amd/display: Add params of set_abm_event for VB Scaling
Zaeem Mohamed
zaeem.mohamed at amd.com
Fri May 31 16:51:18 UTC 2024
From: Chun-LiangChang <chuchang at amd.com>
[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: Jun Lei <jun.lei at amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed at amd.com>
Signed-off-by: Chun-LiangChang <chuchang at amd.com>
---
.../gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c | 18 ++++++
.../gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h | 2 +
.../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 55 +++++++++++++++++++
3 files changed, 75 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c
index b851fc65f5b7..f4987e96fbf9 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c
+++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c
@@ -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;
+}
diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h
index 761685e5b8c9..13f54f1df780 100644
--- a/drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h
+++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h
@@ -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
diff --git a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
index f52716c54180..4db4c5ad5169 100644
--- a/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
+++ b/drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h
@@ -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.
*/
--
2.34.1
More information about the amd-gfx
mailing list