[PATCH v2 2/2] drm/tiny: panel-mipi-dbi: Allow sharing the D/C GPIO

Noralf Trønnes noralf at tronnes.org
Sun Jul 23 11:59:45 UTC 2023



On 7/20/23 12:26, Otto Pflüger wrote:
> 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 <otto.pflueger at 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 eb9f13f18a02..e616e3890043 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);

Please add a comment here that sharing only works when on the same SPI bus.

> +	dc = devm_gpiod_get_optional(dev, "dc",
> +				     GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_NONEXCLUSIVE);

I'd prefer this to be on one line, the 80 column limit has been upped to
a 100 now.

Noralf.

>  	if (IS_ERR(dc))
>  		return dev_err_probe(dev, PTR_ERR(dc), "Failed to get GPIO 'dc'\n");
>  


More information about the dri-devel mailing list