[v2,4/6] i2c: ensure SDA is released in recovery if SDA is controllable

Message ID 20180109135859.20771-5-wsa@the-dreams.de
State Accepted
Headers show
Series
  • i2c: send STOP after recovery; use it for i2c-rcar
Related show

Commit Message

Wolfram Sang Jan. 9, 2018, 1:58 p.m.
From: Wolfram Sang <wsa+renesas@sang-engineering.com>

If we have a function to control SDA, we should ensure that SDA is not
held down by us. So, release the GPIO in this case.

Tested-by: Phil Reid <preid@electromag.com.au>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/i2c-core-base.c | 2 ++
 1 file changed, 2 insertions(+)

Patch

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index a8b3fbe16fa08c..54cef80990a11a 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -169,6 +169,8 @@  int i2c_generic_scl_recovery(struct i2c_adapter *adap)
 		bri->prepare_recovery(adap);
 
 	bri->set_scl(adap, val);
+	if (bri->set_sda)
+		bri->set_sda(adap, 1);
 	ndelay(RECOVERY_NDELAY);
 
 	/*