diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 006c163dd63c..e0c6f056cd0e 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -573,11 +573,17 @@ static int dsi_panel_update_backlight(struct dsi_panel *panel, if (panel->bl_config.bl_inverted_dbv) bl_lvl = (((bl_lvl & 0xff) << 8) | (bl_lvl >> 8)); + if (panel->is_hbm_using_51_cmd && panel->is_hbm_on) { + panel->bl_lvl_during_hbm = bl_lvl; + DSI_DEBUG("HBM is on.. ignore setting backlight. bl_vl=%d\n", + panel->bl_lvl_during_hbm); + return 0; + } + if (bl->bl_2bytes_enable){ bl_lvl_2bytes = ((bl_lvl & 0xff00) >> 8) | ((bl_lvl & 0xff) << 8); rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl_2bytes); - } - else + }else rc = mipi_dsi_dcs_set_display_brightness(dsi, bl_lvl); if (rc < 0) @@ -804,11 +810,36 @@ static int dsi_panel_set_hbm(struct dsi_panel *panel, struct msm_param_info *param_info) { int rc = 0; + u32 tmp_bklt_lvl = 0; + bool old_hbm_on; pr_info("Set HBM to (%d)\n", param_info->value); rc = dsi_panel_send_param_cmd(panel, param_info); if (rc < 0) DSI_ERR("%s: failed to send param cmds. ret=%d\n", __func__, rc); + else { + mutex_lock(&panel->panel_lock); + if (!panel->is_hbm_using_51_cmd) { + mutex_unlock(&panel->panel_lock); + return rc; + } + + old_hbm_on = panel->is_hbm_on ; + panel->is_hbm_on = param_info->value; + if (!panel->is_hbm_on) { + tmp_bklt_lvl= panel->bl_lvl_during_hbm; + panel->bl_lvl_during_hbm = 0; + } + mutex_unlock(&panel->panel_lock); + + if (param_info->value == 0 && old_hbm_on && tmp_bklt_lvl) { + rc = dsi_panel_set_backlight(panel, tmp_bklt_lvl); + if (rc) + DSI_ERR("unable to set backlight\n"); + else + tmp_bklt_lvl = 0; + } + } return rc; }; @@ -3762,6 +3793,11 @@ static int dsi_panel_parse_param_prop(struct dsi_panel *panel, panel->panel_hbm_fod = of_property_read_bool(of_node, "qcom,mdss-dsi-hbm-fod"); + panel->is_hbm_using_51_cmd = of_property_read_bool(of_node, + "qcom,mdss-dsi-panel-hbm-is-51cmd"); + if (panel->is_hbm_using_51_cmd) + DSI_INFO("HBM command is using 0x51 command\n"); + return rc; parse_err: diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index 5bd3499c5dad..9a9c2bf7467e 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -314,9 +314,12 @@ struct dsi_panel { bool no_panel_on_read_support; bool panel_hbm_fod; - bool panel_hbm_dim_off; + bool is_hbm_using_51_cmd; + bool is_hbm_on; + u32 bl_lvl_during_hbm; + struct panel_param *param_cmds; };