linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/1] drm/panel: st7703: Fix initialization failures on Xingbangda XBD599
@ 2023-02-11 17:17 Frank Oltmanns
  2023-02-11 17:17 ` [PATCH 1/1] drm/panel: st7703: Pick different reset sequence Frank Oltmanns
  2023-02-12 11:21 ` [PATCH 0/1] drm/panel: st7703: Fix initialization failures on Xingbangda XBD599 Guido Günther
  0 siblings, 2 replies; 7+ messages in thread
From: Frank Oltmanns @ 2023-02-11 17:17 UTC (permalink / raw)
  To: Guido Günther, Purism Kernel Team, Ondrej Jirman,
	Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	open list:DRM PANEL DRIVERS, open list
  Cc: Frank Oltmanns

This patch fixes intermittent panel initialization failures and screen
corruption during resume from sleep on panel xingbangda,xbd599 (e.g.
used in PinePhone).

It was originally submitted by Ondrej Jirman in July 2020:
https://lore.kernel.org/all/20200716123753.3552425-1-megous@megous.com/

The original patchset contained two patches. One of them broke the panel
on the Purism Librem 5.

This is the concluding message from Guido Günther in that thread:
https://lore.kernel.org/all/20200801110409.GA6351@bogon.m.sigxcpu.org/#t

Guido wanted changes to the commit message. I updated it to adress his
requests.

I send this patch in Ondřej's name with his consent.

The patch is based on drm-next.

Please let me know what you think.

Thanks,
  Frank

Ondrej Jirman (1):
  drm/panel: st7703: Pick different reset sequence

 drivers/gpu/drm/panel/panel-sitronix-st7703.c | 25 ++++++++++---------
 1 file changed, 13 insertions(+), 12 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/1] drm/panel: st7703: Pick different reset sequence
  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
  2023-10-15 10:59   ` Guido Günther
  2023-10-15 12:49   ` Guido Günther
  2023-02-12 11:21 ` [PATCH 0/1] drm/panel: st7703: Fix initialization failures on Xingbangda XBD599 Guido Günther
  1 sibling, 2 replies; 7+ messages in thread
From: Frank Oltmanns @ 2023-02-11 17:17 UTC (permalink / raw)
  To: Guido Günther, Purism Kernel Team, Ondrej Jirman,
	Thierry Reding, Sam Ravnborg, David Airlie, Daniel Vetter,
	open list:DRM PANEL DRIVERS, open list
  Cc: Ondrej Jirman, Frank Oltmanns, Samuel Holland

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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/1] drm/panel: st7703: Fix initialization failures on Xingbangda XBD599
  2023-02-11 17:17 [PATCH 0/1] drm/panel: st7703: Fix initialization failures on Xingbangda XBD599 Frank Oltmanns
  2023-02-11 17:17 ` [PATCH 1/1] drm/panel: st7703: Pick different reset sequence Frank Oltmanns
@ 2023-02-12 11:21 ` Guido Günther
  2023-02-12 12:09   ` Frank Oltmanns
  1 sibling, 1 reply; 7+ messages in thread
From: Guido Günther @ 2023-02-12 11:21 UTC (permalink / raw)
  To: Frank Oltmanns
  Cc: Purism Kernel Team, Ondrej Jirman, Thierry Reding, Sam Ravnborg,
	David Airlie, Daniel Vetter, open list:DRM PANEL DRIVERS,
	open list

Hi Frank,

Thanks for giving this another spin!

On Sat, Feb 11, 2023 at 06:17:47PM +0100, Frank Oltmanns wrote:
> This patch fixes intermittent panel initialization failures and screen
> corruption during resume from sleep on panel xingbangda,xbd599 (e.g.
> used in PinePhone).
> 
> It was originally submitted by Ondrej Jirman in July 2020:
> https://lore.kernel.org/all/20200716123753.3552425-1-megous@megous.com/
> 
> The original patchset contained two patches. One of them broke the panel
> on the Purism Librem 5.

Just for completeness: It's the Librem 5 Devkit, the Librem 5 uses the
mantix,mlaf057we51-x panel.

> This is the concluding message from Guido Günther in that thread:
> https://lore.kernel.org/all/20200801110409.GA6351@bogon.m.sigxcpu.org/#t
> 
> Guido wanted changes to the commit message. I updated it to adress his
> requests.
> 
> I send this patch in Ondřej's name with his consent.
> 
> The patch is based on drm-next.
> 
> Please let me know what you think.

