aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorOliver Endriss <o.endriss@gmx.de>2011-01-10 04:36:10 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-21 19:31:44 -0400
commitf790bdd00da937845b38467abfebdea09acfea0e (patch)
treefa5bc8b416b22145046676a071922b3414fda5de /drivers
parent5bd0dc2d8a0db2f2e119ea50d07bf49e5e038f12 (diff)
[media] stv090x: Optional external lock routine
Card driver may supply its own lock routine now. Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Manu Abraham <manu@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/dvb/frontends/stv090x.c21
-rw-r--r--drivers/media/dvb/frontends/stv090x.h1
2 files changed, 17 insertions, 5 deletions
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c
index e26bfd765460..eccad06216ce 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -767,8 +767,12 @@ static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable)
767 * In case of any error, the lock is unlocked and exit within the 767 * In case of any error, the lock is unlocked and exit within the
768 * relevant operations themselves. 768 * relevant operations themselves.
769 */ 769 */
770 if (enable) 770 if (enable) {
771 mutex_lock(&state->internal->tuner_lock); 771 if (state->config->tuner_i2c_lock)
772 state->config->tuner_i2c_lock(&state->frontend, 1);
773 else
774 mutex_lock(&state->internal->tuner_lock);
775 }
772 776
773 reg = STV090x_READ_DEMOD(state, I2CRPT); 777 reg = STV090x_READ_DEMOD(state, I2CRPT);
774 if (enable) { 778 if (enable) {
@@ -784,13 +788,20 @@ static int stv090x_i2c_gate_ctrl(struct stv090x_state *state, int enable)
784 goto err; 788 goto err;
785 } 789 }
786 790
787 if (!enable) 791 if (!enable) {
788 mutex_unlock(&state->internal->tuner_lock); 792 if (state->config->tuner_i2c_lock)
793 state->config->tuner_i2c_lock(&state->frontend, 0);
794 else
795 mutex_unlock(&state->internal->tuner_lock);
796 }
789 797
790 return 0; 798 return 0;
791err: 799err:
792 dprintk(FE_ERROR, 1, "I/O error"); 800 dprintk(FE_ERROR, 1, "I/O error");
793 mutex_unlock(&state->internal->tuner_lock); 801 if (state->config->tuner_i2c_lock)
802 state->config->tuner_i2c_lock(&state->frontend, 0);
803 else
804 mutex_unlock(&state->internal->tuner_lock);
794 return -1; 805 return -1;
795} 806}
796 807
diff --git a/drivers/media/dvb/frontends/stv090x.h b/drivers/media/dvb/frontends/stv090x.h
index a3fefa717ed6..29cdc2b71314 100644
--- a/drivers/media/dvb/frontends/stv090x.h
+++ b/drivers/media/dvb/frontends/stv090x.h
@@ -100,6 +100,7 @@ struct stv090x_config {
100 int (*tuner_get_bbgain) (struct dvb_frontend *fe, u32 *gain); 100 int (*tuner_get_bbgain) (struct dvb_frontend *fe, u32 *gain);
101 int (*tuner_set_refclk) (struct dvb_frontend *fe, u32 refclk); 101 int (*tuner_set_refclk) (struct dvb_frontend *fe, u32 refclk);
102 int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status); 102 int (*tuner_get_status) (struct dvb_frontend *fe, u32 *status);
103 void (*tuner_i2c_lock) (struct dvb_frontend *fe, int lock);
103}; 104};
104 105
105#if defined(CONFIG_DVB_STV090x) || (defined(CONFIG_DVB_STV090x_MODULE) && defined(MODULE)) 106#if defined(CONFIG_DVB_STV090x) || (defined(CONFIG_DVB_STV090x_MODULE) && defined(MODULE))