From 3df694663724051e2e20abbd935cdbed2b0a4f17 Mon Sep 17 00:00:00 2001 From: wangyq13 Date: Tue, 24 Aug 2021 17:48:18 +0800 Subject: [PATCH] drm/dsi: add keeep panel regulators always on function drm/dsi: Add keep panel regulators always on function when screen on/off. Change-Id: I88e045237a149b9c4b2f908b334aa52b0c75f3be Signed-off-by: wangyq13 Reviewed-on: https://gerrit.mot.com/2049656 SME-Granted: SME Approvals Granted SLTApproved: Slta Waiver Tested-by: Jira Key Reviewed-by: Hua Tan Reviewed-by: Guobin Zhang Submit-Approved: Jira Key --- msm/dsi/dsi_panel.c | 32 ++++++++++++++++++++++---------- msm/dsi/dsi_panel.h | 1 + 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/msm/dsi/dsi_panel.c b/msm/dsi/dsi_panel.c index ec59e43a83ef..3b91987ec417 100644 --- a/msm/dsi/dsi_panel.c +++ b/msm/dsi/dsi_panel.c @@ -488,11 +488,13 @@ static int dsi_panel_power_on(struct dsi_panel *panel) goto exit; } - rc = dsi_pwr_enable_regulator(&panel->power_info, true); - if (rc) { - DSI_ERR("[%s] failed to enable vregs, rc=%d\n", - panel->name, rc); - goto exit; + if (!panel->keep_regulators_on) { + rc = dsi_pwr_enable_regulator(&panel->power_info, true); + if (rc) { + DSI_ERR("[%s] failed to enable vregs, rc=%d\n", + panel->name, rc); + goto exit; + } } rc = dsi_panel_set_pinctrl_state(panel, true); @@ -504,7 +506,8 @@ static int dsi_panel_power_on(struct dsi_panel *panel) goto exit; error_disable_vregs: - (void)dsi_pwr_enable_regulator(&panel->power_info, false); + if (!panel->keep_regulators_on) + (void)dsi_pwr_enable_regulator(&panel->power_info, false); exit: return rc; @@ -550,10 +553,12 @@ static int dsi_panel_power_off(struct dsi_panel *panel) 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); + if (!panel->keep_regulators_on) { + rc = dsi_pwr_enable_regulator(&panel->power_info, false); + if (rc) + DSI_ERR("[%s] failed to enable vregs, rc=%d\n", + panel->name, rc); + } exit: return rc; @@ -2678,6 +2683,7 @@ static int dsi_panel_parse_power_cfg(struct dsi_panel *panel) { int rc = 0; char *supply_name; + struct dsi_parser_utils *utils = &panel->utils; if (panel->host_config.ext_bridge_mode) return 0; @@ -2694,6 +2700,12 @@ static int dsi_panel_parse_power_cfg(struct dsi_panel *panel) goto error; } + panel->keep_regulators_on = utils->read_bool(utils->data, + "qcom,keep-regulators-on"); + + DSI_DEBUG("[%s] keep_regulators_on=%d\n", panel->name, + panel->keep_regulators_on); + error: return rc; } diff --git a/msm/dsi/dsi_panel.h b/msm/dsi/dsi_panel.h index 7ee0cb0888ac..9016b3da25f0 100644 --- a/msm/dsi/dsi_panel.h +++ b/msm/dsi/dsi_panel.h @@ -351,6 +351,7 @@ struct dsi_panel { int panel_test_gpio; int power_mode; + bool keep_regulators_on; enum dsi_panel_physical_type panel_type; struct dsi_tlmm_gpio *tlmm_gpio;