diff mbox

[v2] i2c: algo-bit: add support for I2C_M_STOP

Message ID 20170621092402.773a4b14@endymion (mailing list archive)
State Accepted
Delegated to: Geert Uytterhoeven
Headers show

Commit Message

Jean Delvare June 21, 2017, 7:24 a.m. UTC
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>
---
Changes since v1:
 * Simplify logic

 drivers/i2c/algos/i2c-algo-bit.c |   15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

Comments

Wolfram Sang June 21, 2017, 2:54 p.m. UTC | #1
> +				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?

> +					bit_dbg(3, &i2c_adap->dev,
> +						"emitting enforced stop/start condition\n");
Jean Delvare June 22, 2017, 9:06 a.m. UTC | #2
On Wed, 21 Jun 2017 16:54:26 +0200, Wolfram Sang wrote:
> > +				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?
> 
> > +					bit_dbg(3, &i2c_adap->dev,
> > +						"emitting enforced stop/start condition\n");  
> 

Go ahead, fine with me.
Wolfram Sang June 23, 2017, 6:47 p.m. UTC | #3
> > > +					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!
diff mbox

Patch

--- linux-4.11.orig/drivers/i2c/algos/i2c-algo-bit.c	2017-06-19 09:57:17.949074198 +0200
+++ linux-4.11/drivers/i2c/algos/i2c-algo-bit.c	2017-06-21 09:07:07.910049960 +0200
@@ -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) {