aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tveeprom.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@brturbo.com.br>2005-09-09 16:04:05 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-09-09 16:57:54 -0400
commit0f97a931b337e4662e736ca67f1fab0a187f5852 (patch)
tree974a24348db544ed76e1fea0efda68e0c486f789 /drivers/media/video/tveeprom.c
parent18fc59e230bbda9725736f8f526ef88aab212348 (diff)
[PATCH] v4l: tveeprom improved to support newer Hauppage cards
- tveeprom improved and updated to reflect newer Hauppage cards. - CodingStyle fixes. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> 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/video/tveeprom.c')
-rw-r--r--drivers/media/video/tveeprom.c327
1 files changed, 228 insertions, 99 deletions
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 367401449e3c..5344d5592199 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -47,18 +47,21 @@ MODULE_LICENSE("GPL");
47 47
48static int debug = 0; 48static int debug = 0;
49module_param(debug, int, 0644); 49module_param(debug, int, 0644);
50MODULE_PARM_DESC(debug, "Debug level (0-2)"); 50MODULE_PARM_DESC(debug, "Debug level (0-1)");
51 51
52#define STRM(array,i) (i < sizeof(array)/sizeof(char*) ? array[i] : "unknown") 52#define STRM(array,i) (i < sizeof(array)/sizeof(char*) ? array[i] : "unknown")
53 53
54#define dprintk(num, args...) \ 54#define tveeprom_info(fmt, arg...) do {\
55 do { \ 55 printk(KERN_INFO "tveeprom %d-%04x: " fmt, \
56 if (debug >= num) \ 56 c->adapter->nr, c->addr , ##arg); } while (0)
57 printk(KERN_INFO "tveeprom: " args); \ 57#define tveeprom_warn(fmt, arg...) do {\
58 } while (0) 58 printk(KERN_WARNING "tveeprom %d-%04x: " fmt, \
59 c->adapter->nr, c->addr , ##arg); } while (0)
60#define tveeprom_dbg(fmt, arg...) do {\
61 if (debug) \
62 printk(KERN_INFO "tveeprom %d-%04x: " fmt, \
63 c->adapter->nr, c->addr , ##arg); } while (0)
59 64
60#define TVEEPROM_KERN_ERR(args...) printk(KERN_ERR "tveeprom: " args);
61#define TVEEPROM_KERN_INFO(args...) printk(KERN_INFO "tveeprom: " args);
62 65
63/* ----------------------------------------------------------------------- */ 66/* ----------------------------------------------------------------------- */
64/* some hauppauge specific stuff */ 67/* some hauppauge specific stuff */
@@ -70,14 +73,14 @@ static struct HAUPPAUGE_TUNER_FMT
70} 73}
71hauppauge_tuner_fmt[] = 74hauppauge_tuner_fmt[] =
72{ 75{
73 { 0x00000000, "unknown1" }, 76 { 0x00000000, " unknown1" },
74 { 0x00000000, "unknown2" }, 77 { 0x00000000, " unknown2" },
75 { 0x00000007, "PAL(B/G)" }, 78 { 0x00000007, " PAL(B/G)" },
76 { 0x00001000, "NTSC(M)" }, 79 { 0x00001000, " NTSC(M)" },
77 { 0x00000010, "PAL(I)" }, 80 { 0x00000010, " PAL(I)" },
78 { 0x00400000, "SECAM(L/L´)" }, 81 { 0x00400000, " SECAM(L/L')" },
79 { 0x00000e00, "PAL(D/K)" }, 82 { 0x00000e00, " PAL(D/K)" },
80 { 0x03000000, "ATSC Digital" }, 83 { 0x03000000, " ATSC Digital" },
81}; 84};
82 85
83/* This is the full list of possible tuners. Many thanks to Hauppauge for 86/* This is the full list of possible tuners. Many thanks to Hauppauge for
@@ -203,20 +206,47 @@ hauppauge_tuner[] =
203 { TUNER_TCL_2002N, "TCL 2002N 5H"}, 206 { TUNER_TCL_2002N, "TCL 2002N 5H"},
204 /* 100-103 */ 207 /* 100-103 */
205 { TUNER_ABSENT, "Unspecified"}, 208 { TUNER_ABSENT, "Unspecified"},
206 { TUNER_ABSENT, "Unspecified"}, 209 { TUNER_TEA5767, "Philips TEA5767HN FM Radio"},
207 { TUNER_ABSENT, "Unspecified"}, 210 { TUNER_ABSENT, "Unspecified"},
208 { TUNER_PHILIPS_FM1236_MK3, "TCL MFNM05 4"}, 211 { TUNER_PHILIPS_FM1236_MK3, "TCL MFNM05 4"},
209}; 212};
210 213
211static char *sndtype[] = { 214/* This list is supplied by Hauppauge. Thanks! */
212 "None", "TEA6300", "TEA6320", "TDA9850", "MSP3400C", "MSP3410D", 215static const char *audioIC[] = {
213 "MSP3415", "MSP3430", "MSP3438", "CS5331", "MSP3435", "MSP3440", 216 /* 0-4 */
214 "MSP3445", "MSP3411", "MSP3416", "MSP3425", 217 "None", "TEA6300", "TEA6320", "TDA9850", "MSP3400C",
218 /* 5-9 */
219 "MSP3410D", "MSP3415", "MSP3430", "MSP3438", "CS5331",
220 /* 10-14 */
221 "MSP3435", "MSP3440", "MSP3445", "MSP3411", "MSP3416",
222 /* 15-19 */
223 "MSP3425", "MSP3451", "MSP3418", "Type 0x12", "OKI7716",
224 /* 20-24 */
225 "MSP4410", "MSP4420", "MSP4440", "MSP4450", "MSP4408",
226 /* 25-29 */
227 "MSP4418", "MSP4428", "MSP4448", "MSP4458", "Type 0x1d",
228 /* 30-34 */
229 "CX880", "CX881", "CX883", "CX882", "CX25840",
230 /* 35-38 */
231 "CX25841", "CX25842", "CX25843", "CX23418",
232};
215 233
216 "Type 0x10","Type 0x11","Type 0x12","Type 0x13", 234/* This list is supplied by Hauppauge. Thanks! */
217 "Type 0x14","Type 0x15","Type 0x16","Type 0x17", 235static const char *decoderIC[] = {
218 "Type 0x18","MSP4418","Type 0x1a","MSP4448", 236 /* 0-4 */
219 "Type 0x1c","Type 0x1d","Type 0x1e","Type 0x1f", 237 "None", "BT815", "BT817", "BT819", "BT815A",
238 /* 5-9 */
239 "BT817A", "BT819A", "BT827", "BT829", "BT848",
240 /* 10-14 */
241 "BT848A", "BT849A", "BT829A", "BT827A", "BT878",
242 /* 15-19 */
243 "BT879", "BT880", "VPX3226E", "SAA7114", "SAA7115",
244 /* 20-24 */
245 "CX880", "CX881", "CX883", "SAA7111", "SAA7113",
246 /* 25-29 */
247 "CX882", "TVP5150A", "CX25840", "CX25841", "CX25842",
248 /* 30-31 */
249 "CX25843", "CX23418",
220}; 250};
221 251
222static int hasRadioTuner(int tunerType) 252static int hasRadioTuner(int tunerType)
@@ -257,7 +287,8 @@ static int hasRadioTuner(int tunerType)
257 return 0; 287 return 0;
258} 288}
259 289
260void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data) 290void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
291 unsigned char *eeprom_data)
261{ 292{
262 /* ---------------------------------------------- 293 /* ----------------------------------------------
263 ** The hauppauge eeprom format is tagged 294 ** The hauppauge eeprom format is tagged
@@ -267,10 +298,11 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data
267 ** if packet[0] & f8 == f8, then EOD and packet[1] == checksum 298 ** if packet[0] & f8 == f8, then EOD and packet[1] == checksum
268 ** 299 **
269 ** In our (ivtv) case we're interested in the following: 300 ** In our (ivtv) case we're interested in the following:
270 ** tuner type: tag [00].05 or [0a].01 (index into hauppauge_tuner) 301 ** tuner type: tag [00].05 or [0a].01 (index into hauppauge_tuner)
271 ** tuner fmts: tag [00].04 or [0a].00 (bitmask index into hauppauge_tuner_fmt) 302 ** tuner fmts: tag [00].04 or [0a].00 (bitmask index into hauppauge_tuner_fmt)
272 ** radio: tag [00].{last} or [0e].00 (bitmask. bit2=FM) 303 ** radio: tag [00].{last} or [0e].00 (bitmask. bit2=FM)
273 ** audio proc: tag [02].01 or [05].00 (lower nibble indexes lut?) 304 ** audio proc: tag [02].01 or [05].00 (mask with 0x7f)
305 ** decoder proc: tag [09].01)
274 306
275 ** Fun info: 307 ** Fun info:
276 ** model: tag [00].07-08 or [06].00-01 308 ** model: tag [00].07-08 or [06].00-01
@@ -280,20 +312,24 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data
280 ** # of inputs/outputs ??? 312 ** # of inputs/outputs ???
281 */ 313 */
282 314
283 int i, j, len, done, beenhere, tag, tuner = 0, t_format = 0; 315 int i, j, len, done, beenhere, tag;
284 char *t_name = NULL, *t_fmt_name = NULL;
285 316
286 dprintk(1, "%s\n",__FUNCTION__); 317 int tuner1 = 0, t_format1 = 0;
287 tvee->revision = done = len = beenhere = 0; 318 char *t_name1 = NULL;
288 for (i = 0; !done && i < 256; i += len) { 319 const char *t_fmt_name1[8] = { " none", "", "", "", "", "", "", "" };
289 dprintk(2, "processing pos = %02x (%02x, %02x)\n",
290 i, eeprom_data[i], eeprom_data[i + 1]);
291 320
321 int tuner2 = 0, t_format2 = 0;
322 char *t_name2 = NULL;
323 const char *t_fmt_name2[8] = { " none", "", "", "", "", "", "", "" };
324
325 memset(tvee, 0, sizeof(*tvee));
326 done = len = beenhere = 0;
327 for (i = 0; !done && i < 256; i += len) {
292 if (eeprom_data[i] == 0x84) { 328 if (eeprom_data[i] == 0x84) {
293 len = eeprom_data[i + 1] + (eeprom_data[i + 2] << 8); 329 len = eeprom_data[i + 1] + (eeprom_data[i + 2] << 8);
294 i+=3; 330 i += 3;
295 } else if ((eeprom_data[i] & 0xf0) == 0x70) { 331 } else if ((eeprom_data[i] & 0xf0) == 0x70) {
296 if ((eeprom_data[i] & 0x08)) { 332 if (eeprom_data[i] & 0x08) {
297 /* verify checksum! */ 333 /* verify checksum! */
298 done = 1; 334 done = 1;
299 break; 335 break;
@@ -301,24 +337,30 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data
301 len = eeprom_data[i] & 0x07; 337 len = eeprom_data[i] & 0x07;
302 ++i; 338 ++i;
303 } else { 339 } else {
304 TVEEPROM_KERN_ERR("Encountered bad packet header [%02x]. " 340 tveeprom_warn("Encountered bad packet header [%02x]. "
305 "Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]); 341 "Corrupt or not a Hauppauge eeprom.\n", eeprom_data[i]);
306 return; 342 return;
307 } 343 }
308 344
309 dprintk(1, "%3d [%02x] ", len, eeprom_data[i]); 345 if (debug) {
310 for(j = 1; j < len; j++) { 346 tveeprom_info("Tag [%02x] + %d bytes:", eeprom_data[i], len - 1);
311 dprintk(1, "%02x ", eeprom_data[i + j]); 347 for(j = 1; j < len; j++) {
312 } 348 printk(" %02x", eeprom_data[i + j]);
313 dprintk(1, "\n"); 349 }
350 printk("\n");
351 }
314 352
315 /* process by tag */ 353 /* process by tag */
316 tag = eeprom_data[i]; 354 tag = eeprom_data[i];
317 switch (tag) { 355 switch (tag) {
318 case 0x00: 356 case 0x00:
319 tuner = eeprom_data[i+6]; 357 /* tag: 'Comprehensive' */
320 t_format = eeprom_data[i+5]; 358 tuner1 = eeprom_data[i+6];
359 t_format1 = eeprom_data[i+5];
321 tvee->has_radio = eeprom_data[i+len-1]; 360 tvee->has_radio = eeprom_data[i+len-1];
361 /* old style tag, don't know how to detect
362 IR presence, mark as unknown. */
363 tvee->has_ir = 2;
322 tvee->model = 364 tvee->model =
323 eeprom_data[i+8] + 365 eeprom_data[i+8] +
324 (eeprom_data[i+9] << 8); 366 (eeprom_data[i+9] << 8);
@@ -326,25 +368,43 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data
326 (eeprom_data[i+11] << 8) + 368 (eeprom_data[i+11] << 8) +
327 (eeprom_data[i+12] << 16); 369 (eeprom_data[i+12] << 16);
328 break; 370 break;
371
329 case 0x01: 372 case 0x01:
373 /* tag: 'SerialID' */
330 tvee->serial_number = 374 tvee->serial_number =
331 eeprom_data[i+6] + 375 eeprom_data[i+6] +
332 (eeprom_data[i+7] << 8) + 376 (eeprom_data[i+7] << 8) +
333 (eeprom_data[i+8] << 16); 377 (eeprom_data[i+8] << 16);
334 break; 378 break;
379
335 case 0x02: 380 case 0x02:
336 tvee->audio_processor = eeprom_data[i+2] & 0x0f; 381 /* tag 'AudioInfo'
382 Note mask with 0x7F, high bit used on some older models
383 to indicate 4052 mux was removed in favor of using MSP
384 inputs directly. */
385 tvee->audio_processor = eeprom_data[i+2] & 0x7f;
337 break; 386 break;
387
388 /* case 0x03: tag 'EEInfo' */
389
338 case 0x04: 390 case 0x04:
391 /* tag 'SerialID2' */
339 tvee->serial_number = 392 tvee->serial_number =
340 eeprom_data[i+5] + 393 eeprom_data[i+5] +
341 (eeprom_data[i+6] << 8) + 394 (eeprom_data[i+6] << 8) +
342 (eeprom_data[i+7] << 16); 395 (eeprom_data[i+7] << 16);
343 break; 396 break;
397
344 case 0x05: 398 case 0x05:
345 tvee->audio_processor = eeprom_data[i+1] & 0x0f; 399 /* tag 'Audio2'
400 Note mask with 0x7F, high bit used on some older models
401 to indicate 4052 mux was removed in favor of using MSP
402 inputs directly. */
403 tvee->audio_processor = eeprom_data[i+1] & 0x7f;
346 break; 404 break;
405
347 case 0x06: 406 case 0x06:
407 /* tag 'ModelRev' */
348 tvee->model = 408 tvee->model =
349 eeprom_data[i+1] + 409 eeprom_data[i+1] +
350 (eeprom_data[i+2] << 8); 410 (eeprom_data[i+2] << 8);
@@ -352,27 +412,66 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data
352 (eeprom_data[i+6] << 8) + 412 (eeprom_data[i+6] << 8) +
353 (eeprom_data[i+7] << 16); 413 (eeprom_data[i+7] << 16);
354 break; 414 break;
415
416 case 0x07:
417 /* tag 'Details': according to Hauppauge not interesting
418 on any PCI-era or later boards. */
419 break;
420
421 /* there is no tag 0x08 defined */
422
423 case 0x09:
424 /* tag 'Video' */
425 tvee->decoder_processor = eeprom_data[i + 1];
426 break;
427
355 case 0x0a: 428 case 0x0a:
356 if(beenhere == 0) { 429 /* tag 'Tuner' */
357 tuner = eeprom_data[i+2]; 430 if (beenhere == 0) {
358 t_format = eeprom_data[i+1]; 431 tuner1 = eeprom_data[i+2];
432 t_format1 = eeprom_data[i+1];
359 beenhere = 1; 433 beenhere = 1;
360 break;
361 } else { 434 } else {
362 break; 435 /* a second (radio) tuner may be present */
363 } 436 tuner2 = eeprom_data[i+2];
437 t_format2 = eeprom_data[i+1];
438 if (t_format2 == 0) { /* not a TV tuner? */
439 tvee->has_radio = 1; /* must be radio */
440 }
441 }
442 break;
443
444 case 0x0b:
445 /* tag 'Inputs': according to Hauppauge this is specific
446 to each driver family, so no good assumptions can be
447 made. */
448 break;
449
450 /* case 0x0c: tag 'Balun' */
451 /* case 0x0d: tag 'Teletext' */
452
364 case 0x0e: 453 case 0x0e:
454 /* tag: 'Radio' */
365 tvee->has_radio = eeprom_data[i+1]; 455 tvee->has_radio = eeprom_data[i+1];
366 break; 456 break;
457
458 case 0x0f:
459 /* tag 'IRInfo' */
460 tvee->has_ir = eeprom_data[i+1];
461 break;
462
463 /* case 0x10: tag 'VBIInfo' */
464 /* case 0x11: tag 'QCInfo' */
465 /* case 0x12: tag 'InfoBits' */
466
367 default: 467 default:
368 dprintk(1, "Not sure what to do with tag [%02x]\n", tag); 468 tveeprom_dbg("Not sure what to do with tag [%02x]\n", tag);
369 /* dump the rest of the packet? */ 469 /* dump the rest of the packet? */
370 } 470 }
371
372 } 471 }
373 472
374 if (!done) { 473 if (!done) {
375 TVEEPROM_KERN_ERR("Ran out of data!\n"); 474 tveeprom_warn("Ran out of data!\n");
376 return; 475 return;
377 } 476 }
378 477
@@ -384,47 +483,72 @@ void tveeprom_hauppauge_analog(struct tveeprom *tvee, unsigned char *eeprom_data
384 tvee->rev_str[4] = 0; 483 tvee->rev_str[4] = 0;
385 } 484 }
386 485
387 if (hasRadioTuner(tuner) && !tvee->has_radio) { 486 if (hasRadioTuner(tuner1) && !tvee->has_radio) {
388 TVEEPROM_KERN_INFO("The eeprom says no radio is present, but the tuner type\n"); 487 tveeprom_info("The eeprom says no radio is present, but the tuner type\n");
389 TVEEPROM_KERN_INFO("indicates otherwise. I will assume that radio is present.\n"); 488 tveeprom_info("indicates otherwise. I will assume that radio is present.\n");
390 tvee->has_radio = 1; 489 tvee->has_radio = 1;
391 } 490 }
392 491
393 if (tuner < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) { 492 if (tuner1 < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) {
394 tvee->tuner_type = hauppauge_tuner[tuner].id; 493 tvee->tuner_type = hauppauge_tuner[tuner1].id;
395 t_name = hauppauge_tuner[tuner].name; 494 t_name1 = hauppauge_tuner[tuner1].name;
396 } else { 495 } else {
397 t_name = "<unknown>"; 496 t_name1 = "unknown";
497 }
498
499 if (tuner2 < sizeof(hauppauge_tuner)/sizeof(struct HAUPPAUGE_TUNER)) {
500 tvee->tuner2_type = hauppauge_tuner[tuner2].id;
501 t_name2 = hauppauge_tuner[tuner2].name;
502 } else {
503 t_name2 = "unknown";
398 } 504 }
399 505
400 tvee->tuner_formats = 0; 506 tvee->tuner_formats = 0;
401 t_fmt_name = "<none>"; 507 tvee->tuner2_formats = 0;
402 for (i = 0; i < 8; i++) { 508 for (i = j = 0; i < 8; i++) {
403 if (t_format & (1<<i)) { 509 if (t_format1 & (1 << i)) {
404 tvee->tuner_formats |= hauppauge_tuner_fmt[i].id; 510 tvee->tuner_formats |= hauppauge_tuner_fmt[i].id;
405 /* yuck */ 511 t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name;
406 t_fmt_name = hauppauge_tuner_fmt[i].name;
407 } 512 }
513 if (t_format2 & (1 << i)) {
514 tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id;
515 t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name;
516 }
408 } 517 }
409 518
410 519 tveeprom_info("Hauppauge model %d, rev %s, serial# %d\n",
411 TVEEPROM_KERN_INFO("Hauppauge: model = %d, rev = %s, serial# = %d\n", 520 tvee->model, tvee->rev_str, tvee->serial_number);
412 tvee->model, 521 tveeprom_info("tuner model is %s (idx %d, type %d)\n",
413 tvee->rev_str, 522 t_name1, tuner1, tvee->tuner_type);
414 tvee->serial_number); 523 tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
415 TVEEPROM_KERN_INFO("tuner = %s (idx = %d, type = %d)\n", 524 t_fmt_name1[0], t_fmt_name1[1], t_fmt_name1[2], t_fmt_name1[3],
416 t_name, 525 t_fmt_name1[4], t_fmt_name1[5], t_fmt_name1[6], t_fmt_name1[7],
417 tuner, 526 t_format1);
418 tvee->tuner_type); 527 if (tuner2) {
419 TVEEPROM_KERN_INFO("tuner fmt = %s (eeprom = 0x%02x, v4l2 = 0x%08x)\n", 528 tveeprom_info("second tuner model is %s (idx %d, type %d)\n",
420 t_fmt_name, 529 t_name2, tuner2, tvee->tuner2_type);
421 t_format, 530 }
422 tvee->tuner_formats); 531 if (t_format2) {
423 532 tveeprom_info("TV standards%s%s%s%s%s%s%s%s (eeprom 0x%02x)\n",
424 TVEEPROM_KERN_INFO("audio_processor = %s (type = %d)\n", 533 t_fmt_name2[0], t_fmt_name2[1], t_fmt_name2[2], t_fmt_name2[3],
425 STRM(sndtype,tvee->audio_processor), 534 t_fmt_name2[4], t_fmt_name2[5], t_fmt_name2[6], t_fmt_name2[7],
535 t_format2);
536 }
537 tveeprom_info("audio processor is %s (idx %d)\n",
538 STRM(audioIC, tvee->audio_processor),
426 tvee->audio_processor); 539 tvee->audio_processor);
427 540 if (tvee->decoder_processor) {
541 tveeprom_info("decoder processor is %s (idx %d)\n",
542 STRM(decoderIC, tvee->decoder_processor),
543 tvee->decoder_processor);
544 }
545 if (tvee->has_ir == 2)
546 tveeprom_info("has %sradio\n",
547 tvee->has_radio ? "" : "no ");
548 else
549 tveeprom_info("has %sradio, has %sIR remote\n",
550 tvee->has_radio ? "" : "no ",
551 tvee->has_ir ? "" : "no ");
428} 552}
429EXPORT_SYMBOL(tveeprom_hauppauge_analog); 553EXPORT_SYMBOL(tveeprom_hauppauge_analog);
430 554
@@ -436,23 +560,31 @@ int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len)
436 unsigned char buf; 560 unsigned char buf;
437 int err; 561 int err;
438 562
439 dprintk(1, "%s\n",__FUNCTION__);
440 buf = 0; 563 buf = 0;
441 if (1 != (err = i2c_master_send(c,&buf,1))) { 564 if (1 != (err = i2c_master_send(c, &buf, 1))) {
442 printk(KERN_INFO "tveeprom(%s): Huh, no eeprom present (err=%d)?\n", 565 tveeprom_info("Huh, no eeprom present (err=%d)?\n", err);
443 c->name,err);
444 return -1; 566 return -1;
445 } 567 }
446 if (len != (err = i2c_master_recv(c,eedata,len))) { 568 if (len != (err = i2c_master_recv(c, eedata, len))) {
447 printk(KERN_WARNING "tveeprom(%s): i2c eeprom read error (err=%d)\n", 569 tveeprom_warn("i2c eeprom read error (err=%d)\n", err);
448 c->name,err);
449 return -1; 570 return -1;
450 } 571 }
572 if (debug) {
573 int i;
574
575 tveeprom_info("full 256-byte eeprom dump:\n");
576 for (i = 0; i < len; i++) {
577 if (0 == (i % 16))
578 tveeprom_info("%02x:", i);
579 printk(" %02x", eedata[i]);
580 if (15 == (i % 16))
581 printk("\n");
582 }
583 }
451 return 0; 584 return 0;
452} 585}
453EXPORT_SYMBOL(tveeprom_read); 586EXPORT_SYMBOL(tveeprom_read);
454 587
455
456/* ----------------------------------------------------------------------- */ 588/* ----------------------------------------------------------------------- */
457/* needed for ivtv.sf.net at the moment. Should go away in the long */ 589/* needed for ivtv.sf.net at the moment. Should go away in the long */
458/* run, just call the exported tveeprom_* directly, there is no point in */ 590/* run, just call the exported tveeprom_* directly, there is no point in */
@@ -485,7 +617,7 @@ tveeprom_command(struct i2c_client *client,
485 buf = kmalloc(256,GFP_KERNEL); 617 buf = kmalloc(256,GFP_KERNEL);
486 memset(buf,0,256); 618 memset(buf,0,256);
487 tveeprom_read(client,buf,256); 619 tveeprom_read(client,buf,256);
488 tveeprom_hauppauge_analog(&eeprom,buf); 620 tveeprom_hauppauge_analog(client, &eeprom,buf);
489 kfree(buf); 621 kfree(buf);
490 eeprom_props[0] = eeprom.tuner_type; 622 eeprom_props[0] = eeprom.tuner_type;
491 eeprom_props[1] = eeprom.tuner_formats; 623 eeprom_props[1] = eeprom.tuner_formats;
@@ -506,8 +638,6 @@ tveeprom_detect_client(struct i2c_adapter *adapter,
506{ 638{
507 struct i2c_client *client; 639 struct i2c_client *client;
508 640
509 dprintk(1,"%s: id 0x%x @ 0x%x\n",__FUNCTION__,
510 adapter->id, address << 1);
511 client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); 641 client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL);
512 if (NULL == client) 642 if (NULL == client)
513 return -ENOMEM; 643 return -ENOMEM;
@@ -524,7 +654,6 @@ tveeprom_detect_client(struct i2c_adapter *adapter,
524static int 654static int
525tveeprom_attach_adapter (struct i2c_adapter *adapter) 655tveeprom_attach_adapter (struct i2c_adapter *adapter)
526{ 656{
527 dprintk(1,"%s: id 0x%x\n",__FUNCTION__,adapter->id);
528 if (adapter->id != I2C_HW_B_BT848) 657 if (adapter->id != I2C_HW_B_BT848)
529 return 0; 658 return 0;
530 return i2c_probe(adapter, &addr_data, tveeprom_detect_client); 659 return i2c_probe(adapter, &addr_data, tveeprom_detect_client);