V4L/DVB: [STV090x, STV6110x] Use tuner sleep within the demodulator control
authorManu Abraham <abraham.manu@gmail.com>
Sat, 23 Jan 2010 08:49:08 +0000 (05:49 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 18 May 2010 03:46:47 +0000 (00:46 -0300)
Oliver Endriss <o.endriss@gmx.de> pointed out:
Imho not a good idea, as the frontend thread calls
- fe->ops.tuner_ops.init
- fe->ops.tuner_ops.sleep

If you remove fe->ops.i2c_gate_ctrl, init and sleep will fail,
because gate_ctrl was never called...

--

Signed-off-by: Manu Abraham <manu@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/dvb/frontends/stv090x.c
drivers/media/dvb/frontends/stv090x.h
drivers/media/dvb/frontends/stv6110x.c
drivers/media/dvb/frontends/stv6110x.h
drivers/media/dvb/ttpci/budget.c

index 0af17083511c4ecae589327a2eadad5d03a6fb46..a80a34bb9eb85c3299814b07e9b6df20f3375537 100644 (file)
@@ -3838,6 +3838,11 @@ static int stv090x_sleep(struct dvb_frontend *fe)
        struct stv090x_state *state = fe->demodulator_priv;
        u32 reg;
 
+       if (state->config->tuner_init) {
+               if (state->config->tuner_sleep(fe) < 0)
+                       goto err_gateoff;
+       }
+
        dprintk(FE_DEBUG, 1, "Set %s to sleep",
                state->device == STV0900 ? "STV0900" : "STV0903");
 
@@ -3852,6 +3857,9 @@ static int stv090x_sleep(struct dvb_frontend *fe)
                goto err;
 
        return 0;
+
+err_gateoff:
+       stv090x_i2c_gate_ctrl(state, 0);
 err:
        dprintk(FE_ERROR, 1, "I/O error");
        return -1;
index 30f01a6902ac118b4b0ec0d7fb83b0d5a411dd73..dd1b93ae4e9d2e570c68409b19b010575d259de3 100644 (file)
@@ -87,6 +87,7 @@ struct stv090x_config {
        bool diseqc_envelope_mode;
 
        int (*tuner_init) (struct dvb_frontend *fe);
+       int (*tuner_sleep) (struct dvb_frontend *fe);
        int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode);
        int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency);
        int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency);
index dea4245f077c9b2a9fff430a0287bf131ffda3c1..c1ddb83e6349da0a0069f38810f54d70852de4d4 100644 (file)
@@ -338,14 +338,12 @@ static struct dvb_tuner_ops stv6110x_ops = {
                .frequency_max  = 2150000,
                .frequency_step = 0,
        },
-
-       .init                   = stv6110x_init,
-       .sleep                  = stv6110x_sleep,
        .release                = stv6110x_release
 };
 
 static struct stv6110x_devctl stv6110x_ctl = {
        .tuner_init             = stv6110x_init,
+       .tuner_sleep            = stv6110x_sleep,
        .tuner_set_mode         = stv6110x_set_mode,
        .tuner_set_frequency    = stv6110x_set_frequency,
        .tuner_get_frequency    = stv6110x_get_frequency,
index 2429ae6d78470a59c2a52d246d9b57a5427e8aa7..47516753929a968d3e5bd28b949c4569bbe6eb29 100644 (file)
@@ -40,6 +40,7 @@ enum tuner_status {
 
 struct stv6110x_devctl {
        int (*tuner_init) (struct dvb_frontend *fe);
+       int (*tuner_sleep) (struct dvb_frontend *fe);
        int (*tuner_set_mode) (struct dvb_frontend *fe, enum tuner_mode mode);
        int (*tuner_set_frequency) (struct dvb_frontend *fe, u32 frequency);
        int (*tuner_get_frequency) (struct dvb_frontend *fe, u32 *frequency);
index 1500210c06cf6aff6ccd8c5b5db0fffa32a75d76..e5cb1022d9db5bd781e169525ac95f7f71a248ec 100644 (file)
@@ -442,6 +442,7 @@ static struct stv090x_config tt1600_stv090x_config = {
        .repeater_level         = STV090x_RPTLEVEL_16,
 
        .tuner_init             = NULL,
+       .tuner_sleep            = NULL,
        .tuner_set_mode         = NULL,
        .tuner_set_frequency    = NULL,
        .tuner_get_frequency    = NULL,
@@ -628,6 +629,7 @@ static void frontend_init(struct budget *budget)
                                                 &budget->i2c_adap);
 
                                tt1600_stv090x_config.tuner_init          = ctl->tuner_init;
+                               tt1600_stv090x_config.tuner_sleep         = ctl->tuner_sleep;
                                tt1600_stv090x_config.tuner_set_mode      = ctl->tuner_set_mode;
                                tt1600_stv090x_config.tuner_set_frequency = ctl->tuner_set_frequency;
                                tt1600_stv090x_config.tuner_get_frequency = ctl->tuner_get_frequency;