* Debug macros
*/
-#define tuner_warn(fmt, arg...) do { \
- printk(KERN_WARNING "%s %d-%04x: " fmt, PREFIX, \
- i2c_adapter_id(t->i2c->adapter), \
- t->i2c->addr, ##arg); \
- } while (0)
-
-#define tuner_info(fmt, arg...) do { \
- printk(KERN_INFO "%s %d-%04x: " fmt, PREFIX, \
- i2c_adapter_id(t->i2c->adapter), \
- t->i2c->addr, ##arg); \
- } while (0)
-
-#define tuner_err(fmt, arg...) do { \
- printk(KERN_ERR "%s %d-%04x: " fmt, PREFIX, \
- i2c_adapter_id(t->i2c->adapter), \
- t->i2c->addr, ##arg); \
- } while (0)
-
-#define tuner_dbg(fmt, arg...) do { \
- if (tuner_debug) \
- printk(KERN_DEBUG "%s %d-%04x: " fmt, PREFIX, \
- i2c_adapter_id(t->i2c->adapter), \
- t->i2c->addr, ##arg); \
- } while (0)
+#undef pr_fmt
+
+#define pr_fmt(fmt) KBUILD_MODNAME ": %d-%04x: " fmt, \
+ i2c_adapter_id(t->i2c->adapter), t->i2c->addr
+
+
+#define dprintk(fmt, arg...) do { \
+ if (tuner_debug) \
+ printk(KERN_DEBUG pr_fmt("%s: " fmt), __func__, ##arg); \
+} while (0)
/*
* Internal struct used inside the driver
struct tuner *t = fe->analog_demod_priv;
if (NULL == fe_tuner_ops->set_analog_params) {
- tuner_warn("Tuner frontend module has no way to set freq\n");
+ pr_warn("Tuner frontend module has no way to set freq\n");
return;
}
fe_tuner_ops->set_analog_params(fe, params);
if (fe_tuner_ops->set_config)
return fe_tuner_ops->set_config(fe, priv_cfg);
- tuner_warn("Tuner frontend module has no way to set config\n");
+ pr_warn("Tuner frontend module has no way to set config\n");
return 0;
}
int tune_now = 1;
if (type == UNSET || type == TUNER_ABSENT) {
- tuner_dbg("tuner 0x%02x: Tuner type absent\n", c->addr);
+ dprintk("tuner 0x%02x: Tuner type absent\n", c->addr);
return;
}
t->type = type;
t->config = new_config;
if (tuner_callback != NULL) {
- tuner_dbg("defining GPIO callback\n");
+ dprintk("defining GPIO callback\n");
t->fe.callback = tuner_callback;
}
t->sd.entity.name = t->name;
#endif
- tuner_dbg("type set to %s\n", t->name);
+ dprintk("type set to %s\n", t->name);
t->mode_mask = new_mode_mask;
set_tv_freq(c, t->tv_freq);
}
- tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
+ dprintk("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
c->adapter->name, c->dev.driver->name, c->addr << 1, type,
t->mode_mask);
return;
attach_failed:
- tuner_dbg("Tuner attach for type = %d failed.\n", t->type);
+ dprintk("Tuner attach for type = %d failed.\n", t->type);
t->type = TUNER_ABSENT;
return;
struct tuner *t = to_tuner(sd);
struct i2c_client *c = v4l2_get_subdevdata(sd);
- tuner_dbg("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x, config=%p\n",
+ dprintk("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x, config=%p\n",
tun_setup->type,
tun_setup->addr,
tun_setup->mode_mask,
set_type(c, tun_setup->type, tun_setup->mode_mask,
tun_setup->config, tun_setup->tuner_callback);
} else
- tuner_dbg("set addr discarded for type %i, mask %x. Asked to change tuner at addr 0x%02x, with mask %x\n",
+ dprintk("set addr discarded for type %i, mask %x. Asked to change tuner at addr 0x%02x, with mask %x\n",
t->type, t->mode_mask,
tun_setup->addr, tun_setup->mode_mask);
return 0;
}
- tuner_dbg("Tuner frontend module has no way to set config\n");
+ dprintk("Tuner frontend module has no way to set config\n");
return 0;
}
memset(buffer, 0, sizeof(buffer));
rc = i2c_master_recv(client, buffer, sizeof(buffer));
if (rc >= 0)
- tuner_info("I2C RECV = %*ph\n", rc, buffer);
+ pr_info("I2C RECV = %*ph\n", rc, buffer);
}
/* autodetection code based on the i2c addr */
since it can be tda9887*/
if (tuner_symbol_probe(tda829x_probe, t->i2c->adapter,
t->i2c->addr) >= 0) {
- tuner_dbg("tda829x detected\n");
+ dprintk("tda829x detected\n");
} else {
/* Default is being tda9887 */
t->type = TUNER_TDA9887;
t->mode_mask = T_ANALOG_TV;
if (radio == NULL)
t->mode_mask |= T_RADIO;
- tuner_dbg("Setting mode_mask to 0x%02x\n", t->mode_mask);
+ dprintk("Setting mode_mask to 0x%02x\n", t->mode_mask);
}
/* Should be just before return */
}
if (ret < 0) {
- tuner_err("failed to initialize media entity!\n");
+ pr_err("failed to initialize media entity!\n");
kfree(t);
return ret;
}
set_type(client, t->type, t->mode_mask, t->config, t->fe.callback);
list_add_tail(&t->list, &tuner_list);
- tuner_info("Tuner %d found with type(s)%s%s.\n",
+ pr_info("Tuner %d found with type(s)%s%s.\n",
t->type,
t->mode_mask & T_RADIO ? " Radio" : "",
t->mode_mask & T_ANALOG_TV ? " TV" : "");
if (mode != t->mode) {
if (check_mode(t, mode) == -EINVAL) {
- tuner_dbg("Tuner doesn't support mode %d. Putting tuner to sleep\n",
+ dprintk("Tuner doesn't support mode %d. Putting tuner to sleep\n",
mode);
t->standby = true;
if (analog_ops->standby)
return -EINVAL;
}
t->mode = mode;
- tuner_dbg("Changing to mode %d\n", mode);
+ dprintk("Changing to mode %d\n", mode);
}
return 0;
}
};
if (t->type == UNSET) {
- tuner_warn("tuner type not set\n");
+ pr_warn("tuner type not set\n");
return;
}
if (NULL == analog_ops->set_params) {
- tuner_warn("Tuner has no way to set tv freq\n");
+ pr_warn("Tuner has no way to set tv freq\n");
return;
}
if (freq < tv_range[0] * 16 || freq > tv_range[1] * 16) {
- tuner_dbg("TV freq (%d.%02d) out of range (%d-%d)\n",
+ dprintk("TV freq (%d.%02d) out of range (%d-%d)\n",
freq / 16, freq % 16 * 100 / 16, tv_range[0],
tv_range[1]);
/* V4L2 spec: if the freq is not possible then the closest
freq = tv_range[1] * 16;
}
params.frequency = freq;
- tuner_dbg("tv freq set to %d.%02d\n",
+ dprintk("tv freq set to %d.%02d\n",
freq / 16, freq % 16 * 100 / 16);
t->tv_freq = freq;
t->standby = false;
return V4L2_STD_PAL_Nc;
return V4L2_STD_PAL_N;
default:
- tuner_warn("pal= argument not recognised\n");
+ pr_warn("pal= argument not recognised\n");
break;
}
}
return V4L2_STD_SECAM_LC;
return V4L2_STD_SECAM_L;
default:
- tuner_warn("secam= argument not recognised\n");
+ pr_warn("secam= argument not recognised\n");
break;
}
}
case 'K':
return V4L2_STD_NTSC_M_KR;
default:
- tuner_info("ntsc= argument not recognised\n");
+ pr_info("ntsc= argument not recognised\n");
break;
}
}
};
if (t->type == UNSET) {
- tuner_warn("tuner type not set\n");
+ pr_warn("tuner type not set\n");
return;
}
if (NULL == analog_ops->set_params) {
- tuner_warn("tuner has no way to set radio frequency\n");
+ pr_warn("tuner has no way to set radio frequency\n");
return;
}
if (freq < radio_range[0] * 16000 || freq > radio_range[1] * 16000) {
- tuner_dbg("radio freq (%d.%02d) out of range (%d-%d)\n",
+ dprintk("radio freq (%d.%02d) out of range (%d-%d)\n",
freq / 16000, freq % 16000 * 100 / 16000,
radio_range[0], radio_range[1]);
/* V4L2 spec: if the freq is not possible then the closest
freq = radio_range[1] * 16000;
}
params.frequency = freq;
- tuner_dbg("radio freq set to %d.%02d\n",
+ dprintk("radio freq set to %d.%02d\n",
freq / 16000, freq % 16000 * 100 / 16000);
t->radio_freq = freq;
t->standby = false;
freq = t->tv_freq / 16;
freq_fraction = (t->tv_freq % 16) * 100 / 16;
}
- tuner_info("Tuner mode: %s%s\n", p,
+ pr_info("Tuner mode: %s%s\n", p,
t->standby ? " on standby mode" : "");
- tuner_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction);
- tuner_info("Standard: 0x%08lx\n", (unsigned long)t->std);
+ pr_info("Frequency: %lu.%02lu MHz\n", freq, freq_fraction);
+ pr_info("Standard: 0x%08lx\n", (unsigned long)t->std);
if (t->mode != V4L2_TUNER_RADIO)
return;
if (fe_tuner_ops->get_status) {
fe_tuner_ops->get_status(&t->fe, &tuner_status);
if (tuner_status & TUNER_STATUS_LOCKED)
- tuner_info("Tuner is locked.\n");
+ pr_info("Tuner is locked.\n");
if (tuner_status & TUNER_STATUS_STEREO)
- tuner_info("Stereo: yes\n");
+ pr_info("Stereo: yes\n");
}
if (analog_ops->has_signal) {
u16 signal;
if (!analog_ops->has_signal(fe, &signal))
- tuner_info("Signal strength: %hu\n", signal);
+ pr_info("Signal strength: %hu\n", signal);
}
}
if (on) {
if (t->standby && set_mode(t, t->mode) == 0) {
- tuner_dbg("Waking up tuner\n");
+ dprintk("Waking up tuner\n");
set_freq(t, 0);
}
return 0;
}
- tuner_dbg("Putting tuner to sleep\n");
+ dprintk("Putting tuner to sleep\n");
t->standby = true;
if (analog_ops->standby)
analog_ops->standby(&t->fe);
t->std = tuner_fixup_std(t, std);
if (t->std != std)
- tuner_dbg("Fixup standard %llx to %llx\n", std, t->std);
+ dprintk("Fixup standard %llx to %llx\n", std, t->std);
set_freq(t, 0);
return 0;
}
struct tuner *t = to_tuner(i2c_get_clientdata(c));
struct analog_demod_ops *analog_ops = &t->fe.ops.analog_ops;
- tuner_dbg("suspend\n");
+ dprintk("suspend\n");
if (t->fe.ops.tuner_ops.suspend)
t->fe.ops.tuner_ops.suspend(&t->fe);
struct i2c_client *c = to_i2c_client(dev);
struct tuner *t = to_tuner(i2c_get_clientdata(c));
- tuner_dbg("resume\n");
+ dprintk("resume\n");
if (t->fe.ops.tuner_ops.resume)
t->fe.ops.tuner_ops.resume(&t->fe);