[PATCH] backlight: lms283gf05: Convert to GPIO descriptors

Daniel Thompson daniel.thompson at linaro.org
Wed Apr 29 11:33:05 UTC 2020


On Wed, Apr 29, 2020 at 10:26:31AM +0200, Linus Walleij wrote:
> This converts the lms283gf05 backlight driver to use GPIO
> descriptors and switches the single PXA Palm Z2 device
> over to defining these.
> 
> Since the platform data was only used to convey GPIO
> information we can delete the platform data header.
> 
> Notice that we define the proper active low semantics in
> the board file GPIO descriptor table (active low) and
> assert the reset line by bringing it to "1" (asserted).
> 
> Cc: Marek Vasut <marex at denx.de>
> Cc: Daniel Mack <daniel at zonque.org>
> Cc: Haojian Zhuang <haojian.zhuang at gmail.com>
> Cc: Robert Jarzmik <robert.jarzmik at free.fr>
> Signed-off-by: Linus Walleij <linus.walleij at linaro.org>
> ---
> Marek: I saw this was written by you, are you regularly
> testing the Z2 device?
> ---
>  arch/arm/mach-pxa/z2.c               | 12 ++++++---
>  drivers/video/backlight/lms283gf05.c | 39 +++++++++++-----------------
>  include/linux/spi/lms283gf05.h       | 16 ------------
>  3 files changed, 23 insertions(+), 44 deletions(-)
>  delete mode 100644 include/linux/spi/lms283gf05.h
> 
> diff --git a/drivers/video/backlight/lms283gf05.c b/drivers/video/backlight/lms283gf05.c
> index 0e45685bcc1c..71a26b8b7d3f 100644
> --- a/drivers/video/backlight/lms283gf05.c
> +++ b/drivers/video/backlight/lms283gf05.c
> @@ -150,18 +147,12 @@ static struct lcd_ops lms_ops = {
>  static int lms283gf05_probe(struct spi_device *spi)
>  {
>  	struct lms283gf05_state *st;
> -	struct lms283gf05_pdata *pdata = dev_get_platdata(&spi->dev);
>  	struct lcd_device *ld;
>  	int ret = 0;
>  
> -	if (pdata != NULL) {
> -		ret = devm_gpio_request_one(&spi->dev, pdata->reset_gpio,
> -				GPIOF_DIR_OUT | (!pdata->reset_inverted ?
> -				GPIOF_INIT_HIGH : GPIOF_INIT_LOW),
> -				"LMS283GF05 RESET");
> -		if (ret)
> -			return ret;
> -	}
> +	st->reset = gpiod_get_optional(&spi->dev, "reset", GPIOD_OUT_HIGH);

Isn't this a change of behaviour w.r.t. to the initial state of the pin?

To be honest I suspect it is harmless because we launch into the reset
sequence shortly after anyway. More that that I think I prefer it this
way since it is better aligned with the behaviour of
lms283gf05_power_set().

However if it is an intentional change of behaviour then it would be
good to spell that out in the description for the benefit of future
archaeologists.


Daniel.


> +	if (st->reset)
> +		gpiod_set_consumer_name(st->reset, "LMS283GF05 RESET");
>  
>  	st = devm_kzalloc(&spi->dev, sizeof(struct lms283gf05_state),
>  				GFP_KERNEL);


More information about the dri-devel mailing list