mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 3/4] video: mipi_dbi: disable byte swapping if 16-bit SPI transfers are supported
Date: Thu, 30 Mar 2023 12:33:58 +0200	[thread overview]
Message-ID: <20230330103359.2751080-3-p.zabel@pengutronix.de> (raw)
In-Reply-To: <20230330103359.2751080-1-p.zabel@pengutronix.de>

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@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




  parent reply	other threads:[~2023-03-30 10:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-30 10:33 [PATCH 1/4] spi: add per-driver bits-per-word mask Philipp Zabel
2023-03-30 10:33 ` [PATCH 2/4] spi: stm32: support per-transfer bits per word switching Philipp Zabel
2023-03-30 14:53   ` Philipp Zabel
2023-04-03  7:12     ` Sascha Hauer
2023-03-30 10:33 ` Philipp Zabel [this message]
2023-03-30 10:33 ` [PATCH 4/4] spi: update spi_board_info FIXME comment Philipp Zabel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230330103359.2751080-3-p.zabel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox