aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Krufky <mkrufky@linuxtv.org>2007-10-24 00:00:24 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-01-25 16:01:11 -0500
commit6f998742f09a7116f1232cebc87a814e3aca639a (patch)
tree6f3d263c0ac093a292c599c5c9c5c231196b3606
parent4524c1aba5449d3519d1545f8106811eb73fc72c (diff)
V4L/DVB (6446): tda18271: clean up debug macros
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r--drivers/media/dvb/frontends/tda18271.c76
1 files changed, 35 insertions, 41 deletions
diff --git a/drivers/media/dvb/frontends/tda18271.c b/drivers/media/dvb/frontends/tda18271.c
index 3395f2bda498..1b9c143888ea 100644
--- a/drivers/media/dvb/frontends/tda18271.c
+++ b/drivers/media/dvb/frontends/tda18271.c
@@ -28,13 +28,9 @@ static int debug;
28module_param(debug, int, 0644); 28module_param(debug, int, 0644);
29MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off)."); 29MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
30 30
31#define tuner_dbg(fmt, arg...) do {\ 31#define dprintk(level, fmt, arg...) do {\
32 if (debug > 0) \ 32 if (debug >= level) \
33 printk(KERN_DEBUG fmt, ##arg); } while (0) 33 printk(KERN_DEBUG "%s: " fmt, __FUNCTION__, ##arg); } while (0)
34
35#define tuner_extra_dbg(fmt, arg...) do {\
36 if (debug > 1) \
37 printk(KERN_DEBUG fmt, ##arg); } while (0)
38 34
39#define R_ID 0x00 /* ID byte */ 35#define R_ID 0x00 /* ID byte */
40#define R_TM 0x01 /* Thermo byte */ 36#define R_TM 0x01 /* Thermo byte */
@@ -335,23 +331,23 @@ static void tda18271_dump_regs(struct dvb_frontend *fe)
335 struct tda18271_priv *priv = fe->tuner_priv; 331 struct tda18271_priv *priv = fe->tuner_priv;
336 unsigned char *regs = priv->tda18271_regs; 332 unsigned char *regs = priv->tda18271_regs;
337 333
338 tuner_dbg("=== TDA18271 REG DUMP ===\n"); 334 dprintk(1, "=== TDA18271 REG DUMP ===\n");
339 tuner_dbg("ID_BYTE = 0x%x\n", 0xff & regs[R_ID]); 335 dprintk(1, "ID_BYTE = 0x%x\n", 0xff & regs[R_ID]);
340 tuner_dbg("THERMO_BYTE = 0x%x\n", 0xff & regs[R_TM]); 336 dprintk(1, "THERMO_BYTE = 0x%x\n", 0xff & regs[R_TM]);
341 tuner_dbg("POWER_LEVEL_BYTE = 0x%x\n", 0xff & regs[R_PL]); 337 dprintk(1, "POWER_LEVEL_BYTE = 0x%x\n", 0xff & regs[R_PL]);
342 tuner_dbg("EASY_PROG_BYTE_1 = 0x%x\n", 0xff & regs[R_EP1]); 338 dprintk(1, "EASY_PROG_BYTE_1 = 0x%x\n", 0xff & regs[R_EP1]);
343 tuner_dbg("EASY_PROG_BYTE_2 = 0x%x\n", 0xff & regs[R_EP2]); 339 dprintk(1, "EASY_PROG_BYTE_2 = 0x%x\n", 0xff & regs[R_EP2]);
344 tuner_dbg("EASY_PROG_BYTE_3 = 0x%x\n", 0xff & regs[R_EP3]); 340 dprintk(1, "EASY_PROG_BYTE_3 = 0x%x\n", 0xff & regs[R_EP3]);
345 tuner_dbg("EASY_PROG_BYTE_4 = 0x%x\n", 0xff & regs[R_EP4]); 341 dprintk(1, "EASY_PROG_BYTE_4 = 0x%x\n", 0xff & regs[R_EP4]);
346 tuner_dbg("EASY_PROG_BYTE_5 = 0x%x\n", 0xff & regs[R_EP5]); 342 dprintk(1, "EASY_PROG_BYTE_5 = 0x%x\n", 0xff & regs[R_EP5]);
347 tuner_dbg("CAL_POST_DIV_BYTE = 0x%x\n", 0xff & regs[R_CPD]); 343 dprintk(1, "CAL_POST_DIV_BYTE = 0x%x\n", 0xff & regs[R_CPD]);
348 tuner_dbg("CAL_DIV_BYTE_1 = 0x%x\n", 0xff & regs[R_CD1]); 344 dprintk(1, "CAL_DIV_BYTE_1 = 0x%x\n", 0xff & regs[R_CD1]);
349 tuner_dbg("CAL_DIV_BYTE_2 = 0x%x\n", 0xff & regs[R_CD2]); 345 dprintk(1, "CAL_DIV_BYTE_2 = 0x%x\n", 0xff & regs[R_CD2]);
350 tuner_dbg("CAL_DIV_BYTE_3 = 0x%x\n", 0xff & regs[R_CD3]); 346 dprintk(1, "CAL_DIV_BYTE_3 = 0x%x\n", 0xff & regs[R_CD3]);
351 tuner_dbg("MAIN_POST_DIV_BYTE = 0x%x\n", 0xff & regs[R_MPD]); 347 dprintk(1, "MAIN_POST_DIV_BYTE = 0x%x\n", 0xff & regs[R_MPD]);
352 tuner_dbg("MAIN_DIV_BYTE_1 = 0x%x\n", 0xff & regs[R_MD1]); 348 dprintk(1, "MAIN_DIV_BYTE_1 = 0x%x\n", 0xff & regs[R_MD1]);
353 tuner_dbg("MAIN_DIV_BYTE_2 = 0x%x\n", 0xff & regs[R_MD2]); 349 dprintk(1, "MAIN_DIV_BYTE_2 = 0x%x\n", 0xff & regs[R_MD2]);
354 tuner_dbg("MAIN_DIV_BYTE_3 = 0x%x\n", 0xff & regs[R_MD3]); 350 dprintk(1, "MAIN_DIV_BYTE_3 = 0x%x\n", 0xff & regs[R_MD3]);
355} 351}
356 352
357static void tda18271_read_regs(struct dvb_frontend *fe) 353static void tda18271_read_regs(struct dvb_frontend *fe)
@@ -614,7 +610,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
614 int i; 610 int i;
615 611
616 612
617 tuner_dbg("%s: freq = %d, ifc = %d\n", __FUNCTION__, freq, ifc); 613 dprintk(1, "freq = %d, ifc = %d\n", freq, ifc);
618 614
619 tda18271_init_regs(fe); 615 tda18271_init_regs(fe);
620 /* RF tracking filter calibration */ 616 /* RF tracking filter calibration */
@@ -626,8 +622,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
626 break; 622 break;
627 i++; 623 i++;
628 } 624 }
629 tuner_extra_dbg("bp filter = 0x%x, i = %d\n", 625 dprintk(2, "bp filter = 0x%x, i = %d\n", tda18271_bp_filter[i].val, i);
630 tda18271_bp_filter[i].val, i);
631 626
632 regs[R_EP1] &= ~0x07; /* clear bp filter bits */ 627 regs[R_EP1] &= ~0x07; /* clear bp filter bits */
633 regs[R_EP1] |= tda18271_bp_filter[i].val; 628 regs[R_EP1] |= tda18271_bp_filter[i].val;
@@ -666,8 +661,8 @@ static int tda18271_tune(struct dvb_frontend *fe,
666 break; 661 break;
667 i++; 662 i++;
668 } 663 }
669 tuner_extra_dbg("cal pll, pd = 0x%x, d = 0x%x, i = %d\n", 664 dprintk(2, "cal pll, pd = 0x%x, d = 0x%x, i = %d\n",
670 tda18271_cal_pll[i].pd, tda18271_cal_pll[i].d, i); 665 tda18271_cal_pll[i].pd, tda18271_cal_pll[i].d, i);
671 666
672 regs[R_CPD] = tda18271_cal_pll[i].pd; 667 regs[R_CPD] = tda18271_cal_pll[i].pd;
673 668
@@ -693,8 +688,8 @@ static int tda18271_tune(struct dvb_frontend *fe,
693 break; 688 break;
694 i++; 689 i++;
695 } 690 }
696 tuner_extra_dbg("main pll, pd = 0x%x, d = 0x%x, i = %d\n", 691 dprintk(2, "main pll, pd = 0x%x, d = 0x%x, i = %d\n",
697 tda18271_main_pll[i].pd, tda18271_main_pll[i].d, i); 692 tda18271_main_pll[i].pd, tda18271_main_pll[i].d, i);
698 693
699 regs[R_MPD] = (0x7f & tda18271_main_pll[i].pd); 694 regs[R_MPD] = (0x7f & tda18271_main_pll[i].pd);
700 695
@@ -722,7 +717,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
722 break; 717 break;
723 i++; 718 i++;
724 } 719 }
725 tuner_extra_dbg("km = 0x%x, i = %d\n", tda18271_km[i].val, i); 720 dprintk(2, "km = 0x%x, i = %d\n", tda18271_km[i].val, i);
726 721
727 regs[R_EB13] &= 0x83; 722 regs[R_EB13] &= 0x83;
728 regs[R_EB13] |= tda18271_km[i].val; 723 regs[R_EB13] |= tda18271_km[i].val;
@@ -735,8 +730,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
735 break; 730 break;
736 i++; 731 i++;
737 } 732 }
738 tuner_extra_dbg("rf band = 0x%x, i = %d\n", 733 dprintk(2, "rf band = 0x%x, i = %d\n", tda18271_rf_band[i].val, i);
739 tda18271_rf_band[i].val, i);
740 734
741 regs[R_EP2] &= ~0xe0; /* clear rf band bits */ 735 regs[R_EP2] &= ~0xe0; /* clear rf band bits */
742 regs[R_EP2] |= (tda18271_rf_band[i].val << 5); 736 regs[R_EP2] |= (tda18271_rf_band[i].val << 5);
@@ -748,8 +742,8 @@ static int tda18271_tune(struct dvb_frontend *fe,
748 break; 742 break;
749 i++; 743 i++;
750 } 744 }
751 tuner_extra_dbg("gain taper = 0x%x, i = %d\n", 745 dprintk(2, "gain taper = 0x%x, i = %d\n",
752 tda18271_gain_taper[i].val, i); 746 tda18271_gain_taper[i].val, i);
753 747
754 regs[R_EP2] &= ~0x1f; /* clear gain taper bits */ 748 regs[R_EP2] &= ~0x1f; /* clear gain taper bits */
755 regs[R_EP2] |= tda18271_gain_taper[i].val; 749 regs[R_EP2] |= tda18271_gain_taper[i].val;
@@ -783,7 +777,7 @@ static int tda18271_tune(struct dvb_frontend *fe,
783 break; 777 break;
784 i++; 778 i++;
785 } 779 }
786 tuner_extra_dbg("rf cal = 0x%x, i = %d\n", tda18271_rf_cal[i].val, i); 780 dprintk(2, "rf cal = 0x%x, i = %d\n", tda18271_rf_cal[i].val, i);
787 781
788 /* VHF_Low band only */ 782 /* VHF_Low band only */
789 if (tda18271_rf_cal[i].rfmax != 0) { 783 if (tda18271_rf_cal[i].rfmax != 0) {
@@ -847,8 +841,8 @@ static int tda18271_tune(struct dvb_frontend *fe,
847 break; 841 break;
848 i++; 842 i++;
849 } 843 }
850 tuner_extra_dbg("main pll, pd = 0x%x, d = 0x%x, i = %d\n", 844 dprintk(2, "main pll, pd = 0x%x, d = 0x%x, i = %d\n",
851 tda18271_main_pll[i].pd, tda18271_main_pll[i].d, i); 845 tda18271_main_pll[i].pd, tda18271_main_pll[i].d, i);
852 846
853 regs[R_MPD] = (0x7f & tda18271_main_pll[i].pd); 847 regs[R_MPD] = (0x7f & tda18271_main_pll[i].pd);
854 switch (priv->mode) { 848 switch (priv->mode) {
@@ -979,7 +973,7 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe,
979 if (params->mode == V4L2_TUNER_RADIO) 973 if (params->mode == V4L2_TUNER_RADIO)
980 sgIF = 88; /* if frequency is 5.5 MHz */ 974 sgIF = 88; /* if frequency is 5.5 MHz */
981 975
982 tuner_dbg("setting tda18271 to system %s\n", mode); 976 dprintk(1, "setting tda18271 to system %s\n", mode);
983 977
984 return tda18271_tune(fe, sgIF * 62500, params->frequency * 62500, 978 return tda18271_tune(fe, sgIF * 62500, params->frequency * 62500,
985 0, std); 979 0, std);
@@ -1025,7 +1019,7 @@ struct dvb_frontend *tda18271_attach(struct dvb_frontend *fe, u8 addr,
1025{ 1019{
1026 struct tda18271_priv *priv = NULL; 1020 struct tda18271_priv *priv = NULL;
1027 1021
1028 tuner_dbg("%s:\n", __FUNCTION__); 1022 dprintk(1, "@ 0x%x\n", addr);
1029 priv = kzalloc(sizeof(struct tda18271_priv), GFP_KERNEL); 1023 priv = kzalloc(sizeof(struct tda18271_priv), GFP_KERNEL);
1030 if (priv == NULL) 1024 if (priv == NULL)
1031 return NULL; 1025 return NULL;