From e2e955e81c8791d6d2741cb0ed2cd4beb6546344 Mon Sep 17 00:00:00 2001 From: Bang Nguyen Date: Thu, 2 May 2019 15:40:42 -0500 Subject: [PATCH] disp: msm: Correct the panel's LP11_INIT QCOM has panel's LP11_INIT implementation, but it doesn't meet MOT's panel spec. Here is QCOM's implementaion: - Init the DSI PHY, Turn on panel's POWER, Toggle Reset, and sending MIPI commands Here is MOT's LP11_INIT panel spec: - Init the DSI PHY ( MIPI lines in LP00), Turn on panel POWER, Bring MIPI lines to LP11, Toggle Reset, Sending MIPI commands Port from: f78d13a Change-Id: Ia5f7f5be683615ec1811f550dec1967335c9816d Signed-off-by: Bang Nguyen Reviewed-on: https://gerrit.mot.com/1697591 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Guobin Zhang Submit-Approved: Jira Key --- msm/dsi/dsi_display.c | 3 +- msm/dsi/dsi_panel.c | 64 ++++++++++++++++++++++++------------------- msm/dsi/dsi_panel.h | 2 ++ 3 files changed, 40 insertions(+), 29 deletions(-) diff --git a/msm/dsi/dsi_display.c b/msm/dsi/dsi_display.c index 596b9f1b2f77..8254aab89600 100644 --- a/msm/dsi/dsi_display.c +++ b/msm/dsi/dsi_display.c @@ -8330,7 +8330,8 @@ error_ctrl_clk_off: (void)dsi_display_clk_ctrl(display->dsi_clk_handle, DSI_CORE_CLK, DSI_CLK_OFF); error_panel_post_unprep: - (void)dsi_panel_post_unprepare(display->panel); + if (!display->is_cont_splash_enabled) + (void)dsi_panel_post_unprepare(display->panel); error: mutex_unlock(&display->display_lock); SDE_EVT32(SDE_EVTLOG_FUNC_EXIT); diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index 58e2f03e4b3e..0236ac59252a 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -264,12 +264,13 @@ int dsi_panel_trigger_esd_attack(struct dsi_panel *panel, bool trusted_vm_env) return 0; } -static int dsi_panel_reset(struct dsi_panel *panel) +int dsi_panel_reset(struct dsi_panel *panel) { int rc = 0; struct dsi_panel_reset_config *r_config = &panel->reset_config; int i; + DSI_DEBUG("++\n"); if (gpio_is_valid(panel->reset_config.disp_en_gpio)) { rc = gpio_direction_output(panel->reset_config.disp_en_gpio, 1); if (rc) { @@ -376,23 +377,8 @@ static int dsi_panel_power_on(struct dsi_panel *panel) goto error_disable_vregs; } - rc = dsi_panel_reset(panel); - if (rc) { - DSI_ERR("[%s] failed to reset panel, rc=%d\n", panel->name, rc); - goto error_disable_gpio; - } - goto exit; -error_disable_gpio: - 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->bl_config.en_gpio)) - gpio_set_value(panel->bl_config.en_gpio, 0); - - (void)dsi_panel_set_pinctrl_state(panel, false); - error_disable_vregs: (void)dsi_pwr_enable_regulator(&panel->power_info, false); @@ -4587,14 +4573,17 @@ int dsi_panel_pre_prepare(struct dsi_panel *panel) mutex_lock(&panel->panel_lock); - /* If LP11_INIT is set, panel will be powered up during prepare() */ - if (panel->lp11_init) - goto error; - - rc = dsi_panel_power_on(panel); - if (rc) { - DSI_ERR("[%s] panel power on failed, rc=%d\n", panel->name, rc); - goto error; + /* + * If LP11_INIT is set, panel will be powered up here, not during + * prepare(), but panel's reset will be called later, in prepare call. + */ + if (panel->lp11_init) { + rc = dsi_panel_power_on(panel); + if (rc) { + DSI_ERR("[%s] panel power on failed, rc=%d\n", + panel->name, rc); + goto error; + } } error: @@ -4749,23 +4738,42 @@ int dsi_panel_prepare(struct dsi_panel *panel) mutex_lock(&panel->panel_lock); - if (panel->lp11_init) { + /* If LP11_INIT is not set, then panel will be powered here */ + if (!panel->lp11_init) { rc = dsi_panel_power_on(panel); if (rc) { DSI_ERR("[%s] panel power on failed, rc=%d\n", panel->name, rc); - goto error; + goto end; } } + rc = dsi_panel_reset(panel); + if (rc) { + DSI_ERR("[%s] panel reset failed, rc=%d\n", panel->name, rc); + goto error_disable_gpio; + } + rc = dsi_panel_tx_cmd_set(panel, DSI_CMD_SET_PRE_ON); if (rc) { DSI_ERR("[%s] failed to send DSI_CMD_SET_PRE_ON cmds, rc=%d\n", panel->name, rc); - goto error; + goto error_disable_gpio; } -error: + goto end; +error_disable_gpio: + 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->bl_config.en_gpio)) + gpio_set_value(panel->bl_config.en_gpio, 0); + + if (!panel->lp11_init) { + (void)dsi_panel_set_pinctrl_state(panel, false); + (void)dsi_pwr_enable_regulator(&panel->power_info, false); + } +end: mutex_unlock(&panel->panel_lock); return rc; } diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index 12fb317a3241..4be81859ce79 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -386,6 +386,8 @@ int dsi_panel_set_nolp(struct dsi_panel *panel); int dsi_panel_prepare(struct dsi_panel *panel); +int dsi_panel_reset(struct dsi_panel *panel); + int dsi_panel_enable(struct dsi_panel *panel); int dsi_panel_post_enable(struct dsi_panel *panel);