]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Add params of set_abm_event for VB Scaling
authorChun-LiangChang <chuchang@amd.com>
Fri, 10 May 2024 07:00:18 +0000 (02:00 -0500)
committerAlex Deucher <alexander.deucher@amd.com>
Wed, 5 Jun 2024 15:05:24 +0000 (11:05 -0400)
[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@amd.com>
Acked-by: Zaeem Mohamed <zaeem.mohamed@amd.com>
Signed-off-by: Chun-LiangChang <chuchang@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.c
drivers/gpu/drm/amd/display/dc/dce/dmub_abm_lcd.h
drivers/gpu/drm/amd/display/dmub/inc/dmub_cmd.h

index b851fc65f5b7c7cc6fc70cd22ac71ebb2e8fb1d8..f4987e96fbf937b9c8128dd47af7f9022909fc3e 100644 (file)
@@ -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;
+}
index 761685e5b8c91eabb4d5a5ffb11c8d4299234ccc..13f54f1df780aa47c033dadc6234363ff29ea065 100644 (file)
@@ -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
index f52716c54180fa89da37d805b76f4edb8d0b1ade..4db4c5ad51694624d56ff655a24aa830e7d1840f 100644 (file)
@@ -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.
         */