From: Manu Abraham Date: Sat, 23 Jan 2010 08:49:08 +0000 (-0300) Subject: V4L/DVB: [STV090x, STV6110x] Use tuner sleep within the demodulator control X-Git-Tag: MMI-PSA29.97-13-9~23880^2~385 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c5b74b0f5e81386ca1e9b1128de83502e92fa028;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git V4L/DVB: [STV090x, STV6110x] Use tuner sleep within the demodulator control Oliver Endriss 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 Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index 0af17083511c..a80a34bb9eb8 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c @@ -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; diff --git a/drivers/media/dvb/frontends/stv090x.h b/drivers/media/dvb/frontends/stv090x.h index 30f01a6902ac..dd1b93ae4e9d 100644 --- a/drivers/media/dvb/frontends/stv090x.h +++ b/drivers/media/dvb/frontends/stv090x.h @@ -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); diff --git a/drivers/media/dvb/frontends/stv6110x.c b/drivers/media/dvb/frontends/stv6110x.c index dea4245f077c..c1ddb83e6349 100644 --- a/drivers/media/dvb/frontends/stv6110x.c +++ b/drivers/media/dvb/frontends/stv6110x.c @@ -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, diff --git a/drivers/media/dvb/frontends/stv6110x.h b/drivers/media/dvb/frontends/stv6110x.h index 2429ae6d7847..47516753929a 100644 --- a/drivers/media/dvb/frontends/stv6110x.h +++ b/drivers/media/dvb/frontends/stv6110x.h @@ -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); diff --git a/drivers/media/dvb/ttpci/budget.c b/drivers/media/dvb/ttpci/budget.c index 1500210c06cf..e5cb1022d9db 100644 --- a/drivers/media/dvb/ttpci/budget.c +++ b/drivers/media/dvb/ttpci/budget.c @@ -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;