diff options
author | Steven Toth <stoth@hauppauge.com> | 2005-12-01 03:51:27 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-12-01 18:48:57 -0500 |
commit | 3ca0ea980697d3b3c3d5c13ba7e525ed6c434756 (patch) | |
tree | db5d423db74e88ce836588bb77ab8ae77649b5f8 /drivers/media | |
parent | 759324c3c4b8d63203d7ea41b56553330bc0df06 (diff) |
[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>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/cx88/cx88-cards.c | 38 | ||||
-rw-r--r-- | drivers/media/video/tveeprom.c | 54 |
2 files changed, 56 insertions, 36 deletions
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 746ccaf40cfa..cf2d2c3a33a6 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -1083,44 +1083,26 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) | |||
1083 | tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data); | 1083 | tveeprom_hauppauge_analog(&core->i2c_client, &tv, eeprom_data); |
1084 | core->tuner_type = tv.tuner_type; | 1084 | core->tuner_type = tv.tuner_type; |
1085 | core->has_radio = tv.has_radio; | 1085 | core->has_radio = tv.has_radio; |
1086 | } | ||
1087 | |||
1088 | /* fixme: This is bogus code... add new pnp code to parse or see tveeprom.ko */ | ||
1089 | static int hauppauge_eeprom_dvb(struct cx88_core *core, u8 *ee) | ||
1090 | { | ||
1091 | int model; | ||
1092 | int tuner; | ||
1093 | 1086 | ||
1094 | /* Make sure we support the board model */ | 1087 | /* Make sure we support the board model */ |
1095 | model = ee[0x1f] << 24 | ee[0x1e] << 16 | ee[0x1d] << 8 | ee[0x1c]; | 1088 | switch (tv.model) |
1096 | switch(model) { | 1089 | { |
1097 | case 90002: /* Nova-T-PCI (9002) */ | 1090 | case 90002: /* Nova-T-PCI (9002) */ |
1098 | case 90500: /* Nova-T-PCI (oem) */ | 1091 | case 90500: /* Nova-T-PCI (oem) */ |
1099 | case 90501: /* Nova-T-PCI (oem/IR) */ | 1092 | case 90501: /* Nova-T-PCI (oem/IR) */ |
1100 | case 92000: /* Nova-S-Plus */ | 1093 | case 92000: /* Nova-SE2 (OEM, No Video or IR) */ |
1101 | case 92002: /* Nova-SE2 */ | 1094 | case 92001: /* Nova-S-Plus (Video and IR) */ |
1095 | case 92002: /* Nova-S-Plus (Video and IR) */ | ||
1102 | /* known */ | 1096 | /* known */ |
1103 | break; | 1097 | break; |
1104 | default: | 1098 | default: |
1105 | printk("%s: warning: unknown hauppauge model #%d\n", | 1099 | printk("%s: warning: unknown hauppauge model #%d\n", |
1106 | core->name, model); | 1100 | core->name, tv.model); |
1107 | break; | 1101 | break; |
1108 | } | 1102 | } |
1109 | 1103 | ||
1110 | /* Make sure we support the tuner */ | 1104 | printk(KERN_INFO "%s: hauppauge eeprom: model=%d\n", |
1111 | tuner = ee[0x2d]; | 1105 | core->name, tv.model); |
1112 | switch(tuner) { | ||
1113 | case 0x4B: /* dtt 7595 */ | ||
1114 | case 0x4C: /* dtt 7592 */ | ||
1115 | break; | ||
1116 | default: | ||
1117 | printk("%s: error: unknown hauppauge tuner 0x%02x\n", | ||
1118 | core->name, tuner); | ||
1119 | return -ENODEV; | ||
1120 | } | ||
1121 | printk(KERN_INFO "%s: hauppauge eeprom: model=%d, tuner=%d\n", | ||
1122 | core->name, model, tuner); | ||
1123 | return 0; | ||
1124 | } | 1106 | } |
1125 | 1107 | ||
1126 | /* ----------------------------------------------------------------------- */ | 1108 | /* ----------------------------------------------------------------------- */ |
@@ -1204,7 +1186,7 @@ void cx88_card_list(struct cx88_core *core, struct pci_dev *pci) | |||
1204 | 1186 | ||
1205 | void cx88_card_setup(struct cx88_core *core) | 1187 | void cx88_card_setup(struct cx88_core *core) |
1206 | { | 1188 | { |
1207 | static u8 eeprom[128]; | 1189 | static u8 eeprom[256]; |
1208 | 1190 | ||
1209 | if (0 == core->i2c_rc) { | 1191 | if (0 == core->i2c_rc) { |
1210 | core->i2c_client.addr = 0xa0 >> 1; | 1192 | core->i2c_client.addr = 0xa0 >> 1; |
@@ -1227,7 +1209,7 @@ void cx88_card_setup(struct cx88_core *core) | |||
1227 | break; | 1209 | break; |
1228 | case CX88_BOARD_HAUPPAUGE_DVB_T1: | 1210 | case CX88_BOARD_HAUPPAUGE_DVB_T1: |
1229 | if (0 == core->i2c_rc) | 1211 | if (0 == core->i2c_rc) |
1230 | hauppauge_eeprom_dvb(core,eeprom); | 1212 | hauppauge_eeprom(core,eeprom); |
1231 | break; | 1213 | break; |
1232 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: | 1214 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: |
1233 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: | 1215 | case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: |
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 72e8741e8b59..d6afd918f324 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -81,7 +81,7 @@ hauppauge_tuner_fmt[] = | |||
81 | { 0x00000010, " PAL(I)" }, | 81 | { 0x00000010, " PAL(I)" }, |
82 | { 0x00400000, " SECAM(L/L')" }, | 82 | { 0x00400000, " SECAM(L/L')" }, |
83 | { 0x00000e00, " PAL(D/K)" }, | 83 | { 0x00000e00, " PAL(D/K)" }, |
84 | { 0x03000000, " ATSC Digital" }, | 84 | { 0x03000000, " ATSC/DVB Digital" }, |
85 | }; | 85 | }; |
86 | 86 | ||
87 | /* This is the full list of possible tuners. Many thanks to Hauppauge for | 87 | /* This is the full list of possible tuners. Many thanks to Hauppauge for |
@@ -216,6 +216,20 @@ hauppauge_tuner[] = | |||
216 | { TUNER_ABSENT, "LG TAPC-W701D"}, | 216 | { TUNER_ABSENT, "LG TAPC-W701D"}, |
217 | { TUNER_ABSENT, "TCL 9886P-WM"}, | 217 | { TUNER_ABSENT, "TCL 9886P-WM"}, |
218 | { TUNER_ABSENT, "TCL 1676NM-WM"}, | 218 | { TUNER_ABSENT, "TCL 1676NM-WM"}, |
219 | /* 110-119 */ | ||
220 | { TUNER_ABSENT, "Thompson DTT75105"}, | ||
221 | { TUNER_ABSENT, "Conexant_CX24109"}, | ||
222 | { TUNER_ABSENT, "TCL M2523_5N_E"}, | ||
223 | { TUNER_ABSENT, "TCL M2523_3DB_E"}, | ||
224 | { TUNER_ABSENT, "Philips 8275A"}, | ||
225 | { TUNER_ABSENT, "Microtune MT2060"}, | ||
226 | { TUNER_ABSENT, "Philips FM1236 MK5"}, | ||
227 | { TUNER_ABSENT, "Philips FM1216ME MK5"}, | ||
228 | { TUNER_ABSENT, "TCL M2523_3DI_E"}, | ||
229 | { TUNER_ABSENT, "Samsung THPD5222FG30A"}, | ||
230 | /* 120-129 */ | ||
231 | { TUNER_ABSENT, "Xceive XC3028"}, | ||
232 | { TUNER_ABSENT, "Philips FQ1216LME MK5"}, | ||
219 | }; | 233 | }; |
220 | 234 | ||
221 | static struct HAUPPAUGE_AUDIOIC | 235 | static struct HAUPPAUGE_AUDIOIC |
@@ -369,9 +383,13 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, | |||
369 | done = len = beenhere = 0; | 383 | done = len = beenhere = 0; |
370 | 384 | ||
371 | /* Hack for processing eeprom for em28xx */ | 385 | /* Hack for processing eeprom for em28xx */ |
372 | if ((eeprom_data[0]==0x1a)&&(eeprom_data[1]==0xeb)&& | 386 | if ((eeprom_data[0] == 0x1a) && (eeprom_data[1] == 0xeb) && |
373 | (eeprom_data[2]==0x67)&&(eeprom_data[3]==0x95)) | 387 | (eeprom_data[2] == 0x67) && (eeprom_data[3] == 0x95)) |
374 | start=0xa0; | 388 | start=0xa0; |
389 | else if ((eeprom_data[0] == 0x1f) && (eeprom_data[8] == 0x84)) | ||
390 | start=8; | ||
391 | else if ((eeprom_data[0] == 0x17) && (eeprom_data[8] == 0x84)) | ||
392 | start=8; | ||
375 | else | 393 | else |
376 | start=0; | 394 | start=0; |
377 | 395 | ||
@@ -448,6 +466,17 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, | |||
448 | eeprom_data[i+5] + | 466 | eeprom_data[i+5] + |
449 | (eeprom_data[i+6] << 8) + | 467 | (eeprom_data[i+6] << 8) + |
450 | (eeprom_data[i+7] << 16); | 468 | (eeprom_data[i+7] << 16); |
469 | |||
470 | if ( (eeprom_data[i + 8] && 0xf0) && | ||
471 | (tvee->serial_number < 0xffffff) ) { | ||
472 | tvee->MAC_address[0] = 0x00; | ||
473 | tvee->MAC_address[1] = 0x0D; | ||
474 | tvee->MAC_address[2] = 0xFE; | ||
475 | tvee->MAC_address[3] = eeprom_data[i + 7]; | ||
476 | tvee->MAC_address[4] = eeprom_data[i + 6]; | ||
477 | tvee->MAC_address[5] = eeprom_data[i + 5]; | ||
478 | tvee->has_MAC_address = 1; | ||
479 | } | ||
451 | break; | 480 | break; |
452 | 481 | ||
453 | case 0x05: | 482 | case 0x05: |
@@ -466,11 +495,14 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, | |||
466 | case 0x06: | 495 | case 0x06: |
467 | /* tag 'ModelRev' */ | 496 | /* tag 'ModelRev' */ |
468 | tvee->model = | 497 | tvee->model = |
469 | eeprom_data[i+1] + | 498 | eeprom_data[i + 1] + |
470 | (eeprom_data[i+2] << 8); | 499 | (eeprom_data[i + 2] << 8) + |
471 | tvee->revision = eeprom_data[i+5] + | 500 | (eeprom_data[i + 3] << 16) + |
472 | (eeprom_data[i+6] << 8) + | 501 | (eeprom_data[i + 4] << 24); |
473 | (eeprom_data[i+7] << 16); | 502 | tvee->revision = |
503 | eeprom_data[i +5 ] + | ||
504 | (eeprom_data[i + 6] << 8) + | ||
505 | (eeprom_data[i + 7] << 16); | ||
474 | break; | 506 | break; |
475 | 507 | ||
476 | case 0x07: | 508 | case 0x07: |
@@ -578,6 +610,12 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee, | |||
578 | 610 | ||
579 | tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n", | 611 | tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n", |
580 | tvee->model, tvee->rev_str, tvee->serial_number); | 612 | tvee->model, tvee->rev_str, tvee->serial_number); |
613 | if (tvee->has_MAC_address == 1) { | ||
614 | tveeprom_info("MAC address is %02X-%02X-%02X-%02X-%02X-%02X\n", | ||
615 | tvee->MAC_address[0], tvee->MAC_address[1], | ||
616 | tvee->MAC_address[2], tvee->MAC_address[3], | ||
617 | tvee->MAC_address[4], tvee->MAC_address[5]); | ||
618 | } | ||
581 | tveeprom_info("tuner model is %s (idx %d, type %d)\n", | 619 | tveeprom_info("tuner model is %s (idx %d, type %d)\n", |
582 | t_name1, tuner1, tvee->tuner_type); | 620 | t_name1, tuner1, tvee->tuner_type); |
583 | tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", | 621 | tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", |