diff options
Diffstat (limited to 'drivers/media/dvb/frontends/mb86a20s.c')
-rw-r--r-- | drivers/media/dvb/frontends/mb86a20s.c | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/drivers/media/dvb/frontends/mb86a20s.c b/drivers/media/dvb/frontends/mb86a20s.c index d3ad3e75a35a..cc4acd2f920d 100644 --- a/drivers/media/dvb/frontends/mb86a20s.c +++ b/drivers/media/dvb/frontends/mb86a20s.c | |||
@@ -43,6 +43,8 @@ struct mb86a20s_state { | |||
43 | const struct mb86a20s_config *config; | 43 | const struct mb86a20s_config *config; |
44 | 44 | ||
45 | struct dvb_frontend frontend; | 45 | struct dvb_frontend frontend; |
46 | |||
47 | bool need_init; | ||
46 | }; | 48 | }; |
47 | 49 | ||
48 | struct regdata { | 50 | struct regdata { |
@@ -318,7 +320,7 @@ static int mb86a20s_i2c_writereg(struct mb86a20s_state *state, | |||
318 | 320 | ||
319 | rc = i2c_transfer(state->i2c, &msg, 1); | 321 | rc = i2c_transfer(state->i2c, &msg, 1); |
320 | if (rc != 1) { | 322 | if (rc != 1) { |
321 | printk("%s: writereg rcor(rc == %i, reg == 0x%02x," | 323 | printk("%s: writereg error (rc == %i, reg == 0x%02x," |
322 | " data == 0x%02x)\n", __func__, rc, reg, data); | 324 | " data == 0x%02x)\n", __func__, rc, reg, data); |
323 | return rc; | 325 | return rc; |
324 | } | 326 | } |
@@ -353,7 +355,7 @@ static int mb86a20s_i2c_readreg(struct mb86a20s_state *state, | |||
353 | rc = i2c_transfer(state->i2c, msg, 2); | 355 | rc = i2c_transfer(state->i2c, msg, 2); |
354 | 356 | ||
355 | if (rc != 2) { | 357 | if (rc != 2) { |
356 | rc("%s: reg=0x%x (rcor=%d)\n", __func__, reg, rc); | 358 | rc("%s: reg=0x%x (error=%d)\n", __func__, reg, rc); |
357 | return rc; | 359 | return rc; |
358 | } | 360 | } |
359 | 361 | ||
@@ -382,23 +384,31 @@ static int mb86a20s_initfe(struct dvb_frontend *fe) | |||
382 | /* Initialize the frontend */ | 384 | /* Initialize the frontend */ |
383 | rc = mb86a20s_writeregdata(state, mb86a20s_init); | 385 | rc = mb86a20s_writeregdata(state, mb86a20s_init); |
384 | if (rc < 0) | 386 | if (rc < 0) |
385 | return rc; | 387 | goto err; |
386 | 388 | ||
387 | if (!state->config->is_serial) { | 389 | if (!state->config->is_serial) { |
388 | regD5 &= ~1; | 390 | regD5 &= ~1; |
389 | 391 | ||
390 | rc = mb86a20s_writereg(state, 0x50, 0xd5); | 392 | rc = mb86a20s_writereg(state, 0x50, 0xd5); |
391 | if (rc < 0) | 393 | if (rc < 0) |
392 | return rc; | 394 | goto err; |
393 | rc = mb86a20s_writereg(state, 0x51, regD5); | 395 | rc = mb86a20s_writereg(state, 0x51, regD5); |
394 | if (rc < 0) | 396 | if (rc < 0) |
395 | return rc; | 397 | goto err; |
396 | } | 398 | } |
397 | 399 | ||
398 | if (fe->ops.i2c_gate_ctrl) | 400 | if (fe->ops.i2c_gate_ctrl) |
399 | fe->ops.i2c_gate_ctrl(fe, 1); | 401 | fe->ops.i2c_gate_ctrl(fe, 1); |
400 | 402 | ||
401 | return 0; | 403 | err: |
404 | if (rc < 0) { | ||
405 | state->need_init = true; | ||
406 | printk(KERN_INFO "mb86a20s: Init failed. Will try again later\n"); | ||
407 | } else { | ||
408 | state->need_init = false; | ||
409 | dprintk("Initialization succeded.\n"); | ||
410 | } | ||
411 | return rc; | ||
402 | } | 412 | } |
403 | 413 | ||
404 | static int mb86a20s_read_signal_strength(struct dvb_frontend *fe, u16 *strength) | 414 | static int mb86a20s_read_signal_strength(struct dvb_frontend *fe, u16 *strength) |
@@ -485,8 +495,22 @@ static int mb86a20s_set_frontend(struct dvb_frontend *fe, | |||
485 | 495 | ||
486 | if (fe->ops.i2c_gate_ctrl) | 496 | if (fe->ops.i2c_gate_ctrl) |
487 | fe->ops.i2c_gate_ctrl(fe, 1); | 497 | fe->ops.i2c_gate_ctrl(fe, 1); |
498 | dprintk("Calling tuner set parameters\n"); | ||
488 | fe->ops.tuner_ops.set_params(fe, p); | 499 | fe->ops.tuner_ops.set_params(fe, p); |
489 | 500 | ||
501 | /* | ||
502 | * Make it more reliable: if, for some reason, the initial | ||
503 | * device initialization doesn't happen, initialize it when | ||
504 | * a SBTVD parameters are adjusted. | ||
505 | * | ||
506 | * Unfortunately, due to a hard to track bug at tda829x/tda18271, | ||
507 | * the agc callback logic is not called during DVB attach time, | ||
508 | * causing mb86a20s to not be initialized with Kworld SBTVD. | ||
509 | * So, this hack is needed, in order to make Kworld SBTVD to work. | ||
510 | */ | ||
511 | if (state->need_init) | ||
512 | mb86a20s_initfe(fe); | ||
513 | |||
490 | if (fe->ops.i2c_gate_ctrl) | 514 | if (fe->ops.i2c_gate_ctrl) |
491 | fe->ops.i2c_gate_ctrl(fe, 0); | 515 | fe->ops.i2c_gate_ctrl(fe, 0); |
492 | rc = mb86a20s_writeregdata(state, mb86a20s_reset_reception); | 516 | rc = mb86a20s_writeregdata(state, mb86a20s_reset_reception); |