diff options
Diffstat (limited to 'drivers/media/video/em28xx')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 8 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-core.c | 61 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-i2c.c | 3 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx-video.c | 167 | ||||
-rw-r--r-- | drivers/media/video/em28xx/em28xx.h | 6 |
5 files changed, 137 insertions, 108 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 57779e63f35d..58f7b4194a0d 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include <media/tuner.h> | 30 | #include <media/tuner.h> |
31 | #include <media/audiochip.h> | 31 | #include <media/audiochip.h> |
32 | #include <media/tveeprom.h> | 32 | #include <media/tveeprom.h> |
33 | #include <media/v4l2-common.h> | ||
33 | #include "msp3400.h" | 34 | #include "msp3400.h" |
34 | 35 | ||
35 | #include "em28xx.h" | 36 | #include "em28xx.h" |
@@ -261,7 +262,6 @@ void em28xx_card_setup(struct em28xx *dev) | |||
261 | /* request some modules */ | 262 | /* request some modules */ |
262 | if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) { | 263 | if (dev->model == EM2820_BOARD_HAUPPAUGE_WINTV_USB_2) { |
263 | struct tveeprom tv; | 264 | struct tveeprom tv; |
264 | struct v4l2_audioout ao; | ||
265 | #ifdef CONFIG_MODULES | 265 | #ifdef CONFIG_MODULES |
266 | request_module("tveeprom"); | 266 | request_module("tveeprom"); |
267 | request_module("ir-kbd-i2c"); | 267 | request_module("ir-kbd-i2c"); |
@@ -274,12 +274,8 @@ void em28xx_card_setup(struct em28xx *dev) | |||
274 | 274 | ||
275 | dev->tuner_type= tv.tuner_type; | 275 | dev->tuner_type= tv.tuner_type; |
276 | if (tv.audio_processor == AUDIO_CHIP_MSP34XX) { | 276 | if (tv.audio_processor == AUDIO_CHIP_MSP34XX) { |
277 | dev->i2s_speed=2048000; | ||
277 | dev->has_msp34xx=1; | 278 | dev->has_msp34xx=1; |
278 | memset (&ao,0,sizeof(ao)); | ||
279 | |||
280 | ao.index=2; | ||
281 | ao.mode=V4L2_AUDMODE_32BITS; | ||
282 | em28xx_i2c_call_clients(dev, VIDIOC_S_AUDOUT, &ao); | ||
283 | } else | 279 | } else |
284 | dev->has_msp34xx=0; | 280 | dev->has_msp34xx=0; |
285 | } | 281 | } |
diff --git a/drivers/media/video/em28xx/em28xx-core.c b/drivers/media/video/em28xx/em28xx-core.c index 0cfe75416ec6..dff3893f32fd 100644 --- a/drivers/media/video/em28xx/em28xx-core.c +++ b/drivers/media/video/em28xx/em28xx-core.c | |||
@@ -32,7 +32,7 @@ | |||
32 | 32 | ||
33 | /* #define ENABLE_DEBUG_ISOC_FRAMES */ | 33 | /* #define ENABLE_DEBUG_ISOC_FRAMES */ |
34 | 34 | ||
35 | static unsigned int core_debug; | 35 | static unsigned int core_debug = 0; |
36 | module_param(core_debug,int,0644); | 36 | module_param(core_debug,int,0644); |
37 | MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); | 37 | MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); |
38 | 38 | ||
@@ -41,7 +41,7 @@ MODULE_PARM_DESC(core_debug,"enable debug messages [core]"); | |||
41 | printk(KERN_INFO "%s %s :"fmt, \ | 41 | printk(KERN_INFO "%s %s :"fmt, \ |
42 | dev->name, __FUNCTION__ , ##arg); } while (0) | 42 | dev->name, __FUNCTION__ , ##arg); } while (0) |
43 | 43 | ||
44 | static unsigned int reg_debug; | 44 | static unsigned int reg_debug = 0; |
45 | module_param(reg_debug,int,0644); | 45 | module_param(reg_debug,int,0644); |
46 | MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); | 46 | MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); |
47 | 47 | ||
@@ -50,7 +50,7 @@ MODULE_PARM_DESC(reg_debug,"enable debug messages [URB reg]"); | |||
50 | printk(KERN_INFO "%s %s :"fmt, \ | 50 | printk(KERN_INFO "%s %s :"fmt, \ |
51 | dev->name, __FUNCTION__ , ##arg); } while (0) | 51 | dev->name, __FUNCTION__ , ##arg); } while (0) |
52 | 52 | ||
53 | static unsigned int isoc_debug; | 53 | static unsigned int isoc_debug = 0; |
54 | module_param(isoc_debug,int,0644); | 54 | module_param(isoc_debug,int,0644); |
55 | MODULE_PARM_DESC(isoc_debug,"enable debug messages [isoc transfers]"); | 55 | MODULE_PARM_DESC(isoc_debug,"enable debug messages [isoc transfers]"); |
56 | 56 | ||
@@ -63,59 +63,6 @@ static int alt = EM28XX_PINOUT; | |||
63 | module_param(alt, int, 0644); | 63 | module_param(alt, int, 0644); |
64 | MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint"); | 64 | MODULE_PARM_DESC(alt, "alternate setting to use for video endpoint"); |
65 | 65 | ||
66 | /* ------------------------------------------------------------------ */ | ||
67 | /* debug help functions */ | ||
68 | |||
69 | static const char *v4l1_ioctls[] = { | ||
70 | "0", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", "GPICT", "SPICT", | ||
71 | "CCAPTURE", "GWIN", "SWIN", "GFBUF", "SFBUF", "KEY", "GFREQ", | ||
72 | "SFREQ", "GAUDIO", "SAUDIO", "SYNC", "MCAPTURE", "GMBUF", "GUNIT", | ||
73 | "GCAPTURE", "SCAPTURE", "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", | ||
74 | "SMICROCODE", "GVBIFMT", "SVBIFMT" }; | ||
75 | #define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) | ||
76 | |||
77 | static const char *v4l2_ioctls[] = { | ||
78 | "QUERYCAP", "1", "ENUM_PIXFMT", "ENUM_FBUFFMT", "G_FMT", "S_FMT", | ||
79 | "G_COMP", "S_COMP", "REQBUFS", "QUERYBUF", "G_FBUF", "S_FBUF", | ||
80 | "G_WIN", "S_WIN", "PREVIEW", "QBUF", "16", "DQBUF", "STREAMON", | ||
81 | "STREAMOFF", "G_PERF", "G_PARM", "S_PARM", "G_STD", "S_STD", | ||
82 | "ENUMSTD", "ENUMINPUT", "G_CTRL", "S_CTRL", "G_TUNER", "S_TUNER", | ||
83 | "G_FREQ", "S_FREQ", "G_AUDIO", "S_AUDIO", "35", "QUERYCTRL", | ||
84 | "QUERYMENU", "G_INPUT", "S_INPUT", "ENUMCVT", "41", "42", "43", | ||
85 | "44", "45", "G_OUTPUT", "S_OUTPUT", "ENUMOUTPUT", "G_AUDOUT", | ||
86 | "S_AUDOUT", "ENUMFX", "G_EFFECT", "S_EFFECT", "G_MODULATOR", | ||
87 | "S_MODULATOR" | ||
88 | }; | ||
89 | #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) | ||
90 | |||
91 | void em28xx_print_ioctl(char *name, unsigned int cmd) | ||
92 | { | ||
93 | char *dir; | ||
94 | |||
95 | switch (_IOC_DIR(cmd)) { | ||
96 | case _IOC_NONE: dir = "--"; break; | ||
97 | case _IOC_READ: dir = "r-"; break; | ||
98 | case _IOC_WRITE: dir = "-w"; break; | ||
99 | case _IOC_READ | _IOC_WRITE: dir = "rw"; break; | ||
100 | default: dir = "??"; break; | ||
101 | } | ||
102 | switch (_IOC_TYPE(cmd)) { | ||
103 | case 'v': | ||
104 | printk(KERN_DEBUG "%s: ioctl 0x%08x (v4l1, %s, VIDIOC%s)\n", | ||
105 | name, cmd, dir, (_IOC_NR(cmd) < V4L1_IOCTLS) ? | ||
106 | v4l1_ioctls[_IOC_NR(cmd)] : "???"); | ||
107 | break; | ||
108 | case 'V': | ||
109 | printk(KERN_DEBUG "%s: ioctl 0x%08x (v4l2, %s, VIDIOC_%s)\n", | ||
110 | name, cmd, dir, (_IOC_NR(cmd) < V4L2_IOCTLS) ? | ||
111 | v4l2_ioctls[_IOC_NR(cmd)] : "???"); | ||
112 | break; | ||
113 | default: | ||
114 | printk(KERN_DEBUG "%s: ioctl 0x%08x (???, %s, #%d)\n", | ||
115 | name, cmd, dir, _IOC_NR(cmd)); | ||
116 | } | ||
117 | } | ||
118 | |||
119 | 66 | ||
120 | /* | 67 | /* |
121 | * em28xx_request_buffers() | 68 | * em28xx_request_buffers() |
@@ -126,7 +73,7 @@ u32 em28xx_request_buffers(struct em28xx *dev, u32 count) | |||
126 | const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ | 73 | const size_t imagesize = PAGE_ALIGN(dev->frame_size); /*needs to be page aligned cause the buffers can be mapped individually! */ |
127 | void *buff = NULL; | 74 | void *buff = NULL; |
128 | u32 i; | 75 | u32 i; |
129 | em28xx_coredbg("requested %i buffers with size %zd", count, imagesize); | 76 | em28xx_coredbg("requested %i buffers with size %zi", count, imagesize); |
130 | if (count > EM28XX_NUM_FRAMES) | 77 | if (count > EM28XX_NUM_FRAMES) |
131 | count = EM28XX_NUM_FRAMES; | 78 | count = EM28XX_NUM_FRAMES; |
132 | 79 | ||
diff --git a/drivers/media/video/em28xx/em28xx-i2c.c b/drivers/media/video/em28xx/em28xx-i2c.c index d14bcf4ceaea..0591a705b7a1 100644 --- a/drivers/media/video/em28xx/em28xx-i2c.c +++ b/drivers/media/video/em28xx/em28xx-i2c.c | |||
@@ -28,6 +28,7 @@ | |||
28 | #include <linux/video_decoder.h> | 28 | #include <linux/video_decoder.h> |
29 | 29 | ||
30 | #include "em28xx.h" | 30 | #include "em28xx.h" |
31 | #include <media/v4l2-common.h> | ||
31 | #include <media/tuner.h> | 32 | #include <media/tuner.h> |
32 | 33 | ||
33 | /* ----------------------------------------------------------- */ | 34 | /* ----------------------------------------------------------- */ |
@@ -486,9 +487,7 @@ static struct i2c_adapter em28xx_adap_template = { | |||
486 | .inc_use = inc_use, | 487 | .inc_use = inc_use, |
487 | .dec_use = dec_use, | 488 | .dec_use = dec_use, |
488 | #endif | 489 | #endif |
489 | #ifdef I2C_CLASS_TV_ANALOG | ||
490 | .class = I2C_CLASS_TV_ANALOG, | 490 | .class = I2C_CLASS_TV_ANALOG, |
491 | #endif | ||
492 | .name = "em28xx", | 491 | .name = "em28xx", |
493 | .id = I2C_HW_B_EM28XX, | 492 | .id = I2C_HW_B_EM28XX, |
494 | .algo = &em28xx_algo, | 493 | .algo = &em28xx_algo, |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 3a56120397ae..fdc255918dde 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | #include "em28xx.h" | 33 | #include "em28xx.h" |
34 | #include <media/tuner.h> | 34 | #include <media/tuner.h> |
35 | #include <media/v4l2-common.h> | ||
35 | 36 | ||
36 | #define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \ | 37 | #define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \ |
37 | "Markus Rechberger <mrechberger@gmail.com>, " \ | 38 | "Markus Rechberger <mrechberger@gmail.com>, " \ |
@@ -106,8 +107,32 @@ static const unsigned char saa7114_i2c_init[] = { | |||
106 | #define TVNORMS ARRAY_SIZE(tvnorms) | 107 | #define TVNORMS ARRAY_SIZE(tvnorms) |
107 | 108 | ||
108 | /* supported controls */ | 109 | /* supported controls */ |
110 | /* Common to all boards */ | ||
109 | static struct v4l2_queryctrl em28xx_qctrl[] = { | 111 | static struct v4l2_queryctrl em28xx_qctrl[] = { |
110 | { | 112 | { |
113 | .id = V4L2_CID_AUDIO_VOLUME, | ||
114 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
115 | .name = "Volume", | ||
116 | .minimum = 0x0, | ||
117 | .maximum = 0x1f, | ||
118 | .step = 0x1, | ||
119 | .default_value = 0x1f, | ||
120 | .flags = 0, | ||
121 | },{ | ||
122 | .id = V4L2_CID_AUDIO_MUTE, | ||
123 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
124 | .name = "Mute", | ||
125 | .minimum = 0, | ||
126 | .maximum = 1, | ||
127 | .step = 1, | ||
128 | .default_value = 1, | ||
129 | .flags = 0, | ||
130 | } | ||
131 | }; | ||
132 | |||
133 | /* FIXME: These are specific to saa711x - should be moved to its code */ | ||
134 | static struct v4l2_queryctrl saa711x_qctrl[] = { | ||
135 | { | ||
111 | .id = V4L2_CID_BRIGHTNESS, | 136 | .id = V4L2_CID_BRIGHTNESS, |
112 | .type = V4L2_CTRL_TYPE_INTEGER, | 137 | .type = V4L2_CTRL_TYPE_INTEGER, |
113 | .name = "Brightness", | 138 | .name = "Brightness", |
@@ -135,24 +160,6 @@ static struct v4l2_queryctrl em28xx_qctrl[] = { | |||
135 | .default_value = 0x10, | 160 | .default_value = 0x10, |
136 | .flags = 0, | 161 | .flags = 0, |
137 | },{ | 162 | },{ |
138 | .id = V4L2_CID_AUDIO_VOLUME, | ||
139 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
140 | .name = "Volume", | ||
141 | .minimum = 0x0, | ||
142 | .maximum = 0x1f, | ||
143 | .step = 0x1, | ||
144 | .default_value = 0x1f, | ||
145 | .flags = 0, | ||
146 | },{ | ||
147 | .id = V4L2_CID_AUDIO_MUTE, | ||
148 | .type = V4L2_CTRL_TYPE_BOOLEAN, | ||
149 | .name = "Mute", | ||
150 | .minimum = 0, | ||
151 | .maximum = 1, | ||
152 | .step = 1, | ||
153 | .default_value = 1, | ||
154 | .flags = 0, | ||
155 | },{ | ||
156 | .id = V4L2_CID_RED_BALANCE, | 163 | .id = V4L2_CID_RED_BALANCE, |
157 | .type = V4L2_CTRL_TYPE_INTEGER, | 164 | .type = V4L2_CTRL_TYPE_INTEGER, |
158 | .name = "Red chroma balance", | 165 | .name = "Red chroma balance", |
@@ -179,7 +186,7 @@ static struct v4l2_queryctrl em28xx_qctrl[] = { | |||
179 | .step = 0x1, | 186 | .step = 0x1, |
180 | .default_value = 0x20, | 187 | .default_value = 0x20, |
181 | .flags = 0, | 188 | .flags = 0, |
182 | } | 189 | } |
183 | }; | 190 | }; |
184 | 191 | ||
185 | static struct usb_driver em28xx_usb_driver; | 192 | static struct usb_driver em28xx_usb_driver; |
@@ -280,6 +287,8 @@ static void video_mux(struct em28xx *dev, int index) | |||
280 | em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); | 287 | em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); |
281 | 288 | ||
282 | if (dev->has_msp34xx) { | 289 | if (dev->has_msp34xx) { |
290 | if (dev->i2s_speed) | ||
291 | em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed); | ||
283 | em28xx_i2c_call_clients(dev, VIDIOC_S_AUDIO, &dev->ctl_ainput); | 292 | em28xx_i2c_call_clients(dev, VIDIOC_S_AUDIO, &dev->ctl_ainput); |
284 | ainput = EM28XX_AUDIO_SRC_TUNER; | 293 | ainput = EM28XX_AUDIO_SRC_TUNER; |
285 | em28xx_audio_source(dev, ainput); | 294 | em28xx_audio_source(dev, ainput); |
@@ -674,7 +683,6 @@ static int em28xx_v4l2_mmap(struct file *filp, struct vm_area_struct *vma) | |||
674 | */ | 683 | */ |
675 | static int em28xx_get_ctrl(struct em28xx *dev, struct v4l2_control *ctrl) | 684 | static int em28xx_get_ctrl(struct em28xx *dev, struct v4l2_control *ctrl) |
676 | { | 685 | { |
677 | s32 tmp; | ||
678 | switch (ctrl->id) { | 686 | switch (ctrl->id) { |
679 | case V4L2_CID_AUDIO_MUTE: | 687 | case V4L2_CID_AUDIO_MUTE: |
680 | ctrl->value = dev->mute; | 688 | ctrl->value = dev->mute; |
@@ -682,6 +690,16 @@ static int em28xx_get_ctrl(struct em28xx *dev, struct v4l2_control *ctrl) | |||
682 | case V4L2_CID_AUDIO_VOLUME: | 690 | case V4L2_CID_AUDIO_VOLUME: |
683 | ctrl->value = dev->volume; | 691 | ctrl->value = dev->volume; |
684 | return 0; | 692 | return 0; |
693 | default: | ||
694 | return -EINVAL; | ||
695 | } | ||
696 | } | ||
697 | |||
698 | /*FIXME: should be moved to saa711x */ | ||
699 | static int saa711x_get_ctrl(struct em28xx *dev, struct v4l2_control *ctrl) | ||
700 | { | ||
701 | s32 tmp; | ||
702 | switch (ctrl->id) { | ||
685 | case V4L2_CID_BRIGHTNESS: | 703 | case V4L2_CID_BRIGHTNESS: |
686 | if ((tmp = em28xx_brightness_get(dev)) < 0) | 704 | if ((tmp = em28xx_brightness_get(dev)) < 0) |
687 | return -EIO; | 705 | return -EIO; |
@@ -731,6 +749,15 @@ static int em28xx_set_ctrl(struct em28xx *dev, const struct v4l2_control *ctrl) | |||
731 | case V4L2_CID_AUDIO_VOLUME: | 749 | case V4L2_CID_AUDIO_VOLUME: |
732 | dev->volume = ctrl->value; | 750 | dev->volume = ctrl->value; |
733 | return em28xx_audio_analog_set(dev); | 751 | return em28xx_audio_analog_set(dev); |
752 | default: | ||
753 | return -EINVAL; | ||
754 | } | ||
755 | } | ||
756 | |||
757 | /*FIXME: should be moved to saa711x */ | ||
758 | static int saa711x_set_ctrl(struct em28xx *dev, const struct v4l2_control *ctrl) | ||
759 | { | ||
760 | switch (ctrl->id) { | ||
734 | case V4L2_CID_BRIGHTNESS: | 761 | case V4L2_CID_BRIGHTNESS: |
735 | return em28xx_brightness_set(dev, ctrl->value); | 762 | return em28xx_brightness_set(dev, ctrl->value); |
736 | case V4L2_CID_CONTRAST: | 763 | case V4L2_CID_CONTRAST: |
@@ -994,14 +1021,34 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, | |||
994 | case VIDIOC_QUERYCTRL: | 1021 | case VIDIOC_QUERYCTRL: |
995 | { | 1022 | { |
996 | struct v4l2_queryctrl *qc = arg; | 1023 | struct v4l2_queryctrl *qc = arg; |
997 | u8 i, n; | 1024 | int i, id=qc->id; |
998 | n = sizeof(em28xx_qctrl) / sizeof(em28xx_qctrl[0]); | 1025 | |
999 | for (i = 0; i < n; i++) | 1026 | memset(qc,0,sizeof(*qc)); |
1000 | if (qc->id && qc->id == em28xx_qctrl[i].id) { | 1027 | qc->id=id; |
1001 | memcpy(qc, &(em28xx_qctrl[i]), | 1028 | |
1029 | if (!dev->has_msp34xx) { | ||
1030 | for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) { | ||
1031 | if (qc->id && qc->id == em28xx_qctrl[i].id) { | ||
1032 | memcpy(qc, &(em28xx_qctrl[i]), | ||
1033 | sizeof(*qc)); | ||
1034 | return 0; | ||
1035 | } | ||
1036 | } | ||
1037 | } | ||
1038 | if (dev->decoder == EM28XX_TVP5150) { | ||
1039 | em28xx_i2c_call_clients(dev,cmd,qc); | ||
1040 | if (qc->type) | ||
1041 | return 0; | ||
1042 | else | ||
1043 | return -EINVAL; | ||
1044 | } | ||
1045 | for (i = 0; i < ARRAY_SIZE(saa711x_qctrl); i++) { | ||
1046 | if (qc->id && qc->id == saa711x_qctrl[i].id) { | ||
1047 | memcpy(qc, &(saa711x_qctrl[i]), | ||
1002 | sizeof(*qc)); | 1048 | sizeof(*qc)); |
1003 | return 0; | 1049 | return 0; |
1004 | } | 1050 | } |
1051 | } | ||
1005 | 1052 | ||
1006 | return -EINVAL; | 1053 | return -EINVAL; |
1007 | } | 1054 | } |
@@ -1009,29 +1056,64 @@ static int em28xx_do_ioctl(struct inode *inode, struct file *filp, | |||
1009 | case VIDIOC_G_CTRL: | 1056 | case VIDIOC_G_CTRL: |
1010 | { | 1057 | { |
1011 | struct v4l2_control *ctrl = arg; | 1058 | struct v4l2_control *ctrl = arg; |
1059 | int retval=-EINVAL; | ||
1012 | 1060 | ||
1061 | if (!dev->has_msp34xx) | ||
1062 | retval=em28xx_get_ctrl(dev, ctrl); | ||
1063 | if (retval==-EINVAL) { | ||
1064 | if (dev->decoder == EM28XX_TVP5150) { | ||
1065 | em28xx_i2c_call_clients(dev,cmd,arg); | ||
1066 | return 0; | ||
1067 | } | ||
1013 | 1068 | ||
1014 | return em28xx_get_ctrl(dev, ctrl); | 1069 | return saa711x_get_ctrl(dev, ctrl); |
1070 | } else return retval; | ||
1015 | } | 1071 | } |
1016 | 1072 | ||
1017 | case VIDIOC_S_CTRL_OLD: /* ??? */ | ||
1018 | case VIDIOC_S_CTRL: | 1073 | case VIDIOC_S_CTRL: |
1019 | { | 1074 | { |
1020 | struct v4l2_control *ctrl = arg; | 1075 | struct v4l2_control *ctrl = arg; |
1021 | u8 i, n; | 1076 | u8 i; |
1022 | 1077 | ||
1023 | 1078 | if (!dev->has_msp34xx){ | |
1024 | n = sizeof(em28xx_qctrl) / sizeof(em28xx_qctrl[0]); | 1079 | for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) { |
1025 | for (i = 0; i < n; i++) | 1080 | if (ctrl->id == em28xx_qctrl[i].id) { |
1026 | if (ctrl->id == em28xx_qctrl[i].id) { | 1081 | if (ctrl->value < |
1027 | if (ctrl->value < | 1082 | em28xx_qctrl[i].minimum |
1028 | em28xx_qctrl[i].minimum | 1083 | || ctrl->value > |
1029 | || ctrl->value > | 1084 | em28xx_qctrl[i].maximum) |
1030 | em28xx_qctrl[i].maximum) | 1085 | return -ERANGE; |
1031 | return -ERANGE; | 1086 | return em28xx_set_ctrl(dev, ctrl); |
1087 | } | ||
1088 | } | ||
1089 | } | ||
1032 | 1090 | ||
1033 | return em28xx_set_ctrl(dev, ctrl); | 1091 | if (dev->decoder == EM28XX_TVP5150) { |
1092 | em28xx_i2c_call_clients(dev,cmd,arg); | ||
1093 | return 0; | ||
1094 | } else if (!dev->has_msp34xx) { | ||
1095 | for (i = 0; i < ARRAY_SIZE(em28xx_qctrl); i++) { | ||
1096 | if (ctrl->id == em28xx_qctrl[i].id) { | ||
1097 | if (ctrl->value < | ||
1098 | em28xx_qctrl[i].minimum | ||
1099 | || ctrl->value > | ||
1100 | em28xx_qctrl[i].maximum) | ||
1101 | return -ERANGE; | ||
1102 | return em28xx_set_ctrl(dev, ctrl); | ||
1103 | } | ||
1034 | } | 1104 | } |
1105 | for (i = 0; i < ARRAY_SIZE(saa711x_qctrl); i++) { | ||
1106 | if (ctrl->id == saa711x_qctrl[i].id) { | ||
1107 | if (ctrl->value < | ||
1108 | saa711x_qctrl[i].minimum | ||
1109 | || ctrl->value > | ||
1110 | saa711x_qctrl[i].maximum) | ||
1111 | return -ERANGE; | ||
1112 | return saa711x_set_ctrl(dev, ctrl); | ||
1113 | } | ||
1114 | } | ||
1115 | } | ||
1116 | |||
1035 | return -EINVAL; | 1117 | return -EINVAL; |
1036 | } | 1118 | } |
1037 | 1119 | ||
@@ -1187,7 +1269,7 @@ static int em28xx_video_do_ioctl(struct inode *inode, struct file *filp, | |||
1187 | return -ENODEV; | 1269 | return -ENODEV; |
1188 | 1270 | ||
1189 | if (video_debug > 1) | 1271 | if (video_debug > 1) |
1190 | em28xx_print_ioctl(dev->name,cmd); | 1272 | v4l_print_ioctl(dev->name,cmd); |
1191 | 1273 | ||
1192 | switch (cmd) { | 1274 | switch (cmd) { |
1193 | 1275 | ||
@@ -1564,6 +1646,8 @@ static struct file_operations em28xx_v4l_fops = { | |||
1564 | .poll = em28xx_v4l2_poll, | 1646 | .poll = em28xx_v4l2_poll, |
1565 | .mmap = em28xx_v4l2_mmap, | 1647 | .mmap = em28xx_v4l2_mmap, |
1566 | .llseek = no_llseek, | 1648 | .llseek = no_llseek, |
1649 | .compat_ioctl = v4l_compat_ioctl32, | ||
1650 | |||
1567 | }; | 1651 | }; |
1568 | 1652 | ||
1569 | /******************************** usb interface *****************************************/ | 1653 | /******************************** usb interface *****************************************/ |
@@ -1848,9 +1932,12 @@ static void em28xx_usb_disconnect(struct usb_interface *interface) | |||
1848 | struct em28xx *dev = usb_get_intfdata(interface); | 1932 | struct em28xx *dev = usb_get_intfdata(interface); |
1849 | usb_set_intfdata(interface, NULL); | 1933 | usb_set_intfdata(interface, NULL); |
1850 | 1934 | ||
1935 | /*FIXME: IR should be disconnected */ | ||
1936 | |||
1851 | if (!dev) | 1937 | if (!dev) |
1852 | return; | 1938 | return; |
1853 | 1939 | ||
1940 | |||
1854 | down_write(&em28xx_disconnect); | 1941 | down_write(&em28xx_disconnect); |
1855 | 1942 | ||
1856 | down(&dev->lock); | 1943 | down(&dev->lock); |
diff --git a/drivers/media/video/em28xx/em28xx.h b/drivers/media/video/em28xx/em28xx.h index 5c7a41ce69f3..33de9d846af5 100644 --- a/drivers/media/video/em28xx/em28xx.h +++ b/drivers/media/video/em28xx/em28xx.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | em28xx-cards.c - driver for Empia EM2800/EM2820/2840 USB video capture devices | 2 | em28xx.h - driver for Empia EM2800/EM2820/2840 USB video capture devices |
3 | 3 | ||
4 | Copyright (C) 2005 Markus Rechberger <mrechberger@gmail.com> | 4 | Copyright (C) 2005 Markus Rechberger <mrechberger@gmail.com> |
5 | Ludovico Cavedon <cavedon@sssup.it> | 5 | Ludovico Cavedon <cavedon@sssup.it> |
@@ -216,6 +216,8 @@ struct em28xx { | |||
216 | unsigned int has_msp34xx:1; | 216 | unsigned int has_msp34xx:1; |
217 | unsigned int has_tda9887:1; | 217 | unsigned int has_tda9887:1; |
218 | 218 | ||
219 | u32 i2s_speed; /* I2S speed for audio digital stream */ | ||
220 | |||
219 | enum em28xx_decoder decoder; | 221 | enum em28xx_decoder decoder; |
220 | 222 | ||
221 | int tuner_type; /* type of the tuner */ | 223 | int tuner_type; /* type of the tuner */ |
@@ -293,8 +295,6 @@ void em28xx_set_ir(struct em28xx * dev,struct IR_i2c *ir); | |||
293 | 295 | ||
294 | /* Provided by em28xx-core.c */ | 296 | /* Provided by em28xx-core.c */ |
295 | 297 | ||
296 | void em28xx_print_ioctl(char *name, unsigned int cmd); | ||
297 | |||
298 | u32 em28xx_request_buffers(struct em28xx *dev, u32 count); | 298 | u32 em28xx_request_buffers(struct em28xx *dev, u32 count); |
299 | void em28xx_queue_unusedframes(struct em28xx *dev); | 299 | void em28xx_queue_unusedframes(struct em28xx *dev); |
300 | void em28xx_release_buffers(struct em28xx *dev); | 300 | void em28xx_release_buffers(struct em28xx *dev); |