diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c index 1d757a02b758..aabb4515c9fd 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c @@ -5070,6 +5070,11 @@ int dsi_panel_post_switch(struct dsi_panel *panel) bool aod_fod_flag; bool aod_complete; bool real_aod_mode; + +extern bool oneplus_dimlayer_hbm_enable; +bool backup_dimlayer_hbm = false; +extern int oneplus_dim_status; +int backup_dim_status = 0; int dsi_panel_enable(struct dsi_panel *panel) { int rc = 0; @@ -5115,6 +5120,10 @@ int dsi_panel_enable(struct dsi_panel *panel) panel->panel_initialized = true; pr_err("dsi_panel_enable aod_mode =%d\n",panel->aod_mode); + oneplus_dimlayer_hbm_enable = backup_dimlayer_hbm; + oneplus_dim_status = backup_dim_status; + pr_err("Restore dim when panel goes on"); + blank = MSM_DRM_BLANK_UNBLANK_CHARGE; notifier_data.data = ␣ notifier_data.id = connector_state_crtc_index; @@ -5192,6 +5201,9 @@ int dsi_panel_disable(struct dsi_panel *panel) /* Avoid sending panel off commands when ESD recovery is underway */ if (!atomic_read(&panel->esd_recovery_pending)) { + oneplus_dimlayer_hbm_enable = false; + oneplus_dim_status = 0; + pr_err("Kill dim when panel goes off"); HBM_flag = false; if(panel->aod_mode==2){ panel->aod_status=1; diff --git a/drivers/gpu/drm/msm/sde/sde_crtc.c b/drivers/gpu/drm/msm/sde/sde_crtc.c index 9e4ff5528256..be4338e2e156 100644 --- a/drivers/gpu/drm/msm/sde/sde_crtc.c +++ b/drivers/gpu/drm/msm/sde/sde_crtc.c @@ -3510,6 +3510,8 @@ ssize_t oneplus_display_notify_fp_press(struct device *dev, return count; } extern int aod_layer_hide; +extern int backup_dim_status; +extern bool backup_dimlayer_hbm; extern bool HBM_flag; extern int dsi_panel_tx_cmd_set (struct dsi_panel *panel, enum dsi_cmd_set_type type); int oneplus_dim_status = 0; @@ -3568,8 +3570,10 @@ int oneplus_aod_dc = 0; return count; oneplus_dim_status = dim_status; oneplus_dimlayer_hbm_enable = oneplus_dim_status != 0; - pr_err("notify dim %d,aod = %d press= %d aod_hide =%d\n", - oneplus_dim_status, dsi_display->panel->aod_status, oneplus_onscreenfp_status, aod_layer_hide); + backup_dimlayer_hbm = oneplus_dimlayer_hbm_enable; + backup_dim_status = oneplus_dim_status; + pr_err("notify dim %d,aod = %d press= %d aod_hide =%d oneplus_dimlayer_hbm_enable = %d\n", + oneplus_dim_status, dsi_display->panel->aod_status, oneplus_onscreenfp_status, aod_layer_hide, oneplus_dimlayer_hbm_enable); if (oneplus_dim_status == 1 && HBM_flag) { rc = dsi_panel_tx_cmd_set(dsi_display->panel, DSI_CMD_SET_HBM_ON_5); if (rc) { @@ -5788,8 +5792,12 @@ static int sde_crtc_onscreenfinger_atomic_check(struct sde_crtc_state *cstate, } aod_mode = oneplus_aod_hid; - if (oneplus_dim_status == 5 && display->panel->aod_status == 0) + if (oneplus_dim_status == 5 && display->panel->aod_status == 0) { dim_mode = 0; + oneplus_dim_status = 0; + oneplus_dimlayer_hbm_enable = false; + pr_err("current dim = %d, oneplus_dimlayer_hbm_enable = %d\n", oneplus_dim_status, oneplus_dimlayer_hbm_enable); + } for (i = 0; i < cnt; i++) { mode = sde_plane_check_fingerprint_layer(pstates[i].drm_pstate);