 /* Check the status of the tuner pll */ i2c_readbytes(state, state->config->pll_address, buf, 1); dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]); if ((buf[0] & 0xc0) != 0x40) return 0; /* Tuner PLL not locked or not powered on */ 
static int lgdt3302_read_status(struct dvb_frontend* fe, fe_status_t* status){	struct lgdt3302_state* state = (struct lgdt3302_state*) fe->demodulator_priv;	u8 buf[3];	*status = 0; /* Reset status result */	/* Check the status of the tuner pll */	i2c_readbytes(state, state->config->pll_address, buf, 1);	dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);	if ((buf[0] & 0xc0) != 0x40)		return 0; /* Tuner PLL not locked or not powered on */	/*	 * You must set the Mask bits to 1 in the IRQ_MASK in order	 * to see that status bit in the IRQ_STATUS register.	 * This is done in SwReset();	 */	/* AGC status register */	i2c_selectreadbytes(state, AGC_STATUS, buf, 1);	dprintk("%s: AGC_STATUS = 0x%02x\n", __FUNCTION__, buf[0]);	if ((buf[0] & 0x0c) == 0x8){		/* Test signal does not exist flag */		/* as well as the AGC lock flag.   */		*status |= FE_HAS_SIGNAL;	} else {		/* Without a signal all other status bits are meaningless */		return 0;	}	/* signal status */	i2c_selectreadbytes(state, TOP_CONTROL, buf, sizeof(buf));	dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n", __FUNCTION__, buf[0], buf[1], buf[2]);#if 0	/* Alternative method to check for a signal */	/* using the SNR good/bad interrupts.   */	if ((buf[2] & 0x30) == 0x10)		*status |= FE_HAS_SIGNAL;#endif	/* sync status */	if ((buf[2] & 0x03) == 0x01) {		*status |= FE_HAS_SYNC;	}	/* FEC error status */	if ((buf[2] & 0x0c) == 0x08) {		*status |= FE_HAS_LOCK;		*status |= FE_HAS_VITERBI;	}	/* Carrier Recovery Lock Status Register */	i2c_selectreadbytes(state, CARRIER_LOCK, buf, 1);	dprintk("%s: CARRIER_LOCK = 0x%02x\n", __FUNCTION__, buf[0]);	switch (state->current_modulation) {	case QAM_256:	case QAM_64:		/* Need to undestand why there are 3 lock levels here */		if ((buf[0] & 0x07) == 0x07)			*status |= FE_HAS_CARRIER;		break;	case VSB_8:		if ((buf[0] & 0x80) == 0x80)			*status |= FE_HAS_CARRIER;		break;	default:		printk("KERN_WARNING lgdt3302: %s: Modulation set to unsupported value\n", __FUNCTION__);	}	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/b6aef071bdef0cd9f69113bb3575aa45fafdbbbf/lgdt3302.c/clean/drivers/media/dvb/frontends/lgdt3302.c