]> git.neil.brown.name Git - history.git/commitdiff
[PATCH] DVB: Fixes for frontend drivers
authorMichael Hunold <hunold@linuxtv.org>
Thu, 1 Jan 2004 03:25:04 +0000 (19:25 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Thu, 1 Jan 2004 03:25:04 +0000 (19:25 -0800)
 - ves1820: increase mdelay from 30 to 50 to be more reliable with bad
   reception quality (Andreas Oberritter)
 - dst: remove AUTO_INVERSION for capabilities, allow params
   dst_type_flags and dst_type to have multiple values for multiple
   cards in one machine (Jamie Honan)

drivers/media/dvb/frontends/dst.c
drivers/media/dvb/frontends/ves1820.c

index bb19ddfb122323e67eb61bc1f995b09a1259d1d5..8bafa8acea31317b6a3db9feae2b654e639dcc46 100644 (file)
@@ -44,12 +44,15 @@ MODULE_PARM_DESC(dst_verbose,
 MODULE_PARM(dst_debug, "i");
 MODULE_PARM_DESC(dst_debug, "debug messages, default is 0 (no)");
 
-unsigned int dst_type = (-1U);
-unsigned int dst_type_flags = (-1U);
-MODULE_PARM(dst_type, "i");
+#define DST_MAX_CARDS  6
+unsigned int dst_cur_no = 0;
+
+unsigned int dst_type[DST_MAX_CARDS] = { [0 ... (DST_MAX_CARDS-1)] = (-1U)};
+unsigned int dst_type_flags[DST_MAX_CARDS] = { [0 ... (DST_MAX_CARDS-1)] = (-1U)};
+MODULE_PARM(dst_type, "1-" __stringify(DST_MAX_CARDS) "i");
 MODULE_PARM_DESC(dst_type,
                "Type of DST card, 0 Satellite, 1 terrestial TV, 2 Cable, default driver determined");
-MODULE_PARM(dst_type_flags, "i");
+MODULE_PARM(dst_type_flags, "1-" __stringify(DST_MAX_CARDS) "i");
 MODULE_PARM_DESC(dst_type_flags,
                "Type flags of DST card, bitfield 1=10 byte tuner, 2=TS is 204, 4=symdiv");
 
@@ -102,8 +105,7 @@ static struct dvb_frontend_info dst_info_sat = {
        .symbol_rate_max        = 45000000,
 /*     . symbol_rate_tolerance =       ???,*/
        .notifier_delay         = 50,                /* 1/20 s */
-       .caps = FE_CAN_INVERSION_AUTO |
-               FE_CAN_FEC_AUTO |
+       .caps = FE_CAN_FEC_AUTO |
                FE_CAN_QPSK
 };
 
@@ -117,8 +119,7 @@ static struct dvb_frontend_info dst_info_cable = {
        .symbol_rate_max        = 45000000,
 /*     . symbol_rate_tolerance =       ???,*/
        .notifier_delay         = 50,                /* 1/20 s */
-       .caps = FE_CAN_INVERSION_AUTO |
-               FE_CAN_FEC_AUTO |
+       .caps = FE_CAN_FEC_AUTO |
                FE_CAN_QAM_AUTO
 };
 
@@ -128,8 +129,7 @@ static struct dvb_frontend_info dst_info_tv = {
        .frequency_min          = 137000000,
        .frequency_max          = 858000000,
        .frequency_stepsize     = 166667,
-       .caps = FE_CAN_INVERSION_AUTO |
-           FE_CAN_FEC_AUTO |
+       .caps = FE_CAN_FEC_AUTO |
            FE_CAN_QAM_AUTO |
            FE_CAN_TRANSMISSION_MODE_AUTO | FE_CAN_GUARD_INTERVAL_AUTO
 };
@@ -421,8 +421,6 @@ static int dst_set_inversion (struct dst_data *dst, fe_spectral_inversion_t inve
        case INVERSION_ON:
                val[8] |= 0x80;
                break;
-       case INVERSION_AUTO:
-               break;
        default:
                return -EINVAL;
        }
@@ -607,25 +605,25 @@ static int dst_check_ci (struct dst_data *dst)
                use_dst_type = DST_TYPE_IS_SAT;
                use_type_flags = DST_TYPE_HAS_SYMDIV;
        }
-       switch (dst_type) {
+       switch (dst_type[dst_cur_no]) {
                case (-1U):
                        /* not used */
                        break;
                case DST_TYPE_IS_SAT:
                case DST_TYPE_IS_TERR:
                case DST_TYPE_IS_CABLE:
-                       use_dst_type = (u8)dst_type;
+                       use_dst_type = (u8)(dst_type[dst_cur_no]);
                        break;
                default:
                        printk("%s: invalid user override dst type %d, not used\n",
-                               __FUNCTION__, dst_type);
+                               __FUNCTION__, dst_type[dst_cur_no]);
                        break;
        }
        dst_type_print(use_dst_type);
-       if (dst_type_flags != (-1U)) {
+       if (dst_type_flags[dst_cur_no] != (-1U)) {
                printk("%s: user override dst type flags 0x%x\n",
-                               __FUNCTION__, dst_type_flags);
-               use_type_flags = dst_type_flags;
+                               __FUNCTION__, dst_type_flags[dst_cur_no]);
+               use_type_flags = dst_type_flags[dst_cur_no];
        }
        dst->type_flags = use_type_flags;
        dst->dst_type= use_dst_type;
@@ -1129,6 +1127,10 @@ static int dst_attach (struct dvb_i2c_bus *i2c, void **data)
        struct dvb_frontend_info *info;
 
        dprintk("%s: check ci\n", __FUNCTION__);
+       if (dst_cur_no >= DST_MAX_CARDS) {
+               dprintk("%s: can't have more than %d cards\n", __FUNCTION__, DST_MAX_CARDS);
+               return -ENODEV;
+       }
        bt = bt878_find_by_dvb_adap(i2c->adapter);
        if (!bt)
                return -ENODEV;
@@ -1157,7 +1159,7 @@ static int dst_attach (struct dvb_i2c_bus *i2c, void **data)
                info = &dst_info_cable;
 
        dvb_register_frontend (dst_ioctl, i2c, dst, info);
-
+       dst_cur_no++;
        return 0;
 }
 
index a066a41ecaeda39673654f5de56f25e5820a164a..ce2f45948a6d6afb528409144a996575a68dc3e3 100644 (file)
@@ -233,7 +233,7 @@ static int ves1820_setup_reg0 (struct dvb_frontend *fe, u8 reg0,
         *  check lock and toggle inversion bit if required...
         */
        if (INVERSION_AUTO == inversion && !(ves1820_readreg (fe, 0x11) & 0x08)) {
-               mdelay(30);
+               mdelay(50);
                if (!(ves1820_readreg (fe, 0x11) & 0x08)) {
                        reg0 ^= 0x20;
                        ves1820_writereg (fe, 0x00, reg0 & 0xfe);
@@ -349,7 +349,7 @@ static int ves1820_set_parameters (struct dvb_frontend *fe,
 
        /* yes, this speeds things up: userspace reports lock in about 8 ms
           instead of 500 to 1200 ms after calling FE_SET_FRONTEND. */
-       mdelay(30);
+       mdelay(50);
 
        return 0;
 }