提交 d845fb3a 编写于 作者: M Mauro Carvalho Chehab

[media] em28xx-i2c: add timeout debug information if i2c_debug enabled

If i2c_debug is enabled, we splicitly want to know when a
device fails with timeout.

If i2c_debug==2, this is already provided, for each I2C transfer
that fails.

However, most of the time, we don't need to go that far. We just
want to know that I2C transfers fail.

So, add such errors for normal (ret == 0x10) I2C aborted timeouts.
Signed-off-by: NMauro Carvalho Chehab <m.chehab@samsung.com>
上级 50f0a9df
...@@ -80,6 +80,9 @@ static int em2800_i2c_send_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len) ...@@ -80,6 +80,9 @@ static int em2800_i2c_send_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len)
if (ret == 0x80 + len - 1) if (ret == 0x80 + len - 1)
return len; return len;
if (ret == 0x94 + len - 1) { if (ret == 0x94 + len - 1) {
if (i2c_debug == 1)
em28xx_warn("R05 returned 0x%02x: I2C timeout",
ret);
return -ENXIO; return -ENXIO;
} }
if (ret < 0) { if (ret < 0) {
...@@ -124,6 +127,9 @@ static int em2800_i2c_recv_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len) ...@@ -124,6 +127,9 @@ static int em2800_i2c_recv_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len)
if (ret == 0x84 + len - 1) if (ret == 0x84 + len - 1)
break; break;
if (ret == 0x94 + len - 1) { if (ret == 0x94 + len - 1) {
if (i2c_debug == 1)
em28xx_warn("R05 returned 0x%02x: I2C timeout",
ret);
return -ENXIO; return -ENXIO;
} }
if (ret < 0) { if (ret < 0) {
...@@ -203,6 +209,9 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf, ...@@ -203,6 +209,9 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf,
if (ret == 0) /* success */ if (ret == 0) /* success */
return len; return len;
if (ret == 0x10) { if (ret == 0x10) {
if (i2c_debug == 1)
em28xx_warn("I2C transfer timeout on writing to addr 0x%02x",
addr);
return -ENXIO; return -ENXIO;
} }
if (ret < 0) { if (ret < 0) {
...@@ -263,8 +272,12 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len) ...@@ -263,8 +272,12 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len)
ret); ret);
return ret; return ret;
} }
if (ret == 0x10) if (ret == 0x10) {
if (i2c_debug == 1)
em28xx_warn("I2C transfer timeout on writing to addr 0x%02x",
addr);
return -ENXIO; return -ENXIO;
}
em28xx_warn("unknown i2c error (status=%i)\n", ret); em28xx_warn("unknown i2c error (status=%i)\n", ret);
return -ETIMEDOUT; return -ETIMEDOUT;
...@@ -322,8 +335,12 @@ static int em25xx_bus_B_send_bytes(struct em28xx *dev, u16 addr, u8 *buf, ...@@ -322,8 +335,12 @@ static int em25xx_bus_B_send_bytes(struct em28xx *dev, u16 addr, u8 *buf,
*/ */
if (!ret) if (!ret)
return len; return len;
else if (ret > 0) else if (ret > 0) {
if (i2c_debug == 1)
em28xx_warn("Bus B R08 returned 0x%02x: I2C timeout",
ret);
return -ENXIO; return -ENXIO;
}
return ret; return ret;
/* /*
...@@ -373,8 +390,12 @@ static int em25xx_bus_B_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, ...@@ -373,8 +390,12 @@ static int em25xx_bus_B_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf,
*/ */
if (!ret) if (!ret)
return len; return len;
else if (ret > 0) else if (ret > 0) {
if (i2c_debug == 1)
em28xx_warn("Bus B R08 returned 0x%02x: I2C timeout",
ret);
return -ENXIO; return -ENXIO;
}
return ret; return ret;
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册