diff options
author | Matt Stephenson <stephensonmatt@google.com> | 2023-02-20 21:39:32 +0000 |
---|---|---|
committer | Matt Stephenson <stephensonmatt@google.com> | 2023-03-10 02:18:22 +0000 |
commit | 94975f1e8925139686c26ce369551817ee065e4c (patch) | |
tree | 821b989afea6df265910501d243be075b839b845 | |
parent | b4c37b91fd5b515cc2371951bd592e63ce3614a3 (diff) | |
download | display-drivers-94975f1e8925139686c26ce369551817ee065e4c.tar.gz |
display: set both interactive and AOD dbv
Whenever we receive a brightness request in Interactive mode, calculate
and set both Interactive and AOD DBV. This is achievable thanks to
dedicated DBV reg for each mode (reg 0x51 for Interactive and reg 0x61
for AOD).
Test: Manual
Change-Id: I288be77bd19fdfe0286aebd23295a1f527fcf943
Bug: 242308591
Signed-off-by: Matt Stephenson <stephensonmatt@google.com>
-rw-r--r-- | msm/dsi/dsi_panel.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index e6c70fa5..05b6190b 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -39,6 +39,13 @@ #define RSCC_MODE_THRESHOLD_TIME_US 40 #define DCS_COMMAND_THRESHOLD_TIME_US 40 +static u32 interactive_to_aod_brightness(u32 interactive_brightness, struct dsi_panel *panel) +{ + return (interactive_brightness >= panel->bl_config.bl_step_list_length) ? + panel->bl_config.bl_max_level : + panel->bl_config.bl_step_list[interactive_brightness]; +} + static void dsi_dce_prepare_pps_header(char *buf, u32 pps_delay_ms) { char *bp; @@ -578,6 +585,20 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel, if (rc < 0) DSI_ERR("failed to update dcs backlight:%d\n", bl_lvl); + if (panel->bl_config.bl_step_list_length) { + u32 aod_brightness = interactive_to_aod_brightness(bl_lvl, panel); + u8 payload[2] = { aod_brightness & 0xff, (aod_brightness >> 8) & 0xff }; + + rc = mipi_dsi_dcs_write(dsi, panel->bl_config.aod_dbv_reg, payload, + sizeof(payload)); + + if (rc < 0) + DSI_ERR("failed to update aod backlight:%d\n", aod_brightness); + else + DSI_INFO("brightness: inter: %u, aod: %u, length: %u", bl_lvl, + aod_brightness, panel->bl_config.bl_step_list_length); + } + if (unlikely(panel->bl_config.lp_mode)) dsi->mode_flags = mode_flags; |