]> git.baikalelectronics.ru Git - kernel.git/commit
drm/dbi: Fix SPI Type 1 (9-bit) transfer
authorPaul Cercueil <paul@crapouillou.net>
Fri, 3 Jul 2020 14:13:41 +0000 (16:13 +0200)
committerSam Ravnborg <sam@ravnborg.org>
Mon, 27 Jul 2020 18:29:44 +0000 (20:29 +0200)
commitf2474d5e8b9ca7aaa2f65098f14531cc5c7c0df4
tree3a25cabc151deb118911fd423df55a01b098b745
parent11194265cab25295cf19869f1868bd7dd93977bd
drm/dbi: Fix SPI Type 1 (9-bit) transfer

The function mipi_dbi_spi1_transfer() will transfer its payload as 9-bit
data, the 9th (MSB) bit being the data/command bit. In order to do that,
it unpacks the 8-bit values into 16-bit values, then sets the 9th bit if
the byte corresponds to data, clears it otherwise. The 7 MSB are
padding. The array of now 16-bit values is then passed to the SPI core
for transfer.

This function was broken since its introduction, as the length of the
SPI transfer was set to the payload size before its conversion, but the
payload doubled in size due to the 8-bit -> 16-bit conversion.

Fixes: 3b8ba8032e04 ("drm/tinydrm: Add MIPI DBI support")
Cc: <stable@vger.kernel.org> # 5.4+
Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Reviewed-by: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: Noralf Trønnes <noralf@tronnes.org>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200703141341.1266263-1-paul@crapouillou.net
drivers/gpu/drm/drm_mipi_dbi.c