]> err.no Git - linux-2.6/commitdiff
V4L/DVB (3878): Convert ttpci/budget-patch to refactored tuner code
authorAndrew de Quincey <adq_dvb@lidskialf.net>
Tue, 18 Apr 2006 20:47:11 +0000 (17:47 -0300)
committerMauro Carvalho Chehab <mchehab@infradead.org>
Sun, 25 Jun 2006 04:59:06 +0000 (01:59 -0300)
Rename pll calls to appropriate tuner calls.
Remove pll functions from demod structures.
Hook tuner call into tuner_ops.
Add pll gate control calls where appropriate.

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
drivers/media/dvb/ttpci/budget-patch.c

index 1b3aaac5e7636fbdade5d426b52087bbdfaa95c7..3515f524176a1df5cd7b388e1b0b5bc5883a2e5f 100644 (file)
@@ -258,7 +258,7 @@ static int budget_patch_diseqc_send_burst(struct dvb_frontend* fe, fe_sec_mini_c
        return 0;
 }
 
-static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
+static int alps_bsrv2_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
 {
        struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv;
        u8 pwr = 0;
@@ -281,7 +281,10 @@ static int alps_bsrv2_pll_set(struct dvb_frontend* fe, struct dvb_frontend_param
        // NOTE: since we're using a prescaler of 2, we set the
        // divisor frequency to 62.5kHz and divide by 125 above
 
-       if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;
+       if (fe->ops->i2c_gate_ctrl)
+               fe->ops->i2c_gate_ctrl(fe, 1);
+       if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1)
+               return -EIO;
        return 0;
 }
 
@@ -289,10 +292,9 @@ static struct ves1x93_config alps_bsrv2_config = {
        .demod_address = 0x08,
        .xin = 90100000UL,
        .invert_pwm = 0,
-       .pll_set = alps_bsrv2_pll_set,
 };
 
-static int grundig_29504_451_pll_set(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
+static int grundig_29504_451_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params)
 {
        struct budget_patch* budget = (struct budget_patch*) fe->dvb->priv;
        u32 div;
@@ -305,13 +307,15 @@ static int grundig_29504_451_pll_set(struct dvb_frontend* fe, struct dvb_fronten
        data[2] = 0x8e;
        data[3] = 0x00;
 
-       if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1) return -EIO;
+       if (fe->ops->i2c_gate_ctrl)
+               fe->ops->i2c_gate_ctrl(fe, 1);
+       if (i2c_transfer (&budget->i2c_adap, &msg, 1) != 1)
+               return -EIO;
        return 0;
 }
 
 static struct tda8083_config grundig_29504_451_config = {
        .demod_address = 0x68,
-       .pll_set = grundig_29504_451_pll_set,
 };
 
 static void frontend_init(struct budget_patch* budget)
@@ -323,6 +327,7 @@ static void frontend_init(struct budget_patch* budget)
                // try the ALPS BSRV2 first of all
                budget->dvb_frontend = ves1x93_attach(&alps_bsrv2_config, &budget->i2c_adap);
                if (budget->dvb_frontend) {
+                       budget->dvb_frontend->ops->tuner_ops.set_params = alps_bsrv2_tuner_set_params;
                        budget->dvb_frontend->ops->diseqc_send_master_cmd = budget_patch_diseqc_send_master_cmd;
                        budget->dvb_frontend->ops->diseqc_send_burst = budget_patch_diseqc_send_burst;
                        budget->dvb_frontend->ops->set_tone = budget_patch_set_tone;
@@ -332,6 +337,9 @@ static void frontend_init(struct budget_patch* budget)
                // try the ALPS BSRU6 now
                budget->dvb_frontend = stv0299_attach(&alps_bsru6_config, &budget->i2c_adap);
                if (budget->dvb_frontend) {
+                       budget->dvb_frontend->ops->tuner_ops.set_params = alps_bsru6_tuner_set_params;
+                       budget->dvb_frontend->tuner_priv = &budget->i2c_adap;
+
                        budget->dvb_frontend->ops->diseqc_send_master_cmd = budget_diseqc_send_master_cmd;
                        budget->dvb_frontend->ops->diseqc_send_burst = budget_diseqc_send_burst;
                        budget->dvb_frontend->ops->set_tone = budget_set_tone;
@@ -341,6 +349,7 @@ static void frontend_init(struct budget_patch* budget)
                // Try the grundig 29504-451
                budget->dvb_frontend = tda8083_attach(&grundig_29504_451_config, &budget->i2c_adap);
                if (budget->dvb_frontend) {
+                       budget->dvb_frontend->ops->tuner_ops.set_params = grundig_29504_451_tuner_set_params;
                        budget->dvb_frontend->ops->diseqc_send_master_cmd = budget_diseqc_send_master_cmd;
                        budget->dvb_frontend->ops->diseqc_send_burst = budget_diseqc_send_burst;
                        budget->dvb_frontend->ops->set_tone = budget_set_tone;