linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] i2c: at91: Restore pinctrl state if can't get scl/sda gpios
@ 2020-05-13 11:13 Codrin Ciubotariu
  2020-05-15  9:26 ` Wolfram Sang
  0 siblings, 1 reply; 2+ messages in thread
From: Codrin Ciubotariu @ 2020-05-13 11:13 UTC (permalink / raw)
  To: linux-i2c, linux-arm-kernel, linux-kernel
  Cc: ludovic.desroches, nicolas.ferre, alexandre.belloni, wsa,
	linus.walleij, Codrin Ciubotariu

If there is a strict pinmux or if simply the scl/sda gpios are missing,
the pins will remain in gpio mode, compromizing the I2C bus.
Change to the default state of the pins before returning the error.

Fixes: a53acc7ebf27 ("i2c: at91: Fix pinmux after devm_gpiod_get() for bus recovery")
Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>
---
 drivers/i2c/busses/i2c-at91-master.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/i2c/busses/i2c-at91-master.c b/drivers/i2c/busses/i2c-at91-master.c
index d4a3aef4a594..363d540a8345 100644
--- a/drivers/i2c/busses/i2c-at91-master.c
+++ b/drivers/i2c/busses/i2c-at91-master.c
@@ -877,6 +877,7 @@ static int at91_init_twi_recovery_gpio(struct platform_device *pdev,
 			gpiod_put(rinfo->scl_gpiod);
 			rinfo->scl_gpiod = NULL;
 		}
+		pinctrl_select_state(dev->pinctrl, dev->pinctrl_pins_default);
 		return -EINVAL;
 	}
 
-- 
2.25.1


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

* Re: [PATCH] i2c: at91: Restore pinctrl state if can't get scl/sda gpios
  2020-05-13 11:13 [PATCH] i2c: at91: Restore pinctrl state if can't get scl/sda gpios Codrin Ciubotariu
@ 2020-05-15  9:26 ` Wolfram Sang
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfram Sang @ 2020-05-15  9:26 UTC (permalink / raw)
  To: Codrin Ciubotariu
  Cc: linux-i2c, linux-arm-kernel, linux-kernel, ludovic.desroches,
	nicolas.ferre, alexandre.belloni, linus.walleij

[-- Attachment #1: Type: text/plain, Size: 521 bytes --]

On Wed, May 13, 2020 at 02:13:22PM +0300, Codrin Ciubotariu wrote:
> If there is a strict pinmux or if simply the scl/sda gpios are missing,
> the pins will remain in gpio mode, compromizing the I2C bus.
> Change to the default state of the pins before returning the error.
> 
> Fixes: a53acc7ebf27 ("i2c: at91: Fix pinmux after devm_gpiod_get() for bus recovery")
> Signed-off-by: Codrin Ciubotariu <codrin.ciubotariu@microchip.com>

I squashed it into the other patch and applied it to for-current,
thanks!


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2020-05-15  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13 11:13 [PATCH] i2c: at91: Restore pinctrl state if can't get scl/sda gpios Codrin Ciubotariu
2020-05-15  9:26 ` Wolfram Sang

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).