diff options
author | Michael Krufky <devnull@localhost> | 2005-07-12 01:06:33 +0000 |
---|---|---|
committer | Michael Krufky <devnull@localhost> | 2005-07-12 01:06:33 +0000 |
commit | 03f738fc5cd9d4163f2d0c3a3754489ab0cbc5a5 (patch) | |
tree | 683edc9d591ef3a9ea5c929a2335ea2f6c54fe16 /v4l/lgdt3302.c | |
parent | c77b381314f650f7eb971b55b59e5c8f97692e54 (diff) | |
download | mediapointer-dvb-s2-03f738fc5cd9d4163f2d0c3a3754489ab0cbc5a5.tar.gz mediapointer-dvb-s2-03f738fc5cd9d4163f2d0c3a3754489ab0cbc5a5.tar.bz2 |
* lgdt3302.c:
- 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 according to a comment
seen about the lgdt3303 code.
Signed-off-by: Mac Michaels <wmichaels1@earthlink.net>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Diffstat (limited to 'v4l/lgdt3302.c')
-rw-r--r-- | v4l/lgdt3302.c | 63 |
1 files changed, 31 insertions, 32 deletions
diff --git a/v4l/lgdt3302.c b/v4l/lgdt3302.c index 20233e35c..23a2b5480 100644 --- a/v4l/lgdt3302.c +++ b/v4l/lgdt3302.c @@ -1,5 +1,5 @@ /* - * $Id: lgdt3302.c,v 1.15 2005/07/07 03:41:58 mkrufky Exp $ + * $Id: lgdt3302.c,v 1.16 2005/07/12 01:06:33 mkrufky Exp $ * * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM * @@ -83,7 +83,10 @@ static int i2c_writebytes (struct lgdt3302_state* state, if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); - return -EREMOTEIO; + if (err < 0) + return err; + else + return -EREMOTEIO; } } else { u8 tmp[] = { buf[0], buf[1] }; @@ -96,7 +99,10 @@ static int i2c_writebytes (struct lgdt3302_state* state, tmp[1] = buf[i]; if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err); - return -EREMOTEIO; + if (err < 0) + return err; + else + return -EREMOTEIO; } tmp[0]++; } @@ -266,36 +272,30 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, i2c_writebytes(state, state->config->demod_address, demux_ctrl_cfg, sizeof(demux_ctrl_cfg)); - if (param->u.vsb.modulation == VSB_8) { - /* Initialization for VSB modes only */ - /* Change the value of NCOCTFV[25:0]of carrier - recovery center frequency register for VSB */ - i2c_writebytes(state, state->config->demod_address, + /* Change the value of NCOCTFV[25:0] of carrier + recovery center frequency register */ + i2c_writebytes(state, state->config->demod_address, vsb_freq_cfg, sizeof(vsb_freq_cfg)); - } else { - /* Initialization for QAM modes only */ - /* Set the value of 'INLVTHD' register 0x2a/0x2c - to value from 'IFACC' register 0x39/0x3b -1 */ - int value; - i2c_selectreadbytes(state, AGC_RFIF_ACC0, - &agc_delay_cfg[1], 3); - value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3]; - value = value -1; - dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value); - agc_delay_cfg[1] = (value >> 8) & 0x0f; - agc_delay_cfg[2] = 0x00; - agc_delay_cfg[3] = value & 0xff; - i2c_writebytes(state, state->config->demod_address, - agc_delay_cfg, sizeof(agc_delay_cfg)); - - /* Change the value of IAGCBW[15:8] - of inner AGC loop filter bandwith */ - i2c_writebytes(state, state->config->demod_address, - agc_loop_cfg, sizeof(agc_loop_cfg)); - } + /* Set the value of 'INLVTHD' register 0x2a/0x2c + to value from 'IFACC' register 0x39/0x3b -1 */ + int value; + i2c_selectreadbytes(state, AGC_RFIF_ACC0, + &agc_delay_cfg[1], 3); + value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3]; + value = value -1; + dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value); + agc_delay_cfg[1] = (value >> 8) & 0x0f; + agc_delay_cfg[2] = 0x00; + agc_delay_cfg[3] = value & 0xff; + i2c_writebytes(state, state->config->demod_address, + agc_delay_cfg, sizeof(agc_delay_cfg)); + + /* Change the value of IAGCBW[15:8] + of inner AGC loop filter bandwith */ + i2c_writebytes(state, state->config->demod_address, + agc_loop_cfg, sizeof(agc_loop_cfg)); state->config->set_ts_params(fe, 0); - lgdt3302_SwReset(state); state->current_modulation = param->u.vsb.modulation; } @@ -311,11 +311,10 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, i2c_readbytes(state, state->config->pll_address, buf, 1); dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]); - lgdt3302_SwReset(state); - /* Update current frequency */ state->current_frequency = param->frequency; } + lgdt3302_SwReset(state); return 0; } |