diff options
author | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-01-06 07:17:53 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-01-12 08:56:46 -0500 |
commit | d845fb3ae5b97bda8810f450030c061b49a0b91b (patch) | |
tree | e74ce19d65a3c5e94ca034748d012c42117992cc /drivers/media | |
parent | 50f0a9df275b81096fbc0878c6deb5d99311549e (diff) |
[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: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-i2c.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c index e8eb83160d36..7e1724076ac4 100644 --- a/drivers/media/usb/em28xx/em28xx-i2c.c +++ b/drivers/media/usb/em28xx/em28xx-i2c.c | |||
@@ -80,6 +80,9 @@ static int em2800_i2c_send_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len) | |||
80 | if (ret == 0x80 + len - 1) | 80 | if (ret == 0x80 + len - 1) |
81 | return len; | 81 | return len; |
82 | if (ret == 0x94 + len - 1) { | 82 | if (ret == 0x94 + len - 1) { |
83 | if (i2c_debug == 1) | ||
84 | em28xx_warn("R05 returned 0x%02x: I2C timeout", | ||
85 | ret); | ||
83 | return -ENXIO; | 86 | return -ENXIO; |
84 | } | 87 | } |
85 | if (ret < 0) { | 88 | if (ret < 0) { |
@@ -124,6 +127,9 @@ static int em2800_i2c_recv_bytes(struct em28xx *dev, u8 addr, u8 *buf, u16 len) | |||
124 | if (ret == 0x84 + len - 1) | 127 | if (ret == 0x84 + len - 1) |
125 | break; | 128 | break; |
126 | if (ret == 0x94 + len - 1) { | 129 | if (ret == 0x94 + len - 1) { |
130 | if (i2c_debug == 1) | ||
131 | em28xx_warn("R05 returned 0x%02x: I2C timeout", | ||
132 | ret); | ||
127 | return -ENXIO; | 133 | return -ENXIO; |
128 | } | 134 | } |
129 | if (ret < 0) { | 135 | if (ret < 0) { |
@@ -203,6 +209,9 @@ static int em28xx_i2c_send_bytes(struct em28xx *dev, u16 addr, u8 *buf, | |||
203 | if (ret == 0) /* success */ | 209 | if (ret == 0) /* success */ |
204 | return len; | 210 | return len; |
205 | if (ret == 0x10) { | 211 | if (ret == 0x10) { |
212 | if (i2c_debug == 1) | ||
213 | em28xx_warn("I2C transfer timeout on writing to addr 0x%02x", | ||
214 | addr); | ||
206 | return -ENXIO; | 215 | return -ENXIO; |
207 | } | 216 | } |
208 | if (ret < 0) { | 217 | if (ret < 0) { |
@@ -263,8 +272,12 @@ static int em28xx_i2c_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, u16 len) | |||
263 | ret); | 272 | ret); |
264 | return ret; | 273 | return ret; |
265 | } | 274 | } |
266 | if (ret == 0x10) | 275 | if (ret == 0x10) { |
276 | if (i2c_debug == 1) | ||
277 | em28xx_warn("I2C transfer timeout on writing to addr 0x%02x", | ||
278 | addr); | ||
267 | return -ENXIO; | 279 | return -ENXIO; |
280 | } | ||
268 | 281 | ||
269 | em28xx_warn("unknown i2c error (status=%i)\n", ret); | 282 | em28xx_warn("unknown i2c error (status=%i)\n", ret); |
270 | return -ETIMEDOUT; | 283 | return -ETIMEDOUT; |
@@ -322,8 +335,12 @@ static int em25xx_bus_B_send_bytes(struct em28xx *dev, u16 addr, u8 *buf, | |||
322 | */ | 335 | */ |
323 | if (!ret) | 336 | if (!ret) |
324 | return len; | 337 | return len; |
325 | else if (ret > 0) | 338 | else if (ret > 0) { |
339 | if (i2c_debug == 1) | ||
340 | em28xx_warn("Bus B R08 returned 0x%02x: I2C timeout", | ||
341 | ret); | ||
326 | return -ENXIO; | 342 | return -ENXIO; |
343 | } | ||
327 | 344 | ||
328 | return ret; | 345 | return ret; |
329 | /* | 346 | /* |
@@ -373,8 +390,12 @@ static int em25xx_bus_B_recv_bytes(struct em28xx *dev, u16 addr, u8 *buf, | |||
373 | */ | 390 | */ |
374 | if (!ret) | 391 | if (!ret) |
375 | return len; | 392 | return len; |
376 | else if (ret > 0) | 393 | else if (ret > 0) { |
394 | if (i2c_debug == 1) | ||
395 | em28xx_warn("Bus B R08 returned 0x%02x: I2C timeout", | ||
396 | ret); | ||
377 | return -ENXIO; | 397 | return -ENXIO; |
398 | } | ||
378 | 399 | ||
379 | return ret; | 400 | return ret; |
380 | /* | 401 | /* |