Skip to content

Commit

Permalink
drm: various FOD fixes:
Browse files Browse the repository at this point in the history
Revert 716cae38b: was a semi-working bandaid to workaround intermittent breakages after 60hz hbm stuck fix.

Mostly revert c5aa78c280: Fixed 60hz hbm intermittently stuck after fod, but intermittently broke fod as a result.

Additionally:
 - Only cache backlight value if not HBM.
 - On HBM off, update bl with cached backlight value.
 - Update sde bl scale on fod depress.

The above properly fix and protect against post-FOD high backlight level or HBM at 60hz.

Signed-off-by: Harish <[email protected]>
  • Loading branch information
RealJohnGalt authored and Codecity001 committed Apr 17, 2023
1 parent b396b53 commit a5e4603
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
32 changes: 25 additions & 7 deletions drivers/gpu/drm/msm/dsi-staging/dsi_panel.c
Original file line number Diff line number Diff line change
Expand Up @@ -877,6 +877,7 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
u32 bl_lvl)
{
int rc = 0;
u32 count;
struct mipi_dsi_device *dsi;
struct dsi_display_mode *mode;

Expand All @@ -888,19 +889,39 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel,
dsi = &panel->mipi_device;
mode = panel->cur_mode;


if (panel->is_hbm_enabled)
return 0;

saved_backlight = bl_lvl;

if (panel->dc_dim)
bl_lvl = 1023;

if (panel->bl_config.bl_high2bit) {
if (HBM_flag == true)
return 0;

if (cur_backlight == bl_lvl && (mode_fps != cur_fps ||
cur_h != panel->cur_mode->timing.h_active)) {
cur_fps = mode_fps;
cur_h = panel->cur_mode->timing.h_active;
return 0;
}

if (hbm_brightness_flag == 1) {
count = mode->priv_info->cmd_sets[DSI_CMD_SET_HBM_BRIGHTNESS_OFF].count;
if (!count) {
pr_debug("This panel does not support HBM brightness off mode.\n");
return rc;
}
else {
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_BRIGHTNESS_OFF);
pr_debug("Send DSI_CMD_SET_HBM_BRIGHTNESS_OFF cmds.\n");
hbm_brightness_flag = 0;
}
}

rc = mipi_dsi_dcs_set_display_brightness_samsung(dsi, bl_lvl);
pr_debug("backlight = %d\n", bl_lvl);
cur_backlight = bl_lvl;
Expand Down Expand Up @@ -939,7 +960,6 @@ int dsi_panel_op_set_hbm_mode(struct dsi_panel *panel, int level)
} else {
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_OFF);
printk(KERN_ERR"When HBM OFF -->hbm_backight = %d panel->bl_config.bl_level =%d\n",panel->hbm_backlight,panel->bl_config.bl_level);
rc= dsi_panel_update_backlight(panel,panel->hbm_backlight);
}
break;

Expand Down Expand Up @@ -5787,7 +5807,7 @@ int dsi_panel_set_hbm_mode(struct dsi_panel *panel, int level)
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_OFF);
pr_debug("Send DSI_CMD_SET_HBM_OFF cmds.\n");
pr_debug("hbm_backight = %d, panel->bl_config.bl_level = %d\n",panel->hbm_backlight, panel->bl_config.bl_level);
rc= dsi_panel_update_backlight(panel, panel->hbm_backlight);
rc = dsi_panel_update_backlight(panel, saved_backlight);
}
break;

Expand Down Expand Up @@ -5850,11 +5870,6 @@ int dsi_panel_set_hbm_mode(struct dsi_panel *panel, int level)
HBM_flag = true;
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_ON_5);
pr_debug("Send DSI_CMD_SET_HBM_ON_5 cmds.\n");
if (rc) {
pr_debug("Failed HBM_ON_5, try again.\n");
usleep_range(12000, 13000);
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_HBM_ON_5);
}
}
break;

Expand Down Expand Up @@ -5887,6 +5902,9 @@ int dsi_panel_set_hbm_brightness(struct dsi_panel *panel, int level)
dsi = &panel->mipi_device;
mode = panel->cur_mode;

if (panel->is_hbm_enabled)
return 0;

mutex_lock(&panel->panel_lock);
if (hbm_brightness_flag == 0) {
count = mode->priv_info->cmd_sets[DSI_CMD_SET_HBM_BRIGHTNESS_ON].count;
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/msm/sde/sde_connector.c
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,8 @@ static void sde_connector_pre_update_fod_hbm(struct sde_connector *c_conn)
MSM_ENC_VBLANK);

dsi_panel_set_fod_ui(panel, status);
if (!status)
_sde_connector_update_bl_scale(c_conn);
}

int sde_connector_pre_kickoff(struct drm_connector *connector)
Expand Down

0 comments on commit a5e4603

Please sign in to comment.