If the SPI controller supports switching to 16-bit transfers, there
is no need to swap bytes on little-endian architectures. This also
allows to transfer directly from the 16-bit framebuffer.

Signed-off-by: Philipp Zabel <p.za...@pengutronix.de>
---
 drivers/video/mipi_dbi.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/mipi_dbi.c b/drivers/video/mipi_dbi.c
index e6a147a9bf36..30fba07acfb2 100644
--- a/drivers/video/mipi_dbi.c
+++ b/drivers/video/mipi_dbi.c
@@ -632,8 +632,7 @@ int mipi_dbi_spi_init(struct spi_device *spi, struct 
mipi_dbi *dbi,
 
        dbi->command = mipi_dbi_typec3_command;
        dbi->dc = dc;
-       // TODO: can we just force 16 bit?
-       if (mipi_dbi_machine_little_endian() && spi->bits_per_word != 16)
+       if (mipi_dbi_machine_little_endian() && !spi_is_bpw_supported(spi, 16))
                dbi->swap_bytes = true;
 
        dev_dbg(dev, "SPI speed: %uMHz\n", spi->max_speed_hz / 1000000);
-- 
2.39.2


Reply via email to