diff options
author | Michael Krufky <mkrufky@linuxtv.org> | 2007-12-25 13:10:11 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-01-25 16:04:25 -0500 |
commit | 182519f4c99f73f376323580dda494d986b4760b (patch) | |
tree | 1104af036e85295101407e0b309cae1f36bd663b /drivers/media/dvb | |
parent | 2f27dfc98cc0a183be9e3c2fc0da0450b85e5fde (diff) |
V4L/DVB (6927): tda18271: improve printk macros
Signed-off-by: Michael Krufky <mkrufky@linuxtv.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/dvb')
-rw-r--r-- | drivers/media/dvb/frontends/tda18271-fe.c | 58 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda18271-priv.h | 20 | ||||
-rw-r--r-- | drivers/media/dvb/frontends/tda18271-tables.c | 8 |
3 files changed, 44 insertions, 42 deletions
diff --git a/drivers/media/dvb/frontends/tda18271-fe.c b/drivers/media/dvb/frontends/tda18271-fe.c index 72e256ebeb0f..8146c4e7ee7b 100644 --- a/drivers/media/dvb/frontends/tda18271-fe.c +++ b/drivers/media/dvb/frontends/tda18271-fe.c | |||
@@ -76,23 +76,23 @@ static void tda18271_dump_regs(struct dvb_frontend *fe) | |||
76 | struct tda18271_priv *priv = fe->tuner_priv; | 76 | struct tda18271_priv *priv = fe->tuner_priv; |
77 | unsigned char *regs = priv->tda18271_regs; | 77 | unsigned char *regs = priv->tda18271_regs; |
78 | 78 | ||
79 | dbg_reg("=== TDA18271 REG DUMP ===\n"); | 79 | tda_reg("=== TDA18271 REG DUMP ===\n"); |
80 | dbg_reg("ID_BYTE = 0x%02x\n", 0xff & regs[R_ID]); | 80 | tda_reg("ID_BYTE = 0x%02x\n", 0xff & regs[R_ID]); |
81 | dbg_reg("THERMO_BYTE = 0x%02x\n", 0xff & regs[R_TM]); | 81 | tda_reg("THERMO_BYTE = 0x%02x\n", 0xff & regs[R_TM]); |
82 | dbg_reg("POWER_LEVEL_BYTE = 0x%02x\n", 0xff & regs[R_PL]); | 82 | tda_reg("POWER_LEVEL_BYTE = 0x%02x\n", 0xff & regs[R_PL]); |
83 | dbg_reg("EASY_PROG_BYTE_1 = 0x%02x\n", 0xff & regs[R_EP1]); | 83 | tda_reg("EASY_PROG_BYTE_1 = 0x%02x\n", 0xff & regs[R_EP1]); |
84 | dbg_reg("EASY_PROG_BYTE_2 = 0x%02x\n", 0xff & regs[R_EP2]); | 84 | tda_reg("EASY_PROG_BYTE_2 = 0x%02x\n", 0xff & regs[R_EP2]); |
85 | dbg_reg("EASY_PROG_BYTE_3 = 0x%02x\n", 0xff & regs[R_EP3]); | 85 | tda_reg("EASY_PROG_BYTE_3 = 0x%02x\n", 0xff & regs[R_EP3]); |
86 | dbg_reg("EASY_PROG_BYTE_4 = 0x%02x\n", 0xff & regs[R_EP4]); | 86 | tda_reg("EASY_PROG_BYTE_4 = 0x%02x\n", 0xff & regs[R_EP4]); |
87 | dbg_reg("EASY_PROG_BYTE_5 = 0x%02x\n", 0xff & regs[R_EP5]); | 87 | tda_reg("EASY_PROG_BYTE_5 = 0x%02x\n", 0xff & regs[R_EP5]); |
88 | dbg_reg("CAL_POST_DIV_BYTE = 0x%02x\n", 0xff & regs[R_CPD]); | 88 | tda_reg("CAL_POST_DIV_BYTE = 0x%02x\n", 0xff & regs[R_CPD]); |
89 | dbg_reg("CAL_DIV_BYTE_1 = 0x%02x\n", 0xff & regs[R_CD1]); | 89 | tda_reg("CAL_DIV_BYTE_1 = 0x%02x\n", 0xff & regs[R_CD1]); |
90 | dbg_reg("CAL_DIV_BYTE_2 = 0x%02x\n", 0xff & regs[R_CD2]); | 90 | tda_reg("CAL_DIV_BYTE_2 = 0x%02x\n", 0xff & regs[R_CD2]); |
91 | dbg_reg("CAL_DIV_BYTE_3 = 0x%02x\n", 0xff & regs[R_CD3]); | 91 | tda_reg("CAL_DIV_BYTE_3 = 0x%02x\n", 0xff & regs[R_CD3]); |
92 | dbg_reg("MAIN_POST_DIV_BYTE = 0x%02x\n", 0xff & regs[R_MPD]); | 92 | tda_reg("MAIN_POST_DIV_BYTE = 0x%02x\n", 0xff & regs[R_MPD]); |
93 | dbg_reg("MAIN_DIV_BYTE_1 = 0x%02x\n", 0xff & regs[R_MD1]); | 93 | tda_reg("MAIN_DIV_BYTE_1 = 0x%02x\n", 0xff & regs[R_MD1]); |
94 | dbg_reg("MAIN_DIV_BYTE_2 = 0x%02x\n", 0xff & regs[R_MD2]); | 94 | tda_reg("MAIN_DIV_BYTE_2 = 0x%02x\n", 0xff & regs[R_MD2]); |
95 | dbg_reg("MAIN_DIV_BYTE_3 = 0x%02x\n", 0xff & regs[R_MD3]); | 95 | tda_reg("MAIN_DIV_BYTE_3 = 0x%02x\n", 0xff & regs[R_MD3]); |
96 | } | 96 | } |
97 | 97 | ||
98 | static void tda18271_read_regs(struct dvb_frontend *fe) | 98 | static void tda18271_read_regs(struct dvb_frontend *fe) |
@@ -116,8 +116,7 @@ static void tda18271_read_regs(struct dvb_frontend *fe) | |||
116 | tda18271_i2c_gate_ctrl(fe, 0); | 116 | tda18271_i2c_gate_ctrl(fe, 0); |
117 | 117 | ||
118 | if (ret != 2) | 118 | if (ret != 2) |
119 | printk("ERROR: %s: i2c_transfer returned: %d\n", | 119 | tda_err("ERROR: i2c_transfer returned: %d\n", ret); |
120 | __FUNCTION__, ret); | ||
121 | 120 | ||
122 | if (tda18271_debug & DBG_REG) | 121 | if (tda18271_debug & DBG_REG) |
123 | tda18271_dump_regs(fe); | 122 | tda18271_dump_regs(fe); |
@@ -147,8 +146,7 @@ static void tda18271_write_regs(struct dvb_frontend *fe, int idx, int len) | |||
147 | tda18271_i2c_gate_ctrl(fe, 0); | 146 | tda18271_i2c_gate_ctrl(fe, 0); |
148 | 147 | ||
149 | if (ret != 1) | 148 | if (ret != 1) |
150 | printk(KERN_WARNING "ERROR: %s: i2c_transfer returned: %d\n", | 149 | tda_err("ERROR: i2c_transfer returned: %d\n", ret); |
151 | __FUNCTION__, ret); | ||
152 | } | 150 | } |
153 | 151 | ||
154 | /*---------------------------------------------------------------------*/ | 152 | /*---------------------------------------------------------------------*/ |
@@ -158,7 +156,8 @@ static int tda18271_init_regs(struct dvb_frontend *fe) | |||
158 | struct tda18271_priv *priv = fe->tuner_priv; | 156 | struct tda18271_priv *priv = fe->tuner_priv; |
159 | unsigned char *regs = priv->tda18271_regs; | 157 | unsigned char *regs = priv->tda18271_regs; |
160 | 158 | ||
161 | printk(KERN_INFO "tda18271: initializing registers\n"); | 159 | tda_dbg("initializing registers for device @ %d-%04x\n", |
160 | i2c_adapter_id(priv->i2c_adap), priv->i2c_addr); | ||
162 | 161 | ||
163 | /* initialize registers */ | 162 | /* initialize registers */ |
164 | regs[R_ID] = 0x83; | 163 | regs[R_ID] = 0x83; |
@@ -417,7 +416,7 @@ static int tda18271_tune(struct dvb_frontend *fe, | |||
417 | 416 | ||
418 | tda18271_init(fe); | 417 | tda18271_init(fe); |
419 | 418 | ||
420 | dbg_info("freq = %d, ifc = %d\n", freq, ifc); | 419 | tda_dbg("freq = %d, ifc = %d\n", freq, ifc); |
421 | 420 | ||
422 | /* RF tracking filter calibration */ | 421 | /* RF tracking filter calibration */ |
423 | 422 | ||
@@ -602,8 +601,7 @@ static int tda18271_set_params(struct dvb_frontend *fe, | |||
602 | sgIF = 4000000; | 601 | sgIF = 4000000; |
603 | break; | 602 | break; |
604 | default: | 603 | default: |
605 | printk(KERN_WARNING "%s: modulation not set!\n", | 604 | tda_warn("modulation not set!\n"); |
606 | __FUNCTION__); | ||
607 | return -EINVAL; | 605 | return -EINVAL; |
608 | } | 606 | } |
609 | #if 0 | 607 | #if 0 |
@@ -629,13 +627,11 @@ static int tda18271_set_params(struct dvb_frontend *fe, | |||
629 | sgIF = 4300000; | 627 | sgIF = 4300000; |
630 | break; | 628 | break; |
631 | default: | 629 | default: |
632 | printk(KERN_WARNING "%s: bandwidth not set!\n", | 630 | tda_warn("bandwidth not set!\n"); |
633 | __FUNCTION__); | ||
634 | return -EINVAL; | 631 | return -EINVAL; |
635 | } | 632 | } |
636 | } else { | 633 | } else { |
637 | printk(KERN_WARNING "%s: modulation type not supported!\n", | 634 | tda_warn("modulation type not supported!\n"); |
638 | __FUNCTION__); | ||
639 | return -EINVAL; | 635 | return -EINVAL; |
640 | } | 636 | } |
641 | 637 | ||
@@ -690,7 +686,7 @@ static int tda18271_set_analog_params(struct dvb_frontend *fe, | |||
690 | if (params->mode == V4L2_TUNER_RADIO) | 686 | if (params->mode == V4L2_TUNER_RADIO) |
691 | sgIF = 88; /* if frequency is 5.5 MHz */ | 687 | sgIF = 88; /* if frequency is 5.5 MHz */ |
692 | 688 | ||
693 | dbg_info("setting tda18271 to system %s\n", mode); | 689 | tda_dbg("setting tda18271 to system %s\n", mode); |
694 | 690 | ||
695 | return tda18271_tune(fe, sgIF * 62500, params->frequency * 62500, | 691 | return tda18271_tune(fe, sgIF * 62500, params->frequency * 62500, |
696 | 0, std); | 692 | 0, std); |
@@ -740,7 +736,7 @@ static int tda18271_get_id(struct dvb_frontend *fe) | |||
740 | break; | 736 | break; |
741 | } | 737 | } |
742 | 738 | ||
743 | dbg_info("%s detected @ %d-%04x%s\n", name, | 739 | tda_info("%s detected @ %d-%04x%s\n", name, |
744 | i2c_adapter_id(priv->i2c_adap), priv->i2c_addr, | 740 | i2c_adapter_id(priv->i2c_adap), priv->i2c_addr, |
745 | (0 == ret) ? "" : ", device not supported."); | 741 | (0 == ret) ? "" : ", device not supported."); |
746 | 742 | ||
diff --git a/drivers/media/dvb/frontends/tda18271-priv.h b/drivers/media/dvb/frontends/tda18271-priv.h index b08bf08aa88f..912b81e0c765 100644 --- a/drivers/media/dvb/frontends/tda18271-priv.h +++ b/drivers/media/dvb/frontends/tda18271-priv.h | |||
@@ -90,17 +90,23 @@ struct tda18271_priv { | |||
90 | 90 | ||
91 | extern int tda18271_debug; | 91 | extern int tda18271_debug; |
92 | 92 | ||
93 | #define dprintk(level, fmt, arg...) do {\ | ||
94 | if (tda18271_debug & level) \ | ||
95 | printk(KERN_DEBUG "%s: " fmt, __FUNCTION__, ##arg); } while (0) | ||
96 | |||
97 | #define DBG_INFO 1 | 93 | #define DBG_INFO 1 |
98 | #define DBG_MAP 2 | 94 | #define DBG_MAP 2 |
99 | #define DBG_REG 4 | 95 | #define DBG_REG 4 |
100 | 96 | ||
101 | #define dbg_info(fmt, arg...) dprintk(DBG_INFO, fmt, ##arg) | 97 | #define tda_printk(kern, fmt, arg...) \ |
102 | #define dbg_map(fmt, arg...) dprintk(DBG_MAP, fmt, ##arg) | 98 | printk(kern "%s: " fmt, __FUNCTION__, ##arg) |
103 | #define dbg_reg(fmt, arg...) dprintk(DBG_REG, fmt, ##arg) | 99 | |
100 | #define dprintk(kern, lvl, fmt, arg...) do {\ | ||
101 | if (tda18271_debug & lvl) \ | ||
102 | tda_printk(kern, fmt, ##arg); } while (0) | ||
103 | |||
104 | #define tda_info(fmt, arg...) printk(KERN_INFO fmt, ##arg) | ||
105 | #define tda_warn(fmt, arg...) tda_printk(KERN_WARNING, fmt, ##arg) | ||
106 | #define tda_err(fmt, arg...) tda_printk(KERN_ERR, fmt, ##arg) | ||
107 | #define tda_dbg(fmt, arg...) dprintk(KERN_DEBUG, DBG_INFO, fmt, ##arg) | ||
108 | #define tda_map(fmt, arg...) dprintk(KERN_DEBUG, DBG_MAP, fmt, ##arg) | ||
109 | #define tda_reg(fmt, arg...) dprintk(KERN_DEBUG, DBG_REG, fmt, ##arg) | ||
104 | 110 | ||
105 | /*---------------------------------------------------------------------*/ | 111 | /*---------------------------------------------------------------------*/ |
106 | 112 | ||
diff --git a/drivers/media/dvb/frontends/tda18271-tables.c b/drivers/media/dvb/frontends/tda18271-tables.c index 8990bef0cf7e..e10a93bf12c1 100644 --- a/drivers/media/dvb/frontends/tda18271-tables.c +++ b/drivers/media/dvb/frontends/tda18271-tables.c | |||
@@ -290,7 +290,7 @@ int tda18271_lookup_pll_map(enum tda18271_map_type map_type, | |||
290 | } | 290 | } |
291 | 291 | ||
292 | if (!map) { | 292 | if (!map) { |
293 | dbg_info("%s map is not set!\n", map_name); | 293 | tda_warn("%s map is not set!\n", map_name); |
294 | return -EINVAL; | 294 | return -EINVAL; |
295 | } | 295 | } |
296 | 296 | ||
@@ -302,7 +302,7 @@ int tda18271_lookup_pll_map(enum tda18271_map_type map_type, | |||
302 | *post_div = map[i].pd; | 302 | *post_div = map[i].pd; |
303 | *div = map[i].d; | 303 | *div = map[i].d; |
304 | 304 | ||
305 | dbg_map("%s: post div = 0x%02x, div = 0x%02x\n", | 305 | tda_map("%s: post div = 0x%02x, div = 0x%02x\n", |
306 | map_name, *post_div, *div); | 306 | map_name, *post_div, *div); |
307 | 307 | ||
308 | return 0; | 308 | return 0; |
@@ -346,7 +346,7 @@ int tda18271_lookup_map(enum tda18271_map_type map_type, u32 *freq, u8 *val) | |||
346 | } | 346 | } |
347 | 347 | ||
348 | if (!map) { | 348 | if (!map) { |
349 | dbg_info("%s map is not set!\n", map_name); | 349 | tda_warn("%s map is not set!\n", map_name); |
350 | return -EINVAL; | 350 | return -EINVAL; |
351 | } | 351 | } |
352 | 352 | ||
@@ -357,7 +357,7 @@ int tda18271_lookup_map(enum tda18271_map_type map_type, u32 *freq, u8 *val) | |||
357 | } | 357 | } |
358 | *val = map[i].val; | 358 | *val = map[i].val; |
359 | 359 | ||
360 | dbg_map("%s: 0x%02x\n", map_name, *val); | 360 | tda_map("%s: 0x%02x\n", map_name, *val); |
361 | 361 | ||
362 | return 0; | 362 | return 0; |
363 | } | 363 | } |