diff options
-rw-r--r-- | drivers/media/dvb/frontends/stv090x.c | 9 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/stv090x_priv.h | 1 |
2 files changed, 10 insertions, 0 deletions
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c index 9a817a69ed30..e903334a8323 100644 --- a/drivers/media/dvb/frontends/stv090x.c +++ b/drivers/media/dvb/frontends/stv090x.c | |||
@@ -758,6 +758,9 @@ static int stv090x_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | |||
758 | struct stv090x_state *state = fe->demodulator_priv; | 758 | struct stv090x_state *state = fe->demodulator_priv; |
759 | u32 reg; | 759 | u32 reg; |
760 | 760 | ||
761 | if (enable) | ||
762 | mutex_lock(&state->internal->tuner_lock); | ||
763 | |||
761 | reg = STV090x_READ_DEMOD(state, I2CRPT); | 764 | reg = STV090x_READ_DEMOD(state, I2CRPT); |
762 | if (enable) { | 765 | if (enable) { |
763 | dprintk(FE_DEBUG, 1, "Enable Gate"); | 766 | dprintk(FE_DEBUG, 1, "Enable Gate"); |
@@ -771,9 +774,14 @@ static int stv090x_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) | |||
771 | if ((STV090x_WRITE_DEMOD(state, I2CRPT, reg)) < 0) | 774 | if ((STV090x_WRITE_DEMOD(state, I2CRPT, reg)) < 0) |
772 | goto err; | 775 | goto err; |
773 | } | 776 | } |
777 | |||
778 | if (!enable) | ||
779 | mutex_unlock(&state->internal->tuner_lock); | ||
780 | |||
774 | return 0; | 781 | return 0; |
775 | err: | 782 | err: |
776 | dprintk(FE_ERROR, 1, "I/O error"); | 783 | dprintk(FE_ERROR, 1, "I/O error"); |
784 | mutex_unlock(&state->internal->tuner_lock); | ||
777 | return -1; | 785 | return -1; |
778 | } | 786 | } |
779 | 787 | ||
@@ -4439,6 +4447,7 @@ struct dvb_frontend *stv090x_attach(const struct stv090x_config *config, | |||
4439 | } | 4447 | } |
4440 | 4448 | ||
4441 | mutex_init(&state->internal->demod_lock); | 4449 | mutex_init(&state->internal->demod_lock); |
4450 | mutex_init(&state->internal->tuner_lock); | ||
4442 | 4451 | ||
4443 | if (stv090x_sleep(&state->frontend) < 0) { | 4452 | if (stv090x_sleep(&state->frontend) < 0) { |
4444 | dprintk(FE_ERROR, 1, "Error putting device to sleep"); | 4453 | dprintk(FE_ERROR, 1, "Error putting device to sleep"); |
diff --git a/drivers/media/dvb/frontends/stv090x_priv.h b/drivers/media/dvb/frontends/stv090x_priv.h index d38542665b0a..5b780c80d496 100644 --- a/drivers/media/dvb/frontends/stv090x_priv.h +++ b/drivers/media/dvb/frontends/stv090x_priv.h | |||
@@ -235,6 +235,7 @@ struct stv090x_internal { | |||
235 | u8 i2c_addr; | 235 | u8 i2c_addr; |
236 | 236 | ||
237 | struct mutex demod_lock; /* Lock access to shared register */ | 237 | struct mutex demod_lock; /* Lock access to shared register */ |
238 | struct mutex tuner_lock; /* Lock access to tuners */ | ||
238 | s32 mclk; /* Masterclock Divider factor */ | 239 | s32 mclk; /* Masterclock Divider factor */ |
239 | u32 dev_ver; | 240 | u32 dev_ver; |
240 | 241 | ||