tuner_dbg("adjust gain, step 2. Agc: %d\n", agc_stat); 
tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n", agc_stat, pll_stat & 0x80); 
static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq){	struct tuner *t = i2c_get_clientdata(c);	unsigned char soft_reset[]  = { 0x00, 0x00 };	unsigned char easy_mode[]   = { 0x01, t->tda8290_easy_mode };	unsigned char expert_mode[] = { 0x01, 0x80 };	unsigned char gainset_off[] = { 0x28, 0x14 };	unsigned char if_agc_spd[]  = { 0x0f, 0x88 };	unsigned char adc_head_6[]  = { 0x05, 0x04 };	unsigned char adc_head_9[]  = { 0x05, 0x02 };	unsigned char adc_head_12[] = { 0x05, 0x01 };	unsigned char pll_bw_nom[]  = { 0x0d, 0x47 };	unsigned char pll_bw_low[]  = { 0x0d, 0x27 };	unsigned char gainset_2[]   = { 0x28, 0x64 };	unsigned char agc_rst_on[]  = { 0x0e, 0x0b };	unsigned char agc_rst_off[] = { 0x0e, 0x09 };	unsigned char if_agc_set[]  = { 0x0f, 0x81 };	unsigned char addr_adc_sat  = 0x1a;	unsigned char addr_agc_stat = 0x1d;	unsigned char addr_pll_stat = 0x1b;	unsigned char adc_sat, agc_stat,		      pll_stat;	i2c_master_send(c, easy_mode, 2);	i2c_master_send(c, soft_reset, 2);	msleep(1);	i2c_master_send(c, expert_mode, 2);	i2c_master_send(c, gainset_off, 2);	i2c_master_send(c, if_agc_spd, 2);	if (t->tda8290_easy_mode & 0x60)		i2c_master_send(c, adc_head_9, 2);	else		i2c_master_send(c, adc_head_6, 2);	i2c_master_send(c, pll_bw_nom, 2);	tda8290_i2c_bridge(c, 1);	if (t->tda827x_ver != 0)		tda827xa_tune(c, ifc, freq);	else		tda827x_tune(c, ifc, freq);	/* adjust headroom resp. gain */	i2c_master_send(c, &addr_adc_sat, 1);	i2c_master_recv(c, &adc_sat, 1);	i2c_master_send(c, &addr_agc_stat, 1);	i2c_master_recv(c, &agc_stat, 1);	i2c_master_send(c, &addr_pll_stat, 1);	i2c_master_recv(c, &pll_stat, 1);	if (pll_stat & 0x80)		tuner_dbg("tda8290 is locked, AGC: %d\n", agc_stat);	else		tuner_dbg("tda8290 not locked, no signal?\n");	if ((agc_stat > 115) || (!(pll_stat & 0x80) && (adc_sat <20))) {		tuner_dbg("adjust gain, step 1. Agc: %d\n", agc_stat);		i2c_master_send(c, gainset_2, 2);		msleep(100);		i2c_master_send(c, &addr_agc_stat, 1);		i2c_master_recv(c, &agc_stat, 1);		i2c_master_send(c, &addr_pll_stat, 1);		i2c_master_recv(c, &pll_stat, 1);		if ((agc_stat > 115) || !(pll_stat & 0x80)) {			tuner_dbg("adjust gain, step 2. Agc: %d\n", agc_stat);			if (t->tda827x_ver != 0)				tda827xa_agcf(c);			else				tda827x_agcf(c);			msleep(100);			i2c_master_send(c, &addr_agc_stat, 1);			i2c_master_recv(c, &agc_stat, 1);			i2c_master_send(c, &addr_pll_stat, 1);			i2c_master_recv(c, &pll_stat, 1);			if((agc_stat > 115) || !(pll_stat & 0x80)) {				tuner_dbg("adjust gain, step 3. Agc: %d\n", agc_stat);				i2c_master_send(c, adc_head_12, 2);				i2c_master_send(c, pll_bw_low, 2);				msleep(100);			}		}	}	/* l/ l' deadlock? */	if(t->tda8290_easy_mode & 0x60) {		i2c_master_send(c, &addr_adc_sat, 1);		i2c_master_recv(c, &adc_sat, 1);		i2c_master_send(c, &addr_pll_stat, 1);		i2c_master_recv(c, &pll_stat, 1);		if ((adc_sat > 20) || !(pll_stat & 0x80)) {			i2c_master_send(c, agc_rst_on, 2);			msleep(40);			i2c_master_send(c, agc_rst_off, 2);		}	}	tda8290_i2c_bridge(c, 0);	i2c_master_send(c, if_agc_set, 2);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/4ac95af9a0bdc33f18e6a7532ac5319b2d4ab8c2/tda8290.c/buggy/drivers/media/video/tda8290.c