From: Jean Delvare Date: Wed, 21 Jun 2017 07:24:02 +0000 (+0200) Subject: i2c: algo-bit: add support for I2C_M_STOP X-Git-Tag: v5.15~10876^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=606fd2788b0fce6f5138078a4fbe8979ecba5697;p=platform%2Fkernel%2Flinux-starfive.git 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 Tested-by: Wolfram Sang Signed-off-by: Wolfram Sang --- diff --git a/drivers/i2c/algos/i2c-algo-bit.c b/drivers/i2c/algos/i2c-algo-bit.c index a8e89df..1147bdd 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) {