msm/dsi: add shutdown function to power down panel

When shut down phone, it will call shutdown function to shut down device.
That can meet the power down timing requirements of panel.

Change-Id: If5f5eb57934559d8c6aa979431d434bf89d33de9
Signed-off-by: houdz1 <houdz1@lenovo.com>
Reviewed-on: https://gerrit.mot.com/2063775
SLTApproved: Slta Waiver
SME-Granted: SME Approvals Granted
Tested-by: Jira Key
Reviewed-by: Yeqing Wang <wangyq13@motorola.com>
Reviewed-by: Huosheng Liao <liaohs@motorola.com>
Submit-Approved: Jira Key
This commit is contained in:
houdz1 2021-09-10 11:37:57 +08:00 • committed by tongkun1
commit cf526d3224
4 changed files with 51 additions and 0 deletions

View file

@ -6406,8 +6406,54 @@ static struct platform_driver dsi_display_driver = {
.of_match_table = dsi_display_dt_match,
.suppress_bind_attrs = true,
},
.shutdown = dsi_display_dev_shutdown,
};
void dsi_display_dev_shutdown(struct platform_device *pdev)
{
int rc = 0;
struct dsi_display *display;
struct dsi_panel *panel;
if (!pdev) {
DSI_ERR("Invalid device\n");
return;
}
display = platform_get_drvdata(pdev);
if (display == NULL || display->panel == NULL) {
DSI_ERR("Invalid device\n");
return;
}
panel = display->panel;
if (!panel->need_execute_shutdown) {
return;
}
if (gpio_is_valid(panel->reset_config.disp_en_gpio))
gpio_set_value(panel->reset_config.disp_en_gpio, 0);
if (gpio_is_valid(panel->reset_config.reset_gpio))
gpio_set_value(panel->reset_config.reset_gpio, 0);
if (gpio_is_valid(panel->reset_config.lcd_mode_sel_gpio))
gpio_set_value(panel->reset_config.lcd_mode_sel_gpio, 0);
if (gpio_is_valid(panel->panel_test_gpio)) {
rc = gpio_direction_input(panel->panel_test_gpio);
if (rc)
DSI_WARN("set dir for panel test gpio failed rc=%d\n", rc);
}
rc = dsi_pwr_enable_regulator(&panel->power_info, false);
if (rc)
DSI_ERR("[%s] failed to enable vregs, rc=%d\n", panel->name, rc);
}
static int dsi_display_init(struct dsi_display *display)
{
int rc = 0;

View file

@ -308,6 +308,7 @@ struct dsi_display {
int dsi_display_dev_probe(struct platform_device *pdev);
int dsi_display_dev_remove(struct platform_device *pdev);
void dsi_display_dev_shutdown(struct platform_device *pdev);
/**
* dsi_display_get_num_of_displays() - returns number of display devices

View file

@ -2609,6 +2609,9 @@ static int dsi_panel_parse_misc_features(struct dsi_panel *panel)
panel->skip_panel_off = utils->read_bool(utils->data,
"qcom,skip-panel-power-off");
panel->need_execute_shutdown = utils->read_bool(utils->data,
"qcom,platform-need-execute-shutdown");
panel->spr_info.enable = false;
panel->spr_info.pack_type = MSM_DISPLAY_SPR_TYPE_MAX;

View file

@ -332,6 +332,7 @@ struct dsi_panel {
bool ulps_suspend_enabled;
bool allow_phy_power_off;
bool reset_gpio_always_on;
bool need_execute_shutdown;
atomic_t esd_recovery_pending;
bool is_twm_en;