Commit fac9e899 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

V4L/DVB (3278): convert diagnostics over to the new v4l2-common.h macros.


- Convert diagnostics over to the new v4l2-common.h macros.
- deprecated tuner_debug option, the new option is debug.
- renamed cx25840_debug to debug.
Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@brturbo.com.br>
parent 0e7072ef
......@@ -27,7 +27,7 @@
#include <linux/i2c.h>
#include <linux/i2c-id.h>
#include <linux/videodev.h>
#include <media/audiochip.h>
#include <media/v4l2-common.h>
MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC");
MODULE_AUTHOR("Martin Vaughan");
......@@ -39,21 +39,6 @@ module_param(debug, bool, 0644);
MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On");
#define cs53l32a_dbg(fmt, arg...) \
do { \
if (debug) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)
#define cs53l32a_err(fmt, arg...) do { \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define cs53l32a_info(fmt, arg...) do { \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END };
......@@ -84,7 +69,7 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
the second goes through the PGA. Hence there are three
possible inputs to choose from. */
if (input->index > 2) {
cs53l32a_err("Invalid input %d.\n", input->index);
v4l_err(client, "Invalid input %d.\n", input->index);
return -EINVAL;
}
cs53l32a_write(client, 0x01, 0x01 + (input->index << 4));
......@@ -124,9 +109,9 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
u8 m = cs53l32a_read(client, 0x03);
s8 vol = cs53l32a_read(client, 0x04);
cs53l32a_info("Input: %d%s\n", (v >> 4) & 3,
v4l_info(client, "Input: %d%s\n", (v >> 4) & 3,
(m & 0xC0) ? " (muted)" : "");
cs53l32a_info("Volume: %d dB\n", vol);
v4l_info(client, "Volume: %d dB\n", vol);
break;
}
......@@ -166,12 +151,12 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
client->driver = &i2c_driver;
snprintf(client->name, sizeof(client->name) - 1, "cs53l32a");
cs53l32a_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name);
v4l_info(client, "chip found @ 0x%x (%s)\n", address << 1, adapter->name);
for (i = 1; i <= 7; i++) {
u8 v = cs53l32a_read(client, i);
cs53l32a_dbg("Read Reg %d %02x\n", i, v);
v4l_dbg(1, client, "Read Reg %d %02x\n", i, v);
}
/* Set cs53l32a internal register for Adaptec 2010/2410 setup */
......@@ -189,7 +174,7 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
for (i = 1; i <= 7; i++) {
u8 v = cs53l32a_read(client, i);
cs53l32a_dbg("Read Reg %d %02x\n", i, v);
v4l_dbg(1, client, "Read Reg %d %02x\n", i, v);
}
i2c_attach_client(client);
......
......@@ -43,11 +43,11 @@ MODULE_LICENSE("GPL");
static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };
int cx25840_debug = 0;
int debug = 0;
module_param(cx25840_debug, bool, 0644);
module_param(debug, bool, 0644);
MODULE_PARM_DESC(cx25840_debug, "Debugging messages [0=Off (default) 1=On]");
MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]");
I2C_CLIENT_INSMOD;
......@@ -265,7 +265,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
vid_input <= CX25840_COMPOSITE8);
u8 reg;
cx25840_dbg("decoder set video input %d, audio input %d\n",
v4l_dbg(1, client, "decoder set video input %d, audio input %d\n",
vid_input, aud_input);
if (is_composite) {
......@@ -277,7 +277,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
if ((vid_input & ~0xff0) ||
luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA4 ||
chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) {
cx25840_err("0x%04x is not a valid video input!\n", vid_input);
v4l_err(client, "0x%04x is not a valid video input!\n", vid_input);
return -EINVAL;
}
reg = 0xf0 + ((luma - CX25840_SVIDEO_LUMA1) >> 4);
......@@ -301,7 +301,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
case CX25840_AUDIO8: reg &= ~0xc0; reg |= 0x40; break;
default:
cx25840_err("0x%04x is not a valid audio input!\n", aud_input);
v4l_err(client, "0x%04x is not a valid audio input!\n", aud_input);
return -EINVAL;
}
......@@ -396,7 +396,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
case V4L2_CID_BRIGHTNESS:
if (ctrl->value < 0 || ctrl->value > 255) {
cx25840_err("invalid brightness setting %d\n",
v4l_err(client, "invalid brightness setting %d\n",
ctrl->value);
return -ERANGE;
}
......@@ -406,7 +406,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
case V4L2_CID_CONTRAST:
if (ctrl->value < 0 || ctrl->value > 127) {
cx25840_err("invalid contrast setting %d\n",
v4l_err(client, "invalid contrast setting %d\n",
ctrl->value);
return -ERANGE;
}
......@@ -416,7 +416,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
case V4L2_CID_SATURATION:
if (ctrl->value < 0 || ctrl->value > 127) {
cx25840_err("invalid saturation setting %d\n",
v4l_err(client, "invalid saturation setting %d\n",
ctrl->value);
return -ERANGE;
}
......@@ -427,7 +427,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
case V4L2_CID_HUE:
if (ctrl->value < -127 || ctrl->value > 127) {
cx25840_err("invalid hue setting %d\n", ctrl->value);
v4l_err(client, "invalid hue setting %d\n", ctrl->value);
return -ERANGE;
}
......@@ -515,7 +515,7 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) ||
(Vlines * 8 < Vsrc) || (Vsrc < Vlines)) {
cx25840_err("%dx%d is not a valid size!\n",
v4l_err(client, "%dx%d is not a valid size!\n",
pix->width, pix->height);
return -ERANGE;
}
......@@ -533,7 +533,7 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
else
filter = 3;
cx25840_dbg("decoder set size %dx%d -> scale %ux%u\n",
v4l_dbg(1, client, "decoder set size %dx%d -> scale %ux%u\n",
pix->width, pix->height, HSC, VSC);
/* HSCALE=HSC */
......@@ -602,13 +602,13 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
return cx25840_audio(client, cmd, arg);
case VIDIOC_STREAMON:
cx25840_dbg("enable output\n");
v4l_dbg(1, client, "enable output\n");
cx25840_write(client, 0x115, 0x8c);
cx25840_write(client, 0x116, 0x07);
break;
case VIDIOC_STREAMOFF:
cx25840_dbg("disable output\n");
v4l_dbg(1, client, "disable output\n");
cx25840_write(client, 0x115, 0x00);
cx25840_write(client, 0x116, 0x00);
break;
......@@ -774,7 +774,7 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
client->driver = &i2c_driver_cx25840;
snprintf(client->name, sizeof(client->name) - 1, "cx25840");
cx25840_dbg("detecting cx25840 client on address 0x%x\n", address << 1);
v4l_dbg(1, client, "detecting cx25840 client on address 0x%x\n", address << 1);
device_id = cx25840_read(client, 0x101) << 8;
device_id |= cx25840_read(client, 0x100);
......@@ -782,12 +782,12 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
/* The high byte of the device ID should be
* 0x84 if chip is present */
if ((device_id & 0xff00) != 0x8400) {
cx25840_dbg("cx25840 not found\n");
v4l_dbg(1, client, "cx25840 not found\n");
kfree(client);
return 0;
}
cx25840_info("cx25%3x-2%x found @ 0x%x (%s)\n",
v4l_info(client, "cx25%3x-2%x found @ 0x%x (%s)\n",
(device_id & 0xfff0) >> 4,
(device_id & 0x0f) < 3 ? (device_id & 0x0f) + 1 : 3,
address << 1, adapter->name);
......@@ -891,9 +891,9 @@ static void log_status(struct i2c_client *client)
int aud_input = state->aud_input;
char *p;
cx25840_info("Video signal: %spresent\n",
v4l_info(client, "Video signal: %spresent\n",
(microctrl_vidfmt & 0x10) ? "" : "not ");
cx25840_info("Detected format: %s\n",
v4l_info(client, "Detected format: %s\n",
fmt_strs[gen_stat1 & 0xf]);
switch (mod_det_stat0) {
......@@ -908,7 +908,7 @@ static void log_status(struct i2c_client *client)
case 0xfe: p = "forced mode"; break;
default: p = "not defined";
}
cx25840_info("Detected audio mode: %s\n", p);
v4l_info(client, "Detected audio mode: %s\n", p);
switch (mod_det_stat1) {
case 0x00: p = "not defined"; break;
......@@ -934,10 +934,10 @@ static void log_status(struct i2c_client *client)
case 0xff: p = "no detected audio standard"; break;
default: p = "not defined";
}
cx25840_info("Detected audio standard: %s\n", p);
cx25840_info("Audio muted: %s\n",
v4l_info(client, "Detected audio standard: %s\n", p);
v4l_info(client, "Audio muted: %s\n",
(mute_ctl & 0x2) ? "yes" : "no");
cx25840_info("Audio microcontroller: %s\n",
v4l_info(client, "Audio microcontroller: %s\n",
(download_ctl & 0x10) ? "running" : "stopped");
switch (audio_config >> 4) {
......@@ -959,7 +959,7 @@ static void log_status(struct i2c_client *client)
case 0x0f: p = "automatic detection"; break;
default: p = "undefined";
}
cx25840_info("Configured audio standard: %s\n", p);
v4l_info(client, "Configured audio standard: %s\n", p);
if ((audio_config >> 4) < 0xF) {
switch (audio_config & 0xF) {
......@@ -976,7 +976,7 @@ static void log_status(struct i2c_client *client)
case 0x0a: p = "SAP"; break;
default: p = "undefined";
}
cx25840_info("Configured audio mode: %s\n", p);
v4l_info(client, "Configured audio mode: %s\n", p);
} else {
switch (audio_config & 0xF) {
case 0x00: p = "BG"; break;
......@@ -992,27 +992,27 @@ static void log_status(struct i2c_client *client)
case 0x0f: p = "automatic standard and mode detection"; break;
default: p = "undefined";
}
cx25840_info("Configured audio system: %s\n", p);
v4l_info(client, "Configured audio system: %s\n", p);
}
cx25840_info("Specified standard: %s\n",
v4l_info(client, "Specified standard: %s\n",
vidfmt_sel ? fmt_strs[vidfmt_sel] : "automatic detection");
if (vid_input >= CX25840_COMPOSITE1 &&
vid_input <= CX25840_COMPOSITE8) {
cx25840_info("Specified video input: Composite %d\n",
v4l_info(client, "Specified video input: Composite %d\n",
vid_input - CX25840_COMPOSITE1 + 1);
} else {
cx25840_info("Specified video input: S-Video (Luma In%d, Chroma In%d)\n",
v4l_info(client, "Specified video input: S-Video (Luma In%d, Chroma In%d)\n",
(vid_input & 0xf0) >> 4, (vid_input & 0xf00) >> 8);
}
if (aud_input) {
cx25840_info("Specified audio input: Tuner (In%d)\n", aud_input);
v4l_info(client, "Specified audio input: Tuner (In%d)\n", aud_input);
} else {
cx25840_info("Specified audio input: External\n");
v4l_info(client, "Specified audio input: External\n");
}
cx25840_info("Specified audioclock freq: %d Hz\n", state->audclk_freq);
v4l_info(client, "Specified audioclock freq: %d Hz\n", state->audclk_freq);
switch (pref_mode & 0xf) {
case 0: p = "mono/language A"; break;
......@@ -1025,7 +1025,7 @@ static void log_status(struct i2c_client *client)
case 7: p = "language AB"; break;
default: p = "undefined";
}
cx25840_info("Preferred audio mode: %s\n", p);
v4l_info(client, "Preferred audio mode: %s\n", p);
if ((audio_config & 0xf) == 0xf) {
switch ((afc0 >> 3) & 0x3) {
......@@ -1034,7 +1034,7 @@ static void log_status(struct i2c_client *client)
case 2: p = "autodetect"; break;
default: p = "undefined";
}
cx25840_info("Selected 65 MHz format: %s\n", p);
v4l_info(client, "Selected 65 MHz format: %s\n", p);
switch (afc0 & 0x7) {
case 0: p = "chroma"; break;
......@@ -1044,6 +1044,6 @@ static void log_status(struct i2c_client *client)
case 4: p = "autodetect"; break;
default: p = "undefined";
}
cx25840_info("Selected 45 MHz format: %s\n", p);
v4l_info(client, "Selected 45 MHz format: %s\n", p);
}
}
......@@ -83,11 +83,11 @@ static inline int check_fw_load(struct i2c_client *client, int size)
s |= cx25840_read(client, 0x800);
if (size != s) {
cx25840_err("firmware %s load failed\n", firmware);
v4l_err(client, "firmware %s load failed\n", firmware);
return -EINVAL;
}
cx25840_info("loaded %s firmware (%d bytes)\n", firmware, size);
v4l_info(client, "loaded %s firmware (%d bytes)\n", firmware, size);
return 0;
}
......@@ -98,7 +98,7 @@ static inline int fw_write(struct i2c_client *client, u8 * data, int size)
if ((sent = i2c_master_send(client, data, size)) < size) {
if (fastfw) {
cx25840_err("333MHz i2c firmware load failed\n");
v4l_err(client, "333MHz i2c firmware load failed\n");
fastfw = 0;
set_i2c_delay(client, 10);
......@@ -111,13 +111,12 @@ static inline int fw_write(struct i2c_client *client, u8 * data, int size)
}
if (i2c_master_send(client, data, size) < size) {
cx25840_err
("100MHz i2c firmware load failed\n");
v4l_err(client, "100MHz i2c firmware load failed\n");
return -ENOSYS;
}
} else {
cx25840_err("firmware load i2c failure\n");
v4l_err(client, "firmware load i2c failure\n");
return -ENOSYS;
}
......@@ -133,7 +132,7 @@ int cx25840_loadfw(struct i2c_client *client)
int size, send, retval;
if (request_firmware(&fw, firmware, FWDEV(client)) != 0) {
cx25840_err("unable to open firmware %s\n", firmware);
v4l_err(client, "unable to open firmware %s\n", firmware);
return -EINVAL;
}
......
......@@ -20,25 +20,9 @@
#ifndef _CX25840_H_
#define _CX25840_H_
#include <linux/videodev2.h>
#include <linux/i2c.h>
extern int cx25840_debug;
#define cx25840_dbg(fmt, arg...) do { if (cx25840_debug) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define cx25840_err(fmt, arg...) do { \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define cx25840_info(fmt, arg...) do { \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
/* ENABLE_PVR150_WORKAROUND activates a workaround for a hardware bug that is
present in Hauppauge PVR-150 (and possibly PVR-500) cards that have
certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The
......
......@@ -80,12 +80,12 @@ int stereo_threshold = 0x190; /* a2 threshold for stereo/bilingual
module_param(opmode, int, 0444);
/* read-write */
module_param(once, int, 0644);
module_param(once, bool, 0644);
module_param(debug, int, 0644);
module_param(stereo_threshold, int, 0644);
module_param(standard, int, 0644);
module_param(amsound, int, 0644);
module_param(dolby, int, 0644);
module_param(amsound, bool, 0644);
module_param(dolby, bool, 0644);
MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect");
MODULE_PARM_DESC(once, "No continuous stereo monitoring");
......
......@@ -20,6 +20,9 @@ module_param(tv_antenna, int, 0644);
static unsigned int radio_antenna = 0;
module_param(radio_antenna, int, 0644);
/* from tuner-core.c */
extern int debug;
/* ---------------------------------------------------------------------- */
#define MT2032 0x04
......@@ -401,7 +404,7 @@ static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned
div2a=(lo2/8)-1;
div2b=lo2-(div2a+1)*8;
if (tuner_debug > 1) {
if (debug > 1) {
tuner_dbg("lo1 lo2 = %d %d\n", lo1, lo2);
tuner_dbg("num1 num2 div1a div1b div2a div2b= %x %x %x %x %x %x\n",
num1,num2,div1a,div1b,div2a,div2b);
......@@ -417,7 +420,7 @@ static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned
buf[5]=div2a;
if(num2!=0) buf[5]=buf[5]|0x40;
if (tuner_debug > 1) {
if (debug > 1) {
int i;
tuner_dbg("bufs is: ");
for(i=0;i<6;i++)
......@@ -505,7 +508,7 @@ int microtune_init(struct i2c_client *c)
i2c_master_send(c,buf,1);
i2c_master_recv(c,buf,21);
if (tuner_debug) {
if (debug) {
int i;
tuner_dbg("MT20xx hexdump:");
for(i=0;i<21;i++) {
......
This diff is collapsed.
......@@ -66,30 +66,6 @@ module_param(test_image, int, 0644);
MODULE_PARM_DESC(debug, "debug level (0-2)");
MODULE_PARM_DESC(test_image, "test_image (0-1)");
#define saa7127_dbg(fmt, arg...) \
do { \
if (debug >= 1) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)
/* High volume debug. Use with care. */
#define saa7127_dbg_highvol(fmt, arg...) \
do { \
if (debug == 2) \
printk(KERN_INFO "%s debug %d-%04x: " fmt, \
client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); \
} while (0)
#define saa7127_err(fmt, arg...) do { \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define saa7127_info(fmt, arg...) do { \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };
......@@ -336,7 +312,7 @@ static int saa7127_write(struct i2c_client *client, u8 reg, u8 val)
if (i2c_smbus_write_byte_data(client, reg, val) == 0)
return 0;
}
saa7127_err("I2C Write Problem\n");
v4l_err(client, "I2C Write Problem\n");
return -1;
}
......@@ -362,7 +338,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat
if (enable && (data->field != 0 || data->line != 16))
return -EINVAL;
if (state->vps_enable != enable) {
saa7127_dbg("Turn VPS Signal %s\n", enable ? "on" : "off");
v4l_dbg(1, client, "Turn VPS Signal %s\n", enable ? "on" : "off");
saa7127_write(client, 0x54, enable << 7);
state->vps_enable = enable;
}
......@@ -374,7 +350,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat
state->vps_data[2] = data->data[11];
state->vps_data[3] = data->data[12];
state->vps_data[4] = data->data[13];
saa7127_dbg("Set VPS data %02x %02x %02x %02x %02x\n",
v4l_dbg(1, client, "Set VPS data %02x %02x %02x %02x %02x\n",
state->vps_data[0], state->vps_data[1],
state->vps_data[2], state->vps_data[3],
state->vps_data[4]);
......@@ -397,7 +373,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data
if (enable && (data->field != 0 || data->line != 21))
return -EINVAL;
if (state->cc_enable != enable) {
saa7127_dbg("Turn CC %s\n", enable ? "on" : "off");
v4l_dbg(1, client, "Turn CC %s\n", enable ? "on" : "off");
saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
(state->xds_enable << 7) | (enable << 6) | 0x11);
state->cc_enable = enable;
......@@ -405,7 +381,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data
if (!enable)
return 0;
saa7127_dbg_highvol("CC data: %04x\n", cc);
v4l_dbg(2, client, "CC data: %04x\n", cc);
saa7127_write(client, SAA7127_REG_LINE_21_ODD_0, cc & 0xff);
saa7127_write(client, SAA7127_REG_LINE_21_ODD_1, cc >> 8);
state->cc_data = cc;
......@@ -423,7 +399,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat
if (enable && (data->field != 1 || data->line != 21))
return -EINVAL;
if (state->xds_enable != enable) {
saa7127_dbg("Turn XDS %s\n", enable ? "on" : "off");
v4l_dbg(1, client, "Turn XDS %s\n", enable ? "on" : "off");
saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
(enable << 7) | (state->cc_enable << 6) | 0x11);
state->xds_enable = enable;
......@@ -431,7 +407,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat
if (!enable)
return 0;
saa7127_dbg_highvol("XDS data: %04x\n", xds);
v4l_dbg(2, client, "XDS data: %04x\n", xds);
saa7127_write(client, SAA7127_REG_LINE_21_EVEN_0, xds & 0xff);
saa7127_write(client, SAA7127_REG_LINE_21_EVEN_1, xds >> 8);
state->xds_data = xds;
......@@ -448,7 +424,7 @@ static int saa7127_set_wss(struct i2c_client *client, struct v4l2_sliced_vbi_dat
if (enable && (data->field != 0 || data->line != 23))
return -EINVAL;
if (state->wss_enable != enable) {
saa7127_dbg("Turn WSS %s\n", enable ? "on" : "off");
v4l_dbg(1, client, "Turn WSS %s\n", enable ? "on" : "off");
saa7127_write(client, 0x27, enable << 7);
state->wss_enable = enable;
}
......@@ -457,7 +433,7 @@ static int saa7127_set_wss(struct i2c_client *client, struct v4l2_sliced_vbi_dat
saa7127_write(client, 0x26, data->data[0]);
saa7127_write(client, 0x27, 0x80 | (data->data[1] & 0x3f));
saa7127_dbg("WSS mode: %s\n", wss_strs[data->data[0] & 0xf]);
v4l_dbg(1, client, "WSS mode: %s\n", wss_strs[data->data[0] & 0xf]);
state->wss_mode = (data->data[1] & 0x3f) << 8 | data->data[0];
return 0;
}
......@@ -469,11 +445,11 @@ static int saa7127_set_video_enable(struct i2c_client *client, int enable)
struct saa7127_state *state = i2c_get_clientdata(client);
if (enable) {
saa7127_dbg("Enable Video Output\n");
v4l_dbg(1, client, "Enable Video Output\n");
saa7127_write(client, 0x2d, state->reg_2d);
saa7127_write(client, 0x61, state->reg_61);
} else {
saa7127_dbg("Disable Video Output\n");
v4l_dbg(1, client, "Disable Video Output\n");
saa7127_write(client, 0x2d, (state->reg_2d & 0xf0));
saa7127_write(client, 0x61, (state->reg_61 | 0xc0));
}
......@@ -489,11 +465,11 @@ static int saa7127_set_std(struct i2c_client *client, v4l2_std_id std)
const struct i2c_reg_value *inittab;
if (std & V4L2_STD_525_60) {
saa7127_dbg("Selecting 60 Hz video Standard\n");
v4l_dbg(1, client, "Selecting 60 Hz video Standard\n");
inittab = saa7127_init_config_60hz;
state->reg_61 = SAA7127_60HZ_DAC_CONTROL;
} else {
saa7127_dbg("Selecting 50 Hz video Standard\n");
v4l_dbg(1, client, "Selecting 50 Hz video Standard\n");
inittab = saa7127_init_config_50hz;
state->reg_61 = SAA7127_50HZ_DAC_CONTROL;
}
......@@ -544,7 +520,7 @@ static int saa7127_set_output_type(struct i2c_client *client, int output)
default:
return -EINVAL;
}
saa7127_dbg("Selecting %s output type\n", output_strs[output]);
v4l_dbg(1, client, "Selecting %s output type\n", output_strs[output]);
/* Configure Encoder */
saa7127_write(client, 0x2d, state->reg_2d);
......@@ -561,12 +537,12 @@ static int saa7127_set_input_type(struct i2c_client *client, int input)
switch (input) {
case SAA7127_INPUT_TYPE_NORMAL: /* avia */
saa7127_dbg("Selecting Normal Encoder Input\n");
v4l_dbg(1, client, "Selecting Normal Encoder Input\n");
state->reg_3a_cb = 0;
break;
case SAA7127_INPUT_TYPE_TEST_IMAGE: /* color bar */
saa7127_dbg("Selecting Color Bar generator\n");
v4l_dbg(1, client, "Selecting Color Bar generator\n");
state->reg_3a_cb = 0x80;
break;
......@@ -633,14 +609,14 @@ static int saa7127_command(struct i2c_client *client,
break;
case VIDIOC_LOG_STATUS:
saa7127_info("Standard: %s\n", (state->std & V4L2_STD_525_60) ? "60 Hz" : "50 Hz");
saa7127_info("Input: %s\n", state->input_type ? "color bars" : "normal");
saa7127_info("Output: %s\n", state->video_enable ?
v4l_info(client, "Standard: %s\n", (state->std & V4L2_STD_525_60) ? "60 Hz" : "50 Hz");
v4l_info(client, "Input: %s\n", state->input_type ? "color bars" : "normal");
v4l_info(client, "Output: %s\n", state->video_enable ?
output_strs[state->output_type] : "disabled");
saa7127_info("WSS: %s\n", state->wss_enable ?
v4l_info(client, "WSS: %s\n", state->wss_enable ?
wss_strs[state->wss_mode] : "disabled");
saa7127_info("VPS: %s\n", state->vps_enable ? "enabled" : "disabled");
saa7127_info("CC: %s\n", state->cc_enable ? "enabled" : "disabled");
v4l_info(client, "VPS: %s\n", state->vps_enable ? "enabled" : "disabled");
v4l_info(client, "CC: %s\n", state->cc_enable ? "enabled" : "disabled");
break;
#ifdef CONFIG_VIDEO_ADV_DEBUG
......@@ -723,7 +699,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
client->driver = &i2c_driver_saa7127;
snprintf(client->name, sizeof(client->name) - 1, "saa7127");
saa7127_dbg("detecting saa7127 client on address 0x%x\n", address << 1);
v4l_dbg(1, client, "detecting saa7127 client on address 0x%x\n", address << 1);
/* First test register 0: Bits 5-7 are a version ID (should be 0),
and bit 2 should also be 0.
......@@ -732,7 +708,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
0x1d after a reset and not expected to ever change. */
if ((saa7127_read(client, 0) & 0xe4) != 0 ||
(saa7127_read(client, 0x29) & 0x3f) != 0x1d) {
saa7127_dbg("saa7127 not found\n");
v4l_dbg(1, client, "saa7127 not found\n");
kfree(client);
return 0;
}
......@@ -748,7 +724,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
/* Configure Encoder */
saa7127_dbg("Configuring encoder\n");
v4l_dbg(1, client, "Configuring encoder\n");
saa7127_write_inittab(client, saa7127_init_config_common);
saa7127_set_std(client, V4L2_STD_NTSC);
saa7127_set_output_type(client, SAA7127_OUTPUT_TYPE_BOTH);
......@@ -769,12 +745,12 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2);
saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa);
if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) {
saa7127_info("saa7129 found @ 0x%x (%s)\n", address << 1, adapter->name);
v4l_info(client, "saa7129 found @ 0x%x (%s)\n", address << 1, adapter->name);
saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result);
saa7127_write_inittab(client, saa7129_init_config_extra);
state->ident = V4L2_IDENT_SAA7129;
} else {
saa7127_info("saa7127 found @ 0x%x (%s)\n", address << 1, adapter->name);
v4l_info(client, "saa7127 found @ 0x%x (%s)\n", address << 1, adapter->name);
state->ident = V4L2_IDENT_SAA7127;
}
......
......@@ -17,6 +17,9 @@
#define PREFIX "TEA5767 "
/* from tuner-core.c */
extern int debug;
/*****************************************************************************/
/******************************
......@@ -246,7 +249,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
if (5 != (rc = i2c_master_send(c, buffer, 5)))
tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
if (tuner_debug) {
if (debug) {
if (5 != (rc = i2c_master_recv(c, buffer, 5)))
tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
else
......
......@@ -23,8 +23,6 @@
#include <media/v4l2-common.h>
#include <media/audiochip.h>
#include "msp3400.h"
#define UNSET (-1U)
/* standard i2c insmod options */
......@@ -43,7 +41,8 @@ static unsigned int no_autodetect = 0;
static unsigned int show_i2c = 0;
/* insmod options used at runtime => read/write */
unsigned int tuner_debug = 0;
static unsigned int tuner_debug = 0;
int debug = 0;
static unsigned int tv_range[2] = { 44, 958 };
static unsigned int radio_range[2] = { 65, 108 };
......@@ -55,7 +54,9 @@ static char ntsc[] = "-";
module_param(addr, int, 0444);
module_param(no_autodetect, int, 0444);
module_param(show_i2c, int, 0444);
module_param(tuner_debug, int, 0644);
/* Note: tuner_debug is deprecated and will be removed in 2.6.17 */
module_param(tuner_debug, int, 0444);
module_param(debug, int, 0644);
module_param_string(pal, pal, sizeof(pal), 0644);
module_param_string(secam, secam, sizeof(secam), 0644);
......@@ -419,6 +420,11 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */
t->audmode = V4L2_TUNER_MODE_STEREO;
t->mode_mask = T_UNINITIALIZED;
if (tuner_debug) {
debug = tuner_debug;
printk(KERN_ERR "tuner: tuner_debug is deprecated and will be removed in 2.6.17.\n");
printk(KERN_ERR "tuner: use the debug option instead.\n");
}
if (show_i2c) {
unsigned char buffer[16];
......@@ -546,7 +552,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
{
struct tuner *t = i2c_get_clientdata(client);
if (tuner_debug>1)
if (debug>1)
v4l_i2c_print_ioctl(&(t->i2c),cmd);
switch (cmd) {
......
This diff is collapsed.
......@@ -40,6 +40,7 @@
#include <media/tuner.h>
#include <media/tveeprom.h>
#include <media/v4l2-common.h>
#include <media/audiochip.h>
MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver");
......@@ -52,16 +53,14 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
#define STRM(array,i) (i < sizeof(array)/sizeof(char*) ? array[i] : "unknown")
#define tveeprom_info(fmt, arg...) do {\
printk(KERN_INFO "tveeprom %d-%04x: " fmt, \
c->adapter->nr, c->addr , ##arg); } while (0)
#define tveeprom_warn(fmt, arg...) do {\
printk(KERN_WARNING "tveeprom %d-%04x: " fmt, \
c->adapter->nr, c->addr , ##arg); } while (0)
#define tveeprom_dbg(fmt, arg...) do {\
#define tveeprom_info(fmt, arg...) \
v4l_printk(KERN_INFO, "tveeprom", c->adapter, c->addr, fmt , ## arg)
#define tveeprom_warn(fmt, arg...) \
v4l_printk(KERN_WARNING, "tveeprom", c->adapter, c->addr, fmt , ## arg)
#define tveeprom_dbg(fmt, arg...) do { \
if (debug) \
printk(KERN_INFO "tveeprom %d-%04x: " fmt, \
c->adapter->nr, c->addr , ##arg); } while (0)
v4l_printk(KERN_DEBUG, "tveeprom", c->adapter, c->addr, fmt , ## arg); \
} while (0)
/*
* The Hauppauge eeprom uses an 8bit field to determine which
......
......@@ -32,20 +32,12 @@
#include <linux/i2c.h>
#include <linux/i2c-id.h>
#include <linux/videodev.h>
#include <media/audiochip.h>
#include <media/v4l2-common.h>
MODULE_DESCRIPTION("wm8775 driver");
MODULE_AUTHOR("Ulf Eklund, Hans Verkuil");
MODULE_LICENSE("GPL");
#define wm8775_err(fmt, arg...) do { \
printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
#define wm8775_info(fmt, arg...) do { \
printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
static unsigned short normal_i2c[] = { 0x36 >> 1, I2C_CLIENT_END };
......@@ -69,7 +61,7 @@ static int wm8775_write(struct i2c_client *client, int reg, u16 val)
int i;
if (reg < 0 || reg >= TOT_REGS) {
wm8775_err("Invalid register R%d\n", reg);
v4l_err(client, "Invalid register R%d\n", reg);
return -1;
}
......@@ -79,7 +71,7 @@ static int wm8775_write(struct i2c_client *client, int reg, u16 val)
return 0;
}
}
wm8775_err("I2C: cannot write %03x to register R%d\n", val, reg);
v4l_err(client, "I2C: cannot write %03x to register R%d\n", val, reg);
return -1;
}
......@@ -98,7 +90,7 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd,
If only one input is active (the normal case) then the
input values 1, 2, 4 or 8 should be used. */
if (input->index > 15) {
wm8775_err("Invalid input %d.\n", input->index);
v4l_err(client, "Invalid input %d.\n", input->index);
return -EINVAL;
}
state->input = input->index;
......@@ -133,7 +125,7 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd,
break;
case VIDIOC_LOG_STATUS:
wm8775_info("Input: %d%s\n", state->input,
v4l_info(client, "Input: %d%s\n", state->input,
state->muted ? " (muted)" : "");
break;
......@@ -184,7 +176,7 @@ static int wm8775_attach(struct i2c_adapter *adapter, int address, int kind)
client->driver = &i2c_driver;
snprintf(client->name, sizeof(client->name) - 1, "wm8775");
wm8775_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name);
v4l_info(client, "chip found @ 0x%x (%s)\n", address << 1, adapter->name);
state = kmalloc(sizeof(struct wm8775_state), GFP_KERNEL);
if (state == NULL) {
......
......@@ -202,7 +202,6 @@ struct tuner {
void (*standby)(struct i2c_client *c);
};
extern unsigned int tuner_debug;
extern unsigned const int tuner_count;
extern int microtune_init(struct i2c_client *c);
......@@ -220,7 +219,8 @@ extern int tea5767_autodetection(struct i2c_client *c);
printk(KERN_INFO "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
#define tuner_dbg(fmt, arg...) do {\
if (tuner_debug) \
extern int debug; \
if (debug) \
printk(KERN_DEBUG "%s %d-%04x: " fmt, t->i2c.driver->driver.name, \
i2c_adapter_id(t->i2c.adapter), t->i2c.addr , ##arg); } while (0)
......
......@@ -51,6 +51,7 @@
parameter called 'debug'. */
#define v4l_dbg(level, client, fmt, arg...) \
do { \
extern int debug; \
if (debug >= (level)) \
v4l_client_printk(KERN_DEBUG, client, fmt , ## arg); \
} while (0)
......
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