aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorOliver Endriss <o.endriss@gmx.de>2010-01-10 13:38:38 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-02-26 13:10:38 -0500
commit2c1f750ba3fbd4a54544a68b57087bb89f3ba92c (patch)
treec126e776420eed00d2b4e00dc9ceba7455be3738 /drivers/media
parent76b9ef97953c120172dfc07d48e6d219164c6f6a (diff)
V4L/DVB (13986): [STV090x] Disable I2C gate on error
The I2C gate must also be disabled, if a tuner command failed. Otherwise the tuner mutex would be locked forever. Signed-off-by: Oliver Endriss <o.endriss@gmx.de> Signed-off-by: Manu Abraham <abraham.manu@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/dvb/frontends/stv090x.c46
1 files changed, 31 insertions, 15 deletions
diff --git a/drivers/media/dvb/frontends/stv090x.c b/drivers/media/dvb/frontends/stv090x.c
index 3c5fba838827..cc487f6bdcee 100644
--- a/drivers/media/dvb/frontends/stv090x.c
+++ b/drivers/media/dvb/frontends/stv090x.c
@@ -1782,12 +1782,12 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
1782 1782
1783 if (state->config->tuner_set_frequency) { 1783 if (state->config->tuner_set_frequency) {
1784 if (state->config->tuner_set_frequency(fe, freq) < 0) 1784 if (state->config->tuner_set_frequency(fe, freq) < 0)
1785 goto err; 1785 goto err_gateoff;
1786 } 1786 }
1787 1787
1788 if (state->config->tuner_set_bandwidth) { 1788 if (state->config->tuner_set_bandwidth) {
1789 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0) 1789 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0)
1790 goto err; 1790 goto err_gateoff;
1791 } 1791 }
1792 1792
1793 if (stv090x_i2c_gate_ctrl(fe, 0) < 0) 1793 if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -1800,7 +1800,7 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
1800 1800
1801 if (state->config->tuner_get_status) { 1801 if (state->config->tuner_get_status) {
1802 if (state->config->tuner_get_status(fe, &reg) < 0) 1802 if (state->config->tuner_get_status(fe, &reg) < 0)
1803 goto err; 1803 goto err_gateoff;
1804 } 1804 }
1805 1805
1806 if (reg) 1806 if (reg)
@@ -1819,6 +1819,9 @@ static u32 stv090x_srate_srch_coarse(struct stv090x_state *state)
1819 srate_coarse = stv090x_get_srate(state, state->internal->mclk); 1819 srate_coarse = stv090x_get_srate(state, state->internal->mclk);
1820 1820
1821 return srate_coarse; 1821 return srate_coarse;
1822
1823err_gateoff:
1824 stv090x_i2c_gate_ctrl(fe, 0);
1822err: 1825err:
1823 dprintk(FE_ERROR, 1, "I/O error"); 1826 dprintk(FE_ERROR, 1, "I/O error");
1824 return -1; 1827 return -1;
@@ -2167,12 +2170,12 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
2167 2170
2168 if (state->config->tuner_set_frequency) { 2171 if (state->config->tuner_set_frequency) {
2169 if (state->config->tuner_set_frequency(fe, freq) < 0) 2172 if (state->config->tuner_set_frequency(fe, freq) < 0)
2170 goto err; 2173 goto err_gateoff;
2171 } 2174 }
2172 2175
2173 if (state->config->tuner_set_bandwidth) { 2176 if (state->config->tuner_set_bandwidth) {
2174 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0) 2177 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0)
2175 goto err; 2178 goto err_gateoff;
2176 } 2179 }
2177 2180
2178 if (stv090x_i2c_gate_ctrl(fe, 0) < 0) 2181 if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -2185,7 +2188,7 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
2185 2188
2186 if (state->config->tuner_get_status) { 2189 if (state->config->tuner_get_status) {
2187 if (state->config->tuner_get_status(fe, &reg) < 0) 2190 if (state->config->tuner_get_status(fe, &reg) < 0)
2188 goto err; 2191 goto err_gateoff;
2189 } 2192 }
2190 2193
2191 if (reg) 2194 if (reg)
@@ -2216,6 +2219,8 @@ static int stv090x_get_coldlock(struct stv090x_state *state, s32 timeout_dmd)
2216 2219
2217 return lock; 2220 return lock;
2218 2221
2222err_gateoff:
2223 stv090x_i2c_gate_ctrl(fe, 0);
2219err: 2224err:
2220 dprintk(FE_ERROR, 1, "I/O error"); 2225 dprintk(FE_ERROR, 1, "I/O error");
2221 return -1; 2226 return -1;
@@ -2589,7 +2594,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
2589 2594
2590 if (state->config->tuner_get_frequency) { 2595 if (state->config->tuner_get_frequency) {
2591 if (state->config->tuner_get_frequency(fe, &state->frequency) < 0) 2596 if (state->config->tuner_get_frequency(fe, &state->frequency) < 0)
2592 goto err; 2597 goto err_gateoff;
2593 } 2598 }
2594 2599
2595 if (stv090x_i2c_gate_ctrl(fe, 0) < 0) 2600 if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -2617,7 +2622,7 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
2617 2622
2618 if (state->config->tuner_get_frequency) { 2623 if (state->config->tuner_get_frequency) {
2619 if (state->config->tuner_get_frequency(fe, &state->frequency) < 0) 2624 if (state->config->tuner_get_frequency(fe, &state->frequency) < 0)
2620 goto err; 2625 goto err_gateoff;
2621 } 2626 }
2622 2627
2623 if (stv090x_i2c_gate_ctrl(fe, 0) < 0) 2628 if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -2637,6 +2642,9 @@ static enum stv090x_signal_state stv090x_get_sig_params(struct stv090x_state *st
2637 } 2642 }
2638 2643
2639 return STV090x_OUTOFRANGE; 2644 return STV090x_OUTOFRANGE;
2645
2646err_gateoff:
2647 stv090x_i2c_gate_ctrl(fe, 0);
2640err: 2648err:
2641 dprintk(FE_ERROR, 1, "I/O error"); 2649 dprintk(FE_ERROR, 1, "I/O error");
2642 return -1; 2650 return -1;
@@ -2995,7 +3003,7 @@ static int stv090x_optimize_track(struct stv090x_state *state)
2995 3003
2996 if (state->config->tuner_set_bandwidth) { 3004 if (state->config->tuner_set_bandwidth) {
2997 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0) 3005 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0)
2998 goto err; 3006 goto err_gateoff;
2999 } 3007 }
3000 3008
3001 if (stv090x_i2c_gate_ctrl(fe, 0) < 0) 3009 if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -3047,6 +3055,9 @@ static int stv090x_optimize_track(struct stv090x_state *state)
3047 stv090x_set_vit_thtracq(state); 3055 stv090x_set_vit_thtracq(state);
3048 3056
3049 return 0; 3057 return 0;
3058
3059err_gateoff:
3060 stv090x_i2c_gate_ctrl(fe, 0);
3050err: 3061err:
3051 dprintk(FE_ERROR, 1, "I/O error"); 3062 dprintk(FE_ERROR, 1, "I/O error");
3052 return -1; 3063 return -1;
@@ -3227,17 +3238,17 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
3227 3238
3228 if (state->config->tuner_set_bbgain) { 3239 if (state->config->tuner_set_bbgain) {
3229 if (state->config->tuner_set_bbgain(fe, 10) < 0) /* 10dB */ 3240 if (state->config->tuner_set_bbgain(fe, 10) < 0) /* 10dB */
3230 goto err; 3241 goto err_gateoff;
3231 } 3242 }
3232 3243
3233 if (state->config->tuner_set_frequency) { 3244 if (state->config->tuner_set_frequency) {
3234 if (state->config->tuner_set_frequency(fe, state->frequency) < 0) 3245 if (state->config->tuner_set_frequency(fe, state->frequency) < 0)
3235 goto err; 3246 goto err_gateoff;
3236 } 3247 }
3237 3248
3238 if (state->config->tuner_set_bandwidth) { 3249 if (state->config->tuner_set_bandwidth) {
3239 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0) 3250 if (state->config->tuner_set_bandwidth(fe, state->tuner_bw) < 0)
3240 goto err; 3251 goto err_gateoff;
3241 } 3252 }
3242 3253
3243 if (stv090x_i2c_gate_ctrl(fe, 0) < 0) 3254 if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -3250,7 +3261,7 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
3250 3261
3251 if (state->config->tuner_get_status) { 3262 if (state->config->tuner_get_status) {
3252 if (state->config->tuner_get_status(fe, &reg) < 0) 3263 if (state->config->tuner_get_status(fe, &reg) < 0)
3253 goto err; 3264 goto err_gateoff;
3254 } 3265 }
3255 3266
3256 if (reg) 3267 if (reg)
@@ -3383,6 +3394,8 @@ static enum stv090x_signal_state stv090x_algo(struct stv090x_state *state)
3383 } 3394 }
3384 return signal_state; 3395 return signal_state;
3385 3396
3397err_gateoff:
3398 stv090x_i2c_gate_ctrl(fe, 0);
3386err: 3399err:
3387 dprintk(FE_ERROR, 1, "I/O error"); 3400 dprintk(FE_ERROR, 1, "I/O error");
3388 return -1; 3401 return -1;
@@ -4323,12 +4336,12 @@ static int stv090x_init(struct dvb_frontend *fe)
4323 4336
4324 if (config->tuner_set_mode) { 4337 if (config->tuner_set_mode) {
4325 if (config->tuner_set_mode(fe, TUNER_WAKE) < 0) 4338 if (config->tuner_set_mode(fe, TUNER_WAKE) < 0)
4326 goto err; 4339 goto err_gateoff;
4327 } 4340 }
4328 4341
4329 if (config->tuner_init) { 4342 if (config->tuner_init) {
4330 if (config->tuner_init(fe) < 0) 4343 if (config->tuner_init(fe) < 0)
4331 goto err; 4344 goto err_gateoff;
4332 } 4345 }
4333 4346
4334 if (stv090x_i2c_gate_ctrl(fe, 0) < 0) 4347 if (stv090x_i2c_gate_ctrl(fe, 0) < 0)
@@ -4338,6 +4351,9 @@ static int stv090x_init(struct dvb_frontend *fe)
4338 goto err; 4351 goto err;
4339 4352
4340 return 0; 4353 return 0;
4354
4355err_gateoff:
4356 stv090x_i2c_gate_ctrl(fe, 0);
4341err: 4357err:
4342 dprintk(FE_ERROR, 1, "I/O error"); 4358 dprintk(FE_ERROR, 1, "I/O error");
4343 return -1; 4359 return -1;