[media] saa7134: use DVBv5 parameters on set_params()
authorMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 23 Dec 2011 15:25:04 +0000 (12:25 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 31 Dec 2011 10:33:14 +0000 (08:33 -0200)
Instead of using DVBv3 parameters, rely on DVBv5 parameters to
set the tuner

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/saa7134/saa7134-dvb.c

index 1e4ef16698879f5904fd7b378a4883f48b987640..5fdb8455fe8a897cfad8caed2e9329b732ddc20a 100644 (file)
@@ -186,6 +186,7 @@ static int mt352_avermedia_xc3028_init(struct dvb_frontend *fe)
 static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe,
                                           struct dvb_frontend_parameters* params)
 {
+       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
        u8 off[] = { 0x00, 0xf1};
        u8 on[]  = { 0x00, 0x71};
        struct i2c_msg msg = {.addr=0x43, .flags=0, .buf=off, .len = sizeof(off)};
@@ -196,7 +197,7 @@ static int mt352_pinnacle_tuner_set_params(struct dvb_frontend* fe,
        /* set frequency (mt2050) */
        f.tuner     = 0;
        f.type      = V4L2_TUNER_DIGITAL_TV;
-       f.frequency = params->frequency / 1000 * 16 / 1000;
+       f.frequency = c->frequency / 1000 * 16 / 1000;
        if (fe->ops.i2c_gate_ctrl)
                fe->ops.i2c_gate_ctrl(fe, 1);
        i2c_transfer(&dev->i2c_adap, &msg, 1);
@@ -289,6 +290,7 @@ static int philips_tda1004x_request_firmware(struct dvb_frontend *fe,
 
 static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
 {
+       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
        struct saa7134_dev *dev = fe->dvb->priv;
        struct tda1004x_state *state = fe->demodulator_priv;
        u8 addr = state->config->tuner_address;
@@ -299,7 +301,7 @@ static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_
        u8 band, cp, filter;
 
        /* determine charge pump */
-       tuner_frequency = params->frequency + 36166000;
+       tuner_frequency = c->frequency + 36166000;
        if (tuner_frequency < 87000000)
                return -EINVAL;
        else if (tuner_frequency < 130000000)
@@ -324,28 +326,28 @@ static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_
                return -EINVAL;
 
        /* determine band */
-       if (params->frequency < 49000000)
+       if (c->frequency < 49000000)
                return -EINVAL;
-       else if (params->frequency < 161000000)
+       else if (c->frequency < 161000000)
                band = 1;
-       else if (params->frequency < 444000000)
+       else if (c->frequency < 444000000)
                band = 2;
-       else if (params->frequency < 861000000)
+       else if (c->frequency < 861000000)
                band = 4;
        else
                return -EINVAL;
 
        /* setup PLL filter */
-       switch (params->u.ofdm.bandwidth) {
-       case BANDWIDTH_6_MHZ:
+       switch (c->bandwidth_hz) {
+       case 6000000:
                filter = 0;
                break;
 
-       case BANDWIDTH_7_MHZ:
+       case 7000000:
                filter = 0;
                break;
 
-       case BANDWIDTH_8_MHZ:
+       case 8000000:
                filter = 1;
                break;
 
@@ -356,7 +358,7 @@ static int philips_tda6651_pll_set(struct dvb_frontend *fe, struct dvb_frontend_
        /* calculate divisor
         * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
         */
-       tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000;
+       tuner_frequency = (((c->frequency / 1000) * 6) + 217496) / 1000;
 
        /* setup tuner buffer */
        tuner_buf[0] = (tuner_frequency >> 8) & 0x7f;