aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/tda9887.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2005-11-09 00:37:18 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:16 -0500
commit4eb0c14465a9221f040551a91238b57af301c145 (patch)
treea962f9922a0d5652b66c07b23a06d0dadee04cb1 /drivers/media/video/tda9887.c
parent98f30ed06a0feade6250438b0bd6cc472f26b12a (diff)
[PATCH] v4l: 754: add the adapter address prefix to the tda9887 kernel messages
- Add the adapter/address prefix to the tda9887 kernel messages. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> 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/video/tda9887.c')
-rw-r--r--drivers/media/video/tda9887.c110
1 files changed, 59 insertions, 51 deletions
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index ba22f12e8b32..3a7babef06f4 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -44,8 +44,13 @@ MODULE_LICENSE("GPL");
44/* ---------------------------------------------------------------------- */ 44/* ---------------------------------------------------------------------- */
45 45
46#define UNSET (-1U) 46#define UNSET (-1U)
47#define PREFIX "tda9885/6/7: " 47#define tda9887_info(fmt, arg...) do {\
48#define dprintk if (debug) printk 48 printk(KERN_INFO "%s %d-%04x: " fmt, t->client.name, \
49 i2c_adapter_id(t->client.adapter), t->client.addr , ##arg); } while (0)
50#define tda9887_dbg(fmt, arg...) do {\
51 if (debug) \
52 printk(KERN_INFO "%s %d-%04x: " fmt, t->client.name, \
53 i2c_adapter_id(t->client.adapter), t->client.addr , ##arg); } while (0)
49 54
50struct tda9887 { 55struct tda9887 {
51 struct i2c_client client; 56 struct i2c_client client;
@@ -237,7 +242,7 @@ static struct tvnorm radio_mono = {
237 242
238/* ---------------------------------------------------------------------- */ 243/* ---------------------------------------------------------------------- */
239 244
240static void dump_read_message(unsigned char *buf) 245static void dump_read_message(struct tda9887 *t, unsigned char *buf)
241{ 246{
242 static char *afc[16] = { 247 static char *afc[16] = {
243 "- 12.5 kHz", 248 "- 12.5 kHz",
@@ -257,15 +262,15 @@ static void dump_read_message(unsigned char *buf)
257 "+ 37.5 kHz", 262 "+ 37.5 kHz",
258 "+ 12.5 kHz", 263 "+ 12.5 kHz",
259 }; 264 };
260 printk(PREFIX "read: 0x%2x\n", buf[0]); 265 tda9887_info("read: 0x%2x\n", buf[0]);
261 printk(" after power on : %s\n", (buf[0] & 0x01) ? "yes" : "no"); 266 tda9887_info(" after power on : %s\n", (buf[0] & 0x01) ? "yes" : "no");
262 printk(" afc : %s\n", afc[(buf[0] >> 1) & 0x0f]); 267 tda9887_info(" afc : %s\n", afc[(buf[0] >> 1) & 0x0f]);
263 printk(" fmif level : %s\n", (buf[0] & 0x20) ? "high" : "low"); 268 tda9887_info(" fmif level : %s\n", (buf[0] & 0x20) ? "high" : "low");
264 printk(" afc window : %s\n", (buf[0] & 0x40) ? "in" : "out"); 269 tda9887_info(" afc window : %s\n", (buf[0] & 0x40) ? "in" : "out");
265 printk(" vfi level : %s\n", (buf[0] & 0x80) ? "high" : "low"); 270 tda9887_info(" vfi level : %s\n", (buf[0] & 0x80) ? "high" : "low");
266} 271}
267 272
268static void dump_write_message(unsigned char *buf) 273static void dump_write_message(struct tda9887 *t, unsigned char *buf)
269{ 274{
270 static char *sound[4] = { 275 static char *sound[4] = {
271 "AM/TV", 276 "AM/TV",
@@ -305,58 +310,58 @@ static void dump_write_message(unsigned char *buf)
305 "44 MHz", 310 "44 MHz",
306 }; 311 };
307 312
308 printk(PREFIX "write: byte B 0x%02x\n",buf[1]); 313 tda9887_info("write: byte B 0x%02x\n",buf[1]);
309 printk(" B0 video mode : %s\n", 314 tda9887_info(" B0 video mode : %s\n",
310 (buf[1] & 0x01) ? "video trap" : "sound trap"); 315 (buf[1] & 0x01) ? "video trap" : "sound trap");
311 printk(" B1 auto mute fm : %s\n", 316 tda9887_info(" B1 auto mute fm : %s\n",
312 (buf[1] & 0x02) ? "yes" : "no"); 317 (buf[1] & 0x02) ? "yes" : "no");
313 printk(" B2 carrier mode : %s\n", 318 tda9887_info(" B2 carrier mode : %s\n",
314 (buf[1] & 0x04) ? "QSS" : "Intercarrier"); 319 (buf[1] & 0x04) ? "QSS" : "Intercarrier");
315 printk(" B3-4 tv sound/radio : %s\n", 320 tda9887_info(" B3-4 tv sound/radio : %s\n",
316 sound[(buf[1] & 0x18) >> 3]); 321 sound[(buf[1] & 0x18) >> 3]);
317 printk(" B5 force mute audio: %s\n", 322 tda9887_info(" B5 force mute audio: %s\n",
318 (buf[1] & 0x20) ? "yes" : "no"); 323 (buf[1] & 0x20) ? "yes" : "no");
319 printk(" B6 output port 1 : %s\n", 324 tda9887_info(" B6 output port 1 : %s\n",
320 (buf[1] & 0x40) ? "high (inactive)" : "low (active)"); 325 (buf[1] & 0x40) ? "high (inactive)" : "low (active)");
321 printk(" B7 output port 2 : %s\n", 326 tda9887_info(" B7 output port 2 : %s\n",
322 (buf[1] & 0x80) ? "high (inactive)" : "low (active)"); 327 (buf[1] & 0x80) ? "high (inactive)" : "low (active)");
323 328
324 printk(PREFIX "write: byte C 0x%02x\n",buf[2]); 329 tda9887_info("write: byte C 0x%02x\n",buf[2]);
325 printk(" C0-4 top adjustment : %s dB\n", adjust[buf[2] & 0x1f]); 330 tda9887_info(" C0-4 top adjustment : %s dB\n", adjust[buf[2] & 0x1f]);
326 printk(" C5-6 de-emphasis : %s\n", deemph[(buf[2] & 0x60) >> 5]); 331 tda9887_info(" C5-6 de-emphasis : %s\n", deemph[(buf[2] & 0x60) >> 5]);
327 printk(" C7 audio gain : %s\n", 332 tda9887_info(" C7 audio gain : %s\n",
328 (buf[2] & 0x80) ? "-6" : "0"); 333 (buf[2] & 0x80) ? "-6" : "0");
329 334
330 printk(PREFIX "write: byte E 0x%02x\n",buf[3]); 335 tda9887_info("write: byte E 0x%02x\n",buf[3]);
331 printk(" E0-1 sound carrier : %s\n", 336 tda9887_info(" E0-1 sound carrier : %s\n",
332 carrier[(buf[3] & 0x03)]); 337 carrier[(buf[3] & 0x03)]);
333 printk(" E6 l pll gating : %s\n", 338 tda9887_info(" E6 l pll gating : %s\n",
334 (buf[3] & 0x40) ? "36" : "13"); 339 (buf[3] & 0x40) ? "36" : "13");
335 340
336 if (buf[1] & 0x08) { 341 if (buf[1] & 0x08) {
337 /* radio */ 342 /* radio */
338 printk(" E2-4 video if : %s\n", 343 tda9887_info(" E2-4 video if : %s\n",
339 rif[(buf[3] & 0x0c) >> 2]); 344 rif[(buf[3] & 0x0c) >> 2]);
340 printk(" E7 vif agc output : %s\n", 345 tda9887_info(" E7 vif agc output : %s\n",
341 (buf[3] & 0x80) 346 (buf[3] & 0x80)
342 ? ((buf[3] & 0x10) ? "fm-agc radio" : "sif-agc radio") 347 ? ((buf[3] & 0x10) ? "fm-agc radio" : "sif-agc radio")
343 : "fm radio carrier afc"); 348 : "fm radio carrier afc");
344 } else { 349 } else {
345 /* video */ 350 /* video */
346 printk(" E2-4 video if : %s\n", 351 tda9887_info(" E2-4 video if : %s\n",
347 vif[(buf[3] & 0x1c) >> 2]); 352 vif[(buf[3] & 0x1c) >> 2]);
348 printk(" E5 tuner gain : %s\n", 353 tda9887_info(" E5 tuner gain : %s\n",
349 (buf[3] & 0x80) 354 (buf[3] & 0x80)
350 ? ((buf[3] & 0x20) ? "external" : "normal") 355 ? ((buf[3] & 0x20) ? "external" : "normal")
351 : ((buf[3] & 0x20) ? "minimum" : "normal")); 356 : ((buf[3] & 0x20) ? "minimum" : "normal"));
352 printk(" E7 vif agc output : %s\n", 357 tda9887_info(" E7 vif agc output : %s\n",
353 (buf[3] & 0x80) 358 (buf[3] & 0x80)
354 ? ((buf[3] & 0x20) 359 ? ((buf[3] & 0x20)
355 ? "pin3 port, pin22 vif agc out" 360 ? "pin3 port, pin22 vif agc out"
356 : "pin22 port, pin3 vif acg ext in") 361 : "pin22 port, pin3 vif acg ext in")
357 : "pin3+pin22 port"); 362 : "pin3+pin22 port");
358 } 363 }
359 printk("--\n"); 364 tda9887_info("--\n");
360} 365}
361 366
362/* ---------------------------------------------------------------------- */ 367/* ---------------------------------------------------------------------- */
@@ -380,11 +385,11 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf)
380 } 385 }
381 } 386 }
382 if (NULL == norm) { 387 if (NULL == norm) {
383 dprintk(PREFIX "Unsupported tvnorm entry - audio muted\n"); 388 tda9887_dbg("Unsupported tvnorm entry - audio muted\n");
384 return -1; 389 return -1;
385 } 390 }
386 391
387 dprintk(PREFIX "configure for: %s\n",norm->name); 392 tda9887_dbg("configure for: %s\n",norm->name);
388 buf[1] = norm->b; 393 buf[1] = norm->b;
389 buf[2] = norm->c; 394 buf[2] = norm->c;
390 buf[3] = norm->e; 395 buf[3] = norm->e;
@@ -506,26 +511,26 @@ static int tda9887_fixup_std(struct tda9887 *t)
506 case 'B': 511 case 'B':
507 case 'g': 512 case 'g':
508 case 'G': 513 case 'G':
509 dprintk(PREFIX "insmod fixup: PAL => PAL-BG\n"); 514 tda9887_dbg("insmod fixup: PAL => PAL-BG\n");
510 t->std = V4L2_STD_PAL_BG; 515 t->std = V4L2_STD_PAL_BG;
511 break; 516 break;
512 case 'i': 517 case 'i':
513 case 'I': 518 case 'I':
514 dprintk(PREFIX "insmod fixup: PAL => PAL-I\n"); 519 tda9887_dbg("insmod fixup: PAL => PAL-I\n");
515 t->std = V4L2_STD_PAL_I; 520 t->std = V4L2_STD_PAL_I;
516 break; 521 break;
517 case 'd': 522 case 'd':
518 case 'D': 523 case 'D':
519 case 'k': 524 case 'k':
520 case 'K': 525 case 'K':
521 dprintk(PREFIX "insmod fixup: PAL => PAL-DK\n"); 526 tda9887_dbg("insmod fixup: PAL => PAL-DK\n");
522 t->std = V4L2_STD_PAL_DK; 527 t->std = V4L2_STD_PAL_DK;
523 break; 528 break;
524 case '-': 529 case '-':
525 /* default parameter, do nothing */ 530 /* default parameter, do nothing */
526 break; 531 break;
527 default: 532 default:
528 printk(PREFIX "pal= argument not recognised\n"); 533 tda9887_info("pal= argument not recognised\n");
529 break; 534 break;
530 } 535 }
531 } 536 }
@@ -535,19 +540,19 @@ static int tda9887_fixup_std(struct tda9887 *t)
535 case 'D': 540 case 'D':
536 case 'k': 541 case 'k':
537 case 'K': 542 case 'K':
538 dprintk(PREFIX "insmod fixup: SECAM => SECAM-DK\n"); 543 tda9887_dbg("insmod fixup: SECAM => SECAM-DK\n");
539 t->std = V4L2_STD_SECAM_DK; 544 t->std = V4L2_STD_SECAM_DK;
540 break; 545 break;
541 case 'l': 546 case 'l':
542 case 'L': 547 case 'L':
543 dprintk(PREFIX "insmod fixup: SECAM => SECAM-L\n"); 548 tda9887_dbg("insmod fixup: SECAM => SECAM-L\n");
544 t->std = V4L2_STD_SECAM_L; 549 t->std = V4L2_STD_SECAM_L;
545 break; 550 break;
546 case '-': 551 case '-':
547 /* default parameter, do nothing */ 552 /* default parameter, do nothing */
548 break; 553 break;
549 default: 554 default:
550 printk(PREFIX "secam= argument not recognised\n"); 555 tda9887_info("secam= argument not recognised\n");
551 break; 556 break;
552 } 557 }
553 } 558 }
@@ -561,8 +566,8 @@ static int tda9887_status(struct tda9887 *t)
561 566
562 memset(buf,0,sizeof(buf)); 567 memset(buf,0,sizeof(buf));
563 if (1 != (rc = i2c_master_recv(&t->client,buf,1))) 568 if (1 != (rc = i2c_master_recv(&t->client,buf,1)))
564 printk(PREFIX "i2c i/o error: rc == %d (should be 1)\n",rc); 569 tda9887_info("i2c i/o error: rc == %d (should be 1)\n",rc);
565 dump_read_message(buf); 570 dump_read_message(t, buf);
566 return 0; 571 return 0;
567} 572}
568 573
@@ -588,13 +593,13 @@ static int tda9887_configure(struct tda9887 *t)
588 } 593 }
589 594
590 595
591 dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n", 596 tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n",
592 buf[1],buf[2],buf[3]); 597 buf[1],buf[2],buf[3]);
593 if (debug > 1) 598 if (debug > 1)
594 dump_write_message(buf); 599 dump_write_message(t, buf);
595 600
596 if (4 != (rc = i2c_master_send(&t->client,buf,4))) 601 if (4 != (rc = i2c_master_send(&t->client,buf,4)))
597 printk(PREFIX "i2c i/o error: rc == %d (should be 4)\n",rc); 602 tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc);
598 603
599 if (debug > 2) { 604 if (debug > 2) {
600 msleep_interruptible(1000); 605 msleep_interruptible(1000);
@@ -612,8 +617,6 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind)
612 client_template.adapter = adap; 617 client_template.adapter = adap;
613 client_template.addr = addr; 618 client_template.addr = addr;
614 619
615 printk(PREFIX "chip found @ 0x%x\n", addr<<1);
616
617 if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) 620 if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL)))
618 return -ENOMEM; 621 return -ENOMEM;
619 memset(t,0,sizeof(*t)); 622 memset(t,0,sizeof(*t));
@@ -623,6 +626,8 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind)
623 t->pinnacle_id = UNSET; 626 t->pinnacle_id = UNSET;
624 t->radio_mode = V4L2_TUNER_MODE_STEREO; 627 t->radio_mode = V4L2_TUNER_MODE_STEREO;
625 628
629 tda9887_info("chip found @ 0x%x (%s)\n", addr<<1, adap->name);
630
626 i2c_set_clientdata(&t->client, t); 631 i2c_set_clientdata(&t->client, t);
627 i2c_attach_client(&t->client); 632 i2c_attach_client(&t->client);
628 633
@@ -656,10 +661,10 @@ static int tda9887_detach(struct i2c_client *client)
656} 661}
657 662
658#define SWITCH_V4L2 if (!t->using_v4l2 && debug) \ 663#define SWITCH_V4L2 if (!t->using_v4l2 && debug) \
659 printk(PREFIX "switching to v4l2\n"); \ 664 tda9887_info("switching to v4l2\n"); \
660 t->using_v4l2 = 1; 665 t->using_v4l2 = 1;
661#define CHECK_V4L2 if (t->using_v4l2) { if (debug) \ 666#define CHECK_V4L2 if (t->using_v4l2) { if (debug) \
662 printk(PREFIX "ignore v4l1 call\n"); \ 667 tda9887_info("ignore v4l1 call\n"); \
663 return 0; } 668 return 0; }
664 669
665static int 670static int
@@ -787,7 +792,10 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg)
787 792
788static int tda9887_suspend(struct device * dev, pm_message_t state) 793static int tda9887_suspend(struct device * dev, pm_message_t state)
789{ 794{
790 dprintk("tda9887: suspend\n"); 795 struct i2c_client *c = container_of(dev, struct i2c_client, dev);
796 struct tda9887 *t = i2c_get_clientdata(c);
797
798 tda9887_dbg("suspend\n");
791 return 0; 799 return 0;
792} 800}
793 801
@@ -796,7 +804,7 @@ static int tda9887_resume(struct device * dev)
796 struct i2c_client *c = container_of(dev, struct i2c_client, dev); 804 struct i2c_client *c = container_of(dev, struct i2c_client, dev);
797 struct tda9887 *t = i2c_get_clientdata(c); 805 struct tda9887 *t = i2c_get_clientdata(c);
798 806
799 dprintk("tda9887: resume\n"); 807 tda9887_dbg("resume\n");
800 tda9887_configure(t); 808 tda9887_configure(t);
801 return 0; 809 return 0;
802} 810}