Skip to contentSkip to conversation

i2c: algo-bit: add support for I2C_M_STOP

PATCH In review Jean Delvare 2 participants 4 messages Jun 21, 2017 – Jun 23, 2017 I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
Changes since v1:
* Simplify logic

 drivers/i2c/algos/i2c-algo-bit.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/i2c/algos/i2c-algo-bit.c +12 -3
@@ -553,9 +553,18 @@ static int bit_xfer(struct i2c_adapter *
 		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 condition\n");
+					i2c_stop(adap);
+					bit_dbg(3, &i2c_adap->dev,
+						"emitting start condition\n");
+					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) {
Signature · 2 lines
Jean Delvare
SUSE L3 Support
#1 lore raw

drivers/i2c/algos/i2c-algo-bit.c static int bit_xfer(struct i2c_adapter * · line 561

Quoted 6 lines
drivers/i2c/algos/i2c-algo-bit.c +6 -0
+				if (msgs[i - 1].flags & I2C_M_STOP) {
+					bit_dbg(3, &i2c_adap->dev,
+						"emitting enforced stop condition\n");
+					i2c_stop(adap);
+					bit_dbg(3, &i2c_adap->dev,
+						"emitting start condition\n");

Do you mind if I combine the two debug outputs into one?

Quoted 2 lines
(quoted diff) +2 -0
+					bit_dbg(3, &i2c_adap->dev,
+						"emitting enforced stop/start condition\n");
#2 lore raw
Quoted 9 lines · Wolfram Sang

drivers/i2c/algos/i2c-algo-bit.c static int bit_xfer(struct i2c_adapter * · line 561

Quoted 6 lines
drivers/i2c/algos/i2c-algo-bit.c +6 -0
+				if (msgs[i - 1].flags & I2C_M_STOP) {
+					bit_dbg(3, &i2c_adap->dev,
+						"emitting enforced stop condition\n");
+					i2c_stop(adap);
+					bit_dbg(3, &i2c_adap->dev,
+						"emitting start condition\n");  

Do you mind if I combine the two debug outputs into one?

Quoted 3 lines

Review

Quoted 2 lines
(quoted diff) +2 -0
+					bit_dbg(3, &i2c_adap->dev,
+						"emitting enforced stop/start condition\n");  

Go ahead, fine with me.

Signature · 2 lines
Jean Delvare
SUSE L3 Support
#3 lore raw
Quoted 6 lines
Quoted 4 lines

Review

Quoted 3 lines
(quoted diff) +2 -0
+					bit_dbg(3, &i2c_adap->dev,
+						"emitting enforced stop/start condition\n");  

Go ahead, fine with me.

Did so and applied to for-next, thanks!