diff options
author | Andrew de Quincey <adq_dvb@lidskialf.net> | 2006-04-18 16:47:10 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-06-25 00:58:40 -0400 |
commit | 53a8ee3e903659482e009481ab51d6a6572e6a57 (patch) | |
tree | 18b67dc32c20b63192053501c9327427d6b78910 /drivers/media/dvb/frontends/stv0299.c | |
parent | 66292ebee9c30e05d5df0229b2fa966883082cd3 (diff) |
V4L/DVB (3855): Convert stv0299 to refactored tuner code
Convert to tuner_ops calls.
Remove pll function pointers from structure.
Remove unneeded tuner calls.
Add i2c gate control function.
Remove extra exported 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/stv0299.c')
-rw-r--r-- | drivers/media/dvb/frontends/stv0299.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index 5bcd00f792e6..5a81310235a4 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c | |||
@@ -131,13 +131,6 @@ static int stv0299_readregs (struct stv0299_state* state, u8 reg1, u8 *b, u8 len | |||
131 | return ret == 2 ? 0 : ret; | 131 | return ret == 2 ? 0 : ret; |
132 | } | 132 | } |
133 | 133 | ||
134 | int stv0299_enable_plli2c (struct dvb_frontend* fe) | ||
135 | { | ||
136 | struct stv0299_state* state = fe->demodulator_priv; | ||
137 | |||
138 | return stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ | ||
139 | } | ||
140 | |||
141 | static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec) | 134 | static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec) |
142 | { | 135 | { |
143 | dprintk ("%s\n", __FUNCTION__); | 136 | dprintk ("%s\n", __FUNCTION__); |
@@ -457,12 +450,6 @@ static int stv0299_init (struct dvb_frontend* fe) | |||
457 | for (i=0; !(state->config->inittab[i] == 0xff && state->config->inittab[i+1] == 0xff); i+=2) | 450 | for (i=0; !(state->config->inittab[i] == 0xff && state->config->inittab[i+1] == 0xff); i+=2) |
458 | stv0299_writeregI(state, state->config->inittab[i], state->config->inittab[i+1]); | 451 | stv0299_writeregI(state, state->config->inittab[i], state->config->inittab[i+1]); |
459 | 452 | ||
460 | if (state->config->pll_init) { | ||
461 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ | ||
462 | state->config->pll_init(fe, state->i2c); | ||
463 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ | ||
464 | } | ||
465 | |||
466 | return 0; | 453 | return 0; |
467 | } | 454 | } |
468 | 455 | ||
@@ -560,9 +547,10 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
560 | if (state->config->invert) invval = (~invval) & 1; | 547 | if (state->config->invert) invval = (~invval) & 1; |
561 | stv0299_writeregI(state, 0x0c, (stv0299_readreg(state, 0x0c) & 0xfe) | invval); | 548 | stv0299_writeregI(state, 0x0c, (stv0299_readreg(state, 0x0c) & 0xfe) | invval); |
562 | 549 | ||
563 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ | 550 | if (fe->ops->tuner_ops.set_params) { |
564 | state->config->pll_set(fe, state->i2c, p); | 551 | fe->ops->tuner_ops.set_params(fe, p); |
565 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ | 552 | if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0); |
553 | } | ||
566 | 554 | ||
567 | stv0299_set_FEC (state, p->u.qpsk.fec_inner); | 555 | stv0299_set_FEC (state, p->u.qpsk.fec_inner); |
568 | stv0299_set_symbolrate (fe, p->u.qpsk.symbol_rate); | 556 | stv0299_set_symbolrate (fe, p->u.qpsk.symbol_rate); |
@@ -611,6 +599,17 @@ static int stv0299_sleep(struct dvb_frontend* fe) | |||
611 | return 0; | 599 | return 0; |
612 | } | 600 | } |
613 | 601 | ||
602 | static int stv0299_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | ||
603 | { | ||
604 | struct stv0299_state* state = fe->demodulator_priv; | ||
605 | |||
606 | if (enable) { | ||
607 | return stv0299_writeregI(state, 0x05, 0xb5); | ||
608 | } else { | ||
609 | return stv0299_writeregI(state, 0x05, 0x35); | ||
610 | } | ||
611 | } | ||
612 | |||
614 | static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) | 613 | static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) |
615 | { | 614 | { |
616 | struct stv0299_state* state = fe->demodulator_priv; | 615 | struct stv0299_state* state = fe->demodulator_priv; |
@@ -695,6 +694,7 @@ static struct dvb_frontend_ops stv0299_ops = { | |||
695 | 694 | ||
696 | .init = stv0299_init, | 695 | .init = stv0299_init, |
697 | .sleep = stv0299_sleep, | 696 | .sleep = stv0299_sleep, |
697 | .i2c_gate_ctrl = stv0299_i2c_gate_ctrl, | ||
698 | 698 | ||
699 | .set_frontend = stv0299_set_frontend, | 699 | .set_frontend = stv0299_set_frontend, |
700 | .get_frontend = stv0299_get_frontend, | 700 | .get_frontend = stv0299_get_frontend, |
@@ -721,9 +721,8 @@ MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); | |||
721 | 721 | ||
722 | MODULE_DESCRIPTION("ST STV0299 DVB Demodulator driver"); | 722 | MODULE_DESCRIPTION("ST STV0299 DVB Demodulator driver"); |
723 | MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, " | 723 | MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, " |
724 | "Andreas Oberritter, Andrew de Quincey, Kenneth Aafløy"); | 724 | "Andreas Oberritter, Andrew de Quincey, Kenneth Aafly"); |
725 | MODULE_LICENSE("GPL"); | 725 | MODULE_LICENSE("GPL"); |
726 | 726 | ||
727 | EXPORT_SYMBOL(stv0299_enable_plli2c); | ||
728 | EXPORT_SYMBOL(stv0299_writereg); | 727 | EXPORT_SYMBOL(stv0299_writereg); |
729 | EXPORT_SYMBOL(stv0299_attach); | 728 | EXPORT_SYMBOL(stv0299_attach); |