Commit f790bdd0 authored by Oliver Endriss's avatar Oliver Endriss Committed by Mauro Carvalho Chehab

[media] stv090x: Optional external lock routine

Card driver may supply its own lock routine now.
Signed-off-by: default avatarOliver Endriss <o.endriss@gmx.de>
Signed-off-by: default avatarManu Abraham <manu@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 5bd0dc2d
...@@ -767,8 +767,12 @@ static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable) ...@@ -767,8 +767,12 @@ static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable)
* In case of any error, the lock is unlocked and exit within the * In case of any error, the lock is unlocked and exit within the
* relevant operations themselves. * relevant operations themselves.
*/ */
if (enable) if (enable) {
if (state->config->tuner_i2c_lock)
state->config->tuner_i2c_lock(&state->frontend, 1);
else
mutex_lock(&state->internal->tuner_lock); mutex_lock(&state->internal->tuner_lock);
}
reg = STV090x_READ_DEMOD(state, I2CRPT); reg = STV090x_READ_DEMOD(state, I2CRPT);
if (enable) { if (enable) {
...@@ -784,12 +788,19 @@ static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable) ...@@ -784,12 +788,19 @@ static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable)
goto err; goto err;
} }
if (!enable) if (!enable) {
if (state->config->tuner_i2c_lock)
state->config->tuner_i2c_lock(&state->frontend, 0);
else
mutex_unlock(&state->internal->tuner_lock); mutex_unlock(&state->internal->tuner_lock);
}
return 0; return 0;
err: err:
dprintk(FE_ERROR, 1, "I/O error"); dprintk(FE_ERROR, 1, "I/O error");
if (state->config->tuner_i2c_lock)
state->config->tuner_i2c_lock(&state->frontend, 0);
else
mutex_unlock(&state->internal->tuner_lock); mutex_unlock(&state->internal->tuner_lock);
return -1; return -1;
} }
......
...@@ -100,6 +100,7 @@ struct stv090x_config { ...@@ -100,6 +100,7 @@ struct stv090x_config {
int (*tuner_get_bbgain) (struct dvb_frontend *fe, u32 *gain); int (*tuner_get_bbgain) (struct dvb_frontend *fe, u32 *gain);
int (*tuner_set_refclk) (struct dvb_frontend *fe, u32 refclk); int (*tuner_set_refclk) (struct dvb_frontend *fe, u32 refclk);
int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status); int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status);
void (*tuner_i2c_lock) (struct dvb_frontend *fe, int lock);
}; };
#if defined(CONFIG_DVB_STV090x) || (defined(CONFIG_DVB_STV090x_MODULE) && defined(MODULE)) #if defined(CONFIG_DVB_STV090x) || (defined(CONFIG_DVB_STV090x_MODULE) && defined(MODULE))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment