aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/cx22702.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/cx22702.c')
-rw-r--r--drivers/media/dvb/frontends/cx22702.c29
1 files changed, 5 insertions, 24 deletions
diff --git a/drivers/media/dvb/frontends/cx22702.c b/drivers/media/dvb/frontends/cx22702.c
index 0fc899f81c5..4106d46c957 100644
--- a/drivers/media/dvb/frontends/cx22702.c
+++ b/drivers/media/dvb/frontends/cx22702.c
@@ -40,8 +40,6 @@ struct cx22702_state {
40 40
41 struct i2c_adapter* i2c; 41 struct i2c_adapter* i2c;
42 42
43 struct dvb_frontend_ops ops;
44
45 /* configuration settings */ 43 /* configuration settings */
46 const struct cx22702_config* config; 44 const struct cx22702_config* config;
47 45
@@ -211,22 +209,10 @@ static int cx22702_set_tps (struct dvb_frontend* fe, struct dvb_frontend_paramet
211 u8 val; 209 u8 val;
212 struct cx22702_state* state = fe->demodulator_priv; 210 struct cx22702_state* state = fe->demodulator_priv;
213 211
214 /* set PLL */ 212 if (fe->ops.tuner_ops.set_params) {
215 cx22702_i2c_gate_ctrl(fe, 1); 213 fe->ops.tuner_ops.set_params(fe, p);
216 if (state->config->pll_set) { 214 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
217 state->config->pll_set(fe, p);
218 } else if (state->config->pll_desc) {
219 u8 pllbuf[4];
220 struct i2c_msg msg = { .addr = state->config->pll_address,
221 .buf = pllbuf, .len = 4 };
222 dvb_pll_configure(state->config->pll_desc, pllbuf,
223 p->frequency,
224 p->u.ofdm.bandwidth);
225 i2c_transfer(state->i2c, &msg, 1);
226 } else {
227 BUG();
228 } 215 }
229 cx22702_i2c_gate_ctrl(fe, 0);
230 216
231 /* set inversion */ 217 /* set inversion */
232 cx22702_set_inversion (state, p->inversion); 218 cx22702_set_inversion (state, p->inversion);
@@ -358,10 +344,6 @@ static int cx22702_init (struct dvb_frontend* fe)
358 344
359 cx22702_writereg (state, 0xf8, (state->config->output_mode << 1) & 0x02); 345 cx22702_writereg (state, 0xf8, (state->config->output_mode << 1) & 0x02);
360 346
361 /* init PLL */
362 if (state->config->pll_init)
363 state->config->pll_init(fe);
364
365 cx22702_i2c_gate_ctrl(fe, 0); 347 cx22702_i2c_gate_ctrl(fe, 0);
366 348
367 return 0; 349 return 0;
@@ -495,7 +477,6 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config,
495 /* setup the state */ 477 /* setup the state */
496 state->config = config; 478 state->config = config;
497 state->i2c = i2c; 479 state->i2c = i2c;
498 memcpy(&state->ops, &cx22702_ops, sizeof(struct dvb_frontend_ops));
499 state->prevUCBlocks = 0; 480 state->prevUCBlocks = 0;
500 481
501 /* check if the demod is there */ 482 /* check if the demod is there */
@@ -503,7 +484,7 @@ struct dvb_frontend* cx22702_attach(const struct cx22702_config* config,
503 goto error; 484 goto error;
504 485
505 /* create dvb_frontend */ 486 /* create dvb_frontend */
506 state->frontend.ops = &state->ops; 487 memcpy(&state->frontend.ops, &cx22702_ops, sizeof(struct dvb_frontend_ops));
507 state->frontend.demodulator_priv = state; 488 state->frontend.demodulator_priv = state;
508 return &state->frontend; 489 return &state->frontend;
509 490
@@ -530,6 +511,7 @@ static struct dvb_frontend_ops cx22702_ops = {
530 .release = cx22702_release, 511 .release = cx22702_release,
531 512
532 .init = cx22702_init, 513 .init = cx22702_init,
514 .i2c_gate_ctrl = cx22702_i2c_gate_ctrl,
533 515
534 .set_frontend = cx22702_set_tps, 516 .set_frontend = cx22702_set_tps,
535 .get_frontend = cx22702_get_frontend, 517 .get_frontend = cx22702_get_frontend,
@@ -540,7 +522,6 @@ static struct dvb_frontend_ops cx22702_ops = {
540 .read_signal_strength = cx22702_read_signal_strength, 522 .read_signal_strength = cx22702_read_signal_strength,
541 .read_snr = cx22702_read_snr, 523 .read_snr = cx22702_read_snr,
542 .read_ucblocks = cx22702_read_ucblocks, 524 .read_ucblocks = cx22702_read_ucblocks,
543 .i2c_gate_ctrl = cx22702_i2c_gate_ctrl,
544}; 525};
545 526
546module_param(debug, int, 0644); 527module_param(debug, int, 0644);