[PATCH/RFT,2/6] i2c: imx: use open drain for recovery GPIO
diff mbox series

Message ID 20180713210920.3648-3-wsa+renesas@sang-engineering.com
State Accepted
Headers show
Series
  • i2c: recovery: fix GPIO usage for recovery
Related show

Commit Message

Wolfram Sang July 13, 2018, 9:09 p.m. UTC
I2C is open drain, so set up the GPIO accordingly.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/busses/i2c-imx.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lucas Stach July 23, 2018, 12:47 p.m. UTC | #1
Am Freitag, den 13.07.2018, 23:09 +0200 schrieb Wolfram Sang:
> I2C is open drain, so set up the GPIO accordingly.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

I don't think this matters on any of the i.MX platforms, as the GPIO
pin configuration (including open-drain) is only taken from the DT
pinctrl, with the GPIO driver not being able to change any of those. On
 the flipside this results in a near zero probability of regressions.
;)

As this is obviously right even if it doesn't have any effect on
current software:

Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

> ---
>  drivers/i2c/busses/i2c-imx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 0207e194f84b..3e23ee26c55c 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -1010,7 +1010,7 @@ static int i2c_imx_init_recovery_info(struct imx_i2c_struct *i2c_imx,
> >  	i2c_imx->pinctrl_pins_gpio = pinctrl_lookup_state(i2c_imx->pinctrl,
> >  			"gpio");
> >  	rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_IN);
> > -	rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl", GPIOD_OUT_HIGH);
> > +	rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl", GPIOD_OUT_HIGH_OPEN_DRAIN);
>  
> >  	if (PTR_ERR(rinfo->sda_gpiod) == -EPROBE_DEFER ||
> >  	    PTR_ERR(rinfo->scl_gpiod) == -EPROBE_DEFER) {
Wolfram Sang July 24, 2018, 7:28 a.m. UTC | #2
Hi Lucas,

> I don't think this matters on any of the i.MX platforms, as the GPIO
> pin configuration (including open-drain) is only taken from the DT
> pinctrl, with the GPIO driver not being able to change any of those. On
>  the flipside this results in a near zero probability of regressions.
> ;)

I see. Thanks for the heads up.

> As this is obviously right even if it doesn't have any effect on
> current software:
> 
> Reviewed-by: Lucas Stach <l.stach@pengutronix.de>

Thanks. Yeah, let's fix it. It might serve as an example for other
people.
Wolfram Sang July 24, 2018, 1:01 p.m. UTC | #3
On Fri, Jul 13, 2018 at 11:09:14PM +0200, Wolfram Sang wrote:
> I2C is open drain, so set up the GPIO accordingly.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Updated the commit message with the pinmux info from Lucas and applied
to for-current, thanks!

Patch
diff mbox series

diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 0207e194f84b..3e23ee26c55c 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -1010,7 +1010,7 @@  static int i2c_imx_init_recovery_info(struct imx_i2c_struct *i2c_imx,
 	i2c_imx->pinctrl_pins_gpio = pinctrl_lookup_state(i2c_imx->pinctrl,
 			"gpio");
 	rinfo->sda_gpiod = devm_gpiod_get(&pdev->dev, "sda", GPIOD_IN);
-	rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl", GPIOD_OUT_HIGH);
+	rinfo->scl_gpiod = devm_gpiod_get(&pdev->dev, "scl", GPIOD_OUT_HIGH_OPEN_DRAIN);
 
 	if (PTR_ERR(rinfo->sda_gpiod) == -EPROBE_DEFER ||
 	    PTR_ERR(rinfo->scl_gpiod) == -EPROBE_DEFER) {