msm/dsi: add support HBM with GPIO_DCS

For cypfq, we will set the backlight to max with dcs command.
And pull up hbm_en gpio to set the max current to 25mA.

Change-Id: I07885a122a9efc73e3f1191fa2465c0721ab9ec1
Signed-off-by: houdz1 <[email protected]>
Reviewed-on: https://gerrit.mot.com/2007805
SME-Granted: SME Approvals Granted
SLTApproved: Slta Waiver
Tested-by: Jira Key
Reviewed-by: Huosheng Liao <[email protected]>
Submit-Approved: Jira Key
This commit is contained in:
houdz1 2021-07-09 14:22:43 +08:00 • committed by tongkun1
commit fe176ce302
2 changed files with 54 additions and 6 deletions

View file

@ -237,11 +237,24 @@ static int dsi_panel_gpio_request(struct dsi_panel *panel)
rc);
panel->avdd_enable_gpio = -1;
rc = 0;
goto error_release_avdd_enable;
}
}
if (gpio_is_valid(panel->hbm_en_gpio)) {
rc = gpio_request(panel->hbm_en_gpio, "hbm_en_gpio");
if (rc) {
DSI_WARN("request for hbm_en_gpio failed, rc=%d\n",
rc);
panel->hbm_en_gpio = -1;
rc = 0;
}
}
goto error;
error_release_avdd_enable:
if (gpio_is_valid(panel->avdd_enable_gpio))
gpio_free(panel->avdd_enable_gpio);
error_release_avee_enable:
if (gpio_is_valid(panel->avee_enable_gpio))
gpio_free(panel->avee_enable_gpio);
@ -281,6 +294,9 @@ static int dsi_panel_gpio_release(struct dsi_panel *panel)
if (gpio_is_valid(panel->panel_test_gpio))
gpio_free(panel->panel_test_gpio);
if (gpio_is_valid(panel->hbm_en_gpio))
gpio_free(panel->hbm_en_gpio);
return rc;
}
@ -1011,13 +1027,36 @@ static int dsi_panel_set_hbm(struct dsi_panel *panel,
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);
if (panel->hbm_type == HBM_TYPE_LCD_DCS_GPIO) {
if (gpio_is_valid(panel->hbm_en_gpio)) {
struct panel_param *panel_param = &dsi_panel_param[0][PARAM_HBM_ID];
panel_param->value = param_info->value; if (param_info->value) {
gpio_direction_output(panel->hbm_en_gpio, 1);
pr_info("Set HBM to (%d) with GPIO%d\n", param_info->value, panel->hbm_en_gpio);
}
else {
gpio_direction_output(panel->hbm_en_gpio, 0);
pr_info("Set HBM to (%d) with GPIO%d\n", param_info->value, panel->hbm_en_gpio);
}
rc = dsi_panel_set_backlight(panel, HBM_BRIGHTNESS(param_info->value));
if (rc)
DSI_ERR("Set HBM: unable to set backlight\n");
} else {
DSI_ERR("%s: invalid params\n", __func__);
rc = -EINVAL;
}
} else {
rc = dsi_panel_set_backlight(panel, HBM_BRIGHTNESS(param_info->value));
if (rc)
DSI_ERR("unable to set backlight\n");
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 {
rc = dsi_panel_set_backlight(panel, HBM_BRIGHTNESS(param_info->value));
if (rc)
DSI_ERR("unable to set backlight\n");
}
}
return rc;
@ -2776,6 +2815,13 @@ static int dsi_panel_parse_gpios(struct dsi_panel *panel)
DSI_DEBUG("%s:%d qcom,add-enable-gpio not specified\n", __func__,
__LINE__);
panel->hbm_en_gpio = utils->get_named_gpio(utils->data,
"qcom,platform-hbm-en-gpio",
0);
if (!gpio_is_valid(panel->hbm_en_gpio))
DSI_DEBUG("%s:%d HBM enable gpio not specified\n", __func__,
__LINE__);
error:
return rc;
}

View file

@ -375,6 +375,8 @@ struct dsi_panel {
int avee_enable_gpio;
int avdd_enable_gpio;
int hbm_en_gpio;
};
bool dsi_display_all_displays_dead(void);