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

[media] hd29l2: use Kernel dev_foo() logging

Signed-off-by: default avatarAntti Palosaari <crope@iki.fi>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 0d2d6031
...@@ -22,10 +22,6 @@ ...@@ -22,10 +22,6 @@
#include "hd29l2_priv.h" #include "hd29l2_priv.h"
int hd29l2_debug;
module_param_named(debug, hd29l2_debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off frontend debugging (default:off).");
/* write multiple registers */ /* write multiple registers */
static int hd29l2_wr_regs(struct hd29l2_priv *priv, u8 reg, u8 *val, int len) static int hd29l2_wr_regs(struct hd29l2_priv *priv, u8 reg, u8 *val, int len)
{ {
...@@ -48,7 +44,9 @@ static int hd29l2_wr_regs(struct hd29l2_priv *priv, u8 reg, u8 *val, int len) ...@@ -48,7 +44,9 @@ static int hd29l2_wr_regs(struct hd29l2_priv *priv, u8 reg, u8 *val, int len)
if (ret == 1) { if (ret == 1) {
ret = 0; ret = 0;
} else { } else {
warn("i2c wr failed=%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;
} }
...@@ -78,7 +76,9 @@ static int hd29l2_rd_regs(struct hd29l2_priv *priv, u8 reg, u8 *val, int len) ...@@ -78,7 +76,9 @@ static int hd29l2_rd_regs(struct hd29l2_priv *priv, u8 reg, u8 *val, int len)
if (ret == 2) { if (ret == 2) {
ret = 0; ret = 0;
} else { } else {
warn("i2c rd failed=%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;
} }
...@@ -160,7 +160,7 @@ static int hd29l2_soft_reset(struct hd29l2_priv *priv) ...@@ -160,7 +160,7 @@ static int hd29l2_soft_reset(struct hd29l2_priv *priv)
return 0; return 0;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -170,7 +170,7 @@ static int hd29l2_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) ...@@ -170,7 +170,7 @@ static int hd29l2_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
struct hd29l2_priv *priv = fe->demodulator_priv; struct hd29l2_priv *priv = fe->demodulator_priv;
u8 tmp; u8 tmp;
dbg("%s: enable=%d", __func__, enable); dev_dbg(&priv->i2c->dev, "%s: enable=%d\n", __func__, enable);
/* set tuner address for demod */ /* set tuner address for demod */
if (!priv->tuner_i2c_addr_programmed && enable) { if (!priv->tuner_i2c_addr_programmed && enable) {
...@@ -199,11 +199,11 @@ static int hd29l2_i2c_gate_ctrl(struct dvb_frontend *fe, int enable) ...@@ -199,11 +199,11 @@ static int hd29l2_i2c_gate_ctrl(struct dvb_frontend *fe, int enable)
usleep_range(5000, 10000); usleep_range(5000, 10000);
} }
dbg("%s: loop=%d", __func__, i); dev_dbg(&priv->i2c->dev, "%s: loop=%d\n", __func__, i);
return ret; return ret;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -238,7 +238,7 @@ static int hd29l2_read_status(struct dvb_frontend *fe, fe_status_t *status) ...@@ -238,7 +238,7 @@ static int hd29l2_read_status(struct dvb_frontend *fe, fe_status_t *status)
return 0; return 0;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -270,7 +270,7 @@ static int hd29l2_read_snr(struct dvb_frontend *fe, u16 *snr) ...@@ -270,7 +270,7 @@ static int hd29l2_read_snr(struct dvb_frontend *fe, u16 *snr)
return 0; return 0;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -295,7 +295,7 @@ static int hd29l2_read_signal_strength(struct dvb_frontend *fe, u16 *strength) ...@@ -295,7 +295,7 @@ static int hd29l2_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
return 0; return 0;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -322,7 +322,7 @@ static int hd29l2_read_ber(struct dvb_frontend *fe, u32 *ber) ...@@ -322,7 +322,7 @@ static int hd29l2_read_ber(struct dvb_frontend *fe, u32 *ber)
return 0; return 0;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -344,11 +344,12 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe) ...@@ -344,11 +344,12 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
u32 if_freq, if_ctl; u32 if_freq, if_ctl;
bool auto_mode; bool auto_mode;
dbg("%s: delivery_system=%d frequency=%d bandwidth_hz=%d " \ dev_dbg(&priv->i2c->dev, "%s: delivery_system=%d frequency=%d " \
"modulation=%d inversion=%d fec_inner=%d guard_interval=%d", "bandwidth_hz=%d modulation=%d inversion=%d " \
__func__, "fec_inner=%d guard_interval=%d\n", __func__,
c->delivery_system, c->frequency, c->bandwidth_hz, c->delivery_system, c->frequency, c->bandwidth_hz,
c->modulation, c->inversion, c->fec_inner, c->guard_interval); c->modulation, c->inversion, c->fec_inner,
c->guard_interval);
/* as for now we detect always params automatically */ /* as for now we detect always params automatically */
auto_mode = true; auto_mode = true;
...@@ -394,7 +395,8 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe) ...@@ -394,7 +395,8 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
if (ret) if (ret)
goto err; goto err;
dbg("%s: if_freq=%d if_ctl=%x", __func__, if_freq, if_ctl); dev_dbg(&priv->i2c->dev, "%s: if_freq=%d if_ctl=%x\n",
__func__, if_freq, if_ctl);
if (auto_mode) { if (auto_mode) {
/* /*
...@@ -437,7 +439,7 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe) ...@@ -437,7 +439,7 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
break; break;
} }
dbg("%s: loop=%d", __func__, i); dev_dbg(&priv->i2c->dev, "%s: loop=%d\n", __func__, i);
if (i == 0) if (i == 0)
/* detection failed */ /* detection failed */
...@@ -477,7 +479,8 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe) ...@@ -477,7 +479,8 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
/* ensure modulation validy */ /* ensure modulation validy */
/* 0=QAM4_NR, 1=QAM4, 2=QAM16, 3=QAM32, 4=QAM64 */ /* 0=QAM4_NR, 1=QAM4, 2=QAM16, 3=QAM32, 4=QAM64 */
if (modulation > (ARRAY_SIZE(reg_mod_vals_tab[0].val) - 1)) { if (modulation > (ARRAY_SIZE(reg_mod_vals_tab[0].val) - 1)) {
dbg("%s: modulation=%d not valid", __func__, modulation); dev_dbg(&priv->i2c->dev, "%s: modulation=%d not valid\n",
__func__, modulation);
goto err; goto err;
} }
...@@ -499,12 +502,14 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe) ...@@ -499,12 +502,14 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
if (ret) if (ret)
goto err; goto err;
dbg("%s: modulation=%d guard_interval=%d carrier=%d", dev_dbg(&priv->i2c->dev,
__func__, modulation, guard_interval, carrier); "%s: modulation=%d guard_interval=%d carrier=%d\n",
__func__, modulation, guard_interval, carrier);
if ((carrier == HD29L2_CARRIER_MULTI) && (modulation == HD29L2_QAM64) && if ((carrier == HD29L2_CARRIER_MULTI) && (modulation == HD29L2_QAM64) &&
(guard_interval == HD29L2_PN945)) { (guard_interval == HD29L2_PN945)) {
dbg("%s: C=3780 && QAM64 && PN945", __func__); dev_dbg(&priv->i2c->dev, "%s: C=3780 && QAM64 && PN945\n",
__func__);
ret = hd29l2_wr_reg(priv, 0x42, 0x33); ret = hd29l2_wr_reg(priv, 0x42, 0x33);
if (ret) if (ret)
...@@ -535,14 +540,14 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe) ...@@ -535,14 +540,14 @@ static enum dvbfe_search hd29l2_search(struct dvb_frontend *fe)
break; break;
} }
dbg("%s: loop=%d", __func__, i); dev_dbg(&priv->i2c->dev, "%s: loop=%d\n", __func__, i);
if (i == 0) if (i == 0)
return DVBFE_ALGO_SEARCH_AGAIN; return DVBFE_ALGO_SEARCH_AGAIN;
return DVBFE_ALGO_SEARCH_SUCCESS; return DVBFE_ALGO_SEARCH_SUCCESS;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return DVBFE_ALGO_SEARCH_ERROR; return DVBFE_ALGO_SEARCH_ERROR;
} }
...@@ -704,14 +709,14 @@ static int hd29l2_get_frontend(struct dvb_frontend *fe) ...@@ -704,14 +709,14 @@ static int hd29l2_get_frontend(struct dvb_frontend *fe)
if_ctl = (buf[0] << 16) | ((buf[1] - 7) << 8) | buf[2]; if_ctl = (buf[0] << 16) | ((buf[1] - 7) << 8) | buf[2];
dbg("%s: %s %s %s | %s %s %s | %s %s | NCO=%06x", __func__, dev_dbg(&priv->i2c->dev, "%s: %s %s %s | %s %s %s | %s %s | NCO=%06x\n",
str_constellation, str_code_rate, str_constellation_code_rate, __func__, str_constellation, str_code_rate,
str_guard_interval, str_carrier, str_guard_interval_carrier, str_constellation_code_rate, str_guard_interval,
str_interleave, str_interleave_, if_ctl); str_carrier, str_guard_interval_carrier, str_interleave,
str_interleave_, if_ctl);
return 0; return 0;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
...@@ -730,7 +735,7 @@ static int hd29l2_init(struct dvb_frontend *fe) ...@@ -730,7 +735,7 @@ static int hd29l2_init(struct dvb_frontend *fe)
{ 0x10, 0x38 }, { 0x10, 0x38 },
}; };
dbg("%s:", __func__); dev_dbg(&priv->i2c->dev, "%s:\n", __func__);
/* reset demod */ /* reset demod */
/* it is recommended to HW reset chip using RST_N pin */ /* it is recommended to HW reset chip using RST_N pin */
...@@ -774,7 +779,7 @@ static int hd29l2_init(struct dvb_frontend *fe) ...@@ -774,7 +779,7 @@ static int hd29l2_init(struct dvb_frontend *fe)
return ret; return ret;
err: err:
dbg("%s: failed=%d", __func__, ret); dev_dbg(&priv->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret; return ret;
} }
......
...@@ -58,7 +58,7 @@ extern struct dvb_frontend *hd29l2_attach(const struct hd29l2_config *config, ...@@ -58,7 +58,7 @@ extern struct dvb_frontend *hd29l2_attach(const struct hd29l2_config *config,
static inline struct dvb_frontend *hd29l2_attach( static inline struct dvb_frontend *hd29l2_attach(
const struct hd29l2_config *config, struct i2c_adapter *i2c) const struct hd29l2_config *config, struct i2c_adapter *i2c)
{ {
printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __func__); pr_warn("%s: driver disabled by Kconfig\n", __func__);
return NULL; return NULL;
} }
#endif #endif
......
...@@ -28,19 +28,6 @@ ...@@ -28,19 +28,6 @@
#include "dvb_math.h" #include "dvb_math.h"
#include "hd29l2.h" #include "hd29l2.h"
#define LOG_PREFIX "hd29l2"
#undef dbg
#define dbg(f, arg...) \
if (hd29l2_debug) \
printk(KERN_INFO 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 HD29L2_XTAL 30400000 /* Hz */ #define HD29L2_XTAL 30400000 /* Hz */
......
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