]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/media/dvb/frontends/stv0299.c
V4L/DVB (3935): Add missing pll gate control calls
[linux-2.6-omap-h63xx.git] / drivers / media / dvb / frontends / stv0299.c
index 177d71d56b67ac579ac9111c5397bffcbfa01dbe..e91bb5842dc416fabe8e0d342b626daa3431b54c 100644 (file)
@@ -387,7 +387,7 @@ static int stv0299_set_voltage (struct dvb_frontend* fe, fe_sec_voltage_t voltag
        };
 }
 
-static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, u32 cmd)
+static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, unsigned long cmd)
 {
        struct stv0299_state* state = fe->demodulator_priv;
        u8 reg0x08;
@@ -407,7 +407,7 @@ static int stv0299_send_legacy_dish_cmd (struct dvb_frontend* fe, u32 cmd)
 
        cmd = cmd << 1;
        if (debug_legacy_dish_switch)
-               printk ("%s switch command: 0x%04x\n",__FUNCTION__, cmd);
+               printk ("%s switch command: 0x%04lx\n",__FUNCTION__, cmd);
 
        do_gettimeofday (&nexttime);
        if (debug_legacy_dish_switch)
@@ -450,12 +450,6 @@ static int stv0299_init (struct dvb_frontend* fe)
        for (i=0; !(state->config->inittab[i] == 0xff && state->config->inittab[i+1] == 0xff); i+=2)
                stv0299_writeregI(state, state->config->inittab[i], state->config->inittab[i+1]);
 
-       if (state->config->pll_init) {
-               stv0299_writeregI(state, 0x05, 0xb5);   /*  enable i2c repeater on stv0299  */
-               state->config->pll_init(fe, state->i2c);
-               stv0299_writeregI(state, 0x05, 0x35);   /*  disable i2c repeater on stv0299  */
-       }
-
        return 0;
 }
 
@@ -553,9 +547,10 @@ static int stv0299_set_frontend(struct dvb_frontend* fe, struct dvb_frontend_par
        if (state->config->invert) invval = (~invval) & 1;
        stv0299_writeregI(state, 0x0c, (stv0299_readreg(state, 0x0c) & 0xfe) | invval);
 
-       stv0299_writeregI(state, 0x05, 0xb5);   /*  enable i2c repeater on stv0299  */
-       state->config->pll_set(fe, state->i2c, p);
-       stv0299_writeregI(state, 0x05, 0x35);   /*  disable i2c repeater on stv0299  */
+       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);
+       }
 
        stv0299_set_FEC (state, p->u.qpsk.fec_inner);
        stv0299_set_symbolrate (fe, p->u.qpsk.symbol_rate);
@@ -604,6 +599,19 @@ static int stv0299_sleep(struct dvb_frontend* fe)
        return 0;
 }
 
+static int stv0299_i2c_gate_ctrl(struct dvb_frontend* fe, int enable)
+{
+       struct stv0299_state* state = fe->demodulator_priv;
+
+       if (enable) {
+               stv0299_writeregI(state, 0x05, 0xb5);
+       } else {
+               stv0299_writeregI(state, 0x05, 0x35);
+       }
+       udelay(1);
+       return 0;
+}
+
 static int stv0299_get_tune_settings(struct dvb_frontend* fe, struct dvb_frontend_tune_settings* fesettings)
 {
        struct stv0299_state* state = fe->demodulator_priv;
@@ -688,6 +696,7 @@ static struct dvb_frontend_ops stv0299_ops = {
 
        .init = stv0299_init,
        .sleep = stv0299_sleep,
+       .i2c_gate_ctrl = stv0299_i2c_gate_ctrl,
 
        .set_frontend = stv0299_set_frontend,
        .get_frontend = stv0299_get_frontend,
@@ -714,7 +723,7 @@ MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
 
 MODULE_DESCRIPTION("ST STV0299 DVB Demodulator driver");
 MODULE_AUTHOR("Ralph Metzler, Holger Waechtler, Peter Schildmann, Felix Domke, "
-             "Andreas Oberritter, Andrew de Quincey, Kenneth AaflΓΈy");
+             "Andreas Oberritter, Andrew de Quincey, Kenneth Aafly");
 MODULE_LICENSE("GPL");
 
 EXPORT_SYMBOL(stv0299_writereg);