[PATCH] V4L: tveeprom MAC address parsing/cleanup

- Added a mac address field to the tveeprom structure.

- allow callers to query the MAC address.

- removed some redundant eeprom parsing code in cx88-cards.c (specific to
  Hauppauge DVB products) Instead, placed calls directly to the single eeprom
  parsing function in tveeprom.c

Signed-off-by: Steven Toth <stoth@hauppauge.com>
Signed-off-by: Michael Krufky <mkrufky@m1k.net>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 72e8741..d6afd91 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -81,7 +81,7 @@
 	{ 0x00000010, " PAL(I)" },
 	{ 0x00400000, " SECAM(L/L')" },
 	{ 0x00000e00, " PAL(D/K)" },
-	{ 0x03000000, " ATSC Digital" },
+	{ 0x03000000, " ATSC/DVB Digital" },
 };
 
 /* This is the full list of possible tuners. Many thanks to Hauppauge for
@@ -216,6 +216,20 @@
 	{ TUNER_ABSENT,        "LG TAPC-W701D"},
 	{ TUNER_ABSENT,        "TCL 9886P-WM"},
 	{ TUNER_ABSENT,        "TCL 1676NM-WM"},
+	/* 110-119 */
+	{ TUNER_ABSENT,        "Thompson DTT75105"},
+	{ TUNER_ABSENT,        "Conexant_CX24109"},
+	{ TUNER_ABSENT,        "TCL M2523_5N_E"},
+	{ TUNER_ABSENT,        "TCL M2523_3DB_E"},
+	{ TUNER_ABSENT,        "Philips 8275A"},
+	{ TUNER_ABSENT,        "Microtune MT2060"},
+	{ TUNER_ABSENT,        "Philips FM1236 MK5"},
+	{ TUNER_ABSENT,        "Philips FM1216ME MK5"},
+	{ TUNER_ABSENT,        "TCL M2523_3DI_E"},
+	{ TUNER_ABSENT,        "Samsung THPD5222FG30A"},
+	/* 120-129 */
+	{ TUNER_ABSENT,        "Xceive XC3028"},
+	{ TUNER_ABSENT,        "Philips FQ1216LME MK5"},
 };
 
 static struct HAUPPAUGE_AUDIOIC
@@ -369,9 +383,13 @@
 	done = len = beenhere = 0;
 
 	/* Hack for processing eeprom for em28xx */
-	if ((eeprom_data[0]==0x1a)&&(eeprom_data[1]==0xeb)&&
-				(eeprom_data[2]==0x67)&&(eeprom_data[3]==0x95))
+	if ((eeprom_data[0] == 0x1a) && (eeprom_data[1] == 0xeb) &&
+		(eeprom_data[2] == 0x67) && (eeprom_data[3] == 0x95))
 		start=0xa0;
+	else if ((eeprom_data[0] == 0x1f) && (eeprom_data[8] == 0x84))
+		start=8;
+	else if ((eeprom_data[0] == 0x17) && (eeprom_data[8] == 0x84))
+		start=8;
 	else
 		start=0;
 
@@ -448,6 +466,17 @@
 				eeprom_data[i+5] +
 				(eeprom_data[i+6] << 8) +
 				(eeprom_data[i+7] << 16);
+
+				if ( (eeprom_data[i + 8] && 0xf0) &&
+					(tvee->serial_number < 0xffffff) ) {
+					tvee->MAC_address[0] = 0x00;
+					tvee->MAC_address[1] = 0x0D;
+					tvee->MAC_address[2] = 0xFE;
+					tvee->MAC_address[3] = eeprom_data[i + 7];
+					tvee->MAC_address[4] = eeprom_data[i + 6];
+					tvee->MAC_address[5] = eeprom_data[i + 5];
+					tvee->has_MAC_address = 1;
+				}
 			break;
 
 		case 0x05:
@@ -466,11 +495,14 @@
 		case 0x06:
 			/* tag 'ModelRev' */
 			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);
+				eeprom_data[i + 1] +
+				(eeprom_data[i + 2] << 8) +
+				(eeprom_data[i + 3] << 16) +
+				(eeprom_data[i + 4] << 24);
+			tvee->revision =
+				eeprom_data[i +5 ] +
+				(eeprom_data[i + 6] << 8) +
+				(eeprom_data[i + 7] << 16);
 			break;
 
 		case 0x07:
@@ -578,6 +610,12 @@
 
 	tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n",
 		tvee->model, tvee->rev_str, tvee->serial_number);
+	if (tvee->has_MAC_address == 1) {
+		tveeprom_info("MAC address is %02X-%02X-%02X-%02X-%02X-%02X\n",
+			tvee->MAC_address[0], tvee->MAC_address[1],
+			tvee->MAC_address[2], tvee->MAC_address[3],
+			tvee->MAC_address[4], tvee->MAC_address[5]);
+	}
 	tveeprom_info("tuner model is %s (idx %d, type %d)\n",
 		t_name1, tuner1, tvee->tuner_type);
 	tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",