V4L/DVB (9417): DVB_ATTACH for STB0899, STB6100, TDA8261
[safe/jmp/linux-2.6] / drivers / media / dvb / ttpci / budget-ci.c
index fc4cc49..6b77b12 100644 (file)
@@ -1426,7 +1426,7 @@ static const struct stb0899_s1_reg tt3200_stb0899_s1_init_3[] = {
        { STB0899_TSCFGH                , 0x0c },
        { STB0899_TSCFGM                , 0x00 },
        { STB0899_TSCFGL                , 0x0c },
-       { STB0899_TSOUT                 , 0x07 },
+       { STB0899_TSOUT                 , 0x0d }, /* 0x0d for CAM */
        { STB0899_RSSYNCDEL             , 0x00 },
        { STB0899_TSINHDELH             , 0x02 },
        { STB0899_TSINHDELM             , 0x00 },
@@ -1633,7 +1633,7 @@ static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
        struct tuner_state      t_state;
        int err = 0;
 
-       t_state.frequency = bandwidth;
+       t_state.bandwidth = bandwidth;
        if (&fe->ops)
                frontend_ops = &fe->ops;
        if (&frontend_ops->tuner_ops)
@@ -1644,7 +1644,7 @@ static int stb6100_set_bandwidth(struct dvb_frontend *fe, u32 bandwidth)
                        return err;
                }
        }
-       printk("%s: Bandwidth=%d\n", __func__, t_state.frequency);
+       printk("%s: Bandwidth=%d\n", __func__, t_state.bandwidth);
        return 0;
 }
 
@@ -1683,7 +1683,8 @@ static struct stb0899_config tt3200_config = {
 };
 
 struct stb6100_config tt3200_stb6100_config = {
-       .tuner_address = 0x60
+       .tuner_address  = 0x60,
+       .refclock       = 27000000,
 };
 
 static void frontend_init(struct budget_ci *budget_ci)
@@ -1767,20 +1768,17 @@ static void frontend_init(struct budget_ci *budget_ci)
                break;
 
        case 0x1019:            // TT S2-3200 PCI
-               budget_ci->budget.dvb_frontend = stb0899_attach(&tt3200_config, &budget_ci->budget.i2c_adap);
+               budget_ci->budget.dvb_frontend = dvb_attach(stb0899_attach, &tt3200_config, &budget_ci->budget.i2c_adap);
                if (budget_ci->budget.dvb_frontend) {
-                       if (stb6100_attach(budget_ci->budget.dvb_frontend, &tt3200_stb6100_config, &budget_ci->budget.i2c_adap)) {
-                               if (lnbp21_attach(budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, 0, 0)) {
+                       if (dvb_attach(stb6100_attach, budget_ci->budget.dvb_frontend, &tt3200_stb6100_config, &budget_ci->budget.i2c_adap)) {
+                               if (!dvb_attach(lnbp21_attach, budget_ci->budget.dvb_frontend, &budget_ci->budget.i2c_adap, 0, 0)) {
                                        printk("%s: No LNBP21 found!\n", __FUNCTION__);
-                                       if (budget_ci->budget.dvb_frontend->ops.tuner_ops.release)
-                                               budget_ci->budget.dvb_frontend->ops.tuner_ops.release(budget_ci->budget.dvb_frontend);
-                                       if (budget_ci->budget.dvb_frontend->ops.release)
-                                               budget_ci->budget.dvb_frontend->ops.release(budget_ci->budget.dvb_frontend);
+                                       dvb_frontend_detach(budget_ci->budget.dvb_frontend);
                                        budget_ci->budget.dvb_frontend = NULL;
                                }
                        } else {
-                               if (budget_ci->budget.dvb_frontend->ops.release)
-                                       budget_ci->budget.dvb_frontend->ops.release(budget_ci->budget.dvb_frontend);
+                                       dvb_frontend_detach(budget_ci->budget.dvb_frontend);
+                                       budget_ci->budget.dvb_frontend = NULL;
                        }
                }
                break;