I'll retest this on the devkit on the next days, might be a moment until
I get to that.

Cheers,
 -- Guido

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/1] drm/panel: st7703: Fix initialization failures on Xingbangda XBD599
  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
  0 siblings, 0 replies; 7+ messages in thread
From: Frank Oltmanns @ 2023-02-12 12:09 UTC (permalink / raw)
  To: Guido Günther
  Cc: Purism Kernel Team, Ondrej Jirman, Thierry Reding, Sam Ravnborg,
	David Airlie, Daniel Vetter, open list:DRM PANEL DRIVERS,
	open list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: multipart/mixed; boundary="=-=-=", Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] drm/panel: st7703: Pick different reset sequence
  2023-02-11 17:17 ` [PATCH 1/1] drm/panel: st7703: Pick different reset sequence Frank Oltmanns
@ 2023-10-15 10:59   ` Guido Günther
  2023-10-15 12:49   ` Guido Günther
  1 sibling, 0 replies; 7+ messages in thread
From: Guido Günther @ 2023-10-15 10:59 UTC (permalink / raw)
  To: Frank Oltmanns
  Cc: Purism Kernel Team, Ondrej Jirman, Thierry Reding, Sam Ravnborg,
	David Airlie, Daniel Vetter, open list:DRM PANEL DRIVERS,
	open list, Ondrej Jirman, Samuel Holland

Hi,
On Sat, Feb 11, 2023 at 06:17:48PM +0100, Frank Oltmanns wrote:
> 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[] = {

Reviewed-by: Guido Günther <agx@sigxcpu.org>

Cheers,
 -- Guido

> -- 
> 2.39.1
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] drm/panel: st7703: Pick different reset sequence
  2023-02-11 17:17 ` [PATCH 1/1] drm/panel: st7703: Pick different reset sequence Frank Oltmanns
  2023-10-15 10:59   ` Guido Günther
@ 2023-10-15 12:49   ` Guido Günther
  2023-10-18 14:59     ` Chris Morgan
  1 sibling, 1 reply; 7+ messages in thread
From: Guido Günther @ 2023-10-15 12:49 UTC (permalink / raw)
  To: Frank Oltmanns
  Cc: Purism Kernel Team, Ondrej Jirman, Thierry Reding, Sam Ravnborg,
	David Airlie, Daniel Vetter, open list:DRM PANEL DRIVERS,
	open list, phone-devel, Ondrej Jirman, Samuel Holland

Hi,
On Sat, Feb 11, 2023 at 06:17:48PM +0100, Frank Oltmanns wrote:
> 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).

Thanks, applied to drm-misc-next.
Cheers,
 -- Guido

> 
> 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
> 

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 1/1] drm/panel: st7703: Pick different reset sequence
  2023-10-15 12:49   ` Guido Günther
@ 2023-10-18 14:59     ` Chris Morgan
  0 siblings, 0 replies; 7+ messages in thread
From: Chris Morgan @ 2023-10-18 14:59 UTC (permalink / raw)
  To: Guido Günther
  Cc: Frank Oltmanns, Ondrej Jirman, Purism Kernel Team,
	Samuel Holland, Sam Ravnborg, open list,
	open list:DRM PANEL DRIVERS, Thierry Reding, Ondrej Jirman,
	phone-devel

On Sun, Oct 15, 2023 at 02:49:20PM +0200, Guido Günther wrote:
> Hi,
> On Sat, Feb 11, 2023 at 06:17:48PM +0100, Frank Oltmanns wrote:
> > 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).
> 
> Thanks, applied to drm-misc-next.
> Cheers,
>  -- Guido

Thank you. Probably too late, but this fixes problems I have with a
different ST7703 based panel.

Tested-by: Chris Morgan <macromorgan@hotmail.com>

> 
> > 
> > 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
> > 

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-10-18 14:59 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-11 17:17 [PATCH 0/1] drm/panel: st7703: Fix initialization failures on Xingbangda XBD599 Frank Oltmanns
2023-02-11 17:17 ` [PATCH 1/1] drm/panel: st7703: Pick different reset sequence Frank Oltmanns
2023-10-15 10:59   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).