*
*/
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Turn on/off lgdt330x frontend debugging (default:off).");
-#define dprintk(args...) do { \
- if (debug) \
- printk(KERN_DEBUG "lgdt330x: " args); \
+
+#define dprintk(fmt, arg...) do { \
+ if (debug) \
+ printk(KERN_DEBUG pr_fmt("%s: " fmt), \
+ __func__, ##arg); \
} while (0)
struct lgdt330x_state {
for (i = 0; i < len - 1; i += 2) {
err = i2c_transfer(state->i2c, &msg, 1);
if (err != 1) {
- printk(KERN_WARNING "lgdt330x: %s error (addr %02x <- %02x, err = %i)\n",
- __func__, msg.buf[0], msg.buf[1], err);
+ pr_warn("%s: error (addr %02x <- %02x, err = %i)\n",
+ __func__, msg.buf[0], msg.buf[1], err);
if (err < 0)
return err;
else
ret = i2c_transfer(state->i2c, msg, 2);
if (ret != 2) {
- printk(KERN_WARNING "lgdt330x: %s: addr 0x%02x select 0x%02x error (ret == %i)\n",
- __func__, state->config->demod_address, reg, ret);
+ pr_warn("%s: addr 0x%02x select 0x%02x error (ret == %i)\n",
+ __func__, state->config->demod_address, reg, ret);
if (ret >= 0)
ret = -EIO;
} else {
printk(KERN_WARNING "Only LGDT3302 and LGDT3303 are supported chips.\n");
err = -ENODEV;
}
- dprintk("%s entered as %s\n", __func__, chip_name);
+ dprintk("entered as %s\n", chip_name);
if (err < 0)
return err;
return lgdt330x_sw_reset(state);
if (state->current_modulation != p->modulation) {
switch (p->modulation) {
case VSB_8:
- dprintk("%s: VSB_8 MODE\n", __func__);
+ dprintk("VSB_8 MODE\n");
/* Select VSB mode */
top_ctrl_cfg[1] = 0x03;
break;
case QAM_64:
- dprintk("%s: QAM_64 MODE\n", __func__);
+ dprintk("QAM_64 MODE\n");
/* Select QAM_64 mode */
top_ctrl_cfg[1] = 0x00;
break;
case QAM_256:
- dprintk("%s: QAM_256 MODE\n", __func__);
+ dprintk("QAM_256 MODE\n");
/* Select QAM_256 mode */
top_ctrl_cfg[1] = 0x01;
}
break;
default:
- printk(KERN_WARNING "lgdt330x: %s: Modulation type(%d) UNSUPPORTED\n",
- __func__, p->modulation);
+ pr_warn("%s: Modulation type(%d) UNSUPPORTED\n",
+ __func__, p->modulation);
return -1;
}
if (err < 0)
- printk(KERN_WARNING "lgdt330x: %s: error blasting bytes to lgdt3303 for modulation type(%d)\n",
- __func__, p->modulation);
+ pr_warn("%s: error blasting bytes to lgdt3303 for modulation type(%d)\n",
+ __func__, p->modulation);
/*
* select serial or parallel MPEG hardware interface
/* AGC status register */
i2c_read_demod_bytes(state, AGC_STATUS, buf, 1);
- dprintk("%s: AGC_STATUS = 0x%02x\n", __func__, buf[0]);
+ dprintk("AGC_STATUS = 0x%02x\n", buf[0]);
if ((buf[0] & 0x0c) == 0x8) {
/*
* Test signal does not exist flag
/* signal status */
i2c_read_demod_bytes(state, TOP_CONTROL, buf, sizeof(buf));
- dprintk("%s: TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n",
- __func__, buf[0], buf[1], buf[2]);
+ dprintk("TOP_CONTROL = 0x%02x, IRO_MASK = 0x%02x, IRQ_STATUS = 0x%02x\n",
+ buf[0], buf[1], buf[2]);
/* sync status */
if ((buf[2] & 0x03) == 0x01)
/* Carrier Recovery Lock Status Register */
i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1);
- dprintk("%s: CARRIER_LOCK = 0x%02x\n", __func__, buf[0]);
+ dprintk("CARRIER_LOCK = 0x%02x\n", buf[0]);
switch (state->current_modulation) {
case QAM_256:
case QAM_64:
*status |= FE_HAS_CARRIER;
break;
default:
- printk(KERN_WARNING "lgdt330x: %s: Modulation set to unsupported value\n",
- __func__);
+ pr_warn("%s: Modulation set to unsupported value\n",
+ __func__);
}
return 0;
if (err < 0)
return err;
- dprintk("%s: AGC_STATUS = 0x%02x\n", __func__, buf[0]);
+ dprintk("AGC_STATUS = 0x%02x\n", buf[0]);
if ((buf[0] & 0x21) == 0x01) {
/*
* Test input signal does not exist flag
/* Carrier Recovery Lock Status Register */
i2c_read_demod_bytes(state, CARRIER_LOCK, buf, 1);
- dprintk("%s: CARRIER_LOCK = 0x%02x\n", __func__, buf[0]);
+ dprintk("CARRIER_LOCK = 0x%02x\n", buf[0]);
switch (state->current_modulation) {
case QAM_256:
case QAM_64:
}
break;
default:
- printk(KERN_WARNING "lgdt330x: %s: Modulation set to unsupported value\n",
- __func__);
+ pr_warn("%s: Modulation set to unsupported value\n",
+ __func__);
}
return 0;
}
/* log10(688128)*2^24 and log10(696320)*2^24 */
break;
default:
- printk(KERN_ERR "lgdt330x: %s: Modulation set to unsupported value\n",
+ pr_err("%s: Modulation set to unsupported value\n",
__func__);
return -EREMOTEIO; /* return -EDRIVER_IS_GIBBERED; */
}
state->snr = calculate_snr(noise, c);
*snr = (state->snr) >> 16; /* Convert from 8.24 fixed-point to 8.8 */
- dprintk("%s: noise = 0x%08x, snr = %d.%02d dB\n", __func__, noise,
+ dprintk("noise = 0x%08x, snr = %d.%02d dB\n", noise,
state->snr >> 24, (((state->snr >> 8) & 0xffff) * 100) >> 16);
return 0;
/* log10(688128)*2^24 and log10(696320)*2^24 */
break;
default:
- printk(KERN_ERR "lgdt330x: %s: Modulation set to unsupported value\n",
+ pr_err("%s: Modulation set to unsupported value\n",
__func__);
return -EREMOTEIO; /* return -EDRIVER_IS_GIBBERED; */
}
state->snr = calculate_snr(noise, c);
*snr = (state->snr) >> 16; /* Convert from 8.24 fixed-point to 8.8 */
- dprintk("%s: noise = 0x%08x, snr = %d.%02d dB\n", __func__, noise,
+ dprintk("noise = 0x%08x, snr = %d.%02d dB\n", noise,
state->snr >> 24, (((state->snr >> 8) & 0xffff) * 100) >> 16);
return 0;
error:
kfree(state);
- dprintk("%s: ERROR\n", __func__);
+ dprintk("ERROR\n");
return NULL;
}
EXPORT_SYMBOL(lgdt330x_attach);