提交 58ba006b 编写于 作者: M Michael Krufky 提交者: Linus Torvalds

[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: NMac Michaels <wmichaels1@earthlink.net>
Signed-off-by: NMichael Krufky <mkrufky@m1k.net>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 67bc4eb0
/* /*
* $Id: lgdt3302.c,v 1.5 2005/07/07 03:47:15 mkrufky Exp $
*
* Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM * Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM
* *
* Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net> * Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
...@@ -83,7 +81,10 @@ static int i2c_writebytes (struct lgdt3302_state* state, ...@@ -83,7 +81,10 @@ static int i2c_writebytes (struct lgdt3302_state* state,
if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { 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); 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 { } else {
u8 tmp[] = { buf[0], buf[1] }; u8 tmp[] = { buf[0], buf[1] };
...@@ -96,7 +97,10 @@ static int i2c_writebytes (struct lgdt3302_state* state, ...@@ -96,7 +97,10 @@ static int i2c_writebytes (struct lgdt3302_state* state,
tmp[1] = buf[i]; tmp[1] = buf[i];
if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) { 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); 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]++; tmp[0]++;
} }
...@@ -218,6 +222,8 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, ...@@ -218,6 +222,8 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
/* Change only if we are actually changing the modulation */ /* Change only if we are actually changing the modulation */
if (state->current_modulation != param->u.vsb.modulation) { if (state->current_modulation != param->u.vsb.modulation) {
int value;
switch(param->u.vsb.modulation) { switch(param->u.vsb.modulation) {
case VSB_8: case VSB_8:
dprintk("%s: VSB_8 MODE\n", __FUNCTION__); dprintk("%s: VSB_8 MODE\n", __FUNCTION__);
...@@ -266,36 +272,29 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, ...@@ -266,36 +272,29 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
i2c_writebytes(state, state->config->demod_address, i2c_writebytes(state, state->config->demod_address,
demux_ctrl_cfg, sizeof(demux_ctrl_cfg)); demux_ctrl_cfg, sizeof(demux_ctrl_cfg));
if (param->u.vsb.modulation == VSB_8) { /* Change the value of NCOCTFV[25:0] of carrier
/* Initialization for VSB modes only */ recovery center frequency register */
/* Change the value of NCOCTFV[25:0]of carrier i2c_writebytes(state, state->config->demod_address,
recovery center frequency register for VSB */
i2c_writebytes(state, state->config->demod_address,
vsb_freq_cfg, sizeof(vsb_freq_cfg)); vsb_freq_cfg, sizeof(vsb_freq_cfg));
} else { /* Set the value of 'INLVTHD' register 0x2a/0x2c
/* Initialization for QAM modes only */ to value from 'IFACC' register 0x39/0x3b -1 */
/* Set the value of 'INLVTHD' register 0x2a/0x2c i2c_selectreadbytes(state, AGC_RFIF_ACC0,
to value from 'IFACC' register 0x39/0x3b -1 */ &agc_delay_cfg[1], 3);
int value; value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3];
i2c_selectreadbytes(state, AGC_RFIF_ACC0, value = value -1;
&agc_delay_cfg[1], 3); dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value);
value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3]; agc_delay_cfg[1] = (value >> 8) & 0x0f;
value = value -1; agc_delay_cfg[2] = 0x00;
dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value); agc_delay_cfg[3] = value & 0xff;
agc_delay_cfg[1] = (value >> 8) & 0x0f; i2c_writebytes(state, state->config->demod_address,
agc_delay_cfg[2] = 0x00; agc_delay_cfg, sizeof(agc_delay_cfg));
agc_delay_cfg[3] = value & 0xff;
i2c_writebytes(state, state->config->demod_address, /* Change the value of IAGCBW[15:8]
agc_delay_cfg, sizeof(agc_delay_cfg)); of inner AGC loop filter bandwith */
i2c_writebytes(state, state->config->demod_address,
/* Change the value of IAGCBW[15:8] agc_loop_cfg, sizeof(agc_loop_cfg));
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); state->config->set_ts_params(fe, 0);
lgdt3302_SwReset(state);
state->current_modulation = param->u.vsb.modulation; state->current_modulation = param->u.vsb.modulation;
} }
...@@ -311,11 +310,10 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe, ...@@ -311,11 +310,10 @@ static int lgdt3302_set_parameters(struct dvb_frontend* fe,
i2c_readbytes(state, state->config->pll_address, buf, 1); i2c_readbytes(state, state->config->pll_address, buf, 1);
dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]); dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);
lgdt3302_SwReset(state);
/* Update current frequency */ /* Update current frequency */
state->current_frequency = param->frequency; state->current_frequency = param->frequency;
} }
lgdt3302_SwReset(state);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册