[PATCH v2 3/4] video: mipi_dbi: disable byte swapping if 16-bit SPI transfers are supported

Philipp Zabel p.zabel at pengutronix.de
Mon Apr 3 04:53:39 PDT 2023


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.zabel at 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 61b0fbcc49c6..aab6b1243954 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




More information about the barebox mailing list