state->config->set_ts_params(fe, 1); 
if (state->config->set_ts_params) state->config->set_ts_params(fe, 1); 
static int nxt200x_setup_frontend_parameters (struct dvb_frontend* fe,					     struct dvb_frontend_parameters *p){	struct nxt200x_state* state = fe->demodulator_priv;	u8 buf[4];	/* stop the micro first */	nxt200x_microcontroller_stop(state);	if (state->demod_chip == NXT2004) {		/* make sure demod is set to digital */		buf[0] = 0x04;		nxt200x_writebytes(state, 0x14, buf, 1);		buf[0] = 0x00;		nxt200x_writebytes(state, 0x17, buf, 1);	}	/* get tuning information */	dvb_pll_configure(state->config->pll_desc, buf, p->frequency, 0);	/* set additional params */	switch (p->u.vsb.modulation) {		case QAM_64:		case QAM_256:			/* Set punctured clock for QAM */			/* This is just a guess since I am unable to test it */			state->config->set_ts_params(fe, 1);			/* set to use cable input */			buf[3] |= 0x08;			break;		case VSB_8:			/* Set non-punctured clock for VSB */			state->config->set_ts_params(fe, 0);			break;		default:			return -EINVAL;			break;	}	/* write frequency information */	nxt200x_writetuner(state, buf);	/* reset the agc now that tuning has been completed */	nxt200x_agc_reset(state);	/* set target power level */	switch (p->u.vsb.modulation) {		case QAM_64:		case QAM_256:			buf[0] = 0x74;			break;		case VSB_8:			buf[0] = 0x70;			break;		default:			return -EINVAL;			break;	}	nxt200x_writebytes(state, 0x42, buf, 1);	/* configure sdm */	switch (state->demod_chip) {		case NXT2002:			buf[0] = 0x87;			break;		case NXT2004:			buf[0] = 0x07;			break;		default:			return -EINVAL;			break;	}	nxt200x_writebytes(state, 0x57, buf, 1);	/* write sdm1 input */	buf[0] = 0x10;	buf[1] = 0x00;	nxt200x_writebytes(state, 0x58, buf, 2);	/* write sdmx input */	switch (p->u.vsb.modulation) {		case QAM_64:				buf[0] = 0x68;				break;		case QAM_256:				buf[0] = 0x64;				break;		case VSB_8:				buf[0] = 0x60;				break;		default:				return -EINVAL;				break;	}	buf[1] = 0x00;	nxt200x_writebytes(state, 0x5C, buf, 2);	/* write adc power lpf fc */	buf[0] = 0x05;	nxt200x_writebytes(state, 0x43, buf, 1);	if (state->demod_chip == NXT2004) {		/* write ??? */		buf[0] = 0x00;		buf[1] = 0x00;		nxt200x_writebytes(state, 0x46, buf, 2);	}	/* write accumulator2 input */	buf[0] = 0x80;	buf[1] = 0x00;	nxt200x_writebytes(state, 0x4B, buf, 2);	/* write kg1 */	buf[0] = 0x00;	nxt200x_writebytes(state, 0x4D, buf, 1);	/* write sdm12 lpf fc */	buf[0] = 0x44;	nxt200x_writebytes(state, 0x55, buf, 1);	/* write agc control reg */	buf[0] = 0x04;	nxt200x_writebytes(state, 0x41, buf, 1);	if (state->demod_chip == NXT2004) {		nxt200x_readreg_multibyte(state, 0x80, buf, 1);		buf[0] = 0x24;		nxt200x_writereg_multibyte(state, 0x80, buf, 1);		/* soft reset? */		nxt200x_readreg_multibyte(state, 0x08, buf, 1);		buf[0] = 0x10;		nxt200x_writereg_multibyte(state, 0x08, buf, 1);		nxt200x_readreg_multibyte(state, 0x08, buf, 1);		buf[0] = 0x00;		nxt200x_writereg_multibyte(state, 0x08, buf, 1);		nxt200x_readreg_multibyte(state, 0x80, buf, 1);		buf[0] = 0x04;		nxt200x_writereg_multibyte(state, 0x80, buf, 1);		buf[0] = 0x00;		nxt200x_writereg_multibyte(state, 0x81, buf, 1);		buf[0] = 0x80; buf[1] = 0x00; buf[2] = 0x00;		nxt200x_writereg_multibyte(state, 0x82, buf, 3);		nxt200x_readreg_multibyte(state, 0x88, buf, 1);		buf[0] = 0x11;		nxt200x_writereg_multibyte(state, 0x88, buf, 1);		nxt200x_readreg_multibyte(state, 0x80, buf, 1);		buf[0] = 0x44;		nxt200x_writereg_multibyte(state, 0x80, buf, 1);	}	/* write agc ucgp0 */	switch (p->u.vsb.modulation) {		case QAM_64:				buf[0] = 0x02;				break;		case QAM_256:				buf[0] = 0x03;				break;		case VSB_8:				buf[0] = 0x00;				break;		default:				return -EINVAL;				break;	}	nxt200x_writebytes(state, 0x30, buf, 1);	/* write agc control reg */	buf[0] = 0x00;	nxt200x_writebytes(state, 0x41, buf, 1);	/* write accumulator2 input */	buf[0] = 0x80;	buf[1] = 0x00;	nxt200x_writebytes(state, 0x49, buf,2);	nxt200x_writebytes(state, 0x4B, buf,2);	/* write agc control reg */	buf[0] = 0x04;	nxt200x_writebytes(state, 0x41, buf, 1);	nxt200x_microcontroller_start(state);	if (state->demod_chip == NXT2004) {		nxt2004_microcontroller_init(state);		/* ???? */		buf[0] = 0xF0;		buf[1] = 0x00;		nxt200x_writebytes(state, 0x5C, buf, 2);	}	/* adjacent channel detection should be done here, but I don't	have any stations with this need so I cannot test it */	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/c6dd2d5d61b000509e3a7f6c06778b16a4ef10ba/nxt200x.c/clean/drivers/media/dvb/frontends/nxt200x.c