summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/tiny/ili9225.c
diff options
context:
space:
mode:
authorOtto Pflüger <otto.pflueger@abscue.de>2023-07-24 08:56:53 +0200
committerNoralf Trønnes <noralf@tronnes.org>2023-08-02 13:18:07 +0200
commit8cc8ccbaa5d89b65a32f0260b0cd2288d2c9b6dc (patch)
tree02179c3cc499b92f0aab81412628704415a5c0a3 /drivers/gpu/drm/tiny/ili9225.c
parent8e4bb53c902ed2b06a2c4778e6dbb2c1eeec4960 (diff)
downloadlinux-stable-8cc8ccbaa5d89b65a32f0260b0cd2288d2c9b6dc.tar.gz
linux-stable-8cc8ccbaa5d89b65a32f0260b0cd2288d2c9b6dc.tar.bz2
linux-stable-8cc8ccbaa5d89b65a32f0260b0cd2288d2c9b6dc.zip
drm/mipi-dbi: Lock SPI bus before setting D/C GPIO
Multiple displays may be connected to the same bus and share a D/C GPIO, so the display driver needs exclusive access to the bus to ensure that it can control the D/C GPIO safely. Signed-off-by: Otto Pflüger <otto.pflueger@abscue.de> Reviewed-by: Noralf Trønnes <noralf@tronnes.org> Acked-by: David Lechner <david@lechnology.com> Signed-off-by: Noralf Trønnes <noralf@tronnes.org> Link: https://patchwork.freedesktop.org/patch/msgid/20230724065654.5269-2-otto.pflueger@abscue.de
Diffstat (limited to 'drivers/gpu/drm/tiny/ili9225.c')
-rw-r--r--drivers/gpu/drm/tiny/ili9225.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/gpu/drm/tiny/ili9225.c b/drivers/gpu/drm/tiny/ili9225.c
index 077c6ff5a2e1..4ceb68ffac4b 100644
--- a/drivers/gpu/drm/tiny/ili9225.c
+++ b/drivers/gpu/drm/tiny/ili9225.c
@@ -316,19 +316,24 @@ static int ili9225_dbi_command(struct mipi_dbi *dbi, u8 *cmd, u8 *par,
u32 speed_hz;
int ret;
+ spi_bus_lock(spi->controller);
gpiod_set_value_cansleep(dbi->dc, 0);
speed_hz = mipi_dbi_spi_cmd_max_speed(spi, 1);
ret = mipi_dbi_spi_transfer(spi, speed_hz, 8, cmd, 1);
+ spi_bus_unlock(spi->controller);
if (ret || !num)
return ret;
if (*cmd == ILI9225_WRITE_DATA_TO_GRAM && !dbi->swap_bytes)
bpw = 16;
+ spi_bus_lock(spi->controller);
gpiod_set_value_cansleep(dbi->dc, 1);
speed_hz = mipi_dbi_spi_cmd_max_speed(spi, num);
+ ret = mipi_dbi_spi_transfer(spi, speed_hz, bpw, par, num);
+ spi_bus_unlock(spi->controller);
- return mipi_dbi_spi_transfer(spi, speed_hz, bpw, par, num);
+ return ret;
}
static const struct drm_simple_display_pipe_funcs ili9225_pipe_funcs = {