diff options
author | Antti Palosaari <crope@iki.fi> | 2012-08-21 09:18:58 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-09-15 08:21:07 -0400 |
commit | 9d56f5d1ca68510772acb7c4a5df5a69119bf823 (patch) | |
tree | 0e09ab55d70884e71bffd6a2157ab41389553600 /drivers/media/tuners/qt1010.c | |
parent | 0b8623caddde9a30c129eb8b721f8d25eebf4711 (diff) |
[media] qt1010: convert for Kernel logging
Signed-off-by: Antti Palosaari <crope@iki.fi>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/tuners/qt1010.c')
-rw-r--r-- | drivers/media/tuners/qt1010.c | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/drivers/media/tuners/qt1010.c b/drivers/media/tuners/qt1010.c index 74e7d4cc68c1..5fab622df924 100644 --- a/drivers/media/tuners/qt1010.c +++ b/drivers/media/tuners/qt1010.c | |||
@@ -21,15 +21,6 @@ | |||
21 | #include "qt1010.h" | 21 | #include "qt1010.h" |
22 | #include "qt1010_priv.h" | 22 | #include "qt1010_priv.h" |
23 | 23 | ||
24 | static int debug; | ||
25 | module_param(debug, int, 0644); | ||
26 | MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off)."); | ||
27 | |||
28 | #define dprintk(args...) \ | ||
29 | do { \ | ||
30 | if (debug) printk(KERN_DEBUG "QT1010: " args); \ | ||
31 | } while (0) | ||
32 | |||
33 | /* read single register */ | 24 | /* read single register */ |
34 | static int qt1010_readreg(struct qt1010_priv *priv, u8 reg, u8 *val) | 25 | static int qt1010_readreg(struct qt1010_priv *priv, u8 reg, u8 *val) |
35 | { | 26 | { |
@@ -41,7 +32,8 @@ static int qt1010_readreg(struct qt1010_priv *priv, u8 reg, u8 *val) | |||
41 | }; | 32 | }; |
42 | 33 | ||
43 | if (i2c_transfer(priv->i2c, msg, 2) != 2) { | 34 | if (i2c_transfer(priv->i2c, msg, 2) != 2) { |
44 | printk(KERN_WARNING "qt1010 I2C read failed\n"); | 35 | dev_warn(&priv->i2c->dev, "%s: i2c rd failed reg=%02x\n", |
36 | KBUILD_MODNAME, reg); | ||
45 | return -EREMOTEIO; | 37 | return -EREMOTEIO; |
46 | } | 38 | } |
47 | return 0; | 39 | return 0; |
@@ -55,7 +47,8 @@ static int qt1010_writereg(struct qt1010_priv *priv, u8 reg, u8 val) | |||
55 | .flags = 0, .buf = buf, .len = 2 }; | 47 | .flags = 0, .buf = buf, .len = 2 }; |
56 | 48 | ||
57 | if (i2c_transfer(priv->i2c, &msg, 1) != 1) { | 49 | if (i2c_transfer(priv->i2c, &msg, 1) != 1) { |
58 | printk(KERN_WARNING "qt1010 I2C write failed\n"); | 50 | dev_warn(&priv->i2c->dev, "%s: i2c wr failed reg=%02x\n", |
51 | KBUILD_MODNAME, reg); | ||
59 | return -EREMOTEIO; | 52 | return -EREMOTEIO; |
60 | } | 53 | } |
61 | return 0; | 54 | return 0; |
@@ -229,12 +222,14 @@ static int qt1010_set_params(struct dvb_frontend *fe) | |||
229 | /* 00 */ | 222 | /* 00 */ |
230 | rd[45].val = 0x92; /* TODO: correct value calculation */ | 223 | rd[45].val = 0x92; /* TODO: correct value calculation */ |
231 | 224 | ||
232 | dprintk("freq:%u 05:%02x 07:%02x 09:%02x 0a:%02x 0b:%02x " \ | 225 | dev_dbg(&priv->i2c->dev, |
233 | "1a:%02x 11:%02x 12:%02x 22:%02x 05:%02x 1f:%02x " \ | 226 | "%s: freq:%u 05:%02x 07:%02x 09:%02x 0a:%02x 0b:%02x " \ |
234 | "20:%02x 25:%02x 00:%02x", \ | 227 | "1a:%02x 11:%02x 12:%02x 22:%02x 05:%02x 1f:%02x " \ |
235 | freq, rd[2].val, rd[4].val, rd[6].val, rd[7].val, rd[8].val, \ | 228 | "20:%02x 25:%02x 00:%02x\n", __func__, \ |
236 | rd[10].val, rd[13].val, rd[14].val, rd[15].val, rd[35].val, \ | 229 | freq, rd[2].val, rd[4].val, rd[6].val, rd[7].val, \ |
237 | rd[40].val, rd[41].val, rd[43].val, rd[45].val); | 230 | rd[8].val, rd[10].val, rd[13].val, rd[14].val, \ |
231 | rd[15].val, rd[35].val, rd[40].val, rd[41].val, \ | ||
232 | rd[43].val, rd[45].val); | ||
238 | 233 | ||
239 | for (i = 0; i < ARRAY_SIZE(rd); i++) { | 234 | for (i = 0; i < ARRAY_SIZE(rd); i++) { |
240 | if (rd[i].oper == QT1010_WR) { | 235 | if (rd[i].oper == QT1010_WR) { |
@@ -245,8 +240,7 @@ static int qt1010_set_params(struct dvb_frontend *fe) | |||
245 | if (err) return err; | 240 | if (err) return err; |
246 | } | 241 | } |
247 | 242 | ||
248 | if (debug) | 243 | qt1010_dump_regs(priv); |
249 | qt1010_dump_regs(priv); | ||
250 | 244 | ||
251 | if (fe->ops.i2c_gate_ctrl) | 245 | if (fe->ops.i2c_gate_ctrl) |
252 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ | 246 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ |
@@ -281,7 +275,8 @@ static int qt1010_init_meas1(struct qt1010_priv *priv, | |||
281 | val1 = val2; | 275 | val1 = val2; |
282 | err = qt1010_readreg(priv, reg, &val2); | 276 | err = qt1010_readreg(priv, reg, &val2); |
283 | if (err) return err; | 277 | if (err) return err; |
284 | dprintk("compare reg:%02x %02x %02x", reg, val1, val2); | 278 | dev_dbg(&priv->i2c->dev, "%s: compare reg:%02x %02x %02x\n", |
279 | __func__, reg, val1, val2); | ||
285 | } while (val1 != val2); | 280 | } while (val1 != val2); |
286 | *retval = val1; | 281 | *retval = val1; |
287 | 282 | ||
@@ -465,7 +460,10 @@ struct dvb_frontend * qt1010_attach(struct dvb_frontend *fe, | |||
465 | if (fe->ops.i2c_gate_ctrl) | 460 | if (fe->ops.i2c_gate_ctrl) |
466 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ | 461 | fe->ops.i2c_gate_ctrl(fe, 0); /* close i2c_gate */ |
467 | 462 | ||
468 | printk(KERN_INFO "Quantek QT1010 successfully identified.\n"); | 463 | dev_info(&priv->i2c->dev, |
464 | "%s: Quantek QT1010 successfully identified\n", | ||
465 | KBUILD_MODNAME); | ||
466 | |||
469 | memcpy(&fe->ops.tuner_ops, &qt1010_tuner_ops, | 467 | memcpy(&fe->ops.tuner_ops, &qt1010_tuner_ops, |
470 | sizeof(struct dvb_tuner_ops)); | 468 | sizeof(struct dvb_tuner_ops)); |
471 | 469 | ||