提交 abe41184 编写于 作者: W Wolfram Sang 提交者: Wolfram Sang

i2c: recovery: if possible send STOP with recovery pulses

I2C clients may misunderstand recovery pulses if they can't read SDA to
bail out early. In the worst case, as a write operation. To avoid that
and if we can write SDA, try to send STOP to avoid the
misinterpretation.
Signed-off-by: NWolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: NPeter Rosin <peda@axentia.se>
Signed-off-by: NWolfram Sang <wsa@the-dreams.de>
Cc: stable@kernel.org
上级 54836e2d
...@@ -198,7 +198,16 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap) ...@@ -198,7 +198,16 @@ int i2c_generic_scl_recovery(struct i2c_adapter *adap)
val = !val; val = !val;
bri->set_scl(adap, val); bri->set_scl(adap, val);
ndelay(RECOVERY_NDELAY);
/*
* If we can set SDA, we will always create STOP here to ensure
* the additional pulses will do no harm. This is achieved by
* letting SDA follow SCL half a cycle later.
*/
ndelay(RECOVERY_NDELAY / 2);
if (bri->set_sda)
bri->set_sda(adap, val);
ndelay(RECOVERY_NDELAY / 2);
} }
/* check if recovery actually succeeded */ /* check if recovery actually succeeded */
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册