Re: [PATCH 07/21] drm/omap: panel-nec-nl8048hl11: Convert to the GPIO descriptors API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Wed, Jun 06, 2018 at 12:36:36PM +0300, Laurent Pinchart wrote:
> The GPIO descriptor API is favoured over the plain GPIO API for consumer
> drivers. Using it simplifies the driver code.
> 
> The reset GPIO is mandatory, so drop conditional tests through the
> driver. The qvga GPIO is unused, so drop it completely.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx>
> ---

Reviewed-by: Sebastian Reichel <sebastian.reichel@xxxxxxxxxxxxxxx>

-- Sebastian

>  .../drm/omapdrm/displays/panel-nec-nl8048hl11.c    | 54 +++++-----------------
>  1 file changed, 11 insertions(+), 43 deletions(-)
> 
> diff --git a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> index b4dba55b678b..767ffd2fa0f4 100644
> --- a/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> +++ b/drivers/gpu/drm/omapdrm/displays/panel-nec-nl8048hl11.c
> @@ -11,11 +11,10 @@
>   * (at your option) any later version.
>   */
>  
> -#include <linux/module.h>
>  #include <linux/delay.h>
> -#include <linux/spi/spi.h>
>  #include <linux/gpio/consumer.h>
> -#include <linux/of_gpio.h>
> +#include <linux/module.h>
> +#include <linux/spi/spi.h>
>  
>  #include "../dss/omapdss.h"
>  
> @@ -24,8 +23,7 @@ struct panel_drv_data {
>  
>  	struct videomode vm;
>  
> -	int res_gpio;
> -	int qvga_gpio;
> +	struct gpio_desc *res_gpio;
>  
>  	struct spi_device *spi;
>  };
> @@ -140,8 +138,7 @@ static int nec_8048_enable(struct omap_dss_device *dssdev)
>  	if (r)
>  		return r;
>  
> -	if (gpio_is_valid(ddata->res_gpio))
> -		gpio_set_value_cansleep(ddata->res_gpio, 1);
> +	gpiod_set_value_cansleep(ddata->res_gpio, 1);
>  
>  	dssdev->state = OMAP_DSS_DISPLAY_ACTIVE;
>  
> @@ -156,8 +153,7 @@ static void nec_8048_disable(struct omap_dss_device *dssdev)
>  	if (!omapdss_device_is_enabled(dssdev))
>  		return;
>  
> -	if (gpio_is_valid(ddata->res_gpio))
> -		gpio_set_value_cansleep(ddata->res_gpio, 0);
> +	gpiod_set_value_cansleep(ddata->res_gpio, 0);
>  
>  	src->ops->disable(src);
>  
> @@ -203,29 +199,11 @@ static const struct omap_dss_driver nec_8048_ops = {
>  	.check_timings	= nec_8048_check_timings,
>  };
>  
> -static int nec_8048_probe_of(struct spi_device *spi)
> -{
> -	struct device_node *node = spi->dev.of_node;
> -	struct panel_drv_data *ddata = dev_get_drvdata(&spi->dev);
> -	int gpio;
> -
> -	gpio = of_get_named_gpio(node, "reset-gpios", 0);
> -	if (!gpio_is_valid(gpio)) {
> -		dev_err(&spi->dev, "failed to parse enable gpio\n");
> -		return gpio;
> -	}
> -	ddata->res_gpio = gpio;
> -
> -	/* XXX the panel spec doesn't mention any QVGA pin?? */
> -	ddata->qvga_gpio = -ENOENT;
> -
> -	return 0;
> -}
> -
>  static int nec_8048_probe(struct spi_device *spi)
>  {
>  	struct panel_drv_data *ddata;
>  	struct omap_dss_device *dssdev;
> +	struct gpio_desc *gpio;
>  	int r;
>  
>  	dev_dbg(&spi->dev, "%s\n", __func__);
> @@ -249,23 +227,13 @@ static int nec_8048_probe(struct spi_device *spi)
>  
>  	ddata->spi = spi;
>  
> -	r = nec_8048_probe_of(spi);
> -	if (r)
> -		return r;
> -
> -	if (gpio_is_valid(ddata->qvga_gpio)) {
> -		r = devm_gpio_request_one(&spi->dev, ddata->qvga_gpio,
> -				GPIOF_OUT_INIT_HIGH, "lcd QVGA");
> -		if (r)
> -			return r;
> +	gpio = devm_gpiod_get(&spi->dev, "reset", GPIOD_OUT_LOW);
> +	if (IS_ERR(gpio)) {
> +		dev_err(&spi->dev, "failed to get reset gpio\n");
> +		return PTR_ERR(gpio);
>  	}
>  
> -	if (gpio_is_valid(ddata->res_gpio)) {
> -		r = devm_gpio_request_one(&spi->dev, ddata->res_gpio,
> -				GPIOF_OUT_INIT_LOW, "lcd RES");
> -		if (r)
> -			return r;
> -	}
> +	ddata->res_gpio = gpio;
>  
>  	ddata->vm = nec_8048_panel_vm;
>  
> -- 
> Regards,
> 
> Laurent Pinchart
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@xxxxxxxxxxxxxxxxxxxxx
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

Attachment: signature.asc
Description: PGP signature

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux