[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200716123753.3552425-3-megous@megous.com>
Date: Thu, 16 Jul 2020 14:37:53 +0200
From: Ondrej Jirman <megous@...ous.com>
To: David Airlie <airlied@...ux.ie>, Daniel Vetter <daniel@...ll.ch>,
Thierry Reding <thierry.reding@...il.com>,
Sam Ravnborg <sam@...nborg.org>,
Fabio Estevam <festevam@...il.com>,
Guido Günther <agx@...xcpu.org>,
Robert Chiras <robert.chiras@....com>
Cc: Ondrej Jirman <megous@...ous.com>,
Samuel Holland <samuel@...lland.org>,
dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] drm/panel: st7703: Fix the power up sequence of the panel
The datasheet specifies that it's better to keep reset asserted
while powering up the supplies, and that IOVCC should be enabled
first.
There also needs to be a delay after enabling the supplies and
before deasserting the reset. The datasheet specifies 1ms after
the supplies reach the required voltage. Use 10-20ms to also
give the power supplies some time to reach the required voltage,
too.
This fixes intermittent panel initialization failures and screen
corruption during resume from sleep on PinePhone.
Reported-by: Samuel Holland <samuel@...lland.org>
Signed-off-by: Ondrej Jirman <megous@...ous.com>
---
drivers/gpu/drm/panel/panel-sitronix-st7703.c | 22 +++++++++++--------
1 file changed, 13 insertions(+), 9 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index 45833e6a0f4f..48569a8688f6 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -429,12 +429,8 @@ static int st7703_prepare(struct drm_panel *panel)
return 0;
DRM_DEV_DEBUG_DRIVER(ctx->dev, "Resetting the panel\n");
- ret = regulator_enable(ctx->vcc);
- if (ret < 0) {
- DRM_DEV_ERROR(ctx->dev,
- "Failed to enable vcc supply: %d\n", ret);
- return ret;
- }
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
ret = regulator_enable(ctx->iovcc);
if (ret < 0) {
DRM_DEV_ERROR(ctx->dev,
@@ -442,10 +438,18 @@ static int st7703_prepare(struct drm_panel *panel)
goto disable_vcc;
}
- gpiod_set_value_cansleep(ctx->reset_gpio, 1);
- usleep_range(20, 40);
+ ret = regulator_enable(ctx->vcc);
+ if (ret < 0) {
+ DRM_DEV_ERROR(ctx->dev,
+ "Failed to enable vcc supply: %d\n", ret);
+ return ret;
+ }
+
+ /* Give power supplies time to stabilize before deasserting reset. */
+ usleep_range(10000, 20000);
+
gpiod_set_value_cansleep(ctx->reset_gpio, 0);
- msleep(20);
+ usleep_range(15000, 20000);
ctx->prepared = true;
--
2.27.0
Powered by blists - more mailing lists