aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2008-06-13 19:33:23 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-06-26 14:58:52 -0400
commit74d50724a02d7cdc7f7887411518ec43d0251b97 (patch)
tree221ac42d58f160b1ecfc95ed238443119efa881e
parent104fe9a2d2a56f25fb95800a7ab0f7600dd6879c (diff)
V4L/DVB (8044): au8522: tuning optimizations
If the current modulation and frequency is already set to the desired parameters, then don't re-tune. Don't store current frequency until after we've tuned successfully. Force a re-tune after resume from standby. Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/dvb/frontends/au8522.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/drivers/media/dvb/frontends/au8522.c b/drivers/media/dvb/frontends/au8522.c
index 084a280c2d7f..978a287b751b 100644
--- a/drivers/media/dvb/frontends/au8522.c
+++ b/drivers/media/dvb/frontends/au8522.c
@@ -463,10 +463,13 @@ static int au8522_set_frontend(struct dvb_frontend *fe,
463 struct dvb_frontend_parameters *p) 463 struct dvb_frontend_parameters *p)
464{ 464{
465 struct au8522_state *state = fe->demodulator_priv; 465 struct au8522_state *state = fe->demodulator_priv;
466 int ret = -EINVAL;
466 467
467 dprintk("%s(frequency=%d)\n", __func__, p->frequency); 468 dprintk("%s(frequency=%d)\n", __func__, p->frequency);
468 469
469 state->current_frequency = p->frequency; 470 if ((state->current_frequency == p->frequency) &&
471 (state->current_modulation == p->u.vsb.modulation))
472 return 0;
470 473
471 au8522_enable_modulation(fe, p->u.vsb.modulation); 474 au8522_enable_modulation(fe, p->u.vsb.modulation);
472 475
@@ -476,11 +479,16 @@ static int au8522_set_frontend(struct dvb_frontend *fe,
476 if (fe->ops.tuner_ops.set_params) { 479 if (fe->ops.tuner_ops.set_params) {
477 if (fe->ops.i2c_gate_ctrl) 480 if (fe->ops.i2c_gate_ctrl)
478 fe->ops.i2c_gate_ctrl(fe, 1); 481 fe->ops.i2c_gate_ctrl(fe, 1);
479 fe->ops.tuner_ops.set_params(fe, p); 482 ret = fe->ops.tuner_ops.set_params(fe, p);
480 if (fe->ops.i2c_gate_ctrl) 483 if (fe->ops.i2c_gate_ctrl)
481 fe->ops.i2c_gate_ctrl(fe, 0); 484 fe->ops.i2c_gate_ctrl(fe, 0);
482 } 485 }
483 486
487 if (ret < 0)
488 return ret;
489
490 state->current_frequency = p->frequency;
491
484 return 0; 492 return 0;
485} 493}
486 494
@@ -498,6 +506,16 @@ static int au8522_init(struct dvb_frontend *fe)
498 return 0; 506 return 0;
499} 507}
500 508
509static int au8522_sleep(struct dvb_frontend *fe)
510{
511 struct au8522_state *state = fe->demodulator_priv;
512 dprintk("%s()\n", __func__);
513
514 state->current_frequency = 0;
515
516 return 0;
517}
518
501static int au8522_read_status(struct dvb_frontend *fe, fe_status_t *status) 519static int au8522_read_status(struct dvb_frontend *fe, fe_status_t *status)
502{ 520{
503 struct au8522_state *state = fe->demodulator_priv; 521 struct au8522_state *state = fe->demodulator_priv;
@@ -672,6 +690,7 @@ static struct dvb_frontend_ops au8522_ops = {
672 }, 690 },
673 691
674 .init = au8522_init, 692 .init = au8522_init,
693 .sleep = au8522_sleep,
675 .i2c_gate_ctrl = au8522_i2c_gate_ctrl, 694 .i2c_gate_ctrl = au8522_i2c_gate_ctrl,
676 .set_frontend = au8522_set_frontend, 695 .set_frontend = au8522_set_frontend,
677 .get_frontend = au8522_get_frontend, 696 .get_frontend = au8522_get_frontend,