Skip to contentSkip to conversation

support I2C_M_NO_RD_ACK in i2c-algo-bit

PATCH Applied Kevin O'Connor 2 participants 2 messages Apr 25, 2004 – May 2, 2004 I2C subsystem host drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 support I2C_M_NO_RD_ACK in i2c-algo-bit

This is a message resend - the original didn't make it to lkml.

Hi Greg,

I have an I2C device (Samsung ks0127 video grabber) with a peculiar i2c implementation. When reading bytes, it only senses for the stop condition in the place where the acknowledge bit should be. So, to properly support this device acks need to be turned off during reads.

There is an I2C_M_NO_RD_ACK bit already defined in i2c.h which appears to be what I want. Unfortunately it doesn't seem to be used anywhere in the current tree. At the end of this message is a patch to teach i2c_algo_bit to honor the bit.

-Kevin

drivers/i2c/algos/i2c-algo-bit.c +7 -3
@@ -381,7 +381,13 @@
 			break;
 		}
 
-		if ( count > 1 ) {		/* send ack */
+		temp++;
+		count--;
+
+		if (msg->flags & I2C_M_NO_RD_ACK)
+			continue;
+
+		if ( count > 0 ) {		/* send ack */
 			sdalo(adap);
 			DEBPROTO(printk(" Am "));
 		} else {
@@ -395,8 +401,6 @@
 		};
 		scllo(adap);
 		sdahi(adap);
-		temp++;
-		count--;
 	}
 	return rdcount;
 }
Applied
#1 lore raw
Quoted 9 lines · Kevin O'Connor

This is a message resend - the original didn't make it to lkml.

Hi Greg,

I have an I2C device (Samsung ks0127 video grabber) with a peculiar i2c implementation. When reading bytes, it only senses for the stop condition in the place where the acknowledge bit should be. So, to properly support this device acks need to be turned off during reads.

Quoted 4 lines

There is an I2C_M_NO_RD_ACK bit already defined in i2c.h which appears to be what I want. Unfortunately it doesn't seem to be used anywhere in the current tree. At the end of this message is a patch to teach i2c_algo_bit to honor the bit.

Applied, thanks.

greg k-h