diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c index acee3faf348b..bac1d3eb876f 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.c @@ -870,6 +870,15 @@ int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl) panel->skip_dimmingon = STATE_NONE; } + if (bl_lvl > 0 && panel->last_bl_lvl == 0) { + pr_info("crc off when quickly power on\n"); + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DISP_CRC_OFF); + } + + if (bl_lvl == 0) { + pr_info("DC off when last backlight is 0\n"); + panel->dc_enable = false; + } panel->last_bl_lvl = bl_lvl; return rc; } @@ -3631,6 +3640,15 @@ static int dsi_panel_parse_mi_config(struct dsi_panel *panel, pr_debug("fod_off_dimming_delay %d\n", panel->fod_off_dimming_delay); } + rc = of_property_read_u32(of_node, + "qcom,mdss-dsi-panel-dc-threshold", &panel->dc_threshold); + if (rc) { + panel->dc_threshold = 610; + pr_info("default dc backlight threshold is %d\n", panel->dc_threshold); + } else { + pr_info("dc backlight threshold %d \n", panel->dc_threshold); + } + panel->fod_dimlayer_enabled = utils->read_bool(of_node, "qcom,mdss-dsi-panel-fod-dimlayer-enabled"); if (panel->fod_dimlayer_enabled) { @@ -3660,6 +3678,7 @@ static int dsi_panel_parse_mi_config(struct dsi_panel *panel, panel->bl_lowlevel_duration = 0; panel->hbm_duration = 0; panel->hbm_times = 0; + panel->dc_enable = false; return rc; } @@ -5023,6 +5042,14 @@ static int panel_disp_param_send_lock(struct dsi_panel *panel, int param) pr_debug("hbm fod to normal mode\n"); rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DISP_HBM_FOD2NORM); break; + case DISPPARAM_DC_ON: + pr_info("DC on\n"); + panel->dc_enable = true; + break; + case DISPPARAM_DC_OFF: + pr_info("DC off\n"); + panel->dc_enable = false; + break; case DISPPARAM_HBM_FOD_OFF: pr_debug("hbm fod off\n"); if (panel->elvss_dimming_check_enable) { @@ -5162,7 +5189,15 @@ static int panel_disp_param_send_lock(struct dsi_panel *panel, int param) pr_info("FOD backlight restore last_bl_lvl=%d, state=%d", panel->last_bl_lvl, display->drm_dev->state); rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DISP_DIMMINGOFF); - rc = dsi_panel_update_backlight(panel, panel->last_bl_lvl); + if (panel->dc_enable) { + pr_info("FOD backlight restore dc_threshold=%d, doze_state=%d", + panel->dc_threshold, display->drm_dev->state); + rc = dsi_panel_update_backlight(panel, panel->dc_threshold); + } else { + pr_info("FOD backlight restore last_bl_lvl=%d, doze_state=%d", + panel->last_bl_lvl, display->drm_dev->state); + rc = dsi_panel_update_backlight(panel, panel->last_bl_lvl); + } if ((display->drm_dev && display->drm_dev->state == MSM_DRM_BLANK_LP1) || (display->drm_dev && display->drm_dev->state == MSM_DRM_BLANK_LP2)) { @@ -5509,6 +5544,7 @@ int dsi_panel_disable(struct dsi_panel *panel) panel->fod_dimlayer_hbm_enabled = false; panel->in_aod = false; panel->fod_backlight_flag = false; + panel->dc_enable = false; panel->power_mode = SDE_MODE_DPMS_OFF; mutex_unlock(&panel->panel_lock); diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h index 594843b4ed99..cef4ba5a14a3 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel.h @@ -267,6 +267,9 @@ struct dsi_panel { u64 hbm_duration; u64 hbm_times; + u32 dc_threshold; + bool dc_enable; + int power_mode; enum dsi_panel_physical_type panel_type; }; diff --git a/drivers/gpu/drm/msm/dsi-staging/dsi_panel_mi.h b/drivers/gpu/drm/msm/dsi-staging/dsi_panel_mi.h index 7910752df83a..117301542d64 100644 --- a/drivers/gpu/drm/msm/dsi-staging/dsi_panel_mi.h +++ b/drivers/gpu/drm/msm/dsi-staging/dsi_panel_mi.h @@ -57,6 +57,8 @@ enum DISPPARAM_MODE { DISPPARAM_HBM_ON = 0x10000, DISPPARAM_HBM_FOD_ON = 0x20000, DISPPARAM_HBM_FOD2NORM = 0x30000, + DISPPARAM_DC_ON = 0x40000, + DISPPARAM_DC_OFF = 0x50000, DISPPARAM_HBM_FOD_OFF = 0xE0000, DISPPARAM_HBM_OFF = 0xF0000, DISPPARAM_NORMALMODE1 = 0x100000, diff --git a/drivers/gpu/drm/msm/sde/sde_connector.c b/drivers/gpu/drm/msm/sde/sde_connector.c index 949330077c26..e40b4bb12e89 100644 --- a/drivers/gpu/drm/msm/sde/sde_connector.c +++ b/drivers/gpu/drm/msm/sde/sde_connector.c @@ -730,6 +730,9 @@ int sde_connector_update_hbm(struct sde_connector *c_conn) pr_debug("HBM fod off\n"); sysfs_notify(&dsi_display->drm_conn->kdev->kobj, NULL, "dimlayer_hbm_enabled"); pr_debug("notify hbm off to displayfeature\n"); + dsi_display->panel->dc_enable = true; + pr_debug("fod restore DC\n"); + sysfs_notify(&c_conn->bl_device->dev.kobj, NULL, "brightness_clone"); } dsi_display->panel->fod_dimlayer_hbm_enabled = false; mutex_unlock(&dsi_display->panel->panel_lock); @@ -755,6 +758,11 @@ int sde_connector_update_hbm(struct sde_connector *c_conn) sysfs_notify(&dsi_display->drm_conn->kdev->kobj, NULL, "dimlayer_hbm_enabled"); pr_debug("notify hbm on to displayfeature\n"); } + if (dsi_display->panel->dc_enable) { + dsi_display->panel->dc_enable = false; + pr_debug("fod set CRC OFF\n"); + dsi_display_write_panel(dsi_display, &dsi_display->panel->cur_mode->priv_info->cmd_sets[DSI_CMD_SET_DISP_CRC_OFF]); + } dsi_display->panel->skip_dimmingon = STATE_DIM_BLOCK; dsi_display->panel->fod_dimlayer_hbm_enabled = true; mutex_unlock(&dsi_display->panel->panel_lock);