public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frank Oltmanns <frank@oltmanns.dev>
To: "Guido Günther" <agx@sigxcpu.org>,
	"Purism Kernel Team" <kernel@puri.sm>,
	"Ondrej Jirman" <megous@megous.com>,
	"Thierry Reding" <thierry.reding@gmail.com>,
	"Sam Ravnborg" <sam@ravnborg.org>,
	"David Airlie" <airlied@gmail.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	dri-devel@lists.freedesktop.org (open list:DRM PANEL DRIVERS),
	linux-kernel@vger.kernel.org (open list)
Cc: Ondrej Jirman <megi@xff.cz>, Frank Oltmanns <frank@oltmanns.dev>,
	Samuel Holland <samuel@sholland.org>
Subject: [PATCH 1/1] drm/panel: st7703: Pick different reset sequence
Date: Sat, 11 Feb 2023 18:17:48 +0100	[thread overview]
Message-ID: <20230211171748.36692-2-frank@oltmanns.dev> (raw)
In-Reply-To: <20230211171748.36692-1-frank@oltmanns.dev>

From: Ondrej Jirman <megi@xff.cz>

Switching to a different reset sequence, enabling IOVCC before enabling
VCC.

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 panel xingbangda,xbd599 (e.g.
used in PinePhone).

Signed-off-by: Ondrej Jirman <megi@xff.cz>
Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
Reported-by: Samuel Holland <samuel@sholland.org>
---
 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 6747ca237ced..45695aa51f62 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -411,29 +411,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 const u32 mantix_bus_formats[] = {
-- 
2.39.1


  reply	other threads:[~2023-02-11 17:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-11 17:17 [PATCH 0/1] drm/panel: st7703: Fix initialization failures on Xingbangda XBD599 Frank Oltmanns
2023-02-11 17:17 ` Frank Oltmanns [this message]
2023-10-15 10:59   ` [PATCH 1/1] drm/panel: st7703: Pick different reset sequence Guido Günther
2023-10-15 12:49   ` Guido Günther
2023-10-18 14:59     ` Chris Morgan
2023-02-12 11:21 ` [PATCH 0/1] drm/panel: st7703: Fix initialization failures on Xingbangda XBD599 Guido Günther
2023-02-12 12:09   ` Frank Oltmanns

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230211171748.36692-2-frank@oltmanns.dev \
    --to=frank@oltmanns.dev \
    --cc=agx@sigxcpu.org \
    --cc=airlied@gmail.com \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel@puri.sm \
    --cc=linux-kernel@vger.kernel.org \
    --cc=megi@xff.cz \
    --cc=megous@megous.com \
    --cc=sam@ravnborg.org \
    --cc=samuel@sholland.org \
    --cc=thierry.reding@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox