public inbox for linux-fbdev@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 05/23] OMAPDSS: tpd12s015: CT_CP_HPD as optional gpio
@ 2015-12-09 15:59 Tomi Valkeinen
  2015-12-13 20:13 ` Laurent Pinchart
  0 siblings, 1 reply; 2+ messages in thread
From: Tomi Valkeinen @ 2015-12-09 15:59 UTC (permalink / raw)
  To: linux-fbdev

From: Manisha Agrawal <manisha.agrawal@ti.com>

tpd12s015 HW has LS_OE, CT_CP_HPD and HPD gpios. Out of these gpios,
driver only handled LS_OE as optional. The CT_CP_HPD gpio should also
be treated as optional gpio as it is just a power saving feature. Some
boards hardwire this gpio to be always enable. In this patch, all access
to CT_CP_HPD gpio is made optional.

Signed-off-by: Manisha Agrawal <manisha.agrawal@ti.com>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
index 93f95eaeadad..45a0b8e8d320 100644
--- a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
+++ b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
@@ -46,9 +46,11 @@ static int tpd_connect(struct omap_dss_device *dssdev,
 	dst->src = dssdev;
 	dssdev->dst = dst;
 
-	gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 1);
-	/* DC-DC converter needs at max 300us to get to 90% of 5V */
-	udelay(300);
+	if (ddata->ct_cp_hpd_gpio) {
+		gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 1);
+		/* DC-DC converter needs at max 300us to get to 90% of 5V */
+		udelay(300);
+	}
 
 	return 0;
 }
@@ -64,7 +66,8 @@ static void tpd_disconnect(struct omap_dss_device *dssdev,
 	if (dst != dssdev->dst)
 		return;
 
-	gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 0);
+	if (ddata->ct_cp_hpd_gpio)
+		gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 0);
 
 	dst->src = NULL;
 	dssdev->dst = NULL;
@@ -240,7 +243,7 @@ static int tpd_probe(struct platform_device *pdev)
 	}
 
 
-	gpio = devm_gpiod_get_index(&pdev->dev, NULL, 0,
+	gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0,
 		GPIOD_OUT_LOW);
 	if (IS_ERR(gpio))
 		goto err_gpio;
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 05/23] OMAPDSS: tpd12s015: CT_CP_HPD as optional gpio
  2015-12-09 15:59 [PATCH 05/23] OMAPDSS: tpd12s015: CT_CP_HPD as optional gpio Tomi Valkeinen
@ 2015-12-13 20:13 ` Laurent Pinchart
  0 siblings, 0 replies; 2+ messages in thread
From: Laurent Pinchart @ 2015-12-13 20:13 UTC (permalink / raw)
  To: linux-fbdev

Hi Tomi,

Thank you for the patch.

On Wednesday 09 December 2015 17:59:33 Tomi Valkeinen wrote:
> From: Manisha Agrawal <manisha.agrawal@ti.com>
> 
> tpd12s015 HW has LS_OE, CT_CP_HPD and HPD gpios. Out of these gpios,
> driver only handled LS_OE as optional. The CT_CP_HPD gpio should also
> be treated as optional gpio as it is just a power saving feature. Some
> boards hardwire this gpio to be always enable. In this patch, all access
> to CT_CP_HPD gpio is made optional.
> 
> Signed-off-by: Manisha Agrawal <manisha.agrawal@ti.com>
> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
> ---
>  drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c | 13 ++++++-----
>  1 file changed, 8 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
> b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c index
> 93f95eaeadad..45a0b8e8d320 100644
> --- a/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
> +++ b/drivers/video/fbdev/omap2/displays-new/encoder-tpd12s015.c
> @@ -46,9 +46,11 @@ static int tpd_connect(struct omap_dss_device *dssdev,
>  	dst->src = dssdev;
>  	dssdev->dst = dst;
> 
> -	gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 1);
> -	/* DC-DC converter needs at max 300us to get to 90% of 5V */
> -	udelay(300);
> +	if (ddata->ct_cp_hpd_gpio) {
> +		gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 1);
> +		/* DC-DC converter needs at max 300us to get to 90% of 5V */
> +		udelay(300);
> +	}
> 
>  	return 0;
>  }
> @@ -64,7 +66,8 @@ static void tpd_disconnect(struct omap_dss_device *dssdev,
> if (dst != dssdev->dst)
>  		return;
> 
> -	gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 0);
> +	if (ddata->ct_cp_hpd_gpio)
> +		gpiod_set_value_cansleep(ddata->ct_cp_hpd_gpio, 0);

gpiod_set_value_cansleep() includes a NULL check so you could remove it from 
here.

Apart from that the patch looks good to me.

Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  	dst->src = NULL;
>  	dssdev->dst = NULL;
> @@ -240,7 +243,7 @@ static int tpd_probe(struct platform_device *pdev)
>  	}
> 
> 
> -	gpio = devm_gpiod_get_index(&pdev->dev, NULL, 0,
> +	gpio = devm_gpiod_get_index_optional(&pdev->dev, NULL, 0,
>  		GPIOD_OUT_LOW);
>  	if (IS_ERR(gpio))
>  		goto err_gpio;

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-13 20:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-09 15:59 [PATCH 05/23] OMAPDSS: tpd12s015: CT_CP_HPD as optional gpio Tomi Valkeinen
2015-12-13 20:13 ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox