aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAntti Palosaari <crope@iki.fi>2012-09-12 19:23:46 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-09-23 19:11:55 -0400
commita44850df5a2776f7785abc95051a161e39f8e541 (patch)
treea5caa6b51a24c01528baf173101feacdde3e6ee5
parent0d2d603124fe08a226d348495f345acd9a399214 (diff)
[media] hd29l2: use Kernel dev_foo() logging
Signed-off-by: Antti Palosaari <crope@iki.fi> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/dvb-frontends/hd29l2.c75
-rw-r--r--drivers/media/dvb-frontends/hd29l2.h2
-rw-r--r--drivers/media/dvb-frontends/hd29l2_priv.h13
3 files changed, 41 insertions, 49 deletions
diff --git a/drivers/media/dvb-frontends/hd29l2.c b/drivers/media/dvb-frontends/hd29l2.c
index a00318190837..d7b9d549156d 100644
--- a/drivers/media/dvb-frontends/hd29l2.c
+++ b/drivers/media/dvb-frontends/hd29l2.c
@@ -22,10 +22,6 @@
22 22
23#include "hd29l2_priv.h" 23#include "hd29l2_priv.h"
24 24
25int hd29l2_debug;
26module_param_named(debug, hd29l2_debug, int, 0644);
27MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
28
29/* write multiple registers */ 25/* write multiple registers */
30static int hd29l2_wr_regs(struct hd29l2_priv *priv, u8 reg, u8 *val, int len) 26static int hd29l2_wr_regs(struct hd29l2_priv *priv, u8 reg, u8 *val, int len)
31{ 27{
@@ -48,7 +44,9 @@ static int hd29l2_wr_regs(struct hd29l2_priv *priv, u8 reg, u8 *val, int len)
48 if (ret == 1) { 44 if (ret == 1) {
49 ret = 0; 45 ret = 0;
50 } else { 46 } else {
51 warn("i2c wr failed=%d reg=%02x len=%d", ret, reg, len); 47 dev_warn(&priv->i2c->dev,
48 "%s: i2c wr failed=%d reg=%02x len=%d\n",
49 KBUILD_MODNAME, ret, reg, len);
52 ret = -EREMOTEIO; 50 ret = -EREMOTEIO;
53 } 51 }
54 52
@@ -78,7 +76,9 @@ static int hd29l2_rd_regs(struct hd29l2_priv *priv, u8 reg, u8 *val, int len)
78 if (ret == 2) { 76 if (ret == 2) {
79 ret = 0; 77 ret = 0;
80 } else { 78 } else {
81 warn("i2c rd failed=%d reg=%02x len=%d", ret, reg, len); 79 dev_warn(&priv->i2c->dev,
80 "%s: i2c rd failed=%d reg=%02x len=%d\n",
81 KBUILD_MODNAME, ret, reg, len);
82 ret = -EREMOTEIO; 82 ret = -EREMOTEIO;
83 } 83 }
84 84
@@ -160,7 +160,7 @@ static int hd29l2_soft_reset(struct hd29l2_priv *priv)
160 160
161 return 0; 161 return 0;
162err: 162err:
163 dbg("%s: failed=%d", __func__, ret); 163 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
164 return ret; 164 return ret;
165} 165}
166 166
@@ -170,7 +170,7 @@ static int hd29l2_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
170 struct hd29l2_priv *priv = fe->demodulator_priv; 170 struct hd29l2_priv *priv = fe->demodulator_priv;
171 u8 tmp; 171 u8 tmp;
172 172
173 dbg("%s: enable=%d", __func__, enable); 173 dev_dbg(&priv->i2c->dev, "%s: enable=%d\n", __func__, enable);
174 174
175 /* set tuner address for demod */ 175 /* set tuner address for demod */
176 if (!priv->tuner_i2c_addr_programmed && enable) { 176 if (!priv->tuner_i2c_addr_programmed && enable) {
@@ -199,11 +199,11 @@ static int hd29l2_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
199 usleep_range(5000, 10000); 199 usleep_range(5000, 10000);
200 } 200 }
201 201
202 dbg("%s: loop=%d", __func__, i); 202 dev_dbg(&priv->i2c->dev, "%s: loop=%d\n", __func__, i);
203 203
204 return ret; 204 return ret;
205err: 205err:
206 dbg("%s: failed=%d", __func__, ret); 206 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
207 return ret; 207 return ret;
208} 208}
209 209
@@ -238,7 +238,7 @@ static int hd29l2_read_status(struct dvb_frontend *fe, fe_status_t *status)
238 238
239 return 0; 239 return 0;
240err: 240err:
241 dbg("%s: failed=%d", __func__, ret); 241 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
242 return ret; 242 return ret;
243} 243}
244 244
@@ -270,7 +270,7 @@ static int hd29l2_read_snr(struct dvb_frontend *fe, u16 *snr)
270 270
271 return 0; 271 return 0;
272err: 272err:
273 dbg("%s: failed=%d", __func__, ret); 273 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
274 return ret; 274 return ret;
275} 275}
276 276
@@ -295,7 +295,7 @@ static int hd29l2_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
295 295
296 return 0; 296 return 0;
297err: 297err:
298 dbg("%s: failed=%d", __func__, ret); 298 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
299 return ret; 299 return ret;
300} 300}
301 301
@@ -322,7 +322,7 @@ static int hd29l2_read_ber(struct dvb_frontend *fe, u32 *ber)
322 322
323 return 0; 323 return 0;
324err: 324err:
325 dbg("%s: failed=%d", __func__, ret); 325 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
326 return ret; 326 return ret;
327} 327}
328 328
@@ -344,11 +344,12 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
344 u32 if_freq, if_ctl; 344 u32 if_freq, if_ctl;
345 bool auto_mode; 345 bool auto_mode;
346 346
347 dbg("%s: delivery_system=%d frequency=%d bandwidth_hz=%d " \ 347 dev_dbg(&priv->i2c->dev, "%s: delivery_system=%d frequency=%d " \
348 "modulation=%d inversion=%d fec_inner=%d guard_interval=%d", 348 "bandwidth_hz=%d modulation=%d inversion=%d " \
349 __func__, 349 "fec_inner=%d guard_interval=%d\n", __func__,
350 c->delivery_system, c->frequency, c->bandwidth_hz, 350 c->delivery_system, c->frequency, c->bandwidth_hz,
351 c->modulation, c->inversion, c->fec_inner, c->guard_interval); 351 c->modulation, c->inversion, c->fec_inner,
352 c->guard_interval);
352 353
353 /* as for now we detect always params automatically */ 354 /* as for now we detect always params automatically */
354 auto_mode = true; 355 auto_mode = true;
@@ -394,7 +395,8 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
394 if (ret) 395 if (ret)
395 goto err; 396 goto err;
396 397
397 dbg("%s: if_freq=%d if_ctl=%x", __func__, if_freq, if_ctl); 398 dev_dbg(&priv->i2c->dev, "%s: if_freq=%d if_ctl=%x\n",
399 __func__, if_freq, if_ctl);
398 400
399 if (auto_mode) { 401 if (auto_mode) {
400 /* 402 /*
@@ -437,7 +439,7 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
437 break; 439 break;
438 } 440 }
439 441
440 dbg("%s: loop=%d", __func__, i); 442 dev_dbg(&priv->i2c->dev, "%s: loop=%d\n", __func__, i);
441 443
442 if (i == 0) 444 if (i == 0)
443 /* detection failed */ 445 /* detection failed */
@@ -477,7 +479,8 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
477 /* ensure modulation validy */ 479 /* ensure modulation validy */
478 /* 0=QAM4_NR, 1=QAM4, 2=QAM16, 3=QAM32, 4=QAM64 */ 480 /* 0=QAM4_NR, 1=QAM4, 2=QAM16, 3=QAM32, 4=QAM64 */
479 if (modulation > (ARRAY_SIZE(reg_mod_vals_tab[0].val) - 1)) { 481 if (modulation > (ARRAY_SIZE(reg_mod_vals_tab[0].val) - 1)) {
480 dbg("%s: modulation=%d not valid", __func__, modulation); 482 dev_dbg(&priv->i2c->dev, "%s: modulation=%d not valid\n",
483 __func__, modulation);
481 goto err; 484 goto err;
482 } 485 }
483 486
@@ -499,12 +502,14 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
499 if (ret) 502 if (ret)
500 goto err; 503 goto err;
501 504
502 dbg("%s: modulation=%d guard_interval=%d carrier=%d", 505 dev_dbg(&priv->i2c->dev,
503 __func__, modulation, guard_interval, carrier); 506 "%s: modulation=%d guard_interval=%d carrier=%d\n",
507 __func__, modulation, guard_interval, carrier);
504 508
505 if ((carrier == HD29L2_CARRIER_MULTI) && (modulation == HD29L2_QAM64) && 509 if ((carrier == HD29L2_CARRIER_MULTI) && (modulation == HD29L2_QAM64) &&
506 (guard_interval == HD29L2_PN945)) { 510 (guard_interval == HD29L2_PN945)) {
507 dbg("%s: C=3780 && QAM64 && PN945", __func__); 511 dev_dbg(&priv->i2c->dev, "%s: C=3780 && QAM64 && PN945\n",
512 __func__);
508 513
509 ret = hd29l2_wr_reg(priv, 0x42, 0x33); 514 ret = hd29l2_wr_reg(priv, 0x42, 0x33);
510 if (ret) 515 if (ret)
@@ -535,14 +540,14 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
535 break; 540 break;
536 } 541 }
537 542
538 dbg("%s: loop=%d", __func__, i); 543 dev_dbg(&priv->i2c->dev, "%s: loop=%d\n", __func__, i);
539 544
540 if (i == 0) 545 if (i == 0)
541 return DVBFE_ALGO_SEARCH_AGAIN; 546 return DVBFE_ALGO_SEARCH_AGAIN;
542 547
543 return DVBFE_ALGO_SEARCH_SUCCESS; 548 return DVBFE_ALGO_SEARCH_SUCCESS;
544err: 549err:
545 dbg("%s: failed=%d", __func__, ret); 550 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
546 return DVBFE_ALGO_SEARCH_ERROR; 551 return DVBFE_ALGO_SEARCH_ERROR;
547} 552}
548 553
@@ -704,14 +709,14 @@ static int hd29l2_get_frontend(struct dvb_frontend *fe)
704 709
705 if_ctl = (buf[0] << 16) | ((buf[1] - 7) << 8) | buf[2]; 710 if_ctl = (buf[0] << 16) | ((buf[1] - 7) << 8) | buf[2];
706 711
707 dbg("%s: %s %s %s | %s %s %s | %s %s | NCO=%06x", __func__, 712 dev_dbg(&priv->i2c->dev, "%s: %s %s %s | %s %s %s | %s %s | NCO=%06x\n",
708 str_constellation, str_code_rate, str_constellation_code_rate, 713 __func__, str_constellation, str_code_rate,
709 str_guard_interval, str_carrier, str_guard_interval_carrier, 714 str_constellation_code_rate, str_guard_interval,
710 str_interleave, str_interleave_, if_ctl); 715 str_carrier, str_guard_interval_carrier, str_interleave,
711 716 str_interleave_, if_ctl);
712 return 0; 717 return 0;
713err: 718err:
714 dbg("%s: failed=%d", __func__, ret); 719 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
715 return ret; 720 return ret;
716} 721}
717 722
@@ -730,7 +735,7 @@ static int hd29l2_init(struct dvb_frontend *fe)
730 { 0x10, 0x38 }, 735 { 0x10, 0x38 },
731 }; 736 };
732 737
733 dbg("%s:", __func__); 738 dev_dbg(&priv->i2c->dev, "%s:\n", __func__);
734 739
735 /* reset demod */ 740 /* reset demod */
736 /* it is recommended to HW reset chip using RST_N pin */ 741 /* it is recommended to HW reset chip using RST_N pin */
@@ -774,7 +779,7 @@ static int hd29l2_init(struct dvb_frontend *fe)
774 779
775 return ret; 780 return ret;
776err: 781err:
777 dbg("%s: failed=%d", __func__, ret); 782 dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
778 return ret; 783 return ret;
779} 784}
780 785
diff --git a/drivers/media/dvb-frontends/hd29l2.h b/drivers/media/dvb-frontends/hd29l2.h
index a7a64431364d..4ad00d79aa77 100644
--- a/drivers/media/dvb-frontends/hd29l2.h
+++ b/drivers/media/dvb-frontends/hd29l2.h
@@ -58,7 +58,7 @@ extern struct dvb_frontend *hd29l2_attach(const struct hd29l2_config *config,
58static inline struct dvb_frontend *hd29l2_attach( 58static inline struct dvb_frontend *hd29l2_attach(
59const struct hd29l2_config *config, struct i2c_adapter *i2c) 59const struct hd29l2_config *config, struct i2c_adapter *i2c)
60{ 60{
61 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); 61 pr_warn("%s: driver disabled by Kconfig\n", __func__);
62 return NULL; 62 return NULL;
63} 63}
64#endif 64#endif
diff --git a/drivers/media/dvb-frontends/hd29l2_priv.h b/drivers/media/dvb-frontends/hd29l2_priv.h
index ba16dc3ec2bd..4d571a2282d4 100644
--- a/drivers/media/dvb-frontends/hd29l2_priv.h
+++ b/drivers/media/dvb-frontends/hd29l2_priv.h
@@ -28,19 +28,6 @@
28#include "dvb_math.h" 28#include "dvb_math.h"
29#include "hd29l2.h" 29#include "hd29l2.h"
30 30
31#define LOG_PREFIX "hd29l2"
32
33#undef dbg
34#define dbg(f, arg...) \
35 if (hd29l2_debug) \
36 printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
37#undef err
38#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
39#undef info
40#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
41#undef warn
42#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
43
44#define HD29L2_XTAL 30400000 /* Hz */ 31#define HD29L2_XTAL 30400000 /* Hz */
45 32
46 33