aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/ves1x93.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/dvb/frontends/ves1x93.c')
-rw-r--r--drivers/media/dvb/frontends/ves1x93.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/drivers/media/dvb/frontends/ves1x93.c b/drivers/media/dvb/frontends/ves1x93.c
index 821df8e839d0..54d7b07571b8 100644
--- a/drivers/media/dvb/frontends/ves1x93.c
+++ b/drivers/media/dvb/frontends/ves1x93.c
@@ -36,7 +36,6 @@
36 36
37struct ves1x93_state { 37struct ves1x93_state {
38 struct i2c_adapter* i2c; 38 struct i2c_adapter* i2c;
39 struct dvb_frontend_ops ops;
40 /* configuration settings */ 39 /* configuration settings */
41 const struct ves1x93_config* config; 40 const struct ves1x93_config* config;
42 struct dvb_frontend frontend; 41 struct dvb_frontend frontend;
@@ -278,12 +277,6 @@ static int ves1x93_init (struct dvb_frontend* fe)
278 } 277 }
279 } 278 }
280 279
281 if (state->config->pll_init) {
282 ves1x93_writereg(state, 0x00, 0x11);
283 state->config->pll_init(fe);
284 ves1x93_writereg(state, 0x00, 0x01);
285 }
286
287 return 0; 280 return 0;
288} 281}
289 282
@@ -395,9 +388,10 @@ static int ves1x93_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
395{ 388{
396 struct ves1x93_state* state = fe->demodulator_priv; 389 struct ves1x93_state* state = fe->demodulator_priv;
397 390
398 ves1x93_writereg(state, 0x00, 0x11); 391 if (fe->ops.tuner_ops.set_params) {
399 state->config->pll_set(fe, p); 392 fe->ops.tuner_ops.set_params(fe, p);
400 ves1x93_writereg(state, 0x00, 0x01); 393 if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 0);
394 }
401 ves1x93_set_inversion (state, p->inversion); 395 ves1x93_set_inversion (state, p->inversion);
402 ves1x93_set_fec (state, p->u.qpsk.fec_inner); 396 ves1x93_set_fec (state, p->u.qpsk.fec_inner);
403 ves1x93_set_symbolrate (state, p->u.qpsk.symbol_rate); 397 ves1x93_set_symbolrate (state, p->u.qpsk.symbol_rate);
@@ -442,6 +436,17 @@ static void ves1x93_release(struct dvb_frontend* fe)
442 kfree(state); 436 kfree(state);
443} 437}
444 438
439static int ves1x93_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
440{
441 struct ves1x93_state* state = fe->demodulator_priv;
442
443 if (enable) {
444 return ves1x93_writereg(state, 0x00, 0x11);
445 } else {
446 return ves1x93_writereg(state, 0x00, 0x01);
447 }
448}
449
445static struct dvb_frontend_ops ves1x93_ops; 450static struct dvb_frontend_ops ves1x93_ops;
446 451
447struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, 452struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config,
@@ -457,7 +462,6 @@ struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config,
457 /* setup the state */ 462 /* setup the state */
458 state->config = config; 463 state->config = config;
459 state->i2c = i2c; 464 state->i2c = i2c;
460 memcpy(&state->ops, &ves1x93_ops, sizeof(struct dvb_frontend_ops));
461 state->inversion = INVERSION_OFF; 465 state->inversion = INVERSION_OFF;
462 466
463 /* check if the demod is there + identify it */ 467 /* check if the demod is there + identify it */
@@ -492,7 +496,7 @@ struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config,
492 } 496 }
493 497
494 /* create dvb_frontend */ 498 /* create dvb_frontend */
495 state->frontend.ops = &state->ops; 499 memcpy(&state->frontend.ops, &ves1x93_ops, sizeof(struct dvb_frontend_ops));
496 state->frontend.demodulator_priv = state; 500 state->frontend.demodulator_priv = state;
497 return &state->frontend; 501 return &state->frontend;
498 502
@@ -523,6 +527,7 @@ static struct dvb_frontend_ops ves1x93_ops = {
523 527
524 .init = ves1x93_init, 528 .init = ves1x93_init,
525 .sleep = ves1x93_sleep, 529 .sleep = ves1x93_sleep,
530 .i2c_gate_ctrl = ves1x93_i2c_gate_ctrl,
526 531
527 .set_frontend = ves1x93_set_frontend, 532 .set_frontend = ves1x93_set_frontend,
528 .get_frontend = ves1x93_get_frontend, 533 .get_frontend = ves1x93_get_frontend,