V4L/DVB (7352): tuner-simple: enable digital tuning support for Philips FMD1216ME
authorMichael Krufky <mkrufky@linuxtv.org>
Tue, 22 Apr 2008 17:45:53 +0000 (14:45 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Thu, 24 Apr 2008 17:07:50 +0000 (14:07 -0300)
Enable digital tuning support within tuner-simple. This will allow for a
single tuner module to manage the hardware, without having dvb-pll loaded.

Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/video/tuner-simple.c
drivers/media/video/tuner-types.c
include/media/tuner-types.h

index 3a27d4a8ce385ecaea2bf892e4d496c82c6eca7c..b6587300bb8f479a84302ffbb7e3b029f816e1e1 100644 (file)
@@ -714,6 +714,22 @@ static int simple_set_params(struct dvb_frontend *fe,
        return ret;
 }
 
+static void simple_set_dvb(struct dvb_frontend *fe, u8 *buf,
+                          const struct dvb_frontend_parameters *params)
+{
+       struct tuner_simple_priv *priv = fe->tuner_priv;
+
+       switch (priv->type) {
+       case TUNER_PHILIPS_FMD1216ME_MK3:
+               if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ &&
+                   params->frequency >= 158870000)
+                       buf[3] |= 0x08;
+               break;
+       default:
+               break;
+       }
+}
+
 static int simple_dvb_configure(struct dvb_frontend *fe, u8 *buf,
                                const struct dvb_frontend_parameters *params)
 {
@@ -737,6 +753,8 @@ static int simple_dvb_configure(struct dvb_frontend *fe, u8 *buf,
        buf[2] = config;
        buf[3] = cb;
 
+       simple_set_dvb(fe, buf, params);
+
        tuner_dbg("%s: div=%d | buf=0x%02x,0x%02x,0x%02x,0x%02x\n",
                  tun->name, div, buf[0], buf[1], buf[2], buf[3]);
 
index 13c76a57d8e2ac01f9c993173e2ff773397bbf8c..f2e6630731bf494f3a0456198a083f5077aec903 100644 (file)
@@ -923,6 +923,15 @@ static struct tuner_range tuner_philips_fmd1216me_mk3_pal_ranges[] = {
        { 16 * 999.99        , 0x86, 0x54, },
 };
 
+static struct tuner_range tuner_philips_fmd1216me_mk3_dvb_ranges[] = {
+       { 16 * 143.87 /*MHz*/, 0xbc, 0x41 },
+       { 16 * 158.87 /*MHz*/, 0xf4, 0x41 },
+       { 16 * 329.87 /*MHz*/, 0xbc, 0x42 },
+       { 16 * 441.87 /*MHz*/, 0xf4, 0x42 },
+       { 16 * 625.87 /*MHz*/, 0xbc, 0x44 },
+       { 16 * 803.87 /*MHz*/, 0xf4, 0x44 },
+       { 16 * 999.99        , 0xfc, 0x44 },
+};
 
 static struct tuner_params tuner_philips_fmd1216me_mk3_params[] = {
        {
@@ -936,6 +945,12 @@ static struct tuner_params tuner_philips_fmd1216me_mk3_params[] = {
                .port2_invert_for_secam_lc = 1,
                .port1_set_for_fm_mono = 1,
        },
+       {
+               .type   = TUNER_PARAM_TYPE_DIGITAL,
+               .ranges = tuner_philips_fmd1216me_mk3_dvb_ranges,
+               .count  = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_dvb_ranges),
+               .iffreq = 16 * 36.125, /*MHz*/
+       },
 };
 
 
@@ -1461,6 +1476,9 @@ struct tunertype tuners[] = {
                .name   = "Philips FMD1216ME MK3 Hybrid Tuner",
                .params = tuner_philips_fmd1216me_mk3_params,
                .count  = ARRAY_SIZE(tuner_philips_fmd1216me_mk3_params),
+               .min = 16 *  50.87,
+               .max = 16 * 858.00,
+               .stepsize = 166667,
                .initdata = tua603x_agc112,
                .sleepdata = (u8[]){ 4, 0x9c, 0x60, 0x85, 0x54 },
        },
index fda12093cab3e5be242752a3a162a0f6990db50e..ab03c5344209937818de9200a9f33b678e64c2c5 100644 (file)
@@ -119,7 +119,7 @@ struct tunertype {
 
        u16 min;
        u16 max;
-       u16 stepsize;
+       u32 stepsize;
 
        u8 *initdata;
        u8 *sleepdata;