From 3a63ef6e4b9e9db6d1e131f9477f0f4006c894d9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Otto=20Pfl=C3=BCger?= Date: Mon, 24 Jul 2023 08:56:54 +0200 Subject: [PATCH] drm/tiny: panel-mipi-dbi: Allow sharing the D/C GPIO MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Displays that are connected to the same SPI bus may share the D/C GPIO. Use GPIOD_FLAGS_BIT_NONEXCLUSIVE to allow access to the same GPIO for multiple panel-mipi-dbi instances. Exclusive access to the GPIO during transfers is ensured by the locking in drm_mipi_dbi.c. Signed-off-by: Otto Pflüger Signed-off-by: Noralf Trønnes Link: https://patchwork.freedesktop.org/patch/msgid/20230724065654.5269-3-otto.pflueger@abscue.de --- drivers/gpu/drm/tiny/panel-mipi-dbi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c b/drivers/gpu/drm/tiny/panel-mipi-dbi.c index eb9f13f..f80a141 100644 --- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c +++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c @@ -307,7 +307,8 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi) if (IS_ERR(dbi->reset)) return dev_err_probe(dev, PTR_ERR(dbi->reset), "Failed to get GPIO 'reset'\n"); - dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW); + /* Multiple panels can share the "dc" GPIO, but only if they are on the same SPI bus! */ + dc = devm_gpiod_get_optional(dev, "dc", GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE); if (IS_ERR(dc)) return dev_err_probe(dev, PTR_ERR(dc), "Failed to get GPIO 'dc'\n"); -- 2.7.4