diff options
author | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-07-23 08:48:08 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-01-04 19:49:01 -0500 |
commit | 36ae6df08356609c931e66306b3cb88c22eb055d (patch) | |
tree | 584885babfc259943bf826c494fdbf074b11affc /drivers/media/common | |
parent | 19ad6a01bbb011b88b7a12a5baad6888cf216b35 (diff) |
[media] mt2063: Fix i2c read message
While here, improve a few debug messages that helped to track the
issue and may be useful in the future.
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/tuners/mt2063.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/drivers/media/common/tuners/mt2063.c b/drivers/media/common/tuners/mt2063.c index fdf605034ca6..599f8644ef11 100644 --- a/drivers/media/common/tuners/mt2063.c +++ b/drivers/media/common/tuners/mt2063.c | |||
@@ -305,35 +305,40 @@ static u32 mt2063_read(struct mt2063_state *state, | |||
305 | struct dvb_frontend *fe = state->frontend; | 305 | struct dvb_frontend *fe = state->frontend; |
306 | u32 i = 0; | 306 | u32 i = 0; |
307 | 307 | ||
308 | dprintk(2, "\n"); | 308 | dprintk(2, "addr 0x%02x, cnt %d\n", subAddress, cnt); |
309 | 309 | ||
310 | if (fe->ops.i2c_gate_ctrl) | 310 | if (fe->ops.i2c_gate_ctrl) |
311 | fe->ops.i2c_gate_ctrl(fe, 1); | 311 | fe->ops.i2c_gate_ctrl(fe, 1); |
312 | 312 | ||
313 | for (i = 0; i < cnt; i++) { | 313 | for (i = 0; i < cnt; i++) { |
314 | int ret; | ||
315 | u8 b0[] = { subAddress + i }; | 314 | u8 b0[] = { subAddress + i }; |
316 | struct i2c_msg msg[] = { | 315 | struct i2c_msg msg[] = { |
317 | { | 316 | { |
318 | .addr = state->config->tuner_address, | 317 | .addr = state->config->tuner_address, |
319 | .flags = I2C_M_RD, | 318 | .flags = 0, |
320 | .buf = b0, | 319 | .buf = b0, |
321 | .len = 1 | 320 | .len = 1 |
322 | }, { | 321 | }, { |
323 | .addr = state->config->tuner_address, | 322 | .addr = state->config->tuner_address, |
324 | .flags = I2C_M_RD, | 323 | .flags = I2C_M_RD, |
325 | .buf = pData + 1, | 324 | .buf = pData + i, |
326 | .len = 1 | 325 | .len = 1 |
327 | } | 326 | } |
328 | }; | 327 | }; |
329 | 328 | ||
330 | ret = i2c_transfer(state->i2c, msg, 2); | 329 | status = i2c_transfer(state->i2c, msg, 2); |
331 | if (ret < 0) | 330 | dprintk(2, "addr 0x%02x, ret = %d, val = 0x%02x\n", |
331 | subAddress + i, status, *(pData + i)); | ||
332 | if (status < 0) | ||
332 | break; | 333 | break; |
333 | } | 334 | } |
334 | if (fe->ops.i2c_gate_ctrl) | 335 | if (fe->ops.i2c_gate_ctrl) |
335 | fe->ops.i2c_gate_ctrl(fe, 0); | 336 | fe->ops.i2c_gate_ctrl(fe, 0); |
336 | 337 | ||
338 | if (status < 0) | ||
339 | printk(KERN_ERR "Can't read from address 0x%02x,\n", | ||
340 | subAddress + i); | ||
341 | |||
337 | return status; | 342 | return status; |
338 | } | 343 | } |
339 | 344 | ||
@@ -1801,7 +1806,8 @@ static int mt2063_init(struct dvb_frontend *fe) | |||
1801 | state->rcvr_mode = MT2063_CABLE_QAM; | 1806 | state->rcvr_mode = MT2063_CABLE_QAM; |
1802 | 1807 | ||
1803 | /* Read the Part/Rev code from the tuner */ | 1808 | /* Read the Part/Rev code from the tuner */ |
1804 | status = mt2063_read(state, MT2063_REG_PART_REV, state->reg, 1); | 1809 | status = mt2063_read(state, MT2063_REG_PART_REV, |
1810 | &state->reg[MT2063_REG_PART_REV], 1); | ||
1805 | if (status < 0) { | 1811 | if (status < 0) { |
1806 | printk(KERN_ERR "Can't read mt2063 part ID\n"); | 1812 | printk(KERN_ERR "Can't read mt2063 part ID\n"); |
1807 | return status; | 1813 | return status; |
@@ -1833,7 +1839,9 @@ static int mt2063_init(struct dvb_frontend *fe) | |||
1833 | 1839 | ||
1834 | /* b7 != 0 ==> NOT MT2063 */ | 1840 | /* b7 != 0 ==> NOT MT2063 */ |
1835 | if (status < 0 || ((state->reg[MT2063_REG_RSVD_3B] & 0x80) != 0x00)) { | 1841 | if (status < 0 || ((state->reg[MT2063_REG_RSVD_3B] & 0x80) != 0x00)) { |
1836 | printk(KERN_ERR "mt2063: Unknown 2nd part ID\n"); | 1842 | printk(KERN_ERR "mt2063: Unknown part ID (0x%02x%02x)\n", |
1843 | state->reg[MT2063_REG_PART_REV], | ||
1844 | state->reg[MT2063_REG_RSVD_3B]); | ||
1837 | return -ENODEV; /* Wrong tuner Part/Rev code */ | 1845 | return -ENODEV; /* Wrong tuner Part/Rev code */ |
1838 | } | 1846 | } |
1839 | 1847 | ||