public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 0/1] drm/panel: st7703: Fix resume of XBD599 panel
@ 2023-02-13 12:32 Frank Oltmanns
  2023-02-13 12:32 ` [PATCH v2 1/1] drm/panel: st7703: Fix timings when entering/exiting sleep Frank Oltmanns
  0 siblings, 1 reply; 4+ messages in thread
From: Frank Oltmanns @ 2023-02-13 12:32 UTC (permalink / raw)
  To: Ondrej Jirman, 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 is V2 of a patch that fixes flickering after resume from sleep on
panel xingbangda,xbd599 (e.g. used in PinePhone).

Please see here for the discussion around V1:
https://lore.kernel.org/all/20230212120830.46880-1-frank@oltmanns.dev/T/

V1 introduced panel specific functions for the JH057N and XBD599 panels.
Ondřej Dirman deemed this unneccesary and finally convinced me.

Therefore, V2 is a much simpler patch.

The patch is just a refactoring of Ondřej's original patch, that is
already used today by PinePhone distributions like PostmarketOS.

This patch has not been tested with the JH057N panel used in the Librem
5 devkit. I hereby kindly ask for Librem (i.e. Guido) to test this.

The patch is based on drm-next.

Ondřej, since this is just a very minor refactoring of your work, I
would gladly put you as the author, if you wish so.

Thanks,
  Frank

Frank Oltmanns (1):
  drm/panel: st7703: Fix timings when entering/exiting sleep

 drivers/gpu/drm/panel/panel-sitronix-st7703.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-- 
2.39.1


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

* [PATCH v2 1/1] drm/panel: st7703: Fix timings when entering/exiting sleep
  2023-02-13 12:32 [PATCH v2 0/1] drm/panel: st7703: Fix resume of XBD599 panel Frank Oltmanns
@ 2023-02-13 12:32 ` Frank Oltmanns
  2023-08-29 16:16   ` Guido Günther
  2023-10-15 12:50   ` Guido Günther
  0 siblings, 2 replies; 4+ messages in thread
From: Frank Oltmanns @ 2023-02-13 12:32 UTC (permalink / raw)
  To: Ondrej Jirman, 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, Samuel Holland

Fix flickering of the pinephone's XDB599 panel that happens after
resume.

Extend the delay after issuing the command to exit sleep mode from 60 to
120 msec as per the controller's specification.

Introduce a 120 msec delay after issuing the command to enter sleep
mode. This is needed in order for the controller to reliably finalize
the sleep in sequence before switching of power supply.

In contrast to the JH057N panel, the XBD599 panel does not require a 20
msec delay after initialization and exiting sleep mode. Therefore, move
the delay into the already existing device specific initialization
function.

The XDB599 does not require a 20 msec delay between the SETBGP and
SETVCOM commands. Therefore, remove the delay from the device specific
initialization function.

Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
Cc: Ondrej Jirman <megi@xff.cz>
Reported-by: Samuel Holland <samuel@sholland.org>
---
 drivers/gpu/drm/panel/panel-sitronix-st7703.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
index 6747ca237ced..c49f4ef883fc 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
@@ -126,6 +126,7 @@ static int jh057n_init_sequence(struct st7703 *ctx)
 				   0x18, 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41,
 				   0x37, 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10,
 				   0x11, 0x18);
+	msleep(20);
 
 	return 0;
 }
@@ -273,7 +274,6 @@ static int xbd599_init_sequence(struct st7703 *ctx)
 	mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP,
 			       0x07, /* VREF_SEL = 4.2V */
 			       0x07  /* NVREF_SEL = 4.2V */);
-	msleep(20);
 
 	mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM,
 			       0x2C, /* VCOMDC_F = -0.67V */
@@ -350,16 +350,14 @@ static int st7703_enable(struct drm_panel *panel)
 		return ret;
 	}
 
-	msleep(20);
-
 	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
 	if (ret < 0) {
 		dev_err(ctx->dev, "Failed to exit sleep mode: %d\n", ret);
 		return ret;
 	}
 
-	/* Panel is operational 120 msec after reset */
-	msleep(60);
+	/* It takes the controller 120 msec to wake up after sleep. */
+	msleep(120);
 
 	ret = mipi_dsi_dcs_set_display_on(dsi);
 	if (ret)
