aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/media/dvb/frontends/stv0299.c35
-rw-r--r--drivers/media/dvb/frontends/stv0299.h5
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
134int 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
141static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec) 134static 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
602static 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
614static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) 613static 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
722MODULE_DESCRIPTION("ST STV0299 DVB Demodulator driver"); 722MODULE_DESCRIPTION("ST STV0299 DVB Demodulator driver");
723MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, " 723MODULE_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");
725MODULE_LICENSE("GPL"); 725MODULE_LICENSE("GPL");
726 726
727EXPORT_SYMBOL(stv0299_enable_plli2c);
728EXPORT_SYMBOL(stv0299_writereg); 727EXPORT_SYMBOL(stv0299_writereg);
729EXPORT_SYMBOL(stv0299_attach); 728EXPORT_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
96extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data); 92extern int stv0299_writereg (struct dvb_frontend* fe, u8 reg, u8 data);
97extern int stv0299_enable_plli2c (struct dvb_frontend* fe);
98 93
99extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, 94extern struct dvb_frontend* stv0299_attach(const struct stv0299_config* config,
100 struct i2c_adapter* i2c); 95 struct i2c_adapter* i2c);