aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-12-16 19:20:21 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:03:56 -0500
commit790ba18ec7a5f15c854f52835b0e6f39de2369dd (patch)
tree37841ce180da0d6b4c22d1fafb1389c149d19582 /drivers/media
parent8ca4083b50752d588f8b8b1e5e5776fb17d00304 (diff)
V4L/DVB (6843): tda9887: use printk macros from tuner-i2c.h
replace tda9887_info and tda9887_dbg printk macros with tuner_info and tuner_dbg, defined in tuner-i2c.h Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/tda9887.c145
1 files changed, 70 insertions, 75 deletions
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 0b5dc37fea51..5085cb902125 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -22,18 +22,11 @@
22 Used as part of several tuners 22 Used as part of several tuners
23*/ 23*/
24 24
25static int tda9887_debug; 25static int debug;
26module_param_named(debug, tda9887_debug, int, 0644); 26module_param(debug, int, 0644);
27 27MODULE_PARM_DESC(debug, "enable verbose debug messages");
28#define tda9887_info(fmt, arg...) do {\ 28
29 printk(KERN_INFO "tda9887 %d-%04x: " fmt, \ 29#define PREFIX "tda9887"
30 i2c_adapter_id(priv->i2c_props.adap), \
31 priv->i2c_props.addr, ##arg); } while (0)
32#define tda9887_dbg(fmt, arg...) do {\
33 if (tda9887_debug) \
34 printk(KERN_INFO "tda9887 %d-%04x: " fmt, \
35 i2c_adapter_id(priv->i2c_props.adap), \
36 priv->i2c_props.addr, ##arg); } while (0)
37 30
38struct tda9887_priv { 31struct tda9887_priv {
39 struct tuner_i2c_props i2c_props; 32 struct tuner_i2c_props i2c_props;
@@ -295,12 +288,12 @@ static void dump_read_message(struct dvb_frontend *fe, unsigned char *buf)
295 "+ 37.5 kHz", 288 "+ 37.5 kHz",
296 "+ 12.5 kHz", 289 "+ 12.5 kHz",
297 }; 290 };
298 tda9887_info("read: 0x%2x\n", buf[0]); 291 tuner_info("read: 0x%2x\n", buf[0]);
299 tda9887_info(" after power on : %s\n", (buf[0] & 0x01) ? "yes" : "no"); 292 tuner_info(" after power on : %s\n", (buf[0] & 0x01) ? "yes" : "no");
300 tda9887_info(" afc : %s\n", afc[(buf[0] >> 1) & 0x0f]); 293 tuner_info(" afc : %s\n", afc[(buf[0] >> 1) & 0x0f]);
301 tda9887_info(" fmif level : %s\n", (buf[0] & 0x20) ? "high" : "low"); 294 tuner_info(" fmif level : %s\n", (buf[0] & 0x20) ? "high" : "low");
302 tda9887_info(" afc window : %s\n", (buf[0] & 0x40) ? "in" : "out"); 295 tuner_info(" afc window : %s\n", (buf[0] & 0x40) ? "in" : "out");
303 tda9887_info(" vfi level : %s\n", (buf[0] & 0x80) ? "high" : "low"); 296 tuner_info(" vfi level : %s\n", (buf[0] & 0x80) ? "high" : "low");
304} 297}
305 298
306static void dump_write_message(struct dvb_frontend *fe, unsigned char *buf) 299static void dump_write_message(struct dvb_frontend *fe, unsigned char *buf)
@@ -345,58 +338,60 @@ static void dump_write_message(struct dvb_frontend *fe, unsigned char *buf)
345 "44 MHz", 338 "44 MHz",
346 }; 339 };
347 340
348 tda9887_info("write: byte B 0x%02x\n",buf[1]); 341 tuner_info("write: byte B 0x%02x\n", buf[1]);
349 tda9887_info(" B0 video mode : %s\n", 342 tuner_info(" B0 video mode : %s\n",
350 (buf[1] & 0x01) ? "video trap" : "sound trap"); 343 (buf[1] & 0x01) ? "video trap" : "sound trap");
351 tda9887_info(" B1 auto mute fm : %s\n", 344 tuner_info(" B1 auto mute fm : %s\n",
352 (buf[1] & 0x02) ? "yes" : "no"); 345 (buf[1] & 0x02) ? "yes" : "no");
353 tda9887_info(" B2 carrier mode : %s\n", 346 tuner_info(" B2 carrier mode : %s\n",
354 (buf[1] & 0x04) ? "QSS" : "Intercarrier"); 347 (buf[1] & 0x04) ? "QSS" : "Intercarrier");
355 tda9887_info(" B3-4 tv sound/radio : %s\n", 348 tuner_info(" B3-4 tv sound/radio : %s\n",
356 sound[(buf[1] & 0x18) >> 3]); 349 sound[(buf[1] & 0x18) >> 3]);
357 tda9887_info(" B5 force mute audio: %s\n", 350 tuner_info(" B5 force mute audio: %s\n",
358 (buf[1] & 0x20) ? "yes" : "no"); 351 (buf[1] & 0x20) ? "yes" : "no");
359 tda9887_info(" B6 output port 1 : %s\n", 352 tuner_info(" B6 output port 1 : %s\n",
360 (buf[1] & 0x40) ? "high (inactive)" : "low (active)"); 353 (buf[1] & 0x40) ? "high (inactive)" : "low (active)");
361 tda9887_info(" B7 output port 2 : %s\n", 354 tuner_info(" B7 output port 2 : %s\n",
362 (buf[1] & 0x80) ? "high (inactive)" : "low (active)"); 355 (buf[1] & 0x80) ? "high (inactive)" : "low (active)");
363 356
364 tda9887_info("write: byte C 0x%02x\n",buf[2]); 357 tuner_info("write: byte C 0x%02x\n", buf[2]);
365 tda9887_info(" C0-4 top adjustment : %s dB\n", adjust[buf[2] & 0x1f]); 358 tuner_info(" C0-4 top adjustment : %s dB\n",
366 tda9887_info(" C5-6 de-emphasis : %s\n", deemph[(buf[2] & 0x60) >> 5]); 359 adjust[buf[2] & 0x1f]);
367 tda9887_info(" C7 audio gain : %s\n", 360 tuner_info(" C5-6 de-emphasis : %s\n",
368 (buf[2] & 0x80) ? "-6" : "0"); 361 deemph[(buf[2] & 0x60) >> 5]);
369 362 tuner_info(" C7 audio gain : %s\n",
370 tda9887_info("write: byte E 0x%02x\n",buf[3]); 363 (buf[2] & 0x80) ? "-6" : "0");
371 tda9887_info(" E0-1 sound carrier : %s\n", 364
372 carrier[(buf[3] & 0x03)]); 365 tuner_info("write: byte E 0x%02x\n", buf[3]);
373 tda9887_info(" E6 l pll gating : %s\n", 366 tuner_info(" E0-1 sound carrier : %s\n",
374 (buf[3] & 0x40) ? "36" : "13"); 367 carrier[(buf[3] & 0x03)]);
368 tuner_info(" E6 l pll gating : %s\n",
369 (buf[3] & 0x40) ? "36" : "13");
375 370
376 if (buf[1] & 0x08) { 371 if (buf[1] & 0x08) {
377 /* radio */ 372 /* radio */
378 tda9887_info(" E2-4 video if : %s\n", 373 tuner_info(" E2-4 video if : %s\n",
379 rif[(buf[3] & 0x0c) >> 2]); 374 rif[(buf[3] & 0x0c) >> 2]);
380 tda9887_info(" E7 vif agc output : %s\n", 375 tuner_info(" E7 vif agc output : %s\n",
381 (buf[3] & 0x80) 376 (buf[3] & 0x80)
382 ? ((buf[3] & 0x10) ? "fm-agc radio" : "sif-agc radio") 377 ? ((buf[3] & 0x10) ? "fm-agc radio" :
383 : "fm radio carrier afc"); 378 "sif-agc radio")
379 : "fm radio carrier afc");
384 } else { 380 } else {
385 /* video */ 381 /* video */
386 tda9887_info(" E2-4 video if : %s\n", 382 tuner_info(" E2-4 video if : %s\n",
387 vif[(buf[3] & 0x1c) >> 2]); 383 vif[(buf[3] & 0x1c) >> 2]);
388 tda9887_info(" E5 tuner gain : %s\n", 384 tuner_info(" E5 tuner gain : %s\n",
389 (buf[3] & 0x80) 385 (buf[3] & 0x80)
390 ? ((buf[3] & 0x20) ? "external" : "normal") 386 ? ((buf[3] & 0x20) ? "external" : "normal")
391 : ((buf[3] & 0x20) ? "minimum" : "normal")); 387 : ((buf[3] & 0x20) ? "minimum" : "normal"));
392 tda9887_info(" E7 vif agc output : %s\n", 388 tuner_info(" E7 vif agc output : %s\n",
393 (buf[3] & 0x80) 389 (buf[3] & 0x80) ? ((buf[3] & 0x20)
394 ? ((buf[3] & 0x20) 390 ? "pin3 port, pin22 vif agc out"
395 ? "pin3 port, pin22 vif agc out" 391 : "pin22 port, pin3 vif acg ext in")
396 : "pin22 port, pin3 vif acg ext in") 392 : "pin3+pin22 port");
397 : "pin3+pin22 port");
398 } 393 }
399 tda9887_info("--\n"); 394 tuner_info("--\n");
400} 395}
401 396
402/* ---------------------------------------------------------------------- */ 397/* ---------------------------------------------------------------------- */
@@ -422,11 +417,11 @@ static int tda9887_set_tvnorm(struct dvb_frontend *fe)
422 } 417 }
423 } 418 }
424 if (NULL == norm) { 419 if (NULL == norm) {
425 tda9887_dbg("Unsupported tvnorm entry - audio muted\n"); 420 tuner_dbg("Unsupported tvnorm entry - audio muted\n");
426 return -1; 421 return -1;
427 } 422 }
428 423
429 tda9887_dbg("configure for: %s\n",norm->name); 424 tuner_dbg("configure for: %s\n", norm->name);
430 buf[1] = norm->b; 425 buf[1] = norm->b;
431 buf[2] = norm->c; 426 buf[2] = norm->c;
432 buf[3] = norm->e; 427 buf[3] = norm->e;
@@ -542,7 +537,7 @@ static int tda9887_status(struct dvb_frontend *fe)
542 537
543 memset(buf,0,sizeof(buf)); 538 memset(buf,0,sizeof(buf));
544 if (1 != (rc = tuner_i2c_xfer_recv(&priv->i2c_props,buf,1))) 539 if (1 != (rc = tuner_i2c_xfer_recv(&priv->i2c_props,buf,1)))
545 tda9887_info("i2c i/o error: rc == %d (should be 1)\n",rc); 540 tuner_info("i2c i/o error: rc == %d (should be 1)\n", rc);
546 dump_read_message(fe, buf); 541 dump_read_message(fe, buf);
547 return 0; 542 return 0;
548} 543}
@@ -577,15 +572,15 @@ static void tda9887_configure(struct dvb_frontend *fe)
577 if (priv->mode == T_STANDBY) 572 if (priv->mode == T_STANDBY)
578 priv->data[1] |= cForcedMuteAudioON; 573 priv->data[1] |= cForcedMuteAudioON;
579 574
580 tda9887_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n", 575 tuner_dbg("writing: b=0x%02x c=0x%02x e=0x%02x\n",
581 priv->data[1],priv->data[2],priv->data[3]); 576 priv->data[1], priv->data[2], priv->data[3]);
582 if (tda9887_debug > 1) 577 if (debug > 1)
583 dump_write_message(fe, priv->data); 578 dump_write_message(fe, priv->data);
584 579
585 if (4 != (rc = tuner_i2c_xfer_send(&priv->i2c_props,priv->data,4))) 580 if (4 != (rc = tuner_i2c_xfer_send(&priv->i2c_props,priv->data,4)))
586 tda9887_info("i2c i/o error: rc == %d (should be 4)\n",rc); 581 tuner_info("i2c i/o error: rc == %d (should be 4)\n", rc);
587 582
588 if (tda9887_debug > 2) { 583 if (debug > 2) {
589 msleep_interruptible(1000); 584 msleep_interruptible(1000);
590 tda9887_status(fe); 585 tda9887_status(fe);
591 } 586 }
@@ -596,8 +591,8 @@ static void tda9887_configure(struct dvb_frontend *fe)
596static void tda9887_tuner_status(struct dvb_frontend *fe) 591static void tda9887_tuner_status(struct dvb_frontend *fe)
597{ 592{
598 struct tda9887_priv *priv = fe->analog_demod_priv; 593 struct tda9887_priv *priv = fe->analog_demod_priv;
599 tda9887_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n", 594 tuner_info("Data bytes: b=0x%02x c=0x%02x e=0x%02x\n",
600 priv->data[1], priv->data[2], priv->data[3]); 595 priv->data[1], priv->data[2], priv->data[3]);
601} 596}
602 597
603static int tda9887_get_afc(struct dvb_frontend *fe) 598static int tda9887_get_afc(struct dvb_frontend *fe)
@@ -680,7 +675,7 @@ struct dvb_frontend *tda9887_attach(struct dvb_frontend *fe,
680 priv->i2c_props.addr = i2c_addr; 675 priv->i2c_props.addr = i2c_addr;
681 priv->i2c_props.adap = i2c_adap; 676 priv->i2c_props.adap = i2c_adap;
682 677
683 tda9887_info("tda988[5/6/7] found\n"); 678 tuner_info("tda988[5/6/7] found\n");
684 679
685 fe->ops.analog_demod_ops = &tda9887_tuner_ops; 680 fe->ops.analog_demod_ops = &tda9887_tuner_ops;
686 681