From 6ff2674c42920e7eb23c2b3ee828c3ea98eba43b Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Mon, 28 Oct 2019 08:58:24 -0500 Subject: [PATCH] disp: msm: implement xxx-hbm-is-51cmd dts entry Add qcom,mdss-dsi-panel-hbm-is-51cmd to panel's dts to indicate that the HBM command is using the same backlight command 0x51 command. Therefore when the HBM is on, then the backlight level will be saved and backlight command will be ignored. When the HBM is off then stored backlight level will be set Port from 9bafa67 Change-Id: I58082c5555a4afbebebd2c1d9e8568c787143d2d Signed-off-by: Bang Nguyen Signed-off-by: daiss1 Reviewed-on: https://gerrit.mot.com/1697612 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Guobin Zhang Submit-Approved: Jira Key --- msm/dsi/dsi_panel.c | 40 ++++++++++++++++++++++++++++++++++++++-- msm/dsi/dsi_panel.h | 5 ++++- 2 files changed, 42 insertions(+), 3 deletions(-) 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; };