aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tveeprom.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/tveeprom.c')
-rw-r--r--drivers/media/video/tveeprom.c432
1 files changed, 247 insertions, 185 deletions
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 6453b71f2997..a9bad89b4d69 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -40,6 +40,7 @@
40 40
41#include <media/tuner.h> 41#include <media/tuner.h>
42#include <media/tveeprom.h> 42#include <media/tveeprom.h>
43#include "audiochip.h"
43 44
44MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver"); 45MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver");
45MODULE_AUTHOR("John Klar"); 46MODULE_AUTHOR("John Klar");
@@ -134,8 +135,8 @@ hauppauge_tuner[] =
134 { TUNER_TEMIC_4039FR5_NTSC, "Temic 4039FR5" }, 135 { TUNER_TEMIC_4039FR5_NTSC, "Temic 4039FR5" },
135 { TUNER_PHILIPS_FQ1216ME, "Philips FQ1216 ME" }, 136 { TUNER_PHILIPS_FQ1216ME, "Philips FQ1216 ME" },
136 { TUNER_TEMIC_4066FY5_PAL_I, "Temic 4066FY5" }, 137 { TUNER_TEMIC_4066FY5_PAL_I, "Temic 4066FY5" },
137 { TUNER_PHILIPS_NTSC, "Philips TD1536" }, 138 { TUNER_PHILIPS_NTSC, "Philips TD1536" },
138 { TUNER_PHILIPS_NTSC, "Philips TD1536D" }, 139 { TUNER_PHILIPS_NTSC, "Philips TD1536D" },
139 { TUNER_PHILIPS_NTSC, "Philips FMR1236" }, /* mono radio */ 140 { TUNER_PHILIPS_NTSC, "Philips FMR1236" }, /* mono radio */
140 { TUNER_ABSENT, "Philips FI1256MP" }, 141 { TUNER_ABSENT, "Philips FI1256MP" },
141 /* 40-49 */ 142 /* 40-49 */
@@ -189,7 +190,7 @@ hauppauge_tuner[] =
189 { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MB 3"}, 190 { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MB 3"},
190 { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"}, 191 { TUNER_LG_PAL_NEW_TAPC, "TCL 2002MI 3"},
191 { TUNER_TCL_2002N, "TCL 2002N 6A"}, 192 { TUNER_TCL_2002N, "TCL 2002N 6A"},
192 { TUNER_ABSENT, "Philips FQ1236 MK3"}, 193 { TUNER_PHILIPS_FM1236_MK3, "Philips FQ1236 MK3"},
193 { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, 194 { TUNER_ABSENT, "Samsung TCPN 2121P30A"},
194 { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, 195 { TUNER_ABSENT, "Samsung TCPE 4121P30A"},
195 { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"}, 196 { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"},
@@ -202,93 +203,129 @@ hauppauge_tuner[] =
202 { TUNER_ABSENT, "Philips FQ1236 MK5"}, 203 { TUNER_ABSENT, "Philips FQ1236 MK5"},
203 { TUNER_ABSENT, "Samsung TCPG_6121P30A"}, 204 { TUNER_ABSENT, "Samsung TCPG_6121P30A"},
204 { TUNER_TCL_2002MB, "TCL 2002MB_3H"}, 205 { TUNER_TCL_2002MB, "TCL 2002MB_3H"},
205 { TUNER_ABSENT, "TCL 2002MI_3H"}, 206 { TUNER_ABSENT, "TCL 2002MI_3H"},
206 { TUNER_TCL_2002N, "TCL 2002N 5H"}, 207 { TUNER_TCL_2002N, "TCL 2002N 5H"},
207 /* 100-109 */ 208 /* 100-109 */
208 { TUNER_ABSENT, "Philips FMD1216ME"}, 209 { TUNER_ABSENT, "Philips FMD1216ME"},
209 { TUNER_TEA5767, "Philips TEA5768HL FM Radio"}, 210 { TUNER_TEA5767, "Philips TEA5768HL FM Radio"},
210 { TUNER_ABSENT, "Panasonic ENV57H12D5"}, 211 { TUNER_ABSENT, "Panasonic ENV57H12D5"},
211 { TUNER_ABSENT, "TCL MFNM05-4"}, 212 { TUNER_ABSENT, "TCL MFNM05-4"},
212 { TUNER_ABSENT, "TCL MNM05-4"}, 213 { TUNER_ABSENT, "TCL MNM05-4"},
213 { TUNER_PHILIPS_FM1216ME_MK3, "TCL MPE05-2"}, 214 { TUNER_PHILIPS_FM1216ME_MK3, "TCL MPE05-2"},
214 { TUNER_ABSENT, "TCL MQNM05-4"}, 215 { TUNER_ABSENT, "TCL MQNM05-4"},
215 { TUNER_ABSENT, "LG TAPC-W701D"}, 216 { TUNER_ABSENT, "LG TAPC-W701D"},
216 { TUNER_ABSENT, "TCL 9886P-WM"}, 217 { TUNER_ABSENT, "TCL 9886P-WM"},
217 { TUNER_ABSENT, "TCL 1676NM-WM"}, 218 { TUNER_ABSENT, "TCL 1676NM-WM"},
218}; 219};
219 220
220/* This list is supplied by Hauppauge. Thanks! */ 221static struct HAUPPAUGE_AUDIOIC
221static const char *audioIC[] = { 222{
222 /* 0-4 */ 223 enum audiochip id;
223 "None", "TEA6300", "TEA6320", "TDA9850", "MSP3400C", 224 char *name;
224 /* 5-9 */ 225}
225 "MSP3410D", "MSP3415", "MSP3430", "MSP3438", "CS5331", 226audioIC[] =
226 /* 10-14 */ 227{
227 "MSP3435", "MSP3440", "MSP3445", "MSP3411", "MSP3416", 228 /* 0-4 */
228 /* 15-19 */ 229 {AUDIO_CHIP_NONE, "None"},
229 "MSP3425", "MSP3451", "MSP3418", "Type 0x12", "OKI7716", 230 {AUDIO_CHIP_TEA6300, "TEA6300"},
230 /* 20-24 */ 231 {AUDIO_CHIP_TEA6300, "TEA6320"},
231 "MSP4410", "MSP4420", "MSP4440", "MSP4450", "MSP4408", 232 {AUDIO_CHIP_TDA985X, "TDA9850"},
232 /* 25-29 */ 233 {AUDIO_CHIP_MSP34XX, "MSP3400C"},
233 "MSP4418", "MSP4428", "MSP4448", "MSP4458", "Type 0x1d", 234 /* 5-9 */
234 /* 30-34 */ 235 {AUDIO_CHIP_MSP34XX, "MSP3410D"},
235 "CX880", "CX881", "CX883", "CX882", "CX25840", 236 {AUDIO_CHIP_MSP34XX, "MSP3415"},
236 /* 35-38 */ 237 {AUDIO_CHIP_MSP34XX, "MSP3430"},
237 "CX25841", "CX25842", "CX25843", "CX23418", 238 {AUDIO_CHIP_UNKNOWN, "MSP3438"},
239 {AUDIO_CHIP_UNKNOWN, "CS5331"},
240 /* 10-14 */
241 {AUDIO_CHIP_MSP34XX, "MSP3435"},
242 {AUDIO_CHIP_MSP34XX, "MSP3440"},
243 {AUDIO_CHIP_MSP34XX, "MSP3445"},
244 {AUDIO_CHIP_UNKNOWN, "MSP3411"},
245 {AUDIO_CHIP_UNKNOWN, "MSP3416"},
246 /* 15-19 */
247 {AUDIO_CHIP_MSP34XX, "MSP3425"},
248 {AUDIO_CHIP_UNKNOWN, "MSP3451"},
249 {AUDIO_CHIP_UNKNOWN, "MSP3418"},
250 {AUDIO_CHIP_UNKNOWN, "Type 0x12"},
251 {AUDIO_CHIP_UNKNOWN, "OKI7716"},
252 /* 20-24 */
253 {AUDIO_CHIP_UNKNOWN, "MSP4410"},
254 {AUDIO_CHIP_UNKNOWN, "MSP4420"},
255 {AUDIO_CHIP_UNKNOWN, "MSP4440"},
256 {AUDIO_CHIP_UNKNOWN, "MSP4450"},
257 {AUDIO_CHIP_UNKNOWN, "MSP4408"},
258 /* 25-29 */
259 {AUDIO_CHIP_UNKNOWN, "MSP4418"},
260 {AUDIO_CHIP_UNKNOWN, "MSP4428"},
261 {AUDIO_CHIP_UNKNOWN, "MSP4448"},
262 {AUDIO_CHIP_UNKNOWN, "MSP4458"},
263 {AUDIO_CHIP_UNKNOWN, "Type 0x1d"},
264 /* 30-34 */
265 {AUDIO_CHIP_INTERNAL, "CX880"},
266 {AUDIO_CHIP_INTERNAL, "CX881"},
267 {AUDIO_CHIP_INTERNAL, "CX883"},
268 {AUDIO_CHIP_INTERNAL, "CX882"},
269 {AUDIO_CHIP_INTERNAL, "CX25840"},
270 /* 35-38 */
271 {AUDIO_CHIP_INTERNAL, "CX25841"},
272 {AUDIO_CHIP_INTERNAL, "CX25842"},
273 {AUDIO_CHIP_INTERNAL, "CX25843"},
274 {AUDIO_CHIP_INTERNAL, "CX23418"},
238}; 275};
239 276
240/* This list is supplied by Hauppauge. Thanks! */ 277/* This list is supplied by Hauppauge. Thanks! */
241static const char *decoderIC[] = { 278static const char *decoderIC[] = {
242 /* 0-4 */ 279 /* 0-4 */
243 "None", "BT815", "BT817", "BT819", "BT815A", 280 "None", "BT815", "BT817", "BT819", "BT815A",
244 /* 5-9 */ 281 /* 5-9 */
245 "BT817A", "BT819A", "BT827", "BT829", "BT848", 282 "BT817A", "BT819A", "BT827", "BT829", "BT848",
246 /* 10-14 */ 283 /* 10-14 */
247 "BT848A", "BT849A", "BT829A", "BT827A", "BT878", 284 "BT848A", "BT849A", "BT829A", "BT827A", "BT878",
248 /* 15-19 */ 285 /* 15-19 */
249 "BT879", "BT880", "VPX3226E", "SAA7114", "SAA7115", 286 "BT879", "BT880", "VPX3226E", "SAA7114", "SAA7115",
250 /* 20-24 */ 287 /* 20-24 */
251 "CX880", "CX881", "CX883", "SAA7111", "SAA7113", 288 "CX880", "CX881", "CX883", "SAA7111", "SAA7113",
252 /* 25-29 */ 289 /* 25-29 */
253 "CX882", "TVP5150A", "CX25840", "CX25841", "CX25842", 290 "CX882", "TVP5150A", "CX25840", "CX25841", "CX25842",
254 /* 30-31 */ 291 /* 30-31 */
255 "CX25843", "CX23418", 292 "CX25843", "CX23418",
256}; 293};
257 294
258static int hasRadioTuner(int tunerType) 295static int hasRadioTuner(int tunerType)
259{ 296{
260 switch (tunerType) { 297 switch (tunerType) {
261 case 18: //PNPEnv_TUNER_FR1236_MK2: 298 case 18: //PNPEnv_TUNER_FR1236_MK2:
262 case 23: //PNPEnv_TUNER_FM1236: 299 case 23: //PNPEnv_TUNER_FM1236:
263 case 38: //PNPEnv_TUNER_FMR1236: 300 case 38: //PNPEnv_TUNER_FMR1236:
264 case 16: //PNPEnv_TUNER_FR1216_MK2: 301 case 16: //PNPEnv_TUNER_FR1216_MK2:
265 case 19: //PNPEnv_TUNER_FR1246_MK2: 302 case 19: //PNPEnv_TUNER_FR1246_MK2:
266 case 21: //PNPEnv_TUNER_FM1216: 303 case 21: //PNPEnv_TUNER_FM1216:
267 case 24: //PNPEnv_TUNER_FM1246: 304 case 24: //PNPEnv_TUNER_FM1246:
268 case 17: //PNPEnv_TUNER_FR1216MF_MK2: 305 case 17: //PNPEnv_TUNER_FR1216MF_MK2:
269 case 22: //PNPEnv_TUNER_FM1216MF: 306 case 22: //PNPEnv_TUNER_FM1216MF:
270 case 20: //PNPEnv_TUNER_FR1256_MK2: 307 case 20: //PNPEnv_TUNER_FR1256_MK2:
271 case 25: //PNPEnv_TUNER_FM1256: 308 case 25: //PNPEnv_TUNER_FM1256:
272 case 33: //PNPEnv_TUNER_4039FR5: 309 case 33: //PNPEnv_TUNER_4039FR5:
273 case 42: //PNPEnv_TUNER_4009FR5: 310 case 42: //PNPEnv_TUNER_4009FR5:
274 case 52: //PNPEnv_TUNER_4049FM5: 311 case 52: //PNPEnv_TUNER_4049FM5:
275 case 54: //PNPEnv_TUNER_4049FM5_AltI2C: 312 case 54: //PNPEnv_TUNER_4049FM5_AltI2C:
276 case 44: //PNPEnv_TUNER_4009FN5: 313 case 44: //PNPEnv_TUNER_4009FN5:
277 case 31: //PNPEnv_TUNER_TCPB9085P: 314 case 31: //PNPEnv_TUNER_TCPB9085P:
278 case 30: //PNPEnv_TUNER_TCPN9085D: 315 case 30: //PNPEnv_TUNER_TCPN9085D:
279 case 46: //PNPEnv_TUNER_TP18NSR01F: 316 case 46: //PNPEnv_TUNER_TP18NSR01F:
280 case 47: //PNPEnv_TUNER_TP18PSB01D: 317 case 47: //PNPEnv_TUNER_TP18PSB01D:
281 case 49: //PNPEnv_TUNER_TAPC_I001D: 318 case 49: //PNPEnv_TUNER_TAPC_I001D:
282 case 60: //PNPEnv_TUNER_TAPE_S001D_MK3: 319 case 60: //PNPEnv_TUNER_TAPE_S001D_MK3:
283 case 57: //PNPEnv_TUNER_FM1216ME_MK3: 320 case 57: //PNPEnv_TUNER_FM1216ME_MK3:
284 case 59: //PNPEnv_TUNER_FM1216MP_MK3: 321 case 59: //PNPEnv_TUNER_FM1216MP_MK3:
285 case 58: //PNPEnv_TUNER_FM1236_MK3: 322 case 58: //PNPEnv_TUNER_FM1236_MK3:
286 case 68: //PNPEnv_TUNER_TAPE_H001F_MK3: 323 case 68: //PNPEnv_TUNER_TAPE_H001F_MK3:
287 case 61: //PNPEnv_TUNER_TAPE_M001D_MK3: 324 case 61: //PNPEnv_TUNER_TAPE_M001D_MK3:
288 case 78: //PNPEnv_TUNER_TDA8275C1_8290_FM: 325 case 78: //PNPEnv_TUNER_TDA8275C1_8290_FM:
289 case 89: //PNPEnv_TUNER_TCL_MFPE05_2: 326 case 89: //PNPEnv_TUNER_TCL_MFPE05_2:
290 case 92: //PNPEnv_TUNER_PHILIPS_FQ1236A_MK4: 327 case 92: //PNPEnv_TUNER_PHILIPS_FQ1236A_MK4:
291 return 1; 328 return 1;
292 } 329 }
293 return 0; 330 return 0;
294} 331}
@@ -318,19 +355,27 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
318 ** # of inputs/outputs ??? 355 ** # of inputs/outputs ???
319 */ 356 */
320 357
321 int i, j, len, done, beenhere, tag; 358 int i, j, len, done, beenhere, tag,start;
322 359
323 int tuner1 = 0, t_format1 = 0; 360 int tuner1 = 0, t_format1 = 0, audioic=-1;
324 char *t_name1 = NULL; 361 char *t_name1 = NULL;
325 const char *t_fmt_name1[8] = { " none", "", "", "", "", "", "", "" }; 362 const char *t_fmt_name1[8] = { " none", "", "", "", "", "", "", "" };
326 363
327 int tuner2 = 0, t_format2 = 0; 364 int tuner2 = 0, t_format2 = 0;
328 char *t_name2 = NULL; 365 char *t_name2 = NULL;
329 const char *t_fmt_name2[8] = { " none", "", "", "", "", "", "", "" }; 366 const char *t_fmt_name2[8] = { " none", "", "", "", "", "", "", "" };
330 367
331 memset(tvee, 0, sizeof(*tvee)); 368 memset(tvee, 0, sizeof(*tvee));
332 done = len = beenhere = 0; 369 done = len = beenhere = 0;
333 for (i = 0; !done && i < 256; i += len) { 370
371 /* Hack for processing eeprom for em28xx */
372 if ((eeprom_data[0]==0x1a)&&(eeprom_data[1]==0xeb)&&
373 (eeprom_data[2]==0x67)&&(eeprom_data[3]==0x95))
374 start=0xa0;
375 else
376 start=0;
377
378 for (i = start; !done && i < 256; i += len) {
334 if (eeprom_data[i] == 0x84) { 379 if (eeprom_data[i] == 0x84) {
335 len = eeprom_data[i + 1] + (eeprom_data[i + 2] << 8); 380 len = eeprom_data[i + 1] + (eeprom_data[i + 2] << 8);
336 i += 3; 381 i += 3;
@@ -344,28 +389,28 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
344 ++i; 389 ++i;
345 } else { 390 } else {
346 tveeprom_warn("Encountered bad packet header [%02x]. " 391 tveeprom_warn("Encountered bad packet header [%02x]. "
347 "Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]); 392 "Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]);
348 return; 393 return;
349 } 394 }
350 395
351 if (debug) { 396 if (debug) {
352 tveeprom_info("Tag [%02x] + %d bytes:", eeprom_data[i], len - 1); 397 tveeprom_info("Tag [%02x] + %d bytes:", eeprom_data[i], len - 1);
353 for(j = 1; j < len; j++) { 398 for(j = 1; j < len; j++) {
354 printk(" %02x", eeprom_data[i + j]); 399 printk(" %02x", eeprom_data[i + j]);
355 } 400 }
356 printk("\n"); 401 printk("\n");
357 } 402 }
358 403
359 /* process by tag */ 404 /* process by tag */
360 tag = eeprom_data[i]; 405 tag = eeprom_data[i];
361 switch (tag) { 406 switch (tag) {
362 case 0x00: 407 case 0x00:
363 /* tag: 'Comprehensive' */ 408 /* tag: 'Comprehensive' */
364 tuner1 = eeprom_data[i+6]; 409 tuner1 = eeprom_data[i+6];
365 t_format1 = eeprom_data[i+5]; 410 t_format1 = eeprom_data[i+5];
366 tvee->has_radio = eeprom_data[i+len-1]; 411 tvee->has_radio = eeprom_data[i+len-1];
367 /* old style tag, don't know how to detect 412 /* old style tag, don't know how to detect
368 IR presence, mark as unknown. */ 413 IR presence, mark as unknown. */
369 tvee->has_ir = 2; 414 tvee->has_ir = 2;
370 tvee->model = 415 tvee->model =
371 eeprom_data[i+8] + 416 eeprom_data[i+8] +
@@ -376,7 +421,7 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
376 break; 421 break;
377 422
378 case 0x01: 423 case 0x01:
379 /* tag: 'SerialID' */ 424 /* tag: 'SerialID' */
380 tvee->serial_number = 425 tvee->serial_number =
381 eeprom_data[i+6] + 426 eeprom_data[i+6] +
382 (eeprom_data[i+7] << 8) + 427 (eeprom_data[i+7] << 8) +
@@ -384,17 +429,21 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
384 break; 429 break;
385 430
386 case 0x02: 431 case 0x02:
387 /* tag 'AudioInfo' 432 /* tag 'AudioInfo'
388 Note mask with 0x7F, high bit used on some older models 433 Note mask with 0x7F, high bit used on some older models
389 to indicate 4052 mux was removed in favor of using MSP 434 to indicate 4052 mux was removed in favor of using MSP
390 inputs directly. */ 435 inputs directly. */
391 tvee->audio_processor = eeprom_data[i+2] & 0x7f; 436 audioic = eeprom_data[i+2] & 0x7f;
437 if (audioic < sizeof(audioIC)/sizeof(*audioIC))
438 tvee->audio_processor = audioIC[audioic].id;
439 else
440 tvee->audio_processor = AUDIO_CHIP_UNKNOWN;
392 break; 441 break;
393 442
394 /* case 0x03: tag 'EEInfo' */ 443 /* case 0x03: tag 'EEInfo' */
395 444
396 case 0x04: 445 case 0x04:
397 /* tag 'SerialID2' */ 446 /* tag 'SerialID2' */
398 tvee->serial_number = 447 tvee->serial_number =
399 eeprom_data[i+5] + 448 eeprom_data[i+5] +
400 (eeprom_data[i+6] << 8) + 449 (eeprom_data[i+6] << 8) +
@@ -402,15 +451,20 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
402 break; 451 break;
403 452
404 case 0x05: 453 case 0x05:
405 /* tag 'Audio2' 454 /* tag 'Audio2'
406 Note mask with 0x7F, high bit used on some older models 455 Note mask with 0x7F, high bit used on some older models
407 to indicate 4052 mux was removed in favor of using MSP 456 to indicate 4052 mux was removed in favor of using MSP
408 inputs directly. */ 457 inputs directly. */
409 tvee->audio_processor = eeprom_data[i+1] & 0x7f; 458 audioic = eeprom_data[i+1] & 0x7f;
459 if (audioic < sizeof(audioIC)/sizeof(*audioIC))
460 tvee->audio_processor = audioIC[audioic].id;
461 else
462 tvee->audio_processor = AUDIO_CHIP_UNKNOWN;
463
410 break; 464 break;
411 465
412 case 0x06: 466 case 0x06:
413 /* tag 'ModelRev' */ 467 /* tag 'ModelRev' */
414 tvee->model = 468 tvee->model =
415 eeprom_data[i+1] + 469 eeprom_data[i+1] +
416 (eeprom_data[i+2] << 8); 470 (eeprom_data[i+2] << 8);
@@ -420,55 +474,55 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
420 break; 474 break;
421 475
422 case 0x07: 476 case 0x07:
423 /* tag 'Details': according to Hauppauge not interesting 477 /* tag 'Details': according to Hauppauge not interesting
424 on any PCI-era or later boards. */ 478 on any PCI-era or later boards. */
425 break; 479 break;
426 480
427 /* there is no tag 0x08 defined */ 481 /* there is no tag 0x08 defined */
428 482
429 case 0x09: 483 case 0x09:
430 /* tag 'Video' */ 484 /* tag 'Video' */
431 tvee->decoder_processor = eeprom_data[i + 1]; 485 tvee->decoder_processor = eeprom_data[i + 1];
432 break; 486 break;
433 487
434 case 0x0a: 488 case 0x0a:
435 /* tag 'Tuner' */ 489 /* tag 'Tuner' */
436 if (beenhere == 0) { 490 if (beenhere == 0) {
437 tuner1 = eeprom_data[i+2]; 491 tuner1 = eeprom_data[i+2];
438 t_format1 = eeprom_data[i+1]; 492 t_format1 = eeprom_data[i+1];
439 beenhere = 1; 493 beenhere = 1;
440 } else { 494 } else {
441 /* a second (radio) tuner may be present */ 495 /* a second (radio) tuner may be present */
442 tuner2 = eeprom_data[i+2]; 496 tuner2 = eeprom_data[i+2];
443 t_format2 = eeprom_data[i+1]; 497 t_format2 = eeprom_data[i+1];
444 if (t_format2 == 0) { /* not a TV tuner? */ 498 if (t_format2 == 0) { /* not a TV tuner? */
445 tvee->has_radio = 1; /* must be radio */ 499 tvee->has_radio = 1; /* must be radio */
446 } 500 }
447 } 501 }
448 break; 502 break;
449 503
450 case 0x0b: 504 case 0x0b:
451 /* tag 'Inputs': according to Hauppauge this is specific 505 /* tag 'Inputs': according to Hauppauge this is specific
452 to each driver family, so no good assumptions can be 506 to each driver family, so no good assumptions can be
453 made. */ 507 made. */
454 break; 508 break;
455 509
456 /* case 0x0c: tag 'Balun' */ 510 /* case 0x0c: tag 'Balun' */
457 /* case 0x0d: tag 'Teletext' */ 511 /* case 0x0d: tag 'Teletext' */
458 512
459 case 0x0e: 513 case 0x0e:
460 /* tag: 'Radio' */ 514 /* tag: 'Radio' */
461 tvee->has_radio = eeprom_data[i+1]; 515 tvee->has_radio = eeprom_data[i+1];
462 break; 516 break;
463 517
464 case 0x0f: 518 case 0x0f:
465 /* tag 'IRInfo' */ 519 /* tag 'IRInfo' */
466 tvee->has_ir = eeprom_data[i+1]; 520 tvee->has_ir = eeprom_data[i+1];
467 break; 521 break;
468 522
469 /* case 0x10: tag 'VBIInfo' */ 523 /* case 0x10: tag 'VBIInfo' */
470 /* case 0x11: tag 'QCInfo' */ 524 /* case 0x11: tag 'QCInfo' */
471 /* case 0x12: tag 'InfoBits' */ 525 /* case 0x12: tag 'InfoBits' */
472 526
473 default: 527 default:
474 tveeprom_dbg("Not sure what to do with tag [%02x]\n", tag); 528 tveeprom_dbg("Not sure what to do with tag [%02x]\n", tag);
@@ -489,11 +543,11 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
489 tvee->rev_str[4] = 0; 543 tvee->rev_str[4] = 0;
490 } 544 }
491 545
492 if (hasRadioTuner(tuner1) && !tvee->has_radio) { 546 if (hasRadioTuner(tuner1) && !tvee->has_radio) {
493 tveeprom_info("The eeprom says no radio is present, but the tuner type\n"); 547 tveeprom_info("The eeprom says no radio is present, but the tuner type\n");
494 tveeprom_info("indicates otherwise. I will assume that radio is present.\n"); 548 tveeprom_info("indicates otherwise. I will assume that radio is present.\n");
495 tvee->has_radio = 1; 549 tvee->has_radio = 1;
496 } 550 }
497 551
498 if (tuner1 < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) { 552 if (tuner1 < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) {
499 tvee->tuner_type = hauppauge_tuner[tuner1].id; 553 tvee->tuner_type = hauppauge_tuner[tuner1].id;
@@ -516,45 +570,53 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
516 tvee->tuner_formats |= hauppauge_tuner_fmt[i].id; 570 tvee->tuner_formats |= hauppauge_tuner_fmt[i].id;
517 t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name; 571 t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name;
518 } 572 }
519 if (t_format2 & (1 << i)) { 573 if (t_format2 & (1 << i)) {
520 tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id; 574 tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id;
521 t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name; 575 t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name;
522 } 576 }
523 } 577 }
524 578
525 tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n", 579 tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n",
526 tvee->model, tvee->rev_str, tvee->serial_number); 580 tvee->model, tvee->rev_str, tvee->serial_number);
527 tveeprom_info("tuner model is %s (idx %d, type %d)\n", 581 tveeprom_info("tuner model is %s (idx %d, type %d)\n",
528 t_name1, tuner1, tvee->tuner_type); 582 t_name1, tuner1, tvee->tuner_type);
529 tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", 583 tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
530 t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2], t_fmt_name1[3], 584 t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2], t_fmt_name1[3],
531 t_fmt_name1[4], t_fmt_name1[5], t_fmt_name1[6], t_fmt_name1[7], 585 t_fmt_name1[4], t_fmt_name1[5], t_fmt_name1[6], t_fmt_name1[7],
532 t_format1); 586 t_format1);
533 if (tuner2) { 587 if (tuner2) {
534 tveeprom_info("second tuner model is %s (idx %d, type %d)\n", 588 tveeprom_info("second tuner model is %s (idx %d, type %d)\n",
535 t_name2, tuner2, tvee->tuner2_type); 589 t_name2, tuner2, tvee->tuner2_type);
536 } 590 }
537 if (t_format2) { 591 if (t_format2) {
538 tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n", 592 tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
539 t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2], t_fmt_name2[3], 593 t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2], t_fmt_name2[3],
540 t_fmt_name2[4], t_fmt_name2[5], t_fmt_name2[6], t_fmt_name2[7], 594 t_fmt_name2[4], t_fmt_name2[5], t_fmt_name2[6], t_fmt_name2[7],
541 t_format2); 595 t_format2);
542 } 596 }
543 tveeprom_info("audio processor is %s (idx %d)\n", 597 if (audioic<0) {
544 STRM(audioIC, tvee->audio_processor), 598 tveeprom_info("audio processor is unknown (no idx)\n");
545 tvee->audio_processor); 599 tvee->audio_processor=AUDIO_CHIP_UNKNOWN;
546 if (tvee->decoder_processor) { 600 } else {
547 tveeprom_info("decoder processor is %s (idx %d)\n", 601 if (audioic < sizeof(audioIC)/sizeof(*audioIC))
548 STRM(decoderIC, tvee->decoder_processor), 602 tveeprom_info("audio processor is %s (idx %d)\n",
549 tvee->decoder_processor); 603 audioIC[audioic].name,audioic);
550 } 604 else
551 if (tvee->has_ir == 2) 605 tveeprom_info("audio processor is unknown (idx %d)\n",
552 tveeprom_info("has %sradio\n", 606 audioic);
553 tvee->has_radio ? "" : "no "); 607 }
554 else 608 if (tvee->decoder_processor) {
555 tveeprom_info("has %sradio, has %sIR remote\n", 609 tveeprom_info("decoder processor is %s (idx %d)\n",
556 tvee->has_radio ? "" : "no ", 610 STRM(decoderIC, tvee->decoder_processor),
557 tvee->has_ir ? "" : "no "); 611 tvee->decoder_processor);
612 }
613 if (tvee->has_ir == 2)
614 tveeprom_info("has %sradio\n",
615 tvee->has_radio ? "" : "no ");
616 else
617 tveeprom_info("has %sradio, has %sIR remote\n",
618 tvee->has_radio ? "" : "no ",
619 tvee->has_ir ? "" : "no ");
558} 620}
559EXPORT_SYMBOL(tveeprom_hauppauge_analog); 621EXPORT_SYMBOL(tveeprom_hauppauge_analog);
560 622
@@ -575,18 +637,18 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
575 tveeprom_warn("i2c eeprom read error (err=%d)\n", err); 637 tveeprom_warn("i2c eeprom read error (err=%d)\n", err);
576 return -1; 638 return -1;
577 } 639 }
578 if (debug) { 640 if (debug) {
579 int i; 641 int i;
580 642
581 tveeprom_info("full 256-byte eeprom dump:\n"); 643 tveeprom_info("full 256-byte eeprom dump:\n");
582 for (i = 0; i < len; i++) { 644 for (i = 0; i < len; i++) {
583 if (0 == (i % 16)) 645 if (0 == (i % 16))
584 tveeprom_info("%02x:", i); 646 tveeprom_info("%02x:", i);
585 printk(" %02x", eedata[i]); 647 printk(" %02x", eedata[i]);
586 if (15 == (i % 16)) 648 if (15 == (i % 16))
587 printk("\n"); 649 printk("\n");
588 } 650 }
589 } 651 }
590 return 0; 652 return 0;
591} 653}
592EXPORT_SYMBOL(tveeprom_read); 654EXPORT_SYMBOL(tveeprom_read);