@@ -384,6 +382,9 @@ static int st7703_disable(struct drm_panel *panel)
 	if (ret < 0)
 		dev_err(ctx->dev, "Failed to enter sleep mode: %d\n", ret);
 
+	/* It takes the controller 120 msec to enter sleep mode. */
+	msleep(120);
+
 	return 0;
 }
 
-- 
2.39.1


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

* Re: [PATCH v2 1/1] drm/panel: st7703: Fix timings when entering/exiting sleep
  2023-02-13 12:32 ` [PATCH v2 1/1] drm/panel: st7703: Fix timings when entering/exiting sleep Frank Oltmanns
@ 2023-08-29 16:16   ` Guido Günther
  2023-10-15 12:50   ` Guido Günther
  1 sibling, 0 replies; 4+ messages in thread
From: Guido Günther @ 2023-08-29 16:16 UTC (permalink / raw)
  To: Frank Oltmanns
  Cc: Ondrej Jirman, Purism Kernel Team, Ondrej Jirman, Thierry Reding,
	Sam Ravnborg, David Airlie, Daniel Vetter,
	open list:DRM PANEL DRIVERS, open list, Samuel Holland

Hi,
On Mon, Feb 13, 2023 at 01:32:38PM +0100, Frank Oltmanns wrote:
> Fix flickering of the pinephone's XDB599 panel that happens after
> resume.
> 
> Extend the delay after issuing the command to exit sleep mode from 60 to
> 120 msec as per the controller's specification.
> 
> Introduce a 120 msec delay after issuing the command to enter sleep
> mode. This is needed in order for the controller to reliably finalize
> the sleep in sequence before switching of power supply.
> 
> In contrast to the JH057N panel, the XBD599 panel does not require a 20
> msec delay after initialization and exiting sleep mode. Therefore, move
> the delay into the already existing device specific initialization
> function.
> 
> The XDB599 does not require a 20 msec delay between the SETBGP and
> SETVCOM commands. Therefore, remove the delay from the device specific
> initialization function.
> 
> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
> Cc: Ondrej Jirman <megi@xff.cz>
> Reported-by: Samuel Holland <samuel@sholland.org>
> ---
>  drivers/gpu/drm/panel/panel-sitronix-st7703.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> index 6747ca237ced..c49f4ef883fc 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> @@ -126,6 +126,7 @@ static int jh057n_init_sequence(struct st7703 *ctx)
>  				   0x18, 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41,
>  				   0x37, 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10,
>  				   0x11, 0x18);
> +	msleep(20);
>  
>  	return 0;
>  }
> @@ -273,7 +274,6 @@ static int xbd599_init_sequence(struct st7703 *ctx)
>  	mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP,
>  			       0x07, /* VREF_SEL = 4.2V */
>  			       0x07  /* NVREF_SEL = 4.2V */);
> -	msleep(20);
>  
>  	mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM,
>  			       0x2C, /* VCOMDC_F = -0.67V */
> @@ -350,16 +350,14 @@ static int st7703_enable(struct drm_panel *panel)
>  		return ret;
>  	}
>  
> -	msleep(20);
> -
>  	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
>  	if (ret < 0) {
>  		dev_err(ctx->dev, "Failed to exit sleep mode: %d\n", ret);
>  		return ret;
>  	}
>  
> -	/* Panel is operational 120 msec after reset */
> -	msleep(60);
> +	/* It takes the controller 120 msec to wake up after sleep. */
> +	msleep(120);
>  
>  	ret = mipi_dsi_dcs_set_display_on(dsi);
>  	if (ret)
> @@ -384,6 +382,9 @@ static int st7703_disable(struct drm_panel *panel)
>  	if (ret < 0)
>  		dev_err(ctx->dev, "Failed to enter sleep mode: %d\n", ret);
>  
> +	/* It takes the controller 120 msec to enter sleep mode. */
> +	msleep(120);
> +
>  	return 0;
>  }

Tested this patch on a Librem 5 devkit.

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

Cheers,
 -- Guido

>  
> -- 
> 2.39.1
> 

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

* Re: [PATCH v2 1/1] drm/panel: st7703: Fix timings when entering/exiting sleep
  2023-02-13 12:32 ` [PATCH v2 1/1] drm/panel: st7703: Fix timings when entering/exiting sleep Frank Oltmanns
  2023-08-29 16:16   ` Guido Günther
@ 2023-10-15 12:50   ` Guido Günther
  1 sibling, 0 replies; 4+ messages in thread
