dprintk(1, "%3d [%02x] ", len, eeprom_data[i]); for(j = 1; j < len; j++) { dprintk(1, "%02x ", eeprom_data[i + j]); } dprintk(1, "\n"); 
if (debug) { tveeprom_info("Tag [%02x] + %d bytes:", eeprom_data[i], len - 1); for(j = 1; j < len; j++) { printk(" %02x", eeprom_data[i + j]); } printk("\n"); } 
void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data){	/* ----------------------------------------------	** The hauppauge eeprom format is tagged	**	** if packet[0] == 0x84, then packet[0..1] == length	** else length = packet[0] & 3f;	** if packet[0] & f8 == f8, then EOD and packet[1] == checksum	**	** In our (ivtv) case we're interested in the following:	** tuner type: tag [00].05 or [0a].01 (index into hauppauge_tuner)	** tuner fmts: tag [00].04 or [0a].00 (bitmask index into hauppauge_tuner_fmt)	** radio:      tag [00].{last} or [0e].00  (bitmask.  bit2=FM)	** audio proc: tag [02].01 or [05].00 (lower nibble indexes lut?)	** Fun info:	** model:      tag [00].07-08 or [06].00-01	** revision:   tag [00].09-0b or [06].04-06	** serial#:    tag [01].05-07 or [04].04-06	** # of inputs/outputs ???	*/	int i, j, len, done, beenhere, tag, tuner = 0, t_format = 0;	char *t_name = NULL, *t_fmt_name = NULL;	dprintk(1, "%s\n",__FUNCTION__);	tvee->revision = done = len = beenhere = 0;	for (i = 0; !done && i < 256; i += len) {		dprintk(2, "processing pos = %02x (%02x, %02x)\n",			i, eeprom_data[i], eeprom_data[i + 1]);		if (eeprom_data[i] == 0x84) {			len = eeprom_data[i + 1] + (eeprom_data[i + 2] << 8);			i+=3;		} else if ((eeprom_data[i] & 0xf0) == 0x70) {			if ((eeprom_data[i] & 0x08)) {				/* verify checksum! */				done = 1;				break;			}			len = eeprom_data[i] & 0x07;			++i;		} else {			TVEEPROM_KERN_ERR("Encountered bad packet header [%02x]. "				   "Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]);			return;		}		dprintk(1, "%3d [%02x] ", len, eeprom_data[i]);		for(j = 1; j < len; j++) {			dprintk(1, "%02x ", eeprom_data[i + j]);		}		dprintk(1, "\n");		/* process by tag */		tag = eeprom_data[i];		switch (tag) {		case 0x00:			tuner = eeprom_data[i+6];			t_format = eeprom_data[i+5];			tvee->has_radio = eeprom_data[i+len-1];			tvee->model =				eeprom_data[i+8] +				(eeprom_data[i+9] << 8);			tvee->revision = eeprom_data[i+10] +				(eeprom_data[i+11] << 8) +				(eeprom_data[i+12] << 16);			break;		case 0x01:			tvee->serial_number =				eeprom_data[i+6] +				(eeprom_data[i+7] << 8) +				(eeprom_data[i+8] << 16);			break;		case 0x02:			tvee->audio_processor = eeprom_data[i+2] & 0x0f;			break;		case 0x04:			tvee->serial_number =				eeprom_data[i+5] +				(eeprom_data[i+6] << 8) +				(eeprom_data[i+7] << 16);			break;		case 0x05:			tvee->audio_processor = eeprom_data[i+1] & 0x0f;			break;		case 0x06:			tvee->model =				eeprom_data[i+1] +				(eeprom_data[i+2] << 8);			tvee->revision = eeprom_data[i+5] +				(eeprom_data[i+6] << 8) +				(eeprom_data[i+7] << 16);			break;		case 0x0a:			if(beenhere == 0) {				tuner = eeprom_data[i+2];				t_format = eeprom_data[i+1];				beenhere = 1;				break;			} else {				break;			}		case 0x0e:			tvee->has_radio = eeprom_data[i+1];			break;		default:			dprintk(1, "Not sure what to do with tag [%02x]\n", tag);			/* dump the rest of the packet? */		}	}	if (!done) {		TVEEPROM_KERN_ERR("Ran out of data!\n");		return;	}	if (tvee->revision != 0) {		tvee->rev_str[0] = 32 + ((tvee->revision >> 18) & 0x3f);		tvee->rev_str[1] = 32 + ((tvee->revision >> 12) & 0x3f);		tvee->rev_str[2] = 32 + ((tvee->revision >>  6) & 0x3f);		tvee->rev_str[3] = 32 + ( tvee->revision        & 0x3f);		tvee->rev_str[4] = 0;	}        if (hasRadioTuner(tuner) && !tvee->has_radio) {	    TVEEPROM_KERN_INFO("The eeprom says no radio is present, but the tuner type\n");	    TVEEPROM_KERN_INFO("indicates otherwise. I will assume that radio is present.\n");            tvee->has_radio = 1;        }	if (tuner < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) {		tvee->tuner_type = hauppauge_tuner[tuner].id;		t_name = hauppauge_tuner[tuner].name;	} else {		t_name = "<unknown>";	}	tvee->tuner_formats = 0;	t_fmt_name = "<none>";	for (i = 0; i < 8; i++) {		if (t_format & (1<<i)) {			tvee->tuner_formats |= hauppauge_tuner_fmt[i].id;			/* yuck */			t_fmt_name = hauppauge_tuner_fmt[i].name;		}	}	TVEEPROM_KERN_INFO("Hauppauge: model = %d, rev = %s, serial# = %d\n",		   tvee->model,		   tvee->rev_str,		   tvee->serial_number);	TVEEPROM_KERN_INFO("tuner = %s (idx = %d, type = %d)\n",		   t_name,		   tuner,		   tvee->tuner_type);	TVEEPROM_KERN_INFO("tuner fmt = %s (eeprom = 0x%02x, v4l2 = 0x%08x)\n",		   t_fmt_name,		   t_format,		   tvee->tuner_formats);	TVEEPROM_KERN_INFO("audio_processor = %s (type = %d)\n",		   STRM(sndtype,tvee->audio_processor),		   tvee->audio_processor);}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/0f97a931b337e4662e736ca67f1fab0a187f5852/tveeprom.c/clean/drivers/media/video/tveeprom.c