diff options
author | Jean Delvare <jdelvare@suse.de> | 2017-06-21 09:24:02 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2017-06-23 20:45:43 +0200 |
commit | 606fd2788b0fce6f5138078a4fbe8979ecba5697 (patch) | |
tree | 0b43cd440500074cd17a95f78f074f41dd4e1029 /drivers/i2c | |
parent | 413dfbbfca54904760aa04af40ca26e2a70f3eda (diff) | |
download | linux-606fd2788b0fce6f5138078a4fbe8979ecba5697.tar.bz2 |
i2c: algo-bit: add support for I2C_M_STOP
Support for enforced STOPs will allow us to use SCCB compatible devices.
Based on a preliminary patch by Wolfram Sang.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/algos/i2c-algo-bit.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index a8e89df665b9..1147bddb8b2c 100644 --- a/drivers/i2c/algos/i2c-algo-bit.c +++ b/drivers/i2c/algos/i2c-algo-bit.c @@ -553,9 +553,16 @@ static int bit_xfer(struct i2c_adapter *i2c_adap, nak_ok = pmsg->flags & I2C_M_IGNORE_NAK; if (!(pmsg->flags & I2C_M_NOSTART)) { if (i) { - bit_dbg(3, &i2c_adap->dev, "emitting " - "repeated start condition\n"); - i2c_repstart(adap); + if (msgs[i - 1].flags & I2C_M_STOP) { + bit_dbg(3, &i2c_adap->dev, + "emitting enforced stop/start condition\n"); + i2c_stop(adap); + i2c_start(adap); + } else { + bit_dbg(3, &i2c_adap->dev, + "emitting repeated start condition\n"); + i2c_repstart(adap); + } } ret = bit_doAddress(i2c_adap, pmsg); if ((ret != 0) && !nak_ok) { |