]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
V4L/DVB (4032): Fix Pinnacle 300i
authorAndrew de Quincey <adq_dvb@lidskialf.net>
Tue, 16 May 2006 20:22:02 +0000 (17:22 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 25 Jun 2006 05:00:34 +0000 (02:00 -0300)
I had broken the mt352 tuning when a non-directly connected PLL was used -
uncommon, but this is what is used on the pinnacle card.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/frontends/mt352.c
drivers/media/video/saa7134/saa7134-dvb.c

index ed3bede029eb2e4b78122012127366e2f9c6a222..8601a3f43074833301639f1ed2182eb00ce69d34 100644 (file)
@@ -287,30 +287,22 @@ static int mt352_set_parameters(struct dvb_frontend* fe,
        mt352_calc_nominal_rate(state, op->bandwidth, buf+4);
        mt352_calc_input_freq(state, buf+6);
 
-       // if there is no secondary tuner, call set_params to set up a potential
-       // tuner attached elsewhere
        if (state->config.no_tuner) {
                if (fe->ops->tuner_ops.set_params) {
                        fe->ops->tuner_ops.set_params(fe, param);
-                       if (fe->ops->i2c_gate_ctrl) fe->ops->i2c_gate_ctrl(fe, 0);
+                       if (fe->ops->i2c_gate_ctrl)
+                               fe->ops->i2c_gate_ctrl(fe, 0);
                }
 
-               /* start decoding only */
+               mt352_write(fe, buf, 8);
                mt352_write(fe, fsm_go, 2);
-       }
-
-       // retrieve the pllbuf - we do this even if there is no
-       // secondary tuner simply so we have a record of what was sent for
-       // debugging.
-       if (fe->ops->tuner_ops.calc_regs) {
-               fe->ops->tuner_ops.calc_regs(fe, param, buf+8, 5);
-               buf[8] <<= 1;
-               mt352_write(fe, buf, sizeof(buf));
-       }
-
-       // send PLL and start tuning and then decoding
-       if (!state->config.no_tuner) {
-               mt352_write(fe, tuner_go, 2);
+       } else {
+               if (fe->ops->tuner_ops.calc_regs) {
+                       fe->ops->tuner_ops.calc_regs(fe, param, buf+8, 5);
+                       buf[8] <<= 1;
+                       mt352_write(fe, buf, sizeof(buf));
+                       mt352_write(fe, tuner_go, 2);
+               }
        }
 
        return 0;
index f2b155a2299d2c05a18a1ddbf7b57cdaa4e7dbde..716b829c460f95c7f4c34025a429a1d97f6c419e 100644 (file)
@@ -132,9 +132,8 @@ static int mt352_aver777_init(struct dvb_frontend* fe)
        return 0;
 }
 
-static int mt352_pinnacle_tuner_calc_regs(struct dvb_frontend* fe,
-                                      struct dvb_frontend_parameters* params,
-                                      u8* pllbuf, int buf_len)
+static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe,
+                                          struct dvb_frontend_parameters* params)
 {
        u8 off[] = { 0x00, 0xf1};
        u8 on[]  = { 0x00, 0x71};
@@ -143,9 +142,6 @@ static int mt352_pinnacle_tuner_calc_regs(struct dvb_frontend* fe,
        struct saa7134_dev *dev = fe->dvb->priv;
        struct v4l2_frequency f;
 
-       if (buf_len < 5)
-               return -EINVAL;
-
        /* set frequency (mt2050) */
        f.tuner     = 0;
        f.type      = V4L2_TUNER_DIGITAL_TV;
@@ -162,13 +158,7 @@ static int mt352_pinnacle_tuner_calc_regs(struct dvb_frontend* fe,
        pinnacle_antenna_pwr(dev, antenna_pwr);
 
        /* mt352 setup */
-       mt352_pinnacle_init(fe);
-       pllbuf[0] = 0x61;
-       pllbuf[1] = 0x00;
-       pllbuf[2] = 0x00;
-       pllbuf[3] = 0x80;
-       pllbuf[4] = 0x00;
-       return 5;
+       return mt352_pinnacle_init(fe);
 }
 
 static int mt352_aver777_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *params, u8* pllbuf, int buf_len)
@@ -1025,7 +1015,7 @@ static int dvb_init(struct saa7134_dev *dev)
                dev->dvb.frontend = mt352_attach(&pinnacle_300i,
                                                 &dev->i2c_adap);
                if (dev->dvb.frontend) {
-                       dev->dvb.frontend->ops->tuner_ops.calc_regs = mt352_pinnacle_tuner_calc_regs;
+                       dev->dvb.frontend->ops->tuner_ops.set_params = mt352_pinnacle_tuner_set_params;
                }
                break;