aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAndrew de Quincey <adq_dvb@lidskialf.net>2006-04-18 16:47:09 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-06-25 00:58:35 -0400
commita81870e00bf502db2c579dcb9721adab3775ba58 (patch)
treef235348748b929e42aadc6a2dd5314fa6308b689 /drivers
parent0244422220f149d2e930deab89515fd5ca9a6bdd (diff)
V4L/DVB (3849): Convert mt312 to refactored tuner code
Convert to tuner_ops calls. Remove pll function pointers from structure. Remove unneeded tuner calls. Add i2c gate control function. Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/frontends/mt312.c25
-rw-r--r--drivers/media/dvb/frontends/mt312.h4
2 files changed, 16 insertions, 13 deletions
diff --git a/drivers/media/dvb/frontends/mt312.c b/drivers/media/dvb/frontends/mt312.c
index d3aea83cf218..46e12a8acf72 100644
--- a/drivers/media/dvb/frontends/mt312.c
+++ b/drivers/media/dvb/frontends/mt312.c
@@ -277,12 +277,6 @@ static int mt312_initfe(struct dvb_frontend* fe)
277 if ((ret = mt312_writereg(state, CS_SW_LIM, 0x69)) < 0) 277 if ((ret = mt312_writereg(state, CS_SW_LIM, 0x69)) < 0)
278 return ret; 278 return ret;
279 279
280 if (state->config->pll_init) {
281 mt312_writereg(state, GPP_CTRL, 0x40);
282 state->config->pll_init(fe);
283 mt312_writereg(state, GPP_CTRL, 0x00);
284 }
285
286 return 0; 280 return 0;
287} 281}
288 282
@@ -529,9 +523,10 @@ static int mt312_set_frontend(struct dvb_frontend* fe,
529 return -EINVAL; 523 return -EINVAL;
530 } 524 }
531 525
532 mt312_writereg(state, GPP_CTRL, 0x40); 526 if (fe->ops->tuner_ops.set_params) {
533 state->config->pll_set(fe, p); 527 fe->ops->tuner_ops.set_params(fe, p);
534 mt312_writereg(state, GPP_CTRL, 0x00); 528 if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0);
529 }
535 530
536 /* sr = (u16)(sr * 256.0 / 1000000.0) */ 531 /* sr = (u16)(sr * 256.0 / 1000000.0) */
537 sr = mt312_div(p->u.qpsk.symbol_rate * 4, 15625); 532 sr = mt312_div(p->u.qpsk.symbol_rate * 4, 15625);
@@ -578,6 +573,17 @@ static int mt312_get_frontend(struct dvb_frontend* fe,
578 return 0; 573 return 0;
579} 574}
580 575
576static int mt312_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
577{
578 struct mt312_state* state = fe->demodulator_priv;
579
580 if (enable) {
581 return mt312_writereg(state, GPP_CTRL, 0x40);
582 } else {
583 return mt312_writereg(state, GPP_CTRL, 0x00);
584 }
585}
586
581static int mt312_sleep(struct dvb_frontend* fe) 587static int mt312_sleep(struct dvb_frontend* fe)
582{ 588{
583 struct mt312_state *state = fe->demodulator_priv; 589 struct mt312_state *state = fe->demodulator_priv;
@@ -633,6 +639,7 @@ static struct dvb_frontend_ops vp310_mt312_ops = {
633 639
634 .init = mt312_initfe, 640 .init = mt312_initfe,
635 .sleep = mt312_sleep, 641 .sleep = mt312_sleep,
642 .i2c_gate_ctrl = mt312_i2c_gate_ctrl,
636 643
637 .set_frontend = mt312_set_frontend, 644 .set_frontend = mt312_set_frontend,
638 .get_frontend = mt312_get_frontend, 645 .get_frontend = mt312_get_frontend,
diff --git a/drivers/media/dvb/frontends/mt312.h b/drivers/media/dvb/frontends/mt312.h
index 074d844f0139..666a1bd1c244 100644
--- a/drivers/media/dvb/frontends/mt312.h
+++ b/drivers/media/dvb/frontends/mt312.h
@@ -32,10 +32,6 @@ struct mt312_config
32{ 32{
33 /* the demodulator's i2c address */ 33 /* the demodulator's i2c address */
34 u8 demod_address; 34 u8 demod_address;
35
36 /* PLL maintenance */
37 int (*pll_init)(struct dvb_frontend* fe);
38 int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
39}; 35};
40 36
41struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config, 37struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config,