drm: msm: implement FOD dimlayer bl block

Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
This commit is contained in:
UtsavBalar1231
2020-06-10 10:55:28 +05:30
parent a54591508d
commit 76deb8e5d7
3 changed files with 56 additions and 9 deletions

View File

@@ -829,6 +829,26 @@ int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl)
if (0 == bl_lvl)
dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DISP_DIMMINGOFF);
if (panel->dc_enable && bl_lvl < panel->dc_threshold && bl_lvl != 0) {
pr_info("skip set backlight because dc enable %d, dim_layer_replace_dc:%d, bl %d, last_bl %d\n",
panel->dc_enable, panel->dim_layer_replace_dc, bl_lvl, panel->last_bl_lvl);
return rc;
}
if (panel->fod_dimlayer_bl_block) {
panel->last_bl_lvl = bl_lvl;
pr_info("skip set backlight due to dim layer block\n");
return rc;
}
if (panel->fodflag && panel->last_bl_lvl == 0 && bl_lvl != 0 && !panel->fod_dimlayer_hbm_enabled && panel->fod_dimlayer_enabled) {
panel->fod_dimlayer_bl_block = true;
pr_info("the fod_dimlayer_bl_block state is [%d]\n", panel->fod_dimlayer_bl_block);
panel->last_bl_lvl = bl_lvl;
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_DISP_CRC_OFF);
pr_info("crc off when fod dimlayer hbm disable\n");
return rc;
}
if (panel->bl_config.bl_remap_flag && panel->bl_config.brightness_max_level
&& panel->bl_config.bl_max_level) {
@@ -880,6 +900,7 @@ int dsi_panel_set_backlight(struct dsi_panel *panel, u32 bl_lvl)
panel->dc_enable = false;
}
panel->last_bl_lvl = bl_lvl;
return rc;
}
@@ -4591,6 +4612,11 @@ int dsi_panel_set_nolp(struct dsi_panel *panel)
mutex_lock(&panel->panel_lock);
if (!panel->fod_hbm_enabled && !panel->fod_dimlayer_hbm_enabled) {
if (panel->fodflag && panel->fod_dimlayer_enabled) {
dsi_panel_update_backlight(panel, 0);
panel->fod_dimlayer_bl_block = true;
pr_info("the fod_dimlayer_bl_block state is [%d]\n", panel->fod_dimlayer_bl_block);
}
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_NOLP);
if (rc)
pr_err("[%s] failed to send DSI_CMD_SET_NOLP cmd, rc=%d\n",
@@ -4613,6 +4639,10 @@ int dsi_panel_set_nolp(struct dsi_panel *panel)
dsi_pwr_panel_regulator_mode_set(&panel->power_info,
"ibb", REGULATOR_MODE_NORMAL);
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_NOLP);
if (rc)
pr_err("[%s] failed to send DSI_CMD_SET_NOLP cmd, rc=%d\n",
panel->name, rc);
exit:
mutex_unlock(&panel->panel_lock);
return rc;
@@ -5043,8 +5073,10 @@ static int panel_disp_param_send_lock(struct dsi_panel *panel, int param)
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;
if (!panel->dim_layer_replace_dc) {
pr_info("DC on\n");
panel->dc_enable = true;
}
break;
case DISPPARAM_DC_OFF:
pr_info("DC off\n");
@@ -5147,6 +5179,8 @@ static int panel_disp_param_send_lock(struct dsi_panel *panel, int param)
rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_NOLP);
break;
case DISPPARAM_HBM_BACKLIGHT_RESEND:
if (panel->fod_dimlayer_bl_block)
break;
{
backlight_delta++;

View File

@@ -269,6 +269,9 @@ struct dsi_panel {
u32 dc_threshold;
bool dc_enable;
bool dim_layer_replace_dc;
bool fod_dimlayer_bl_block;
bool fodflag;
int power_mode;
enum dsi_panel_physical_type panel_type;

View File

@@ -730,9 +730,13 @@ 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");
if (dsi_display->panel->dim_layer_replace_dc) {
dsi_panel_set_backlight(dsi_display->panel, c_conn->bl_device->props.brightness);
dsi_display->panel->dim_layer_replace_dc = false;
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);
@@ -758,11 +762,17 @@ 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]);
if (dsi_display->panel->fod_dimlayer_bl_block) {
dsi_display->panel->fod_dimlayer_bl_block = false;
pr_debug("the fod_dimlayer_bl_block state is [%d]\n", dsi_display->panel->fod_dimlayer_bl_block);
dsi_panel_set_backlight(dsi_display->panel, dsi_display->panel->last_bl_lvl);
}
/* force disable CRC */
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);