V4L/DVB: Budget/STV090x/STV6110x: Initialize the demodulator immediately after the...
authorAndreas Regel <andreas.regel@gmx.de>
Sat, 13 Feb 2010 19:48:07 +0000 (16:48 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 18 May 2010 03:46:49 +0000 (00:46 -0300)
Signed-off-by: Andreas Regel <andreas.regel@gmx.de>
Signed-off-by: Manu Abraham <manu@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/stv090x.c
drivers/media/dvb/frontends/stv6110x.c
drivers/media/dvb/ttpci/budget.c

index 3cc1be2..a461fdf 100644 (file)
@@ -4324,6 +4324,20 @@ static int stv090x_init(struct dvb_frontend *fe)
        u32 reg;
 
        if (state->internal->mclk == 0) {
+               /* call tuner init to configure the tuner's clock output
+                  divider directly before setting up the master clock of
+                  the stv090x. */
+               if (stv090x_i2c_gate_ctrl(state, 1) < 0)
+                       goto err;
+
+               if (config->tuner_init) {
+                       if (config->tuner_init(fe) < 0)
+                               goto err_gateoff;
+               }
+
+               if (stv090x_i2c_gate_ctrl(state, 0) < 0)
+                       goto err;
+
                stv090x_set_mclk(state, 135000000, config->xtal); /* 135 Mhz */
                msleep(5);
                if (stv090x_write_reg(state, STV090x_SYNTCTRL,
index c1ddb83..2f9cd24 100644 (file)
@@ -361,7 +361,6 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
 {
        struct stv6110x_state *stv6110x;
        u8 default_regs[] = {0x07, 0x11, 0xdc, 0x85, 0x17, 0x01, 0xe6, 0x1e};
-       int ret;
 
        stv6110x = kzalloc(sizeof (struct stv6110x_state), GFP_KERNEL);
        if (stv6110x == NULL)
@@ -390,25 +389,6 @@ struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe,
                break;
        }
 
-       if (fe->ops.i2c_gate_ctrl) {
-               ret = fe->ops.i2c_gate_ctrl(fe, 1);
-               if (ret < 0)
-                       goto error;
-       }
-
-       ret = stv6110x_write_regs(stv6110x, 0, stv6110x->regs,
-                                 ARRAY_SIZE(stv6110x->regs));
-       if (ret < 0) {
-               dprintk(FE_ERROR, 1, "Initialization failed");
-               goto error;
-       }
-
-       if (fe->ops.i2c_gate_ctrl) {
-               ret = fe->ops.i2c_gate_ctrl(fe, 0);
-               if (ret < 0)
-                       goto error;
-       }
-
        fe->tuner_priv          = stv6110x;
        fe->ops.tuner_ops       = stv6110x_ops;
 
index e5cb102..f5db13d 100644 (file)
@@ -640,6 +640,12 @@ static void frontend_init(struct budget *budget)
                                tt1600_stv090x_config.tuner_set_refclk    = ctl->tuner_set_refclk;
                                tt1600_stv090x_config.tuner_get_status    = ctl->tuner_get_status;
 
+                               /* call the init function once to initialize
+                                  tuner's clock output divider and demod's
+                                  master clock */
+                               if (budget->dvb_frontend->ops.init)
+                                       budget->dvb_frontend->ops.init(budget->dvb_frontend);
+
                                dvb_attach(isl6423_attach,
                                        budget->dvb_frontend,
                                        &budget->i2c_adap,