build/patch/kernel/archive/sunxi-5.10/megous/drm-panel-st7703-Improve-the-power-up-sequence-of-th.patch

74 lines
2.2 KiB
Diff
Raw Normal View History

From c849eec33180044637f72a2e8b2c3787ae1eae22 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Sun, 5 Jul 2020 16:00:16 +0200
Subject: [PATCH 215/351] drm/panel: st7703: Improve 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 give the
power supplies some time to reach the required voltage, too.
This fixes panel initialization failures during resume from sleep
on PinePhone.
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/gpu/drm/panel/panel-sitronix-st7703.c | 25 ++++++++++---------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index 3af2a6c280dd..1fe0e72995cd 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -425,29 +425,30 @@ static int st7703_prepare(struct drm_panel *panel)
return 0;
dev_dbg(ctx->dev, "Resetting the panel\n");
- ret = regulator_enable(ctx->vcc);
+ gpiod_set_value_cansleep(ctx->reset_gpio, 1);
+
+ ret = regulator_enable(ctx->iovcc);
if (ret < 0) {
- dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret);
+ dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret);
return ret;
}
- ret = regulator_enable(ctx->iovcc);
+
+ ret = regulator_enable(ctx->vcc);
if (ret < 0) {
- dev_err(ctx->dev, "Failed to enable iovcc supply: %d\n", ret);
- goto disable_vcc;
+ dev_err(ctx->dev, "Failed to enable vcc supply: %d\n", ret);
+ regulator_disable(ctx->iovcc);
+ return ret;
}
- gpiod_set_value_cansleep(ctx->reset_gpio, 1);
- usleep_range(20, 40);
+ /* 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;
return 0;
-
-disable_vcc:
- regulator_disable(ctx->vcc);
- return ret;
}
static int st7703_get_modes(struct drm_panel *panel,
--
2.34.0