]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[media] xc4000: use DVBv5 parameters on set_params()
authorMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 21 Dec 2011 12:02:55 +0000 (09:02 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Sat, 31 Dec 2011 10:27:49 +0000 (08:27 -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/common/tuners/xc4000.c

index 21a7b094a774764d29077a55b5cb8bb3b77ba574..ee6db66143f1a07013554980a872e39e35ed2a06 100644 (file)
@@ -1124,80 +1124,67 @@ static void xc_debug_dump(struct xc4000_priv *priv)
 static int xc4000_set_params(struct dvb_frontend *fe,
        struct dvb_frontend_parameters *params)
 {
+       struct dtv_frontend_properties *c = &fe->dtv_property_cache;
+       u32 delsys = c->delivery_system;
+       u32 bw = c->bandwidth_hz;
        struct xc4000_priv *priv = fe->tuner_priv;
        unsigned int type;
        int     ret = -EREMOTEIO;
 
-       dprintk(1, "%s() frequency=%d (Hz)\n", __func__, params->frequency);
+       dprintk(1, "%s() frequency=%d (Hz)\n", __func__, c->frequency);
 
        mutex_lock(&priv->lock);
 
-       if (fe->ops.info.type == FE_ATSC) {
-               dprintk(1, "%s() ATSC\n", __func__);
-               switch (params->u.vsb.modulation) {
-               case VSB_8:
-               case VSB_16:
-                       dprintk(1, "%s() VSB modulation\n", __func__);
-                       priv->rf_mode = XC_RF_MODE_AIR;
-                       priv->freq_hz = params->frequency - 1750000;
-                       priv->bandwidth = BANDWIDTH_6_MHZ;
-                       priv->video_standard = XC4000_DTV6;
-                       type = DTV6;
-                       break;
-               case QAM_64:
-               case QAM_256:
-               case QAM_AUTO:
-                       dprintk(1, "%s() QAM modulation\n", __func__);
-                       priv->rf_mode = XC_RF_MODE_CABLE;
-                       priv->freq_hz = params->frequency - 1750000;
-                       priv->bandwidth = BANDWIDTH_6_MHZ;
-                       priv->video_standard = XC4000_DTV6;
-                       type = DTV6;
-                       break;
-               default:
-                       ret = -EINVAL;
-                       goto fail;
-               }
-       } else if (fe->ops.info.type == FE_OFDM) {
+       switch (delsys) {
+       case SYS_ATSC:
+               dprintk(1, "%s() VSB modulation\n", __func__);
+               priv->rf_mode = XC_RF_MODE_AIR;
+               priv->freq_hz = c->frequency - 1750000;
+               priv->bandwidth = BANDWIDTH_6_MHZ;
+               priv->video_standard = XC4000_DTV6;
+               type = DTV6;
+               break;
+       case SYS_DVBC_ANNEX_B:
+               dprintk(1, "%s() QAM modulation\n", __func__);
+               priv->rf_mode = XC_RF_MODE_CABLE;
+               priv->freq_hz = c->frequency - 1750000;
+               priv->bandwidth = BANDWIDTH_6_MHZ;
+               priv->video_standard = XC4000_DTV6;
+               type = DTV6;
+               break;
+       case SYS_DVBT:
+       case SYS_DVBT2:
                dprintk(1, "%s() OFDM\n", __func__);
-               switch (params->u.ofdm.bandwidth) {
-               case BANDWIDTH_6_MHZ:
+               if (bw == 0) {
+                       if (c->frequency < 400000000) {
+                               priv->bandwidth = BANDWIDTH_7_MHZ;
+                               priv->freq_hz = c->frequency - 2250000;
+                       } else {
+                               priv->bandwidth = BANDWIDTH_8_MHZ;
+                               priv->freq_hz = c->frequency - 2750000;
+                       }
+                       priv->video_standard = XC4000_DTV7_8;
+                       type = DTV78;
+               } else if (bw <= 6000000) {
                        priv->bandwidth = BANDWIDTH_6_MHZ;
                        priv->video_standard = XC4000_DTV6;
-                       priv->freq_hz = params->frequency - 1750000;
+                       priv->freq_hz = c->frequency - 1750000;
                        type = DTV6;
-                       break;
-               case BANDWIDTH_7_MHZ:
+               } else if (bw <= 7000000) {
                        priv->bandwidth = BANDWIDTH_7_MHZ;
                        priv->video_standard = XC4000_DTV7;
-                       priv->freq_hz = params->frequency - 2250000;
+                       priv->freq_hz = c->frequency - 2250000;
                        type = DTV7;
-                       break;
-               case BANDWIDTH_8_MHZ:
+               } else {
                        priv->bandwidth = BANDWIDTH_8_MHZ;
                        priv->video_standard = XC4000_DTV8;
-                       priv->freq_hz = params->frequency - 2750000;
+                       priv->freq_hz = c->frequency - 2750000;
                        type = DTV8;
-                       break;
-               case BANDWIDTH_AUTO:
-                       if (params->frequency < 400000000) {
-                               priv->bandwidth = BANDWIDTH_7_MHZ;
-                               priv->freq_hz = params->frequency - 2250000;
-                       } else {
-                               priv->bandwidth = BANDWIDTH_8_MHZ;
-                               priv->freq_hz = params->frequency - 2750000;
-                       }
-                       priv->video_standard = XC4000_DTV7_8;
-                       type = DTV78;
-                       break;
-               default:
-                       printk(KERN_ERR "xc4000 bandwidth not set!\n");
-                       ret = -EINVAL;
-                       goto fail;
                }
                priv->rf_mode = XC_RF_MODE_AIR;
-       } else {
-               printk(KERN_ERR "xc4000 modulation type not supported!\n");
+               break;
+       default:
+               printk(KERN_ERR "xc4000 delivery system not supported!\n");
                ret = -EINVAL;
                goto fail;
        }