On 17/11/2022 12:09, Mark Brown wrote:
I don't understand what the commit log is saying here. The
meson-spicc driver advertises support for 8 bit words, if the driver
is sending data formatted as a byte stream everything should be fine.
It may be that there is some optimisation available from taking
advantage of the hardware's ability to handle larger word sizes but
there should be no data corruption issue.
There is no data corruption but the 16-bit pixel data have per-pixel
bytes swapped: for example 0x55AD is sent instead of 0xAD55 and this is
causing the wrong color to be displayed on the panel.
The problem is that the current code is sending data with an hardcoded
bpw == 8 whether the data is swapped or not before the sending.
For 8-bit only controllers the data is swapped by the MIPI DBI code but
this is not true for controllers supporting 16-bit as well, but in both
cases we are sending the data out the same way with an 8 bpw.
So the same image is basically displayed differently whether the SPI
controller supports 16 bpw or not. I'm trying to fix this by sending
data with 16-bit bpw when the controller is supporting that.
Please note that this is what it is done also by mipi_dbi_typec3_command().
+ /* + * Check whether pixel data bytes needs to be swapped or not
+ */ + if (*cmd == MIPI_DCS_WRITE_MEMORY_START &&
!mipi->swap_bytes) + bpw = 16; +
You should check the SPI controller compatibility here.
This is already done in mipi_dbi_spi_init() by using spi_is_bpw_supported().
Cheers,
--
Carlo Caione