aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-04-18 16:47:10 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:58:45 -0400
commita98af2246b3d0e85566b3b489ffbc8018b21b4a3 (patch)
treec623cf3b886fdff23157c57310977f311f408a95 /drivers/media/dvb/frontends
parent74349bef1a5b5a287721a42bec08c226b095e8b0 (diff)
V4L/DVB (3859): Convert s5h1420 to refactored tuner code
Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends')
-rw-r--r--drivers/media/dvb/frontends/s5h1420.c39
-rw-r--r--drivers/media/dvb/frontends/s5h1420.h4
2 files changed, 25 insertions, 18 deletions
diff --git a/drivers/media/dvb/frontends/s5h1420.c b/drivers/media/dvb/frontends/s5h1420.c
index d69477596921..5dee511544bf 100644
--- a/drivers/media/dvb/frontends/s5h1420.c
+++ b/drivers/media/dvb/frontends/s5h1420.c
@@ -584,7 +584,6 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe,
584 struct s5h1420_state* state = fe->demodulator_priv; 584 struct s5h1420_state* state = fe->demodulator_priv;
585 int frequency_delta; 585 int frequency_delta;
586 struct dvb_frontend_tune_settings fesettings; 586 struct dvb_frontend_tune_settings fesettings;
587 u32 tmp;
588 587
589 /* check if we should do a fast-tune */ 588 /* check if we should do a fast-tune */
590 memcpy(&fesettings.parameters, p, sizeof(struct dvb_frontend_parameters)); 589 memcpy(&fesettings.parameters, p, sizeof(struct dvb_frontend_parameters));
@@ -596,10 +595,17 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe,
596 (state->fec_inner == p->u.qpsk.fec_inner) && 595 (state->fec_inner == p->u.qpsk.fec_inner) &&
597 (state->symbol_rate == p->u.qpsk.symbol_rate)) { 596 (state->symbol_rate == p->u.qpsk.symbol_rate)) {
598 597
599 if (state->config->pll_set) { 598 if (fe->ops->tuner_ops.set_params) {
600 s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); 599 fe->ops->tuner_ops.set_params(fe, p);
601 state->config->pll_set(fe, p, &tmp); 600 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0);
601 }
602 if (fe->ops->tuner_ops.get_frequency) {
603 u32 tmp;
604 fe->ops->tuner_ops.get_frequency(fe, &tmp);
605 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0);
602 s5h1420_setfreqoffset(state, p->frequency - tmp); 606 s5h1420_setfreqoffset(state, p->frequency - tmp);
607 } else {
608 s5h1420_setfreqoffset(state, 0);
603 } 609 }
604 return 0; 610 return 0;
605 } 611 }
@@ -646,9 +652,9 @@ static int s5h1420_set_frontend(struct dvb_frontend* fe,
646 s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) | 1); 652 s5h1420_writereg(state, 0x05, s5h1420_readreg(state, 0x05) | 1);
647 653
648 /* set tuner PLL */ 654 /* set tuner PLL */
649 if (state->config->pll_set) { 655 if (fe->ops->tuner_ops.set_params) {
650 s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1); 656 fe->ops->tuner_ops.set_params(fe, p);
651 state->config->pll_set(fe, p, &tmp); 657 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0);
652 s5h1420_setfreqoffset(state, 0); 658 s5h1420_setfreqoffset(state, 0);
653 } 659 }
654 660
@@ -708,6 +714,17 @@ static int s5h1420_get_tune_settings(struct dvb_frontend* fe,
708 return 0; 714 return 0;
709} 715}
710 716
717static int s5h1420_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
718{
719 struct s5h1420_state* state = fe->demodulator_priv;
720
721 if (enable) {
722 return s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1);
723 } else {
724 return s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) & 0xfe);
725 }
726}
727
711static int s5h1420_init (struct dvb_frontend* fe) 728static int s5h1420_init (struct dvb_frontend* fe)
712{ 729{
713 struct s5h1420_state* state = fe->demodulator_priv; 730 struct s5h1420_state* state = fe->demodulator_priv;
@@ -717,13 +734,6 @@ static int s5h1420_init (struct dvb_frontend* fe)
717 msleep(10); 734 msleep(10);
718 s5h1420_reset(state); 735 s5h1420_reset(state);
719 736
720 /* init PLL */
721 if (state->config->pll_init) {
722 s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) | 1);
723 state->config->pll_init(fe);
724 s5h1420_writereg (state, 0x02, s5h1420_readreg(state,0x02) & 0xfe);
725 }
726
727 return 0; 737 return 0;
728} 738}
729 739
@@ -800,6 +810,7 @@ static struct dvb_frontend_ops s5h1420_ops = {
800 810
801 .init = s5h1420_init, 811 .init = s5h1420_init,
802 .sleep = s5h1420_sleep, 812 .sleep = s5h1420_sleep,
813 .i2c_gate_ctrl = s5h1420_i2c_gate_ctrl,
803 814
804 .set_frontend = s5h1420_set_frontend, 815 .set_frontend = s5h1420_set_frontend,
805 .get_frontend = s5h1420_get_frontend, 816 .get_frontend = s5h1420_get_frontend,
diff --git a/drivers/media/dvb/frontends/s5h1420.h b/drivers/media/dvb/frontends/s5h1420.h
index 73296f13c324..4e39015fa67e 100644
--- a/drivers/media/dvb/frontends/s5h1420.h
+++ b/drivers/media/dvb/frontends/s5h1420.h
@@ -32,10 +32,6 @@ struct s5h1420_config
32 32
33 /* does the inversion require inversion? */ 33 /* does the inversion require inversion? */
34 u8 invert:1; 34 u8 invert:1;
35
36 /* PLL maintenance */
37 int (*pll_init)(struct dvb_frontend* fe);
38 int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params, u32* freqout);
39}; 35};
40 36
41extern struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config, 37extern struct dvb_frontend* s5h1420_attach(const struct s5h1420_config* config,