V4L/DVB (3854): Convert ves1x93 to refactored tuner code
authorAndrew de Quincey <adq_dvb@lidskialf.net>
Tue, 18 Apr 2006 20:47:10 +0000 (17:47 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 25 Jun 2006 04:58:39 +0000 (01:58 -0300)
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>
drivers/media/dvb/frontends/ves1x93.c
drivers/media/dvb/frontends/ves1x93.h

index 821df8e839d056669d594ac1bcf47adb7d65e9b1..660aa7bb90d0c0591f87ed17192b08419abd535c 100644 (file)
@@ -278,12 +278,6 @@ static int ves1x93_init (struct dvb_frontend* fe)
                }
        }
 
-       if (state->config->pll_init) {
-               ves1x93_writereg(state, 0x00, 0x11);
-               state->config->pll_init(fe);
-               ves1x93_writereg(state, 0x00, 0x01);
-       }
-
        return 0;
 }
 
@@ -395,9 +389,10 @@ static int ves1x93_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
 {
        struct ves1x93_state* state = fe->demodulator_priv;
 
-       ves1x93_writereg(state, 0x00, 0x11);
-       state->config->pll_set(fe, p);
-       ves1x93_writereg(state, 0x00, 0x01);
+       if (fe->ops->tuner_ops.set_params) {
+               fe->ops->tuner_ops.set_params(fe, p);
+               if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0);
+       }
        ves1x93_set_inversion (state, p->inversion);
        ves1x93_set_fec (state, p->u.qpsk.fec_inner);
        ves1x93_set_symbolrate (state, p->u.qpsk.symbol_rate);
@@ -442,6 +437,17 @@ static void ves1x93_release(struct dvb_frontend* fe)
        kfree(state);
 }
 
+static int ves1x93_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
+{
+       struct ves1x93_state* state = fe->demodulator_priv;
+
+       if (enable) {
+               return ves1x93_writereg(state, 0x00, 0x11);
+       } else {
+               return ves1x93_writereg(state, 0x00, 0x01);
+       }
+}
+
 static struct dvb_frontend_ops ves1x93_ops;
 
 struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config,
@@ -523,6 +529,7 @@ static struct dvb_frontend_ops ves1x93_ops = {
 
        .init = ves1x93_init,
        .sleep = ves1x93_sleep,
+       .i2c_gate_ctrl = ves1x93_i2c_gate_ctrl,
 
        .set_frontend = ves1x93_set_frontend,
        .get_frontend = ves1x93_get_frontend,
index 1627e37c57a4681c20da0d42e6eafafc4439cb98..ba88ae0855c994025b4a13c5e07ae65ab919bca7 100644 (file)
@@ -38,10 +38,6 @@ struct ves1x93_config
 
        /* should PWM be inverted? */
        u8 invert_pwm:1;
-
-       /* PLL maintenance */
-       int (*pll_init)(struct dvb_frontend* fe);
-       int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
 };
 
 extern struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config,