aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx25840
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/video/cx25840
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/video/cx25840')
-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
3 files changed, 41 insertions, 58 deletions
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