aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDevin Heitmueller <devin.heitmueller@gmail.com>2008-11-15 21:29:11 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-06-16 17:21:04 -0400
commit91bd625e217452f01fc568f4d2cb3ad5cee4640c (patch)
tree01ba017d977d49dd32c2c00460bc32c7c56c6001
parent8475cbcb0f885189969915eb3680d10fc525d722 (diff)
V4L/DVB (11786): xc5000: handle tuner reset failures properly
Properly handle tuner reset failures (before it was always returning success) Signed-off-by: Devin Heitmueller <devin.heitmueller@gmail.com> Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/common/tuners/xc5000.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/drivers/media/common/tuners/xc5000.c b/drivers/media/common/tuners/xc5000.c
index f3880f8977e0..be6981737fb1 100644
--- a/drivers/media/common/tuners/xc5000.c
+++ b/drivers/media/common/tuners/xc5000.c
@@ -191,10 +191,10 @@ static struct XC_TV_STANDARD XC5000_Standard[MAX_TV_STANDARD] = {
191 {"FM Radio-INPUT1", 0x0208, 0x9002} 191 {"FM Radio-INPUT1", 0x0208, 0x9002}
192}; 192};
193 193
194static int xc5000_is_firmware_loaded(struct dvb_frontend *fe); 194static int xc5000_is_firmware_loaded(struct dvb_frontend *fe);
195static int xc5000_writeregs(struct xc5000_priv *priv, u8 *buf, u8 len); 195static int xc5000_writeregs(struct xc5000_priv *priv, u8 *buf, u8 len);
196static int xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len); 196static int xc5000_readregs(struct xc5000_priv *priv, u8 *buf, u8 len);
197static void xc5000_TunerReset(struct dvb_frontend *fe); 197static int xc5000_TunerReset(struct dvb_frontend *fe);
198 198
199static int xc_send_i2c_data(struct xc5000_priv *priv, u8 *buf, int len) 199static int xc_send_i2c_data(struct xc5000_priv *priv, u8 *buf, int len)
200{ 200{
@@ -208,18 +208,12 @@ static int xc_read_i2c_data(struct xc5000_priv *priv, u8 *buf, int len)
208 ? XC_RESULT_I2C_READ_FAILURE : XC_RESULT_SUCCESS; 208 ? XC_RESULT_I2C_READ_FAILURE : XC_RESULT_SUCCESS;
209} 209}
210 210
211static int xc_reset(struct dvb_frontend *fe)
212{
213 xc5000_TunerReset(fe);
214 return XC_RESULT_SUCCESS;
215}
216
217static void xc_wait(int wait_ms) 211static void xc_wait(int wait_ms)
218{ 212{
219 msleep(wait_ms); 213 msleep(wait_ms);
220} 214}
221 215
222static void xc5000_TunerReset(struct dvb_frontend *fe) 216static int xc5000_TunerReset(struct dvb_frontend *fe)
223{ 217{
224 struct xc5000_priv *priv = fe->tuner_priv; 218 struct xc5000_priv *priv = fe->tuner_priv;
225 int ret; 219 int ret;
@@ -232,10 +226,15 @@ static void xc5000_TunerReset(struct dvb_frontend *fe)
232 priv->i2c_props.adap->algo_data, 226 priv->i2c_props.adap->algo_data,
233 DVB_FRONTEND_COMPONENT_TUNER, 227 DVB_FRONTEND_COMPONENT_TUNER,
234 XC5000_TUNER_RESET, 0); 228 XC5000_TUNER_RESET, 0);
235 if (ret) 229 if (ret) {
236 printk(KERN_ERR "xc5000: reset failed\n"); 230 printk(KERN_ERR "xc5000: reset failed\n");
237 } else 231 return XC_RESULT_RESET_FAILURE;
232 }
233 } else {
238 printk(KERN_ERR "xc5000: no tuner reset callback function, fatal\n"); 234 printk(KERN_ERR "xc5000: no tuner reset callback function, fatal\n");
235 return XC_RESULT_RESET_FAILURE;
236 }
237 return XC_RESULT_SUCCESS;
239} 238}
240 239
241static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData) 240static int xc_write_reg(struct xc5000_priv *priv, u16 regAddr, u16 i2cData)
@@ -309,7 +308,7 @@ static int xc_load_i2c_sequence(struct dvb_frontend *fe, const u8 *i2c_sequence)
309 len = i2c_sequence[index] * 256 + i2c_sequence[index+1]; 308 len = i2c_sequence[index] * 256 + i2c_sequence[index+1];
310 if (len == 0x0000) { 309 if (len == 0x0000) {
311 /* RESET command */ 310 /* RESET command */
312 result = xc_reset(fe); 311 result = xc5000_TunerReset(fe);
313 index += 2; 312 index += 2;
314 if (result != XC_RESULT_SUCCESS) 313 if (result != XC_RESULT_SUCCESS)
315 return result; 314 return result;