/* Select VSB mode and serial MPEG interface */ top_ctrl_cfg[1] = 0x07; 
/* Select VSB mode */ top_ctrl_cfg[1] = 0x03; 
static int lgdt330x_set_parameters(struct dvb_frontend* fe,				   struct dvb_frontend_parameters *param){	struct lgdt330x_state* state =		(struct lgdt330x_state*) fe->demodulator_priv;	/* Use 50MHz parameter values from spec sheet since xtal is 50 */	static u8 top_ctrl_cfg[]   = { TOP_CONTROL, 0x03 };	static u8 vsb_freq_cfg[]   = { VSB_CARRIER_FREQ0, 0x00, 0x87, 0x8e, 0x01 };	static u8 demux_ctrl_cfg[] = { DEMUX_CONTROL, 0xfb };	static u8 agc_rf_cfg[]     = { AGC_RF_BANDWIDTH0, 0x40, 0x93, 0x00 };	static u8 agc_ctrl_cfg[]   = { AGC_FUNC_CTRL2, 0xc6, 0x40 };	static u8 agc_delay_cfg[]  = { AGC_DELAY0, 0x07, 0x00, 0xfe };	static u8 agc_loop_cfg[]   = { AGC_LOOP_BANDWIDTH0, 0x08, 0x9a };	/* Change only if we are actually changing the modulation */	if (state->current_modulation != param->u.vsb.modulation) {		switch(param->u.vsb.modulation) {		case VSB_8:			dprintk("%s: VSB_8 MODE\n", __FUNCTION__);			/* Select VSB mode and serial MPEG interface */			top_ctrl_cfg[1] = 0x07;			/* Select ANT connector if supported by card */			if (state->config->pll_rf_set)				state->config->pll_rf_set(fe, 1);			break;		case QAM_64:			dprintk("%s: QAM_64 MODE\n", __FUNCTION__);			/* Select QAM_64 mode and serial MPEG interface */			top_ctrl_cfg[1] = 0x04;			/* Select CABLE connector if supported by card */			if (state->config->pll_rf_set)				state->config->pll_rf_set(fe, 0);			break;		case QAM_256:			dprintk("%s: QAM_256 MODE\n", __FUNCTION__);			/* Select QAM_256 mode and serial MPEG interface */			top_ctrl_cfg[1] = 0x05;			/* Select CABLE connector if supported by card */			if (state->config->pll_rf_set)				state->config->pll_rf_set(fe, 0);			break;		default:			printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n", __FUNCTION__, param->u.vsb.modulation);			return -1;		}		/* Initializations common to all modes */		/* Select the requested mode */		i2c_writebytes(state, state->config->demod_address,			       top_ctrl_cfg, sizeof(top_ctrl_cfg));		/* Change the value of IFBW[11:0]		   of AGC IF/RF loop filter bandwidth register */		i2c_writebytes(state, state->config->demod_address,			       agc_rf_cfg, sizeof(agc_rf_cfg));		/* Change the value of bit 6, 'nINAGCBY' and		   'NSSEL[1:0] of ACG function control register 2 */		/* Change the value of bit 6 'RFFIX'		   of AGC function control register 3 */		i2c_writebytes(state, state->config->demod_address,			       agc_ctrl_cfg, sizeof(agc_ctrl_cfg));		/* Change the TPCLK pin polarity		   data is valid on falling clock */		i2c_writebytes(state, state->config->demod_address,			       demux_ctrl_cfg, sizeof(demux_ctrl_cfg));		/* 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));		/* Set the value of 'INLVTHD' register 0x2a/0x2c to 0x7fe */		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);		state->current_modulation = param->u.vsb.modulation;	}	/* Change only if we are actually changing the channel */	if (state->current_frequency != param->frequency) {		u8 buf[5];		struct i2c_msg msg = { .flags = 0, .buf = &buf[1], .len = 4 };		int err;		state->config->pll_set(fe, param, buf);		msg.addr = buf[0];		dprintk("%s: tuner at 0x%02x bytes: 0x%02x 0x%02x "			"0x%02x 0x%02x\n", __FUNCTION__,			buf[0],buf[1],buf[2],buf[3],buf[4]);		if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {			printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n", __FUNCTION__, buf[0], buf[1], err);			if (err < 0)				return err;			else				return -EREMOTEIO;		}#if 0		/* Check the status of the tuner pll */		i2c_readbytes(state, buf[0], &buf[1], 1);		dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[1]);#endif		/* Update current frequency */		state->current_frequency = param->frequency;	}	lgdt330x_SwReset(state);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/1963c907b21e140082d081b1c8f8c2154593c7d7/lgdt330x.c/clean/drivers/media/dvb/frontends/lgdt330x.c