Commit 9edd6987 authored by Antti Palosaari's avatar Antti Palosaari Committed by Mauro Carvalho Chehab

[media] tda18218: switch to Kernel logging

Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent af3a07ac
...@@ -18,13 +18,8 @@ ...@@ -18,13 +18,8 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include "tda18218.h"
#include "tda18218_priv.h" #include "tda18218_priv.h"
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off debugging (default:off).");
/* write multiple registers */ /* write multiple registers */
static int tda18218_wr_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) static int tda18218_wr_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len)
{ {
...@@ -56,7 +51,8 @@ static int tda18218_wr_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) ...@@ -56,7 +51,8 @@ static int tda18218_wr_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len)
if (ret == 1) { if (ret == 1) {
ret = 0; ret = 0;
} else { } else {
warn("i2c wr failed ret:%d reg:%02x len:%d", ret, reg, len); dev_warn(&priv->i2c->dev, "%s: i2c wr failed=%d reg=%02x " \
"len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO; ret = -EREMOTEIO;
} }
...@@ -87,7 +83,8 @@ static int tda18218_rd_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len) ...@@ -87,7 +83,8 @@ static int tda18218_rd_regs(struct tda18218_priv *priv, u8 reg, u8 *val, u8 len)
memcpy(val, &buf[reg], len); memcpy(val, &buf[reg], len);
ret = 0; ret = 0;
} else { } else {
warn("i2c rd failed ret:%d reg:%02x len:%d", ret, reg, len); dev_warn(&priv->i2c->dev, "%s: i2c rd failed=%d reg=%02x " \
"len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO; ret = -EREMOTEIO;
} }
...@@ -197,7 +194,7 @@ static int tda18218_set_params(struct dvb_frontend *fe) ...@@ -197,7 +194,7 @@ static int tda18218_set_params(struct dvb_frontend *fe)
fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */ fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */
if (ret) if (ret)
dbg("%s: failed ret:%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -206,7 +203,7 @@ static int tda18218_get_if_frequency(struct dvb_frontend *fe, u32 *frequency) ...@@ -206,7 +203,7 @@ static int tda18218_get_if_frequency(struct dvb_frontend *fe, u32 *frequency)
{ {
struct tda18218_priv *priv = fe->tuner_priv; struct tda18218_priv *priv = fe->tuner_priv;
*frequency = priv->if_frequency; *frequency = priv->if_frequency;
dbg("%s: if=%d", __func__, *frequency); dev_dbg(&priv->i2c->dev, "%s: if_frequency=%d\n", __func__, *frequency);
return 0; return 0;
} }
...@@ -225,7 +222,7 @@ static int tda18218_sleep(struct dvb_frontend *fe) ...@@ -225,7 +222,7 @@ static int tda18218_sleep(struct dvb_frontend *fe)
fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */ fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */
if (ret) if (ret)
dbg("%s: failed ret:%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -246,7 +243,7 @@ static int tda18218_init(struct dvb_frontend *fe) ...@@ -246,7 +243,7 @@ static int tda18218_init(struct dvb_frontend *fe)
fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */ fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */
if (ret) if (ret)
dbg("%s: failed ret:%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -305,13 +302,16 @@ struct dvb_frontend *tda18218_attach(struct dvb_frontend *fe, ...@@ -305,13 +302,16 @@ struct dvb_frontend *tda18218_attach(struct dvb_frontend *fe,
/* check if the tuner is there */ /* check if the tuner is there */
ret = tda18218_rd_reg(priv, R00_ID, &val); ret = tda18218_rd_reg(priv, R00_ID, &val);
dbg("%s: ret:%d chip ID:%02x", __func__, ret, val); dev_dbg(&priv->i2c->dev, "%s: ret=%d chip id=%02x\n", __func__, ret,
val);
if (ret || val != def_regs[R00_ID]) { if (ret || val != def_regs[R00_ID]) {
kfree(priv); kfree(priv);
return NULL; return NULL;
} }
info("NXP TDA18218HN successfully identified."); dev_info(&priv->i2c->dev,
"%s: NXP TDA18218HN successfully identified\n",
KBUILD_MODNAME);
memcpy(&fe->ops.tuner_ops, &tda18218_tuner_ops, memcpy(&fe->ops.tuner_ops, &tda18218_tuner_ops,
sizeof(struct dvb_tuner_ops)); sizeof(struct dvb_tuner_ops));
...@@ -326,7 +326,7 @@ struct dvb_frontend *tda18218_attach(struct dvb_frontend *fe, ...@@ -326,7 +326,7 @@ struct dvb_frontend *tda18218_attach(struct dvb_frontend *fe,
/* standby */ /* standby */
ret = tda18218_wr_reg(priv, R17_PD1, priv->regs[R17_PD1] | (1 << 0)); ret = tda18218_wr_reg(priv, R17_PD1, priv->regs[R17_PD1] | (1 << 0));
if (ret) if (ret)
dbg("%s: failed ret:%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
if (fe->ops.i2c_gate_ctrl) if (fe->ops.i2c_gate_ctrl)
fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */ fe->ops.i2c_gate_ctrl(fe, 0); /* close I2C-gate */
......
...@@ -21,18 +21,7 @@ ...@@ -21,18 +21,7 @@
#ifndef TDA18218_PRIV_H #ifndef TDA18218_PRIV_H
#define TDA18218_PRIV_H #define TDA18218_PRIV_H
#define LOG_PREFIX "tda18218" #include "tda18218.h"
#undef dbg
#define dbg(f, arg...) \
if (debug) \
printk(KERN_DEBUG LOG_PREFIX": " f "\n" , ## arg)
#undef err
#define err(f, arg...) printk(KERN_ERR LOG_PREFIX": " f "\n" , ## arg)
#undef info
#define info(f, arg...) printk(KERN_INFO LOG_PREFIX": " f "\n" , ## arg)
#undef warn
#define warn(f, arg...) printk(KERN_WARNING LOG_PREFIX": " f "\n" , ## arg)
#define R00_ID 0x00 /* ID byte */ #define R00_ID 0x00 /* ID byte */
#define R01_R1 0x01 /* Read byte 1 */ #define R01_R1 0x01 /* Read byte 1 */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment