]> git.karo-electronics.de Git - linux-beck.git/commitdiff
V4L/DVB (3849): Convert mt312 to refactored tuner code
authorAndrew de Quincey <adq_dvb@lidskialf.net>
Tue, 18 Apr 2006 20:47:09 +0000 (17:47 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 25 Jun 2006 04:58:35 +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/mt312.c
drivers/media/dvb/frontends/mt312.h

index d3aea83cf218e23fff5cc841cb1178152af885c7..46e12a8acf728b2b103fd88528edfc226268f44c 100644 (file)
@@ -277,12 +277,6 @@ static int mt312_initfe(struct dvb_frontend* fe)
        if ((ret = mt312_writereg(state, CS_SW_LIM, 0x69)) < 0)
                return ret;
 
-       if (state->config->pll_init) {
-               mt312_writereg(state, GPP_CTRL, 0x40);
-               state->config->pll_init(fe);
-               mt312_writereg(state, GPP_CTRL, 0x00);
-       }
-
        return 0;
 }
 
@@ -529,9 +523,10 @@ static int mt312_set_frontend(struct dvb_frontend* fe,
                return -EINVAL;
        }
 
-       mt312_writereg(state, GPP_CTRL, 0x40);
-       state->config->pll_set(fe, p);
-       mt312_writereg(state, GPP_CTRL, 0x00);
+       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);
+       }
 
        /* sr = (u16)(sr * 256.0 / 1000000.0) */
        sr = mt312_div(p->u.qpsk.symbol_rate * 4, 15625);
@@ -578,6 +573,17 @@ static int mt312_get_frontend(struct dvb_frontend* fe,
        return 0;
 }
 
+static int mt312_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
+{
+       struct mt312_state* state = fe->demodulator_priv;
+
+       if (enable) {
+               return mt312_writereg(state, GPP_CTRL, 0x40);
+       } else {
+               return mt312_writereg(state, GPP_CTRL, 0x00);
+       }
+}
+
 static int mt312_sleep(struct dvb_frontend* fe)
 {
        struct mt312_state *state = fe->demodulator_priv;
@@ -633,6 +639,7 @@ static struct dvb_frontend_ops vp310_mt312_ops = {
 
        .init = mt312_initfe,
        .sleep = mt312_sleep,
+       .i2c_gate_ctrl = mt312_i2c_gate_ctrl,
 
        .set_frontend = mt312_set_frontend,
        .get_frontend = mt312_get_frontend,
index 074d844f01393678e2e271273f8ba54bdcd6641f..666a1bd1c244ff0752c9b79a64d5abb08c5f7d07 100644 (file)
@@ -32,10 +32,6 @@ struct mt312_config
 {
        /* the demodulator's i2c address */
        u8 demod_address;
-
-       /* PLL maintenance */
-       int (*pll_init)(struct dvb_frontend* fe);
-       int (*pll_set)(struct dvb_frontend* fe, struct dvb_frontend_parameters* params);
 };
 
 struct dvb_frontend* vp310_mt312_attach(const struct mt312_config* config,