diff options
author | Michael Krufky <mkrufky@m1k.net> | 2005-07-12 16:58:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-12 19:01:03 -0400 |
commit | 58ba006be9b5a8f14f32c530d19fcd4e633aadf8 (patch) | |
tree | 0fc1b3d619886c3756048d76457ada524b3cd0c3 /drivers/media | |
parent | 67bc4eb0b1140a4bf364f2dcca152be659ed9057 (diff) |
[PATCH] dvb: LGDT3302 QAM256 initialization fix
- Initialize all non mutually exclusive variables
without regard to the mode selected.
- Do a software reset each time the parameters are
set, regardless of whether anything changes.
This may allow an application to recover from a
hung condition.
- Improved error reporting.
- Removed $Id:$
Signed-off-by: Mac Michaels <wmichaels1@earthlink.net>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/dvb/frontends/lgdt3302.c | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/drivers/media/dvb/frontends/lgdt3302.c b/drivers/media/dvb/frontends/lgdt3302.c index 09c914256e49..2eea03d218cd 100644 --- a/drivers/media/dvb/frontends/lgdt3302.c +++ b/drivers/media/dvb/frontends/lgdt3302.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: lgdt3302.c,v 1.5 2005/07/07 03:47:15 mkrufky Exp $ | ||
3 | * | ||
4 | * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM | 2 | * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM |
5 | * | 3 | * |
6 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> | 4 | * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> |
@@ -83,7 +81,10 @@ static int i2c_writebytes (struct lgdt3302_state* state, | |||
83 | 81 | ||
84 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 82 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
85 | printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); | 83 | printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); |
86 | return -EREMOTEIO; | 84 | if (err < 0) |
85 | return err; | ||
86 | else | ||
87 | return -EREMOTEIO; | ||
87 | } | 88 | } |
88 | } else { | 89 | } else { |
89 | u8 tmp[] = { buf[0], buf[1] }; | 90 | u8 tmp[] = { buf[0], buf[1] }; |
@@ -96,7 +97,10 @@ static int i2c_writebytes (struct lgdt3302_state* state, | |||
96 | tmp[1] = buf[i]; | 97 | tmp[1] = buf[i]; |
97 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { | 98 | if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { |
98 | printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); | 99 | printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); |
99 | return -EREMOTEIO; | 100 | if (err < 0) |
101 | return err; | ||
102 | else | ||
103 | return -EREMOTEIO; | ||
100 | } | 104 | } |
101 | tmp[0]++; | 105 | tmp[0]++; |
102 | } | 106 | } |
@@ -218,6 +222,8 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, | |||
218 | 222 | ||
219 | /* Change only if we are actually changing the modulation */ | 223 | /* Change only if we are actually changing the modulation */ |
220 | if (state->current_modulation != param->u.vsb.modulation) { | 224 | if (state->current_modulation != param->u.vsb.modulation) { |
225 | int value; | ||
226 | |||
221 | switch(param->u.vsb.modulation) { | 227 | switch(param->u.vsb.modulation) { |
222 | case VSB_8: | 228 | case VSB_8: |
223 | dprintk("%s: VSB_8 MODE\n", __FUNCTION__); | 229 | dprintk("%s: VSB_8 MODE\n", __FUNCTION__); |
@@ -266,36 +272,29 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, | |||
266 | i2c_writebytes(state, state->config->demod_address, | 272 | i2c_writebytes(state, state->config->demod_address, |
267 | demux_ctrl_cfg, sizeof(demux_ctrl_cfg)); | 273 | demux_ctrl_cfg, sizeof(demux_ctrl_cfg)); |
268 | 274 | ||
269 | if (param->u.vsb.modulation == VSB_8) { | 275 | /* Change the value of NCOCTFV[25:0] of carrier |
270 | /* Initialization for VSB modes only */ | 276 | recovery center frequency register */ |
271 | /* Change the value of NCOCTFV[25:0]of carrier | 277 | i2c_writebytes(state, state->config->demod_address, |
272 | recovery center frequency register for VSB */ | ||
273 | i2c_writebytes(state, state->config->demod_address, | ||
274 | vsb_freq_cfg, sizeof(vsb_freq_cfg)); | 278 | vsb_freq_cfg, sizeof(vsb_freq_cfg)); |
275 | } else { | 279 | /* Set the value of 'INLVTHD' register 0x2a/0x2c |
276 | /* Initialization for QAM modes only */ | 280 | to value from 'IFACC' register 0x39/0x3b -1 */ |
277 | /* Set the value of 'INLVTHD' register 0x2a/0x2c | 281 | i2c_selectreadbytes(state, AGC_RFIF_ACC0, |
278 | to value from 'IFACC' register 0x39/0x3b -1 */ | 282 | &agc_delay_cfg[1], 3); |
279 | int value; | 283 | value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3]; |
280 | i2c_selectreadbytes(state, AGC_RFIF_ACC0, | 284 | value = value -1; |
281 | &agc_delay_cfg[1], 3); | 285 | dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value); |
282 | value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3]; | 286 | agc_delay_cfg[1] = (value >> 8) & 0x0f; |
283 | value = value -1; | 287 | agc_delay_cfg[2] = 0x00; |
284 | dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value); | 288 | agc_delay_cfg[3] = value & 0xff; |
285 | agc_delay_cfg[1] = (value >> 8) & 0x0f; | 289 | i2c_writebytes(state, state->config->demod_address, |
286 | agc_delay_cfg[2] = 0x00; | 290 | agc_delay_cfg, sizeof(agc_delay_cfg)); |
287 | agc_delay_cfg[3] = value & 0xff; | 291 | |
288 | i2c_writebytes(state, state->config->demod_address, | 292 | /* Change the value of IAGCBW[15:8] |
289 | agc_delay_cfg, sizeof(agc_delay_cfg)); | 293 | of inner AGC loop filter bandwith */ |
290 | 294 | i2c_writebytes(state, state->config->demod_address, | |
291 | /* Change the value of IAGCBW[15:8] | 295 | agc_loop_cfg, sizeof(agc_loop_cfg)); |
292 | of inner AGC loop filter bandwith */ | ||
293 | i2c_writebytes(state, state->config->demod_address, | ||
294 | agc_loop_cfg, sizeof(agc_loop_cfg)); | ||
295 | } | ||
296 | 296 | ||
297 | state->config->set_ts_params(fe, 0); | 297 | state->config->set_ts_params(fe, 0); |
298 | lgdt3302_SwReset(state); | ||
299 | state->current_modulation = param->u.vsb.modulation; | 298 | state->current_modulation = param->u.vsb.modulation; |
300 | } | 299 | } |
301 | 300 | ||
@@ -311,11 +310,10 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, | |||
311 | i2c_readbytes(state, state->config->pll_address, buf, 1); | 310 | i2c_readbytes(state, state->config->pll_address, buf, 1); |
312 | dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]); | 311 | dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]); |
313 | 312 | ||
314 | lgdt3302_SwReset(state); | ||
315 | |||
316 | /* Update current frequency */ | 313 | /* Update current frequency */ |
317 | state->current_frequency = param->frequency; | 314 | state->current_frequency = param->frequency; |
318 | } | 315 | } |
316 | lgdt3302_SwReset(state); | ||
319 | return 0; | 317 | return 0; |
320 | } | 318 | } |
321 | 319 | ||