All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/mcde: Retry DSI read/write transactions
@ 2020-07-30  8:13 ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2020-07-30  8:13 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul
  Cc: Linus Walleij, Stephan Gerhold, linux-arm-kernel

The vendor driver makes a few retries on read DSI
transactions, something that is needed especially in
case of read (such as reading the panel MTP ID) while
the panel is running in video mode. This happens on
the Samsung s6e63m0 panel on the Golden device.

Retry reads and writes alike two times.

Cc: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpu/drm/mcde/mcde_dsi.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index 337c4c5e3947..76fecd7ab658 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -207,8 +207,8 @@ static int mcde_dsi_host_detach(struct mipi_dsi_host *host,
 	 (type == MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM) || \
 	 (type == MIPI_DSI_DCS_READ))
 
-static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
-				      const struct mipi_dsi_msg *msg)
+static ssize_t mcde_dsi_host_transfer_commit(struct mipi_dsi_host *host,
+					     const struct mipi_dsi_msg *msg)
 {
 	struct mcde_dsi *d = host_to_mcde_dsi(host);
 	const u32 loop_delay_us = 10; /* us */
@@ -353,6 +353,23 @@ static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
 	return ret;
 }
 
+static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
+				      const struct mipi_dsi_msg *msg)
+{
+	struct mcde_dsi *d = host_to_mcde_dsi(host);
+	int retries = 2;
+	ssize_t ret;
+
+	while (retries--) {
+		ret = mcde_dsi_host_transfer_commit(host, msg);
+		if (ret >= 0)
+			return ret;
+	}
+
+	dev_err(d->dev, "gave up transfer after retrying\n");
+	return ret;
+}
+
 static const struct mipi_dsi_host_ops mcde_dsi_host_ops = {
 	.attach = mcde_dsi_host_attach,
 	.detach = mcde_dsi_host_detach,
-- 
2.26.2


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* [PATCH] drm/mcde: Retry DSI read/write transactions
@ 2020-07-30  8:13 ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2020-07-30  8:13 UTC (permalink / raw)
  To: dri-devel, Maarten Lankhorst, Maxime Ripard, Sean Paul
  Cc: Stephan Gerhold, linux-arm-kernel

The vendor driver makes a few retries on read DSI
transactions, something that is needed especially in
case of read (such as reading the panel MTP ID) while
the panel is running in video mode. This happens on
the Samsung s6e63m0 panel on the Golden device.

Retry reads and writes alike two times.

Cc: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/gpu/drm/mcde/mcde_dsi.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
index 337c4c5e3947..76fecd7ab658 100644
--- a/drivers/gpu/drm/mcde/mcde_dsi.c
+++ b/drivers/gpu/drm/mcde/mcde_dsi.c
@@ -207,8 +207,8 @@ static int mcde_dsi_host_detach(struct mipi_dsi_host *host,
 	 (type == MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM) || \
 	 (type == MIPI_DSI_DCS_READ))
 
-static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
-				      const struct mipi_dsi_msg *msg)
+static ssize_t mcde_dsi_host_transfer_commit(struct mipi_dsi_host *host,
+					     const struct mipi_dsi_msg *msg)
 {
 	struct mcde_dsi *d = host_to_mcde_dsi(host);
 	const u32 loop_delay_us = 10; /* us */
@@ -353,6 +353,23 @@ static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
 	return ret;
 }
 
