aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2006-01-09 12:32:40 -0500
committerMauro Carvalho Chehab <mchehab@brturbo.com.br>2006-01-09 12:32:40 -0500
commitfac9e89999a12f378112fe93764b30196bc03f46 (patch)
tree6daf5fee44efe3d878358d17fa9934139d0c7ade /drivers/media
parent0e7072ef6623c3dc58faf3f7310aba77b0a5845e (diff)
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: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@brturbo.com.br>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/cs53l32a.c29
-rw-r--r--drivers/media/video/cx25840/cx25840-core.c70
-rw-r--r--drivers/media/video/cx25840/cx25840-firmware.c13
-rw-r--r--drivers/media/video/cx25840/cx25840.h16
-rw-r--r--drivers/media/video/msp3400-driver.c6
-rw-r--r--drivers/media/video/mt20xx.c9
-rw-r--r--drivers/media/video/saa7115.c87
-rw-r--r--drivers/media/video/saa7127.c78
-rw-r--r--drivers/media/video/tea5767.c5
-rw-r--r--drivers/media/video/tuner-core.c16
-rw-r--r--drivers/media/video/tvaudio.c81
-rw-r--r--drivers/media/video/tveeprom.c17
-rw-r--r--drivers/media/video/wm8775.c20
13 files changed, 183 insertions, 264 deletions
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c
index 7d997aeda63e..b421068f7ea3 100644
--- a/drivers/media/video/cs53l32a.c
+++ b/drivers/media/video/cs53l32a.c
@@ -27,7 +27,7 @@
27#include <linux/i2c.h> 27#include <linux/i2c.h>
28#include <linux/i2c-id.h> 28#include <linux/i2c-id.h>
29#include <linux/videodev.h> 29#include <linux/videodev.h>
30#include <media/audiochip.h> 30#include <media/v4l2-common.h>
31 31
32MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC"); 32MODULE_DESCRIPTION("i2c device driver for cs53l32a Audio ADC");
33MODULE_AUTHOR("Martin Vaughan"); 33MODULE_AUTHOR("Martin Vaughan");
@@ -39,21 +39,6 @@ module_param(debug, bool, 0644);
39 39
40MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On"); 40MODULE_PARM_DESC(debug, "Debugging messages\n\t\t\t0=Off (default), 1=On");
41 41
42#define cs53l32a_dbg(fmt, arg...) \
43 do { \
44 if (debug) \
45 printk(KERN_INFO "%s debug %d-%04x: " fmt, \
46 client->driver->driver.name, \
47 i2c_adapter_id(client->adapter), client->addr , ## arg); \
48 } while (0)
49
50#define cs53l32a_err(fmt, arg...) do { \
51 printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
52 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
53#define cs53l32a_info(fmt, arg...) do { \
54 printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
55 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
56
57static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END }; 42static unsigned short normal_i2c[] = { 0x22 >> 1, I2C_CLIENT_END };
58 43
59 44
@@ -84,7 +69,7 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
84 the second goes through the PGA. Hence there are three 69 the second goes through the PGA. Hence there are three
85 possible inputs to choose from. */ 70 possible inputs to choose from. */
86 if (input->index > 2) { 71 if (input->index > 2) {
87 cs53l32a_err("Invalid input %d.\n", input->index); 72 v4l_err(client, "Invalid input %d.\n", input->index);
88 return -EINVAL; 73 return -EINVAL;
89 } 74 }
90 cs53l32a_write(client, 0x01, 0x01 + (input->index << 4)); 75 cs53l32a_write(client, 0x01, 0x01 + (input->index << 4));
@@ -124,9 +109,9 @@ static int cs53l32a_command(struct i2c_client *client, unsigned int cmd,
124 u8 m = cs53l32a_read(client, 0x03); 109 u8 m = cs53l32a_read(client, 0x03);
125 s8 vol = cs53l32a_read(client, 0x04); 110 s8 vol = cs53l32a_read(client, 0x04);
126 111
127 cs53l32a_info("Input: %d%s\n", (v >> 4) & 3, 112 v4l_info(client, "Input: %d%s\n", (v >> 4) & 3,
128 (m & 0xC0) ? " (muted)" : ""); 113 (m & 0xC0) ? " (muted)" : "");
129 cs53l32a_info("Volume: %d dB\n", vol); 114 v4l_info(client, "Volume: %d dB\n", vol);
130 break; 115 break;
131 } 116 }
132 117
@@ -166,12 +151,12 @@ static int cs53l32a_attach(struct i2c_adapter *adapter, int address, int kind)
166 client->driver = &i2c_driver; 151 client->driver = &i2c_driver;
167 snprintf(client->name, sizeof(client->name) - 1, "cs53l32a"); 152 snprintf(client->name, sizeof(client->name) - 1, "cs53l32a");
168 153
169 cs53l32a_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); 154 v4l_info(client, "chip found @ 0x%x (%s)\n", address << 1, adapter->name);
170 155
171 for (i = 1; i <= 7; i++) { 156 for (i = 1; i <= 7; i++) {
172 u8 v = cs53l32a_read(client, i); 157 u8 v = cs53l32a_read(client, i);
173 158
174 cs53l32a_dbg("Read Reg %d %02x\n", i, v); 159 v4l_dbg(1, client, "Read Reg %d %02x\n", i, v);
175 } 160 }
176 161
177 /* Set cs53l32a internal register for Adaptec 2010/2410 setup */ 162 /* 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)
189 for (i = 1; i <= 7; i++) { 174 for (i = 1; i <= 7; i++) {
190 u8 v = cs53l32a_read(client, i); 175 u8 v = cs53l32a_read(client, i);
191 176
192 cs53l32a_dbg("Read Reg %d %02x\n", i, v); 177 v4l_dbg(1, client, "Read Reg %d %02x\n", i, v);
193 } 178 }
194 179
195 i2c_attach_client(client); 180 i2c_attach_client(client);
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c
index 07607264bd41..2bf057ec626c 100644
--- a/drivers/media/video/cx25840/cx25840-core.c
+++ b/drivers/media/video/cx25840/cx25840-core.c
@@ -43,11 +43,11 @@ MODULE_LICENSE("GPL");
43static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; 43static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };
44 44
45 45
46int cx25840_debug = 0; 46int debug = 0;
47 47
48module_param(cx25840_debug, bool, 0644); 48module_param(debug, bool, 0644);
49 49
50MODULE_PARM_DESC(cx25840_debug, "Debugging messages [0=Off (default) 1=On]"); 50MODULE_PARM_DESC(debug, "Debugging messages [0=Off (default) 1=On]");
51 51
52I2C_CLIENT_INSMOD; 52I2C_CLIENT_INSMOD;
53 53
@@ -265,7 +265,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
265 vid_input <= CX25840_COMPOSITE8); 265 vid_input <= CX25840_COMPOSITE8);
266 u8 reg; 266 u8 reg;
267 267
268 cx25840_dbg("decoder set video input %d, audio input %d\n", 268 v4l_dbg(1, client, "decoder set video input %d, audio input %d\n",
269 vid_input, aud_input); 269 vid_input, aud_input);
270 270
271 if (is_composite) { 271 if (is_composite) {
@@ -277,7 +277,7 @@ static int set_input(struct i2c_client *client, enum cx25840_video_input vid_inp
277 if ((vid_input & ~0xff0) || 277 if ((vid_input & ~0xff0) ||
278 luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA4 || 278 luma < CX25840_SVIDEO_LUMA1 || luma > CX25840_SVIDEO_LUMA4 ||
279 chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) { 279 chroma < CX25840_SVIDEO_CHROMA4 || chroma > CX25840_SVIDEO_CHROMA8) {
280 cx25840_err("0x%04x is not a valid video input!\n", vid_input); 280 v4l_err(client, "0x%04x is not a valid video input!\n", vid_input);
281 return -EINVAL; 281 return -EINVAL;
282 } 282 }
283 reg = 0xf0 + ((luma - CX25840_SVIDEO_LUMA1) >> 4); 283 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
301 case CX25840_AUDIO8: reg &= ~0xc0; reg |= 0x40; break; 301 case CX25840_AUDIO8: reg &= ~0xc0; reg |= 0x40; break;
302 302
303 default: 303 default:
304 cx25840_err("0x%04x is not a valid audio input!\n", aud_input); 304 v4l_err(client, "0x%04x is not a valid audio input!\n", aud_input);
305 return -EINVAL; 305 return -EINVAL;
306 } 306 }
307 307
@@ -396,7 +396,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
396 396
397 case V4L2_CID_BRIGHTNESS: 397 case V4L2_CID_BRIGHTNESS:
398 if (ctrl->value < 0 || ctrl->value > 255) { 398 if (ctrl->value < 0 || ctrl->value > 255) {
399 cx25840_err("invalid brightness setting %d\n", 399 v4l_err(client, "invalid brightness setting %d\n",
400 ctrl->value); 400 ctrl->value);
401 return -ERANGE; 401 return -ERANGE;
402 } 402 }
@@ -406,7 +406,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
406 406
407 case V4L2_CID_CONTRAST: 407 case V4L2_CID_CONTRAST:
408 if (ctrl->value < 0 || ctrl->value > 127) { 408 if (ctrl->value < 0 || ctrl->value > 127) {
409 cx25840_err("invalid contrast setting %d\n", 409 v4l_err(client, "invalid contrast setting %d\n",
410 ctrl->value); 410 ctrl->value);
411 return -ERANGE; 411 return -ERANGE;
412 } 412 }
@@ -416,7 +416,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
416 416
417 case V4L2_CID_SATURATION: 417 case V4L2_CID_SATURATION:
418 if (ctrl->value < 0 || ctrl->value > 127) { 418 if (ctrl->value < 0 || ctrl->value > 127) {
419 cx25840_err("invalid saturation setting %d\n", 419 v4l_err(client, "invalid saturation setting %d\n",
420 ctrl->value); 420 ctrl->value);
421 return -ERANGE; 421 return -ERANGE;
422 } 422 }
@@ -427,7 +427,7 @@ static int set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
427 427
428 case V4L2_CID_HUE: 428 case V4L2_CID_HUE:
429 if (ctrl->value < -127 || ctrl->value > 127) { 429 if (ctrl->value < -127 || ctrl->value > 127) {
430 cx25840_err("invalid hue setting %d\n", ctrl->value); 430 v4l_err(client, "invalid hue setting %d\n", ctrl->value);
431 return -ERANGE; 431 return -ERANGE;
432 } 432 }
433 433
@@ -515,7 +515,7 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
515 515
516 if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) || 516 if ((pix->width * 16 < Hsrc) || (Hsrc < pix->width) ||
517 (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) { 517 (Vlines * 8 < Vsrc) || (Vsrc < Vlines)) {
518 cx25840_err("%dx%d is not a valid size!\n", 518 v4l_err(client, "%dx%d is not a valid size!\n",
519 pix->width, pix->height); 519 pix->width, pix->height);
520 return -ERANGE; 520 return -ERANGE;
521 } 521 }
@@ -533,7 +533,7 @@ static int set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
533 else 533 else
534 filter = 3; 534 filter = 3;
535 535
536 cx25840_dbg("decoder set size %dx%d -> scale %ux%u\n", 536 v4l_dbg(1, client, "decoder set size %dx%d -> scale %ux%u\n",
537 pix->width, pix->height, HSC, VSC); 537 pix->width, pix->height, HSC, VSC);
538 538
539 /* HSCALE=HSC */ 539 /* HSCALE=HSC */
@@ -602,13 +602,13 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd,
602 return cx25840_audio(client, cmd, arg); 602 return cx25840_audio(client, cmd, arg);
603 603
604 case VIDIOC_STREAMON: 604 case VIDIOC_STREAMON:
605 cx25840_dbg("enable output\n"); 605 v4l_dbg(1, client, "enable output\n");
606 cx25840_write(client, 0x115, 0x8c); 606 cx25840_write(client, 0x115, 0x8c);
607 cx25840_write(client, 0x116, 0x07); 607 cx25840_write(client, 0x116, 0x07);
608 break; 608 break;
609 609
610 case VIDIOC_STREAMOFF: 610 case VIDIOC_STREAMOFF:
611 cx25840_dbg("disable output\n"); 611 v4l_dbg(1, client, "disable output\n");
612 cx25840_write(client, 0x115, 0x00); 612 cx25840_write(client, 0x115, 0x00);
613 cx25840_write(client, 0x116, 0x00); 613 cx25840_write(client, 0x116, 0x00);
614 break; 614 break;
@@ -774,7 +774,7 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
774 client->driver = &i2c_driver_cx25840; 774 client->driver = &i2c_driver_cx25840;
775 snprintf(client->name, sizeof(client->name) - 1, "cx25840"); 775 snprintf(client->name, sizeof(client->name) - 1, "cx25840");
776 776
777 cx25840_dbg("detecting cx25840 client on address 0x%x\n", address << 1); 777 v4l_dbg(1, client, "detecting cx25840 client on address 0x%x\n", address << 1);
778 778
779 device_id = cx25840_read(client, 0x101) << 8; 779 device_id = cx25840_read(client, 0x101) << 8;
780 device_id |= cx25840_read(client, 0x100); 780 device_id |= cx25840_read(client, 0x100);
@@ -782,12 +782,12 @@ static int cx25840_detect_client(struct i2c_adapter *adapter, int address,
782 /* The high byte of the device ID should be 782 /* The high byte of the device ID should be
783 * 0x84 if chip is present */ 783 * 0x84 if chip is present */
784 if ((device_id & 0xff00) != 0x8400) { 784 if ((device_id & 0xff00) != 0x8400) {
785 cx25840_dbg("cx25840 not found\n"); 785 v4l_dbg(1, client, "cx25840 not found\n");
786 kfree(client); 786 kfree(client);
787 return 0; 787 return 0;
788 } 788 }
789 789
790 cx25840_info("cx25%3x-2%x found @ 0x%x (%s)\n", 790 v4l_info(client, "cx25%3x-2%x found @ 0x%x (%s)\n",
791 (device_id & 0xfff0) >> 4, 791 (device_id & 0xfff0) >> 4,
792 (device_id & 0x0f) < 3 ? (device_id & 0x0f) + 1 : 3, 792 (device_id & 0x0f) < 3 ? (device_id & 0x0f) + 1 : 3,
793 address << 1, adapter->name); 793 address << 1, adapter->name);
@@ -891,9 +891,9 @@ static void log_status(struct i2c_client *client)
891 int aud_input = state->aud_input; 891 int aud_input = state->aud_input;
892 char *p; 892 char *p;
893 893
894 cx25840_info("Video signal: %spresent\n", 894 v4l_info(client, "Video signal: %spresent\n",
895 (microctrl_vidfmt & 0x10) ? "" : "not "); 895 (microctrl_vidfmt & 0x10) ? "" : "not ");
896 cx25840_info("Detected format: %s\n", 896 v4l_info(client, "Detected format: %s\n",
897 fmt_strs[gen_stat1 & 0xf]); 897 fmt_strs[gen_stat1 & 0xf]);
898 898
899 switch (mod_det_stat0) { 899 switch (mod_det_stat0) {
@@ -908,7 +908,7 @@ static void log_status(struct i2c_client *client)
908 case 0xfe: p = "forced mode"; break; 908 case 0xfe: p = "forced mode"; break;
909 default: p = "not defined"; 909 default: p = "not defined";
910 } 910 }
911 cx25840_info("Detected audio mode: %s\n", p); 911 v4l_info(client, "Detected audio mode: %s\n", p);
912 912
913 switch (mod_det_stat1) { 913 switch (mod_det_stat1) {
914 case 0x00: p = "not defined"; break; 914 case 0x00: p = "not defined"; break;
@@ -934,10 +934,10 @@ static void log_status(struct i2c_client *client)
934 case 0xff: p = "no detected audio standard"; break; 934 case 0xff: p = "no detected audio standard"; break;
935 default: p = "not defined"; 935 default: p = "not defined";
936 } 936 }
937 cx25840_info("Detected audio standard: %s\n", p); 937 v4l_info(client, "Detected audio standard: %s\n", p);
938 cx25840_info("Audio muted: %s\n", 938 v4l_info(client, "Audio muted: %s\n",
939 (mute_ctl & 0x2) ? "yes" : "no"); 939 (mute_ctl & 0x2) ? "yes" : "no");
940 cx25840_info("Audio microcontroller: %s\n", 940 v4l_info(client, "Audio microcontroller: %s\n",
941 (download_ctl & 0x10) ? "running" : "stopped"); 941 (download_ctl & 0x10) ? "running" : "stopped");
942 942
943 switch (audio_config >> 4) { 943 switch (audio_config >> 4) {
@@ -959,7 +959,7 @@ static void log_status(struct i2c_client *client)
959 case 0x0f: p = "automatic detection"; break; 959 case 0x0f: p = "automatic detection"; break;
960 default: p = "undefined"; 960 default: p = "undefined";
961 } 961 }
962 cx25840_info("Configured audio standard: %s\n", p); 962 v4l_info(client, "Configured audio standard: %s\n", p);
963 963
964 if ((audio_config >> 4) < 0xF) { 964 if ((audio_config >> 4) < 0xF) {
965 switch (audio_config & 0xF) { 965 switch (audio_config & 0xF) {
@@ -976,7 +976,7 @@ static void log_status(struct i2c_client *client)
976 case 0x0a: p = "SAP"; break; 976 case 0x0a: p = "SAP"; break;
977 default: p = "undefined"; 977 default: p = "undefined";
978 } 978 }
979 cx25840_info("Configured audio mode: %s\n", p); 979 v4l_info(client, "Configured audio mode: %s\n", p);
980 } else { 980 } else {
981 switch (audio_config & 0xF) { 981 switch (audio_config & 0xF) {
982 case 0x00: p = "BG"; break; 982 case 0x00: p = "BG"; break;
@@ -992,27 +992,27 @@ static void log_status(struct i2c_client *client)
992 case 0x0f: p = "automatic standard and mode detection"; break; 992 case 0x0f: p = "automatic standard and mode detection"; break;
993 default: p = "undefined"; 993 default: p = "undefined";
994 } 994 }
995 cx25840_info("Configured audio system: %s\n", p); 995 v4l_info(client, "Configured audio system: %s\n", p);
996 } 996 }
997 997
998 cx25840_info("Specified standard: %s\n", 998 v4l_info(client, "Specified standard: %s\n",
999 vidfmt_sel ? fmt_strs[vidfmt_sel] : "automatic detection"); 999 vidfmt_sel ? fmt_strs[vidfmt_sel] : "automatic detection");
1000 1000
1001 if (vid_input >= CX25840_COMPOSITE1 && 1001 if (vid_input >= CX25840_COMPOSITE1 &&
1002 vid_input <= CX25840_COMPOSITE8) { 1002 vid_input <= CX25840_COMPOSITE8) {
1003 cx25840_info("Specified video input: Composite %d\n", 1003 v4l_info(client, "Specified video input: Composite %d\n",
1004 vid_input - CX25840_COMPOSITE1 + 1); 1004 vid_input - CX25840_COMPOSITE1 + 1);
1005 } else { 1005 } else {
1006 cx25840_info("Specified video input: S-Video (Luma In%d, Chroma In%d)\n", 1006 v4l_info(client, "Specified video input: S-Video (Luma In%d, Chroma In%d)\n",
1007 (vid_input & 0xf0) >> 4, (vid_input & 0xf00) >> 8); 1007 (vid_input & 0xf0) >> 4, (vid_input & 0xf00) >> 8);
1008 } 1008 }
1009 if (aud_input) { 1009 if (aud_input) {
1010 cx25840_info("Specified audio input: Tuner (In%d)\n", aud_input); 1010 v4l_info(client, "Specified audio input: Tuner (In%d)\n", aud_input);
1011 } else { 1011 } else {
1012 cx25840_info("Specified audio input: External\n"); 1012 v4l_info(client, "Specified audio input: External\n");
1013 } 1013 }
1014 1014
1015 cx25840_info("Specified audioclock freq: %d Hz\n", state->audclk_freq); 1015 v4l_info(client, "Specified audioclock freq: %d Hz\n", state->audclk_freq);
1016 1016
1017 switch (pref_mode & 0xf) { 1017 switch (pref_mode & 0xf) {
1018 case 0: p = "mono/language A"; break; 1018 case 0: p = "mono/language A"; break;
@@ -1025,7 +1025,7 @@ static void log_status(struct i2c_client *client)
1025 case 7: p = "language AB"; break; 1025 case 7: p = "language AB"; break;
1026 default: p = "undefined"; 1026 default: p = "undefined";
1027 } 1027 }
1028 cx25840_info("Preferred audio mode: %s\n", p); 1028 v4l_info(client, "Preferred audio mode: %s\n", p);
1029 1029
1030 if ((audio_config & 0xf) == 0xf) { 1030 if ((audio_config & 0xf) == 0xf) {
1031 switch ((afc0 >> 3) & 0x3) { 1031 switch ((afc0 >> 3) & 0x3) {
@@ -1034,7 +1034,7 @@ static void log_status(struct i2c_client *client)
1034 case 2: p = "autodetect"; break; 1034 case 2: p = "autodetect"; break;
1035 default: p = "undefined"; 1035 default: p = "undefined";
1036 } 1036 }
1037 cx25840_info("Selected 65 MHz format: %s\n", p); 1037 v4l_info(client, "Selected 65 MHz format: %s\n", p);
1038 1038
1039 switch (afc0 & 0x7) { 1039 switch (afc0 & 0x7) {
1040 case 0: p = "chroma"; break; 1040 case 0: p = "chroma"; break;
@@ -1044,6 +1044,6 @@ static void log_status(struct i2c_client *client)
1044 case 4: p = "autodetect"; break; 1044 case 4: p = "autodetect"; break;
1045 default: p = "undefined"; 1045 default: p = "undefined";
1046 } 1046 }
1047 cx25840_info("Selected 45 MHz format: %s\n", p); 1047 v4l_info(client, "Selected 45 MHz format: %s\n", p);
1048 } 1048 }
1049} 1049}
diff --git a/drivers/media/video/cx25840/cx25840-firmware.c b/drivers/media/video/cx25840/cx25840-firmware.c
index f43024f2aaef..12a73e64f756 100644
--- a/drivers/media/video/cx25840/cx25840-firmware.c
+++ b/drivers/media/video/cx25840/cx25840-firmware.c
@@ -83,11 +83,11 @@ static inline int check_fw_load(struct i2c_client *client, int size)
83 s |= cx25840_read(client, 0x800); 83 s |= cx25840_read(client, 0x800);
84 84
85 if (size != s) { 85 if (size != s) {
86 cx25840_err("firmware %s load failed\n", firmware); 86 v4l_err(client, "firmware %s load failed\n", firmware);
87 return -EINVAL; 87 return -EINVAL;
88 } 88 }
89 89
90 cx25840_info("loaded %s firmware (%d bytes)\n", firmware, size); 90 v4l_info(client, "loaded %s firmware (%d bytes)\n", firmware, size);
91 return 0; 91 return 0;
92} 92}
93 93
@@ -98,7 +98,7 @@ static inline int fw_write(struct i2c_client *client, u8 * data, int size)
98 if ((sent = i2c_master_send(client, data, size)) < size) { 98 if ((sent = i2c_master_send(client, data, size)) < size) {
99 99
100 if (fastfw) { 100 if (fastfw) {
101 cx25840_err("333MHz i2c firmware load failed\n"); 101 v4l_err(client, "333MHz i2c firmware load failed\n");
102 fastfw = 0; 102 fastfw = 0;
103 set_i2c_delay(client, 10); 103 set_i2c_delay(client, 10);
104 104
@@ -111,13 +111,12 @@ static inline int fw_write(struct i2c_client *client, u8 * data, int size)
111 } 111 }
112 112
113 if (i2c_master_send(client, data, size) < size) { 113 if (i2c_master_send(client, data, size) < size) {
114 cx25840_err 114 v4l_err(client, "100MHz i2c firmware load failed\n");
115 ("100MHz i2c firmware load failed\n");
116 return -ENOSYS; 115 return -ENOSYS;
117 } 116 }
118 117
119 } else { 118 } else {
120 cx25840_err("firmware load i2c failure\n"); 119 v4l_err(client, "firmware load i2c failure\n");
121 return -ENOSYS; 120 return -ENOSYS;
122 } 121 }
123 122
@@ -133,7 +132,7 @@ int cx25840_loadfw(struct i2c_client *client)
133 int size, send, retval; 132 int size, send, retval;
134 133
135 if (request_firmware(&fw, firmware, FWDEV(client)) != 0) { 134 if (request_firmware(&fw, firmware, FWDEV(client)) != 0) {
136 cx25840_err("unable to open firmware %s\n", firmware); 135 v4l_err(client, "unable to open firmware %s\n", firmware);
137 return -EINVAL; 136 return -EINVAL;
138 } 137 }
139 138
diff --git a/drivers/media/video/cx25840/cx25840.h b/drivers/media/video/cx25840/cx25840.h
index dc58d4292a34..4260c3faa37a 100644
--- a/drivers/media/video/cx25840/cx25840.h
+++ b/drivers/media/video/cx25840/cx25840.h
@@ -20,25 +20,9 @@
20#ifndef _CX25840_H_ 20#ifndef _CX25840_H_
21#define _CX25840_H_ 21#define _CX25840_H_
22 22
23
24#include <linux/videodev2.h> 23#include <linux/videodev2.h>
25#include <linux/i2c.h> 24#include <linux/i2c.h>
26 25
27extern int cx25840_debug;
28
29#define cx25840_dbg(fmt, arg...) do { if (cx25840_debug) \
30 printk(KERN_INFO "%s debug %d-%04x: " fmt, \
31 client->driver->driver.name, \
32 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
33
34#define cx25840_err(fmt, arg...) do { \
35 printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
36 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
37
38#define cx25840_info(fmt, arg...) do { \
39 printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
40 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
41
42/* ENABLE_PVR150_WORKAROUND activates a workaround for a hardware bug that is 26/* ENABLE_PVR150_WORKAROUND activates a workaround for a hardware bug that is
43 present in Hauppauge PVR-150 (and possibly PVR-500) cards that have 27 present in Hauppauge PVR-150 (and possibly PVR-500) cards that have
44 certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The 28 certain NTSC tuners (tveeprom tuner model numbers 85, 99 and 112). The
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 4c0c7bed2edf..eece5fe46cbe 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -80,12 +80,12 @@ int stereo_threshold = 0x190; /* a2 threshold for stereo/bilingual
80module_param(opmode, int, 0444); 80module_param(opmode, int, 0444);
81 81
82/* read-write */ 82/* read-write */
83module_param(once, int, 0644); 83module_param(once, bool, 0644);
84module_param(debug, int, 0644); 84module_param(debug, int, 0644);
85module_param(stereo_threshold, int, 0644); 85module_param(stereo_threshold, int, 0644);
86module_param(standard, int, 0644); 86module_param(standard, int, 0644);
87module_param(amsound, int, 0644); 87module_param(amsound, bool, 0644);
88module_param(dolby, int, 0644); 88module_param(dolby, bool, 0644);
89 89
90MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect"); 90MODULE_PARM_DESC(opmode, "Forces a MSP3400 opmode. 0=Manual, 1=Autodetect, 2=Autodetect and autoselect");
91MODULE_PARM_DESC(once, "No continuous stereo monitoring"); 91MODULE_PARM_DESC(once, "No continuous stereo monitoring");
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c
index e2df722ebaeb..2c19c9588c02 100644
--- a/drivers/media/video/mt20xx.c
+++ b/drivers/media/video/mt20xx.c
@@ -20,6 +20,9 @@ module_param(tv_antenna, int, 0644);
20static unsigned int radio_antenna = 0; 20static unsigned int radio_antenna = 0;
21module_param(radio_antenna, int, 0644); 21module_param(radio_antenna, int, 0644);
22 22
23/* from tuner-core.c */
24extern int debug;
25
23/* ---------------------------------------------------------------------- */ 26/* ---------------------------------------------------------------------- */
24 27
25#define MT2032 0x04 28#define MT2032 0x04
@@ -401,7 +404,7 @@ static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned
401 div2a=(lo2/8)-1; 404 div2a=(lo2/8)-1;
402 div2b=lo2-(div2a+1)*8; 405 div2b=lo2-(div2a+1)*8;
403 406
404 if (tuner_debug > 1) { 407 if (debug > 1) {
405 tuner_dbg("lo1 lo2 = %d %d\n", lo1, lo2); 408 tuner_dbg("lo1 lo2 = %d %d\n", lo1, lo2);
406 tuner_dbg("num1 num2 div1a div1b div2a div2b= %x %x %x %x %x %x\n", 409 tuner_dbg("num1 num2 div1a div1b div2a div2b= %x %x %x %x %x %x\n",
407 num1,num2,div1a,div1b,div2a,div2b); 410 num1,num2,div1a,div1b,div2a,div2b);
@@ -417,7 +420,7 @@ static void mt2050_set_if_freq(struct i2c_client *c,unsigned int freq, unsigned
417 buf[5]=div2a; 420 buf[5]=div2a;
418 if(num2!=0) buf[5]=buf[5]|0x40; 421 if(num2!=0) buf[5]=buf[5]|0x40;
419 422
420 if (tuner_debug > 1) { 423 if (debug > 1) {
421 int i; 424 int i;
422 tuner_dbg("bufs is: "); 425 tuner_dbg("bufs is: ");
423 for(i=0;i<6;i++) 426 for(i=0;i<6;i++)
@@ -505,7 +508,7 @@ int microtune_init(struct i2c_client *c)
505 508
506 i2c_master_send(c,buf,1); 509 i2c_master_send(c,buf,1);
507 i2c_master_recv(c,buf,21); 510 i2c_master_recv(c,buf,21);
508 if (tuner_debug) { 511 if (debug) {
509 int i; 512 int i;
510 tuner_dbg("MT20xx hexdump:"); 513 tuner_dbg("MT20xx hexdump:");
511 for(i=0;i<21;i++) { 514 for(i=0;i<21;i++) {
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index cf530b94cd12..6cc13311bc2c 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -47,25 +47,10 @@ MODULE_AUTHOR("Maxim Yevtyushkin, Kevin Thayer, Chris Kennedy, Hans Verkuil");
47MODULE_LICENSE("GPL"); 47MODULE_LICENSE("GPL");
48 48
49static int debug = 0; 49static int debug = 0;
50module_param(debug, int, 0644); 50module_param(debug, bool, 0644);
51 51
52MODULE_PARM_DESC(debug, "Debug level (0-1)"); 52MODULE_PARM_DESC(debug, "Debug level (0-1)");
53 53
54#define saa7115_dbg(fmt,arg...) \
55 do { \
56 if (debug) \
57 printk(KERN_INFO "%s debug %d-%04x: " fmt, \
58 client->driver->driver.name, \
59 i2c_adapter_id(client->adapter), client->addr , ## arg); \
60 } while (0)
61
62#define saa7115_err(fmt, arg...) do { \
63 printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
64 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
65#define saa7115_info(fmt, arg...) do { \
66 printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
67 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
68
69static unsigned short normal_i2c[] = { 0x42 >> 1, 0x40 >> 1, I2C_CLIENT_END }; 54static unsigned short normal_i2c[] = { 0x42 >> 1, 0x40 >> 1, I2C_CLIENT_END };
70 55
71 56
@@ -564,7 +549,7 @@ static int saa7115_set_audio_clock_freq(struct i2c_client *client, u32 freq)
564 u32 hz; 549 u32 hz;
565 u64 f; 550 u64 f;
566 551
567 saa7115_dbg("set audio clock freq: %d\n", freq); 552 v4l_dbg(1, client, "set audio clock freq: %d\n", freq);
568 553
569 /* sanity check */ 554 /* sanity check */
570 if (freq < 32000 || freq > 48000) 555 if (freq < 32000 || freq > 48000)
@@ -599,7 +584,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c
599 switch (ctrl->id) { 584 switch (ctrl->id) {
600 case V4L2_CID_BRIGHTNESS: 585 case V4L2_CID_BRIGHTNESS:
601 if (ctrl->value < 0 || ctrl->value > 255) { 586 if (ctrl->value < 0 || ctrl->value > 255) {
602 saa7115_err("invalid brightness setting %d\n", ctrl->value); 587 v4l_err(client, "invalid brightness setting %d\n", ctrl->value);
603 return -ERANGE; 588 return -ERANGE;
604 } 589 }
605 590
@@ -609,7 +594,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c
609 594
610 case V4L2_CID_CONTRAST: 595 case V4L2_CID_CONTRAST:
611 if (ctrl->value < 0 || ctrl->value > 127) { 596 if (ctrl->value < 0 || ctrl->value > 127) {
612 saa7115_err("invalid contrast setting %d\n", ctrl->value); 597 v4l_err(client, "invalid contrast setting %d\n", ctrl->value);
613 return -ERANGE; 598 return -ERANGE;
614 } 599 }
615 600
@@ -619,7 +604,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c
619 604
620 case V4L2_CID_SATURATION: 605 case V4L2_CID_SATURATION:
621 if (ctrl->value < 0 || ctrl->value > 127) { 606 if (ctrl->value < 0 || ctrl->value > 127) {
622 saa7115_err("invalid saturation setting %d\n", ctrl->value); 607 v4l_err(client, "invalid saturation setting %d\n", ctrl->value);
623 return -ERANGE; 608 return -ERANGE;
624 } 609 }
625 610
@@ -629,7 +614,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c
629 614
630 case V4L2_CID_HUE: 615 case V4L2_CID_HUE:
631 if (ctrl->value < -127 || ctrl->value > 127) { 616 if (ctrl->value < -127 || ctrl->value > 127) {
632 saa7115_err("invalid hue setting %d\n", ctrl->value); 617 v4l_err(client, "invalid hue setting %d\n", ctrl->value);
633 return -ERANGE; 618 return -ERANGE;
634 } 619 }
635 620
@@ -685,10 +670,10 @@ static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
685 670
686 // This works for NTSC-M, SECAM-L and the 50Hz PAL variants. 671 // This works for NTSC-M, SECAM-L and the 50Hz PAL variants.
687 if (std & V4L2_STD_525_60) { 672 if (std & V4L2_STD_525_60) {
688 saa7115_dbg("decoder set standard 60 Hz\n"); 673 v4l_dbg(1, client, "decoder set standard 60 Hz\n");
689 saa7115_writeregs(client, saa7115_cfg_60hz_video); 674 saa7115_writeregs(client, saa7115_cfg_60hz_video);
690 } else { 675 } else {
691 saa7115_dbg("decoder set standard 50 Hz\n"); 676 v4l_dbg(1, client, "decoder set standard 50 Hz\n");
692 saa7115_writeregs(client, saa7115_cfg_50hz_video); 677 saa7115_writeregs(client, saa7115_cfg_50hz_video);
693 } 678 }
694 679
@@ -717,13 +702,13 @@ static void saa7115_log_status(struct i2c_client *client)
717 int signalOk; 702 int signalOk;
718 int vcr; 703 int vcr;
719 704
720 saa7115_info("Audio frequency: %d Hz\n", state->audclk_freq); 705 v4l_info(client, "Audio frequency: %d Hz\n", state->audclk_freq);
721 if (client->name[6] == '4') { 706 if (client->name[6] == '4') {
722 /* status for the saa7114 */ 707 /* status for the saa7114 */
723 reg1f = saa7115_read(client, 0x1f); 708 reg1f = saa7115_read(client, 0x1f);
724 signalOk = (reg1f & 0xc1) == 0x81; 709 signalOk = (reg1f & 0xc1) == 0x81;
725 saa7115_info("Video signal: %s\n", signalOk ? "ok" : "bad"); 710 v4l_info(client, "Video signal: %s\n", signalOk ? "ok" : "bad");
726 saa7115_info("Frequency: %s\n", (reg1f & 0x20) ? "60 Hz" : "50 Hz"); 711 v4l_info(client, "Frequency: %s\n", (reg1f & 0x20) ? "60 Hz" : "50 Hz");
727 return; 712 return;
728 } 713 }
729 714
@@ -735,25 +720,25 @@ static void saa7115_log_status(struct i2c_client *client)
735 vcr = !(reg1f & 0x10); 720 vcr = !(reg1f & 0x10);
736 721
737 if (state->input >= 6) { 722 if (state->input >= 6) {
738 saa7115_info("Input: S-Video %d\n", state->input - 6); 723 v4l_info(client, "Input: S-Video %d\n", state->input - 6);
739 } else { 724 } else {
740 saa7115_info("Input: Composite %d\n", state->input); 725 v4l_info(client, "Input: Composite %d\n", state->input);
741 } 726 }
742 saa7115_info("Video signal: %s\n", signalOk ? (vcr ? "VCR" : "broadcast/DVD") : "bad"); 727 v4l_info(client, "Video signal: %s\n", signalOk ? (vcr ? "VCR" : "broadcast/DVD") : "bad");
743 saa7115_info("Frequency: %s\n", (reg1f & 0x20) ? "60 Hz" : "50 Hz"); 728 v4l_info(client, "Frequency: %s\n", (reg1f & 0x20) ? "60 Hz" : "50 Hz");
744 729
745 switch (reg1e & 0x03) { 730 switch (reg1e & 0x03) {
746 case 1: 731 case 1:
747 saa7115_info("Detected format: NTSC\n"); 732 v4l_info(client, "Detected format: NTSC\n");
748 break; 733 break;
749 case 2: 734 case 2:
750 saa7115_info("Detected format: PAL\n"); 735 v4l_info(client, "Detected format: PAL\n");
751 break; 736 break;
752 case 3: 737 case 3:
753 saa7115_info("Detected format: SECAM\n"); 738 v4l_info(client, "Detected format: SECAM\n");
754 break; 739 break;
755 default: 740 default:
756 saa7115_info("Detected format: BW/No color\n"); 741 v4l_info(client, "Detected format: BW/No color\n");
757 break; 742 break;
758 } 743 }
759} 744}
@@ -878,7 +863,7 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
878 863
879 pix = &(fmt->fmt.pix); 864 pix = &(fmt->fmt.pix);
880 865
881 saa7115_dbg("decoder set size\n"); 866 v4l_dbg(1, client, "decoder set size\n");
882 867
883 /* FIXME need better bounds checking here */ 868 /* FIXME need better bounds checking here */
884 if ((pix->width < 1) || (pix->width > 1440)) 869 if ((pix->width < 1) || (pix->width > 1440))
@@ -904,7 +889,7 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
904 HPSC = HPSC ? HPSC : 1; 889 HPSC = HPSC ? HPSC : 1;
905 HFSC = (int)((1024 * 720) / (HPSC * pix->width)); 890 HFSC = (int)((1024 * 720) / (HPSC * pix->width));
906 891
907 saa7115_dbg("Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC); 892 v4l_dbg(1, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC);
908 /* FIXME hardcodes to "Task B" 893 /* FIXME hardcodes to "Task B"
909 * write H prescaler integer */ 894 * write H prescaler integer */
910 saa7115_write(client, 0xd0, (u8) (HPSC & 0x3f)); 895 saa7115_write(client, 0xd0, (u8) (HPSC & 0x3f));
@@ -918,10 +903,10 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
918 saa7115_write(client, 0xDD, (u8) ((HFSC >> 9) & 0xff)); 903 saa7115_write(client, 0xDD, (u8) ((HFSC >> 9) & 0xff));
919 } else { 904 } else {
920 if (is_50hz) { 905 if (is_50hz) {
921 saa7115_dbg("Setting full 50hz width\n"); 906 v4l_dbg(1, client, "Setting full 50hz width\n");
922 saa7115_writeregs(client, saa7115_cfg_50hz_fullres_x); 907 saa7115_writeregs(client, saa7115_cfg_50hz_fullres_x);
923 } else { 908 } else {
924 saa7115_dbg("Setting full 60hz width\n"); 909 v4l_dbg(1, client, "Setting full 60hz width\n");
925 saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x); 910 saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x);
926 } 911 }
927 } 912 }
@@ -930,7 +915,7 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
930 915
931 if (pix->height != Vsrc) { 916 if (pix->height != Vsrc) {
932 VSCY = (int)((1024 * Vsrc) / pix->height); 917 VSCY = (int)((1024 * Vsrc) / pix->height);
933 saa7115_dbg("Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY); 918 v4l_dbg(1, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY);
934 919
935 /* Correct Contrast and Luminance */ 920 /* Correct Contrast and Luminance */
936 saa7115_write(client, 0xd5, (u8) (64 * 1024 / VSCY)); 921 saa7115_write(client, 0xd5, (u8) (64 * 1024 / VSCY));
@@ -944,10 +929,10 @@ static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
944 saa7115_write(client, 0xe3, (u8) ((VSCY >> 8) & 0xff)); 929 saa7115_write(client, 0xe3, (u8) ((VSCY >> 8) & 0xff));
945 } else { 930 } else {
946 if (is_50hz) { 931 if (is_50hz) {
947 saa7115_dbg("Setting full 50Hz height\n"); 932 v4l_dbg(1, client, "Setting full 50Hz height\n");
948 saa7115_writeregs(client, saa7115_cfg_50hz_fullres_y); 933 saa7115_writeregs(client, saa7115_cfg_50hz_fullres_y);
949 } else { 934 } else {
950 saa7115_dbg("Setting full 60hz height\n"); 935 v4l_dbg(1, client, "Setting full 60hz height\n");
951 saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y); 936 saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y);
952 } 937 }
953 } 938 }
@@ -1052,7 +1037,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1052 break; 1037 break;
1053 status = saa7115_read(client, 0x1f); 1038 status = saa7115_read(client, 0x1f);
1054 1039
1055 saa7115_dbg("status: 0x%02x\n", status); 1040 v4l_dbg(1, client, "status: 0x%02x\n", status);
1056 vt->signal = ((status & (1 << 6)) == 0) ? 0xffff : 0x0; 1041 vt->signal = ((status & (1 << 6)) == 0) ? 0xffff : 0x0;
1057 break; 1042 break;
1058 } 1043 }
@@ -1085,7 +1070,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1085 break; 1070 break;
1086 1071
1087 case VIDIOC_S_INPUT: 1072 case VIDIOC_S_INPUT:
1088 saa7115_dbg("decoder set input %d\n", *iarg); 1073 v4l_dbg(1, client, "decoder set input %d\n", *iarg);
1089 /* inputs from 0-9 are available */ 1074 /* inputs from 0-9 are available */
1090 if (*iarg < 0 || *iarg > 9) { 1075 if (*iarg < 0 || *iarg > 9) {
1091 return -EINVAL; 1076 return -EINVAL;
@@ -1093,7 +1078,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1093 1078
1094 if (state->input == *iarg) 1079 if (state->input == *iarg)
1095 break; 1080 break;
1096 saa7115_dbg("now setting %s input\n", 1081 v4l_dbg(1, client, "now setting %s input\n",
1097 *iarg >= 6 ? "S-Video" : "Composite"); 1082 *iarg >= 6 ? "S-Video" : "Composite");
1098 state->input = *iarg; 1083 state->input = *iarg;
1099 1084
@@ -1110,7 +1095,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1110 1095
1111 case VIDIOC_STREAMON: 1096 case VIDIOC_STREAMON:
1112 case VIDIOC_STREAMOFF: 1097 case VIDIOC_STREAMOFF:
1113 saa7115_dbg("%s output\n", 1098 v4l_dbg(1, client, "%s output\n",
1114 (cmd == VIDIOC_STREAMON) ? "enable" : "disable"); 1099 (cmd == VIDIOC_STREAMON) ? "enable" : "disable");
1115 1100
1116 if (state->enable != (cmd == VIDIOC_STREAMON)) { 1101 if (state->enable != (cmd == VIDIOC_STREAMON)) {
@@ -1124,7 +1109,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1124 break; 1109 break;
1125 1110
1126 case VIDIOC_INT_RESET: 1111 case VIDIOC_INT_RESET:
1127 saa7115_dbg("decoder RESET\n"); 1112 v4l_dbg(1, client, "decoder RESET\n");
1128 saa7115_writeregs(client, saa7115_cfg_reset_scaler); 1113 saa7115_writeregs(client, saa7115_cfg_reset_scaler);
1129 break; 1114 break;
1130 1115
@@ -1218,19 +1203,19 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
1218 client->driver = &i2c_driver_saa7115; 1203 client->driver = &i2c_driver_saa7115;
1219 snprintf(client->name, sizeof(client->name) - 1, "saa7115"); 1204 snprintf(client->name, sizeof(client->name) - 1, "saa7115");
1220 1205
1221 saa7115_dbg("detecting saa7115 client on address 0x%x\n", address << 1); 1206 v4l_dbg(1, client, "detecting saa7115 client on address 0x%x\n", address << 1);
1222 1207
1223 saa7115_write(client, 0, 5); 1208 saa7115_write(client, 0, 5);
1224 chip_id = saa7115_read(client, 0) & 0x0f; 1209 chip_id = saa7115_read(client, 0) & 0x0f;
1225 if (chip_id != 4 && chip_id != 5) { 1210 if (chip_id != 4 && chip_id != 5) {
1226 saa7115_dbg("saa7115 not found\n"); 1211 v4l_dbg(1, client, "saa7115 not found\n");
1227 kfree(client); 1212 kfree(client);
1228 return 0; 1213 return 0;
1229 } 1214 }
1230 if (chip_id == 4) { 1215 if (chip_id == 4) {
1231 snprintf(client->name, sizeof(client->name) - 1, "saa7114"); 1216 snprintf(client->name, sizeof(client->name) - 1, "saa7114");
1232 } 1217 }
1233 saa7115_info("saa711%d found @ 0x%x (%s)\n", chip_id, address << 1, adapter->name); 1218 v4l_info(client, "saa711%d found @ 0x%x (%s)\n", chip_id, address << 1, adapter->name);
1234 1219
1235 state = kmalloc(sizeof(struct saa7115_state), GFP_KERNEL); 1220 state = kmalloc(sizeof(struct saa7115_state), GFP_KERNEL);
1236 i2c_set_clientdata(client, state); 1221 i2c_set_clientdata(client, state);
@@ -1250,7 +1235,7 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
1250 state->ident = (chip_id == 4) ? V4L2_IDENT_SAA7114 : V4L2_IDENT_SAA7115; 1235 state->ident = (chip_id == 4) ? V4L2_IDENT_SAA7114 : V4L2_IDENT_SAA7115;
1251 state->audclk_freq = 48000; 1236 state->audclk_freq = 48000;
1252 1237
1253 saa7115_dbg("writing init values\n"); 1238 v4l_dbg(1, client, "writing init values\n");
1254 1239
1255 /* init to 60hz/48khz */ 1240 /* init to 60hz/48khz */
1256 saa7115_writeregs(client, saa7115_init_auto_input); 1241 saa7115_writeregs(client, saa7115_init_auto_input);
@@ -1263,7 +1248,7 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
1263 1248
1264 i2c_attach_client(client); 1249 i2c_attach_client(client);
1265 1250
1266 saa7115_dbg("status: (1E) 0x%02x, (1F) 0x%02x\n", 1251 v4l_dbg(1, client, "status: (1E) 0x%02x, (1F) 0x%02x\n",
1267 saa7115_read(client, 0x1e), saa7115_read(client, 0x1f)); 1252 saa7115_read(client, 0x1e), saa7115_read(client, 0x1f));
1268 1253
1269 return 0; 1254 return 0;
diff --git a/drivers/media/video/saa7127.c b/drivers/media/video/saa7127.c
index aee0f2d73da3..2009c1bc4720 100644
--- a/drivers/media/video/saa7127.c
+++ b/drivers/media/video/saa7127.c
@@ -66,30 +66,6 @@ module_param(test_image, int, 0644);
66MODULE_PARM_DESC(debug, "debug level (0-2)"); 66MODULE_PARM_DESC(debug, "debug level (0-2)");
67MODULE_PARM_DESC(test_image, "test_image (0-1)"); 67MODULE_PARM_DESC(test_image, "test_image (0-1)");
68 68
69#define saa7127_dbg(fmt, arg...) \
70 do { \
71 if (debug >= 1) \
72 printk(KERN_INFO "%s debug %d-%04x: " fmt, \
73 client->driver->driver.name, \
74 i2c_adapter_id(client->adapter), client->addr , ## arg); \
75 } while (0)
76
77/* High volume debug. Use with care. */
78#define saa7127_dbg_highvol(fmt, arg...) \
79 do { \
80 if (debug == 2) \
81 printk(KERN_INFO "%s debug %d-%04x: " fmt, \
82 client->driver->driver.name, \
83 i2c_adapter_id(client->adapter), client->addr , ## arg); \
84 } while (0)
85
86#define saa7127_err(fmt, arg...) do { \
87 printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
88 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
89#define saa7127_info(fmt, arg...) do { \
90 printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
91 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
92
93static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END }; 69static unsigned short normal_i2c[] = { 0x88 >> 1, I2C_CLIENT_END };
94 70
95 71
@@ -336,7 +312,7 @@ static int saa7127_write(struct i2c_client *client, u8 reg, u8 val)
336 if (i2c_smbus_write_byte_data(client, reg, val) == 0) 312 if (i2c_smbus_write_byte_data(client, reg, val) == 0)
337 return 0; 313 return 0;
338 } 314 }
339 saa7127_err("I2C Write Problem\n"); 315 v4l_err(client, "I2C Write Problem\n");
340 return -1; 316 return -1;
341} 317}
342 318
@@ -362,7 +338,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat
362 if (enable && (data->field != 0 || data->line != 16)) 338 if (enable && (data->field != 0 || data->line != 16))
363 return -EINVAL; 339 return -EINVAL;
364 if (state->vps_enable != enable) { 340 if (state->vps_enable != enable) {
365 saa7127_dbg("Turn VPS Signal %s\n", enable ? "on" : "off"); 341 v4l_dbg(1, client, "Turn VPS Signal %s\n", enable ? "on" : "off");
366 saa7127_write(client, 0x54, enable << 7); 342 saa7127_write(client, 0x54, enable << 7);
367 state->vps_enable = enable; 343 state->vps_enable = enable;
368 } 344 }
@@ -374,7 +350,7 @@ static int saa7127_set_vps(struct i2c_client *client, struct v4l2_sliced_vbi_dat
374 state->vps_data[2] = data->data[11]; 350 state->vps_data[2] = data->data[11];
375 state->vps_data[3] = data->data[12]; 351 state->vps_data[3] = data->data[12];
376 state->vps_data[4] = data->data[13]; 352 state->vps_data[4] = data->data[13];
377 saa7127_dbg("Set VPS data %02x %02x %02x %02x %02x\n", 353 v4l_dbg(1, client, "Set VPS data %02x %02x %02x %02x %02x\n",
378 state->vps_data[0], state->vps_data[1], 354 state->vps_data[0], state->vps_data[1],
379 state->vps_data[2], state->vps_data[3], 355 state->vps_data[2], state->vps_data[3],
380 state->vps_data[4]); 356 state->vps_data[4]);
@@ -397,7 +373,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data
397 if (enable && (data->field != 0 || data->line != 21)) 373 if (enable && (data->field != 0 || data->line != 21))
398 return -EINVAL; 374 return -EINVAL;
399 if (state->cc_enable != enable) { 375 if (state->cc_enable != enable) {
400 saa7127_dbg("Turn CC %s\n", enable ? "on" : "off"); 376 v4l_dbg(1, client, "Turn CC %s\n", enable ? "on" : "off");
401 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, 377 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
402 (state->xds_enable << 7) | (enable << 6) | 0x11); 378 (state->xds_enable << 7) | (enable << 6) | 0x11);
403 state->cc_enable = enable; 379 state->cc_enable = enable;
@@ -405,7 +381,7 @@ static int saa7127_set_cc(struct i2c_client *client, struct v4l2_sliced_vbi_data
405 if (!enable) 381 if (!enable)
406 return 0; 382 return 0;
407 383
408 saa7127_dbg_highvol("CC data: %04x\n", cc); 384 v4l_dbg(2, client, "CC data: %04x\n", cc);
409 saa7127_write(client, SAA7127_REG_LINE_21_ODD_0, cc & 0xff); 385 saa7127_write(client, SAA7127_REG_LINE_21_ODD_0, cc & 0xff);
410 saa7127_write(client, SAA7127_REG_LINE_21_ODD_1, cc >> 8); 386 saa7127_write(client, SAA7127_REG_LINE_21_ODD_1, cc >> 8);
411 state->cc_data = cc; 387 state->cc_data = cc;
@@ -423,7 +399,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat
423 if (enable && (data->field != 1 || data->line != 21)) 399 if (enable && (data->field != 1 || data->line != 21))
424 return -EINVAL; 400 return -EINVAL;
425 if (state->xds_enable != enable) { 401 if (state->xds_enable != enable) {
426 saa7127_dbg("Turn XDS %s\n", enable ? "on" : "off"); 402 v4l_dbg(1, client, "Turn XDS %s\n", enable ? "on" : "off");
427 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION, 403 saa7127_write(client, SAA7127_REG_CLOSED_CAPTION,
428 (enable << 7) | (state->cc_enable << 6) | 0x11); 404 (enable << 7) | (state->cc_enable << 6) | 0x11);
429 state->xds_enable = enable; 405 state->xds_enable = enable;
@@ -431,7 +407,7 @@ static int saa7127_set_xds(struct i2c_client *client, struct v4l2_sliced_vbi_dat
431 if (!enable) 407 if (!enable)
432 return 0; 408 return 0;
433 409
434 saa7127_dbg_highvol("XDS data: %04x\n", xds); 410 v4l_dbg(2, client, "XDS data: %04x\n", xds);
435 saa7127_write(client, SAA7127_REG_LINE_21_EVEN_0, xds & 0xff); 411 saa7127_write(client, SAA7127_REG_LINE_21_EVEN_0, xds & 0xff);
436 saa7127_write(client, SAA7127_REG_LINE_21_EVEN_1, xds >> 8); 412 saa7127_write(client, SAA7127_REG_LINE_21_EVEN_1, xds >> 8);
437 state->xds_data = xds; 413 state->xds_data = xds;
@@ -448,7 +424,7 @@ static int saa7127_set_wss(struct i2c_client *client, struct v4l2_sliced_vbi_dat
448 if (enable && (data->field != 0 || data->line != 23)) 424 if (enable && (data->field != 0 || data->line != 23))
449 return -EINVAL; 425 return -EINVAL;
450 if (state->wss_enable != enable) { 426 if (state->wss_enable != enable) {
451 saa7127_dbg("Turn WSS %s\n", enable ? "on" : "off"); 427 v4l_dbg(1, client, "Turn WSS %s\n", enable ? "on" : "off");
452 saa7127_write(client, 0x27, enable << 7); 428 saa7127_write(client, 0x27, enable << 7);
453 state->wss_enable = enable; 429 state->wss_enable = enable;
454 } 430 }
@@ -457,7 +433,7 @@ static int saa7127_set_wss(struct i2c_client *client, struct v4l2_sliced_vbi_dat
457 433
458 saa7127_write(client, 0x26, data->data[0]); 434 saa7127_write(client, 0x26, data->data[0]);
459 saa7127_write(client, 0x27, 0x80 | (data->data[1] & 0x3f)); 435 saa7127_write(client, 0x27, 0x80 | (data->data[1] & 0x3f));
460 saa7127_dbg("WSS mode: %s\n", wss_strs[data->data[0] & 0xf]); 436 v4l_dbg(1, client, "WSS mode: %s\n", wss_strs[data->data[0] & 0xf]);
461 state->wss_mode = (data->data[1] & 0x3f) << 8 | data->data[0]; 437 state->wss_mode = (data->data[1] & 0x3f) << 8 | data->data[0];
462 return 0; 438 return 0;
463} 439}
@@ -469,11 +445,11 @@ static int saa7127_set_video_enable(struct i2c_client *client, int enable)
469 struct saa7127_state *state = i2c_get_clientdata(client); 445 struct saa7127_state *state = i2c_get_clientdata(client);
470 446
471 if (enable) { 447 if (enable) {
472 saa7127_dbg("Enable Video Output\n"); 448 v4l_dbg(1, client, "Enable Video Output\n");
473 saa7127_write(client, 0x2d, state->reg_2d); 449 saa7127_write(client, 0x2d, state->reg_2d);
474 saa7127_write(client, 0x61, state->reg_61); 450 saa7127_write(client, 0x61, state->reg_61);
475 } else { 451 } else {
476 saa7127_dbg("Disable Video Output\n"); 452 v4l_dbg(1, client, "Disable Video Output\n");
477 saa7127_write(client, 0x2d, (state->reg_2d & 0xf0)); 453 saa7127_write(client, 0x2d, (state->reg_2d & 0xf0));
478 saa7127_write(client, 0x61, (state->reg_61 | 0xc0)); 454 saa7127_write(client, 0x61, (state->reg_61 | 0xc0));
479 } 455 }
@@ -489,11 +465,11 @@ static int saa7127_set_std(struct i2c_client *client, v4l2_std_id std)
489 const struct i2c_reg_value *inittab; 465 const struct i2c_reg_value *inittab;
490 466
491 if (std & V4L2_STD_525_60) { 467 if (std & V4L2_STD_525_60) {
492 saa7127_dbg("Selecting 60 Hz video Standard\n"); 468 v4l_dbg(1, client, "Selecting 60 Hz video Standard\n");
493 inittab = saa7127_init_config_60hz; 469 inittab = saa7127_init_config_60hz;
494 state->reg_61 = SAA7127_60HZ_DAC_CONTROL; 470 state->reg_61 = SAA7127_60HZ_DAC_CONTROL;
495 } else { 471 } else {
496 saa7127_dbg("Selecting 50 Hz video Standard\n"); 472 v4l_dbg(1, client, "Selecting 50 Hz video Standard\n");
497 inittab = saa7127_init_config_50hz; 473 inittab = saa7127_init_config_50hz;
498 state->reg_61 = SAA7127_50HZ_DAC_CONTROL; 474 state->reg_61 = SAA7127_50HZ_DAC_CONTROL;
499 } 475 }
@@ -544,7 +520,7 @@ static int saa7127_set_output_type(struct i2c_client *client, int output)
544 default: 520 default:
545 return -EINVAL; 521 return -EINVAL;
546 } 522 }
547 saa7127_dbg("Selecting %s output type\n", output_strs[output]); 523 v4l_dbg(1, client, "Selecting %s output type\n", output_strs[output]);
548 524
549 /* Configure Encoder */ 525 /* Configure Encoder */
550 saa7127_write(client, 0x2d, state->reg_2d); 526 saa7127_write(client, 0x2d, state->reg_2d);
@@ -561,12 +537,12 @@ static int saa7127_set_input_type(struct i2c_client *client, int input)
561 537
562 switch (input) { 538 switch (input) {
563 case SAA7127_INPUT_TYPE_NORMAL: /* avia */ 539 case SAA7127_INPUT_TYPE_NORMAL: /* avia */
564 saa7127_dbg("Selecting Normal Encoder Input\n"); 540 v4l_dbg(1, client, "Selecting Normal Encoder Input\n");
565 state->reg_3a_cb = 0; 541 state->reg_3a_cb = 0;
566 break; 542 break;
567 543
568 case SAA7127_INPUT_TYPE_TEST_IMAGE: /* color bar */ 544 case SAA7127_INPUT_TYPE_TEST_IMAGE: /* color bar */
569 saa7127_dbg("Selecting Color Bar generator\n"); 545 v4l_dbg(1, client, "Selecting Color Bar generator\n");
570 state->reg_3a_cb = 0x80; 546 state->reg_3a_cb = 0x80;
571 break; 547 break;
572 548
@@ -633,14 +609,14 @@ static int saa7127_command(struct i2c_client *client,
633 break; 609 break;
634 610
635 case VIDIOC_LOG_STATUS: 611 case VIDIOC_LOG_STATUS:
636 saa7127_info("Standard: %s\n", (state->std & V4L2_STD_525_60) ? "60 Hz" : "50 Hz"); 612 v4l_info(client, "Standard: %s\n", (state->std & V4L2_STD_525_60) ? "60 Hz" : "50 Hz");
637 saa7127_info("Input: %s\n", state->input_type ? "color bars" : "normal"); 613 v4l_info(client, "Input: %s\n", state->input_type ? "color bars" : "normal");
638 saa7127_info("Output: %s\n", state->video_enable ? 614 v4l_info(client, "Output: %s\n", state->video_enable ?
639 output_strs[state->output_type] : "disabled"); 615 output_strs[state->output_type] : "disabled");
640 saa7127_info("WSS: %s\n", state->wss_enable ? 616 v4l_info(client, "WSS: %s\n", state->wss_enable ?
641 wss_strs[state->wss_mode] : "disabled"); 617 wss_strs[state->wss_mode] : "disabled");
642 saa7127_info("VPS: %s\n", state->vps_enable ? "enabled" : "disabled"); 618 v4l_info(client, "VPS: %s\n", state->vps_enable ? "enabled" : "disabled");
643 saa7127_info("CC: %s\n", state->cc_enable ? "enabled" : "disabled"); 619 v4l_info(client, "CC: %s\n", state->cc_enable ? "enabled" : "disabled");
644 break; 620 break;
645 621
646#ifdef CONFIG_VIDEO_ADV_DEBUG 622#ifdef CONFIG_VIDEO_ADV_DEBUG
@@ -723,7 +699,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
723 client->driver = &i2c_driver_saa7127; 699 client->driver = &i2c_driver_saa7127;
724 snprintf(client->name, sizeof(client->name) - 1, "saa7127"); 700 snprintf(client->name, sizeof(client->name) - 1, "saa7127");
725 701
726 saa7127_dbg("detecting saa7127 client on address 0x%x\n", address << 1); 702 v4l_dbg(1, client, "detecting saa7127 client on address 0x%x\n", address << 1);
727 703
728 /* First test register 0: Bits 5-7 are a version ID (should be 0), 704 /* First test register 0: Bits 5-7 are a version ID (should be 0),
729 and bit 2 should also be 0. 705 and bit 2 should also be 0.
@@ -732,7 +708,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
732 0x1d after a reset and not expected to ever change. */ 708 0x1d after a reset and not expected to ever change. */
733 if ((saa7127_read(client, 0) & 0xe4) != 0 || 709 if ((saa7127_read(client, 0) & 0xe4) != 0 ||
734 (saa7127_read(client, 0x29) & 0x3f) != 0x1d) { 710 (saa7127_read(client, 0x29) & 0x3f) != 0x1d) {
735 saa7127_dbg("saa7127 not found\n"); 711 v4l_dbg(1, client, "saa7127 not found\n");
736 kfree(client); 712 kfree(client);
737 return 0; 713 return 0;
738 } 714 }
@@ -748,7 +724,7 @@ static int saa7127_attach(struct i2c_adapter *adapter, int address, int kind)
748 724
749 /* Configure Encoder */ 725 /* Configure Encoder */
750 726
751 saa7127_dbg("Configuring encoder\n"); 727 v4l_dbg(1, client, "Configuring encoder\n");
752 saa7127_write_inittab(client, saa7127_init_config_common); 728 saa7127_write_inittab(client, saa7127_init_config_common);
753 saa7127_set_std(client, V4L2_STD_NTSC); 729 saa7127_set_std(client, V4L2_STD_NTSC);
754 saa7127_set_output_type(client, SAA7127_OUTPUT_TYPE_BOTH); 730 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)
769 read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2); 745 read_result = saa7127_read(client, SAA7129_REG_FADE_KEY_COL2);
770 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa); 746 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, 0xaa);
771 if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) { 747 if (saa7127_read(client, SAA7129_REG_FADE_KEY_COL2) == 0xaa) {
772 saa7127_info("saa7129 found @ 0x%x (%s)\n", address << 1, adapter->name); 748 v4l_info(client, "saa7129 found @ 0x%x (%s)\n", address << 1, adapter->name);
773 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result); 749 saa7127_write(client, SAA7129_REG_FADE_KEY_COL2, read_result);
774 saa7127_write_inittab(client, saa7129_init_config_extra); 750 saa7127_write_inittab(client, saa7129_init_config_extra);
775 state->ident = V4L2_IDENT_SAA7129; 751 state->ident = V4L2_IDENT_SAA7129;
776 } else { 752 } else {
777 saa7127_info("saa7127 found @ 0x%x (%s)\n", address << 1, adapter->name); 753 v4l_info(client, "saa7127 found @ 0x%x (%s)\n", address << 1, adapter->name);
778 state->ident = V4L2_IDENT_SAA7127; 754 state->ident = V4L2_IDENT_SAA7127;
779 } 755 }
780 756
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c
index 4647db66ba68..261b7a3c0417 100644
--- a/drivers/media/video/tea5767.c
+++ b/drivers/media/video/tea5767.c
@@ -17,6 +17,9 @@
17 17
18#define PREFIX "TEA5767 " 18#define PREFIX "TEA5767 "
19 19
20/* from tuner-core.c */
21extern int debug;
22
20/*****************************************************************************/ 23/*****************************************************************************/
21 24
22/****************************** 25/******************************
@@ -246,7 +249,7 @@ static void set_radio_freq(struct i2c_client *c, unsigned int frq)
246 if (5 != (rc = i2c_master_send(c, buffer, 5))) 249 if (5 != (rc = i2c_master_send(c, buffer, 5)))
247 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); 250 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
248 251
249 if (tuner_debug) { 252 if (debug) {
250 if (5 != (rc = i2c_master_recv(c, buffer, 5))) 253 if (5 != (rc = i2c_master_recv(c, buffer, 5)))
251 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc); 254 tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
252 else 255 else
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index fd18a882668e..a727c3ae62c3 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -23,8 +23,6 @@
23#include <media/v4l2-common.h> 23#include <media/v4l2-common.h>
24#include <media/audiochip.h> 24#include <media/audiochip.h>
25 25
26#include "msp3400.h"
27
28#define UNSET (-1U) 26#define UNSET (-1U)
29 27
30/* standard i2c insmod options */ 28/* standard i2c insmod options */
@@ -43,7 +41,8 @@ static unsigned int no_autodetect = 0;
43static unsigned int show_i2c = 0; 41static unsigned int show_i2c = 0;
44 42
45/* insmod options used at runtime => read/write */ 43/* insmod options used at runtime => read/write */
46unsigned int tuner_debug = 0; 44static unsigned int tuner_debug = 0;
45int debug = 0;
47 46
48static unsigned int tv_range[2] = { 44, 958 }; 47static unsigned int tv_range[2] = { 44, 958 };
49static unsigned int radio_range[2] = { 65, 108 }; 48static unsigned int radio_range[2] = { 65, 108 };
@@ -55,7 +54,9 @@ static char ntsc[] = "-";
55module_param(addr, int, 0444); 54module_param(addr, int, 0444);
56module_param(no_autodetect, int, 0444); 55module_param(no_autodetect, int, 0444);
57module_param(show_i2c, int, 0444); 56module_param(show_i2c, int, 0444);
58module_param(tuner_debug, int, 0644); 57/* Note: tuner_debug is deprecated and will be removed in 2.6.17 */
58module_param(tuner_debug, int, 0444);
59module_param(debug, int, 0644);
59 60
60module_param_string(pal, pal, sizeof(pal), 0644); 61module_param_string(pal, pal, sizeof(pal), 0644);
61module_param_string(secam, secam, sizeof(secam), 0644); 62module_param_string(secam, secam, sizeof(secam), 0644);
@@ -419,6 +420,11 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
419 t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */ 420 t->radio_if2 = 10700 * 1000; /* 10.7MHz - FM radio */
420 t->audmode = V4L2_TUNER_MODE_STEREO; 421 t->audmode = V4L2_TUNER_MODE_STEREO;
421 t->mode_mask = T_UNINITIALIZED; 422 t->mode_mask = T_UNINITIALIZED;
423 if (tuner_debug) {
424 debug = tuner_debug;
425 printk(KERN_ERR "tuner: tuner_debug is deprecated and will be removed in 2.6.17.\n");
426 printk(KERN_ERR "tuner: use the debug option instead.\n");
427 }
422 428
423 if (show_i2c) { 429 if (show_i2c) {
424 unsigned char buffer[16]; 430 unsigned char buffer[16];
@@ -546,7 +552,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
546{ 552{
547 struct tuner *t = i2c_get_clientdata(client); 553 struct tuner *t = i2c_get_clientdata(client);
548 554
549 if (tuner_debug>1) 555 if (debug>1)
550 v4l_i2c_print_ioctl(&(t->i2c),cmd); 556 v4l_i2c_print_ioctl(&(t->i2c),cmd);
551 557
552 switch (cmd) { 558 switch (cmd) {
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index fec620073aa3..9f6b6d855f00 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -47,19 +47,6 @@ MODULE_LICENSE("GPL");
47 47
48#define UNSET (-1U) 48#define UNSET (-1U)
49 49
50#define tvaudio_info(fmt, arg...) do { \
51 printk(KERN_INFO "%s %d-%04x: " fmt, chip->c.driver->name, \
52 i2c_adapter_id(chip->c.adapter), chip->c.addr , ## arg); } while (0)
53#define tvaudio_warn(fmt, arg...) do { \
54 printk(KERN_WARNING "%s %d-%04x: " fmt, chip->c.driver->name, \
55 i2c_adapter_id(chip->c.adapter), chip->c.addr , ## arg); } while (0)
56#define tvaudio_dbg(fmt, arg...) \
57 do { \
58 if (debug) \
59 printk(KERN_INFO "%s debug %d-%04x: " fmt, chip->c.driver->name, \
60 i2c_adapter_id(chip->c.adapter), chip->c.addr , ## arg); \
61 } while (0)
62
63/* ---------------------------------------------------------------------- */ 50/* ---------------------------------------------------------------------- */
64/* our structs */ 51/* our structs */
65 52
@@ -172,23 +159,23 @@ static int chip_write(struct CHIPSTATE *chip, int subaddr, int val)
172 unsigned char buffer[2]; 159 unsigned char buffer[2];
173 160
174 if (-1 == subaddr) { 161 if (-1 == subaddr) {
175 tvaudio_dbg("%s: chip_write: 0x%x\n", 162 v4l_dbg(1, &chip->c, "%s: chip_write: 0x%x\n",
176 chip->c.name, val); 163 chip->c.name, val);
177 chip->shadow.bytes[1] = val; 164 chip->shadow.bytes[1] = val;
178 buffer[0] = val; 165 buffer[0] = val;
179 if (1 != i2c_master_send(&chip->c,buffer,1)) { 166 if (1 != i2c_master_send(&chip->c,buffer,1)) {
180 tvaudio_warn("%s: I/O error (write 0x%x)\n", 167 v4l_warn(&chip->c, "%s: I/O error (write 0x%x)\n",
181 chip->c.name, val); 168 chip->c.name, val);
182 return -1; 169 return -1;
183 } 170 }
184 } else { 171 } else {
185 tvaudio_dbg("%s: chip_write: reg%d=0x%x\n", 172 v4l_dbg(1, &chip->c, "%s: chip_write: reg%d=0x%x\n",
186 chip->c.name, subaddr, val); 173 chip->c.name, subaddr, val);
187 chip->shadow.bytes[subaddr+1] = val; 174 chip->shadow.bytes[subaddr+1] = val;
188 buffer[0] = subaddr; 175 buffer[0] = subaddr;
189 buffer[1] = val; 176 buffer[1] = val;
190 if (2 != i2c_master_send(&chip->c,buffer,2)) { 177 if (2 != i2c_master_send(&chip->c,buffer,2)) {
191 tvaudio_warn("%s: I/O error (write reg%d=0x%x)\n", 178 v4l_warn(&chip->c, "%s: I/O error (write reg%d=0x%x)\n",
192 chip->c.name, subaddr, val); 179 chip->c.name, subaddr, val);
193 return -1; 180 return -1;
194 } 181 }
@@ -213,11 +200,11 @@ static int chip_read(struct CHIPSTATE *chip)
213 unsigned char buffer; 200 unsigned char buffer;
214 201
215 if (1 != i2c_master_recv(&chip->c,&buffer,1)) { 202 if (1 != i2c_master_recv(&chip->c,&buffer,1)) {
216 tvaudio_warn("%s: I/O error (read)\n", 203 v4l_warn(&chip->c, "%s: I/O error (read)\n",
217 chip->c.name); 204 chip->c.name);
218 return -1; 205 return -1;
219 } 206 }
220 tvaudio_dbg("%s: chip_read: 0x%x\n",chip->c.name, buffer); 207 v4l_dbg(1, &chip->c, "%s: chip_read: 0x%x\n",chip->c.name, buffer);
221 return buffer; 208 return buffer;
222} 209}
223 210
@@ -232,10 +219,10 @@ static int chip_read2(struct CHIPSTATE *chip, int subaddr)
232 write[0] = subaddr; 219 write[0] = subaddr;
233 220
234 if (2 != i2c_transfer(chip->c.adapter,msgs,2)) { 221 if (2 != i2c_transfer(chip->c.adapter,msgs,2)) {
235 tvaudio_warn("%s: I/O error (read2)\n", chip->c.name); 222 v4l_warn(&chip->c, "%s: I/O error (read2)\n", chip->c.name);
236 return -1; 223 return -1;
237 } 224 }
238 tvaudio_dbg("%s: chip_read2: reg%d=0x%x\n", 225 v4l_dbg(1, &chip->c, "%s: chip_read2: reg%d=0x%x\n",
239 chip->c.name, subaddr,read[0]); 226 chip->c.name, subaddr,read[0]);
240 return read[0]; 227 return read[0];
241} 228}
@@ -248,7 +235,7 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd)
248 return 0; 235 return 0;
249 236
250 /* update our shadow register set; print bytes if (debug > 0) */ 237 /* update our shadow register set; print bytes if (debug > 0) */
251 tvaudio_dbg("%s: chip_cmd(%s): reg=%d, data:", 238 v4l_dbg(1, &chip->c, "%s: chip_cmd(%s): reg=%d, data:",
252 chip->c.name, name,cmd->bytes[0]); 239 chip->c.name, name,cmd->bytes[0]);
253 for (i = 1; i < cmd->count; i++) { 240 for (i = 1; i < cmd->count; i++) {
254 if (debug) 241 if (debug)
@@ -260,7 +247,7 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd)
260 247
261 /* send data to the chip */ 248 /* send data to the chip */
262 if (cmd->count != i2c_master_send(&chip->c,cmd->bytes,cmd->count)) { 249 if (cmd->count != i2c_master_send(&chip->c,cmd->bytes,cmd->count)) {
263 tvaudio_warn("%s: I/O error (%s)\n", chip->c.name, name); 250 v4l_warn(&chip->c, "%s: I/O error (%s)\n", chip->c.name, name);
264 return -1; 251 return -1;
265 } 252 }
266 return 0; 253 return 0;
@@ -287,7 +274,7 @@ static int chip_thread(void *data)
287 274
288 daemonize("%s", chip->c.name); 275 daemonize("%s", chip->c.name);
289 allow_signal(SIGTERM); 276 allow_signal(SIGTERM);
290 tvaudio_dbg("%s: thread started\n", chip->c.name); 277 v4l_dbg(1, &chip->c, "%s: thread started\n", chip->c.name);
291 278
292 for (;;) { 279 for (;;) {
293 add_wait_queue(&chip->wq, &wait); 280 add_wait_queue(&chip->wq, &wait);
@@ -299,7 +286,7 @@ static int chip_thread(void *data)
299 try_to_freeze(); 286 try_to_freeze();
300 if (chip->done || signal_pending(current)) 287 if (chip->done || signal_pending(current))
301 break; 288 break;
302 tvaudio_dbg("%s: thread wakeup\n", chip->c.name); 289 v4l_dbg(1, &chip->c, "%s: thread wakeup\n", chip->c.name);
303 290
304 /* don't do anything for radio or if mode != auto */ 291 /* don't do anything for radio or if mode != auto */
305 if (chip->radio || chip->mode != 0) 292 if (chip->radio || chip->mode != 0)
@@ -312,7 +299,7 @@ static int chip_thread(void *data)
312 mod_timer(&chip->wt, jiffies+2*HZ); 299 mod_timer(&chip->wt, jiffies+2*HZ);
313 } 300 }
314 301
315 tvaudio_dbg("%s: thread exiting\n", chip->c.name); 302 v4l_dbg(1, &chip->c, "%s: thread exiting\n", chip->c.name);
316 complete_and_exit(&chip->texit, 0); 303 complete_and_exit(&chip->texit, 0);
317 return 0; 304 return 0;
318} 305}
@@ -325,7 +312,7 @@ static void generic_checkmode(struct CHIPSTATE *chip)
325 if (mode == chip->prevmode) 312 if (mode == chip->prevmode)
326 return; 313 return;
327 314
328 tvaudio_dbg("%s: thread checkmode\n", chip->c.name); 315 v4l_dbg(1, &chip->c, "%s: thread checkmode\n", chip->c.name);
329 chip->prevmode = mode; 316 chip->prevmode = mode;
330 317
331 if (mode & VIDEO_SOUND_STEREO) 318 if (mode & VIDEO_SOUND_STEREO)
@@ -372,7 +359,7 @@ static int tda9840_getmode(struct CHIPSTATE *chip)
372 if (val & TDA9840_ST_STEREO) 359 if (val & TDA9840_ST_STEREO)
373 mode |= VIDEO_SOUND_STEREO; 360 mode |= VIDEO_SOUND_STEREO;
374 361
375 tvaudio_dbg ("tda9840_getmode(): raw chip read: %d, return: %d\n", 362 v4l_dbg(1, &chip->c, "tda9840_getmode(): raw chip read: %d, return: %d\n",
376 val, mode); 363 val, mode);
377 return mode; 364 return mode;
378} 365}
@@ -668,7 +655,7 @@ static int tda9873_getmode(struct CHIPSTATE *chip)
668 mode |= VIDEO_SOUND_STEREO; 655 mode |= VIDEO_SOUND_STEREO;
669 if (val & TDA9873_DUAL) 656 if (val & TDA9873_DUAL)
670 mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 657 mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
671 tvaudio_dbg ("tda9873_getmode(): raw chip read: %d, return: %d\n", 658 v4l_dbg(1, &chip->c, "tda9873_getmode(): raw chip read: %d, return: %d\n",
672 val, mode); 659 val, mode);
673 return mode; 660 return mode;
674} 661}
@@ -679,12 +666,12 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode)
679 /* int adj_data = chip->shadow.bytes[TDA9873_AD+1] ; */ 666 /* int adj_data = chip->shadow.bytes[TDA9873_AD+1] ; */
680 667
681 if ((sw_data & TDA9873_INP_MASK) != TDA9873_INTERNAL) { 668 if ((sw_data & TDA9873_INP_MASK) != TDA9873_INTERNAL) {
682 tvaudio_dbg("tda9873_setmode(): external input\n"); 669 v4l_dbg(1, &chip->c, "tda9873_setmode(): external input\n");
683 return; 670 return;
684 } 671 }
685 672
686 tvaudio_dbg("tda9873_setmode(): chip->shadow.bytes[%d] = %d\n", TDA9873_SW+1, chip->shadow.bytes[TDA9873_SW+1]); 673 v4l_dbg(1, &chip->c, "tda9873_setmode(): chip->shadow.bytes[%d] = %d\n", TDA9873_SW+1, chip->shadow.bytes[TDA9873_SW+1]);
687 tvaudio_dbg("tda9873_setmode(): sw_data = %d\n", sw_data); 674 v4l_dbg(1, &chip->c, "tda9873_setmode(): sw_data = %d\n", sw_data);
688 675
689 switch (mode) { 676 switch (mode) {
690 case VIDEO_SOUND_MONO: 677 case VIDEO_SOUND_MONO:
@@ -705,7 +692,7 @@ static void tda9873_setmode(struct CHIPSTATE *chip, int mode)
705 } 692 }
706 693
707 chip_write(chip, TDA9873_SW, sw_data); 694 chip_write(chip, TDA9873_SW, sw_data);
708 tvaudio_dbg("tda9873_setmode(): req. mode %d; chip_write: %d\n", 695 v4l_dbg(1, &chip->c, "tda9873_setmode(): req. mode %d; chip_write: %d\n",
709 mode, sw_data); 696 mode, sw_data);
710} 697}
711 698
@@ -844,7 +831,7 @@ static int tda9874a_setup(struct CHIPSTATE *chip)
844 chip_write(chip, TDA9874A_SDACOSR, (tda9874a_mode) ? 0x81:0x80); 831 chip_write(chip, TDA9874A_SDACOSR, (tda9874a_mode) ? 0x81:0x80);
845 chip_write(chip, TDA9874A_AOSR, 0x00); /* or 0x10 */ 832 chip_write(chip, TDA9874A_AOSR, 0x00); /* or 0x10 */
846 } 833 }
847 tvaudio_dbg("tda9874a_setup(): %s [0x%02X].\n", 834 v4l_dbg(1, &chip->c, "tda9874a_setup(): %s [0x%02X].\n",
848 tda9874a_modelist[tda9874a_STD].name,tda9874a_STD); 835 tda9874a_modelist[tda9874a_STD].name,tda9874a_STD);
849 return 1; 836 return 1;
850} 837}
@@ -887,7 +874,7 @@ static int tda9874a_getmode(struct CHIPSTATE *chip)
887 mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; 874 mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
888 } 875 }
889 876
890 tvaudio_dbg("tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n", 877 v4l_dbg(1, &chip->c, "tda9874a_getmode(): DSR=0x%X, NSR=0x%X, NECR=0x%X, return: %d.\n",
891 dsr, nsr, necr, mode); 878 dsr, nsr, necr, mode);
892 return mode; 879 return mode;
893} 880}
@@ -933,7 +920,7 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode)
933 chip_write(chip, TDA9874A_AOSR, aosr); 920 chip_write(chip, TDA9874A_AOSR, aosr);
934 chip_write(chip, TDA9874A_MDACOSR, mdacosr); 921 chip_write(chip, TDA9874A_MDACOSR, mdacosr);
935 922
936 tvaudio_dbg("tda9874a_setmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n", 923 v4l_dbg(1, &chip->c, "tda9874a_setmode(): req. mode %d; AOSR=0x%X, MDACOSR=0x%X.\n",
937 mode, aosr, mdacosr); 924 mode, aosr, mdacosr);
938 925
939 } else { /* dic == 0x07 */ 926 } else { /* dic == 0x07 */
@@ -968,7 +955,7 @@ static void tda9874a_setmode(struct CHIPSTATE *chip, int mode)
968 chip_write(chip, TDA9874A_FMMR, fmmr); 955 chip_write(chip, TDA9874A_FMMR, fmmr);
969 chip_write(chip, TDA9874A_AOSR, aosr); 956 chip_write(chip, TDA9874A_AOSR, aosr);
970 957
971 tvaudio_dbg("tda9874a_setmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n", 958 v4l_dbg(1, &chip->c, "tda9874a_setmode(): req. mode %d; FMMR=0x%X, AOSR=0x%X.\n",
972 mode, fmmr, aosr); 959 mode, fmmr, aosr);
973 } 960 }
974} 961}
@@ -982,10 +969,10 @@ static int tda9874a_checkit(struct CHIPSTATE *chip)
982 if(-1 == (sic = chip_read2(chip,TDA9874A_SIC))) 969 if(-1 == (sic = chip_read2(chip,TDA9874A_SIC)))
983 return 0; 970 return 0;
984 971
985 tvaudio_dbg("tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic); 972 v4l_dbg(1, &chip->c, "tda9874a_checkit(): DIC=0x%X, SIC=0x%X.\n", dic, sic);
986 973
987 if((dic == 0x11)||(dic == 0x07)) { 974 if((dic == 0x11)||(dic == 0x07)) {
988 tvaudio_info("found tda9874%s.\n", (dic == 0x11) ? "a":"h"); 975 v4l_info(&chip->c, "found tda9874%s.\n", (dic == 0x11) ? "a":"h");
989 tda9874a_dic = dic; /* remember device id. */ 976 tda9874a_dic = dic; /* remember device id. */
990 return 1; 977 return 1;
991 } 978 }
@@ -1197,7 +1184,7 @@ static int ta8874z_getmode(struct CHIPSTATE *chip)
1197 }else if (!(val & TA8874Z_B0)){ 1184 }else if (!(val & TA8874Z_B0)){
1198 mode |= VIDEO_SOUND_STEREO; 1185 mode |= VIDEO_SOUND_STEREO;
1199 } 1186 }
1200 /* tvaudio_dbg ("ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */ 1187 /* v4l_dbg(1, &chip->c, "ta8874z_getmode(): raw chip read: 0x%02x, return: 0x%02x\n", val, mode); */
1201 return mode; 1188 return mode;
1202} 1189}
1203 1190
@@ -1210,7 +1197,7 @@ static void ta8874z_setmode(struct CHIPSTATE *chip, int mode)
1210{ 1197{
1211 int update = 1; 1198 int update = 1;
1212 audiocmd *t = NULL; 1199 audiocmd *t = NULL;
1213 tvaudio_dbg("ta8874z_setmode(): mode: 0x%02x\n", mode); 1200 v4l_dbg(1, &chip->c, "ta8874z_setmode(): mode: 0x%02x\n", mode);
1214 1201
1215 switch(mode){ 1202 switch(mode){
1216 case VIDEO_SOUND_MONO: 1203 case VIDEO_SOUND_MONO:
@@ -1491,7 +1478,7 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind)
1491 i2c_set_clientdata(&chip->c, chip); 1478 i2c_set_clientdata(&chip->c, chip);
1492 1479
1493 /* find description for the chip */ 1480 /* find description for the chip */
1494 tvaudio_dbg("chip found @ 0x%x\n", addr<<1); 1481 v4l_dbg(1, &chip->c, "chip found @ 0x%x\n", addr<<1);
1495 for (desc = chiplist; desc->name != NULL; desc++) { 1482 for (desc = chiplist; desc->name != NULL; desc++) {
1496 if (0 == *(desc->insmodopt)) 1483 if (0 == *(desc->insmodopt))
1497 continue; 1484 continue;
@@ -1503,12 +1490,12 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind)
1503 break; 1490 break;
1504 } 1491 }
1505 if (desc->name == NULL) { 1492 if (desc->name == NULL) {
1506 tvaudio_dbg("no matching chip description found\n"); 1493 v4l_dbg(1, &chip->c, "no matching chip description found\n");
1507 return -EIO; 1494 return -EIO;
1508 } 1495 }
1509 tvaudio_info("%s found @ 0x%x (%s)\n", desc->name, addr<<1, adap->name); 1496 v4l_info(&chip->c, "%s found @ 0x%x (%s)\n", desc->name, addr<<1, adap->name);
1510 if (desc->flags) { 1497 if (desc->flags) {
1511 tvaudio_dbg("matches:%s%s%s.\n", 1498 v4l_dbg(1, &chip->c, "matches:%s%s%s.\n",
1512 (desc->flags & CHIP_HAS_VOLUME) ? " volume" : "", 1499 (desc->flags & CHIP_HAS_VOLUME) ? " volume" : "",
1513 (desc->flags & CHIP_HAS_BASSTREBLE) ? " bass/treble" : "", 1500 (desc->flags & CHIP_HAS_BASSTREBLE) ? " bass/treble" : "",
1514 (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : ""); 1501 (desc->flags & CHIP_HAS_INPUTSEL) ? " audiomux" : "");
@@ -1551,7 +1538,7 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind)
1551 init_completion(&chip->texit); 1538 init_completion(&chip->texit);
1552 chip->tpid = kernel_thread(chip_thread,(void *)chip,0); 1539 chip->tpid = kernel_thread(chip_thread,(void *)chip,0);
1553 if (chip->tpid < 0) 1540 if (chip->tpid < 0)
1554 tvaudio_warn("%s: kernel_thread() failed\n", 1541 v4l_warn(&chip->c, "%s: kernel_thread() failed\n",
1555 chip->c.name); 1542 chip->c.name);
1556 wake_up_interruptible(&chip->wq); 1543 wake_up_interruptible(&chip->wq);
1557 } 1544 }
@@ -1596,7 +1583,7 @@ static int chip_command(struct i2c_client *client,
1596 struct CHIPSTATE *chip = i2c_get_clientdata(client); 1583 struct CHIPSTATE *chip = i2c_get_clientdata(client);
1597 struct CHIPDESC *desc = chiplist + chip->type; 1584 struct CHIPDESC *desc = chiplist + chip->type;
1598 1585
1599 tvaudio_dbg("%s: chip_command 0x%x\n", chip->c.name, cmd); 1586 v4l_dbg(1, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd);
1600 1587
1601 switch (cmd) { 1588 switch (cmd) {
1602 case AUDC_SET_INPUT: 1589 case AUDC_SET_INPUT:
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 9bb367863a6f..fd0acc5da667 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -40,6 +40,7 @@
40 40
41#include <media/tuner.h> 41#include <media/tuner.h>
42#include <media/tveeprom.h> 42#include <media/tveeprom.h>
43#include <media/v4l2-common.h>
43#include <media/audiochip.h> 44#include <media/audiochip.h>
44 45
45MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver"); 46MODULE_DESCRIPTION("i2c Hauppauge eeprom decoder driver");
@@ -52,16 +53,14 @@ MODULE_PARM_DESC(debug, "Debug level (0-1)");
52 53
53#define STRM(array,i) (i < sizeof(array)/sizeof(char*) ? array[i] : "unknown") 54#define STRM(array,i) (i < sizeof(array)/sizeof(char*) ? array[i] : "unknown")
54 55
55#define tveeprom_info(fmt, arg...) do {\ 56#define tveeprom_info(fmt, arg...) \
56 printk(KERN_INFO "tveeprom %d-%04x: " fmt, \ 57 v4l_printk(KERN_INFO, "tveeprom", c->adapter, c->addr, fmt , ## arg)
57 c->adapter->nr, c->addr , ##arg); } while (0) 58#define tveeprom_warn(fmt, arg...) \
58#define tveeprom_warn(fmt, arg...) do {\ 59 v4l_printk(KERN_WARNING, "tveeprom", c->adapter, c->addr, fmt , ## arg)
59 printk(KERN_WARNING "tveeprom %d-%04x: " fmt, \ 60#define tveeprom_dbg(fmt, arg...) do { \
60 c->adapter->nr, c->addr , ##arg); } while (0)
61#define tveeprom_dbg(fmt, arg...) do {\
62 if (debug) \ 61 if (debug) \
63 printk(KERN_INFO "tveeprom %d-%04x: " fmt, \ 62 v4l_printk(KERN_DEBUG, "tveeprom", c->adapter, c->addr, fmt , ## arg); \
64 c->adapter->nr, c->addr , ##arg); } while (0) 63 } while (0)
65 64
66/* 65/*
67 * The Hauppauge eeprom uses an 8bit field to determine which 66 * The Hauppauge eeprom uses an 8bit field to determine which
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c
index a1b6a427ab74..20b4ec93d7c9 100644
--- a/drivers/media/video/wm8775.c
+++ b/drivers/media/video/wm8775.c
@@ -32,20 +32,12 @@
32#include <linux/i2c.h> 32#include <linux/i2c.h>
33#include <linux/i2c-id.h> 33#include <linux/i2c-id.h>
34#include <linux/videodev.h> 34#include <linux/videodev.h>
35#include <media/audiochip.h> 35#include <media/v4l2-common.h>
36 36
37MODULE_DESCRIPTION("wm8775 driver"); 37MODULE_DESCRIPTION("wm8775 driver");
38MODULE_AUTHOR("Ulf Eklund, Hans Verkuil"); 38MODULE_AUTHOR("Ulf Eklund, Hans Verkuil");
39MODULE_LICENSE("GPL"); 39MODULE_LICENSE("GPL");
40 40
41#define wm8775_err(fmt, arg...) do { \
42 printk(KERN_ERR "%s %d-%04x: " fmt, client->driver->driver.name, \
43 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
44#define wm8775_info(fmt, arg...) do { \
45 printk(KERN_INFO "%s %d-%04x: " fmt, client->driver->driver.name, \
46 i2c_adapter_id(client->adapter), client->addr , ## arg); } while (0)
47
48
49static unsigned short normal_i2c[] = { 0x36 >> 1, I2C_CLIENT_END }; 41static unsigned short normal_i2c[] = { 0x36 >> 1, I2C_CLIENT_END };
50 42
51 43
@@ -69,7 +61,7 @@ static int wm8775_write(struct i2c_client *client, int reg, u16 val)
69 int i; 61 int i;
70 62
71 if (reg < 0 || reg >= TOT_REGS) { 63 if (reg < 0 || reg >= TOT_REGS) {
72 wm8775_err("Invalid register R%d\n", reg); 64 v4l_err(client, "Invalid register R%d\n", reg);
73 return -1; 65 return -1;
74 } 66 }
75 67
@@ -79,7 +71,7 @@ static int wm8775_write(struct i2c_client *client, int reg, u16 val)
79 return 0; 71 return 0;
80 } 72 }
81 } 73 }
82 wm8775_err("I2C: cannot write %03x to register R%d\n", val, reg); 74 v4l_err(client, "I2C: cannot write %03x to register R%d\n", val, reg);
83 return -1; 75 return -1;
84} 76}
85 77
@@ -98,7 +90,7 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd,
98 If only one input is active (the normal case) then the 90 If only one input is active (the normal case) then the
99 input values 1, 2, 4 or 8 should be used. */ 91 input values 1, 2, 4 or 8 should be used. */
100 if (input->index > 15) { 92 if (input->index > 15) {
101 wm8775_err("Invalid input %d.\n", input->index); 93 v4l_err(client, "Invalid input %d.\n", input->index);
102 return -EINVAL; 94 return -EINVAL;
103 } 95 }
104 state->input = input->index; 96 state->input = input->index;
@@ -133,7 +125,7 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd,
133 break; 125 break;
134 126
135 case VIDIOC_LOG_STATUS: 127 case VIDIOC_LOG_STATUS:
136 wm8775_info("Input: %d%s\n", state->input, 128 v4l_info(client, "Input: %d%s\n", state->input,
137 state->muted ? " (muted)" : ""); 129 state->muted ? " (muted)" : "");
138 break; 130 break;
139 131
@@ -184,7 +176,7 @@ static int wm8775_attach(struct i2c_adapter *adapter, int address, int kind)
184 client->driver = &i2c_driver; 176 client->driver = &i2c_driver;
185 snprintf(client->name, sizeof(client->name) - 1, "wm8775"); 177 snprintf(client->name, sizeof(client->name) - 1, "wm8775");
186 178
187 wm8775_info("chip found @ 0x%x (%s)\n", address << 1, adapter->name); 179 v4l_info(client, "chip found @ 0x%x (%s)\n", address << 1, adapter->name);
188 180
189 state = kmalloc(sizeof(struct wm8775_state), GFP_KERNEL); 181 state = kmalloc(sizeof(struct wm8775_state), GFP_KERNEL);
190 if (state == NULL) { 182 if (state == NULL) {