diff mbox series

[2/7] drm/panel: sitronix-st7789v: Use 9 bits per spi word by default

Message ID 20230609145951.853533-3-miquel.raynal@bootlin.com (mailing list archive)
State New, archived
Headers show
Series drm/panel: sitronix-st7789v: Support ET028013DMA panel | expand

Commit Message

Miquel Raynal June 9, 2023, 2:59 p.m. UTC
The Sitronix controller expects 9-bit words, provide this as default at
probe time rather than specifying this in each and every access.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

Comments

Sam Ravnborg June 10, 2023, 8:09 p.m. UTC | #1
On Fri, Jun 09, 2023 at 04:59:46PM +0200, Miquel Raynal wrote:
> The Sitronix controller expects 9-bit words, provide this as default at
> probe time rather than specifying this in each and every access.
> 
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> ---
>  drivers/gpu/drm/panel/panel-sitronix-st7789v.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> index c67b9adb157f..e9ca7ebb458a 100644
> --- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> +++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
> @@ -138,7 +138,6 @@ static int st7789v_spi_write(struct st7789v *ctx, enum st7789v_prefix prefix,
>  	spi_message_init(&msg);
>  
>  	xfer.tx_buf = &txbuf;
> -	xfer.bits_per_word = 9;
>  	xfer.len = sizeof(txbuf);
>  
>  	spi_message_add_tail(&xfer, &msg);
> @@ -365,6 +364,13 @@ static int st7789v_probe(struct spi_device *spi)
>  	spi_set_drvdata(spi, ctx);
>  	ctx->spi = spi;
>  
> +	spi->bits_per_word = 9;
> +	ret = spi_setup(spi);
> +	if (ret < 0) {
> +		dev_err(&spi->dev, "spi_setup failed: %d\n", ret);
> +		return ret;
> +	}

Use dev_err_probe().
With this change:
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>

> +
>  	drm_panel_init(&ctx->panel, &spi->dev, &st7789v_drm_funcs,
>  		       DRM_MODE_CONNECTOR_DPI);
>  
> -- 
> 2.34.1
diff mbox series

Patch

diff --git a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
index c67b9adb157f..e9ca7ebb458a 100644
--- a/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
+++ b/drivers/gpu/drm/panel/panel-sitronix-st7789v.c
@@ -138,7 +138,6 @@  static int st7789v_spi_write(struct st7789v *ctx, enum st7789v_prefix prefix,
 	spi_message_init(&msg);
 
 	xfer.tx_buf = &txbuf;
-	xfer.bits_per_word = 9;
 	xfer.len = sizeof(txbuf);
 
 	spi_message_add_tail(&xfer, &msg);
@@ -365,6 +364,13 @@  static int st7789v_probe(struct spi_device *spi)
 	spi_set_drvdata(spi, ctx);
 	ctx->spi = spi;
 
+	spi->bits_per_word = 9;
+	ret = spi_setup(spi);
+	if (ret < 0) {
+		dev_err(&spi->dev, "spi_setup failed: %d\n", ret);
+		return ret;
+	}
+
 	drm_panel_init(&ctx->panel, &spi->dev, &st7789v_drm_funcs,
 		       DRM_MODE_CONNECTOR_DPI);