+static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
+				      const struct mipi_dsi_msg *msg)
+{
+	struct mcde_dsi *d = host_to_mcde_dsi(host);
+	int retries = 2;
+	ssize_t ret;
+
+	while (retries--) {
+		ret = mcde_dsi_host_transfer_commit(host, msg);
+		if (ret >= 0)
+			return ret;
+	}
+
+	dev_err(d->dev, "gave up transfer after retrying\n");
+	return ret;
+}
+
 static const struct mipi_dsi_host_ops mcde_dsi_host_ops = {
 	.attach = mcde_dsi_host_attach,
 	.detach = mcde_dsi_host_detach,
-- 
2.26.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

* Re: [PATCH] drm/mcde: Retry DSI read/write transactions
  2020-07-30  8:13 ` Linus Walleij
@ 2020-07-30  9:25   ` Stephan Gerhold
  -1 siblings, 0 replies; 4+ messages in thread
From: Stephan Gerhold @ 2020-07-30  9:25 UTC (permalink / raw)
  To: Linus Walleij
  Cc: linux-arm-kernel, Sean Paul, Maarten Lankhorst, Maxime Ripard, dri-devel

On Thu, Jul 30, 2020 at 10:13:06AM +0200, Linus Walleij wrote:
> The vendor driver makes a few retries on read DSI
> transactions, something that is needed especially in
> case of read (such as reading the panel MTP ID) while
> the panel is running in video mode. This happens on
> the Samsung s6e63m0 panel on the Golden device.
> 

So this fixes reads from the panel for samsung-golden?

> Retry reads and writes alike two times.
> 
> Cc: Stephan Gerhold <stephan@gerhold.net>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpu/drm/mcde/mcde_dsi.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
> index 337c4c5e3947..76fecd7ab658 100644
> --- a/drivers/gpu/drm/mcde/mcde_dsi.c
> +++ b/drivers/gpu/drm/mcde/mcde_dsi.c
> @@ -207,8 +207,8 @@ static int mcde_dsi_host_detach(struct mipi_dsi_host *host,
>  	 (type == MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM) || \
>  	 (type == MIPI_DSI_DCS_READ))
>  
> -static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
> -				      const struct mipi_dsi_msg *msg)
> +static ssize_t mcde_dsi_host_transfer_commit(struct mipi_dsi_host *host,
> +					     const struct mipi_dsi_msg *msg)
>  {
>  	struct mcde_dsi *d = host_to_mcde_dsi(host);
>  	const u32 loop_delay_us = 10; /* us */
> @@ -353,6 +353,23 @@ static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
>  	return ret;
>  }
>  
> +static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
> +				      const struct mipi_dsi_msg *msg)
> +{
> +	struct mcde_dsi *d = host_to_mcde_dsi(host);
> +	int retries = 2;
> +	ssize_t ret;
> +
> +	while (retries--) {
> +		ret = mcde_dsi_host_transfer_commit(host, msg);
> +		if (ret >= 0)
> +			return ret;
> +	}

I wonder if it would be better to do this inside
mcde_dsi_host_transfer_commit() - it seems like the vendor driver only
retries triggering the command, i.e.

	writel(~0, d->regs + DSI_DIRECT_CMD_STS_CLR);
	writel(~0, d->regs + DSI_CMD_MODE_STS_CLR);
	/* Send command */
	writel(1, d->regs + DSI_DIRECT_CMD_SEND);

and does not write all the registers again.

> +
> +	dev_err(d->dev, "gave up transfer after retrying\n");
> +	return ret;
> +}
> +
>  static const struct mipi_dsi_host_ops mcde_dsi_host_ops = {
>  	.attach = mcde_dsi_host_attach,
>  	.detach = mcde_dsi_host_detach,
> -- 
> 2.26.2
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] drm/mcde: Retry DSI read/write transactions
@ 2020-07-30  9:25   ` Stephan Gerhold
  0 siblings, 0 replies; 4+ messages in thread
From: Stephan Gerhold @ 2020-07-30  9:25 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-arm-kernel, Sean Paul, dri-devel

On Thu, Jul 30, 2020 at 10:13:06AM +0200, Linus Walleij wrote:
> The vendor driver makes a few retries on read DSI
> transactions, something that is needed especially in
> case of read (such as reading the panel MTP ID) while
> the panel is running in video mode. This happens on
> the Samsung s6e63m0 panel on the Golden device.
> 

So this fixes reads from the panel for samsung-golden?

> Retry reads and writes alike two times.
> 
> Cc: Stephan Gerhold <stephan@gerhold.net>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
>  drivers/gpu/drm/mcde/mcde_dsi.c | 21 +++++++++++++++++++--
>  1 file changed, 19 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c
> index 337c4c5e3947..76fecd7ab658 100644
> --- a/drivers/gpu/drm/mcde/mcde_dsi.c
> +++ b/drivers/gpu/drm/mcde/mcde_dsi.c
> @@ -207,8 +207,8 @@ static int mcde_dsi_host_detach(struct mipi_dsi_host *host,
>  	 (type == MIPI_DSI_GENERIC_READ_REQUEST_2_PARAM) || \
>  	 (type == MIPI_DSI_DCS_READ))
>  
> -static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
> -				      const struct mipi_dsi_msg *msg)
> +static ssize_t mcde_dsi_host_transfer_commit(struct mipi_dsi_host *host,
> +					     const struct mipi_dsi_msg *msg)
>  {
>  	struct mcde_dsi *d = host_to_mcde_dsi(host);
>  	const u32 loop_delay_us = 10; /* us */
> @@ -353,6 +353,23 @@ static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
>  	return ret;
>  }
>  
> +static ssize_t mcde_dsi_host_transfer(struct mipi_dsi_host *host,
> +				      const struct mipi_dsi_msg *msg)
> +{
> +	struct mcde_dsi *d = host_to_mcde_dsi(host);
> +	int retries = 2;
> +	ssize_t ret;
> +
> +	while (retries--) {
> +		ret = mcde_dsi_host_transfer_commit(host, msg);
> +		if (ret >= 0)
> +			return ret;
> +	}

I wonder if it would be better to do this inside
mcde_dsi_host_transfer_commit() - it seems like the vendor driver only
retries triggering the command, i.e.

	writel(~0, d->regs + DSI_DIRECT_CMD_STS_CLR);
	writel(~0, d->regs + DSI_CMD_MODE_STS_CLR);
	/* Send command */
	writel(1, d->regs + DSI_DIRECT_CMD_SEND);

and does not write all the registers again.

> +
> +	dev_err(d->dev, "gave up transfer after retrying\n");
> +	return ret;
> +}
> +
>  static const struct mipi_dsi_host_ops mcde_dsi_host_ops = {
>  	.attach = mcde_dsi_host_attach,
>  	.detach = mcde_dsi_host_detach,
> -- 
> 2.26.2
> 
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

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

end of thread, other threads:[~2020-07-30  9:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-30  8:13 [PATCH] drm/mcde: Retry DSI read/write transactions Linus Walleij
2020-07-30  8:13 ` Linus Walleij
2020-07-30  9:25 ` Stephan Gerhold
2020-07-30  9:25   ` Stephan Gerhold

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.