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 | |
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>
-rw-r--r-- | drivers/media/dvb/frontends/stv0299.c | 35 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stv0299.h | 5 |
2 files changed, 17 insertions, 23 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); |
diff --git a/drivers/media/dvb/frontends/stv0299.h b/drivers/media/dvb/frontends/stv0299.h index 32c87b4c2f13..1504828e4232 100644 --- a/drivers/media/dvb/frontends/stv0299.h +++ b/drivers/media/dvb/frontends/stv0299.h | |||
@@ -87,14 +87,9 @@ struct stv0299_config | |||
87 | 87 | ||
88 | /* Set the symbol rate */ | 88 | /* Set the symbol rate */ |
89 | int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio); | 89 | int (*set_symbol_rate)(struct dvb_frontend* fe, u32 srate, u32 ratio); |
90 | |||
91 | /* PLL maintenance */ | ||
92 | int (*pll_init)(struct dvb_frontend *fe, struct i2c_adapter *i2c); | ||
93 | int (*pll_set)(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dvb_frontend_parameters *params); | ||
94 | }; | 90 | }; |
95 | 91 | ||
96 | extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data); | 92 | extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data); |
97 | extern int stv0299_enable_plli2c (struct dvb_frontend* fe); | ||
98 | 93 | ||
99 | extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | 94 | extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, |
100 | struct i2c_adapter* i2c); | 95 | struct i2c_adapter* i2c); |