diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2006-01-09 12:32:40 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@brturbo.com.br> | 2006-01-09 12:32:40 -0500 |
commit | 7e8b09ea1636e360a8fabebeaeb91c17f64e01b5 (patch) | |
tree | ac850285b7fe128cc3a2a821a8b73bdf550a7f79 /drivers/media/video/msp3400-driver.c | |
parent | 53b0a1c60bcc167534b31f56adfbbe2919e6f80b (diff) |
V4L/DVB (3276): 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>
Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media/video/msp3400-driver.c')
-rw-r--r-- | drivers/media/video/msp3400-driver.c | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index de79c641583a..4c0c7bed2edf 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -129,11 +129,11 @@ int msp_reset(struct i2c_client *client) | |||
129 | { client->addr, I2C_M_RD, 2, read }, | 129 | { client->addr, I2C_M_RD, 2, read }, |
130 | }; | 130 | }; |
131 | 131 | ||
132 | msp_dbg3("msp_reset\n"); | 132 | v4l_dbg(3, client, "msp_reset\n"); |
133 | if (i2c_transfer(client->adapter, &reset[0], 1) != 1 || | 133 | if (i2c_transfer(client->adapter, &reset[0], 1) != 1 || |
134 | i2c_transfer(client->adapter, &reset[1], 1) != 1 || | 134 | i2c_transfer(client->adapter, &reset[1], 1) != 1 || |
135 | i2c_transfer(client->adapter, test, 2) != 2) { | 135 | i2c_transfer(client->adapter, test, 2) != 2) { |
136 | msp_err("chip reset failed\n"); | 136 | v4l_err(client, "chip reset failed\n"); |
137 | return -1; | 137 | return -1; |
138 | } | 138 | } |
139 | return 0; | 139 | return 0; |
@@ -156,18 +156,18 @@ static int msp_read(struct i2c_client *client, int dev, int addr) | |||
156 | for (err = 0; err < 3; err++) { | 156 | for (err = 0; err < 3; err++) { |
157 | if (i2c_transfer(client->adapter, msgs, 2) == 2) | 157 | if (i2c_transfer(client->adapter, msgs, 2) == 2) |
158 | break; | 158 | break; |
159 | msp_warn("I/O error #%d (read 0x%02x/0x%02x)\n", err, | 159 | v4l_warn(client, "I/O error #%d (read 0x%02x/0x%02x)\n", err, |
160 | dev, addr); | 160 | dev, addr); |
161 | current->state = TASK_INTERRUPTIBLE; | 161 | current->state = TASK_INTERRUPTIBLE; |
162 | schedule_timeout(msecs_to_jiffies(10)); | 162 | schedule_timeout(msecs_to_jiffies(10)); |
163 | } | 163 | } |
164 | if (err == 3) { | 164 | if (err == 3) { |
165 | msp_warn("giving up, resetting chip. Sound will go off, sorry folks :-|\n"); | 165 | v4l_warn(client, "giving up, resetting chip. Sound will go off, sorry folks :-|\n"); |
166 | msp_reset(client); | 166 | msp_reset(client); |
167 | return -1; | 167 | return -1; |
168 | } | 168 | } |
169 | retval = read[0] << 8 | read[1]; | 169 | retval = read[0] << 8 | read[1]; |
170 | msp_dbg3("msp_read(0x%x, 0x%x): 0x%x\n", dev, addr, retval); | 170 | v4l_dbg(3, client, "msp_read(0x%x, 0x%x): 0x%x\n", dev, addr, retval); |
171 | return retval; | 171 | return retval; |
172 | } | 172 | } |
173 | 173 | ||
@@ -192,17 +192,17 @@ static int msp_write(struct i2c_client *client, int dev, int addr, int val) | |||
192 | buffer[3] = val >> 8; | 192 | buffer[3] = val >> 8; |
193 | buffer[4] = val & 0xff; | 193 | buffer[4] = val & 0xff; |
194 | 194 | ||
195 | msp_dbg3("msp_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val); | 195 | v4l_dbg(3, client, "msp_write(0x%x, 0x%x, 0x%x)\n", dev, addr, val); |
196 | for (err = 0; err < 3; err++) { | 196 | for (err = 0; err < 3; err++) { |
197 | if (i2c_master_send(client, buffer, 5) == 5) | 197 | if (i2c_master_send(client, buffer, 5) == 5) |
198 | break; | 198 | break; |
199 | msp_warn("I/O error #%d (write 0x%02x/0x%02x)\n", err, | 199 | v4l_warn(client, "I/O error #%d (write 0x%02x/0x%02x)\n", err, |
200 | dev, addr); | 200 | dev, addr); |
201 | current->state = TASK_INTERRUPTIBLE; | 201 | current->state = TASK_INTERRUPTIBLE; |
202 | schedule_timeout(msecs_to_jiffies(10)); | 202 | schedule_timeout(msecs_to_jiffies(10)); |
203 | } | 203 | } |
204 | if (err == 3) { | 204 | if (err == 3) { |
205 | msp_warn("giving up, resetting chip. Sound will go off, sorry folks :-|\n"); | 205 | v4l_warn(client, "giving up, resetting chip. Sound will go off, sorry folks :-|\n"); |
206 | msp_reset(client); | 206 | msp_reset(client); |
207 | return -1; | 207 | return -1; |
208 | } | 208 | } |
@@ -275,7 +275,7 @@ void msp_set_scart(struct i2c_client *client, int in, int out) | |||
275 | } else | 275 | } else |
276 | state->acb = 0xf60; /* Mute Input and SCART 1 Output */ | 276 | state->acb = 0xf60; /* Mute Input and SCART 1 Output */ |
277 | 277 | ||
278 | msp_dbg1("scart switch: %s => %d (ACB=0x%04x)\n", | 278 | v4l_dbg(1, client, "scart switch: %s => %d (ACB=0x%04x)\n", |
279 | scart_names[in], out, state->acb); | 279 | scart_names[in], out, state->acb); |
280 | msp_write_dsp(client, 0x13, state->acb); | 280 | msp_write_dsp(client, 0x13, state->acb); |
281 | 281 | ||
@@ -285,7 +285,7 @@ void msp_set_scart(struct i2c_client *client, int in, int out) | |||
285 | 285 | ||
286 | void msp_set_mute(struct i2c_client *client) | 286 | void msp_set_mute(struct i2c_client *client) |
287 | { | 287 | { |
288 | msp_dbg1("mute audio\n"); | 288 | v4l_dbg(1, client, "mute audio\n"); |
289 | msp_write_dsp(client, 0x0000, 0); /* loudspeaker */ | 289 | msp_write_dsp(client, 0x0000, 0); /* loudspeaker */ |
290 | msp_write_dsp(client, 0x0006, 0); /* headphones */ | 290 | msp_write_dsp(client, 0x0006, 0); /* headphones */ |
291 | } | 291 | } |
@@ -302,7 +302,7 @@ void msp_set_audio(struct i2c_client *client) | |||
302 | bass = ((state->bass - 32768) * 0x60 / 65535) << 8; | 302 | bass = ((state->bass - 32768) * 0x60 / 65535) << 8; |
303 | treble = ((state->treble - 32768) * 0x60 / 65535) << 8; | 303 | treble = ((state->treble - 32768) * 0x60 / 65535) << 8; |
304 | 304 | ||
305 | msp_dbg1("mute=%s volume=%d balance=%d bass=%d treble=%d\n", | 305 | v4l_dbg(1, client, "mute=%s volume=%d balance=%d bass=%d treble=%d\n", |
306 | state->muted ? "on" : "off", state->volume, state->balance, | 306 | state->muted ? "on" : "off", state->volume, state->balance, |
307 | state->bass, state->treble); | 307 | state->bass, state->treble); |
308 | 308 | ||
@@ -318,7 +318,7 @@ int msp_modus(struct i2c_client *client, int norm) | |||
318 | { | 318 | { |
319 | switch (norm) { | 319 | switch (norm) { |
320 | case VIDEO_MODE_PAL: | 320 | case VIDEO_MODE_PAL: |
321 | msp_dbg1("video mode selected to PAL\n"); | 321 | v4l_dbg(1, client, "video mode selected to PAL\n"); |
322 | 322 | ||
323 | #if 1 | 323 | #if 1 |
324 | /* experimental: not sure this works with all chip versions */ | 324 | /* experimental: not sure this works with all chip versions */ |
@@ -328,16 +328,16 @@ int msp_modus(struct i2c_client *client, int norm) | |||
328 | return 0x1003; | 328 | return 0x1003; |
329 | #endif | 329 | #endif |
330 | case VIDEO_MODE_NTSC: /* BTSC */ | 330 | case VIDEO_MODE_NTSC: /* BTSC */ |
331 | msp_dbg1("video mode selected to NTSC\n"); | 331 | v4l_dbg(1, client, "video mode selected to NTSC\n"); |
332 | return 0x2003; | 332 | return 0x2003; |
333 | case VIDEO_MODE_SECAM: | 333 | case VIDEO_MODE_SECAM: |
334 | msp_dbg1("video mode selected to SECAM\n"); | 334 | v4l_dbg(1, client, "video mode selected to SECAM\n"); |
335 | return 0x0003; | 335 | return 0x0003; |
336 | case VIDEO_MODE_RADIO: | 336 | case VIDEO_MODE_RADIO: |
337 | msp_dbg1("video mode selected to Radio\n"); | 337 | v4l_dbg(1, client, "video mode selected to Radio\n"); |
338 | return 0x0003; | 338 | return 0x0003; |
339 | case VIDEO_MODE_AUTO: | 339 | case VIDEO_MODE_AUTO: |
340 | msp_dbg1("video mode selected to Auto\n"); | 340 | v4l_dbg(1, client, "video mode selected to Auto\n"); |
341 | return 0x2003; | 341 | return 0x2003; |
342 | default: | 342 | default: |
343 | return 0x0003; | 343 | return 0x0003; |
@@ -620,7 +620,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
620 | 620 | ||
621 | case AUDC_SET_RADIO: | 621 | case AUDC_SET_RADIO: |
622 | state->norm = VIDEO_MODE_RADIO; | 622 | state->norm = VIDEO_MODE_RADIO; |
623 | msp_dbg1("switching to radio mode\n"); | 623 | v4l_dbg(1, client, "switching to radio mode\n"); |
624 | state->watch_stereo = 0; | 624 | state->watch_stereo = 0; |
625 | switch (state->opmode) { | 625 | switch (state->opmode) { |
626 | case OPMODE_MANUAL: | 626 | case OPMODE_MANUAL: |
@@ -875,7 +875,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
875 | if (a->index < 0 || a->index > 2) | 875 | if (a->index < 0 || a->index > 2) |
876 | return -EINVAL; | 876 | return -EINVAL; |
877 | 877 | ||
878 | msp_dbg1("Setting audio out on msp34xx to input %i\n", a->index); | 878 | v4l_dbg(1, client, "Setting audio out on msp34xx to input %i\n", a->index); |
879 | msp_set_scart(client, state->in_scart, a->index + 1); | 879 | msp_set_scart(client, state->in_scart, a->index + 1); |
880 | 880 | ||
881 | break; | 881 | break; |
@@ -885,7 +885,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
885 | { | 885 | { |
886 | u32 *a = (u32 *)arg; | 886 | u32 *a = (u32 *)arg; |
887 | 887 | ||
888 | msp_dbg1("Setting I2S speed to %d\n", *a); | 888 | v4l_dbg(1, client, "Setting I2S speed to %d\n", *a); |
889 | 889 | ||
890 | switch (*a) { | 890 | switch (*a) { |
891 | case 1024000: | 891 | case 1024000: |
@@ -921,16 +921,16 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
921 | 921 | ||
922 | case VIDIOC_LOG_STATUS: | 922 | case VIDIOC_LOG_STATUS: |
923 | msp_any_detect_stereo(client); | 923 | msp_any_detect_stereo(client); |
924 | msp_info("%s rev1 = 0x%04x rev2 = 0x%04x\n", | 924 | v4l_info(client, "%s rev1 = 0x%04x rev2 = 0x%04x\n", |
925 | client->name, state->rev1, state->rev2); | 925 | client->name, state->rev1, state->rev2); |
926 | msp_info("Audio: volume %d balance %d bass %d treble %d%s\n", | 926 | v4l_info(client, "Audio: volume %d balance %d bass %d treble %d%s\n", |
927 | state->volume, state->balance, | 927 | state->volume, state->balance, |
928 | state->bass, state->treble, | 928 | state->bass, state->treble, |
929 | state->muted ? " (muted)" : ""); | 929 | state->muted ? " (muted)" : ""); |
930 | msp_info("Mode: %s (%s%s)\n", msp_standard_mode_name(state->mode), | 930 | v4l_info(client, "Mode: %s (%s%s)\n", msp_standard_mode_name(state->mode), |
931 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", | 931 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", |
932 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); | 932 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); |
933 | msp_info("ACB: 0x%04x\n", state->acb); | 933 | v4l_info(client, "ACB: 0x%04x\n", state->acb); |
934 | break; | 934 | break; |
935 | 935 | ||
936 | default: | 936 | default: |
@@ -944,7 +944,7 @@ static int msp_suspend(struct device * dev, pm_message_t state) | |||
944 | { | 944 | { |
945 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 945 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); |
946 | 946 | ||
947 | msp_dbg1("suspend\n"); | 947 | v4l_dbg(1, client, "suspend\n"); |
948 | msp_reset(client); | 948 | msp_reset(client); |
949 | return 0; | 949 | return 0; |
950 | } | 950 | } |
@@ -953,7 +953,7 @@ static int msp_resume(struct device * dev) | |||
953 | { | 953 | { |
954 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); | 954 | struct i2c_client *client = container_of(dev, struct i2c_client, dev); |
955 | 955 | ||
956 | msp_dbg1("resume\n"); | 956 | v4l_dbg(1, client, "resume\n"); |
957 | msp_wake_thread(client); | 957 | msp_wake_thread(client); |
958 | return 0; | 958 | return 0; |
959 | } | 959 | } |
@@ -979,7 +979,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
979 | snprintf(client->name, sizeof(client->name) - 1, "msp3400"); | 979 | snprintf(client->name, sizeof(client->name) - 1, "msp3400"); |
980 | 980 | ||
981 | if (msp_reset(client) == -1) { | 981 | if (msp_reset(client) == -1) { |
982 | msp_dbg1("msp3400 not found\n"); | 982 | v4l_dbg(1, client, "msp3400 not found\n"); |
983 | kfree(client); | 983 | kfree(client); |
984 | return -1; | 984 | return -1; |
985 | } | 985 | } |
@@ -1005,9 +1005,9 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1005 | state->rev1 = msp_read_dsp(client, 0x1e); | 1005 | state->rev1 = msp_read_dsp(client, 0x1e); |
1006 | if (state->rev1 != -1) | 1006 | if (state->rev1 != -1) |
1007 | state->rev2 = msp_read_dsp(client, 0x1f); | 1007 | state->rev2 = msp_read_dsp(client, 0x1f); |
1008 | msp_dbg1("rev1=0x%04x, rev2=0x%04x\n", state->rev1, state->rev2); | 1008 | v4l_dbg(1, client, "rev1=0x%04x, rev2=0x%04x\n", state->rev1, state->rev2); |
1009 | if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) { | 1009 | if (state->rev1 == -1 || (state->rev1 == 0 && state->rev2 == 0)) { |
1010 | msp_dbg1("not an msp3400 (cannot read chip version)\n"); | 1010 | v4l_dbg(1, client, "not an msp3400 (cannot read chip version)\n"); |
1011 | kfree(state); | 1011 | kfree(state); |
1012 | kfree(client); | 1012 | kfree(client); |
1013 | return -1; | 1013 | return -1; |
@@ -1035,8 +1035,8 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | /* hello world :-) */ | 1037 | /* hello world :-) */ |
1038 | msp_info("%s found @ 0x%x (%s)\n", client->name, address << 1, adapter->name); | 1038 | v4l_info(client, "%s found @ 0x%x (%s)\n", client->name, address << 1, adapter->name); |
1039 | msp_info("%s ", client->name); | 1039 | v4l_info(client, "%s ", client->name); |
1040 | if (HAVE_NICAM(state) && HAVE_RADIO(state)) | 1040 | if (HAVE_NICAM(state) && HAVE_RADIO(state)) |
1041 | printk("supports nicam and radio, "); | 1041 | printk("supports nicam and radio, "); |
1042 | else if (HAVE_NICAM(state)) | 1042 | else if (HAVE_NICAM(state)) |
@@ -1067,7 +1067,7 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1067 | state->kthread = kthread_run(thread_func, client, "msp34xx"); | 1067 | state->kthread = kthread_run(thread_func, client, "msp34xx"); |
1068 | 1068 | ||
1069 | if (state->kthread == NULL) | 1069 | if (state->kthread == NULL) |
1070 | msp_warn("kernel_thread() failed\n"); | 1070 | v4l_warn(client, "kernel_thread() failed\n"); |
1071 | msp_wake_thread(client); | 1071 | msp_wake_thread(client); |
1072 | } | 1072 | } |
1073 | 1073 | ||