From: Guido Günther @ 2023-10-15 12:50 UTC (permalink / raw)
  To: Frank Oltmanns
  Cc: Ondrej Jirman, Purism Kernel Team, Ondrej Jirman, Thierry Reding,
	Sam Ravnborg, David Airlie, Daniel Vetter,
	open list:DRM PANEL DRIVERS, open list, phone-devel,
	Samuel Holland

Hi,
On Mon, Feb 13, 2023 at 01:32:38PM +0100, Frank Oltmanns wrote:
> Fix flickering of the pinephone's XDB599 panel that happens after
> resume.
> 
> Extend the delay after issuing the command to exit sleep mode from 60 to
> 120 msec as per the controller's specification.
> 
> Introduce a 120 msec delay after issuing the command to enter sleep
> mode. This is needed in order for the controller to reliably finalize
> the sleep in sequence before switching of power supply.
> 
> In contrast to the JH057N panel, the XBD599 panel does not require a 20
> msec delay after initialization and exiting sleep mode. Therefore, move
> the delay into the already existing device specific initialization
> function.
> 
> The XDB599 does not require a 20 msec delay between the SETBGP and
> SETVCOM commands. Therefore, remove the delay from the device specific
> initialization function.

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

> Signed-off-by: Frank Oltmanns <frank@oltmanns.dev>
> Cc: Ondrej Jirman <megi@xff.cz>
> Reported-by: Samuel Holland <samuel@sholland.org>
> ---
>  drivers/gpu/drm/panel/panel-sitronix-st7703.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7703.c b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> index 6747ca237ced..c49f4ef883fc 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7703.c
> @@ -126,6 +126,7 @@ static int jh057n_init_sequence(struct st7703 *ctx)
>  				   0x18, 0x00, 0x09, 0x0E, 0x29, 0x2D, 0x3C, 0x41,
>  				   0x37, 0x07, 0x0B, 0x0D, 0x10, 0x11, 0x0F, 0x10,
>  				   0x11, 0x18);
> +	msleep(20);
>  
>  	return 0;
>  }
> @@ -273,7 +274,6 @@ static int xbd599_init_sequence(struct st7703 *ctx)
>  	mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETBGP,
>  			       0x07, /* VREF_SEL = 4.2V */
>  			       0x07  /* NVREF_SEL = 4.2V */);
> -	msleep(20);
>  
>  	mipi_dsi_dcs_write_seq(dsi, ST7703_CMD_SETVCOM,
>  			       0x2C, /* VCOMDC_F = -0.67V */
> @@ -350,16 +350,14 @@ static int st7703_enable(struct drm_panel *panel)
>  		return ret;
>  	}
>  
> -	msleep(20);
> -
>  	ret = mipi_dsi_dcs_exit_sleep_mode(dsi);
>  	if (ret < 0) {
>  		dev_err(ctx->dev, "Failed to exit sleep mode: %d\n", ret);
>  		return ret;
>  	}
>  
> -	/* Panel is operational 120 msec after reset */
> -	msleep(60);
> +	/* It takes the controller 120 msec to wake up after sleep. */
> +	msleep(120);
>  
>  	ret = mipi_dsi_dcs_set_display_on(dsi);
>  	if (ret)
> @@ -384,6 +382,9 @@ static int st7703_disable(struct drm_panel *panel)
>  	if (ret < 0)
>  		dev_err(ctx->dev, "Failed to enter sleep mode: %d\n", ret);
>  
> +	/* It takes the controller 120 msec to enter sleep mode. */
> +	msleep(120);
> +
>  	return 0;
>  }
>  
> -- 
> 2.39.1
> 

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

end of thread, other threads:[~2023-10-15 12:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-13 12:32 [PATCH v2 0/1] drm/panel: st7703: Fix resume of XBD599 panel Frank Oltmanns
2023-02-13 12:32 ` [PATCH v2 1/1] drm/panel: st7703: Fix timings when entering/exiting sleep Frank Oltmanns
2023-08-29 16:16   ` Guido Günther
2023-10-15 12:50   ` Guido Günther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox