Re: [PATCH] drm/tilcdc: Switch to using GPIO descriptors

2019-12-04 Thread Sam Ravnborg
Hi Jyri.

On Tue, Dec 03, 2019 at 08:29:45PM +0200, Jyri Sarha wrote:
> On 03/12/2019 15:09, Linus Walleij wrote:
> > The TI LCDC picks a GPIO line from the device tree to use
> > for DPMS power on/off. We can switch this to use a GPIO
> > descriptor pretty easily. Make sure to request the GPIO
> > "as is" so that the DPMS state that we start (boot) in is
> > preserved.
> > 
> 
> Hmmm, I have been considering ditching this driver all together since no
> mainline platform has ever used it. Also, if anybody ever wants to
> connect tfp410 to tilcdc, he should use drm/bridge/ti-tfp410.c instead.
> 
> But since the patch is there, maybe I should pick it up, and remove the
> bundled driver later a bit later.

IMO much better to just get rid of it now - as there is anyway no users.
No reason to patch code that is essential dead.
You just postpone the task for no gain.

Sam
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/tilcdc: Switch to using GPIO descriptors

2019-12-03 Thread Jyri Sarha
On 03/12/2019 15:09, Linus Walleij wrote:
> The TI LCDC picks a GPIO line from the device tree to use
> for DPMS power on/off. We can switch this to use a GPIO
> descriptor pretty easily. Make sure to request the GPIO
> "as is" so that the DPMS state that we start (boot) in is
> preserved.
> 

Hmmm, I have been considering ditching this driver all together since no
mainline platform has ever used it. Also, if anybody ever wants to
connect tfp410 to tilcdc, he should use drm/bridge/ti-tfp410.c instead.

But since the patch is there, maybe I should pick it up, and remove the
bundled driver later a bit later.

BR,
Jyri

> Cc: Jyri Sarha 
> Cc: Tomi Valkeinen 
> Cc: David Lechner 
> Signed-off-by: Linus Walleij 
> ---
>  drivers/gpu/drm/tilcdc/tilcdc_tfp410.c | 30 --
>  1 file changed, 14 insertions(+), 16 deletions(-)
> 
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c 
> b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
> index 530edb3b51cc..41cd9a7c4316 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_tfp410.c
> @@ -4,9 +4,8 @@
>   * Author: Rob Clark 
>   */
>  
> -#include 
> +#include 
>  #include 
> -#include 
>  #include 
>  #include 
>  
> @@ -21,7 +20,7 @@
>  struct tfp410_module {
>   struct tilcdc_module base;
>   struct i2c_adapter *i2c;
> - int gpio;
> + struct gpio_desc *power_gpiod;
>  };
>  #define to_tfp410_module(x) container_of(x, struct tfp410_module, base)
>  
> @@ -58,10 +57,10 @@ static void tfp410_encoder_dpms(struct drm_encoder 
> *encoder, int mode)
>  
>   if (mode == DRM_MODE_DPMS_ON) {
>   DBG("Power on");
> - gpio_direction_output(tfp410_encoder->mod->gpio, 1);
> + gpiod_direction_output(tfp410_encoder->mod->power_gpiod, 1);
>   } else {
>   DBG("Power off");
> - gpio_direction_output(tfp410_encoder->mod->gpio, 0);
> + gpiod_direction_output(tfp410_encoder->mod->power_gpiod, 0);
>   }
>  
>   tfp410_encoder->dpms = mode;
> @@ -318,17 +317,17 @@ static int tfp410_probe(struct platform_device *pdev)
>  
>   of_node_put(i2c_node);
>  
> - tfp410_mod->gpio = of_get_named_gpio_flags(node, "powerdn-gpio",
> - 0, NULL);
> - if (tfp410_mod->gpio < 0) {
> - dev_warn(>dev, "No power down GPIO\n");
> - } else {
> - ret = gpio_request(tfp410_mod->gpio, "DVI_PDn");
> - if (ret) {
> - dev_err(>dev, "could not get DVI_PDn gpio\n");
> - goto fail_adapter;
> - }
> + tfp410_mod->power_gpiod = devm_gpiod_get_optional(>dev,
> +   "powerdn",
> +   GPIOD_ASIS);
> + if (IS_ERR(tfp410_mod->power_gpiod)) {
> + dev_err(>dev, "could not get DVI_PDn gpio\n");
> + goto fail_adapter;
>   }
> + if (!tfp410_mod->power_gpiod)
> + dev_warn(>dev, "No power down GPIO\n");
> + else
> + gpiod_set_consumer_name(tfp410_mod->power_gpiod, "DVI_PDn");
>  
>   return 0;
>  
> @@ -346,7 +345,6 @@ static int tfp410_remove(struct platform_device *pdev)
>   struct tfp410_module *tfp410_mod = to_tfp410_module(mod);
>  
>   i2c_put_adapter(tfp410_mod->i2c);
> - gpio_free(tfp410_mod->gpio);
>  
>   tilcdc_module_cleanup(mod);
>  
> 


-- 
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/tilcdc: Switch to using GPIO descriptors

2019-12-03 Thread David Lechner

On 12/3/19 7:09 AM, Linus Walleij wrote:

The TI LCDC picks a GPIO line from the device tree to use
for DPMS power on/off. We can switch this to use a GPIO
descriptor pretty easily. Make sure to request the GPIO
"as is" so that the DPMS state that we start (boot) in is
preserved.

Cc: Jyri Sarha 
Cc: Tomi Valkeinen 
Cc: David Lechner 
Signed-off-by: Linus Walleij 
---


Reviewed-by: David Lechner 


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