struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv; 
struct sp887x_state* state = fe->demodulator_priv; 
static int sp887x_initial_setup (struct dvb_frontend* fe, const struct firmware *fw){	struct sp887x_state* state = (struct sp887x_state*) fe->demodulator_priv;	u8 buf [BLOCKSIZE+2];	int i;	int fw_size = fw->size;	unsigned char *mem = fw->data;	dprintk("%s\n", __FUNCTION__);	/* ignore the first 10 bytes, then we expect 0x4000 bytes of firmware */	if (fw_size < FW_SIZE+10)		return -ENODEV;	mem = fw->data + 10;	/* soft reset */	sp887x_writereg(state, 0xf1a, 0x000);	sp887x_microcontroller_stop (state);	printk ("%s: firmware upload... ", __FUNCTION__);	/* setup write pointer to -1 (end of memory) */	/* bit 0x8000 in address is set to enable 13bit mode */	sp887x_writereg(state, 0x8f08, 0x1fff);	/* dummy write (wrap around to start of memory) */	sp887x_writereg(state, 0x8f0a, 0x0000);	for (i = 0; i < FW_SIZE; i += BLOCKSIZE) {		int c = BLOCKSIZE;		int err;		if (i+c > FW_SIZE)			c = FW_SIZE - i;		/* bit 0x8000 in address is set to enable 13bit mode */		/* bit 0x4000 enables multibyte read/write transfers */		/* write register is 0xf0a */		buf[0] = 0xcf;		buf[1] = 0x0a;		memcpy(&buf[2], mem + i, c);		if ((err = i2c_writebytes (state, buf, c+2)) < 0) {			printk ("failed.\n");			printk ("%s: i2c error (err == %i)\n", __FUNCTION__, err);			return err;		}	}	/* don't write RS bytes between packets */	sp887x_writereg(state, 0xc13, 0x001);	/* suppress clock if (!data_valid) */	sp887x_writereg(state, 0xc14, 0x000);	/* setup MPEG interface... */	sp887x_writereg(state, 0xc1a, 0x872);	sp887x_writereg(state, 0xc1b, 0x001);	sp887x_writereg(state, 0xc1c, 0x000); /* parallel mode (serial mode == 1) */	sp887x_writereg(state, 0xc1a, 0x871);	/* ADC mode, 2 for MT8872, 3 for SP8870/SP8871 */	sp887x_writereg(state, 0x301, 0x002);	sp887x_setup_agc(state);	/* bit 0x010: enable data valid signal */	sp887x_writereg(state, 0xd00, 0x010);	sp887x_writereg(state, 0x0d1, 0x000);	/* setup the PLL */	if (state->config->pll_init) {		sp887x_writereg(state, 0x206, 0x001);		state->config->pll_init(fe);		sp887x_writereg(state, 0x206, 0x000);	}	printk ("done.\n");	return 0;};
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/b8742700f13163ffa00cddce2a3c940b9ab2ab5a/sp887x.c/clean/drivers/media/dvb/frontends/sp887x.c