if (ret == 1) {
ret = 0;
} else {
- printk(KERN_WARNING "%s: i2c wr failed=%d reg=%06x len=%d\n",
- __func__, ret, reg, len);
+ dev_warn(&state->i2c->dev, "%s: i2c wr failed=%d reg=%06x " \
+ "len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
}
if (ret == 2) {
ret = 0;
} else {
- printk(KERN_WARNING "%s: i2c rd failed=%d reg=%06x len=%d\n",
- __func__, ret, reg, len);
+ dev_warn(&state->i2c->dev, "%s: i2c rd failed=%d reg=%06x " \
+ "len=%d\n", KBUILD_MODNAME, ret, reg, len);
ret = -EREMOTEIO;
}
return 0;
}
-static u32 af9033_div(u32 a, u32 b, u32 x)
+static u32 af9033_div(struct af9033_state *state, u32 a, u32 b, u32 x)
{
u32 r = 0, c = 0, i;
- pr_debug("%s: a=%d b=%d x=%d\n", __func__, a, b, x);
+ dev_dbg(&state->i2c->dev, "%s: a=%d b=%d x=%d\n", __func__, a, b, x);
if (a > b) {
c = a / b;
}
r = (c << (u32)x) + r;
- pr_debug("%s: a=%d b=%d x=%d r=%d r=%x\n", __func__, a, b, x, r, r);
+ dev_dbg(&state->i2c->dev, "%s: a=%d b=%d x=%d r=%d r=%x\n",
+ __func__, a, b, x, r, r);
return r;
}
};
/* program clock control */
- clock_cw = af9033_div(state->cfg.clock, 1000000ul, 19ul);
+ clock_cw = af9033_div(state, state->cfg.clock, 1000000ul, 19ul);
buf[0] = (clock_cw >> 0) & 0xff;
buf[1] = (clock_cw >> 8) & 0xff;
buf[2] = (clock_cw >> 16) & 0xff;
buf[3] = (clock_cw >> 24) & 0xff;
- pr_debug("%s: clock=%d clock_cw=%08x\n", __func__, state->cfg.clock,
- clock_cw);
+ dev_dbg(&state->i2c->dev, "%s: clock=%d clock_cw=%08x\n",
+ __func__, state->cfg.clock, clock_cw);
ret = af9033_wr_regs(state, 0x800025, buf, 4);
if (ret < 0)
break;
}
- adc_cw = af9033_div(clock_adc_lut[i].adc, 1000000ul, 19ul);
+ adc_cw = af9033_div(state, clock_adc_lut[i].adc, 1000000ul, 19ul);
buf[0] = (adc_cw >> 0) & 0xff;
buf[1] = (adc_cw >> 8) & 0xff;
buf[2] = (adc_cw >> 16) & 0xff;
- pr_debug("%s: adc=%d adc_cw=%06x\n", __func__, clock_adc_lut[i].adc,
- adc_cw);
+ dev_dbg(&state->i2c->dev, "%s: adc=%d adc_cw=%06x\n",
+ __func__, clock_adc_lut[i].adc, adc_cw);
ret = af9033_wr_regs(state, 0x80f1cd, buf, 3);
if (ret < 0)
}
/* load OFSM settings */
- pr_debug("%s: load ofsm settings\n", __func__);
+ dev_dbg(&state->i2c->dev, "%s: load ofsm settings\n", __func__);
len = ARRAY_SIZE(ofsm_init);
init = ofsm_init;
for (i = 0; i < len; i++) {
}
/* load tuner specific settings */
- pr_debug("%s: load tuner specific settings\n",
+ dev_dbg(&state->i2c->dev, "%s: load tuner specific settings\n",
__func__);
switch (state->cfg.tuner) {
case AF9033_TUNER_TUA9001:
init = tuner_init_tda18218;
break;
default:
- pr_debug("%s: unsupported tuner ID=%d\n", __func__,
- state->cfg.tuner);
+ dev_dbg(&state->i2c->dev, "%s: unsupported tuner ID=%d\n",
+ __func__, state->cfg.tuner);
ret = -ENODEV;
goto err;
}
return 0;
err:
- pr_debug("%s: failed=%d\n", __func__, ret);
+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
usleep_range(200, 10000);
}
- pr_debug("%s: loop=%d\n", __func__, i);
+ dev_dbg(&state->i2c->dev, "%s: loop=%d\n", __func__, i);
if (i == 0) {
ret = -ETIMEDOUT;
return 0;
err:
- pr_debug("%s: failed=%d\n", __func__, ret);
+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
u8 tmp, buf[3], bandwidth_reg_val;
u32 if_frequency, freq_cw, adc_freq;
- pr_debug("%s: frequency=%d bandwidth_hz=%d\n", __func__, c->frequency,
- c->bandwidth_hz);
+ dev_dbg(&state->i2c->dev, "%s: frequency=%d bandwidth_hz=%d\n",
+ __func__, c->frequency, c->bandwidth_hz);
/* check bandwidth */
switch (c->bandwidth_hz) {
bandwidth_reg_val = 0x02;
break;
default:
- pr_debug("%s: invalid bandwidth_hz\n", __func__);
+ dev_dbg(&state->i2c->dev, "%s: invalid bandwidth_hz\n",
+ __func__);
ret = -EINVAL;
goto err;
}
else
if_frequency *= -1;
- freq_cw = af9033_div(if_frequency, adc_freq, 23ul);
+ freq_cw = af9033_div(state, if_frequency, adc_freq, 23ul);
if (spec_inv == -1)
freq_cw *= -1;
return 0;
err:
- pr_debug("%s: failed=%d\n", __func__, ret);
+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
int ret;
u8 buf[8];
- pr_debug("%s\n", __func__);
+ dev_dbg(&state->i2c->dev, "%s:\n", __func__);
/* read all needed registers */
ret = af9033_rd_regs(state, 0x80f900, buf, sizeof(buf));
return 0;
err:
- pr_debug("%s: failed=%d\n", __func__, ret);
+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
return 0;
err:
- pr_debug("%s: failed=%d\n", __func__, ret);
+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
return 0;
err:
- pr_debug("%s: failed=%d\n", __func__, ret);
+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
return 0;
err:
- pr_debug("%s: failed=%d\n", __func__, ret);
+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
return 0;
err:
- pr_debug("%s: failed=%d\n", __func__, ret);
+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
+
return ret;
}
struct af9033_state *state = fe->demodulator_priv;
int ret;
- pr_debug("%s: enable=%d\n", __func__, enable);
+ dev_dbg(&state->i2c->dev, "%s: enable=%d\n", __func__, enable);
ret = af9033_wr_reg_mask(state, 0x00fa04, enable, 0x01);
if (ret < 0)
return 0;
err:
- pr_debug("%s: failed=%d\n", __func__, ret);
+ dev_dbg(&state->i2c->dev, "%s: failed=%d\n", __func__, ret);
return ret;
}
struct af9033_state *state;
u8 buf[8];
- pr_debug("%s:\n", __func__);
+ dev_dbg(&i2c->dev, "%s:\n", __func__);
/* allocate memory for the internal state */
state = kzalloc(sizeof(struct af9033_state), GFP_KERNEL);
memcpy(&state->cfg, config, sizeof(struct af9033_config));
if (state->cfg.clock != 12000000) {
- printk(KERN_INFO "af9033: unsupported clock=%d, only " \
- "12000000 Hz is supported currently\n",
- state->cfg.clock);
+ dev_err(&state->i2c->dev, "%s: af9033: unsupported clock=%d, " \
+ "only 12000000 Hz is supported currently\n",
+ KBUILD_MODNAME, state->cfg.clock);
goto err;
}
if (ret < 0)
goto err;
- printk(KERN_INFO "af9033: firmware version: LINK=%d.%d.%d.%d " \
- "OFDM=%d.%d.%d.%d\n", buf[0], buf[1], buf[2], buf[3],
- buf[4], buf[5], buf[6], buf[7]);
+ dev_info(&state->i2c->dev, "%s: firmware version: LINK=%d.%d.%d.%d " \
+ "OFDM=%d.%d.%d.%d\n", KBUILD_MODNAME, buf[0], buf[1],
+ buf[2], buf[3], buf[4], buf[5], buf[6], buf[7]);
/* configure internal TS mode */
switch (state->cfg.ts_mode) {