Skip to content

Commit 46d8a07

Browse files
committed
drm/sitronix/st7586: fix bad pixel data due to byte swap
Correctly set dbi->write_memory_bpw for the ST7586 driver. This driver is for a monochrome display that has an unusual data format, so the default value set in mipi_dbi_spi_init() is not correct simply because this controller is non-standard. Previously, we were using dbi->swap_bytes to make the same sort of workaround, but it was removed in the same commit that added dbi->write_memory_bpw, so we need to use the latter now to have the correct behavior. This fixes every 3 columns of pixels being swapped on the display. There are 3 pixels per byte, so the byte swap caused this effect. Fixes: df3fb27 ("drm/mipi-dbi: Make bits per word configurable for pixel transfers") Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Signed-off-by: David Lechner <dlechner@baylibre.com> Link: https://patch.msgid.link/20260228-drm-mipi-dbi-fix-st7586-byte-swap-v1-1-e78f6c24cd28@baylibre.com
1 parent 021f1b7 commit 46d8a07

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

drivers/gpu/drm/sitronix/st7586.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,12 @@ static int st7586_probe(struct spi_device *spi)
347347
if (ret)
348348
return ret;
349349

350+
/*
351+
* Override value set by mipi_dbi_spi_init(). This driver is a bit
352+
* non-standard, so best to set it explicitly here.
353+
*/
354+
dbi->write_memory_bpw = 8;
355+
350356
/* Cannot read from this controller via SPI */
351357
dbi->read_commands = NULL;
352358

@@ -356,15 +362,6 @@ static int st7586_probe(struct spi_device *spi)
356362
if (ret)
357363
return ret;
358364

359-
/*
360-
* we are using 8-bit data, so we are not actually swapping anything,
361-
* but setting mipi->swap_bytes makes mipi_dbi_typec3_command() do the
362-
* right thing and not use 16-bit transfers (which results in swapped
363-
* bytes on little-endian systems and causes out of order data to be
364-
* sent to the display).
365-
*/
366-
dbi->swap_bytes = true;
367-
368365
drm_mode_config_reset(drm);
369366

370367
ret = drm_dev_register(drm, 0);

0 commit comments

Comments
 (0)