[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191106081752.12944-2-jitao.shi@mediatek.com>
Date: Wed, 6 Nov 2019 16:17:52 +0800
From: Jitao Shi <jitao.shi@...iatek.com>
To: Thierry Reding <thierry.reding@...il.com>,
Sam Ravnborg <sam@...nborg.org>,
David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
CC: <linux-mediatek@...ts.infradead.org>,
<srv_heupstream@...iatek.com>, <yingjoe.chen@...iatek.com>,
<eddie.huang@...iatek.com>, <cawa.cheng@...iatek.com>,
<bibby.hsieh@...iatek.com>, <ck.hu@...iatek.com>,
<stonea168@....com>, Jitao Shi <jitao.shi@...iatek.com>
Subject: [PATCH 1/1] drm/panel: boe-tv101wum-n16 seperate the panel power control
Seperate the panel power control from prepare/unprepare.
Signed-off-by: Jitao Shi <jitao.shi@...iatek.com>
---
.../gpu/drm/panel/panel-boe-tv101wum-nl6.c | 69 +++++++++++++------
1 file changed, 49 insertions(+), 20 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
index e2496a334ab6..5b1b285a2194 100644
--- a/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
+++ b/drivers/gpu/drm/panel/panel-boe-tv101wum-nl6.c
@@ -50,6 +50,7 @@ struct boe_panel {
struct regulator *avdd;
struct gpio_desc *enable_gpio;
+ bool prepared_power;
bool prepared;
bool enabled;
@@ -501,12 +502,11 @@ static int boe_panel_disable(struct drm_panel *panel)
return 0;
}
-static int boe_panel_unprepare(struct drm_panel *panel)
+static int boe_panel_unprepare_power(struct drm_panel *panel)
{
struct boe_panel *boe = to_boe_panel(panel);
- int ret;
- if (!boe->prepared)
+ if (!boe->prepared_power)
return 0;
if (boe->desc->discharge_on_disable) {
@@ -518,12 +518,6 @@ static int boe_panel_unprepare(struct drm_panel *panel)
usleep_range(5000, 7000);
regulator_disable(boe->pp1800);
} else {
- ret = boe_panel_off(boe);
- if (ret < 0) {
- dev_err(panel->dev, "failed to set panel off: %d\n",
- ret);
- return ret;
- }
msleep(150);
gpiod_set_value(boe->enable_gpio, 0);
usleep_range(500, 1000);
@@ -533,17 +527,39 @@ static int boe_panel_unprepare(struct drm_panel *panel)
regulator_disable(boe->pp1800);
}
+ boe->prepared_power = false;
+
+ return 0;
+}
+
+static int boe_panel_unprepare(struct drm_panel *panel)
+{
+ struct boe_panel *boe = to_boe_panel(panel);
+ int ret;
+
+ if (!boe->prepared)
+ return 0;
+
+ if (!boe->desc->discharge_on_disable) {
+ ret = boe_panel_off(boe);
+ if (ret < 0) {
+ dev_err(panel->dev, "failed to set panel off: %d\n",
+ ret);
+ return ret;
+ }
+ }
+
boe->prepared = false;
return 0;
}
-static int boe_panel_prepare(struct drm_panel *panel)
+static int boe_panel_prepare_power(struct drm_panel *panel)
{
struct boe_panel *boe = to_boe_panel(panel);
int ret;
- if (boe->prepared)
+ if (boe->prepared_power)
return 0;
gpiod_set_value(boe->enable_gpio, 0);
@@ -571,18 +587,10 @@ static int boe_panel_prepare(struct drm_panel *panel)
gpiod_set_value(boe->enable_gpio, 1);
usleep_range(6000, 10000);
- ret = boe_panel_init(boe);
- if (ret < 0) {
- dev_err(panel->dev, "failed to init panel: %d\n", ret);
- goto poweroff;
- }
-
- boe->prepared = true;
+ boe->prepared_power = true;
return 0;
-poweroff:
- regulator_disable(boe->avee);
poweroffavdd:
regulator_disable(boe->avdd);
poweroff1v8:
@@ -593,6 +601,25 @@ static int boe_panel_prepare(struct drm_panel *panel)
return ret;
}
+static int boe_panel_prepare(struct drm_panel *panel)
+{
+ struct boe_panel *boe = to_boe_panel(panel);
+ int ret;
+
+ if (boe->prepared)
+ return 0;
+
+ ret = boe_panel_init(boe);
+ if (ret < 0) {
+ dev_err(panel->dev, "failed to init panel: %d\n", ret);
+ return ret;
+ }
+
+ boe->prepared = true;
+
+ return 0;
+}
+
static int boe_panel_enable(struct drm_panel *panel)
{
struct boe_panel *boe = to_boe_panel(panel);
@@ -754,7 +781,9 @@ static int boe_panel_get_modes(struct drm_panel *panel)
static const struct drm_panel_funcs boe_panel_funcs = {
.disable = boe_panel_disable,
.unprepare = boe_panel_unprepare,
+ .unprepare_power = boe_panel_unprepare_power,
.prepare = boe_panel_prepare,
+ .prepare_power = boe_panel_prepare_power,
.enable = boe_panel_enable,
.get_modes = boe_panel_get_modes,
};
--
2.21.0
Powered by blists - more mailing lists