i2c: rk3x: fix 0 length write transfers

i2cdetect -q was broken (everything was a false positive, and no transfers were
actually being sent over i2c). The way it works is by sending a 0 length write
request and checking for NACK. This patch fixes the 0 length writes and actually
sends them.

Reported-by: Doug Anderson <[email protected]>
Signed-off-by: Alexandru M Stan <[email protected]>
Tested-by: Doug Anderson <[email protected]>
Tested-by: Max Schwarz <[email protected]>
Signed-off-by: Wolfram Sang <[email protected]>
Cc: [email protected]
This commit is contained in:
Alexandru M Stan 2014-10-01 10:40:41 -07:00 • committed by Wolfram Sang
commit cf27020d2f

View file

@ -238,7 +238,7 @@ static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c)
for (i = 0; i < 8; ++i) {
val = 0;
for (j = 0; j < 4; ++j) {
if (i2c->processed == i2c->msg->len)
if ((i2c->processed == i2c->msg->len) && (cnt != 0))
break;
if (i2c->processed == 0 && cnt == 0)