diff options
Diffstat (limited to 'drivers/media/dvb/frontends/stv0299.c')
-rw-r--r-- | drivers/media/dvb/frontends/stv0299.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/drivers/media/dvb/frontends/stv0299.c b/drivers/media/dvb/frontends/stv0299.c index 5bcd00f792e6..96648a75440d 100644 --- a/drivers/media/dvb/frontends/stv0299.c +++ b/drivers/media/dvb/frontends/stv0299.c | |||
@@ -56,7 +56,6 @@ | |||
56 | 56 | ||
57 | struct stv0299_state { | 57 | struct stv0299_state { |
58 | struct i2c_adapter* i2c; | 58 | struct i2c_adapter* i2c; |
59 | struct dvb_frontend_ops ops; | ||
60 | const struct stv0299_config* config; | 59 | const struct stv0299_config* config; |
61 | struct dvb_frontend frontend; | 60 | struct dvb_frontend frontend; |
62 | 61 | ||
@@ -131,13 +130,6 @@ static int stv0299_readregs (struct stv0299_state* state, u8 reg1, u8 *b, u8 len | |||
131 | return ret == 2 ? 0 : ret; | 130 | return ret == 2 ? 0 : ret; |
132 | } | 131 | } |
133 | 132 | ||
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) | 133 | static int stv0299_set_FEC (struct stv0299_state* state, fe_code_rate_t fec) |
142 | { | 134 | { |
143 | dprintk ("%s\n", __FUNCTION__); | 135 | dprintk ("%s\n", __FUNCTION__); |
@@ -457,12 +449,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) | 449 | 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]); | 450 | stv0299_writeregI(state, state->config->inittab[i], state->config->inittab[i+1]); |
459 | 451 | ||
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; | 452 | return 0; |
467 | } | 453 | } |
468 | 454 | ||
@@ -560,9 +546,10 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par | |||
560 | if (state->config->invert) invval = (~invval) & 1; | 546 | if (state->config->invert) invval = (~invval) & 1; |
561 | stv0299_writeregI(state, 0x0c, (stv0299_readreg(state, 0x0c) & 0xfe) | invval); | 547 | stv0299_writeregI(state, 0x0c, (stv0299_readreg(state, 0x0c) & 0xfe) | invval); |
562 | 548 | ||
563 | stv0299_writeregI(state, 0x05, 0xb5); /* enable i2c repeater on stv0299 */ | 549 | if (fe->ops.tuner_ops.set_params) { |
564 | state->config->pll_set(fe, state->i2c, p); | 550 | fe->ops.tuner_ops.set_params(fe, p); |
565 | stv0299_writeregI(state, 0x05, 0x35); /* disable i2c repeater on stv0299 */ | 551 | if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0); |
552 | } | ||
566 | 553 | ||
567 | stv0299_set_FEC (state, p->u.qpsk.fec_inner); | 554 | stv0299_set_FEC (state, p->u.qpsk.fec_inner); |
568 | stv0299_set_symbolrate (fe, p->u.qpsk.symbol_rate); | 555 | stv0299_set_symbolrate (fe, p->u.qpsk.symbol_rate); |
@@ -611,6 +598,19 @@ static int stv0299_sleep(struct dvb_frontend* fe) | |||
611 | return 0; | 598 | return 0; |
612 | } | 599 | } |
613 | 600 | ||
601 | static int stv0299_i2c_gate_ctrl(struct dvb_frontend* fe, int enable) | ||
602 | { | ||
603 | struct stv0299_state* state = fe->demodulator_priv; | ||
604 | |||
605 | if (enable) { | ||
606 | stv0299_writeregI(state, 0x05, 0xb5); | ||
607 | } else { | ||
608 | stv0299_writeregI(state, 0x05, 0x35); | ||
609 | } | ||
610 | udelay(1); | ||
611 | return 0; | ||
612 | } | ||
613 | |||
614 | static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) | 614 | static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings) |
615 | { | 615 | { |
616 | struct stv0299_state* state = fe->demodulator_priv; | 616 | struct stv0299_state* state = fe->demodulator_priv; |
@@ -647,7 +647,6 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | |||
647 | /* setup the state */ | 647 | /* setup the state */ |
648 | state->config = config; | 648 | state->config = config; |
649 | state->i2c = i2c; | 649 | state->i2c = i2c; |
650 | memcpy(&state->ops, &stv0299_ops, sizeof(struct dvb_frontend_ops)); | ||
651 | state->initialised = 0; | 650 | state->initialised = 0; |
652 | state->tuner_frequency = 0; | 651 | state->tuner_frequency = 0; |
653 | state->symbol_rate = 0; | 652 | state->symbol_rate = 0; |
@@ -664,7 +663,7 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, | |||
664 | if (id != 0xa1 && id != 0x80) goto error; | 663 | if (id != 0xa1 && id != 0x80) goto error; |
665 | 664 | ||
666 | /* create dvb_frontend */ | 665 | /* create dvb_frontend */ |
667 | state->frontend.ops = &state->ops; | 666 | memcpy(&state->frontend.ops, &stv0299_ops, sizeof(struct dvb_frontend_ops)); |
668 | state->frontend.demodulator_priv = state; | 667 | state->frontend.demodulator_priv = state; |
669 | return &state->frontend; | 668 | return &state->frontend; |
670 | 669 | ||
@@ -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); |