aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/dvb/frontends/tda18271-fe.c
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-12-02 00:45:04 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:03:12 -0500
commit293da0ec468addf891856e9ffee88af2fd00e25a (patch)
treee391303bb314e69c99b0b529b0f648c7e6c381df /drivers/media/dvb/frontends/tda18271-fe.c
parent1457263e9df6911384c474532a49d1b25bc9d248 (diff)
V4L/DVB (6725): tda18271: improve debug flexibility
converted debug module option to an or-able setting. 1 = info 2 = table map values 4 = register dumps Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb/frontends/tda18271-fe.c')
-rw-r--r--drivers/media/dvb/frontends/tda18271-fe.c70
1 files changed, 39 insertions, 31 deletions
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c
index 1944177da873..01de75e369ed 100644
--- a/drivers/media/dvb/frontends/tda18271-fe.c
+++ b/drivers/media/dvb/frontends/tda18271-fe.c
@@ -27,12 +27,20 @@
27 27
28static int tda18271_debug; 28static int tda18271_debug;
29module_param_named(debug, tda18271_debug, int, 0644); 29module_param_named(debug, tda18271_debug, int, 0644);
30MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); 30MODULE_PARM_DESC(debug, "set debug level (info=1, map=2, reg=4 (or-able))");
31 31
32#define dprintk(level, fmt, arg...) do {\ 32#define dprintk(level, fmt, arg...) do {\
33 if (tda18271_debug >= level) \ 33 if (tda18271_debug & level) \
34 printk(KERN_DEBUG "%s: " fmt, __FUNCTION__, ##arg); } while (0) 34 printk(KERN_DEBUG "%s: " fmt, __FUNCTION__, ##arg); } while (0)
35 35
36#define DBG_INFO 1
37#define DBG_MAP 2
38#define DBG_REG 4
39
40#define dbg_info(fmt, arg...) dprintk(DBG_INFO, fmt, ##arg)
41#define dbg_map(fmt, arg...) dprintk(DBG_MAP, fmt, ##arg)
42#define dbg_reg(fmt, arg...) dprintk(DBG_REG, fmt, ##arg)
43
36/*---------------------------------------------------------------------*/ 44/*---------------------------------------------------------------------*/
37 45
38#define TDA18271_ANALOG 0 46#define TDA18271_ANALOG 0
@@ -75,23 +83,23 @@ static void tda18271_dump_regs(struct dvb_frontend *fe)
75 struct tda18271_priv *priv = fe->tuner_priv; 83 struct tda18271_priv *priv = fe->tuner_priv;
76 unsigned char *regs = priv->tda18271_regs; 84 unsigned char *regs = priv->tda18271_regs;
77 85
78 dprintk(1, "=== TDA18271 REG DUMP ===\n"); 86 dbg_reg("=== TDA18271 REG DUMP ===\n");
79 dprintk(1, "ID_BYTE = 0x%x\n", 0xff & regs[R_ID]); 87 dbg_reg("ID_BYTE = 0x%x\n", 0xff & regs[R_ID]);
80 dprintk(1, "THERMO_BYTE = 0x%x\n", 0xff & regs[R_TM]); 88 dbg_reg("THERMO_BYTE = 0x%x\n", 0xff & regs[R_TM]);
81 dprintk(1, "POWER_LEVEL_BYTE = 0x%x\n", 0xff & regs[R_PL]); 89 dbg_reg("POWER_LEVEL_BYTE = 0x%x\n", 0xff & regs[R_PL]);
82 dprintk(1, "EASY_PROG_BYTE_1 = 0x%x\n", 0xff & regs[R_EP1]); 90 dbg_reg("EASY_PROG_BYTE_1 = 0x%x\n", 0xff & regs[R_EP1]);
83 dprintk(1, "EASY_PROG_BYTE_2 = 0x%x\n", 0xff & regs[R_EP2]); 91 dbg_reg("EASY_PROG_BYTE_2 = 0x%x\n", 0xff & regs[R_EP2]);
84 dprintk(1, "EASY_PROG_BYTE_3 = 0x%x\n", 0xff & regs[R_EP3]); 92 dbg_reg("EASY_PROG_BYTE_3 = 0x%x\n", 0xff & regs[R_EP3]);
85 dprintk(1, "EASY_PROG_BYTE_4 = 0x%x\n", 0xff & regs[R_EP4]); 93 dbg_reg("EASY_PROG_BYTE_4 = 0x%x\n", 0xff & regs[R_EP4]);
86 dprintk(1, "EASY_PROG_BYTE_5 = 0x%x\n", 0xff & regs[R_EP5]); 94 dbg_reg("EASY_PROG_BYTE_5 = 0x%x\n", 0xff & regs[R_EP5]);
87 dprintk(1, "CAL_POST_DIV_BYTE = 0x%x\n", 0xff & regs[R_CPD]); 95 dbg_reg("CAL_POST_DIV_BYTE = 0x%x\n", 0xff & regs[R_CPD]);
88 dprintk(1, "CAL_DIV_BYTE_1 = 0x%x\n", 0xff & regs[R_CD1]); 96 dbg_reg("CAL_DIV_BYTE_1 = 0x%x\n", 0xff & regs[R_CD1]);
89 dprintk(1, "CAL_DIV_BYTE_2 = 0x%x\n", 0xff & regs[R_CD2]); 97 dbg_reg("CAL_DIV_BYTE_2 = 0x%x\n", 0xff & regs[R_CD2]);
90 dprintk(1, "CAL_DIV_BYTE_3 = 0x%x\n", 0xff & regs[R_CD3]); 98 dbg_reg("CAL_DIV_BYTE_3 = 0x%x\n", 0xff & regs[R_CD3]);
91 dprintk(1, "MAIN_POST_DIV_BYTE = 0x%x\n", 0xff & regs[R_MPD]); 99 dbg_reg("MAIN_POST_DIV_BYTE = 0x%x\n", 0xff & regs[R_MPD]);
92 dprintk(1, "MAIN_DIV_BYTE_1 = 0x%x\n", 0xff & regs[R_MD1]); 100 dbg_reg("MAIN_DIV_BYTE_1 = 0x%x\n", 0xff & regs[R_MD1]);
93 dprintk(1, "MAIN_DIV_BYTE_2 = 0x%x\n", 0xff & regs[R_MD2]); 101 dbg_reg("MAIN_DIV_BYTE_2 = 0x%x\n", 0xff & regs[R_MD2]);
94 dprintk(1, "MAIN_DIV_BYTE_3 = 0x%x\n", 0xff & regs[R_MD3]); 102 dbg_reg("MAIN_DIV_BYTE_3 = 0x%x\n", 0xff & regs[R_MD3]);
95} 103}
96 104
97static void tda18271_read_regs(struct dvb_frontend *fe) 105static void tda18271_read_regs(struct dvb_frontend *fe)
@@ -118,7 +126,7 @@ static void tda18271_read_regs(struct dvb_frontend *fe)
118 printk("ERROR: %s: i2c_transfer returned: %d\n", 126 printk("ERROR: %s: i2c_transfer returned: %d\n",
119 __FUNCTION__, ret); 127 __FUNCTION__, ret);
120 128
121 if (tda18271_debug > 2) 129 if (tda18271_debug & DBG_REG)
122 tda18271_dump_regs(fe); 130 tda18271_dump_regs(fe);
123} 131}
124 132
@@ -361,7 +369,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
361 369
362 tda18271_init(fe); 370 tda18271_init(fe);
363 371
364 dprintk(1, "freq = %d, ifc = %d\n", freq, ifc); 372 dbg_info("freq = %d, ifc = %d\n", freq, ifc);
365 373
366 /* RF tracking filter calibration */ 374 /* RF tracking filter calibration */
367 375
@@ -372,7 +380,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
372 break; 380 break;
373 i++; 381 i++;
374 } 382 }
375 dprintk(2, "bp filter = 0x%x, i = %d\n", tda18271_bp_filter[i].val, i); 383 dbg_map("bp filter = 0x%x, i = %d\n", tda18271_bp_filter[i].val, i);
376 384
377 regs[R_EP1] &= ~0x07; /* clear bp filter bits */ 385 regs[R_EP1] &= ~0x07; /* clear bp filter bits */
378 regs[R_EP1] |= tda18271_bp_filter[i].val; 386 regs[R_EP1] |= tda18271_bp_filter[i].val;
@@ -411,7 +419,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
411 break; 419 break;
412 i++; 420 i++;
413 } 421 }
414 dprintk(2, "cal pll, pd = 0x%x, d = 0x%x, i = %d\n", 422 dbg_map("cal pll, pd = 0x%x, d = 0x%x, i = %d\n",
415 tda18271_cal_pll[i].pd, tda18271_cal_pll[i].d, i); 423 tda18271_cal_pll[i].pd, tda18271_cal_pll[i].d, i);
416 424
417 regs[R_CPD] = tda18271_cal_pll[i].pd; 425 regs[R_CPD] = tda18271_cal_pll[i].pd;
@@ -438,7 +446,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
438 break; 446 break;
439 i++; 447 i++;
440 } 448 }
441 dprintk(2, "main pll, pd = 0x%x, d = 0x%x, i = %d\n", 449 dbg_map("main pll, pd = 0x%x, d = 0x%x, i = %d\n",
442 tda18271_main_pll[i].pd, tda18271_main_pll[i].d, i); 450 tda18271_main_pll[i].pd, tda18271_main_pll[i].d, i);
443 451
444 regs[R_MPD] = (0x7f & tda18271_main_pll[i].pd); 452 regs[R_MPD] = (0x7f & tda18271_main_pll[i].pd);
@@ -467,7 +475,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
467 break; 475 break;
468 i++; 476 i++;
469 } 477 }
470 dprintk(2, "km = 0x%x, i = %d\n", tda18271_km[i].val, i); 478 dbg_map("km = 0x%x, i = %d\n", tda18271_km[i].val, i);
471 479
472 regs[R_EB13] &= 0x83; 480 regs[R_EB13] &= 0x83;
473 regs[R_EB13] |= tda18271_km[i].val; 481 regs[R_EB13] |= tda18271_km[i].val;
@@ -480,7 +488,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
480 break; 488 break;
481 i++; 489 i++;
482 } 490 }
483 dprintk(2, "rf band = 0x%x, i = %d\n", tda18271_rf_band[i].val, i); 491 dbg_map("rf band = 0x%x, i = %d\n", tda18271_rf_band[i].val, i);
484 492
485 regs[R_EP2] &= ~0xe0; /* clear rf band bits */ 493 regs[R_EP2] &= ~0xe0; /* clear rf band bits */
486 regs[R_EP2] |= (tda18271_rf_band[i].val << 5); 494 regs[R_EP2] |= (tda18271_rf_band[i].val << 5);
@@ -492,7 +500,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
492 break; 500 break;
493 i++; 501 i++;
494 } 502 }
495 dprintk(2, "gain taper = 0x%x, i = %d\n", 503 dbg_map("gain taper = 0x%x, i = %d\n",
496 tda18271_gain_taper[i].val, i); 504 tda18271_gain_taper[i].val, i);
497 505
498 regs[R_EP2] &= ~0x1f; /* clear gain taper bits */ 506 regs[R_EP2] &= ~0x1f; /* clear gain taper bits */
@@ -527,7 +535,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
527 break; 535 break;
528 i++; 536 i++;
529 } 537 }
530 dprintk(2, "rf cal = 0x%x, i = %d\n", tda18271_rf_cal[i].val, i); 538 dbg_map("rf cal = 0x%x, i = %d\n", tda18271_rf_cal[i].val, i);
531 539
532 /* VHF_Low band only */ 540 /* VHF_Low band only */
533 if (tda18271_rf_cal[i].rfmax != 0) { 541 if (tda18271_rf_cal[i].rfmax != 0) {
@@ -581,7 +589,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
581 break; 589 break;
582 i++; 590 i++;
583 } 591 }
584 dprintk(2, "main pll, pd = 0x%x, d = 0x%x, i = %d\n", 592 dbg_map("main pll, pd = 0x%x, d = 0x%x, i = %d\n",
585 tda18271_main_pll[i].pd, tda18271_main_pll[i].d, i); 593 tda18271_main_pll[i].pd, tda18271_main_pll[i].d, i);
586 594
587 regs[R_MPD] = (0x7f & tda18271_main_pll[i].pd); 595 regs[R_MPD] = (0x7f & tda18271_main_pll[i].pd);
@@ -717,7 +725,7 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe,
717 if (params->mode == V4L2_TUNER_RADIO) 725 if (params->mode == V4L2_TUNER_RADIO)
718 sgIF = 88; /* if frequency is 5.5 MHz */ 726 sgIF = 88; /* if frequency is 5.5 MHz */
719 727
720 dprintk(1, "setting tda18271 to system %s\n", mode); 728 dbg_info("setting tda18271 to system %s\n", mode);
721 729
722 return tda18271_tune(fe, sgIF * 62500, params->frequency * 62500, 730 return tda18271_tune(fe, sgIF * 62500, params->frequency * 62500,
723 0, std); 731 0, std);
@@ -764,7 +772,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
764{ 772{
765 struct tda18271_priv *priv = NULL; 773 struct tda18271_priv *priv = NULL;
766 774
767 dprintk(1, "@ %d-%04x\n", i2c_adapter_id(i2c), addr); 775 dbg_info("@ %d-%04x\n", i2c_adapter_id(i2c), addr);
768 priv = kzalloc(sizeof(struct tda18271_priv), GFP_KERNEL); 776 priv = kzalloc(sizeof(struct tda18271_priv), GFP_KERNEL);
769 if (priv == NULL) 777 if (priv == NULL)
770 return NULL; 778 return NULL;