summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/msp3400-kthreads.c
diff options
context:
space:
mode:
authorHans Verkuil <devnull@localhost>2006-01-02 18:22:39 +0000
committerHans Verkuil <devnull@localhost>2006-01-02 18:22:39 +0000
commit3d80f276313cd11569c95a5aade93a3dff009aaa (patch)
tree8a66b7b9736dab2fc74f36e37c5cbf0ac63cf2be /linux/drivers/media/video/msp3400-kthreads.c
parentf591fa75d8325a9732e155b7db70d8aec349d183 (diff)
downloadmediapointer-dvb-s2-3d80f276313cd11569c95a5aade93a3dff009aaa.tar.gz
mediapointer-dvb-s2-3d80f276313cd11569c95a5aade93a3dff009aaa.tar.bz2
Added new diagnositics macros, convert msp3400 to the new macros.
- Added new v4l_err, v4l_warn, v4l_info and v4l_dbg macros to v4l2-common.h for use in v4l-dvb i2c drivers. This ensures a unique prefix for each device instance. - At a later stage these macros may be reimplemented using the device-generic macros from device.h. - Converted the msp3400 driver to the new macros. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'linux/drivers/media/video/msp3400-kthreads.c')
-rw-r--r--linux/drivers/media/video/msp3400-kthreads.c102
1 files changed, 51 insertions, 51 deletions
diff --git a/linux/drivers/media/video/msp3400-kthreads.c b/linux/drivers/media/video/msp3400-kthreads.c
index 5aa308a02..e68241d90 100644
--- a/linux/drivers/media/video/msp3400-kthreads.c
+++ b/linux/drivers/media/video/msp3400-kthreads.c
@@ -174,7 +174,7 @@ void msp3400c_setmode(struct i2c_client *client, int type)
struct msp_state *state = i2c_get_clientdata(client);
int i;
- msp_dbg1("setmode: %d\n", type);
+ v4l_dbg(1, client, "setmode: %d\n", type);
state->mode = type;
state->audmode = V4L2_TUNER_MODE_MONO;
state->rxsubchans = V4L2_TUNER_SUB_MONO;
@@ -241,7 +241,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
/* this method would break everything, let's make sure
* it's never called
*/
- msp_dbg1("setstereo called with mode=%d instead of set_source (ignored)\n",
+ v4l_dbg(1, client, "setstereo called with mode=%d instead of set_source (ignored)\n",
mode);
return;
}
@@ -249,7 +249,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
/* switch demodulator */
switch (state->mode) {
case MSP_MODE_FM_TERRA:
- msp_dbg1("FM setstereo: %s\n", strmode[mode]);
+ v4l_dbg(1, client, "FM setstereo: %s\n", strmode[mode]);
msp3400c_setcarrier(client,state->second,state->main);
switch (mode) {
case V4L2_TUNER_MODE_STEREO:
@@ -263,7 +263,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
}
break;
case MSP_MODE_FM_SAT:
- msp_dbg1("SAT setstereo: %s\n", strmode[mode]);
+ v4l_dbg(1, client, "SAT setstereo: %s\n", strmode[mode]);
switch (mode) {
case V4L2_TUNER_MODE_MONO:
msp3400c_setcarrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5));
@@ -282,24 +282,24 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
case MSP_MODE_FM_NICAM1:
case MSP_MODE_FM_NICAM2:
case MSP_MODE_AM_NICAM:
- msp_dbg1("NICAM setstereo: %s\n",strmode[mode]);
+ v4l_dbg(1, client, "NICAM setstereo: %s\n",strmode[mode]);
msp3400c_setcarrier(client,state->second,state->main);
if (state->nicam_on)
nicam=0x0100;
break;
case MSP_MODE_BTSC:
- msp_dbg1("BTSC setstereo: %s\n",strmode[mode]);
+ v4l_dbg(1, client, "BTSC setstereo: %s\n",strmode[mode]);
nicam=0x0300;
break;
case MSP_MODE_EXTERN:
- msp_dbg1("extern setstereo: %s\n",strmode[mode]);
+ v4l_dbg(1, client, "extern setstereo: %s\n",strmode[mode]);
nicam = 0x0200;
break;
case MSP_MODE_FM_RADIO:
- msp_dbg1("FM-Radio setstereo: %s\n",strmode[mode]);
+ v4l_dbg(1, client, "FM-Radio setstereo: %s\n",strmode[mode]);
break;
default:
- msp_dbg1("mono setstereo\n");
+ v4l_dbg(1, client, "mono setstereo\n");
return;
}
@@ -314,7 +314,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
break;
case V4L2_TUNER_MODE_MONO:
if (state->mode == MSP_MODE_AM_NICAM) {
- msp_dbg1("switching to AM mono\n");
+ v4l_dbg(1, client, "switching to AM mono\n");
/* AM mono decoding is handled by tuner, not MSP chip */
/* SCART switching control register */
msp_set_scart(client, SCART_MONO, 0);
@@ -328,7 +328,7 @@ void msp3400c_setstereo(struct i2c_client *client, int mode)
src = 0x0010 | nicam;
break;
}
- msp_dbg1("setstereo final source/matrix = 0x%x\n", src);
+ v4l_dbg(1, client, "setstereo final source/matrix = 0x%x\n", src);
if (dolby) {
msp_write_dsp(client, 0x0008, 0x0520);
@@ -348,20 +348,20 @@ static void msp3400c_print_mode(struct i2c_client *client)
struct msp_state *state = i2c_get_clientdata(client);
if (state->main == state->second) {
- msp_dbg1("mono sound carrier: %d.%03d MHz\n",
+ v4l_dbg(1, client, "mono sound carrier: %d.%03d MHz\n",
state->main / 910000, (state->main / 910) % 1000);
} else {
- msp_dbg1("main sound carrier: %d.%03d MHz\n",
+ v4l_dbg(1, client, "main sound carrier: %d.%03d MHz\n",
state->main / 910000, (state->main / 910) % 1000);
}
if (state->mode == MSP_MODE_FM_NICAM1 || state->mode == MSP_MODE_FM_NICAM2)
- msp_dbg1("NICAM/FM carrier : %d.%03d MHz\n",
+ v4l_dbg(1, client, "NICAM/FM carrier : %d.%03d MHz\n",
state->second / 910000, (state->second/910) % 1000);
if (state->mode == MSP_MODE_AM_NICAM)
- msp_dbg1("NICAM/AM carrier : %d.%03d MHz\n",
+ v4l_dbg(1, client, "NICAM/AM carrier : %d.%03d MHz\n",
state->second / 910000, (state->second / 910) % 1000);
if (state->mode == MSP_MODE_FM_TERRA && state->main != state->second) {
- msp_dbg1("FM-stereo carrier : %d.%03d MHz\n",
+ v4l_dbg(1, client, "FM-stereo carrier : %d.%03d MHz\n",
state->second / 910000, (state->second / 910) % 1000);
}
}
@@ -381,7 +381,7 @@ int autodetect_stereo(struct i2c_client *client)
val = msp_read_dsp(client, 0x18);
if (val > 32767)
val -= 65536;
- msp_dbg2("stereo detect register: %d\n", val);
+ v4l_dbg(2, client, "stereo detect register: %d\n", val);
if (val > 4096) {
rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO;
} else if (val < -4096) {
@@ -395,7 +395,7 @@ int autodetect_stereo(struct i2c_client *client)
case MSP_MODE_FM_NICAM2:
case MSP_MODE_AM_NICAM:
val = msp_read_dem(client, 0x23);
- msp_dbg2("nicam sync=%d, mode=%d\n",
+ v4l_dbg(2, client, "nicam sync=%d, mode=%d\n",
val & 1, (val & 0x1e) >> 1);
if (val & 1) {
@@ -428,7 +428,7 @@ int autodetect_stereo(struct i2c_client *client)
break;
case MSP_MODE_BTSC:
val = msp_read_dem(client, 0x200);
- msp_dbg2("status=0x%x (pri=%s, sec=%s, %s%s%s)\n",
+ v4l_dbg(2, client, "status=0x%x (pri=%s, sec=%s, %s%s%s)\n",
val,
(val & 0x0002) ? "no" : "yes",
(val & 0x0004) ? "no" : "yes",
@@ -442,13 +442,13 @@ int autodetect_stereo(struct i2c_client *client)
}
if (rxsubchans != state->rxsubchans) {
update = 1;
- msp_dbg1("watch: rxsubchans %d => %d\n",
+ v4l_dbg(1, client, "watch: rxsubchans %d => %d\n",
state->rxsubchans,rxsubchans);
state->rxsubchans = rxsubchans;
}
if (newnicam != state->nicam_on) {
update = 1;
- msp_dbg1("watch: nicam %d => %d\n",
+ v4l_dbg(1, client, "watch: nicam %d => %d\n",
state->nicam_on,newnicam);
state->nicam_on = newnicam;
}
@@ -488,14 +488,14 @@ int msp3400c_thread(void *data)
msp_setup_thread(state);
#endif
- msp_dbg1("msp3400 daemon started\n");
+ v4l_dbg(1, client, "msp3400 daemon started\n");
for (;;) {
- msp_dbg2("msp3400 thread: sleep\n");
+ v4l_dbg(2, client, "msp3400 thread: sleep\n");
msp_sleep(state, -1);
- msp_dbg2("msp3400 thread: wakeup\n");
+ v4l_dbg(2, client, "msp3400 thread: wakeup\n");
restart:
- msp_dbg1("thread: restart scan\n");
+ v4l_dbg(1, client, "thread: restart scan\n");
state->restart = 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
if (state->rmmod || signal_pending(current))
@@ -507,7 +507,7 @@ int msp3400c_thread(void *data)
if (VIDEO_MODE_RADIO == state->norm ||
MSP_MODE_EXTERN == state->mode) {
/* no carrier scan, just unmute */
- msp_dbg1("thread: no carrier scan\n");
+ v4l_dbg(1, client, "thread: no carrier scan\n");
msp_set_audio(client);
continue;
}
@@ -531,7 +531,7 @@ int msp3400c_thread(void *data)
/* autodetect doesn't work well with AM ... */
max1 = 3;
count = 0;
- msp_dbg1("AM sound override\n");
+ v4l_dbg(1, client, "AM sound override\n");
}
for (this = 0; this < count; this++) {
@@ -543,7 +543,7 @@ int msp3400c_thread(void *data)
val -= 65536;
if (val1 < val)
val1 = val, max1 = this;
- msp_dbg1("carrier1 val: %5d / %s\n", val,cd[this].name);
+ v4l_dbg(1, client, "carrier1 val: %5d / %s\n", val,cd[this].name);
}
/* carrier detect pass #2 -- second (stereo) carrier */
@@ -579,7 +579,7 @@ int msp3400c_thread(void *data)
val -= 65536;
if (val2 < val)
val2 = val, max2 = this;
- msp_dbg1("carrier2 val: %5d / %s\n", val,cd[this].name);
+ v4l_dbg(1, client, "carrier2 val: %5d / %s\n", val,cd[this].name);
}
/* program the msp3400 according to the results */
@@ -667,7 +667,7 @@ int msp3400c_thread(void *data)
watch_stereo(client);
}
}
- msp_dbg1("thread: exit\n");
+ v4l_dbg(1, client, "thread: exit\n");
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
state->kthread = NULL;
@@ -687,15 +687,15 @@ int msp3410d_thread(void *data)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
msp_setup_thread(state);
#endif
- msp_dbg1("msp3410 daemon started\n");
+ v4l_dbg(1, client, "msp3410 daemon started\n");
for (;;) {
- msp_dbg2("msp3410 thread: sleep\n");
+ v4l_dbg(2, client, "msp3410 thread: sleep\n");
msp_sleep(state,-1);
- msp_dbg2("msp3410 thread: wakeup\n");
+ v4l_dbg(2, client, "msp3410 thread: wakeup\n");
restart:
- msp_dbg1("thread: restart scan\n");
+ v4l_dbg(1, client, "thread: restart scan\n");
state->restart = 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
if (state->rmmod || signal_pending(current))
@@ -706,7 +706,7 @@ int msp3410d_thread(void *data)
if (state->mode == MSP_MODE_EXTERN) {
/* no carrier scan needed, just unmute */
- msp_dbg1("thread: no carrier scan\n");
+ v4l_dbg(1, client, "thread: no carrier scan\n");
msp_set_audio(client);
continue;
}
@@ -726,7 +726,7 @@ int msp3410d_thread(void *data)
state->watch_stereo = 0;
if (debug)
- msp_dbg1("setting mode: %s (0x%04x)\n",
+ v4l_dbg(1, client, "setting mode: %s (0x%04x)\n",
msp_standard_mode_name(std), std);
if (std != 1) {
@@ -742,20 +742,20 @@ int msp3410d_thread(void *data)
val = msp_read_dem(client, 0x7e);
if (val < 0x07ff)
break;
- msp_dbg1("detection still in progress\n");
+ v4l_dbg(1, client, "detection still in progress\n");
}
}
for (i = 0; msp_modelist[i].name != NULL; i++)
if (msp_modelist[i].retval == val)
break;
- msp_dbg1("current mode: %s (0x%04x)\n",
+ v4l_dbg(1, client, "current mode: %s (0x%04x)\n",
msp_standard_mode_name(val), val);
state->main = msp_modelist[i].main;
state->second = msp_modelist[i].second;
if (amsound && (state->norm == VIDEO_MODE_SECAM) && (val != 0x0009)) {
/* autodetection has failed, let backup */
- msp_dbg1("autodetection failed,"
+ v4l_dbg(1, client, "autodetection failed,"
" switching to backup mode: %s (0x%04x)\n",
msp_modelist[8].name ? msp_modelist[8].name : "unknown",val);
val = 0x0009;
@@ -844,7 +844,7 @@ int msp3410d_thread(void *data)
watch_stereo(client);
}
}
- msp_dbg1("thread: exit\n");
+ v4l_dbg(1, client, "thread: exit\n");
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
state->kthread = NULL;
@@ -877,7 +877,7 @@ static void msp34xxg_set_source(struct i2c_client *client, int source)
*/
int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20);
- msp_dbg1("set source to %d (0x%x)\n", source, value);
+ v4l_dbg(1, client, "set source to %d (0x%x)\n", source, value);
/* Loudspeaker Output */
msp_write_dsp(client, 0x08, value);
/* SCART1 DA Output */
@@ -948,16 +948,16 @@ int msp34xxg_thread(void *data)
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
msp_setup_thread(state);
#endif
- msp_dbg1("msp34xxg daemon started\n");
+ v4l_dbg(1, client, "msp34xxg daemon started\n");
state->source = 1; /* default */
for (;;) {
- msp_dbg2("msp34xxg thread: sleep\n");
+ v4l_dbg(2, client, "msp34xxg thread: sleep\n");
msp_sleep(state, -1);
- msp_dbg2("msp34xxg thread: wakeup\n");
+ v4l_dbg(2, client, "msp34xxg thread: wakeup\n");
restart:
- msp_dbg1("thread: restart scan\n");
+ v4l_dbg(1, client, "thread: restart scan\n");
state->restart = 0;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
if (state->rmmod || signal_pending(current))
@@ -973,7 +973,7 @@ int msp34xxg_thread(void *data)
goto unmute;
/* watch autodetect */
- msp_dbg1("triggered autodetect, waiting for result\n");
+ v4l_dbg(1, client, "triggered autodetect, waiting for result\n");
for (i = 0; i < 10; i++) {
if (msp_sleep(state, 100))
goto restart;
@@ -984,16 +984,16 @@ int msp34xxg_thread(void *data)
std = val;
break;
}
- msp_dbg2("detection still in progress\n");
+ v4l_dbg(2, client, "detection still in progress\n");
}
if (std == 1) {
- msp_dbg1("detection still in progress after 10 tries. giving up.\n");
+ v4l_dbg(1, client, "detection still in progress after 10 tries. giving up.\n");
continue;
}
unmute:
state->mode = std;
- msp_dbg1("current mode: %s (0x%04x)\n",
+ v4l_dbg(1, client, "current mode: %s (0x%04x)\n",
msp_standard_mode_name(std), std);
/* unmute: dispatch sound to scart output, set scart volume */
@@ -1005,7 +1005,7 @@ int msp34xxg_thread(void *data)
msp_write_dem(client, 0x40, state->i2s_mode);
}
- msp_dbg1("thread: exit\n");
+ v4l_dbg(1, client, "thread: exit\n");
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
state->kthread = NULL;
@@ -1037,7 +1037,7 @@ void msp34xxg_detect_stereo(struct i2c_client *client)
* this is a problem, I'll handle SAP just like lang1/lang2.
*/
}
- msp_dbg1("status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n",
+ v4l_dbg(1, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n",
status, is_stereo, is_bilingual, state->rxsubchans);
}