linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: pca954x: Defer probing due to reset GPIO
@ 2015-03-04 14:44 Laurent Pinchart
       [not found] ` <1425480268-7322-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Laurent Pinchart @ 2015-03-04 14:44 UTC (permalink / raw)
  To: linux-i2c-u79uwXL29TY76Z2rM5mHXA; +Cc: Wolfram Sang

If a reset GPIO is specified but not available we must defer probing, as
the device could be held in reset. Use devm_gpiod_request_optional() to
handle this automatically.

Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
---
 drivers/i2c/muxes/i2c-mux-pca954x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/i2c/muxes/i2c-mux-pca954x.c b/drivers/i2c/muxes/i2c-mux-pca954x.c
index 3d8f4fe..bea0d2d 100644
--- a/drivers/i2c/muxes/i2c-mux-pca954x.c
+++ b/drivers/i2c/muxes/i2c-mux-pca954x.c
@@ -204,9 +204,9 @@ static int pca954x_probe(struct i2c_client *client,
 	i2c_set_clientdata(client, data);
 
 	/* Get the mux out of reset if a reset GPIO is specified. */
-	gpio = devm_gpiod_get(&client->dev, "reset");
-	if (!IS_ERR(gpio))
-		gpiod_direction_output(gpio, 0);
+	gpio = devm_gpiod_get_optional(&client->dev, "reset", GPIOD_OUT_LOW);
+	if (IS_ERR(gpio))
+		return PTR_ERR(gpio);
 
 	/* Write the mux register at addr to verify
 	 * that the mux is in fact present. This also
-- 
Regards,

Laurent Pinchart

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

* Re: [PATCH] i2c: pca954x: Defer probing due to reset GPIO
       [not found] ` <1425480268-7322-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2015-03-05  8:53   ` Uwe Kleine-König
       [not found]     ` <20150305085353.GS7865-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
  0 siblings, 1 reply; 3+ messages in thread
From: Uwe Kleine-König @ 2015-03-05  8:53 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang

Hello,

On Wed, Mar 04, 2015 at 04:44:28PM +0200, Laurent Pinchart wrote:
> If a reset GPIO is specified but not available we must defer probing, as
> the device could be held in reset. Use devm_gpiod_request_optional() to
> handle this automatically.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
I sent the same patch with a slightly different motivation two weeks
ago: http://article.gmane.org/gmane.linux.drivers.i2c/21972

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

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

* Re: [PATCH] i2c: pca954x: Defer probing due to reset GPIO
       [not found]     ` <20150305085353.GS7865-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
@ 2015-03-05 10:23       ` Laurent Pinchart
  0 siblings, 0 replies; 3+ messages in thread
From: Laurent Pinchart @ 2015-03-05 10:23 UTC (permalink / raw)
  To: Uwe Kleine-König; +Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA, Wolfram Sang

Hi Uwe,

On Thursday 05 March 2015 09:53:53 Uwe Kleine-König wrote:
> On Wed, Mar 04, 2015 at 04:44:28PM +0200, Laurent Pinchart wrote:
> > If a reset GPIO is specified but not available we must defer probing, as
> > the device could be held in reset. Use devm_gpiod_request_optional() to
> > handle this automatically.
> > 
> > Signed-off-by: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
> 
> I sent the same patch with a slightly different motivation two weeks
> ago: http://article.gmane.org/gmane.linux.drivers.i2c/21972

And I've even acked it... Well, I guess it means I really like the patch ;-) 
Let's get your version merged.

-- 
Regards,

Laurent Pinchart

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

end of thread, other threads:[~2015-03-05 10:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-04 14:44 [PATCH] i2c: pca954x: Defer probing due to reset GPIO Laurent Pinchart
     [not found] ` <1425480268-7322-1-git-send-email-laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2015-03-05  8:53   ` Uwe Kleine-König
     [not found]     ` <20150305085353.GS7865-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2015-03-05 10:23       ` Laurent Pinchart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).