Skip to content

Commit

Permalink
i2c: core: only use set_scl for bus recovery after calling prepare_re…
Browse files Browse the repository at this point in the history
…covery

Using set_scl may be ineffective before calling the driver specific
prepare_recovery callback, which might change into a test mode. So
instead of setting SCL in i2c_generic_scl_recovery, move it to
i2c_generic_recovery (after the optional prepare_recovery).

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
Acked-by: Alexander Sverdlin <alexander.sverdlin@nokia.com>
Tested-by: Alexander Sverdlin <alexander.sverdlin@gmail.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
  • Loading branch information
jluebbe authored and Wolfram Sang committed Jul 31, 2015
1 parent d12c0aa commit 8b06260
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,9 @@ static int i2c_generic_recovery(struct i2c_adapter *adap)
if (bri->prepare_recovery)
bri->prepare_recovery(adap);

bri->set_scl(adap, val);
ndelay(RECOVERY_NDELAY);

/*
* By this time SCL is high, as we need to give 9 falling-rising edges
*/
Expand Down Expand Up @@ -597,7 +600,6 @@ static int i2c_generic_recovery(struct i2c_adapter *adap)

int i2c_generic_scl_recovery(struct i2c_adapter *adap)
{
adap->bus_recovery_info->set_scl(adap, 1);
return i2c_generic_recovery(adap);
}
EXPORT_SYMBOL_GPL(i2c_generic_scl_recovery);
Expand Down

0 comments on commit 8b06260

Please sign in to comment.