diff options
206 files changed, 7253 insertions, 4791 deletions
diff --git a/Documentation/video4linux/CQcam.txt b/Documentation/video4linux/CQcam.txt index e415e3604539..464e4cec94cb 100644 --- a/Documentation/video4linux/CQcam.txt +++ b/Documentation/video4linux/CQcam.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | c-qcam - Connectix Color QuickCam video4linux kernel driver | 1 | c-qcam - Connectix Color QuickCam video4linux kernel driver |
2 | 2 | ||
3 | Copyright (C) 1999 Dave Forrest <drf5n@virginia.edu> | 3 | Copyright (C) 1999 Dave Forrest <drf5n@virginia.edu> |
4 | released under GNU GPL. | 4 | released under GNU GPL. |
5 | 5 | ||
6 | 1999-12-08 Dave Forrest, written with kernel version 2.2.12 in mind | 6 | 1999-12-08 Dave Forrest, written with kernel version 2.2.12 in mind |
7 | 7 | ||
@@ -45,21 +45,21 @@ configuration. The appropriate flags are: | |||
45 | CONFIG_PNP_PARPORT M for autoprobe.o IEEE1284 readback module | 45 | CONFIG_PNP_PARPORT M for autoprobe.o IEEE1284 readback module |
46 | CONFIG_PRINTER_READBACK M for parport_probe.o IEEE1284 readback module | 46 | CONFIG_PRINTER_READBACK M for parport_probe.o IEEE1284 readback module |
47 | CONFIG_VIDEO_DEV M for videodev.o video4linux module | 47 | CONFIG_VIDEO_DEV M for videodev.o video4linux module |
48 | CONFIG_VIDEO_CQCAM M for c-qcam.o Color Quickcam module | 48 | CONFIG_VIDEO_CQCAM M for c-qcam.o Color Quickcam module |
49 | 49 | ||
50 | With these flags, the kernel should compile and install the modules. | 50 | With these flags, the kernel should compile and install the modules. |
51 | To record and monitor the compilation, I use: | 51 | To record and monitor the compilation, I use: |
52 | 52 | ||
53 | (make zlilo ; \ | 53 | (make zlilo ; \ |
54 | make modules; \ | 54 | make modules; \ |
55 | make modules_install ; | 55 | make modules_install ; |
56 | depmod -a ) &>log & | 56 | depmod -a ) &>log & |
57 | less log # then a capital 'F' to watch the progress | 57 | less log # then a capital 'F' to watch the progress |
58 | 58 | ||
59 | But that is my personal preference. | 59 | But that is my personal preference. |
60 | 60 | ||
61 | 2.2 Configuration | 61 | 2.2 Configuration |
62 | 62 | ||
63 | The configuration requires module configuration and device | 63 | The configuration requires module configuration and device |
64 | configuration. I like kmod or kerneld process with the | 64 | configuration. I like kmod or kerneld process with the |
65 | /etc/modprobe.conf file so the modules can automatically load/unload as | 65 | /etc/modprobe.conf file so the modules can automatically load/unload as |
@@ -68,7 +68,7 @@ using MAKEDEV, or need to be created. The following sections detail | |||
68 | these procedures. | 68 | these procedures. |
69 | 69 | ||
70 | 70 | ||
71 | 2.1 Module Configuration | 71 | 2.1 Module Configuration |
72 | 72 | ||
73 | Using modules requires a bit of work to install and pass the | 73 | Using modules requires a bit of work to install and pass the |
74 | parameters. Understand that entries in /etc/modprobe.conf of: | 74 | parameters. Understand that entries in /etc/modprobe.conf of: |
@@ -128,9 +128,9 @@ system (CONFIG_PROC_FS), the parallel printer support | |||
128 | (CONFIG_PRINTER), the IEEE 1284 system,(CONFIG_PRINTER_READBACK), you | 128 | (CONFIG_PRINTER), the IEEE 1284 system,(CONFIG_PRINTER_READBACK), you |
129 | should be able to read some identification from your quickcam with | 129 | should be able to read some identification from your quickcam with |
130 | 130 | ||
131 | modprobe -v parport | 131 | modprobe -v parport |
132 | modprobe -v parport_probe | 132 | modprobe -v parport_probe |
133 | cat /proc/parport/PORTNUMBER/autoprobe | 133 | cat /proc/parport/PORTNUMBER/autoprobe |
134 | Returns: | 134 | Returns: |
135 | CLASS:MEDIA; | 135 | CLASS:MEDIA; |
136 | MODEL:Color QuickCam 2.0; | 136 | MODEL:Color QuickCam 2.0; |
@@ -140,7 +140,7 @@ Returns: | |||
140 | and well. A common problem is that the current driver does not | 140 | and well. A common problem is that the current driver does not |
141 | reliably detect a c-qcam, even though one is attached. In this case, | 141 | reliably detect a c-qcam, even though one is attached. In this case, |
142 | 142 | ||
143 | modprobe -v c-qcam | 143 | modprobe -v c-qcam |
144 | or | 144 | or |
145 | insmod -v c-qcam | 145 | insmod -v c-qcam |
146 | 146 | ||
@@ -152,16 +152,16 @@ video4linux mailing list and archive for more current information. | |||
152 | 3.1 Checklist: | 152 | 3.1 Checklist: |
153 | 153 | ||
154 | Can you get an image? | 154 | Can you get an image? |
155 | v4lgrab >qcam.ppm ; wc qcam.ppm ; xv qcam.ppm | 155 | v4lgrab >qcam.ppm ; wc qcam.ppm ; xv qcam.ppm |
156 | 156 | ||
157 | Is a working c-qcam connected to the port? | 157 | Is a working c-qcam connected to the port? |
158 | grep ^ /proc/parport/?/autoprobe | 158 | grep ^ /proc/parport/?/autoprobe |
159 | 159 | ||
160 | Do the /dev/video* files exist? | 160 | Do the /dev/video* files exist? |
161 | ls -lad /dev/video | 161 | ls -lad /dev/video |
162 | 162 | ||
163 | Is the c-qcam module loaded? | 163 | Is the c-qcam module loaded? |
164 | modprobe -v c-qcam ; lsmod | 164 | modprobe -v c-qcam ; lsmod |
165 | 165 | ||
166 | Does the camera work with alternate programs? cqcam, etc? | 166 | Does the camera work with alternate programs? cqcam, etc? |
167 | 167 | ||
@@ -174,7 +174,7 @@ video4linux mailing list and archive for more current information. | |||
174 | isn't, you might try patching the c-qcam module to add a parport=xxx | 174 | isn't, you might try patching the c-qcam module to add a parport=xxx |
175 | option as in the bw-qcam module so you can specify the parallel port: | 175 | option as in the bw-qcam module so you can specify the parallel port: |
176 | 176 | ||
177 | insmod -v c-qcam parport=0 | 177 | insmod -v c-qcam parport=0 |
178 | 178 | ||
179 | And bypass the detection code, see ../../drivers/char/c-qcam.c and | 179 | And bypass the detection code, see ../../drivers/char/c-qcam.c and |
180 | look for the 'qc_detect' code and call. | 180 | look for the 'qc_detect' code and call. |
@@ -183,12 +183,12 @@ look for the 'qc_detect' code and call. | |||
183 | this work is documented at the video4linux2 site listed below. | 183 | this work is documented at the video4linux2 site listed below. |
184 | 184 | ||
185 | 185 | ||
186 | 9.0 --- A sample program using v4lgrabber, | 186 | 9.0 --- A sample program using v4lgrabber, |
187 | 187 | ||
188 | This program is a simple image grabber that will copy a frame from the | 188 | This program is a simple image grabber that will copy a frame from the |
189 | first video device, /dev/video0 to standard output in portable pixmap | 189 | first video device, /dev/video0 to standard output in portable pixmap |
190 | format (.ppm) Using this like: 'v4lgrab | convert - c-qcam.jpg' | 190 | format (.ppm) Using this like: 'v4lgrab | convert - c-qcam.jpg' |
191 | produced this picture of me at | 191 | produced this picture of me at |
192 | http://mug.sys.virginia.edu/~drf5n/extras/c-qcam.jpg | 192 | http://mug.sys.virginia.edu/~drf5n/extras/c-qcam.jpg |
193 | 193 | ||
194 | -------------------- 8< ---------------- 8< ----------------------------- | 194 | -------------------- 8< ---------------- 8< ----------------------------- |
@@ -202,8 +202,8 @@ produced this picture of me at | |||
202 | * Use as: | 202 | * Use as: |
203 | * v4lgrab >image.ppm | 203 | * v4lgrab >image.ppm |
204 | * | 204 | * |
205 | * Copyright (C) 1998-05-03, Phil Blundell <philb@gnu.org> | 205 | * Copyright (C) 1998-05-03, Phil Blundell <philb@gnu.org> |
206 | * Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c | 206 | * Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c |
207 | * with minor modifications (Dave Forrest, drf5n@virginia.edu). | 207 | * with minor modifications (Dave Forrest, drf5n@virginia.edu). |
208 | * | 208 | * |
209 | */ | 209 | */ |
@@ -225,55 +225,55 @@ produced this picture of me at | |||
225 | 225 | ||
226 | #define READ_VIDEO_PIXEL(buf, format, depth, r, g, b) \ | 226 | #define READ_VIDEO_PIXEL(buf, format, depth, r, g, b) \ |
227 | { \ | 227 | { \ |
228 | switch (format) \ | 228 | switch (format) \ |
229 | { \ | 229 | { \ |
230 | case VIDEO_PALETTE_GREY: \ | 230 | case VIDEO_PALETTE_GREY: \ |
231 | switch (depth) \ | 231 | switch (depth) \ |
232 | { \ | 232 | { \ |
233 | case 4: \ | 233 | case 4: \ |
234 | case 6: \ | 234 | case 6: \ |
235 | case 8: \ | 235 | case 8: \ |
236 | (r) = (g) = (b) = (*buf++ << 8);\ | 236 | (r) = (g) = (b) = (*buf++ << 8);\ |
237 | break; \ | 237 | break; \ |
238 | \ | 238 | \ |
239 | case 16: \ | 239 | case 16: \ |
240 | (r) = (g) = (b) = \ | 240 | (r) = (g) = (b) = \ |
241 | *((unsigned short *) buf); \ | 241 | *((unsigned short *) buf); \ |
242 | buf += 2; \ | 242 | buf += 2; \ |
243 | break; \ | 243 | break; \ |
244 | } \ | 244 | } \ |
245 | break; \ | 245 | break; \ |
246 | \ | 246 | \ |
247 | \ | 247 | \ |
248 | case VIDEO_PALETTE_RGB565: \ | 248 | case VIDEO_PALETTE_RGB565: \ |
249 | { \ | 249 | { \ |
250 | unsigned short tmp = *(unsigned short *)buf; \ | 250 | unsigned short tmp = *(unsigned short *)buf; \ |
251 | (r) = tmp&0xF800; \ | 251 | (r) = tmp&0xF800; \ |
252 | (g) = (tmp<<5)&0xFC00; \ | 252 | (g) = (tmp<<5)&0xFC00; \ |
253 | (b) = (tmp<<11)&0xF800; \ | 253 | (b) = (tmp<<11)&0xF800; \ |
254 | buf += 2; \ | 254 | buf += 2; \ |
255 | } \ | 255 | } \ |
256 | break; \ | 256 | break; \ |
257 | \ | 257 | \ |
258 | case VIDEO_PALETTE_RGB555: \ | 258 | case VIDEO_PALETTE_RGB555: \ |
259 | (r) = (buf[0]&0xF8)<<8; \ | 259 | (r) = (buf[0]&0xF8)<<8; \ |
260 | (g) = ((buf[0] << 5 | buf[1] >> 3)&0xF8)<<8; \ | 260 | (g) = ((buf[0] << 5 | buf[1] >> 3)&0xF8)<<8; \ |
261 | (b) = ((buf[1] << 2 ) & 0xF8)<<8; \ | 261 | (b) = ((buf[1] << 2 ) & 0xF8)<<8; \ |
262 | buf += 2; \ | 262 | buf += 2; \ |
263 | break; \ | 263 | break; \ |
264 | \ | 264 | \ |
265 | case VIDEO_PALETTE_RGB24: \ | 265 | case VIDEO_PALETTE_RGB24: \ |
266 | (r) = buf[0] << 8; (g) = buf[1] << 8; \ | 266 | (r) = buf[0] << 8; (g) = buf[1] << 8; \ |
267 | (b) = buf[2] << 8; \ | 267 | (b) = buf[2] << 8; \ |
268 | buf += 3; \ | 268 | buf += 3; \ |
269 | break; \ | 269 | break; \ |
270 | \ | 270 | \ |
271 | default: \ | 271 | default: \ |
272 | fprintf(stderr, \ | 272 | fprintf(stderr, \ |
273 | "Format %d not yet supported\n", \ | 273 | "Format %d not yet supported\n", \ |
274 | format); \ | 274 | format); \ |
275 | } \ | 275 | } \ |
276 | } | 276 | } |
277 | 277 | ||
278 | int get_brightness_adj(unsigned char *image, long size, int *brightness) { | 278 | int get_brightness_adj(unsigned char *image, long size, int *brightness) { |
279 | long i, tot = 0; | 279 | long i, tot = 0; |
@@ -324,40 +324,40 @@ int main(int argc, char ** argv) | |||
324 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { | 324 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { |
325 | vpic.depth=6; | 325 | vpic.depth=6; |
326 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { | 326 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { |
327 | vpic.depth=4; | 327 | vpic.depth=4; |
328 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { | 328 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { |
329 | fprintf(stderr, "Unable to find a supported capture format.\n"); | 329 | fprintf(stderr, "Unable to find a supported capture format.\n"); |
330 | close(fd); | 330 | close(fd); |
331 | exit(1); | 331 | exit(1); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | } | 334 | } |
335 | } else { | 335 | } else { |
336 | vpic.depth=24; | 336 | vpic.depth=24; |
337 | vpic.palette=VIDEO_PALETTE_RGB24; | 337 | vpic.palette=VIDEO_PALETTE_RGB24; |
338 | 338 | ||
339 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { | 339 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { |
340 | vpic.palette=VIDEO_PALETTE_RGB565; | 340 | vpic.palette=VIDEO_PALETTE_RGB565; |
341 | vpic.depth=16; | 341 | vpic.depth=16; |
342 | 342 | ||
343 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { | 343 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { |
344 | vpic.palette=VIDEO_PALETTE_RGB555; | 344 | vpic.palette=VIDEO_PALETTE_RGB555; |
345 | vpic.depth=15; | 345 | vpic.depth=15; |
346 | 346 | ||
347 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { | 347 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { |
348 | fprintf(stderr, "Unable to find a supported capture format.\n"); | 348 | fprintf(stderr, "Unable to find a supported capture format.\n"); |
349 | return -1; | 349 | return -1; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | } | 352 | } |
353 | } | 353 | } |
354 | 354 | ||
355 | buffer = malloc(win.width * win.height * bpp); | 355 | buffer = malloc(win.width * win.height * bpp); |
356 | if (!buffer) { | 356 | if (!buffer) { |
357 | fprintf(stderr, "Out of memory.\n"); | 357 | fprintf(stderr, "Out of memory.\n"); |
358 | exit(1); | 358 | exit(1); |
359 | } | 359 | } |
360 | 360 | ||
361 | do { | 361 | do { |
362 | int newbright; | 362 | int newbright; |
363 | read(fd, buffer, win.width * win.height * bpp); | 363 | read(fd, buffer, win.width * win.height * bpp); |
@@ -365,8 +365,8 @@ int main(int argc, char ** argv) | |||
365 | if (f) { | 365 | if (f) { |
366 | vpic.brightness += (newbright << 8); | 366 | vpic.brightness += (newbright << 8); |
367 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { | 367 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { |
368 | perror("VIDIOSPICT"); | 368 | perror("VIDIOSPICT"); |
369 | break; | 369 | break; |
370 | } | 370 | } |
371 | } | 371 | } |
372 | } while (f); | 372 | } while (f); |
@@ -381,7 +381,7 @@ int main(int argc, char ** argv) | |||
381 | fputc(g>>8, stdout); | 381 | fputc(g>>8, stdout); |
382 | fputc(b>>8, stdout); | 382 | fputc(b>>8, stdout); |
383 | } | 383 | } |
384 | 384 | ||
385 | close(fd); | 385 | close(fd); |
386 | return 0; | 386 | return 0; |
387 | } | 387 | } |
diff --git a/Documentation/video4linux/README.cpia b/Documentation/video4linux/README.cpia index c95e7bbc0fdf..19cd3bf24981 100644 --- a/Documentation/video4linux/README.cpia +++ b/Documentation/video4linux/README.cpia | |||
@@ -87,7 +87,7 @@ hardware configuration of the parport. You can give the boot-parameter | |||
87 | at the LILO-prompt or specify it in lilo.conf. I use the following | 87 | at the LILO-prompt or specify it in lilo.conf. I use the following |
88 | append-line in lilo.conf: | 88 | append-line in lilo.conf: |
89 | 89 | ||
90 | append="parport=0x378,7,3" | 90 | append="parport=0x378,7,3" |
91 | 91 | ||
92 | See Documentation/parport.txt for more information about the | 92 | See Documentation/parport.txt for more information about the |
93 | configuration of the parport and the values given above. Do not simply | 93 | configuration of the parport and the values given above. Do not simply |
@@ -175,7 +175,7 @@ THANKS (in no particular order): | |||
175 | - Manuel J. Petit de Gabriel <mpetit@dit.upm.es> for providing help | 175 | - Manuel J. Petit de Gabriel <mpetit@dit.upm.es> for providing help |
176 | with Isabel (http://isabel.dit.upm.es/) | 176 | with Isabel (http://isabel.dit.upm.es/) |
177 | - Bas Huisman <bhuism@cs.utwente.nl> for writing the initial parport code | 177 | - Bas Huisman <bhuism@cs.utwente.nl> for writing the initial parport code |
178 | - Jarl Totland <Jarl.Totland@bdc.no> for setting up the mailing list | 178 | - Jarl Totland <Jarl.Totland@bdc.no> for setting up the mailing list |
179 | and maintaining the web-server[3] | 179 | and maintaining the web-server[3] |
180 | - Chris Whiteford <Chris@informinteractive.com> for fixes related to the | 180 | - Chris Whiteford <Chris@informinteractive.com> for fixes related to the |
181 | 1.02 firmware | 181 | 1.02 firmware |
diff --git a/Documentation/video4linux/Zoran b/Documentation/video4linux/Zoran index 52c94bd7dca1..be9f21b84555 100644 --- a/Documentation/video4linux/Zoran +++ b/Documentation/video4linux/Zoran | |||
@@ -28,7 +28,7 @@ Iomega Buz: | |||
28 | * Philips saa7111 TV decoder | 28 | * Philips saa7111 TV decoder |
29 | * Philips saa7185 TV encoder | 29 | * Philips saa7185 TV encoder |
30 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 30 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
31 | videocodec, saa7111, saa7185, zr36060, zr36067 | 31 | videocodec, saa7111, saa7185, zr36060, zr36067 |
32 | Inputs/outputs: Composite and S-video | 32 | Inputs/outputs: Composite and S-video |
33 | Norms: PAL, SECAM (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) | 33 | Norms: PAL, SECAM (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) |
34 | Card number: 7 | 34 | Card number: 7 |
@@ -39,7 +39,7 @@ Linux Media Labs LML33: | |||
39 | * Brooktree bt819 TV decoder | 39 | * Brooktree bt819 TV decoder |
40 | * Brooktree bt856 TV encoder | 40 | * Brooktree bt856 TV encoder |
41 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 41 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
42 | videocodec, bt819, bt856, zr36060, zr36067 | 42 | videocodec, bt819, bt856, zr36060, zr36067 |
43 | Inputs/outputs: Composite and S-video | 43 | Inputs/outputs: Composite and S-video |
44 | Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) | 44 | Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) |
45 | Card number: 5 | 45 | Card number: 5 |
@@ -50,7 +50,7 @@ Linux Media Labs LML33R10: | |||
50 | * Philips saa7114 TV decoder | 50 | * Philips saa7114 TV decoder |
51 | * Analog Devices adv7170 TV encoder | 51 | * Analog Devices adv7170 TV encoder |
52 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 52 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
53 | videocodec, saa7114, adv7170, zr36060, zr36067 | 53 | videocodec, saa7114, adv7170, zr36060, zr36067 |
54 | Inputs/outputs: Composite and S-video | 54 | Inputs/outputs: Composite and S-video |
55 | Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) | 55 | Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) |
56 | Card number: 6 | 56 | Card number: 6 |
@@ -61,7 +61,7 @@ Pinnacle/Miro DC10(new): | |||
61 | * Philips saa7110a TV decoder | 61 | * Philips saa7110a TV decoder |
62 | * Analog Devices adv7176 TV encoder | 62 | * Analog Devices adv7176 TV encoder |
63 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 63 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
64 | videocodec, saa7110, adv7175, zr36060, zr36067 | 64 | videocodec, saa7110, adv7175, zr36060, zr36067 |
65 | Inputs/outputs: Composite, S-video and Internal | 65 | Inputs/outputs: Composite, S-video and Internal |
66 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) | 66 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) |
67 | Card number: 1 | 67 | Card number: 1 |
@@ -84,7 +84,7 @@ Pinnacle/Miro DC10(old): * | |||
84 | * Micronas vpx3220a TV decoder | 84 | * Micronas vpx3220a TV decoder |
85 | * mse3000 TV encoder or Analog Devices adv7176 TV encoder * | 85 | * mse3000 TV encoder or Analog Devices adv7176 TV encoder * |
86 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 86 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
87 | videocodec, vpx3220, mse3000/adv7175, zr36050, zr36016, zr36067 | 87 | videocodec, vpx3220, mse3000/adv7175, zr36050, zr36016, zr36067 |
88 | Inputs/outputs: Composite, S-video and Internal | 88 | Inputs/outputs: Composite, S-video and Internal |
89 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) | 89 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) |
90 | Card number: 0 | 90 | Card number: 0 |
@@ -96,7 +96,7 @@ Pinnacle/Miro DC30: * | |||
96 | * Micronas vpx3225d/vpx3220a/vpx3216b TV decoder | 96 | * Micronas vpx3225d/vpx3220a/vpx3216b TV decoder |
97 | * Analog Devices adv7176 TV encoder | 97 | * Analog Devices adv7176 TV encoder |
98 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 98 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
99 | videocodec, vpx3220/vpx3224, adv7175, zr36050, zr36016, zr36067 | 99 | videocodec, vpx3220/vpx3224, adv7175, zr36050, zr36016, zr36067 |
100 | Inputs/outputs: Composite, S-video and Internal | 100 | Inputs/outputs: Composite, S-video and Internal |
101 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) | 101 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) |
102 | Card number: 3 | 102 | Card number: 3 |
@@ -123,11 +123,11 @@ Note: use encoder=X or decoder=X for non-default i2c chips (see i2c-id.h) | |||
123 | 123 | ||
124 | The best know TV standards are NTSC/PAL/SECAM. but for decoding a frame that | 124 | The best know TV standards are NTSC/PAL/SECAM. but for decoding a frame that |
125 | information is not enough. There are several formats of the TV standards. | 125 | information is not enough. There are several formats of the TV standards. |
126 | And not every TV decoder is able to handle every format. Also the every | 126 | And not every TV decoder is able to handle every format. Also the every |
127 | combination is supported by the driver. There are currently 11 different | 127 | combination is supported by the driver. There are currently 11 different |
128 | tv broadcast formats all aver the world. | 128 | tv broadcast formats all aver the world. |
129 | 129 | ||
130 | The CCIR defines parameters needed for broadcasting the signal. | 130 | The CCIR defines parameters needed for broadcasting the signal. |
131 | The CCIR has defined different standards: A,B,D,E,F,G,D,H,I,K,K1,L,M,N,... | 131 | The CCIR has defined different standards: A,B,D,E,F,G,D,H,I,K,K1,L,M,N,... |
132 | The CCIR says not much about about the colorsystem used !!! | 132 | The CCIR says not much about about the colorsystem used !!! |
133 | And talking about a colorsystem says not to much about how it is broadcast. | 133 | And talking about a colorsystem says not to much about how it is broadcast. |
@@ -136,18 +136,18 @@ The CCIR standards A,E,F are not used any more. | |||
136 | 136 | ||
137 | When you speak about NTSC, you usually mean the standard: CCIR - M using | 137 | When you speak about NTSC, you usually mean the standard: CCIR - M using |
138 | the NTSC colorsystem which is used in the USA, Japan, Mexico, Canada | 138 | the NTSC colorsystem which is used in the USA, Japan, Mexico, Canada |
139 | and a few others. | 139 | and a few others. |
140 | 140 | ||
141 | When you talk about PAL, you usually mean: CCIR - B/G using the PAL | 141 | When you talk about PAL, you usually mean: CCIR - B/G using the PAL |
142 | colorsystem which is used in many Countries. | 142 | colorsystem which is used in many Countries. |
143 | 143 | ||
144 | When you talk about SECAM, you mean: CCIR - L using the SECAM Colorsystem | 144 | When you talk about SECAM, you mean: CCIR - L using the SECAM Colorsystem |
145 | which is used in France, and a few others. | 145 | which is used in France, and a few others. |
146 | 146 | ||
147 | There the other version of SECAM, CCIR - D/K is used in Bulgaria, China, | 147 | There the other version of SECAM, CCIR - D/K is used in Bulgaria, China, |
148 | Slovakai, Hungary, Korea (Rep.), Poland, Rumania and a others. | 148 | Slovakai, Hungary, Korea (Rep.), Poland, Rumania and a others. |
149 | 149 | ||
150 | The CCIR - H uses the PAL colorsystem (sometimes SECAM) and is used in | 150 | The CCIR - H uses the PAL colorsystem (sometimes SECAM) and is used in |
151 | Egypt, Libya, Sri Lanka, Syrain Arab. Rep. | 151 | Egypt, Libya, Sri Lanka, Syrain Arab. Rep. |
152 | 152 | ||
153 | The CCIR - I uses the PAL colorsystem, and is used in Great Britain, Hong Kong, | 153 | The CCIR - I uses the PAL colorsystem, and is used in Great Britain, Hong Kong, |
@@ -158,30 +158,30 @@ and is used in Argentinia, Uruguay, an a few others | |||
158 | 158 | ||
159 | We do not talk about how the audio is broadcast ! | 159 | We do not talk about how the audio is broadcast ! |
160 | 160 | ||
161 | A rather good sites about the TV standards are: | 161 | A rather good sites about the TV standards are: |
162 | http://www.sony.jp/ServiceArea/Voltage_map/ | 162 | http://www.sony.jp/ServiceArea/Voltage_map/ |
163 | http://info.electronicwerkstatt.de/bereiche/fernsehtechnik/frequenzen_und_normen/Fernsehnormen/ | 163 | http://info.electronicwerkstatt.de/bereiche/fernsehtechnik/frequenzen_und_normen/Fernsehnormen/ |
164 | and http://www.cabl.com/restaurant/channel.html | 164 | and http://www.cabl.com/restaurant/channel.html |
165 | 165 | ||
166 | Other weird things around: NTSC 4.43 is a modificated NTSC, which is mainly | 166 | Other weird things around: NTSC 4.43 is a modificated NTSC, which is mainly |
167 | used in PAL VCR's that are able to play back NTSC. PAL 60 seems to be the same | 167 | used in PAL VCR's that are able to play back NTSC. PAL 60 seems to be the same |
168 | as NTSC 4.43 . The Datasheets also talk about NTSC 44, It seems as if it would | 168 | as NTSC 4.43 . The Datasheets also talk about NTSC 44, It seems as if it would |
169 | be the same as NTSC 4.43. | 169 | be the same as NTSC 4.43. |
170 | NTSC Combs seems to be a decoder mode where the decoder uses a comb filter | 170 | NTSC Combs seems to be a decoder mode where the decoder uses a comb filter |
171 | to split coma and luma instead of a Delay line. | 171 | to split coma and luma instead of a Delay line. |
172 | 172 | ||
173 | But I did not defiantly find out what NTSC Comb is. | 173 | But I did not defiantly find out what NTSC Comb is. |
174 | 174 | ||
175 | Philips saa7111 TV decoder | 175 | Philips saa7111 TV decoder |
176 | was introduced in 1997, is used in the BUZ and | 176 | was introduced in 1997, is used in the BUZ and |
177 | can handle: PAL B/G/H/I, PAL N, PAL M, NTSC M, NTSC N, NTSC 4.43 and SECAM | 177 | can handle: PAL B/G/H/I, PAL N, PAL M, NTSC M, NTSC N, NTSC 4.43 and SECAM |
178 | 178 | ||
179 | Philips saa7110a TV decoder | 179 | Philips saa7110a TV decoder |
180 | was introduced in 1995, is used in the Pinnacle/Miro DC10(new), DC10+ and | 180 | was introduced in 1995, is used in the Pinnacle/Miro DC10(new), DC10+ and |
181 | can handle: PAL B/G, NTSC M and SECAM | 181 | can handle: PAL B/G, NTSC M and SECAM |
182 | 182 | ||
183 | Philips saa7114 TV decoder | 183 | Philips saa7114 TV decoder |
184 | was introduced in 2000, is used in the LML33R10 and | 184 | was introduced in 2000, is used in the LML33R10 and |
185 | can handle: PAL B/G/D/H/I/N, PAL N, PAL M, NTSC M, NTSC 4.43 and SECAM | 185 | can handle: PAL B/G/D/H/I/N, PAL N, PAL M, NTSC M, NTSC 4.43 and SECAM |
186 | 186 | ||
187 | Brooktree bt819 TV decoder | 187 | Brooktree bt819 TV decoder |
@@ -206,7 +206,7 @@ was introduced in 1996, is used in the BUZ | |||
206 | can generate: PAL B/G, NTSC M | 206 | can generate: PAL B/G, NTSC M |
207 | 207 | ||
208 | Brooktree bt856 TV Encoder | 208 | Brooktree bt856 TV Encoder |
209 | was introduced in 1994, is used in the LML33 | 209 | was introduced in 1994, is used in the LML33 |
210 | can generate: PAL B/D/G/H/I/N, PAL M, NTSC M, PAL-N (Argentina) | 210 | can generate: PAL B/D/G/H/I/N, PAL M, NTSC M, PAL-N (Argentina) |
211 | 211 | ||
212 | Analog Devices adv7170 TV Encoder | 212 | Analog Devices adv7170 TV Encoder |
@@ -221,9 +221,9 @@ ITT mse3000 TV encoder | |||
221 | was introduced in 1991, is used in the DC10 old | 221 | was introduced in 1991, is used in the DC10 old |
222 | can generate: PAL , NTSC , SECAM | 222 | can generate: PAL , NTSC , SECAM |
223 | 223 | ||
224 | The adv717x, should be able to produce PAL N. But you find nothing PAL N | 224 | The adv717x, should be able to produce PAL N. But you find nothing PAL N |
225 | specific in the registers. Seem that you have to reuse a other standard | 225 | specific in the registers. Seem that you have to reuse a other standard |
226 | to generate PAL N, maybe it would work if you use the PAL M settings. | 226 | to generate PAL N, maybe it would work if you use the PAL M settings. |
227 | 227 | ||
228 | ========================== | 228 | ========================== |
229 | 229 | ||
@@ -261,7 +261,7 @@ Here's my experience of using LML33 and Buz on various motherboards: | |||
261 | 261 | ||
262 | VIA MVP3 | 262 | VIA MVP3 |
263 | Forget it. Pointless. Doesn't work. | 263 | Forget it. Pointless. Doesn't work. |
264 | Intel 430FX (Pentium 200) | 264 | Intel 430FX (Pentium 200) |
265 | LML33 perfect, Buz tolerable (3 or 4 frames dropped per movie) | 265 | LML33 perfect, Buz tolerable (3 or 4 frames dropped per movie) |
266 | Intel 440BX (early stepping) | 266 | Intel 440BX (early stepping) |
267 | LML33 tolerable. Buz starting to get annoying (6-10 frames/hour) | 267 | LML33 tolerable. Buz starting to get annoying (6-10 frames/hour) |
@@ -438,52 +438,52 @@ importance of buffer sizes: | |||
438 | > -q 25 -b 128 : 24.655.992 | 438 | > -q 25 -b 128 : 24.655.992 |
439 | > -q 25 -b 256 : 25.859.820 | 439 | > -q 25 -b 256 : 25.859.820 |
440 | 440 | ||
441 | I woke up, and can't go to sleep again. I'll kill some time explaining why | 441 | I woke up, and can't go to sleep again. I'll kill some time explaining why |
442 | this doesn't look strange to me. | 442 | this doesn't look strange to me. |
443 | 443 | ||
444 | Let's do some math using a width of 704 pixels. I'm not sure whether the Buz | 444 | Let's do some math using a width of 704 pixels. I'm not sure whether the Buz |
445 | actually use that number or not, but that's not too important right now. | 445 | actually use that number or not, but that's not too important right now. |
446 | 446 | ||
447 | 704x288 pixels, one field, is 202752 pixels. Divided by 64 pixels per block; | 447 | 704x288 pixels, one field, is 202752 pixels. Divided by 64 pixels per block; |
448 | 3168 blocks per field. Each pixel consist of two bytes; 128 bytes per block; | 448 | 3168 blocks per field. Each pixel consist of two bytes; 128 bytes per block; |
449 | 1024 bits per block. 100% in the new driver mean 1:2 compression; the maximum | 449 | 1024 bits per block. 100% in the new driver mean 1:2 compression; the maximum |
450 | output becomes 512 bits per block. Actually 510, but 512 is simpler to use | 450 | output becomes 512 bits per block. Actually 510, but 512 is simpler to use |
451 | for calculations. | 451 | for calculations. |
452 | 452 | ||
453 | Let's say that we specify d1q50. We thus want 256 bits per block; times 3168 | 453 | Let's say that we specify d1q50. We thus want 256 bits per block; times 3168 |
454 | becomes 811008 bits; 101376 bytes per field. We're talking raw bits and bytes | 454 | becomes 811008 bits; 101376 bytes per field. We're talking raw bits and bytes |
455 | here, so we don't need to do any fancy corrections for bits-per-pixel or such | 455 | here, so we don't need to do any fancy corrections for bits-per-pixel or such |
456 | things. 101376 bytes per field. | 456 | things. 101376 bytes per field. |
457 | 457 | ||
458 | d1 video contains two fields per frame. Those sum up to 202752 bytes per | 458 | d1 video contains two fields per frame. Those sum up to 202752 bytes per |
459 | frame, and one of those frames goes into each buffer. | 459 | frame, and one of those frames goes into each buffer. |
460 | 460 | ||
461 | But wait a second! -b128 gives 128kB buffers! It's not possible to cram | 461 | But wait a second! -b128 gives 128kB buffers! It's not possible to cram |
462 | 202752 bytes of JPEG data into 128kB! | 462 | 202752 bytes of JPEG data into 128kB! |
463 | 463 | ||
464 | This is what the driver notice and automatically compensate for in your | 464 | This is what the driver notice and automatically compensate for in your |
465 | examples. Let's do some math using this information: | 465 | examples. Let's do some math using this information: |
466 | 466 | ||
467 | 128kB is 131072 bytes. In this buffer, we want to store two fields, which | 467 | 128kB is 131072 bytes. In this buffer, we want to store two fields, which |
468 | leaves 65536 bytes for each field. Using 3168 blocks per field, we get | 468 | leaves 65536 bytes for each field. Using 3168 blocks per field, we get |
469 | 20.68686868... available bytes per block; 165 bits. We can't allow the | 469 | 20.68686868... available bytes per block; 165 bits. We can't allow the |
470 | request for 256 bits per block when there's only 165 bits available! The -q50 | 470 | request for 256 bits per block when there's only 165 bits available! The -q50 |
471 | option is silently overridden, and the -b128 option takes precedence, leaving | 471 | option is silently overridden, and the -b128 option takes precedence, leaving |
472 | us with the equivalence of -q32. | 472 | us with the equivalence of -q32. |
473 | 473 | ||
474 | This gives us a data rate of 165 bits per block, which, times 3168, sums up | 474 | This gives us a data rate of 165 bits per block, which, times 3168, sums up |
475 | to 65340 bytes per field, out of the allowed 65536. The current driver has | 475 | to 65340 bytes per field, out of the allowed 65536. The current driver has |
476 | another level of rate limiting; it won't accept -q values that fill more than | 476 | another level of rate limiting; it won't accept -q values that fill more than |
477 | 6/8 of the specified buffers. (I'm not sure why. "Playing it safe" seem to be | 477 | 6/8 of the specified buffers. (I'm not sure why. "Playing it safe" seem to be |
478 | a safe bet. Personally, I think I would have lowered requested-bits-per-block | 478 | a safe bet. Personally, I think I would have lowered requested-bits-per-block |
479 | by one, or something like that.) We can't use 165 bits per block, but have to | 479 | by one, or something like that.) We can't use 165 bits per block, but have to |
480 | lower it again, to 6/8 of the available buffer space: We end up with 124 bits | 480 | lower it again, to 6/8 of the available buffer space: We end up with 124 bits |
481 | per block, the equivalence of -q24. With 128kB buffers, you can't use greater | 481 | per block, the equivalence of -q24. With 128kB buffers, you can't use greater |
482 | than -q24 at -d1. (And PAL, and 704 pixels width...) | 482 | than -q24 at -d1. (And PAL, and 704 pixels width...) |
483 | 483 | ||
484 | The third example is limited to -q24 through the same process. The second | 484 | The third example is limited to -q24 through the same process. The second |
485 | example, using very similar calculations, is limited to -q48. The only | 485 | example, using very similar calculations, is limited to -q48. The only |
486 | example that actually grab at the specified -q value is the last one, which | 486 | example that actually grab at the specified -q value is the last one, which |
487 | is clearly visible, looking at the file size. | 487 | is clearly visible, looking at the file size. |
488 | -- | 488 | -- |
489 | 489 | ||
diff --git a/Documentation/video4linux/bttv/ICs b/Documentation/video4linux/bttv/ICs index 6b7491336967..611315f87c3e 100644 --- a/Documentation/video4linux/bttv/ICs +++ b/Documentation/video4linux/bttv/ICs | |||
@@ -14,13 +14,13 @@ Hauppauge Win/TV pci (version 405): | |||
14 | 14 | ||
15 | Microchip 24LC02B or | 15 | Microchip 24LC02B or |
16 | Philips 8582E2Y: 256 Byte EEPROM with configuration information | 16 | Philips 8582E2Y: 256 Byte EEPROM with configuration information |
17 | I2C 0xa0-0xa1, (24LC02B also responds to 0xa2-0xaf) | 17 | I2C 0xa0-0xa1, (24LC02B also responds to 0xa2-0xaf) |
18 | Philips SAA5246AGP/E: Videotext decoder chip, I2C 0x22-0x23 | 18 | Philips SAA5246AGP/E: Videotext decoder chip, I2C 0x22-0x23 |
19 | TDA9800: sound decoder | 19 | TDA9800: sound decoder |
20 | Winbond W24257AS-35: 32Kx8 CMOS static RAM (Videotext buffer mem) | 20 | Winbond W24257AS-35: 32Kx8 CMOS static RAM (Videotext buffer mem) |
21 | 14052B: analog switch for selection of sound source | 21 | 14052B: analog switch for selection of sound source |
22 | 22 | ||
23 | PAL: | 23 | PAL: |
24 | TDA5737: VHF, hyperband and UHF mixer/oscillator for TV and VCR 3-band tuners | 24 | TDA5737: VHF, hyperband and UHF mixer/oscillator for TV and VCR 3-band tuners |
25 | TSA5522: 1.4 GHz I2C-bus controlled synthesizer, I2C 0xc2-0xc3 | 25 | TSA5522: 1.4 GHz I2C-bus controlled synthesizer, I2C 0xc2-0xc3 |
26 | 26 | ||
diff --git a/Documentation/video4linux/bttv/PROBLEMS b/Documentation/video4linux/bttv/PROBLEMS index 8e31e9e36bf7..2b8b0079f7c7 100644 --- a/Documentation/video4linux/bttv/PROBLEMS +++ b/Documentation/video4linux/bttv/PROBLEMS | |||
@@ -3,7 +3,7 @@ | |||
3 | - Start capturing by pressing "c" or by selecting it via a menu!!! | 3 | - Start capturing by pressing "c" or by selecting it via a menu!!! |
4 | 4 | ||
5 | - The memory of some S3 cards is not recognized right: | 5 | - The memory of some S3 cards is not recognized right: |
6 | 6 | ||
7 | First of all, if you are not using XFree-3.2 or newer, upgrade AT LEAST to | 7 | First of all, if you are not using XFree-3.2 or newer, upgrade AT LEAST to |
8 | XFree-3.2A! This solved the problem for most people. | 8 | XFree-3.2A! This solved the problem for most people. |
9 | 9 | ||
@@ -31,23 +31,23 @@ | |||
31 | (mostly with Trio 64 but also with some others) | 31 | (mostly with Trio 64 but also with some others) |
32 | Get the free demo version of Accelerated X from www.xinside.com and try | 32 | Get the free demo version of Accelerated X from www.xinside.com and try |
33 | bttv with it. bttv seems to work with most S3 cards with Accelerated X. | 33 | bttv with it. bttv seems to work with most S3 cards with Accelerated X. |
34 | 34 | ||
35 | Since I do not know much (better make that almost nothing) about VGA card | 35 | Since I do not know much (better make that almost nothing) about VGA card |
36 | programming I do not know the reason for this. | 36 | programming I do not know the reason for this. |
37 | Looks like XFree does something different when setting up the video memory? | 37 | Looks like XFree does something different when setting up the video memory? |
38 | Maybe somebody can enlighten me? | 38 | Maybe somebody can enlighten me? |
39 | Would be nice if somebody could get this to work with XFree since | 39 | Would be nice if somebody could get this to work with XFree since |
40 | Accelerated X costs more than some of the grabber cards ... | 40 | Accelerated X costs more than some of the grabber cards ... |
41 | 41 | ||
42 | Better linear frame buffer support for S3 cards will probably be in | 42 | Better linear frame buffer support for S3 cards will probably be in |
43 | XFree 4.0. | 43 | XFree 4.0. |
44 | 44 | ||
45 | - Grabbing is not switched off when changing consoles with XFree. | 45 | - Grabbing is not switched off when changing consoles with XFree. |
46 | That's because XFree and some AcceleratedX versions do not send unmap | 46 | That's because XFree and some AcceleratedX versions do not send unmap |
47 | events. | 47 | events. |
48 | 48 | ||
49 | - Some popup windows (e.g. of the window manager) are not refreshed. | 49 | - Some popup windows (e.g. of the window manager) are not refreshed. |
50 | 50 | ||
51 | Disable backing store by starting X with the option "-bs" | 51 | Disable backing store by starting X with the option "-bs" |
52 | 52 | ||
53 | - When using 32 bpp in XFree or 24+8bpp mode in AccelX 3.1 the system | 53 | - When using 32 bpp in XFree or 24+8bpp mode in AccelX 3.1 the system |
diff --git a/Documentation/video4linux/bttv/README.quirks b/Documentation/video4linux/bttv/README.quirks index e8edb87df711..92e03929a6b2 100644 --- a/Documentation/video4linux/bttv/README.quirks +++ b/Documentation/video4linux/bttv/README.quirks | |||
@@ -38,9 +38,9 @@ tolerate. | |||
38 | ------------------------ | 38 | ------------------------ |
39 | 39 | ||
40 | When using the 430FX PCI, the following rules will ensure | 40 | When using the 430FX PCI, the following rules will ensure |
41 | compatibility: | 41 | compatibility: |
42 | 42 | ||
43 | (1) Deassert REQ at the same time as asserting FRAME. | 43 | (1) Deassert REQ at the same time as asserting FRAME. |
44 | (2) Do not reassert REQ to request another bus transaction until after | 44 | (2) Do not reassert REQ to request another bus transaction until after |
45 | finish-ing the previous transaction. | 45 | finish-ing the previous transaction. |
46 | 46 | ||
diff --git a/Documentation/video4linux/bttv/THANKS b/Documentation/video4linux/bttv/THANKS index 2085399da7d4..950aa781c2e9 100644 --- a/Documentation/video4linux/bttv/THANKS +++ b/Documentation/video4linux/bttv/THANKS | |||
@@ -1,6 +1,6 @@ | |||
1 | Many thanks to: | 1 | Many thanks to: |
2 | 2 | ||
3 | - Markus Schroeder <schroedm@uni-duesseldorf.de> for information on the Bt848 | 3 | - Markus Schroeder <schroedm@uni-duesseldorf.de> for information on the Bt848 |
4 | and tuner programming and his control program xtvc. | 4 | and tuner programming and his control program xtvc. |
5 | 5 | ||
6 | - Martin Buck <martin-2.buck@student.uni-ulm.de> for his great Videotext | 6 | - Martin Buck <martin-2.buck@student.uni-ulm.de> for his great Videotext |
@@ -16,7 +16,7 @@ Many thanks to: | |||
16 | - MIRO for providing a free PCTV card and detailed information about the | 16 | - MIRO for providing a free PCTV card and detailed information about the |
17 | components on their cards. (E.g. how the tuner type is detected) | 17 | components on their cards. (E.g. how the tuner type is detected) |
18 | Without their card I could not have debugged the NTSC mode. | 18 | Without their card I could not have debugged the NTSC mode. |
19 | 19 | ||
20 | - Hauppauge for telling how the sound input is selected and what components | 20 | - Hauppauge for telling how the sound input is selected and what components |
21 | they do and will use on their radio cards. | 21 | they do and will use on their radio cards. |
22 | Also many thanks for faxing me the FM1216 data sheet. | 22 | Also many thanks for faxing me the FM1216 data sheet. |
diff --git a/Documentation/video4linux/radiotrack.txt b/Documentation/video4linux/radiotrack.txt index 2b75345f13e3..d1f3ed199186 100644 --- a/Documentation/video4linux/radiotrack.txt +++ b/Documentation/video4linux/radiotrack.txt | |||
@@ -131,17 +131,17 @@ Check Stereo: BASE <-- 0xd8 (current volume, stereo detect, | |||
131 | x=0xff ==> "not stereo", x=0xfd ==> "stereo detected" | 131 | x=0xff ==> "not stereo", x=0xfd ==> "stereo detected" |
132 | 132 | ||
133 | Set Frequency: code = (freq*40) + 10486188 | 133 | Set Frequency: code = (freq*40) + 10486188 |
134 | foreach of the 24 bits in code, | 134 | foreach of the 24 bits in code, |
135 | (from Least to Most Significant): | 135 | (from Least to Most Significant): |
136 | to write a "zero" bit, | 136 | to write a "zero" bit, |
137 | BASE <-- 0x01 (audio mute, no stereo detect, radio | 137 | BASE <-- 0x01 (audio mute, no stereo detect, radio |
138 | disable, "zero" bit phase 1, tuner adjust) | 138 | disable, "zero" bit phase 1, tuner adjust) |
139 | BASE <-- 0x03 (audio mute, no stereo detect, radio | 139 | BASE <-- 0x03 (audio mute, no stereo detect, radio |
140 | disable, "zero" bit phase 2, tuner adjust) | 140 | disable, "zero" bit phase 2, tuner adjust) |
141 | to write a "one" bit, | 141 | to write a "one" bit, |
142 | BASE <-- 0x05 (audio mute, no stereo detect, radio | 142 | BASE <-- 0x05 (audio mute, no stereo detect, radio |
143 | disable, "one" bit phase 1, tuner adjust) | 143 | disable, "one" bit phase 1, tuner adjust) |
144 | BASE <-- 0x07 (audio mute, no stereo detect, radio | 144 | BASE <-- 0x07 (audio mute, no stereo detect, radio |
145 | disable, "one" bit phase 2, tuner adjust) | 145 | disable, "one" bit phase 2, tuner adjust) |
146 | 146 | ||
147 | ---------------------------------------------------------------------------- | 147 | ---------------------------------------------------------------------------- |
diff --git a/Documentation/video4linux/w9966.txt b/Documentation/video4linux/w9966.txt index e7ac33a7eb06..78a651254b84 100644 --- a/Documentation/video4linux/w9966.txt +++ b/Documentation/video4linux/w9966.txt | |||
@@ -26,7 +26,7 @@ is called VIDEO_PALETTE_YUV422 (16 bpp). | |||
26 | A minimal test application (with source) is available from: | 26 | A minimal test application (with source) is available from: |
27 | http://hem.fyristorg.com/mogul/w9966.html | 27 | http://hem.fyristorg.com/mogul/w9966.html |
28 | 28 | ||
29 | The slow framerate is due to missing DMA ECP read support in the | 29 | The slow framerate is due to missing DMA ECP read support in the |
30 | parport drivers. I might add working EPP support later. | 30 | parport drivers. I might add working EPP support later. |
31 | 31 | ||
32 | Good luck! | 32 | Good luck! |
diff --git a/Documentation/video4linux/zr36120.txt b/Documentation/video4linux/zr36120.txt index 5d6357eefde4..ac6d92d01944 100644 --- a/Documentation/video4linux/zr36120.txt +++ b/Documentation/video4linux/zr36120.txt | |||
@@ -2,7 +2,7 @@ Driver for Trust Computer Products Framegrabber, version 0.6.1 | |||
2 | ------ --- ----- -------- -------- ------------ ------- - - - | 2 | ------ --- ----- -------- -------- ------------ ------- - - - |
3 | 3 | ||
4 | - ZORAN ------------------------------------------------------ | 4 | - ZORAN ------------------------------------------------------ |
5 | Author: Pauline Middelink <middelin@polyware.nl> | 5 | Author: Pauline Middelink <middelin@polyware.nl> |
6 | Date: 18 September 1999 | 6 | Date: 18 September 1999 |
7 | Version: 0.6.1 | 7 | Version: 0.6.1 |
8 | 8 | ||
@@ -115,7 +115,7 @@ After making/checking the devices do: | |||
115 | <n> is the cardtype of the card you have. The cardnumber can | 115 | <n> is the cardtype of the card you have. The cardnumber can |
116 | be found in the source of zr36120. Look for tvcards. If your | 116 | be found in the source of zr36120. Look for tvcards. If your |
117 | card is not there, please try if any other card gives some | 117 | card is not there, please try if any other card gives some |
118 | response, and mail me if you got a working tvcard addition. | 118 | response, and mail me if you got a working tvcard addition. |
119 | 119 | ||
120 | PS. <TVCard editors behold!) | 120 | PS. <TVCard editors behold!) |
121 | Dont forget to set video_input to the number of inputs | 121 | Dont forget to set video_input to the number of inputs |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index c2602b340491..baa9f58beffc 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -50,5 +50,19 @@ config VIDEO_IR | |||
50 | config VIDEO_TVEEPROM | 50 | config VIDEO_TVEEPROM |
51 | tristate | 51 | tristate |
52 | 52 | ||
53 | config USB_DABUSB | ||
54 | tristate "DABUSB driver" | ||
55 | depends on USB | ||
56 | ---help--- | ||
57 | A Digital Audio Broadcasting (DAB) Receiver for USB and Linux | ||
58 | brought to you by the DAB-Team | ||
59 | <http://wwwbode.cs.tum.edu/Par/arch/dab/>. This driver can be taken | ||
60 | as an example for URB-based bulk, control, and isochronous | ||
61 | transactions. URB's are explained in | ||
62 | <Documentation/usb/URB.txt>. | ||
63 | |||
64 | To compile this driver as a module, choose M here: the | ||
65 | module will be called dabusb. | ||
66 | |||
53 | endmenu | 67 | endmenu |
54 | 68 | ||
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 3870fa948cc0..523ab3851c7b 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -50,14 +50,15 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits) | |||
50 | /********************************************************************************/ | 50 | /********************************************************************************/ |
51 | /* common dma functions */ | 51 | /* common dma functions */ |
52 | 52 | ||
53 | void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf) | 53 | void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q, |
54 | struct saa7146_buf *buf) | ||
54 | { | 55 | { |
55 | DEB_EE(("dev:%p, buf:%p\n",dev,buf)); | 56 | DEB_EE(("dev:%p, buf:%p\n",dev,buf)); |
56 | 57 | ||
57 | BUG_ON(in_interrupt()); | 58 | BUG_ON(in_interrupt()); |
58 | 59 | ||
59 | videobuf_waiton(&buf->vb,0,0); | 60 | videobuf_waiton(&buf->vb,0,0); |
60 | videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma); | 61 | videobuf_dma_unmap(q, &buf->vb.dma); |
61 | videobuf_dma_free(&buf->vb.dma); | 62 | videobuf_dma_free(&buf->vb.dma); |
62 | buf->vb.state = STATE_NEEDS_INIT; | 63 | buf->vb.state = STATE_NEEDS_INIT; |
63 | } | 64 | } |
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c index 500bd3f05e16..063608462ebe 100644 --- a/drivers/media/common/saa7146_vbi.c +++ b/drivers/media/common/saa7146_vbi.c | |||
@@ -236,7 +236,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
236 | } | 236 | } |
237 | 237 | ||
238 | if (buf->vb.size != size) | 238 | if (buf->vb.size != size) |
239 | saa7146_dma_free(dev,buf); | 239 | saa7146_dma_free(dev,q,buf); |
240 | 240 | ||
241 | if (STATE_NEEDS_INIT == buf->vb.state) { | 241 | if (STATE_NEEDS_INIT == buf->vb.state) { |
242 | buf->vb.width = llength; | 242 | buf->vb.width = llength; |
@@ -247,7 +247,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
247 | saa7146_pgtable_free(dev->pci, &buf->pt[2]); | 247 | saa7146_pgtable_free(dev->pci, &buf->pt[2]); |
248 | saa7146_pgtable_alloc(dev->pci, &buf->pt[2]); | 248 | saa7146_pgtable_alloc(dev->pci, &buf->pt[2]); |
249 | 249 | ||
250 | err = videobuf_iolock(dev->pci,&buf->vb, NULL); | 250 | err = videobuf_iolock(q,&buf->vb, NULL); |
251 | if (err) | 251 | if (err) |
252 | goto oops; | 252 | goto oops; |
253 | err = saa7146_pgtable_build_single(dev->pci, &buf->pt[2], buf->vb.dma.sglist, buf->vb.dma.sglen); | 253 | err = saa7146_pgtable_build_single(dev->pci, &buf->pt[2], buf->vb.dma.sglist, buf->vb.dma.sglen); |
@@ -261,7 +261,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
261 | 261 | ||
262 | oops: | 262 | oops: |
263 | DEB_VBI(("error out.\n")); | 263 | DEB_VBI(("error out.\n")); |
264 | saa7146_dma_free(dev,buf); | 264 | saa7146_dma_free(dev,q,buf); |
265 | 265 | ||
266 | return err; | 266 | return err; |
267 | } | 267 | } |
@@ -301,7 +301,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
301 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 301 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
302 | 302 | ||
303 | DEB_VBI(("vb:%p\n",vb)); | 303 | DEB_VBI(("vb:%p\n",vb)); |
304 | saa7146_dma_free(dev,buf); | 304 | saa7146_dma_free(dev,q,buf); |
305 | } | 305 | } |
306 | 306 | ||
307 | static struct videobuf_queue_ops vbi_qops = { | 307 | static struct videobuf_queue_ops vbi_qops = { |
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 6b42713d97f4..e7079d1bd537 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -1275,7 +1275,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1275 | buf->vb.field != field || | 1275 | buf->vb.field != field || |
1276 | buf->vb.field != fh->video_fmt.field || | 1276 | buf->vb.field != fh->video_fmt.field || |
1277 | buf->fmt != &fh->video_fmt) { | 1277 | buf->fmt != &fh->video_fmt) { |
1278 | saa7146_dma_free(dev,buf); | 1278 | saa7146_dma_free(dev,q,buf); |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | if (STATE_NEEDS_INIT == buf->vb.state) { | 1281 | if (STATE_NEEDS_INIT == buf->vb.state) { |
@@ -1304,7 +1304,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1304 | saa7146_pgtable_alloc(dev->pci, &buf->pt[0]); | 1304 | saa7146_pgtable_alloc(dev->pci, &buf->pt[0]); |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | err = videobuf_iolock(dev->pci,&buf->vb, &vv->ov_fb); | 1307 | err = videobuf_iolock(q,&buf->vb, &vv->ov_fb); |
1308 | if (err) | 1308 | if (err) |
1309 | goto oops; | 1309 | goto oops; |
1310 | err = saa7146_pgtable_build(dev,buf); | 1310 | err = saa7146_pgtable_build(dev,buf); |
@@ -1318,7 +1318,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1318 | 1318 | ||
1319 | oops: | 1319 | oops: |
1320 | DEB_D(("error out.\n")); | 1320 | DEB_D(("error out.\n")); |
1321 | saa7146_dma_free(dev,buf); | 1321 | saa7146_dma_free(dev,q,buf); |
1322 | 1322 | ||
1323 | return err; | 1323 | return err; |
1324 | } | 1324 | } |
@@ -1363,7 +1363,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1363 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 1363 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
1364 | 1364 | ||
1365 | DEB_CAP(("vbuf:%p\n",vb)); | 1365 | DEB_CAP(("vbuf:%p\n",vb)); |
1366 | saa7146_dma_free(dev,buf); | 1366 | saa7146_dma_free(dev,q,buf); |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | static struct videobuf_queue_ops video_qops = { | 1369 | static struct videobuf_queue_ops video_qops = { |
diff --git a/drivers/media/dvb/b2c2/flexcop-usb.c b/drivers/media/dvb/b2c2/flexcop-usb.c index a6c91db40ad6..06ec9fff0ec1 100644 --- a/drivers/media/dvb/b2c2/flexcop-usb.c +++ b/drivers/media/dvb/b2c2/flexcop-usb.c | |||
@@ -541,6 +541,7 @@ static struct usb_device_id flexcop_usb_table [] = { | |||
541 | { USB_DEVICE(0x0af7, 0x0101) }, | 541 | { USB_DEVICE(0x0af7, 0x0101) }, |
542 | { } | 542 | { } |
543 | }; | 543 | }; |
544 | MODULE_DEVICE_TABLE (usb, flexcop_usb_table); | ||
544 | 545 | ||
545 | /* usb specific object needed to register this driver with the usb subsystem */ | 546 | /* usb specific object needed to register this driver with the usb subsystem */ |
546 | static struct usb_driver flexcop_usb_driver = { | 547 | static struct usb_driver flexcop_usb_driver = { |
diff --git a/drivers/media/dvb/bt8xx/Makefile b/drivers/media/dvb/bt8xx/Makefile index d188e4c670b5..9d197efb481d 100644 --- a/drivers/media/dvb/bt8xx/Makefile +++ b/drivers/media/dvb/bt8xx/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o | 1 | obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o |
2 | 2 | ||
3 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video -Idrivers/media/dvb/frontends | 3 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video/bt8xx -Idrivers/media/dvb/frontends |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index e14bf43941e3..a14e737ec848 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -81,18 +81,19 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | |||
81 | return -EAGAIN; | 81 | return -EAGAIN; |
82 | 82 | ||
83 | if (num > 2) | 83 | if (num > 2) |
84 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | 84 | warn("more than two i2c messages at a time is not handled yet. TODO."); |
85 | 85 | ||
86 | for (i = 0; i < num; i++) { | 86 | for (i = 0; i < num; i++) { |
87 | 87 | ||
88 | switch (msg[i].addr) { | 88 | if (d->udev->descriptor.idVendor == USB_VID_MEDION) |
89 | case 0x63: | 89 | switch (msg[i].addr) { |
90 | cxusb_gpio_tuner(d,0); | 90 | case 0x63: |
91 | break; | 91 | cxusb_gpio_tuner(d,0); |
92 | default: | 92 | break; |
93 | cxusb_gpio_tuner(d,1); | 93 | default: |
94 | break; | 94 | cxusb_gpio_tuner(d,1); |
95 | } | 95 | break; |
96 | } | ||
96 | 97 | ||
97 | /* read request */ | 98 | /* read request */ |
98 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | 99 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { |
@@ -108,7 +109,7 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | |||
108 | break; | 109 | break; |
109 | 110 | ||
110 | if (ibuf[0] != 0x08) | 111 | if (ibuf[0] != 0x08) |
111 | deb_info("i2c read could have been failed\n"); | 112 | deb_i2c("i2c read may have failed\n"); |
112 | 113 | ||
113 | memcpy(msg[i+1].buf,&ibuf[1],msg[i+1].len); | 114 | memcpy(msg[i+1].buf,&ibuf[1],msg[i+1].len); |
114 | 115 | ||
@@ -122,7 +123,7 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | |||
122 | if (cxusb_ctrl_msg(d,CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0) | 123 | if (cxusb_ctrl_msg(d,CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0) |
123 | break; | 124 | break; |
124 | if (ibuf != 0x08) | 125 | if (ibuf != 0x08) |
125 | deb_info("i2c write could have been failed\n"); | 126 | deb_i2c("i2c write may have failed\n"); |
126 | } | 127 | } |
127 | } | 128 | } |
128 | 129 | ||
@@ -410,7 +411,6 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const | |||
410 | if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) && | 411 | if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) && |
411 | fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { | 412 | fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { |
412 | 413 | ||
413 | /* FIXME: are we allowed to change the fw-data ? */ | ||
414 | fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1; | 414 | fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1; |
415 | fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8; | 415 | fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8; |
416 | 416 | ||
diff --git a/drivers/media/dvb/dvb-usb/cxusb.h b/drivers/media/dvb/dvb-usb/cxusb.h index 087c99427853..c8ef77554b00 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.h +++ b/drivers/media/dvb/dvb-usb/cxusb.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | extern int dvb_usb_cxusb_debug; | 7 | extern int dvb_usb_cxusb_debug; |
8 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) | 8 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) |
9 | #define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \ | ||
10 | dprintk(dvb_usb_cxusb_debug,0x01,args) | ||
9 | 11 | ||
10 | /* usb commands - some of it are guesses, don't have a reference yet */ | 12 | /* usb commands - some of it are guesses, don't have a reference yet */ |
11 | #define CMD_I2C_WRITE 0x08 | 13 | #define CMD_I2C_WRITE 0x08 |
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c index 2f23ceab8d44..603a22e4bfe2 100644 --- a/drivers/media/dvb/ttpci/av7110_v4l.c +++ b/drivers/media/dvb/ttpci/av7110_v4l.c | |||
@@ -369,6 +369,11 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
369 | fm_matrix = 0x3001; // stereo | 369 | fm_matrix = 0x3001; // stereo |
370 | src = 0x0020; | 370 | src = 0x0020; |
371 | break; | 371 | break; |
372 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
373 | dprintk(2, "VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1_LANG2\n"); | ||
374 | fm_matrix = 0x3000; // bilingual | ||
375 | src = 0x0020; | ||
376 | break; | ||
372 | case V4L2_TUNER_MODE_LANG1: | 377 | case V4L2_TUNER_MODE_LANG1: |
373 | dprintk(2, "VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1\n"); | 378 | dprintk(2, "VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1\n"); |
374 | fm_matrix = 0x3000; // mono | 379 | fm_matrix = 0x3000; // mono |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index c622a4da5663..f31a19890b15 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -16,31 +16,7 @@ config VIDEO_ADV_DEBUG | |||
16 | V4L devices. | 16 | V4L devices. |
17 | In doubt, say N. | 17 | In doubt, say N. |
18 | 18 | ||
19 | config VIDEO_BT848 | 19 | source "drivers/media/video/bt8xx/Kconfig" |
20 | tristate "BT848 Video For Linux" | ||
21 | depends on VIDEO_DEV && PCI && I2C | ||
22 | select I2C_ALGOBIT | ||
23 | select FW_LOADER | ||
24 | select VIDEO_BTCX | ||
25 | select VIDEO_BUF | ||
26 | select VIDEO_IR | ||
27 | select VIDEO_TUNER | ||
28 | select VIDEO_TVEEPROM | ||
29 | select VIDEO_MSP3400 | ||
30 | ---help--- | ||
31 | Support for BT848 based frame grabber/overlay boards. This includes | ||
32 | the Miro, Hauppauge and STB boards. Please read the material in | ||
33 | <file:Documentation/video4linux/bttv/> for more information. | ||
34 | |||
35 | To compile this driver as a module, choose M here: the | ||
36 | module will be called bttv. | ||
37 | |||
38 | config VIDEO_BT848_DVB | ||
39 | bool "DVB/ATSC Support for bt878 based TV cards" | ||
40 | depends on VIDEO_BT848 && DVB_CORE | ||
41 | select DVB_BT8XX | ||
42 | ---help--- | ||
43 | This adds support for DVB/ATSC cards based on the BT878 chip. | ||
44 | 20 | ||
45 | config VIDEO_SAA6588 | 21 | config VIDEO_SAA6588 |
46 | tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" | 22 | tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" |
@@ -315,8 +291,6 @@ config VIDEO_HEXIUM_GEMINI | |||
315 | 291 | ||
316 | source "drivers/media/video/cx88/Kconfig" | 292 | source "drivers/media/video/cx88/Kconfig" |
317 | 293 | ||
318 | source "drivers/media/video/em28xx/Kconfig" | ||
319 | |||
320 | config VIDEO_OVCAMCHIP | 294 | config VIDEO_OVCAMCHIP |
321 | tristate "OmniVision Camera Chip support" | 295 | tristate "OmniVision Camera Chip support" |
322 | depends on VIDEO_DEV && I2C | 296 | depends on VIDEO_DEV && I2C |
@@ -391,4 +365,234 @@ config VIDEO_SAA7127 | |||
391 | To compile this driver as a module, choose M here: the | 365 | To compile this driver as a module, choose M here: the |
392 | module will be called saa7127 | 366 | module will be called saa7127 |
393 | 367 | ||
368 | # | ||
369 | # USB Multimedia device configuration | ||
370 | # | ||
371 | |||
372 | menu "V4L USB devices" | ||
373 | depends on USB && VIDEO_DEV | ||
374 | |||
375 | source "drivers/media/video/em28xx/Kconfig" | ||
376 | |||
377 | config USB_VICAM | ||
378 | tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" | ||
379 | depends on USB && VIDEO_DEV && EXPERIMENTAL | ||
380 | ---help--- | ||
381 | Say Y here if you have 3com homeconnect camera (vicam). | ||
382 | |||
383 | This driver uses the Video For Linux API. You must say Y or M to | ||
384 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
385 | Information on this API and pointers to "v4l" programs may be found | ||
386 | at <file:Documentation/video4linux/API.html>. | ||
387 | |||
388 | To compile this driver as a module, choose M here: the | ||
389 | module will be called vicam. | ||
390 | |||
391 | config USB_DSBR | ||
392 | tristate "D-Link USB FM radio support (EXPERIMENTAL)" | ||
393 | depends on USB && VIDEO_DEV && EXPERIMENTAL | ||
394 | ---help--- | ||
395 | Say Y here if you want to connect this type of radio to your | ||
396 | computer's USB port. Note that the audio is not digital, and | ||
397 | you must connect the line out connector to a sound card or a | ||
398 | set of speakers. | ||
399 | |||
400 | This driver uses the Video For Linux API. You must enable | ||
401 | (Y or M in config) Video For Linux (under Character Devices) | ||
402 | to use this driver. Information on this API and pointers to | ||
403 | "v4l" programs may be found at | ||
404 | <file:Documentation/video4linux/API.html>. | ||
405 | |||
406 | To compile this driver as a module, choose M here: the | ||
407 | module will be called dsbr100. | ||
408 | |||
409 | config USB_ET61X251 | ||
410 | tristate "USB ET61X[12]51 PC Camera Controller support" | ||
411 | depends on USB && VIDEO_DEV | ||
412 | ---help--- | ||
413 | Say Y here if you want support for cameras based on Etoms ET61X151 | ||
414 | or ET61X251 PC Camera Controllers. | ||
415 | |||
416 | See <file:Documentation/usb/et61x251.txt> for more informations. | ||
417 | |||
418 | This driver uses the Video For Linux API. You must say Y or M to | ||
419 | "Video For Linux" to use this driver. | ||
420 | |||
421 | To compile this driver as a module, choose M here: the | ||
422 | module will be called et61x251. | ||
423 | |||
424 | config USB_IBMCAM | ||
425 | tristate "USB IBM (Xirlink) C-it Camera support" | ||
426 | depends on USB && VIDEO_DEV | ||
427 | ---help--- | ||
428 | Say Y here if you want to connect a IBM "C-It" camera, also known as | ||
429 | "Xirlink PC Camera" to your computer's USB port. For more | ||
430 | information, read <file:Documentation/usb/ibmcam.txt>. | ||
431 | |||
432 | This driver uses the Video For Linux API. You must enable | ||
433 | (Y or M in config) Video For Linux (under Character Devices) | ||
434 | to use this driver. Information on this API and pointers to | ||
435 | "v4l" programs may be found at | ||
436 | <file:Documentation/video4linux/API.html>. | ||
437 | |||
438 | To compile this driver as a module, choose M here: the | ||
439 | module will be called ibmcam. | ||
440 | |||
441 | This camera has several configuration options which | ||
442 | can be specified when you load the module. Read | ||
443 | <file:Documentation/usb/ibmcam.txt> to learn more. | ||
444 | |||
445 | config USB_KONICAWC | ||
446 | tristate "USB Konica Webcam support" | ||
447 | depends on USB && VIDEO_DEV | ||
448 | ---help--- | ||
449 | Say Y here if you want support for webcams based on a Konica | ||
450 | chipset. This is known to work with the Intel YC76 webcam. | ||
451 | |||
452 | This driver uses the Video For Linux API. You must enable | ||
453 | (Y or M in config) Video For Linux (under Character Devices) | ||
454 | to use this driver. Information on this API and pointers to | ||
455 | "v4l" programs may be found at | ||
456 | <file:Documentation/video4linux/API.html>. | ||
457 | |||
458 | To compile this driver as a module, choose M here: the | ||
459 | module will be called konicawc. | ||
460 | |||
461 | config USB_OV511 | ||
462 | tristate "USB OV511 Camera support" | ||
463 | depends on USB && VIDEO_DEV | ||
464 | ---help--- | ||
465 | Say Y here if you want to connect this type of camera to your | ||
466 | computer's USB port. See <file:Documentation/usb/ov511.txt> for more | ||
467 | information and for a list of supported cameras. | ||
468 | |||
469 | This driver uses the Video For Linux API. You must say Y or M to | ||
470 | "Video For Linux" (under Character Devices) to use this driver. | ||
471 | Information on this API and pointers to "v4l" programs may be found | ||
472 | at <file:Documentation/video4linux/API.html>. | ||
473 | |||
474 | To compile this driver as a module, choose M here: the | ||
475 | module will be called ov511. | ||
476 | |||
477 | config USB_SE401 | ||
478 | tristate "USB SE401 Camera support" | ||
479 | depends on USB && VIDEO_DEV | ||
480 | ---help--- | ||
481 | Say Y here if you want to connect this type of camera to your | ||
482 | computer's USB port. See <file:Documentation/usb/se401.txt> for more | ||
483 | information and for a list of supported cameras. | ||
484 | |||
485 | This driver uses the Video For Linux API. You must say Y or M to | ||
486 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
487 | Information on this API and pointers to "v4l" programs may be found | ||
488 | at <file:Documentation/video4linux/API.html>. | ||
489 | |||
490 | To compile this driver as a module, choose M here: the | ||
491 | module will be called se401. | ||
492 | |||
493 | config USB_SN9C102 | ||
494 | tristate "USB SN9C10x PC Camera Controller support" | ||
495 | depends on USB && VIDEO_DEV | ||
496 | ---help--- | ||
497 | Say Y here if you want support for cameras based on SONiX SN9C101, | ||
498 | SN9C102 or SN9C103 PC Camera Controllers. | ||
499 | |||
500 | See <file:Documentation/usb/sn9c102.txt> for more informations. | ||
501 | |||
502 | This driver uses the Video For Linux API. You must say Y or M to | ||
503 | "Video For Linux" to use this driver. | ||
504 | |||
505 | To compile this driver as a module, choose M here: the | ||
506 | module will be called sn9c102. | ||
507 | |||
508 | config USB_STV680 | ||
509 | tristate "USB STV680 (Pencam) Camera support" | ||
510 | depends on USB && VIDEO_DEV | ||
511 | ---help--- | ||
512 | Say Y here if you want to connect this type of camera to your | ||
513 | computer's USB port. This includes the Pencam line of cameras. | ||
514 | See <file:Documentation/usb/stv680.txt> for more information and for | ||
515 | a list of supported cameras. | ||
516 | |||
517 | This driver uses the Video For Linux API. You must say Y or M to | ||
518 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
519 | Information on this API and pointers to "v4l" programs may be found | ||
520 | at <file:Documentation/video4linux/API.html>. | ||
521 | |||
522 | To compile this driver as a module, choose M here: the | ||
523 | module will be called stv680. | ||
524 | |||
525 | config USB_W9968CF | ||
526 | tristate "USB W996[87]CF JPEG Dual Mode Camera support" | ||
527 | depends on USB && VIDEO_DEV && I2C && VIDEO_OVCAMCHIP | ||
528 | ---help--- | ||
529 | Say Y here if you want support for cameras based on OV681 or | ||
530 | Winbond W9967CF/W9968CF JPEG USB Dual Mode Camera Chips. | ||
531 | |||
532 | This driver has an optional plugin, which is distributed as a | ||
533 | separate module only (released under GPL). It allows to use higher | ||
534 | resolutions and framerates, but cannot be included in the official | ||
535 | Linux kernel for performance purposes. | ||
536 | |||
537 | See <file:Documentation/usb/w9968cf.txt> for more informations. | ||
538 | |||
539 | This driver uses the Video For Linux and the I2C APIs. It needs the | ||
540 | OmniVision Camera Chip support as well. You must say Y or M to | ||
541 | "Video For Linux", "I2C Support" and "OmniVision Camera Chip | ||
542 | support" to use this driver. | ||
543 | |||
544 | To compile this driver as a module, choose M here: the | ||
545 | module will be called w9968cf. | ||
546 | |||
547 | config USB_ZC0301 | ||
548 | tristate "USB ZC0301 Image Processor and Control Chip support" | ||
549 | depends on USB && VIDEO_DEV | ||
550 | ---help--- | ||
551 | Say Y here if you want support for cameras based on the ZC0301 | ||
552 | Image Processor and Control Chip. | ||
553 | |||
554 | See <file:Documentation/usb/zc0301.txt> for more informations. | ||
555 | |||
556 | This driver uses the Video For Linux API. You must say Y or M to | ||
557 | "Video For Linux" to use this driver. | ||
558 | |||
559 | To compile this driver as a module, choose M here: the | ||
560 | module will be called zc0301. | ||
561 | |||
562 | config USB_PWC | ||
563 | tristate "USB Philips Cameras" | ||
564 | depends on USB && VIDEO_DEV | ||
565 | ---help--- | ||
566 | Say Y or M here if you want to use one of these Philips & OEM | ||
567 | webcams: | ||
568 | * Philips PCA645, PCA646 | ||
569 | * Philips PCVC675, PCVC680, PCVC690 | ||
570 | * Philips PCVC720/40, PCVC730, PCVC740, PCVC750 | ||
571 | * Askey VC010 | ||
572 | * Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro' | ||
573 | and 'Orbit'/'Sphere' | ||
574 | * Samsung MPC-C10, MPC-C30 | ||
575 | * Creative Webcam 5, Pro Ex | ||
576 | * SOTEC Afina Eye | ||
577 | * Visionite VCS-UC300, VCS-UM100 | ||
578 | |||
579 | The PCA635, PCVC665 and PCVC720/20 are not supported by this driver | ||
580 | and never will be, but the 665 and 720/20 are supported by other | ||
581 | drivers. | ||
582 | |||
583 | See <file:Documentation/usb/philips.txt> for more information and | ||
584 | installation instructions. | ||
585 | |||
586 | The built-in microphone is enabled by selecting USB Audio support. | ||
587 | |||
588 | This driver uses the Video For Linux API. You must say Y or M to | ||
589 | "Video For Linux" (under Character Devices) to use this driver. | ||
590 | Information on this API and pointers to "v4l" programs may be found | ||
591 | at <file:Documentation/video4linux/API.html>. | ||
592 | |||
593 | To compile this driver as a module, choose M here: the | ||
594 | module will be called pwc. | ||
595 | |||
596 | endmenu # V4L USB devices | ||
597 | |||
394 | endmenu | 598 | endmenu |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index f2bd4c0c4f10..1c0e72e5a593 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -2,9 +2,6 @@ | |||
2 | # Makefile for the video capture/playback device drivers. | 2 | # Makefile for the video capture/playback device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ | ||
6 | bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o \ | ||
7 | bttv-input.o | ||
8 | zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o | 5 | zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o |
9 | zr36067-objs := zoran_procfs.o zoran_device.o \ | 6 | zr36067-objs := zoran_procfs.o zoran_device.o \ |
10 | zoran_driver.o zoran_card.o | 7 | zoran_driver.o zoran_card.o |
@@ -15,8 +12,8 @@ msp3400-objs := msp3400-driver.o msp3400-kthreads.o | |||
15 | 12 | ||
16 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o | 13 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o |
17 | 14 | ||
18 | obj-$(CONFIG_VIDEO_BT848) += bttv.o tvaudio.o \ | 15 | obj-$(CONFIG_VIDEO_BT848) += bt8xx/ |
19 | tda7432.o tda9875.o ir-kbd-i2c.o | 16 | obj-$(CONFIG_VIDEO_BT848) += tvaudio.o tda7432.o tda9875.o ir-kbd-i2c.o |
20 | obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o | 17 | obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o |
21 | 18 | ||
22 | obj-$(CONFIG_VIDEO_ZR36120) += zoran.o | 19 | obj-$(CONFIG_VIDEO_ZR36120) += zoran.o |
@@ -68,4 +65,23 @@ obj-$(CONFIG_VIDEO_CX25840) += cx25840/ | |||
68 | obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o | 65 | obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o |
69 | obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o | 66 | obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o |
70 | 67 | ||
68 | et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o | ||
69 | zc0301-objs := zc0301_core.o zc0301_pas202bcb.o | ||
70 | |||
71 | obj-$(CONFIG_USB_DABUSB) += dabusb.o | ||
72 | obj-$(CONFIG_USB_DSBR) += dsbr100.o | ||
73 | obj-$(CONFIG_USB_OV511) += ov511.o | ||
74 | obj-$(CONFIG_USB_SE401) += se401.o | ||
75 | obj-$(CONFIG_USB_STV680) += stv680.o | ||
76 | obj-$(CONFIG_USB_W9968CF) += w9968cf.o | ||
77 | |||
78 | obj-$(CONFIG_USB_SN9C102) += sn9c102/ | ||
79 | obj-$(CONFIG_USB_ET61X251) += et61x251/ | ||
80 | obj-$(CONFIG_USB_PWC) += pwc/ | ||
81 | obj-$(CONFIG_USB_ZC0301) += zc0301/ | ||
82 | |||
83 | obj-$(CONFIG_USB_IBMCAM) += usbvideo/ | ||
84 | obj-$(CONFIG_USB_KONICAWC) += usbvideo/ | ||
85 | obj-$(CONFIG_USB_VICAM) += usbvideo/ | ||
86 | |||
71 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core | 87 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core |
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 671e36db224d..48709582a186 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * adv7170 - adv7170, adv7171 video encoder driver version 0.0.1 | 2 | * adv7170 - adv7170, adv7171 video encoder driver version 0.0.1 |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com> | 4 | * Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com> |
5 | * | 5 | * |
6 | * Based on adv7176 driver by: | 6 | * Based on adv7176 driver by: |
7 | * | 7 | * |
8 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> | 8 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
9 | * Copyright (C) 1999 Wolfgang Scherr <scherr@net4you.net> | 9 | * Copyright (C) 1999 Wolfgang Scherr <scherr@net4you.net> |
@@ -173,7 +173,7 @@ adv7170_write_block (struct i2c_client *client, | |||
173 | static const unsigned char init_NTSC[] = { | 173 | static const unsigned char init_NTSC[] = { |
174 | 0x00, 0x10, // MR0 | 174 | 0x00, 0x10, // MR0 |
175 | 0x01, 0x20, // MR1 | 175 | 0x01, 0x20, // MR1 |
176 | 0x02, 0x0e, // MR2 RTC control: bits 2 and 1 | 176 | 0x02, 0x0e, // MR2 RTC control: bits 2 and 1 |
177 | 0x03, 0x80, // MR3 | 177 | 0x03, 0x80, // MR3 |
178 | 0x04, 0x30, // MR4 | 178 | 0x04, 0x30, // MR4 |
179 | 0x05, 0x00, // Reserved | 179 | 0x05, 0x00, // Reserved |
@@ -196,7 +196,7 @@ static const unsigned char init_NTSC[] = { | |||
196 | 0x16, 0x00, // CGMS_WSS_0 | 196 | 0x16, 0x00, // CGMS_WSS_0 |
197 | 0x17, 0x00, // CGMS_WSS_1 | 197 | 0x17, 0x00, // CGMS_WSS_1 |
198 | 0x18, 0x00, // CGMS_WSS_2 | 198 | 0x18, 0x00, // CGMS_WSS_2 |
199 | 0x19, 0x00, // Teletext Ctl | 199 | 0x19, 0x00, // Teletext Ctl |
200 | }; | 200 | }; |
201 | 201 | ||
202 | static const unsigned char init_PAL[] = { | 202 | static const unsigned char init_PAL[] = { |
@@ -381,7 +381,7 @@ static unsigned short normal_i2c[] = | |||
381 | }; | 381 | }; |
382 | 382 | ||
383 | static unsigned short ignore = I2C_CLIENT_END; | 383 | static unsigned short ignore = I2C_CLIENT_END; |
384 | 384 | ||
385 | static struct i2c_client_address_data addr_data = { | 385 | static struct i2c_client_address_data addr_data = { |
386 | .normal_i2c = normal_i2c, | 386 | .normal_i2c = normal_i2c, |
387 | .probe = &ignore, | 387 | .probe = &ignore, |
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 085e8863cacb..68e7d7aff5e6 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * adv7175 - adv7175a video encoder driver version 0.0.3 | 2 | * adv7175 - adv7175a video encoder driver version 0.0.3 |
3 | * | 3 | * |
4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> | 4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
@@ -233,7 +233,7 @@ adv7175_command (struct i2c_client *client, | |||
233 | sizeof(init_common)); | 233 | sizeof(init_common)); |
234 | adv7175_write(client, 0x07, TR0MODE | TR0RST); | 234 | adv7175_write(client, 0x07, TR0MODE | TR0RST); |
235 | adv7175_write(client, 0x07, TR0MODE); | 235 | adv7175_write(client, 0x07, TR0MODE); |
236 | break; | 236 | break; |
237 | 237 | ||
238 | case ENCODER_GET_CAPABILITIES: | 238 | case ENCODER_GET_CAPABILITIES: |
239 | { | 239 | { |
@@ -399,7 +399,7 @@ static unsigned short normal_i2c[] = | |||
399 | }; | 399 | }; |
400 | 400 | ||
401 | static unsigned short ignore = I2C_CLIENT_END; | 401 | static unsigned short ignore = I2C_CLIENT_END; |
402 | 402 | ||
403 | static struct i2c_client_address_data addr_data = { | 403 | static struct i2c_client_address_data addr_data = { |
404 | .normal_i2c = normal_i2c, | 404 | .normal_i2c = normal_i2c, |
405 | .probe = &ignore, | 405 | .probe = &ignore, |
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index c586f64b6b7f..dbe025170599 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c | |||
@@ -161,39 +161,39 @@ void iic(int n, unsigned long addr, unsigned long data1, unsigned long data2, | |||
161 | { | 161 | { |
162 | int i; | 162 | int i; |
163 | 163 | ||
164 | /* Slave Address */ | 164 | /* Slave Address */ |
165 | ar_outl(addr, PLDI2CDATA); | 165 | ar_outl(addr, PLDI2CDATA); |
166 | wait_for_vsync(); | 166 | wait_for_vsync(); |
167 | 167 | ||
168 | /* Start */ | 168 | /* Start */ |
169 | ar_outl(1, PLDI2CCND); | 169 | ar_outl(1, PLDI2CCND); |
170 | wait_acknowledge(); | 170 | wait_acknowledge(); |
171 | 171 | ||
172 | /* Transfer data 1 */ | 172 | /* Transfer data 1 */ |
173 | ar_outl(data1, PLDI2CDATA); | 173 | ar_outl(data1, PLDI2CDATA); |
174 | wait_for_vsync(); | 174 | wait_for_vsync(); |
175 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); | 175 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); |
176 | wait_acknowledge(); | 176 | wait_acknowledge(); |
177 | 177 | ||
178 | /* Transfer data 2 */ | 178 | /* Transfer data 2 */ |
179 | ar_outl(data2, PLDI2CDATA); | 179 | ar_outl(data2, PLDI2CDATA); |
180 | wait_for_vsync(); | 180 | wait_for_vsync(); |
181 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); | 181 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); |
182 | wait_acknowledge(); | 182 | wait_acknowledge(); |
183 | 183 | ||
184 | if (n == 3) { | 184 | if (n == 3) { |
185 | /* Transfer data 3 */ | 185 | /* Transfer data 3 */ |
186 | ar_outl(data3, PLDI2CDATA); | 186 | ar_outl(data3, PLDI2CDATA); |
187 | wait_for_vsync(); | 187 | wait_for_vsync(); |
188 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); | 188 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); |
189 | wait_acknowledge(); | 189 | wait_acknowledge(); |
190 | } | 190 | } |
191 | 191 | ||
192 | /* Stop */ | 192 | /* Stop */ |
193 | for (i = 0; i < 100; i++) | 193 | for (i = 0; i < 100; i++) |
194 | cpu_relax(); | 194 | cpu_relax(); |
195 | ar_outl(2, PLDI2CCND); | 195 | ar_outl(2, PLDI2CCND); |
196 | ar_outl(2, PLDI2CCND); | 196 | ar_outl(2, PLDI2CCND); |
197 | 197 | ||
198 | while (ar_inl(PLDI2CSTS) & PLDI2CSTS_BB) | 198 | while (ar_inl(PLDI2CSTS) & PLDI2CSTS_BB) |
199 | cpu_relax(); | 199 | cpu_relax(); |
@@ -204,24 +204,24 @@ void init_iic(void) | |||
204 | { | 204 | { |
205 | DEBUG(1, "init_iic:\n"); | 205 | DEBUG(1, "init_iic:\n"); |
206 | 206 | ||
207 | /* | 207 | /* |
208 | * ICU Setting (iic) | 208 | * ICU Setting (iic) |
209 | */ | 209 | */ |
210 | /* I2C Setting */ | 210 | /* I2C Setting */ |
211 | ar_outl(0x0, PLDI2CCR); /* I2CCR Disable */ | 211 | ar_outl(0x0, PLDI2CCR); /* I2CCR Disable */ |
212 | ar_outl(0x0300, PLDI2CMOD); /* I2CMOD ACK/8b-data/7b-addr/auto */ | 212 | ar_outl(0x0300, PLDI2CMOD); /* I2CMOD ACK/8b-data/7b-addr/auto */ |
213 | ar_outl(0x1, PLDI2CACK); /* I2CACK ACK */ | 213 | ar_outl(0x1, PLDI2CACK); /* I2CACK ACK */ |
214 | 214 | ||
215 | /* I2C CLK */ | 215 | /* I2C CLK */ |
216 | /* 50MH-100k */ | 216 | /* 50MH-100k */ |
217 | if (freq == 75) { | 217 | if (freq == 75) { |
218 | ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */ | 218 | ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */ |
219 | } else if (freq == 50) { | 219 | } else if (freq == 50) { |
220 | ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */ | 220 | ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */ |
221 | } else { | 221 | } else { |
222 | ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */ | 222 | ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */ |
223 | } | 223 | } |
224 | ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */ | 224 | ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */ |
225 | } | 225 | } |
226 | 226 | ||
227 | /************************************************************************** | 227 | /************************************************************************** |
@@ -253,7 +253,7 @@ static inline void wait_for_vertical_sync(int exp_line) | |||
253 | 253 | ||
254 | /* | 254 | /* |
255 | * check HCOUNT because we cannot check vertical sync. | 255 | * check HCOUNT because we cannot check vertical sync. |
256 | */ | 256 | */ |
257 | for (; tmout >= 0; tmout--) { | 257 | for (; tmout >= 0; tmout--) { |
258 | l = ar_inl(ARVHCOUNT); | 258 | l = ar_inl(ARVHCOUNT); |
259 | if (l == exp_line) | 259 | if (l == exp_line) |
@@ -562,8 +562,8 @@ static void ar_interrupt(int irq, void *dev, struct pt_regs *regs) | |||
562 | /* operations for interlace mode */ | 562 | /* operations for interlace mode */ |
563 | if ( line_count < (AR_HEIGHT_VGA/2) ) /* even line */ | 563 | if ( line_count < (AR_HEIGHT_VGA/2) ) /* even line */ |
564 | line_number = (line_count << 1); | 564 | line_number = (line_count << 1); |
565 | else /* odd line */ | 565 | else /* odd line */ |
566 | line_number = | 566 | line_number = |
567 | (((line_count - (AR_HEIGHT_VGA/2)) << 1) + 1); | 567 | (((line_count - (AR_HEIGHT_VGA/2)) << 1) + 1); |
568 | } else { | 568 | } else { |
569 | line_number = line_count; | 569 | line_number = line_count; |
@@ -651,7 +651,7 @@ static int ar_initialize(struct video_device *dev) | |||
651 | cr |= ARVCR1_NORMAL; | 651 | cr |= ARVCR1_NORMAL; |
652 | ar_outl(cr, ARVCR1); | 652 | ar_outl(cr, ARVCR1); |
653 | 653 | ||
654 | /* | 654 | /* |
655 | * Initialize IIC so that CPU can communicate with AR LSI, | 655 | * Initialize IIC so that CPU can communicate with AR LSI, |
656 | * and send boot commands to AR LSI. | 656 | * and send boot commands to AR LSI. |
657 | */ | 657 | */ |
@@ -846,7 +846,7 @@ static int __init ar_init(void) | |||
846 | * so register video device as a frame grabber type. | 846 | * so register video device as a frame grabber type. |
847 | * device is named "video[0-64]". | 847 | * device is named "video[0-64]". |
848 | * video_register_device() initializes h/w using ar_initialize(). | 848 | * video_register_device() initializes h/w using ar_initialize(). |
849 | */ | 849 | */ |
850 | if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) { | 850 | if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) { |
851 | /* return -1, -ENFILE(full) or others */ | 851 | /* return -1, -ENFILE(full) or others */ |
852 | printk("arv: register video (Colour AR) failed.\n"); | 852 | printk("arv: register video (Colour AR) failed.\n"); |
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index d8a18a6a5bee..e7b38fdd5e3c 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * bt819 - BT819A VideoStream Decoder (Rockwell Part) | 2 | * bt819 - BT819A VideoStream Decoder (Rockwell Part) |
3 | * | 3 | * |
4 | * Copyright (C) 1999 Mike Bernson <mike@mlb.org> | 4 | * Copyright (C) 1999 Mike Bernson <mike@mlb.org> |
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * Modifications for LML33/DC10plus unified driver | 7 | * Modifications for LML33/DC10plus unified driver |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Changes by Ronald Bultje <rbultje@ronald.bitfreak.net> | 10 | * Changes by Ronald Bultje <rbultje@ronald.bitfreak.net> |
11 | * - moved over to linux>=2.4.x i2c protocol (9/9/2002) | 11 | * - moved over to linux>=2.4.x i2c protocol (9/9/2002) |
12 | * | 12 | * |
@@ -206,9 +206,9 @@ bt819_init (struct i2c_client *client) | |||
206 | Bug in the bt819 stepping on my board? | 206 | Bug in the bt819 stepping on my board? |
207 | */ | 207 | */ |
208 | 0x14, 0x00, /* 0x14 Vertial Scaling lsb */ | 208 | 0x14, 0x00, /* 0x14 Vertial Scaling lsb */ |
209 | 0x16, 0x07, /* 0x16 Video Timing Polarity | 209 | 0x16, 0x07, /* 0x16 Video Timing Polarity |
210 | ACTIVE=active low | 210 | ACTIVE=active low |
211 | FIELD: high=odd, | 211 | FIELD: high=odd, |
212 | vreset=active high, | 212 | vreset=active high, |
213 | hreset=active high */ | 213 | hreset=active high */ |
214 | 0x18, 0x68, /* 0x18 AGC Delay */ | 214 | 0x18, 0x68, /* 0x18 AGC Delay */ |
@@ -497,7 +497,7 @@ static unsigned short normal_i2c[] = { | |||
497 | }; | 497 | }; |
498 | 498 | ||
499 | static unsigned short ignore = I2C_CLIENT_END; | 499 | static unsigned short ignore = I2C_CLIENT_END; |
500 | 500 | ||
501 | static struct i2c_client_address_data addr_data = { | 501 | static struct i2c_client_address_data addr_data = { |
502 | .normal_i2c = normal_i2c, | 502 | .normal_i2c = normal_i2c, |
503 | .probe = &ignore, | 503 | .probe = &ignore, |
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 4d47a0a0e974..af3b61d4fa7d 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * bt856 - BT856A Digital Video Encoder (Rockwell Part) | 2 | * bt856 - BT856A Digital Video Encoder (Rockwell Part) |
3 | * | 3 | * |
4 | * Copyright (C) 1999 Mike Bernson <mike@mlb.org> | 4 | * Copyright (C) 1999 Mike Bernson <mike@mlb.org> |
@@ -285,7 +285,7 @@ bt856_command (struct i2c_client *client, | |||
285 | static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END }; | 285 | static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END }; |
286 | 286 | ||
287 | static unsigned short ignore = I2C_CLIENT_END; | 287 | static unsigned short ignore = I2C_CLIENT_END; |
288 | 288 | ||
289 | static struct i2c_client_address_data addr_data = { | 289 | static struct i2c_client_address_data addr_data = { |
290 | .normal_i2c = normal_i2c, | 290 | .normal_i2c = normal_i2c, |
291 | .probe = &ignore, | 291 | .probe = &ignore, |
diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig new file mode 100644 index 000000000000..085477c12612 --- /dev/null +++ b/drivers/media/video/bt8xx/Kconfig | |||
@@ -0,0 +1,25 @@ | |||
1 | config VIDEO_BT848 | ||
2 | tristate "BT848 Video For Linux" | ||
3 | depends on VIDEO_DEV && PCI && I2C | ||
4 | select I2C_ALGOBIT | ||
5 | select FW_LOADER | ||
6 | select VIDEO_BTCX | ||
7 | select VIDEO_BUF | ||
8 | select VIDEO_IR | ||
9 | select VIDEO_TUNER | ||
10 | select VIDEO_TVEEPROM | ||
11 | select VIDEO_MSP3400 | ||
12 | ---help--- | ||
13 | Support for BT848 based frame grabber/overlay boards. This includes | ||
14 | the Miro, Hauppauge and STB boards. Please read the material in | ||
15 | <file:Documentation/video4linux/bttv/> for more information. | ||
16 | |||
17 | To compile this driver as a module, choose M here: the | ||
18 | module will be called bttv. | ||
19 | |||
20 | config VIDEO_BT848_DVB | ||
21 | bool "DVB/ATSC Support for bt878 based TV cards" | ||
22 | depends on VIDEO_BT848 && DVB_CORE | ||
23 | select DVB_BT8XX | ||
24 | ---help--- | ||
25 | This adds support for DVB/ATSC cards based on the BT878 chip. | ||
diff --git a/drivers/media/video/bt8xx/Makefile b/drivers/media/video/bt8xx/Makefile new file mode 100644 index 000000000000..94350f21cdc0 --- /dev/null +++ b/drivers/media/video/bt8xx/Makefile | |||
@@ -0,0 +1,12 @@ | |||
1 | # | ||
2 | # Makefile for the video capture/playback device drivers. | ||
3 | # | ||
4 | |||
5 | bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ | ||
6 | bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o \ | ||
7 | bttv-input.o | ||
8 | |||
9 | obj-$(CONFIG_VIDEO_BT848) += bttv.o | ||
10 | |||
11 | EXTRA_CFLAGS += -I$(src)/.. | ||
12 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core | ||
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt8xx/bt832.c index cc54b62f4601..a51876137880 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt8xx/bt832.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <media/audiochip.h> | ||
34 | #include <media/v4l2-common.h> | 33 | #include <media/v4l2-common.h> |
35 | 34 | ||
36 | #include "bttv.h" | 35 | #include "bttv.h" |
@@ -39,7 +38,7 @@ | |||
39 | MODULE_LICENSE("GPL"); | 38 | MODULE_LICENSE("GPL"); |
40 | 39 | ||
41 | /* Addresses to scan */ | 40 | /* Addresses to scan */ |
42 | static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1, | 41 | static unsigned short normal_i2c[] = { I2C_ADDR_BT832_ALT1>>1, I2C_ADDR_BT832_ALT2>>1, |
43 | I2C_CLIENT_END }; | 42 | I2C_CLIENT_END }; |
44 | I2C_CLIENT_INSMOD; | 43 | I2C_CLIENT_INSMOD; |
45 | 44 | ||
diff --git a/drivers/media/video/bt832.h b/drivers/media/video/bt8xx/bt832.h index 1ce8fa71f7db..1ce8fa71f7db 100644 --- a/drivers/media/video/bt832.h +++ b/drivers/media/video/bt8xx/bt832.h | |||
diff --git a/drivers/media/video/bt848.h b/drivers/media/video/bt8xx/bt848.h index 0bcd95303bb0..0bcd95303bb0 100644 --- a/drivers/media/video/bt848.h +++ b/drivers/media/video/bt8xx/bt848.h | |||
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index abfa6ad857a0..f209a7492051 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | #include "bttvp.h" | 40 | #include "bttvp.h" |
41 | #include <media/v4l2-common.h> | 41 | #include <media/v4l2-common.h> |
42 | #include <media/tvaudio.h> | ||
42 | 43 | ||
43 | /* fwd decl */ | 44 | /* fwd decl */ |
44 | static void boot_msp34xx(struct bttv *btv, int pin); | 45 | static void boot_msp34xx(struct bttv *btv, int pin); |
@@ -336,7 +337,8 @@ struct tvcard bttv_tvcards[] = { | |||
336 | .svhs = 2, | 337 | .svhs = 2, |
337 | .gpiomask = 15, | 338 | .gpiomask = 15, |
338 | .muxsel = { 2, 3, 1, 1 }, | 339 | .muxsel = { 2, 3, 1, 1 }, |
339 | .audiomux = { 2, 0, 0, 0, 10 }, | 340 | .gpiomux = { 2, 0, 0, 0 }, |
341 | .gpiomute = 10, | ||
340 | .needs_tvaudio = 1, | 342 | .needs_tvaudio = 1, |
341 | .tuner_type = -1, | 343 | .tuner_type = -1, |
342 | .tuner_addr = ADDR_UNSET, | 344 | .tuner_addr = ADDR_UNSET, |
@@ -350,7 +352,8 @@ struct tvcard bttv_tvcards[] = { | |||
350 | .svhs = 2, | 352 | .svhs = 2, |
351 | .gpiomask = 7, | 353 | .gpiomask = 7, |
352 | .muxsel = { 2, 3, 1, 1 }, | 354 | .muxsel = { 2, 3, 1, 1 }, |
353 | .audiomux = { 0, 1, 2, 3, 4 }, | 355 | .gpiomux = { 0, 1, 2, 3 }, |
356 | .gpiomute = 4, | ||
354 | .needs_tvaudio = 1, | 357 | .needs_tvaudio = 1, |
355 | .tuner_type = -1, | 358 | .tuner_type = -1, |
356 | .tuner_addr = ADDR_UNSET, | 359 | .tuner_addr = ADDR_UNSET, |
@@ -364,7 +367,8 @@ struct tvcard bttv_tvcards[] = { | |||
364 | .svhs = 2, | 367 | .svhs = 2, |
365 | .gpiomask = 7, | 368 | .gpiomask = 7, |
366 | .muxsel = { 2, 3, 1, 1 }, | 369 | .muxsel = { 2, 3, 1, 1 }, |
367 | .audiomux = { 4, 0, 2, 3, 1 }, | 370 | .gpiomux = { 4, 0, 2, 3 }, |
371 | .gpiomute = 1, | ||
368 | .no_msp34xx = 1, | 372 | .no_msp34xx = 1, |
369 | .needs_tvaudio = 1, | 373 | .needs_tvaudio = 1, |
370 | .tuner_type = TUNER_PHILIPS_NTSC, | 374 | .tuner_type = TUNER_PHILIPS_NTSC, |
@@ -383,7 +387,7 @@ struct tvcard bttv_tvcards[] = { | |||
383 | .svhs = 2, | 387 | .svhs = 2, |
384 | .gpiomask = 0, | 388 | .gpiomask = 0, |
385 | .muxsel = { 2, 3, 1, 1 }, | 389 | .muxsel = { 2, 3, 1, 1 }, |
386 | .audiomux = { 0 }, | 390 | .gpiomux = { 0 }, |
387 | .needs_tvaudio = 0, | 391 | .needs_tvaudio = 0, |
388 | .tuner_type = 4, | 392 | .tuner_type = 4, |
389 | .tuner_addr = ADDR_UNSET, | 393 | .tuner_addr = ADDR_UNSET, |
@@ -397,7 +401,8 @@ struct tvcard bttv_tvcards[] = { | |||
397 | .svhs = 2, | 401 | .svhs = 2, |
398 | .gpiomask = 3, | 402 | .gpiomask = 3, |
399 | .muxsel = { 2, 3, 1, 0 }, | 403 | .muxsel = { 2, 3, 1, 0 }, |
400 | .audiomux = { 0, 1, 0, 1, 3 }, | 404 | .gpiomux = { 0, 1, 0, 1 }, |
405 | .gpiomute = 3, | ||
401 | .needs_tvaudio = 1, | 406 | .needs_tvaudio = 1, |
402 | .tuner_type = -1, | 407 | .tuner_type = -1, |
403 | .tuner_addr = ADDR_UNSET, | 408 | .tuner_addr = ADDR_UNSET, |
@@ -411,7 +416,7 @@ struct tvcard bttv_tvcards[] = { | |||
411 | .svhs = 3, | 416 | .svhs = 3, |
412 | .muxsel = { 2, 3, 1, 1 }, | 417 | .muxsel = { 2, 3, 1, 1 }, |
413 | .gpiomask = 0x0f, | 418 | .gpiomask = 0x0f, |
414 | .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0 }, | 419 | .gpiomux = { 0x0c, 0x04, 0x08, 0x04 }, |
415 | /* 0x04 for some cards ?? */ | 420 | /* 0x04 for some cards ?? */ |
416 | .needs_tvaudio = 1, | 421 | .needs_tvaudio = 1, |
417 | .tuner_type = -1, | 422 | .tuner_type = -1, |
@@ -428,7 +433,7 @@ struct tvcard bttv_tvcards[] = { | |||
428 | .svhs = 3, | 433 | .svhs = 3, |
429 | .gpiomask = 0, | 434 | .gpiomask = 0, |
430 | .muxsel = { 2, 3, 1, 0, 0 }, | 435 | .muxsel = { 2, 3, 1, 0, 0 }, |
431 | .audiomux = { 0 }, | 436 | .gpiomux = { 0 }, |
432 | .needs_tvaudio = 1, | 437 | .needs_tvaudio = 1, |
433 | .tuner_type = -1, | 438 | .tuner_type = -1, |
434 | .tuner_addr = ADDR_UNSET, | 439 | .tuner_addr = ADDR_UNSET, |
@@ -444,7 +449,8 @@ struct tvcard bttv_tvcards[] = { | |||
444 | .svhs = 2, | 449 | .svhs = 2, |
445 | .gpiomask = 0xc00, | 450 | .gpiomask = 0xc00, |
446 | .muxsel = { 2, 3, 1, 1 }, | 451 | .muxsel = { 2, 3, 1, 1 }, |
447 | .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0 }, | 452 | .gpiomux = { 0, 0xc00, 0x800, 0x400 }, |
453 | .gpiomute = 0xc00, | ||
448 | .needs_tvaudio = 1, | 454 | .needs_tvaudio = 1, |
449 | .pll = PLL_28, | 455 | .pll = PLL_28, |
450 | .tuner_type = -1, | 456 | .tuner_type = -1, |
@@ -459,7 +465,7 @@ struct tvcard bttv_tvcards[] = { | |||
459 | .svhs = 2, | 465 | .svhs = 2, |
460 | .gpiomask = 3, | 466 | .gpiomask = 3, |
461 | .muxsel = { 2, 3, 1, 1 }, | 467 | .muxsel = { 2, 3, 1, 1 }, |
462 | .audiomux = { 1, 1, 2, 3, 0 }, | 468 | .gpiomux = { 1, 1, 2, 3 }, |
463 | .needs_tvaudio = 0, | 469 | .needs_tvaudio = 0, |
464 | .pll = PLL_28, | 470 | .pll = PLL_28, |
465 | .tuner_type = TUNER_TEMIC_PAL, | 471 | .tuner_type = TUNER_TEMIC_PAL, |
@@ -474,7 +480,8 @@ struct tvcard bttv_tvcards[] = { | |||
474 | .svhs = 2, | 480 | .svhs = 2, |
475 | .gpiomask = 0x0f, /* old: 7 */ | 481 | .gpiomask = 0x0f, /* old: 7 */ |
476 | .muxsel = { 2, 0, 1, 1 }, | 482 | .muxsel = { 2, 0, 1, 1 }, |
477 | .audiomux = { 0, 1, 2, 3, 4 }, | 483 | .gpiomux = { 0, 1, 2, 3 }, |
484 | .gpiomute = 4, | ||
478 | .needs_tvaudio = 1, | 485 | .needs_tvaudio = 1, |
479 | .pll = PLL_28, | 486 | .pll = PLL_28, |
480 | .tuner_type = -1, | 487 | .tuner_type = -1, |
@@ -489,7 +496,8 @@ struct tvcard bttv_tvcards[] = { | |||
489 | .svhs = 2, | 496 | .svhs = 2, |
490 | .gpiomask = 0x3014f, | 497 | .gpiomask = 0x3014f, |
491 | .muxsel = { 2, 3, 1, 1 }, | 498 | .muxsel = { 2, 3, 1, 1 }, |
492 | .audiomux = { 0x20001,0x10001, 0, 0,10 }, | 499 | .gpiomux = { 0x20001,0x10001, 0, 0 }, |
500 | .gpiomute = 10, | ||
493 | .needs_tvaudio = 1, | 501 | .needs_tvaudio = 1, |
494 | .tuner_type = -1, | 502 | .tuner_type = -1, |
495 | .tuner_addr = ADDR_UNSET, | 503 | .tuner_addr = ADDR_UNSET, |
@@ -505,7 +513,7 @@ struct tvcard bttv_tvcards[] = { | |||
505 | .svhs = 2, | 513 | .svhs = 2, |
506 | .gpiomask = 15, | 514 | .gpiomask = 15, |
507 | .muxsel = { 2, 3, 1, 1 }, | 515 | .muxsel = { 2, 3, 1, 1 }, |
508 | .audiomux = { 13, 14, 11, 7, 0, 0 }, | 516 | .gpiomux = { 13, 14, 11, 7 }, |
509 | .needs_tvaudio = 1, | 517 | .needs_tvaudio = 1, |
510 | .tuner_type = -1, | 518 | .tuner_type = -1, |
511 | .tuner_addr = ADDR_UNSET, | 519 | .tuner_addr = ADDR_UNSET, |
@@ -519,7 +527,7 @@ struct tvcard bttv_tvcards[] = { | |||
519 | .svhs = 2, | 527 | .svhs = 2, |
520 | .gpiomask = 15, | 528 | .gpiomask = 15, |
521 | .muxsel = { 2, 3, 1, 1 }, | 529 | .muxsel = { 2, 3, 1, 1 }, |
522 | .audiomux = { 13, 14, 11, 7, 0, 0 }, | 530 | .gpiomux = { 13, 14, 11, 7 }, |
523 | .needs_tvaudio = 1, | 531 | .needs_tvaudio = 1, |
524 | .msp34xx_alt = 1, | 532 | .msp34xx_alt = 1, |
525 | .pll = PLL_28, | 533 | .pll = PLL_28, |
@@ -537,7 +545,8 @@ struct tvcard bttv_tvcards[] = { | |||
537 | .svhs = 2, | 545 | .svhs = 2, |
538 | .gpiomask = 7, | 546 | .gpiomask = 7, |
539 | .muxsel = { 2, 3, 1, 1 }, | 547 | .muxsel = { 2, 3, 1, 1 }, |
540 | .audiomux = { 0, 2, 1, 3, 4 }, /* old: {0, 1, 2, 3, 4} */ | 548 | .gpiomux = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */ |
549 | .gpiomute = 4, | ||
541 | .needs_tvaudio = 1, | 550 | .needs_tvaudio = 1, |
542 | .pll = PLL_28, | 551 | .pll = PLL_28, |
543 | .tuner_type = -1, | 552 | .tuner_type = -1, |
@@ -552,7 +561,8 @@ struct tvcard bttv_tvcards[] = { | |||
552 | .svhs = 2, | 561 | .svhs = 2, |
553 | .gpiomask = 15, | 562 | .gpiomask = 15, |
554 | .muxsel = { 2, 3, 1, 1 }, | 563 | .muxsel = { 2, 3, 1, 1 }, |
555 | .audiomux = { 0 , 0, 1 , 0, 10 }, | 564 | .gpiomux = { 0, 0, 1, 0 }, |
565 | .gpiomute = 10, | ||
556 | .needs_tvaudio = 1, | 566 | .needs_tvaudio = 1, |
557 | .tuner_type = -1, | 567 | .tuner_type = -1, |
558 | .tuner_addr = ADDR_UNSET, | 568 | .tuner_addr = ADDR_UNSET, |
@@ -570,10 +580,11 @@ struct tvcard bttv_tvcards[] = { | |||
570 | .muxsel = { 2, 3, 1, 1 }, | 580 | .muxsel = { 2, 3, 1, 1 }, |
571 | #if 0 | 581 | #if 0 |
572 | /* old */ | 582 | /* old */ |
573 | .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 }, | 583 | .gpiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000 }, |
574 | #else | 584 | #else |
575 | /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */ | 585 | /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */ |
576 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, | 586 | .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, |
587 | .gpiomute = 0x002000, | ||
577 | #endif | 588 | #endif |
578 | .needs_tvaudio = 1, | 589 | .needs_tvaudio = 1, |
579 | .pll = PLL_28, | 590 | .pll = PLL_28, |
@@ -587,7 +598,8 @@ struct tvcard bttv_tvcards[] = { | |||
587 | .svhs = 2, | 598 | .svhs = 2, |
588 | .gpiomask = 0x8300f8, | 599 | .gpiomask = 0x8300f8, |
589 | .muxsel = { 2, 3, 1, 1,0 }, | 600 | .muxsel = { 2, 3, 1, 1,0 }, |
590 | .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007 }, | 601 | .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 }, |
602 | .gpiomute = 0xcfa007, | ||
591 | .needs_tvaudio = 1, | 603 | .needs_tvaudio = 1, |
592 | .tuner_type = -1, | 604 | .tuner_type = -1, |
593 | .tuner_addr = ADDR_UNSET, | 605 | .tuner_addr = ADDR_UNSET, |
@@ -603,7 +615,7 @@ struct tvcard bttv_tvcards[] = { | |||
603 | .svhs = 2, | 615 | .svhs = 2, |
604 | .gpiomask = 0, | 616 | .gpiomask = 0, |
605 | .muxsel = { 2, 3, 1, 1 }, | 617 | .muxsel = { 2, 3, 1, 1 }, |
606 | .audiomux = { 1, 0, 0, 0, 0 }, | 618 | .gpiomux = { 1, 0, 0, 0 }, |
607 | .needs_tvaudio = 1, | 619 | .needs_tvaudio = 1, |
608 | .tuner_type = -1, | 620 | .tuner_type = -1, |
609 | .tuner_addr = ADDR_UNSET, | 621 | .tuner_addr = ADDR_UNSET, |
@@ -617,7 +629,7 @@ struct tvcard bttv_tvcards[] = { | |||
617 | .svhs = -1, | 629 | .svhs = -1, |
618 | .gpiomask = 0x8dff00, | 630 | .gpiomask = 0x8dff00, |
619 | .muxsel = { 2, 3, 1, 1 }, | 631 | .muxsel = { 2, 3, 1, 1 }, |
620 | .audiomux = { 0 }, | 632 | .gpiomux = { 0 }, |
621 | .no_msp34xx = 1, | 633 | .no_msp34xx = 1, |
622 | .tuner_type = -1, | 634 | .tuner_type = -1, |
623 | .tuner_addr = ADDR_UNSET, | 635 | .tuner_addr = ADDR_UNSET, |
@@ -644,7 +656,8 @@ struct tvcard bttv_tvcards[] = { | |||
644 | .svhs = 2, | 656 | .svhs = 2, |
645 | .gpiomask = 0x1800, | 657 | .gpiomask = 0x1800, |
646 | .muxsel = { 2, 3, 1, 1 }, | 658 | .muxsel = { 2, 3, 1, 1 }, |
647 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, | 659 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
660 | .gpiomute = 0x1800, | ||
648 | .pll = PLL_28, | 661 | .pll = PLL_28, |
649 | .tuner_type = TUNER_PHILIPS_PAL_I, | 662 | .tuner_type = TUNER_PHILIPS_PAL_I, |
650 | .tuner_addr = ADDR_UNSET, | 663 | .tuner_addr = ADDR_UNSET, |
@@ -658,7 +671,8 @@ struct tvcard bttv_tvcards[] = { | |||
658 | .svhs = 2, | 671 | .svhs = 2, |
659 | .gpiomask = 0xc00, | 672 | .gpiomask = 0xc00, |
660 | .muxsel = { 2, 3, 1, 1 }, | 673 | .muxsel = { 2, 3, 1, 1 }, |
661 | .audiomux = { 0, 1, 0x800, 0x400, 0xc00, 0 }, | 674 | .gpiomux = { 0, 1, 0x800, 0x400 }, |
675 | .gpiomute = 0xc00, | ||
662 | .needs_tvaudio = 1, | 676 | .needs_tvaudio = 1, |
663 | .pll = PLL_28, | 677 | .pll = PLL_28, |
664 | .tuner_type = -1, | 678 | .tuner_type = -1, |
@@ -674,7 +688,7 @@ struct tvcard bttv_tvcards[] = { | |||
674 | .gpiomask = 7, | 688 | .gpiomask = 7, |
675 | .muxsel = { 2, 3, -1 }, | 689 | .muxsel = { 2, 3, -1 }, |
676 | .digital_mode = DIGITAL_MODE_CAMERA, | 690 | .digital_mode = DIGITAL_MODE_CAMERA, |
677 | .audiomux = { 0, 0, 0, 0, 0 }, | 691 | .gpiomux = { 0, 0, 0, 0 }, |
678 | .no_msp34xx = 1, | 692 | .no_msp34xx = 1, |
679 | .pll = PLL_28, | 693 | .pll = PLL_28, |
680 | .tuner_type = TUNER_ALPS_TSBB5_PAL_I, | 694 | .tuner_type = TUNER_ALPS_TSBB5_PAL_I, |
@@ -691,7 +705,8 @@ struct tvcard bttv_tvcards[] = { | |||
691 | .svhs = 2, | 705 | .svhs = 2, |
692 | .gpiomask = 0xe00, | 706 | .gpiomask = 0xe00, |
693 | .muxsel = { 2, 3, 1, 1 }, | 707 | .muxsel = { 2, 3, 1, 1 }, |
694 | .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00 }, | 708 | .gpiomux = {0x400, 0x400, 0x400, 0x400 }, |
709 | .gpiomute = 0xc00, | ||
695 | .needs_tvaudio = 1, | 710 | .needs_tvaudio = 1, |
696 | .pll = PLL_28, | 711 | .pll = PLL_28, |
697 | .tuner_type = -1, | 712 | .tuner_type = -1, |
@@ -707,7 +722,8 @@ struct tvcard bttv_tvcards[] = { | |||
707 | .svhs = 2, | 722 | .svhs = 2, |
708 | .gpiomask = 0x1f0fff, | 723 | .gpiomask = 0x1f0fff, |
709 | .muxsel = { 2, 3, 1, 1 }, | 724 | .muxsel = { 2, 3, 1, 1 }, |
710 | .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000 }, | 725 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, |
726 | .gpiomute = 0x40000, | ||
711 | .needs_tvaudio = 0, | 727 | .needs_tvaudio = 0, |
712 | .tuner_type = TUNER_PHILIPS_PAL, | 728 | .tuner_type = TUNER_PHILIPS_PAL, |
713 | .tuner_addr = ADDR_UNSET, | 729 | .tuner_addr = ADDR_UNSET, |
@@ -722,7 +738,8 @@ struct tvcard bttv_tvcards[] = { | |||
722 | .svhs = 3, | 738 | .svhs = 3, |
723 | .gpiomask = 7, | 739 | .gpiomask = 7, |
724 | .muxsel = { 2, 0, 1, 1 }, | 740 | .muxsel = { 2, 0, 1, 1 }, |
725 | .audiomux = { 0, 1, 2, 3, 4 }, | 741 | .gpiomux = { 0, 1, 2, 3 }, |
742 | .gpiomute = 4, | ||
726 | .needs_tvaudio = 1, | 743 | .needs_tvaudio = 1, |
727 | .tuner_type = -1, | 744 | .tuner_type = -1, |
728 | .tuner_addr = ADDR_UNSET, | 745 | .tuner_addr = ADDR_UNSET, |
@@ -736,7 +753,8 @@ struct tvcard bttv_tvcards[] = { | |||
736 | .svhs = 2, | 753 | .svhs = 2, |
737 | .gpiomask = 0x1800, | 754 | .gpiomask = 0x1800, |
738 | .muxsel = { 2, 3, 1, 1 }, | 755 | .muxsel = { 2, 3, 1, 1 }, |
739 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, | 756 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
757 | .gpiomute = 0x1800, | ||
740 | .pll = PLL_28, | 758 | .pll = PLL_28, |
741 | .tuner_type = TUNER_PHILIPS_SECAM, | 759 | .tuner_type = TUNER_PHILIPS_SECAM, |
742 | .tuner_addr = ADDR_UNSET, | 760 | .tuner_addr = ADDR_UNSET, |
@@ -752,7 +770,8 @@ struct tvcard bttv_tvcards[] = { | |||
752 | .svhs = 2, | 770 | .svhs = 2, |
753 | .gpiomask = 0x1f0fff, | 771 | .gpiomask = 0x1f0fff, |
754 | .muxsel = { 2, 3, 1, 1 }, | 772 | .muxsel = { 2, 3, 1, 1 }, |
755 | .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000 }, | 773 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0x00000 }, |
774 | .gpiomute = 0x40000, | ||
756 | .needs_tvaudio = 0, | 775 | .needs_tvaudio = 0, |
757 | .tuner_type = TUNER_PHILIPS_PAL, | 776 | .tuner_type = TUNER_PHILIPS_PAL, |
758 | .tuner_addr = ADDR_UNSET, | 777 | .tuner_addr = ADDR_UNSET, |
@@ -799,7 +818,7 @@ struct tvcard bttv_tvcards[] = { | |||
799 | .svhs = 1, /* was: 4 */ | 818 | .svhs = 1, /* was: 4 */ |
800 | .gpiomask = 0, | 819 | .gpiomask = 0, |
801 | .muxsel = { 2, 3, 1, 0, 0}, | 820 | .muxsel = { 2, 3, 1, 0, 0}, |
802 | .audiomux = { 0 }, | 821 | .gpiomux = { 0 }, |
803 | .needs_tvaudio = 1, | 822 | .needs_tvaudio = 1, |
804 | .tuner_type = -1, | 823 | .tuner_type = -1, |
805 | .tuner_addr = ADDR_UNSET, | 824 | .tuner_addr = ADDR_UNSET, |
@@ -815,7 +834,8 @@ struct tvcard bttv_tvcards[] = { | |||
815 | .svhs = 2, | 834 | .svhs = 2, |
816 | .gpiomask = 0x1800, /* 0x8dfe00 */ | 835 | .gpiomask = 0x1800, /* 0x8dfe00 */ |
817 | .muxsel = { 2, 3, 1, 1 }, | 836 | .muxsel = { 2, 3, 1, 1 }, |
818 | .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 }, | 837 | .gpiomux = { 0, 0x0800, 0x1000, 0x1000 }, |
838 | .gpiomute = 0x1800, | ||
819 | .pll = PLL_28, | 839 | .pll = PLL_28, |
820 | .tuner_type = -1, | 840 | .tuner_type = -1, |
821 | .tuner_addr = ADDR_UNSET, | 841 | .tuner_addr = ADDR_UNSET, |
@@ -829,7 +849,7 @@ struct tvcard bttv_tvcards[] = { | |||
829 | .svhs = 3, | 849 | .svhs = 3, |
830 | .gpiomask = 1, | 850 | .gpiomask = 1, |
831 | .muxsel = { 2, 3, 1, 1 }, | 851 | .muxsel = { 2, 3, 1, 1 }, |
832 | .audiomux = { 1, 0, 0, 0, 0 }, | 852 | .gpiomux = { 1, 0, 0, 0 }, |
833 | .pll = PLL_28, | 853 | .pll = PLL_28, |
834 | .tuner_type = TUNER_PHILIPS_PAL, | 854 | .tuner_type = TUNER_PHILIPS_PAL, |
835 | .tuner_addr = ADDR_UNSET, | 855 | .tuner_addr = ADDR_UNSET, |
@@ -845,7 +865,7 @@ struct tvcard bttv_tvcards[] = { | |||
845 | .svhs = 2, | 865 | .svhs = 2, |
846 | .gpiomask = 0, | 866 | .gpiomask = 0, |
847 | .muxsel = { 2, 3, 1, 1 }, | 867 | .muxsel = { 2, 3, 1, 1 }, |
848 | .audiomux = { 0 }, | 868 | .gpiomux = { 0 }, |
849 | .needs_tvaudio = 0, | 869 | .needs_tvaudio = 0, |
850 | .tuner_type = 4, | 870 | .tuner_type = 4, |
851 | .tuner_addr = ADDR_UNSET, | 871 | .tuner_addr = ADDR_UNSET, |
@@ -859,7 +879,8 @@ struct tvcard bttv_tvcards[] = { | |||
859 | .svhs = 2, | 879 | .svhs = 2, |
860 | .gpiomask = 0xffff00, | 880 | .gpiomask = 0xffff00, |
861 | .muxsel = { 2, 3, 1, 1 }, | 881 | .muxsel = { 2, 3, 1, 1 }, |
862 | .audiomux = { 0x500, 0, 0x300, 0x900, 0x900 }, | 882 | .gpiomux = { 0x500, 0, 0x300, 0x900 }, |
883 | .gpiomute = 0x900, | ||
863 | .needs_tvaudio = 1, | 884 | .needs_tvaudio = 1, |
864 | .pll = PLL_28, | 885 | .pll = PLL_28, |
865 | .tuner_type = TUNER_PHILIPS_PAL, | 886 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -875,11 +896,12 @@ struct tvcard bttv_tvcards[] = { | |||
875 | .muxsel = { 2, 3, 1, 1, 0 }, /* TV, CVid, SVid, CVid over SVid connector */ | 896 | .muxsel = { 2, 3, 1, 1, 0 }, /* TV, CVid, SVid, CVid over SVid connector */ |
876 | #if 0 | 897 | #if 0 |
877 | .gpiomask = 0xc33000, | 898 | .gpiomask = 0xc33000, |
878 | .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 }, | 899 | .gpiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 }, |
879 | #else | 900 | #else |
880 | /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ | 901 | /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ |
881 | .gpiomask = 0xb33000, | 902 | .gpiomask = 0xb33000, |
882 | .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, | 903 | .gpiomux = { 0x122000,0x1000,0x0000,0x620000 }, |
904 | .gpiomute = 0x800000, | ||
883 | #endif | 905 | #endif |
884 | /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) | 906 | /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) |
885 | gpio23 -- hef4052:nEnable (0x800000) | 907 | gpio23 -- hef4052:nEnable (0x800000) |
@@ -909,7 +931,8 @@ struct tvcard bttv_tvcards[] = { | |||
909 | .svhs = 2, | 931 | .svhs = 2, |
910 | .gpiomask = 0x1800, | 932 | .gpiomask = 0x1800, |
911 | .muxsel = { 2, 3, 1, 1 }, | 933 | .muxsel = { 2, 3, 1, 1 }, |
912 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, | 934 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
935 | .gpiomute = 0x1800, | ||
913 | .pll = PLL_28, | 936 | .pll = PLL_28, |
914 | .tuner_type = -1, | 937 | .tuner_type = -1, |
915 | .tuner_addr = ADDR_UNSET, | 938 | .tuner_addr = ADDR_UNSET, |
@@ -925,7 +948,8 @@ struct tvcard bttv_tvcards[] = { | |||
925 | .svhs = 2, | 948 | .svhs = 2, |
926 | .gpiomask = 0x1800, | 949 | .gpiomask = 0x1800, |
927 | .muxsel = { 2, 3, 1, 1 }, | 950 | .muxsel = { 2, 3, 1, 1 }, |
928 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, | 951 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
952 | .gpiomute = 0x1800, | ||
929 | .pll = PLL_28, | 953 | .pll = PLL_28, |
930 | .tuner_type = -1, | 954 | .tuner_type = -1, |
931 | .tuner_addr = ADDR_UNSET, | 955 | .tuner_addr = ADDR_UNSET, |
@@ -940,7 +964,8 @@ struct tvcard bttv_tvcards[] = { | |||
940 | .svhs = 2, | 964 | .svhs = 2, |
941 | .gpiomask = 0xff, | 965 | .gpiomask = 0xff, |
942 | .muxsel = { 2, 3, 1, 1 }, | 966 | .muxsel = { 2, 3, 1, 1 }, |
943 | .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, | 967 | .gpiomux = { 0x21, 0x20, 0x24, 0x2c }, |
968 | .gpiomute = 0x29, | ||
944 | .no_msp34xx = 1, | 969 | .no_msp34xx = 1, |
945 | .pll = PLL_28, | 970 | .pll = PLL_28, |
946 | .tuner_type = -1, | 971 | .tuner_type = -1, |
@@ -955,7 +980,8 @@ struct tvcard bttv_tvcards[] = { | |||
955 | .svhs = 2, | 980 | .svhs = 2, |
956 | .gpiomask = 0x551e00, | 981 | .gpiomask = 0x551e00, |
957 | .muxsel = { 2, 3, 1, 0 }, | 982 | .muxsel = { 2, 3, 1, 0 }, |
958 | .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 }, | 983 | .gpiomux = { 0x551400, 0x551200, 0, 0 }, |
984 | .gpiomute = 0x551c00, | ||
959 | .needs_tvaudio = 1, | 985 | .needs_tvaudio = 1, |
960 | .pll = PLL_28, | 986 | .pll = PLL_28, |
961 | .tuner_type = 1, | 987 | .tuner_type = 1, |
@@ -971,7 +997,8 @@ struct tvcard bttv_tvcards[] = { | |||
971 | .svhs = 2, | 997 | .svhs = 2, |
972 | .gpiomask = 0x03000F, | 998 | .gpiomask = 0x03000F, |
973 | .muxsel = { 2, 3, 1, 1 }, | 999 | .muxsel = { 2, 3, 1, 1 }, |
974 | .audiomux = { 2, 0xd0001, 0, 0, 1 }, | 1000 | .gpiomux = { 2, 0xd0001, 0, 0 }, |
1001 | .gpiomute = 1, | ||
975 | .needs_tvaudio = 0, | 1002 | .needs_tvaudio = 0, |
976 | .pll = PLL_28, | 1003 | .pll = PLL_28, |
977 | .tuner_type = -1, | 1004 | .tuner_type = -1, |
@@ -988,7 +1015,8 @@ struct tvcard bttv_tvcards[] = { | |||
988 | .svhs = 2, | 1015 | .svhs = 2, |
989 | .gpiomask = 7, | 1016 | .gpiomask = 7, |
990 | .muxsel = { 2, 3, 1, 1 }, | 1017 | .muxsel = { 2, 3, 1, 1 }, |
991 | .audiomux = { 4, 0, 2, 3, 1 }, | 1018 | .gpiomux = { 4, 0, 2, 3 }, |
1019 | .gpiomute = 1, | ||
992 | .no_msp34xx = 1, | 1020 | .no_msp34xx = 1, |
993 | .needs_tvaudio = 1, | 1021 | .needs_tvaudio = 1, |
994 | .tuner_type = TUNER_PHILIPS_NTSC, | 1022 | .tuner_type = TUNER_PHILIPS_NTSC, |
@@ -1005,7 +1033,7 @@ struct tvcard bttv_tvcards[] = { | |||
1005 | .svhs = 2, | 1033 | .svhs = 2, |
1006 | .gpiomask = 15, | 1034 | .gpiomask = 15, |
1007 | .muxsel = { 2, 3, 1, 1 }, | 1035 | .muxsel = { 2, 3, 1, 1 }, |
1008 | .audiomux = { 13, 4, 11, 7, 0, 0 }, | 1036 | .gpiomux = { 13, 4, 11, 7 }, |
1009 | .needs_tvaudio = 1, | 1037 | .needs_tvaudio = 1, |
1010 | .pll = PLL_28, | 1038 | .pll = PLL_28, |
1011 | .tuner_type = -1, | 1039 | .tuner_type = -1, |
@@ -1022,7 +1050,7 @@ struct tvcard bttv_tvcards[] = { | |||
1022 | .svhs = 2, | 1050 | .svhs = 2, |
1023 | .gpiomask = 0, | 1051 | .gpiomask = 0, |
1024 | .muxsel = { 2, 3, 1, 1}, | 1052 | .muxsel = { 2, 3, 1, 1}, |
1025 | .audiomux = { 0, 0, 0, 0, 0}, | 1053 | .gpiomux = { 0, 0, 0, 0}, |
1026 | .needs_tvaudio = 1, | 1054 | .needs_tvaudio = 1, |
1027 | .no_msp34xx = 1, | 1055 | .no_msp34xx = 1, |
1028 | .pll = PLL_28, | 1056 | .pll = PLL_28, |
@@ -1038,7 +1066,8 @@ struct tvcard bttv_tvcards[] = { | |||
1038 | .svhs = 2, | 1066 | .svhs = 2, |
1039 | .gpiomask = 0xe00b, | 1067 | .gpiomask = 0xe00b, |
1040 | .muxsel = { 2, 3, 1, 1 }, | 1068 | .muxsel = { 2, 3, 1, 1 }, |
1041 | .audiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc }, | 1069 | .gpiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0 }, |
1070 | .gpiomute = 0xff3ffc, | ||
1042 | .no_msp34xx = 1, | 1071 | .no_msp34xx = 1, |
1043 | .tuner_type = -1, | 1072 | .tuner_type = -1, |
1044 | .tuner_addr = ADDR_UNSET, | 1073 | .tuner_addr = ADDR_UNSET, |
@@ -1054,7 +1083,8 @@ struct tvcard bttv_tvcards[] = { | |||
1054 | .svhs = -1, | 1083 | .svhs = -1, |
1055 | .gpiomask = 3, | 1084 | .gpiomask = 3, |
1056 | .muxsel = { 2, 3, 1, 1 }, | 1085 | .muxsel = { 2, 3, 1, 1 }, |
1057 | .audiomux = { 1, 1, 0, 2, 3 }, | 1086 | .gpiomux = { 1, 1, 0, 2 }, |
1087 | .gpiomute = 3, | ||
1058 | .no_msp34xx = 1, | 1088 | .no_msp34xx = 1, |
1059 | .pll = PLL_NONE, | 1089 | .pll = PLL_NONE, |
1060 | .tuner_type = -1, | 1090 | .tuner_type = -1, |
@@ -1069,7 +1099,7 @@ struct tvcard bttv_tvcards[] = { | |||
1069 | .svhs = 3, | 1099 | .svhs = 3, |
1070 | .gpiomask = 0, | 1100 | .gpiomask = 0, |
1071 | .muxsel = { 2, 3, 1, 0, 0 }, | 1101 | .muxsel = { 2, 3, 1, 0, 0 }, |
1072 | .audiomux = { 0 }, | 1102 | .gpiomux = { 0 }, |
1073 | .no_msp34xx = 1, | 1103 | .no_msp34xx = 1, |
1074 | .pll = PLL_28, | 1104 | .pll = PLL_28, |
1075 | .tuner_type = -1, | 1105 | .tuner_type = -1, |
@@ -1084,7 +1114,8 @@ struct tvcard bttv_tvcards[] = { | |||
1084 | .svhs = 2, | 1114 | .svhs = 2, |
1085 | .gpiomask = 0xbcf03f, | 1115 | .gpiomask = 0xbcf03f, |
1086 | .muxsel = { 2, 3, 1, 1 }, | 1116 | .muxsel = { 2, 3, 1, 1 }, |
1087 | .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f }, | 1117 | .gpiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0 }, |
1118 | .gpiomute = 0xbcb03f, | ||
1088 | .no_msp34xx = 1, | 1119 | .no_msp34xx = 1, |
1089 | .pll = PLL_28, | 1120 | .pll = PLL_28, |
1090 | .tuner_type = 21, | 1121 | .tuner_type = 21, |
@@ -1099,7 +1130,8 @@ struct tvcard bttv_tvcards[] = { | |||
1099 | .svhs = 2, | 1130 | .svhs = 2, |
1100 | .gpiomask = 0x70000, | 1131 | .gpiomask = 0x70000, |
1101 | .muxsel = { 2, 3, 1, 1 }, | 1132 | .muxsel = { 2, 3, 1, 1 }, |
1102 | .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 }, | 1133 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, |
1134 | .gpiomute = 0x40000, | ||
1103 | .needs_tvaudio = 1, | 1135 | .needs_tvaudio = 1, |
1104 | .no_msp34xx = 1, | 1136 | .no_msp34xx = 1, |
1105 | .pll = PLL_35, | 1137 | .pll = PLL_35, |
@@ -1118,7 +1150,8 @@ struct tvcard bttv_tvcards[] = { | |||
1118 | .svhs = 2, | 1150 | .svhs = 2, |
1119 | .gpiomask = 15, | 1151 | .gpiomask = 15, |
1120 | .muxsel = { 2, 3, 1, 1 }, | 1152 | .muxsel = { 2, 3, 1, 1 }, |
1121 | .audiomux = {2,0,0,0,1 }, | 1153 | .gpiomux = {2,0,0,0 }, |
1154 | .gpiomute = 1, | ||
1122 | .needs_tvaudio = 1, | 1155 | .needs_tvaudio = 1, |
1123 | .pll = PLL_28, | 1156 | .pll = PLL_28, |
1124 | .tuner_type = -1, | 1157 | .tuner_type = -1, |
@@ -1133,7 +1166,7 @@ struct tvcard bttv_tvcards[] = { | |||
1133 | .svhs = 2, | 1166 | .svhs = 2, |
1134 | .gpiomask = 0x010f00, | 1167 | .gpiomask = 0x010f00, |
1135 | .muxsel = {2, 3, 0, 0 }, | 1168 | .muxsel = {2, 3, 0, 0 }, |
1136 | .audiomux = {0x10000, 0, 0x10000, 0, 0, 0 }, | 1169 | .gpiomux = {0x10000, 0, 0x10000, 0 }, |
1137 | .no_msp34xx = 1, | 1170 | .no_msp34xx = 1, |
1138 | .pll = PLL_28, | 1171 | .pll = PLL_28, |
1139 | .tuner_type = TUNER_ALPS_TSHC6_NTSC, | 1172 | .tuner_type = TUNER_ALPS_TSHC6_NTSC, |
@@ -1150,7 +1183,8 @@ struct tvcard bttv_tvcards[] = { | |||
1150 | .gpiomask = 0xAA0000, | 1183 | .gpiomask = 0xAA0000, |
1151 | .muxsel = { 2,3,1,1,-1 }, | 1184 | .muxsel = { 2,3,1,1,-1 }, |
1152 | .digital_mode = DIGITAL_MODE_CAMERA, | 1185 | .digital_mode = DIGITAL_MODE_CAMERA, |
1153 | .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 }, | 1186 | .gpiomux = { 0x20000, 0, 0x80000, 0x80000 }, |
1187 | .gpiomute = 0xa8000, | ||
1154 | .no_msp34xx = 1, | 1188 | .no_msp34xx = 1, |
1155 | .pll = PLL_28, | 1189 | .pll = PLL_28, |
1156 | .tuner_type = TUNER_PHILIPS_PAL_I, | 1190 | .tuner_type = TUNER_PHILIPS_PAL_I, |
@@ -1175,7 +1209,8 @@ struct tvcard bttv_tvcards[] = { | |||
1175 | .svhs = 2, | 1209 | .svhs = 2, |
1176 | .gpiomask = 7, | 1210 | .gpiomask = 7, |
1177 | .muxsel = { 2, 0, 1, 1 }, | 1211 | .muxsel = { 2, 0, 1, 1 }, |
1178 | .audiomux = { 0, 1, 2, 3, 4 }, | 1212 | .gpiomux = { 0, 1, 2, 3 }, |
1213 | .gpiomute = 4, | ||
1179 | .pll = PLL_28, | 1214 | .pll = PLL_28, |
1180 | .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, | 1215 | .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, |
1181 | .tuner_addr = ADDR_UNSET, | 1216 | .tuner_addr = ADDR_UNSET, |
@@ -1192,7 +1227,8 @@ struct tvcard bttv_tvcards[] = { | |||
1192 | .svhs = 3, | 1227 | .svhs = 3, |
1193 | .gpiomask = 0x03000F, | 1228 | .gpiomask = 0x03000F, |
1194 | .muxsel = { 2, 3, 1, 1 }, | 1229 | .muxsel = { 2, 3, 1, 1 }, |
1195 | .audiomux = { 1, 0xd0001, 0, 0, 10 }, | 1230 | .gpiomux = { 1, 0xd0001, 0, 0 }, |
1231 | .gpiomute = 10, | ||
1196 | /* sound path (5 sources): | 1232 | /* sound path (5 sources): |
1197 | MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable) | 1233 | MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable) |
1198 | 0= ext. Audio IN | 1234 | 0= ext. Audio IN |
@@ -1218,7 +1254,8 @@ struct tvcard bttv_tvcards[] = { | |||
1218 | .svhs = 2, | 1254 | .svhs = 2, |
1219 | .gpiomask = 0x1c, | 1255 | .gpiomask = 0x1c, |
1220 | .muxsel = { 2, 3, 1, 1 }, | 1256 | .muxsel = { 2, 3, 1, 1 }, |
1221 | .audiomux = { 0, 0, 0x10, 8, 4 }, | 1257 | .gpiomux = { 0, 0, 0x10, 8 }, |
1258 | .gpiomute = 4, | ||
1222 | .needs_tvaudio = 1, | 1259 | .needs_tvaudio = 1, |
1223 | .pll = PLL_28, | 1260 | .pll = PLL_28, |
1224 | .tuner_type = TUNER_PHILIPS_PAL, | 1261 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -1230,7 +1267,7 @@ struct tvcard bttv_tvcards[] = { | |||
1230 | /* Tim Röstermundt <rosterm@uni-muenster.de> | 1267 | /* Tim Röstermundt <rosterm@uni-muenster.de> |
1231 | in de.comp.os.unix.linux.hardware: | 1268 | in de.comp.os.unix.linux.hardware: |
1232 | options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 | 1269 | options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 |
1233 | audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff | 1270 | gpiomux =0x44c71f,0x44d71f,0,0x44d71f,0x44dfff |
1234 | options tuner type=5 */ | 1271 | options tuner type=5 */ |
1235 | .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]", | 1272 | .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]", |
1236 | .video_inputs = 4, | 1273 | .video_inputs = 4, |
@@ -1239,7 +1276,8 @@ struct tvcard bttv_tvcards[] = { | |||
1239 | .svhs = 2, | 1276 | .svhs = 2, |
1240 | .gpiomask = 0x18e0, | 1277 | .gpiomask = 0x18e0, |
1241 | .muxsel = { 2, 3, 1, 1 }, | 1278 | .muxsel = { 2, 3, 1, 1 }, |
1242 | .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 }, | 1279 | .gpiomux = { 0x0000,0x0800,0x1000,0x1000 }, |
1280 | .gpiomute = 0x18e0, | ||
1243 | /* For cards with tda9820/tda9821: | 1281 | /* For cards with tda9820/tda9821: |
1244 | 0x0000: Tuner normal stereo | 1282 | 0x0000: Tuner normal stereo |
1245 | 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) | 1283 | 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) |
@@ -1259,7 +1297,8 @@ struct tvcard bttv_tvcards[] = { | |||
1259 | .svhs = 2, | 1297 | .svhs = 2, |
1260 | .gpiomask = 0xF, | 1298 | .gpiomask = 0xF, |
1261 | .muxsel = { 2, 3, 1, 0 }, | 1299 | .muxsel = { 2, 3, 1, 0 }, |
1262 | .audiomux = { 2, 0, 0, 0, 10 }, | 1300 | .gpiomux = { 2, 0, 0, 0 }, |
1301 | .gpiomute = 10, | ||
1263 | .needs_tvaudio = 0, | 1302 | .needs_tvaudio = 0, |
1264 | .pll = PLL_28, | 1303 | .pll = PLL_28, |
1265 | .tuner_type = TUNER_TEMIC_PAL, | 1304 | .tuner_type = TUNER_TEMIC_PAL, |
@@ -1277,7 +1316,8 @@ struct tvcard bttv_tvcards[] = { | |||
1277 | .svhs = 2, | 1316 | .svhs = 2, |
1278 | .gpiomask = 0x1800, | 1317 | .gpiomask = 0x1800, |
1279 | .muxsel = { 2, 3, 1, 1 }, | 1318 | .muxsel = { 2, 3, 1, 1 }, |
1280 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, | 1319 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
1320 | .gpiomute = 0x1800, | ||
1281 | .pll = PLL_28, | 1321 | .pll = PLL_28, |
1282 | .tuner_type = 5, | 1322 | .tuner_type = 5, |
1283 | .tuner_addr = ADDR_UNSET, | 1323 | .tuner_addr = ADDR_UNSET, |
@@ -1294,7 +1334,7 @@ struct tvcard bttv_tvcards[] = { | |||
1294 | .svhs = 1, | 1334 | .svhs = 1, |
1295 | .gpiomask = 0, | 1335 | .gpiomask = 0, |
1296 | .muxsel = { 3, 1 }, | 1336 | .muxsel = { 3, 1 }, |
1297 | .audiomux = { 0 }, | 1337 | .gpiomux = { 0 }, |
1298 | .needs_tvaudio = 0, | 1338 | .needs_tvaudio = 0, |
1299 | .no_msp34xx = 1, | 1339 | .no_msp34xx = 1, |
1300 | .pll = PLL_35, | 1340 | .pll = PLL_35, |
@@ -1311,7 +1351,8 @@ struct tvcard bttv_tvcards[] = { | |||
1311 | .svhs = 2, | 1351 | .svhs = 2, |
1312 | .gpiomask = 0xe00, | 1352 | .gpiomask = 0xe00, |
1313 | .muxsel = { 2, 3, 1, 1}, | 1353 | .muxsel = { 2, 3, 1, 1}, |
1314 | .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 }, | 1354 | .gpiomux = { 0x400, 0x400, 0x400, 0x400 }, |
1355 | .gpiomute = 0x800, | ||
1315 | .needs_tvaudio = 1, | 1356 | .needs_tvaudio = 1, |
1316 | .pll = PLL_28, | 1357 | .pll = PLL_28, |
1317 | .tuner_type = TUNER_TEMIC_4036FY5_NTSC, | 1358 | .tuner_type = TUNER_TEMIC_4036FY5_NTSC, |
@@ -1327,7 +1368,8 @@ struct tvcard bttv_tvcards[] = { | |||
1327 | .svhs = 2, | 1368 | .svhs = 2, |
1328 | .gpiomask = 0x03000F, | 1369 | .gpiomask = 0x03000F, |
1329 | .muxsel = { 2, 3, 1, 0 }, | 1370 | .muxsel = { 2, 3, 1, 0 }, |
1330 | .audiomux = { 2, 0, 0, 0, 1 }, | 1371 | .gpiomux = { 2, 0, 0, 0 }, |
1372 | .gpiomute = 1, | ||
1331 | .pll = PLL_28, | 1373 | .pll = PLL_28, |
1332 | .tuner_type = 0, | 1374 | .tuner_type = 0, |
1333 | .tuner_addr = ADDR_UNSET, | 1375 | .tuner_addr = ADDR_UNSET, |
@@ -1344,7 +1386,8 @@ struct tvcard bttv_tvcards[] = { | |||
1344 | .svhs = -1, | 1386 | .svhs = -1, |
1345 | .gpiomask = 11, | 1387 | .gpiomask = 11, |
1346 | .muxsel = { 2, 3, 1, 1 }, | 1388 | .muxsel = { 2, 3, 1, 1 }, |
1347 | .audiomux = { 2, 0, 0, 1, 8 }, | 1389 | .gpiomux = { 2, 0, 0, 1 }, |
1390 | .gpiomute = 8, | ||
1348 | .pll = PLL_35, | 1391 | .pll = PLL_35, |
1349 | .tuner_type = TUNER_TEMIC_PAL, | 1392 | .tuner_type = TUNER_TEMIC_PAL, |
1350 | .tuner_addr = ADDR_UNSET, | 1393 | .tuner_addr = ADDR_UNSET, |
@@ -1359,7 +1402,7 @@ struct tvcard bttv_tvcards[] = { | |||
1359 | .svhs = 1, | 1402 | .svhs = 1, |
1360 | .gpiomask = 0xF, | 1403 | .gpiomask = 0xF, |
1361 | .muxsel = { 2, 2 }, | 1404 | .muxsel = { 2, 2 }, |
1362 | .audiomux = { }, | 1405 | .gpiomux = { }, |
1363 | .no_msp34xx = 1, | 1406 | .no_msp34xx = 1, |
1364 | .needs_tvaudio = 0, | 1407 | .needs_tvaudio = 0, |
1365 | .pll = PLL_28, | 1408 | .pll = PLL_28, |
@@ -1378,7 +1421,8 @@ struct tvcard bttv_tvcards[] = { | |||
1378 | .svhs = 2, | 1421 | .svhs = 2, |
1379 | .gpiomask = 0xFF, | 1422 | .gpiomask = 0xFF, |
1380 | .muxsel = { 2, 3, 1, 0 }, | 1423 | .muxsel = { 2, 3, 1, 0 }, |
1381 | .audiomux = { 1, 0, 4, 4, 9 }, | 1424 | .gpiomux = { 1, 0, 4, 4 }, |
1425 | .gpiomute = 9, | ||
1382 | .needs_tvaudio = 0, | 1426 | .needs_tvaudio = 0, |
1383 | .pll = PLL_28, | 1427 | .pll = PLL_28, |
1384 | .tuner_type = TUNER_PHILIPS_PAL, | 1428 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -1394,7 +1438,8 @@ struct tvcard bttv_tvcards[] = { | |||
1394 | .svhs = 2, | 1438 | .svhs = 2, |
1395 | .gpiomask = 0xf03f, | 1439 | .gpiomask = 0xf03f, |
1396 | .muxsel = { 2, 3, 1, 0 }, | 1440 | .muxsel = { 2, 3, 1, 0 }, |
1397 | .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe }, | 1441 | .gpiomux = { 0xbffe, 0, 0xbfff, 0 }, |
1442 | .gpiomute = 0xbffe, | ||
1398 | .pll = PLL_28, | 1443 | .pll = PLL_28, |
1399 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, | 1444 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, |
1400 | .tuner_addr = ADDR_UNSET, | 1445 | .tuner_addr = ADDR_UNSET, |
@@ -1411,7 +1456,7 @@ struct tvcard bttv_tvcards[] = { | |||
1411 | .svhs = -1, | 1456 | .svhs = -1, |
1412 | .gpiomask = 1, | 1457 | .gpiomask = 1, |
1413 | .muxsel = { 2, 3, 0, 1 }, | 1458 | .muxsel = { 2, 3, 0, 1 }, |
1414 | .audiomux = { 0, 0, 1, 0, 0 }, | 1459 | .gpiomux = { 0, 0, 1, 0 }, |
1415 | .no_msp34xx = 1, | 1460 | .no_msp34xx = 1, |
1416 | .pll = PLL_28, | 1461 | .pll = PLL_28, |
1417 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, | 1462 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, |
@@ -1430,7 +1475,8 @@ struct tvcard bttv_tvcards[] = { | |||
1430 | /* Radio changed from 1e80 to 0x800 to make | 1475 | /* Radio changed from 1e80 to 0x800 to make |
1431 | FlyVideo2000S in .hu happy (gm)*/ | 1476 | FlyVideo2000S in .hu happy (gm)*/ |
1432 | /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ | 1477 | /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ |
1433 | .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 }, | 1478 | .gpiomux = { 0x0000,0x0800,0x1000,0x1000 }, |
1479 | .gpiomute = 0x1800, | ||
1434 | .audio_hook = fv2000s_audio, | 1480 | .audio_hook = fv2000s_audio, |
1435 | .no_msp34xx = 1, | 1481 | .no_msp34xx = 1, |
1436 | .no_tda9875 = 1, | 1482 | .no_tda9875 = 1, |
@@ -1448,7 +1494,8 @@ struct tvcard bttv_tvcards[] = { | |||
1448 | .svhs = 2, | 1494 | .svhs = 2, |
1449 | .gpiomask = 0xffff00, | 1495 | .gpiomask = 0xffff00, |
1450 | .muxsel = { 2, 3, 1, 1 }, | 1496 | .muxsel = { 2, 3, 1, 1 }, |
1451 | .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900 }, | 1497 | .gpiomux = { 0x500, 0x500, 0x300, 0x900 }, |
1498 | .gpiomute = 0x900, | ||
1452 | .needs_tvaudio = 1, | 1499 | .needs_tvaudio = 1, |
1453 | .pll = PLL_28, | 1500 | .pll = PLL_28, |
1454 | .tuner_type = TUNER_PHILIPS_PAL, | 1501 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -1465,7 +1512,7 @@ struct tvcard bttv_tvcards[] = { | |||
1465 | .svhs = 2, | 1512 | .svhs = 2, |
1466 | .gpiomask = 0x010f00, | 1513 | .gpiomask = 0x010f00, |
1467 | .muxsel = {2, 3, 0, 0 }, | 1514 | .muxsel = {2, 3, 0, 0 }, |
1468 | .audiomux = {0x10000, 0, 0x10000, 0, 0, 0 }, | 1515 | .gpiomux = {0x10000, 0, 0x10000, 0 }, |
1469 | .no_msp34xx = 1, | 1516 | .no_msp34xx = 1, |
1470 | .pll = PLL_28, | 1517 | .pll = PLL_28, |
1471 | .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, | 1518 | .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, |
@@ -1486,7 +1533,8 @@ struct tvcard bttv_tvcards[] = { | |||
1486 | .gpiomask = 0x4f8a00, | 1533 | .gpiomask = 0x4f8a00, |
1487 | /* 0x100000: 1=MSP enabled (0=disable again) | 1534 | /* 0x100000: 1=MSP enabled (0=disable again) |
1488 | * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ | 1535 | * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ |
1489 | .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff}, | 1536 | .gpiomux = {0x947fff, 0x987fff,0x947fff,0x947fff }, |
1537 | .gpiomute = 0x947fff, | ||
1490 | /* tvtuner, radio, external,internal, mute, stereo | 1538 | /* tvtuner, radio, external,internal, mute, stereo |
1491 | * tuner, Composit, SVid, Composit-on-Svid-adapter */ | 1539 | * tuner, Composit, SVid, Composit-on-Svid-adapter */ |
1492 | .muxsel = { 2, 3 ,0 ,1 }, | 1540 | .muxsel = { 2, 3 ,0 ,1 }, |
@@ -1518,7 +1566,8 @@ struct tvcard bttv_tvcards[] = { | |||
1518 | .svhs = 2, | 1566 | .svhs = 2, |
1519 | .gpiomask = 15, | 1567 | .gpiomask = 15, |
1520 | .muxsel = { 2, 3, 1, 1 }, | 1568 | .muxsel = { 2, 3, 1, 1 }, |
1521 | .audiomux = { 0, 0, 11, 7, 13, 0 }, /* TV and Radio with same GPIO ! */ | 1569 | .gpiomux = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */ |
1570 | .gpiomute = 13, | ||
1522 | .needs_tvaudio = 1, | 1571 | .needs_tvaudio = 1, |
1523 | .pll = PLL_28, | 1572 | .pll = PLL_28, |
1524 | .tuner_type = 25, | 1573 | .tuner_type = 25, |
@@ -1557,7 +1606,8 @@ struct tvcard bttv_tvcards[] = { | |||
1557 | .svhs = 2, | 1606 | .svhs = 2, |
1558 | .gpiomask = 0x3f, | 1607 | .gpiomask = 0x3f, |
1559 | .muxsel = { 2, 3, 1, 1 }, | 1608 | .muxsel = { 2, 3, 1, 1 }, |
1560 | .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 }, | 1609 | .gpiomux = { 0x01, 0x00, 0x03, 0x03 }, |
1610 | .gpiomute = 0x09, | ||
1561 | .needs_tvaudio = 1, | 1611 | .needs_tvaudio = 1, |
1562 | .no_msp34xx = 1, | 1612 | .no_msp34xx = 1, |
1563 | .no_tda9875 = 1, | 1613 | .no_tda9875 = 1, |
@@ -1586,7 +1636,7 @@ struct tvcard bttv_tvcards[] = { | |||
1586 | .svhs = 4, | 1636 | .svhs = 4, |
1587 | .gpiomask = 0, | 1637 | .gpiomask = 0, |
1588 | .muxsel = { 2, 3, 1, 0, 0 }, | 1638 | .muxsel = { 2, 3, 1, 0, 0 }, |
1589 | .audiomux = { 0 }, | 1639 | .gpiomux = { 0 }, |
1590 | .needs_tvaudio = 0, | 1640 | .needs_tvaudio = 0, |
1591 | .tuner_type = -1, | 1641 | .tuner_type = -1, |
1592 | .tuner_addr = ADDR_UNSET, | 1642 | .tuner_addr = ADDR_UNSET, |
@@ -1618,7 +1668,8 @@ struct tvcard bttv_tvcards[] = { | |||
1618 | .svhs = 2, | 1668 | .svhs = 2, |
1619 | .gpiomask = 0x1C800F, /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */ | 1669 | .gpiomask = 0x1C800F, /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */ |
1620 | .muxsel = { 2, 1, 1, }, | 1670 | .muxsel = { 2, 1, 1, }, |
1621 | .audiomux = { 0, 1, 2, 2, 4 }, | 1671 | .gpiomux = { 0, 1, 2, 2 }, |
1672 | .gpiomute = 4, | ||
1622 | .needs_tvaudio = 0, | 1673 | .needs_tvaudio = 0, |
1623 | .tuner_type = TUNER_PHILIPS_PAL, | 1674 | .tuner_type = TUNER_PHILIPS_PAL, |
1624 | .tuner_addr = ADDR_UNSET, | 1675 | .tuner_addr = ADDR_UNSET, |
@@ -1637,7 +1688,8 @@ struct tvcard bttv_tvcards[] = { | |||
1637 | .svhs = 2, | 1688 | .svhs = 2, |
1638 | .gpiomask = 0x140007, | 1689 | .gpiomask = 0x140007, |
1639 | .muxsel = { 2, 3, 1, 1 }, | 1690 | .muxsel = { 2, 3, 1, 1 }, |
1640 | .audiomux = { 0, 1, 2, 3, 4, 0 }, | 1691 | .gpiomux = { 0, 1, 2, 3 }, |
1692 | .gpiomute = 4, | ||
1641 | .tuner_type = TUNER_PHILIPS_NTSC, | 1693 | .tuner_type = TUNER_PHILIPS_NTSC, |
1642 | .tuner_addr = ADDR_UNSET, | 1694 | .tuner_addr = ADDR_UNSET, |
1643 | .radio_addr = ADDR_UNSET, | 1695 | .radio_addr = ADDR_UNSET, |
@@ -1651,7 +1703,7 @@ struct tvcard bttv_tvcards[] = { | |||
1651 | .svhs = -1, | 1703 | .svhs = -1, |
1652 | .gpiomask = 0, | 1704 | .gpiomask = 0, |
1653 | .muxsel = { 2, 3, 1, 0 }, | 1705 | .muxsel = { 2, 3, 1, 0 }, |
1654 | .audiomux = { 0 }, | 1706 | .gpiomux = { 0 }, |
1655 | .needs_tvaudio = 0, | 1707 | .needs_tvaudio = 0, |
1656 | .no_msp34xx = 1, | 1708 | .no_msp34xx = 1, |
1657 | .pll = PLL_28, | 1709 | .pll = PLL_28, |
@@ -1667,13 +1719,14 @@ struct tvcard bttv_tvcards[] = { | |||
1667 | .svhs = 2, | 1719 | .svhs = 2, |
1668 | .gpiomask = 7, | 1720 | .gpiomask = 7, |
1669 | .muxsel = { 2, 3, 1, 1 }, /* Tuner, SVid, SVHS, SVid to SVHS connector */ | 1721 | .muxsel = { 2, 3, 1, 1 }, /* Tuner, SVid, SVHS, SVid to SVHS connector */ |
1670 | .audiomux = { 0 ,0 ,4, 4,4,4},/* Yes, this tuner uses the same audio output for TV and FM radio! | 1722 | .gpiomux = { 0, 0, 4, 4 },/* Yes, this tuner uses the same audio output for TV and FM radio! |
1671 | * This card lacks external Audio In, so we mute it on Ext. & Int. | 1723 | * This card lacks external Audio In, so we mute it on Ext. & Int. |
1672 | * The PCB can take a sbx1637/sbx1673, wiring unknown. | 1724 | * The PCB can take a sbx1637/sbx1673, wiring unknown. |
1673 | * This card lacks PCI subsystem ID, sigh. | 1725 | * This card lacks PCI subsystem ID, sigh. |
1674 | * audiomux=1: lower volume, 2+3: mute | 1726 | * gpiomux =1: lower volume, 2+3: mute |
1675 | * btwincap uses 0x80000/0x80003 | 1727 | * btwincap uses 0x80000/0x80003 |
1676 | */ | 1728 | */ |
1729 | .gpiomute = 4, | ||
1677 | .needs_tvaudio = 0, | 1730 | .needs_tvaudio = 0, |
1678 | .no_msp34xx = 1, | 1731 | .no_msp34xx = 1, |
1679 | .pll = PLL_28, | 1732 | .pll = PLL_28, |
@@ -1720,7 +1773,7 @@ struct tvcard bttv_tvcards[] = { | |||
1720 | .radio_addr = ADDR_UNSET, | 1773 | .radio_addr = ADDR_UNSET, |
1721 | 1774 | ||
1722 | .gpiomask = 7, | 1775 | .gpiomask = 7, |
1723 | .audiomux = {7}, | 1776 | .gpiomux = {7}, |
1724 | }, | 1777 | }, |
1725 | [BTTV_BOARD_GVBCTV5PCI] = { | 1778 | [BTTV_BOARD_GVBCTV5PCI] = { |
1726 | .name = "IODATA GV-BCTV5/PCI", | 1779 | .name = "IODATA GV-BCTV5/PCI", |
@@ -1730,7 +1783,8 @@ struct tvcard bttv_tvcards[] = { | |||
1730 | .svhs = 2, | 1783 | .svhs = 2, |
1731 | .gpiomask = 0x0f0f80, | 1784 | .gpiomask = 0x0f0f80, |
1732 | .muxsel = {2, 3, 1, 0 }, | 1785 | .muxsel = {2, 3, 1, 0 }, |
1733 | .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0}, | 1786 | .gpiomux = {0x030000, 0x010000, 0, 0 }, |
1787 | .gpiomute = 0x020000, | ||
1734 | .no_msp34xx = 1, | 1788 | .no_msp34xx = 1, |
1735 | .pll = PLL_28, | 1789 | .pll = PLL_28, |
1736 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 1790 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
@@ -1960,7 +2014,7 @@ struct tvcard bttv_tvcards[] = { | |||
1960 | .gpiomask = 2, | 2014 | .gpiomask = 2, |
1961 | /* TV, Comp1, Composite over SVID con, SVID */ | 2015 | /* TV, Comp1, Composite over SVID con, SVID */ |
1962 | .muxsel = { 2, 3, 1, 1 }, | 2016 | .muxsel = { 2, 3, 1, 1 }, |
1963 | .audiomux = { 2, 2, 0, 0, 0 }, | 2017 | .gpiomux = { 2, 2, 0, 0 }, |
1964 | .pll = PLL_28, | 2018 | .pll = PLL_28, |
1965 | .has_radio = 1, | 2019 | .has_radio = 1, |
1966 | .tuner_type = TUNER_PHILIPS_PAL, | 2020 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -1984,7 +2038,8 @@ struct tvcard bttv_tvcards[] = { | |||
1984 | .svhs = -1, | 2038 | .svhs = -1, |
1985 | .gpiomask = 7, | 2039 | .gpiomask = 7, |
1986 | .muxsel = { 2, 3, 1, 1}, | 2040 | .muxsel = { 2, 3, 1, 1}, |
1987 | .audiomux = { 0, 1, 2, 3, 4}, | 2041 | .gpiomux = { 0, 1, 2, 3}, |
2042 | .gpiomute = 4, | ||
1988 | .needs_tvaudio = 1, | 2043 | .needs_tvaudio = 1, |
1989 | .tuner_type = 5, | 2044 | .tuner_type = 5, |
1990 | .tuner_addr = ADDR_UNSET, | 2045 | .tuner_addr = ADDR_UNSET, |
@@ -2016,7 +2071,7 @@ struct tvcard bttv_tvcards[] = { | |||
2016 | .svhs = -1, | 2071 | .svhs = -1, |
2017 | .gpiomask = 0, | 2072 | .gpiomask = 0, |
2018 | .muxsel = { 2, 3 }, | 2073 | .muxsel = { 2, 3 }, |
2019 | .audiomux = { 0 }, | 2074 | .gpiomux = { 0 }, |
2020 | .needs_tvaudio = 0, | 2075 | .needs_tvaudio = 0, |
2021 | .no_msp34xx = 1, | 2076 | .no_msp34xx = 1, |
2022 | .pll = PLL_28, | 2077 | .pll = PLL_28, |
@@ -2035,7 +2090,8 @@ struct tvcard bttv_tvcards[] = { | |||
2035 | .gpiomask = 0x001e8007, | 2090 | .gpiomask = 0x001e8007, |
2036 | .muxsel = { 2, 3, 1, 0 }, | 2091 | .muxsel = { 2, 3, 1, 0 }, |
2037 | /* Tuner, Radio, external, internal, off, on */ | 2092 | /* Tuner, Radio, external, internal, off, on */ |
2038 | .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 }, | 2093 | .gpiomux = { 0x08, 0x0f, 0x0a, 0x08 }, |
2094 | .gpiomute = 0x0f, | ||
2039 | .needs_tvaudio = 0, | 2095 | .needs_tvaudio = 0, |
2040 | .no_msp34xx = 1, | 2096 | .no_msp34xx = 1, |
2041 | .pll = PLL_28, | 2097 | .pll = PLL_28, |
@@ -2152,7 +2208,7 @@ struct tvcard bttv_tvcards[] = { | |||
2152 | .svhs = -1, | 2208 | .svhs = -1, |
2153 | .gpiomask = 0, | 2209 | .gpiomask = 0, |
2154 | .muxsel = { 2, 3, 1, 0 }, | 2210 | .muxsel = { 2, 3, 1, 0 }, |
2155 | .audiomux = { 0 }, | 2211 | .gpiomux = { 0 }, |
2156 | .needs_tvaudio = 0, | 2212 | .needs_tvaudio = 0, |
2157 | .no_msp34xx = 1, | 2213 | .no_msp34xx = 1, |
2158 | .pll = PLL_28, | 2214 | .pll = PLL_28, |
@@ -2169,7 +2225,7 @@ struct tvcard bttv_tvcards[] = { | |||
2169 | .svhs = 3, | 2225 | .svhs = 3, |
2170 | .gpiomask = 0x00, | 2226 | .gpiomask = 0x00, |
2171 | .muxsel = { 2, 3, 1, 0 }, | 2227 | .muxsel = { 2, 3, 1, 0 }, |
2172 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 2228 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2173 | .needs_tvaudio = 1, | 2229 | .needs_tvaudio = 1, |
2174 | .pll = PLL_28, | 2230 | .pll = PLL_28, |
2175 | .tuner_type = -1, | 2231 | .tuner_type = -1, |
@@ -2184,7 +2240,7 @@ struct tvcard bttv_tvcards[] = { | |||
2184 | .svhs = 3, | 2240 | .svhs = 3, |
2185 | .gpiomask = 0x00, | 2241 | .gpiomask = 0x00, |
2186 | .muxsel = { 2, 3, 1, 1 }, | 2242 | .muxsel = { 2, 3, 1, 1 }, |
2187 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 2243 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2188 | .needs_tvaudio = 1, | 2244 | .needs_tvaudio = 1, |
2189 | .pll = PLL_28, | 2245 | .pll = PLL_28, |
2190 | .tuner_type = -1, | 2246 | .tuner_type = -1, |
@@ -2204,7 +2260,7 @@ struct tvcard bttv_tvcards[] = { | |||
2204 | via the upper nibble of muxsel. here: used for | 2260 | via the upper nibble of muxsel. here: used for |
2205 | xternal video-mux */ | 2261 | xternal video-mux */ |
2206 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 }, | 2262 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 }, |
2207 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 2263 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2208 | .needs_tvaudio = 1, | 2264 | .needs_tvaudio = 1, |
2209 | .pll = PLL_28, | 2265 | .pll = PLL_28, |
2210 | .tuner_type = -1, | 2266 | .tuner_type = -1, |
@@ -2222,7 +2278,7 @@ struct tvcard bttv_tvcards[] = { | |||
2222 | via the upper nibble of muxsel. here: used for | 2278 | via the upper nibble of muxsel. here: used for |
2223 | xternal video-mux */ | 2279 | xternal video-mux */ |
2224 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 }, | 2280 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 }, |
2225 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 2281 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2226 | .needs_tvaudio = 1, | 2282 | .needs_tvaudio = 1, |
2227 | .pll = PLL_28, | 2283 | .pll = PLL_28, |
2228 | .tuner_type = -1, | 2284 | .tuner_type = -1, |
@@ -2310,7 +2366,7 @@ struct tvcard bttv_tvcards[] = { | |||
2310 | .svhs = 2, | 2366 | .svhs = 2, |
2311 | .gpiomask = 3, | 2367 | .gpiomask = 3, |
2312 | .muxsel = { 2, 3, 1, 1 }, | 2368 | .muxsel = { 2, 3, 1, 1 }, |
2313 | .audiomux = { 1, 1, 1, 1, 0 }, | 2369 | .gpiomux = { 1, 1, 1, 1 }, |
2314 | .needs_tvaudio = 1, | 2370 | .needs_tvaudio = 1, |
2315 | .tuner_type = TUNER_PHILIPS_PAL, | 2371 | .tuner_type = TUNER_PHILIPS_PAL, |
2316 | .tuner_addr = ADDR_UNSET, | 2372 | .tuner_addr = ADDR_UNSET, |
@@ -2341,7 +2397,8 @@ struct tvcard bttv_tvcards[] = { | |||
2341 | .svhs = 2, | 2397 | .svhs = 2, |
2342 | .gpiomask = 0x008007, | 2398 | .gpiomask = 0x008007, |
2343 | .muxsel = { 2, 3, 0, 0 }, | 2399 | .muxsel = { 2, 3, 0, 0 }, |
2344 | .audiomux = { 0, 0, 0, 0, 0x000003, 0 }, | 2400 | .gpiomux = { 0, 0, 0, 0 }, |
2401 | .gpiomute = 0x000003, | ||
2345 | .pll = PLL_28, | 2402 | .pll = PLL_28, |
2346 | .tuner_type = TUNER_PHILIPS_PAL, | 2403 | .tuner_type = TUNER_PHILIPS_PAL, |
2347 | .tuner_addr = ADDR_UNSET, | 2404 | .tuner_addr = ADDR_UNSET, |
@@ -2377,7 +2434,7 @@ struct tvcard bttv_tvcards[] = { | |||
2377 | .needs_tvaudio = 0, | 2434 | .needs_tvaudio = 0, |
2378 | .gpiomask = 0x68, | 2435 | .gpiomask = 0x68, |
2379 | .muxsel = { 2, 3, 1 }, | 2436 | .muxsel = { 2, 3, 1 }, |
2380 | .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 }, | 2437 | .gpiomux = { 0x68, 0x68, 0x61, 0x61 }, |
2381 | .pll = PLL_28, | 2438 | .pll = PLL_28, |
2382 | }, | 2439 | }, |
2383 | 2440 | ||
@@ -2392,7 +2449,8 @@ struct tvcard bttv_tvcards[] = { | |||
2392 | .svhs = 2, | 2449 | .svhs = 2, |
2393 | .gpiomask = 0x008007, | 2450 | .gpiomask = 0x008007, |
2394 | .muxsel = { 2, 3, 1, 1 }, | 2451 | .muxsel = { 2, 3, 1, 1 }, |
2395 | .audiomux = { 0, 1, 2, 2, 3 }, | 2452 | .gpiomux = { 0, 1, 2, 2 }, |
2453 | .gpiomute = 3, | ||
2396 | .needs_tvaudio = 0, | 2454 | .needs_tvaudio = 0, |
2397 | .pll = PLL_28, | 2455 | .pll = PLL_28, |
2398 | .tuner_type = TUNER_PHILIPS_PAL, | 2456 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -2417,7 +2475,7 @@ struct tvcard bttv_tvcards[] = { | |||
2417 | .no_tda9875 = 1, | 2475 | .no_tda9875 = 1, |
2418 | .no_tda7432 = 1, | 2476 | .no_tda7432 = 1, |
2419 | .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/ | 2477 | .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/ |
2420 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 2478 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2421 | .pll = PLL_28, | 2479 | .pll = PLL_28, |
2422 | .needs_tvaudio = 0, | 2480 | .needs_tvaudio = 0, |
2423 | .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ | 2481 | .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ |
@@ -2435,7 +2493,7 @@ struct tvcard bttv_tvcards[] = { | |||
2435 | .svhs = 2, | 2493 | .svhs = 2, |
2436 | .gpiomask = 0x0000000f, | 2494 | .gpiomask = 0x0000000f, |
2437 | .muxsel = { 2, 1, 1 }, | 2495 | .muxsel = { 2, 1, 1 }, |
2438 | .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00 }, | 2496 | .gpiomux = { 0x02, 0x00, 0x00, 0x00 }, |
2439 | .tuner_type = TUNER_TEMIC_PAL, | 2497 | .tuner_type = TUNER_TEMIC_PAL, |
2440 | .tuner_addr = ADDR_UNSET, | 2498 | .tuner_addr = ADDR_UNSET, |
2441 | .radio_addr = ADDR_UNSET, | 2499 | .radio_addr = ADDR_UNSET, |
@@ -2491,7 +2549,7 @@ struct tvcard bttv_tvcards[] = { | |||
2491 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, | 2549 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, |
2492 | 3, 3, 3, 3, 3, 3, 3, 3 }, | 2550 | 3, 3, 3, 3, 3, 3, 3, 3 }, |
2493 | .muxsel_hook = sigmaSQ_muxsel, | 2551 | .muxsel_hook = sigmaSQ_muxsel, |
2494 | .audiomux = { 0 }, | 2552 | .gpiomux = { 0 }, |
2495 | .no_msp34xx = 1, | 2553 | .no_msp34xx = 1, |
2496 | .pll = PLL_28, | 2554 | .pll = PLL_28, |
2497 | .tuner_type = -1, | 2555 | .tuner_type = -1, |
@@ -2508,7 +2566,7 @@ struct tvcard bttv_tvcards[] = { | |||
2508 | .gpiomask = 0x0, | 2566 | .gpiomask = 0x0, |
2509 | .muxsel = { 2, 2, 2, 2 }, | 2567 | .muxsel = { 2, 2, 2, 2 }, |
2510 | .muxsel_hook = sigmaSLC_muxsel, | 2568 | .muxsel_hook = sigmaSLC_muxsel, |
2511 | .audiomux = { 0 }, | 2569 | .gpiomux = { 0 }, |
2512 | .no_msp34xx = 1, | 2570 | .no_msp34xx = 1, |
2513 | .pll = PLL_28, | 2571 | .pll = PLL_28, |
2514 | .tuner_type = -1, | 2572 | .tuner_type = -1, |
@@ -2526,7 +2584,8 @@ struct tvcard bttv_tvcards[] = { | |||
2526 | .svhs = -1, | 2584 | .svhs = -1, |
2527 | .gpiomask = 0xFF, | 2585 | .gpiomask = 0xFF, |
2528 | .muxsel = { 2, 3, 1, 1 }, | 2586 | .muxsel = { 2, 3, 1, 1 }, |
2529 | .audiomux = { 2, 0, 0, 0, 10 }, | 2587 | .gpiomux = { 2, 0, 0, 0 }, |
2588 | .gpiomute = 10, | ||
2530 | .needs_tvaudio = 0, | 2589 | .needs_tvaudio = 0, |
2531 | .pll = PLL_28, | 2590 | .pll = PLL_28, |
2532 | .tuner_type = TUNER_PHILIPS_PAL, | 2591 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -2560,7 +2619,8 @@ struct tvcard bttv_tvcards[] = { | |||
2560 | .svhs = 2, | 2619 | .svhs = 2, |
2561 | .gpiomask = 0x3f, | 2620 | .gpiomask = 0x3f, |
2562 | .muxsel = {2, 3, 1, 0 }, | 2621 | .muxsel = {2, 3, 1, 0 }, |
2563 | .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31 }, | 2622 | .gpiomux = {0x31, 0x31, 0x31, 0x31 }, |
2623 | .gpiomute = 0x31, | ||
2564 | .no_msp34xx = 1, | 2624 | .no_msp34xx = 1, |
2565 | .pll = PLL_28, | 2625 | .pll = PLL_28, |
2566 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 2626 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
@@ -2583,7 +2643,7 @@ struct tvcard bttv_tvcards[] = { | |||
2583 | .tuner_addr = ADDR_UNSET, | 2643 | .tuner_addr = ADDR_UNSET, |
2584 | .radio_addr = ADDR_UNSET, | 2644 | .radio_addr = ADDR_UNSET, |
2585 | .gpiomask = 0x008007, | 2645 | .gpiomask = 0x008007, |
2586 | .audiomux = { 0, 0x000001,0,0, 0 }, | 2646 | .gpiomux = { 0, 0x000001,0,0 }, |
2587 | .needs_tvaudio = 1, | 2647 | .needs_tvaudio = 1, |
2588 | .has_radio = 1, | 2648 | .has_radio = 1, |
2589 | }, | 2649 | }, |
@@ -2693,7 +2753,8 @@ struct tvcard bttv_tvcards[] = { | |||
2693 | .svhs = 2, | 2753 | .svhs = 2, |
2694 | .muxsel = { 2, 3, 1 }, | 2754 | .muxsel = { 2, 3, 1 }, |
2695 | .gpiomask = 0x00e00007, | 2755 | .gpiomask = 0x00e00007, |
2696 | .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 }, | 2756 | .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, |
2757 | .gpiomute = 0x00c00007, | ||
2697 | .no_msp34xx = 1, | 2758 | .no_msp34xx = 1, |
2698 | .no_tda9875 = 1, | 2759 | .no_tda9875 = 1, |
2699 | .no_tda7432 = 1, | 2760 | .no_tda7432 = 1, |
@@ -2709,7 +2770,8 @@ struct tvcard bttv_tvcards[] = { | |||
2709 | .svhs = 2, | 2770 | .svhs = 2, |
2710 | .gpiomask = 0x01fe00, | 2771 | .gpiomask = 0x01fe00, |
2711 | .muxsel = { 2, 3, 1, 1 }, | 2772 | .muxsel = { 2, 3, 1, 1 }, |
2712 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, | 2773 | .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, |
2774 | .gpiomute = 0x002000, | ||
2713 | .needs_tvaudio = 1, | 2775 | .needs_tvaudio = 1, |
2714 | .pll = PLL_28, | 2776 | .pll = PLL_28, |
2715 | .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, | 2777 | .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, |
@@ -2726,7 +2788,8 @@ struct tvcard bttv_tvcards[] = { | |||
2726 | .svhs = 2, | 2788 | .svhs = 2, |
2727 | .gpiomask = 0x001c0007, | 2789 | .gpiomask = 0x001c0007, |
2728 | .muxsel = { 2, 3, 1, 1 }, | 2790 | .muxsel = { 2, 3, 1, 1 }, |
2729 | .audiomux = { 0, 1, 2, 2, 3 }, | 2791 | .gpiomux = { 0, 1, 2, 2 }, |
2792 | .gpiomute = 3, | ||
2730 | .needs_tvaudio = 0, | 2793 | .needs_tvaudio = 0, |
2731 | .pll = PLL_28, | 2794 | .pll = PLL_28, |
2732 | .tuner_type = TUNER_TENA_9533_DI, | 2795 | .tuner_type = TUNER_TENA_9533_DI, |
@@ -2745,7 +2808,8 @@ struct tvcard bttv_tvcards[] = { | |||
2745 | .gpiomask = 0x01fe00, | 2808 | .gpiomask = 0x01fe00, |
2746 | .muxsel = { 2,3,1,1,-1 }, | 2809 | .muxsel = { 2,3,1,1,-1 }, |
2747 | .digital_mode = DIGITAL_MODE_CAMERA, | 2810 | .digital_mode = DIGITAL_MODE_CAMERA, |
2748 | .audiomux = { 0x00400, 0x10400, 0x04400, 0x80000, 0x12400, 0x46000 }, | 2811 | .gpiomux = { 0x00400, 0x10400, 0x04400, 0x80000 }, |
2812 | .gpiomute = 0x12400, | ||
2749 | .no_msp34xx = 1, | 2813 | .no_msp34xx = 1, |
2750 | .pll = PLL_28, | 2814 | .pll = PLL_28, |
2751 | .tuner_type = TUNER_LG_PAL_FM, | 2815 | .tuner_type = TUNER_LG_PAL_FM, |
@@ -2763,7 +2827,8 @@ struct tvcard bttv_tvcards[] = { | |||
2763 | .svhs = 2, | 2827 | .svhs = 2, |
2764 | .gpiomask = 0x3f, | 2828 | .gpiomask = 0x3f, |
2765 | .muxsel = { 2, 3, 1, 1 }, | 2829 | .muxsel = { 2, 3, 1, 1 }, |
2766 | .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, | 2830 | .gpiomux = { 0x21, 0x20, 0x24, 0x2c }, |
2831 | .gpiomute = 0x29, | ||
2767 | .no_msp34xx = 1, | 2832 | .no_msp34xx = 1, |
2768 | .pll = PLL_28, | 2833 | .pll = PLL_28, |
2769 | .tuner_type = TUNER_YMEC_TVF_5533MF, | 2834 | .tuner_type = TUNER_YMEC_TVF_5533MF, |
@@ -2797,7 +2862,8 @@ struct tvcard bttv_tvcards[] = { | |||
2797 | .svhs = 2, | 2862 | .svhs = 2, |
2798 | .gpiomask = 15, | 2863 | .gpiomask = 15, |
2799 | .muxsel = { 2, 3, 1, 1 }, | 2864 | .muxsel = { 2, 3, 1, 1 }, |
2800 | .audiomux = { 2, 0, 0, 0, 1 }, | 2865 | .gpiomux = { 2, 0, 0, 0 }, |
2866 | .gpiomute = 1, | ||
2801 | .needs_tvaudio = 1, | 2867 | .needs_tvaudio = 1, |
2802 | .pll = PLL_28, | 2868 | .pll = PLL_28, |
2803 | .tuner_type = 2, | 2869 | .tuner_type = 2, |
@@ -2813,7 +2879,7 @@ struct tvcard bttv_tvcards[] = { | |||
2813 | .svhs = 2, | 2879 | .svhs = 2, |
2814 | .gpiomask = 0x108007, | 2880 | .gpiomask = 0x108007, |
2815 | .muxsel = { 2, 3, 1, 1 }, | 2881 | .muxsel = { 2, 3, 1, 1 }, |
2816 | .audiomux = { 100000, 100002, 100002, 100000 }, | 2882 | .gpiomux = { 100000, 100002, 100002, 100000 }, |
2817 | .no_msp34xx = 1, | 2883 | .no_msp34xx = 1, |
2818 | .no_tda9875 = 1, | 2884 | .no_tda9875 = 1, |
2819 | .no_tda7432 = 1, | 2885 | .no_tda7432 = 1, |
@@ -2853,7 +2919,8 @@ struct tvcard bttv_tvcards[] = { | |||
2853 | .svhs = 2, | 2919 | .svhs = 2, |
2854 | .gpiomask = 7, | 2920 | .gpiomask = 7, |
2855 | .muxsel = { 2, 3, 1, 1 }, | 2921 | .muxsel = { 2, 3, 1, 1 }, |
2856 | .audiomux = { 0, 1, 2, 3, 4 }, | 2922 | .gpiomux = { 0, 1, 2, 3 }, |
2923 | .gpiomute = 4, | ||
2857 | .tuner_type = TUNER_TEMIC_4009FR5_PAL, | 2924 | .tuner_type = TUNER_TEMIC_4009FR5_PAL, |
2858 | .tuner_addr = ADDR_UNSET, | 2925 | .tuner_addr = ADDR_UNSET, |
2859 | .radio_addr = ADDR_UNSET, | 2926 | .radio_addr = ADDR_UNSET, |
@@ -2925,20 +2992,20 @@ void __devinit bttv_idcard(struct bttv *btv) | |||
2925 | if (UNSET != audiomux[0]) { | 2992 | if (UNSET != audiomux[0]) { |
2926 | gpiobits = 0; | 2993 | gpiobits = 0; |
2927 | for (i = 0; i < 5; i++) { | 2994 | for (i = 0; i < 5; i++) { |
2928 | bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i]; | 2995 | bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i]; |
2929 | gpiobits |= audiomux[i]; | 2996 | gpiobits |= audiomux[i]; |
2930 | } | 2997 | } |
2931 | } else { | 2998 | } else { |
2932 | gpiobits = audioall; | 2999 | gpiobits = audioall; |
2933 | for (i = 0; i < 5; i++) { | 3000 | for (i = 0; i < 5; i++) { |
2934 | bttv_tvcards[btv->c.type].audiomux[i] = audioall; | 3001 | bttv_tvcards[btv->c.type].gpiomux[i] = audioall; |
2935 | } | 3002 | } |
2936 | } | 3003 | } |
2937 | bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits; | 3004 | bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits; |
2938 | printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=", | 3005 | printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=", |
2939 | btv->c.nr,bttv_tvcards[btv->c.type].gpiomask); | 3006 | btv->c.nr,bttv_tvcards[btv->c.type].gpiomask); |
2940 | for (i = 0; i < 5; i++) { | 3007 | for (i = 0; i < 5; i++) { |
2941 | printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]); | 3008 | printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]); |
2942 | } | 3009 | } |
2943 | printk("\n"); | 3010 | printk("\n"); |
2944 | } | 3011 | } |
@@ -3046,7 +3113,7 @@ static void miro_pinnacle_gpio(struct bttv *btv) | |||
3046 | gpio_inout(0xffffff, 0); | 3113 | gpio_inout(0xffffff, 0); |
3047 | gpio = gpio_read(); | 3114 | gpio = gpio_read(); |
3048 | id = ((gpio>>10) & 63) -1; | 3115 | id = ((gpio>>10) & 63) -1; |
3049 | msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx"); | 3116 | msp = bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx"); |
3050 | if (id < 32) { | 3117 | if (id < 32) { |
3051 | btv->tuner_type = miro_tunermap[id]; | 3118 | btv->tuner_type = miro_tunermap[id]; |
3052 | if (0 == (gpio & 0x20)) { | 3119 | if (0 == (gpio & 0x20)) { |
@@ -3442,8 +3509,8 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3442 | 3509 | ||
3443 | if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) { | 3510 | if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) { |
3444 | /* detect Bt832 chip for quartzsight digital camera */ | 3511 | /* detect Bt832 chip for quartzsight digital camera */ |
3445 | if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) || | 3512 | if ((bttv_I2CRead(btv, I2C_ADDR_BT832_ALT1, "Bt832") >=0) || |
3446 | (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0)) | 3513 | (bttv_I2CRead(btv, I2C_ADDR_BT832_ALT2, "Bt832") >=0)) |
3447 | boot_bt832(btv); | 3514 | boot_bt832(btv); |
3448 | } | 3515 | } |
3449 | 3516 | ||
@@ -3452,19 +3519,19 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3452 | 3519 | ||
3453 | /* try to detect audio/fader chips */ | 3520 | /* try to detect audio/fader chips */ |
3454 | if (!bttv_tvcards[btv->c.type].no_msp34xx && | 3521 | if (!bttv_tvcards[btv->c.type].no_msp34xx && |
3455 | bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0) | 3522 | bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx") >=0) |
3456 | request_module("msp3400"); | 3523 | request_module("msp3400"); |
3457 | 3524 | ||
3458 | if (bttv_tvcards[btv->c.type].msp34xx_alt && | 3525 | if (bttv_tvcards[btv->c.type].msp34xx_alt && |
3459 | bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0) | 3526 | bttv_I2CRead(btv, I2C_ADDR_MSP3400_ALT, "MSP34xx (alternate address)") >=0) |
3460 | request_module("msp3400"); | 3527 | request_module("msp3400"); |
3461 | 3528 | ||
3462 | if (!bttv_tvcards[btv->c.type].no_tda9875 && | 3529 | if (!bttv_tvcards[btv->c.type].no_tda9875 && |
3463 | bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0) | 3530 | bttv_I2CRead(btv, I2C_ADDR_TDA9875, "TDA9875") >=0) |
3464 | request_module("tda9875"); | 3531 | request_module("tda9875"); |
3465 | 3532 | ||
3466 | if (!bttv_tvcards[btv->c.type].no_tda7432 && | 3533 | if (!bttv_tvcards[btv->c.type].no_tda7432 && |
3467 | bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) | 3534 | bttv_I2CRead(btv, I2C_ADDR_TDA7432, "TDA7432") >=0) |
3468 | request_module("tda7432"); | 3535 | request_module("tda7432"); |
3469 | 3536 | ||
3470 | if (bttv_tvcards[btv->c.type].needs_tvaudio) | 3537 | if (bttv_tvcards[btv->c.type].needs_tvaudio) |
@@ -3475,7 +3542,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3475 | if (btv->tda9887_conf) | 3542 | if (btv->tda9887_conf) |
3476 | tda9887 = 1; | 3543 | tda9887 = 1; |
3477 | if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb && | 3544 | if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb && |
3478 | bttv_I2CRead(btv, I2C_TDA9887, "TDA9887") >=0) | 3545 | bttv_I2CRead(btv, I2C_ADDR_TDA9887, "TDA9887") >=0) |
3479 | tda9887 = 1; | 3546 | tda9887 = 1; |
3480 | /* Hybrid DVB card, DOES have a tda9887 */ | 3547 | /* Hybrid DVB card, DOES have a tda9887 */ |
3481 | if (btv->c.type == BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE) | 3548 | if (btv->c.type == BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE) |
@@ -3796,18 +3863,18 @@ void bttv_tda9880_setnorm(struct bttv *btv, int norm) | |||
3796 | { | 3863 | { |
3797 | /* fix up our card entry */ | 3864 | /* fix up our card entry */ |
3798 | if(norm==VIDEO_MODE_NTSC) { | 3865 | if(norm==VIDEO_MODE_NTSC) { |
3799 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x957fff; | 3866 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; |
3800 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x957fff; | 3867 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x957fff; |
3801 | dprintk("bttv_tda9880_setnorm to NTSC\n"); | 3868 | dprintk("bttv_tda9880_setnorm to NTSC\n"); |
3802 | } | 3869 | } |
3803 | else { | 3870 | else { |
3804 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x947fff; | 3871 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff; |
3805 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x947fff; | 3872 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x947fff; |
3806 | dprintk("bttv_tda9880_setnorm to PAL\n"); | 3873 | dprintk("bttv_tda9880_setnorm to PAL\n"); |
3807 | } | 3874 | } |
3808 | /* set GPIO according */ | 3875 | /* set GPIO according */ |
3809 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask, | 3876 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask, |
3810 | bttv_tvcards[btv->c.type].audiomux[btv->audio]); | 3877 | bttv_tvcards[btv->c.type].gpiomux[btv->audio]); |
3811 | } | 3878 | } |
3812 | 3879 | ||
3813 | 3880 | ||
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index c0415d6e7fee..74def9c23952 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -36,13 +36,15 @@ | |||
36 | #include <linux/kdev_t.h> | 36 | #include <linux/kdev_t.h> |
37 | #include "bttvp.h" | 37 | #include "bttvp.h" |
38 | #include <media/v4l2-common.h> | 38 | #include <media/v4l2-common.h> |
39 | #include <media/tvaudio.h> | ||
40 | #include <media/msp3400.h> | ||
39 | 41 | ||
40 | #include <linux/dma-mapping.h> | 42 | #include <linux/dma-mapping.h> |
41 | 43 | ||
42 | #include <asm/io.h> | 44 | #include <asm/io.h> |
43 | #include <asm/byteorder.h> | 45 | #include <asm/byteorder.h> |
44 | 46 | ||
45 | #include "rds.h" | 47 | #include <media/rds.h> |
46 | 48 | ||
47 | 49 | ||
48 | unsigned int bttv_num; /* number of Bt848s in use */ | 50 | unsigned int bttv_num; /* number of Bt848s in use */ |
@@ -926,45 +928,98 @@ video_mux(struct bttv *btv, unsigned int input) | |||
926 | 928 | ||
927 | static char *audio_modes[] = { | 929 | static char *audio_modes[] = { |
928 | "audio: tuner", "audio: radio", "audio: extern", | 930 | "audio: tuner", "audio: radio", "audio: extern", |
929 | "audio: intern", "audio: off" | 931 | "audio: intern", "audio: mute" |
930 | }; | 932 | }; |
931 | 933 | ||
932 | static int | 934 | static int |
933 | audio_mux(struct bttv *btv, int mode) | 935 | audio_mux(struct bttv *btv, int input, int mute) |
934 | { | 936 | { |
935 | int val,mux,i2c_mux,signal; | 937 | int gpio_val, signal; |
938 | struct v4l2_control ctrl; | ||
939 | struct i2c_client *c; | ||
936 | 940 | ||
937 | gpio_inout(bttv_tvcards[btv->c.type].gpiomask, | 941 | gpio_inout(bttv_tvcards[btv->c.type].gpiomask, |
938 | bttv_tvcards[btv->c.type].gpiomask); | 942 | bttv_tvcards[btv->c.type].gpiomask); |
939 | signal = btread(BT848_DSTATUS) & BT848_DSTATUS_HLOC; | 943 | signal = btread(BT848_DSTATUS) & BT848_DSTATUS_HLOC; |
940 | 944 | ||
941 | switch (mode) { | 945 | btv->mute = mute; |
942 | case AUDIO_MUTE: | 946 | btv->audio = input; |
943 | btv->audio |= AUDIO_MUTE; | 947 | |
944 | break; | 948 | /* automute */ |
945 | case AUDIO_UNMUTE: | 949 | mute = mute || (btv->opt_automute && !signal && !btv->radio_user); |
946 | btv->audio &= ~AUDIO_MUTE; | 950 | |
947 | break; | 951 | if (mute) |
948 | case AUDIO_TUNER: | 952 | gpio_val = bttv_tvcards[btv->c.type].gpiomute; |
949 | case AUDIO_RADIO: | 953 | else |
950 | case AUDIO_EXTERN: | 954 | gpio_val = bttv_tvcards[btv->c.type].gpiomux[input]; |
951 | case AUDIO_INTERN: | 955 | |
952 | btv->audio &= AUDIO_MUTE; | 956 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask, gpio_val); |
953 | btv->audio |= mode; | ||
954 | } | ||
955 | i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio; | ||
956 | if (btv->opt_automute && !signal && !btv->radio_user) | ||
957 | mux = AUDIO_OFF; | ||
958 | |||
959 | val = bttv_tvcards[btv->c.type].audiomux[mux]; | ||
960 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val); | ||
961 | if (bttv_gpio) | 957 | if (bttv_gpio) |
962 | bttv_gpio_tracking(btv,audio_modes[mux]); | 958 | bttv_gpio_tracking(btv, audio_modes[mute ? 4 : input]); |
963 | if (!in_interrupt()) | 959 | if (in_interrupt()) |
964 | bttv_call_i2c_clients(btv,AUDC_SET_INPUT,&(i2c_mux)); | 960 | return 0; |
961 | |||
962 | ctrl.id = V4L2_CID_AUDIO_MUTE; | ||
963 | ctrl.value = btv->mute; | ||
964 | bttv_call_i2c_clients(btv, VIDIOC_S_CTRL, &ctrl); | ||
965 | c = btv->i2c_msp34xx_client; | ||
966 | if (c) { | ||
967 | struct v4l2_routing route; | ||
968 | |||
969 | /* Note: the inputs tuner/radio/extern/intern are translated | ||
970 | to msp routings. This assumes common behavior for all msp3400 | ||
971 | based TV cards. When this assumption fails, then the | ||
972 | specific MSP routing must be added to the card table. | ||
973 | For now this is sufficient. */ | ||
974 | switch (input) { | ||
975 | case TVAUDIO_INPUT_RADIO: | ||
976 | route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, | ||
977 | MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); | ||
978 | break; | ||
979 | case TVAUDIO_INPUT_EXTERN: | ||
980 | route.input = MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, | ||
981 | MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); | ||
982 | break; | ||
983 | case TVAUDIO_INPUT_INTERN: | ||
984 | /* Yes, this is the same input as for RADIO. I doubt | ||
985 | if this is ever used. The only board with an INTERN | ||
986 | input is the BTTV_BOARD_AVERMEDIA98. I wonder how | ||
987 | that was tested. My guess is that the whole INTERN | ||
988 | input does not work. */ | ||
989 | route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, | ||
990 | MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); | ||
991 | break; | ||
992 | case TVAUDIO_INPUT_TUNER: | ||
993 | default: | ||
994 | route.input = MSP_INPUT_DEFAULT; | ||
995 | break; | ||
996 | } | ||
997 | route.output = MSP_OUTPUT_DEFAULT; | ||
998 | c->driver->command(c, VIDIOC_INT_S_AUDIO_ROUTING, &route); | ||
999 | } | ||
1000 | c = btv->i2c_tvaudio_client; | ||
1001 | if (c) { | ||
1002 | struct v4l2_routing route; | ||
1003 | |||
1004 | route.input = input; | ||
1005 | route.output = 0; | ||
1006 | c->driver->command(c, VIDIOC_INT_S_AUDIO_ROUTING, &route); | ||
1007 | } | ||
965 | return 0; | 1008 | return 0; |
966 | } | 1009 | } |
967 | 1010 | ||
1011 | static inline int | ||
1012 | audio_mute(struct bttv *btv, int mute) | ||
1013 | { | ||
1014 | return audio_mux(btv, btv->audio, mute); | ||
1015 | } | ||
1016 | |||
1017 | static inline int | ||
1018 | audio_input(struct bttv *btv, int input) | ||
1019 | { | ||
1020 | return audio_mux(btv, input, btv->mute); | ||
1021 | } | ||
1022 | |||
968 | static void | 1023 | static void |
969 | i2c_vidiocschan(struct bttv *btv) | 1024 | i2c_vidiocschan(struct bttv *btv) |
970 | { | 1025 | { |
@@ -1023,8 +1078,8 @@ set_input(struct bttv *btv, unsigned int input) | |||
1023 | } else { | 1078 | } else { |
1024 | video_mux(btv,input); | 1079 | video_mux(btv,input); |
1025 | } | 1080 | } |
1026 | audio_mux(btv,(input == bttv_tvcards[btv->c.type].tuner ? | 1081 | audio_input(btv,(input == bttv_tvcards[btv->c.type].tuner ? |
1027 | AUDIO_TUNER : AUDIO_EXTERN)); | 1082 | TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN)); |
1028 | set_tvnorm(btv,btv->tvnorm); | 1083 | set_tvnorm(btv,btv->tvnorm); |
1029 | i2c_vidiocschan(btv); | 1084 | i2c_vidiocschan(btv); |
1030 | } | 1085 | } |
@@ -1236,10 +1291,10 @@ static int set_control(struct bttv *btv, struct v4l2_control *c) | |||
1236 | case V4L2_CID_AUDIO_MUTE: | 1291 | case V4L2_CID_AUDIO_MUTE: |
1237 | if (c->value) { | 1292 | if (c->value) { |
1238 | va.flags |= VIDEO_AUDIO_MUTE; | 1293 | va.flags |= VIDEO_AUDIO_MUTE; |
1239 | audio_mux(btv, AUDIO_MUTE); | 1294 | audio_mute(btv, 1); |
1240 | } else { | 1295 | } else { |
1241 | va.flags &= ~VIDEO_AUDIO_MUTE; | 1296 | va.flags &= ~VIDEO_AUDIO_MUTE; |
1242 | audio_mux(btv, AUDIO_UNMUTE); | 1297 | audio_mute(btv, 0); |
1243 | } | 1298 | } |
1244 | break; | 1299 | break; |
1245 | 1300 | ||
@@ -1397,7 +1452,7 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, | |||
1397 | free_btres(btv,fh,RESOURCE_OVERLAY); | 1452 | free_btres(btv,fh,RESOURCE_OVERLAY); |
1398 | if (NULL != old) { | 1453 | if (NULL != old) { |
1399 | dprintk("switch_overlay: old=%p state is %d\n",old,old->vb.state); | 1454 | dprintk("switch_overlay: old=%p state is %d\n",old,old->vb.state); |
1400 | bttv_dma_free(btv, old); | 1455 | bttv_dma_free(&fh->cap,btv, old); |
1401 | kfree(old); | 1456 | kfree(old); |
1402 | } | 1457 | } |
1403 | dprintk("switch_overlay: done\n"); | 1458 | dprintk("switch_overlay: done\n"); |
@@ -1407,7 +1462,8 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, | |||
1407 | /* ----------------------------------------------------------------------- */ | 1462 | /* ----------------------------------------------------------------------- */ |
1408 | /* video4linux (1) interface */ | 1463 | /* video4linux (1) interface */ |
1409 | 1464 | ||
1410 | static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, | 1465 | static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv, |
1466 | struct bttv_buffer *buf, | ||
1411 | const struct bttv_format *fmt, | 1467 | const struct bttv_format *fmt, |
1412 | unsigned int width, unsigned int height, | 1468 | unsigned int width, unsigned int height, |
1413 | enum v4l2_field field) | 1469 | enum v4l2_field field) |
@@ -1450,7 +1506,7 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, | |||
1450 | /* alloc risc memory */ | 1506 | /* alloc risc memory */ |
1451 | if (STATE_NEEDS_INIT == buf->vb.state) { | 1507 | if (STATE_NEEDS_INIT == buf->vb.state) { |
1452 | redo_dma_risc = 1; | 1508 | redo_dma_risc = 1; |
1453 | if (0 != (rc = videobuf_iolock(btv->c.pci,&buf->vb,&btv->fbuf))) | 1509 | if (0 != (rc = videobuf_iolock(q,&buf->vb,&btv->fbuf))) |
1454 | goto fail; | 1510 | goto fail; |
1455 | } | 1511 | } |
1456 | 1512 | ||
@@ -1462,7 +1518,7 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, | |||
1462 | return 0; | 1518 | return 0; |
1463 | 1519 | ||
1464 | fail: | 1520 | fail: |
1465 | bttv_dma_free(btv,buf); | 1521 | bttv_dma_free(q,btv,buf); |
1466 | return rc; | 1522 | return rc; |
1467 | } | 1523 | } |
1468 | 1524 | ||
@@ -1486,7 +1542,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
1486 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); | 1542 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); |
1487 | struct bttv_fh *fh = q->priv_data; | 1543 | struct bttv_fh *fh = q->priv_data; |
1488 | 1544 | ||
1489 | return bttv_prepare_buffer(fh->btv, buf, fh->fmt, | 1545 | return bttv_prepare_buffer(q,fh->btv, buf, fh->fmt, |
1490 | fh->width, fh->height, field); | 1546 | fh->width, fh->height, field); |
1491 | } | 1547 | } |
1492 | 1548 | ||
@@ -1510,7 +1566,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1510 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); | 1566 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); |
1511 | struct bttv_fh *fh = q->priv_data; | 1567 | struct bttv_fh *fh = q->priv_data; |
1512 | 1568 | ||
1513 | bttv_dma_free(fh->btv,buf); | 1569 | bttv_dma_free(&fh->cap,fh->btv,buf); |
1514 | } | 1570 | } |
1515 | 1571 | ||
1516 | static struct videobuf_queue_ops bttv_video_qops = { | 1572 | static struct videobuf_queue_ops bttv_video_qops = { |
@@ -1653,7 +1709,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | |||
1653 | return -EINVAL; | 1709 | return -EINVAL; |
1654 | 1710 | ||
1655 | mutex_lock(&btv->lock); | 1711 | mutex_lock(&btv->lock); |
1656 | audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE); | 1712 | audio_mute(btv, (v->flags&VIDEO_AUDIO_MUTE) ? 1 : 0); |
1657 | bttv_call_i2c_clients(btv,cmd,v); | 1713 | bttv_call_i2c_clients(btv,cmd,v); |
1658 | 1714 | ||
1659 | /* card specific hooks */ | 1715 | /* card specific hooks */ |
@@ -1822,7 +1878,8 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | |||
1822 | bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va); | 1878 | bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va); |
1823 | if (t->audmode == V4L2_TUNER_MODE_MONO) | 1879 | if (t->audmode == V4L2_TUNER_MODE_MONO) |
1824 | va.mode = VIDEO_SOUND_MONO; | 1880 | va.mode = VIDEO_SOUND_MONO; |
1825 | else if (t->audmode == V4L2_TUNER_MODE_STEREO) | 1881 | else if (t->audmode == V4L2_TUNER_MODE_STEREO || |
1882 | t->audmode == V4L2_TUNER_MODE_LANG1_LANG2) | ||
1826 | va.mode = VIDEO_SOUND_STEREO; | 1883 | va.mode = VIDEO_SOUND_STEREO; |
1827 | else if (t->audmode == V4L2_TUNER_MODE_LANG1) | 1884 | else if (t->audmode == V4L2_TUNER_MODE_LANG1) |
1828 | va.mode = VIDEO_SOUND_LANG1; | 1885 | va.mode = VIDEO_SOUND_LANG1; |
@@ -2496,7 +2553,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2496 | field = (vm->height > bttv_tvnorms[btv->tvnorm].sheight/2) | 2553 | field = (vm->height > bttv_tvnorms[btv->tvnorm].sheight/2) |
2497 | ? V4L2_FIELD_INTERLACED | 2554 | ? V4L2_FIELD_INTERLACED |
2498 | : V4L2_FIELD_BOTTOM; | 2555 | : V4L2_FIELD_BOTTOM; |
2499 | retval = bttv_prepare_buffer(btv,buf, | 2556 | retval = bttv_prepare_buffer(&fh->cap,btv,buf, |
2500 | format_by_palette(vm->format), | 2557 | format_by_palette(vm->format), |
2501 | vm->width,vm->height,field); | 2558 | vm->width,vm->height,field); |
2502 | if (0 != retval) | 2559 | if (0 != retval) |
@@ -2528,8 +2585,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2528 | retval = -EIO; | 2585 | retval = -EIO; |
2529 | /* fall through */ | 2586 | /* fall through */ |
2530 | case STATE_DONE: | 2587 | case STATE_DONE: |
2531 | videobuf_dma_pci_sync(btv->c.pci,&buf->vb.dma); | 2588 | videobuf_dma_sync(&fh->cap,&buf->vb.dma); |
2532 | bttv_dma_free(btv,buf); | 2589 | bttv_dma_free(&fh->cap,btv,buf); |
2533 | break; | 2590 | break; |
2534 | default: | 2591 | default: |
2535 | retval = -EINVAL; | 2592 | retval = -EINVAL; |
@@ -3162,8 +3219,8 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3162 | 3219 | ||
3163 | file->private_data = btv; | 3220 | file->private_data = btv; |
3164 | 3221 | ||
3165 | bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type); | 3222 | bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL); |
3166 | audio_mux(btv,AUDIO_RADIO); | 3223 | audio_input(btv,TVAUDIO_INPUT_RADIO); |
3167 | 3224 | ||
3168 | mutex_unlock(&btv->lock); | 3225 | mutex_unlock(&btv->lock); |
3169 | return 0; | 3226 | return 0; |
@@ -3749,7 +3806,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) | |||
3749 | bttv_irq_switch_video(btv); | 3806 | bttv_irq_switch_video(btv); |
3750 | 3807 | ||
3751 | if ((astat & BT848_INT_HLOCK) && btv->opt_automute) | 3808 | if ((astat & BT848_INT_HLOCK) && btv->opt_automute) |
3752 | audio_mux(btv, -1); | 3809 | audio_mute(btv, btv->mute); /* trigger automute */ |
3753 | 3810 | ||
3754 | if (astat & (BT848_INT_SCERR|BT848_INT_OCERR)) { | 3811 | if (astat & (BT848_INT_SCERR|BT848_INT_OCERR)) { |
3755 | printk(KERN_INFO "bttv%d: %s%s @ %08x,",btv->c.nr, | 3812 | printk(KERN_INFO "bttv%d: %s%s @ %08x,",btv->c.nr, |
@@ -4050,7 +4107,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
4050 | bt848_contrast(btv,32768); | 4107 | bt848_contrast(btv,32768); |
4051 | bt848_hue(btv,32768); | 4108 | bt848_hue(btv,32768); |
4052 | bt848_sat(btv,32768); | 4109 | bt848_sat(btv,32768); |
4053 | audio_mux(btv,AUDIO_MUTE); | 4110 | audio_mute(btv, 1); |
4054 | set_input(btv,0); | 4111 | set_input(btv,0); |
4055 | } | 4112 | } |
4056 | 4113 | ||
diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bt8xx/bttv-gpio.c index c4d5e2b70c28..c4d5e2b70c28 100644 --- a/drivers/media/video/bttv-gpio.c +++ b/drivers/media/video/bt8xx/bttv-gpio.c | |||
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bt8xx/bttv-i2c.c index 614c12018557..4b562b386fcf 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bt8xx/bttv-i2c.c | |||
@@ -302,6 +302,10 @@ static int attach_inform(struct i2c_client *client) | |||
302 | if (!client->driver->command) | 302 | if (!client->driver->command) |
303 | return 0; | 303 | return 0; |
304 | 304 | ||
305 | if (client->driver->id == I2C_DRIVERID_MSP3400) | ||
306 | btv->i2c_msp34xx_client = client; | ||
307 | if (client->driver->id == I2C_DRIVERID_TVAUDIO) | ||
308 | btv->i2c_tvaudio_client = client; | ||
305 | if (btv->tuner_type != UNSET) { | 309 | if (btv->tuner_type != UNSET) { |
306 | struct tuner_setup tun_setup; | 310 | struct tuner_setup tun_setup; |
307 | 311 | ||
diff --git a/drivers/media/video/bttv-if.c b/drivers/media/video/bt8xx/bttv-if.c index 19b564ab0e92..19b564ab0e92 100644 --- a/drivers/media/video/bttv-if.c +++ b/drivers/media/video/bt8xx/bttv-if.c | |||
diff --git a/drivers/media/video/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index 69efa0e5174d..69efa0e5174d 100644 --- a/drivers/media/video/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c | |||
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c index 344f84e9af04..16323a5d68ac 100644 --- a/drivers/media/video/bttv-risc.c +++ b/drivers/media/video/bt8xx/bttv-risc.c | |||
@@ -509,11 +509,11 @@ bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc, | |||
509 | } | 509 | } |
510 | 510 | ||
511 | void | 511 | void |
512 | bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf) | 512 | bttv_dma_free(struct videobuf_queue *q,struct bttv *btv, struct bttv_buffer *buf) |
513 | { | 513 | { |
514 | BUG_ON(in_interrupt()); | 514 | BUG_ON(in_interrupt()); |
515 | videobuf_waiton(&buf->vb,0,0); | 515 | videobuf_waiton(&buf->vb,0,0); |
516 | videobuf_dma_pci_unmap(btv->c.pci, &buf->vb.dma); | 516 | videobuf_dma_unmap(q, &buf->vb.dma); |
517 | videobuf_dma_free(&buf->vb.dma); | 517 | videobuf_dma_free(&buf->vb.dma); |
518 | btcx_riscmem_free(btv->c.pci,&buf->bottom); | 518 | btcx_riscmem_free(btv->c.pci,&buf->bottom); |
519 | btcx_riscmem_free(btv->c.pci,&buf->top); | 519 | btcx_riscmem_free(btv->c.pci,&buf->top); |
diff --git a/drivers/media/video/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c index 72afdd64b882..e20ff238e409 100644 --- a/drivers/media/video/bttv-vbi.c +++ b/drivers/media/video/bt8xx/bttv-vbi.c | |||
@@ -96,7 +96,7 @@ static int vbi_buffer_prepare(struct videobuf_queue *q, | |||
96 | return -EINVAL; | 96 | return -EINVAL; |
97 | 97 | ||
98 | if (STATE_NEEDS_INIT == buf->vb.state) { | 98 | if (STATE_NEEDS_INIT == buf->vb.state) { |
99 | if (0 != (rc = videobuf_iolock(btv->c.pci, &buf->vb, NULL))) | 99 | if (0 != (rc = videobuf_iolock(q, &buf->vb, NULL))) |
100 | goto fail; | 100 | goto fail; |
101 | if (0 != (rc = vbi_buffer_risc(btv,buf,fh->lines))) | 101 | if (0 != (rc = vbi_buffer_risc(btv,buf,fh->lines))) |
102 | goto fail; | 102 | goto fail; |
@@ -109,7 +109,7 @@ static int vbi_buffer_prepare(struct videobuf_queue *q, | |||
109 | return 0; | 109 | return 0; |
110 | 110 | ||
111 | fail: | 111 | fail: |
112 | bttv_dma_free(btv,buf); | 112 | bttv_dma_free(q,btv,buf); |
113 | return rc; | 113 | return rc; |
114 | } | 114 | } |
115 | 115 | ||
@@ -136,7 +136,7 @@ static void vbi_buffer_release(struct videobuf_queue *q, struct videobuf_buffer | |||
136 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); | 136 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); |
137 | 137 | ||
138 | dprintk("free %p\n",vb); | 138 | dprintk("free %p\n",vb); |
139 | bttv_dma_free(fh->btv,buf); | 139 | bttv_dma_free(&fh->cap,fh->btv,buf); |
140 | } | 140 | } |
141 | 141 | ||
142 | struct videobuf_queue_ops bttv_vbi_qops = { | 142 | struct videobuf_queue_ops bttv_vbi_qops = { |
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bt8xx/bttv.h index 9908c8e0c951..3a23265c1538 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bt8xx/bttv.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <media/ir-common.h> | 19 | #include <media/ir-common.h> |
20 | #include <media/ir-kbd-i2c.h> | 20 | #include <media/ir-kbd-i2c.h> |
21 | #include <media/i2c-addr.h> | ||
21 | 22 | ||
22 | /* ---------------------------------------------------------- */ | 23 | /* ---------------------------------------------------------- */ |
23 | /* exported by bttv-cards.c */ | 24 | /* exported by bttv-cards.c */ |
@@ -168,25 +169,6 @@ | |||
168 | #define BTTV_BOARD_HAUPPAUGE_IMPACTVCB 0x8f | 169 | #define BTTV_BOARD_HAUPPAUGE_IMPACTVCB 0x8f |
169 | #define BTTV_BOARD_MACHTV_MAGICTV 0x90 | 170 | #define BTTV_BOARD_MACHTV_MAGICTV 0x90 |
170 | 171 | ||
171 | /* i2c address list */ | ||
172 | #define I2C_TSA5522 0xc2 | ||
173 | #define I2C_TDA7432 0x8a | ||
174 | #define I2C_BT832_ALT1 0x88 | ||
175 | #define I2C_BT832_ALT2 0x8a // alternate setting | ||
176 | #define I2C_TDA8425 0x82 | ||
177 | #define I2C_TDA9840 0x84 | ||
178 | #define I2C_TDA9850 0xb6 /* also used by 9855,9873 */ | ||
179 | #define I2C_TDA9874 0xb0 /* also used by 9875 */ | ||
180 | #define I2C_TDA9875 0xb0 | ||
181 | #define I2C_HAUPEE 0xa0 | ||
182 | #define I2C_STBEE 0xae | ||
183 | #define I2C_VHX 0xc0 | ||
184 | #define I2C_MSP3400 0x80 | ||
185 | #define I2C_MSP3400_ALT 0x88 | ||
186 | #define I2C_TEA6300 0x80 /* also used by 6320 */ | ||
187 | #define I2C_DPL3518 0x84 | ||
188 | #define I2C_TDA9887 0x86 | ||
189 | |||
190 | /* more card-specific defines */ | 172 | /* more card-specific defines */ |
191 | #define PT2254_L_CHANNEL 0x10 | 173 | #define PT2254_L_CHANNEL 0x10 |
192 | #define PT2254_R_CHANNEL 0x08 | 174 | #define PT2254_R_CHANNEL 0x08 |
@@ -252,7 +234,8 @@ struct tvcard | |||
252 | unsigned int digital_mode; // DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO | 234 | unsigned int digital_mode; // DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO |
253 | u32 gpiomask; | 235 | u32 gpiomask; |
254 | u32 muxsel[16]; | 236 | u32 muxsel[16]; |
255 | u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */ | 237 | u32 gpiomux[4]; /* Tuner, Radio, external, internal */ |
238 | u32 gpiomute; /* GPIO mute setting */ | ||
256 | u32 gpiomask2; /* GPIO MUX mask */ | 239 | u32 gpiomask2; /* GPIO MUX mask */ |
257 | 240 | ||
258 | /* i2c audio flags */ | 241 | /* i2c audio flags */ |
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 9cb72f176f7d..ee989d2e15d9 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h | |||
@@ -41,7 +41,6 @@ | |||
41 | 41 | ||
42 | #include <linux/device.h> | 42 | #include <linux/device.h> |
43 | #include <media/video-buf.h> | 43 | #include <media/video-buf.h> |
44 | #include <media/audiochip.h> | ||
45 | #include <media/tuner.h> | 44 | #include <media/tuner.h> |
46 | #include <media/tveeprom.h> | 45 | #include <media/tveeprom.h> |
47 | #include <media/ir-common.h> | 46 | #include <media/ir-common.h> |
@@ -190,7 +189,8 @@ int bttv_buffer_activate_video(struct bttv *btv, | |||
190 | struct bttv_buffer_set *set); | 189 | struct bttv_buffer_set *set); |
191 | int bttv_buffer_activate_vbi(struct bttv *btv, | 190 | int bttv_buffer_activate_vbi(struct bttv *btv, |
192 | struct bttv_buffer *vbi); | 191 | struct bttv_buffer *vbi); |
193 | void bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf); | 192 | void bttv_dma_free(struct videobuf_queue *q, struct bttv *btv, |
193 | struct bttv_buffer *buf); | ||
194 | 194 | ||
195 | /* overlay handling */ | 195 | /* overlay handling */ |
196 | int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov, | 196 | int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov, |
@@ -298,6 +298,8 @@ struct bttv { | |||
298 | int i2c_state, i2c_rc; | 298 | int i2c_state, i2c_rc; |
299 | int i2c_done; | 299 | int i2c_done; |
300 | wait_queue_head_t i2c_queue; | 300 | wait_queue_head_t i2c_queue; |
301 | struct i2c_client *i2c_msp34xx_client; | ||
302 | struct i2c_client *i2c_tvaudio_client; | ||
301 | 303 | ||
302 | /* video4linux (1) */ | 304 | /* video4linux (1) */ |
303 | struct video_device *video_dev; | 305 | struct video_device *video_dev; |
@@ -320,6 +322,7 @@ struct bttv { | |||
320 | /* video state */ | 322 | /* video state */ |
321 | unsigned int input; | 323 | unsigned int input; |
322 | unsigned int audio; | 324 | unsigned int audio; |
325 | unsigned int mute; | ||
323 | unsigned long freq; | 326 | unsigned long freq; |
324 | int tvnorm,hue,contrast,bright,saturation; | 327 | int tvnorm,hue,contrast,bright,saturation; |
325 | struct v4l2_framebuffer fbuf; | 328 | struct v4l2_framebuffer fbuf; |
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index d97b7d8ac33d..cf61c590f4ad 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c | |||
@@ -150,7 +150,7 @@ static int qc_calibrate(struct qcam_device *q) | |||
150 | static struct qcam_device *qcam_init(struct parport *port) | 150 | static struct qcam_device *qcam_init(struct parport *port) |
151 | { | 151 | { |
152 | struct qcam_device *q; | 152 | struct qcam_device *q; |
153 | 153 | ||
154 | q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); | 154 | q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); |
155 | if(q==NULL) | 155 | if(q==NULL) |
156 | return NULL; | 156 | return NULL; |
@@ -158,16 +158,16 @@ static struct qcam_device *qcam_init(struct parport *port) | |||
158 | q->pport = port; | 158 | q->pport = port; |
159 | q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, | 159 | q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, |
160 | NULL, 0, NULL); | 160 | NULL, 0, NULL); |
161 | if (q->pdev == NULL) | 161 | if (q->pdev == NULL) |
162 | { | 162 | { |
163 | printk(KERN_ERR "bw-qcam: couldn't register for %s.\n", | 163 | printk(KERN_ERR "bw-qcam: couldn't register for %s.\n", |
164 | port->name); | 164 | port->name); |
165 | kfree(q); | 165 | kfree(q); |
166 | return NULL; | 166 | return NULL; |
167 | } | 167 | } |
168 | 168 | ||
169 | memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); | 169 | memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); |
170 | 170 | ||
171 | mutex_init(&q->lock); | 171 | mutex_init(&q->lock); |
172 | 172 | ||
173 | q->port_mode = (QC_ANY | QC_NOTSET); | 173 | q->port_mode = (QC_ANY | QC_NOTSET); |
@@ -236,12 +236,12 @@ static int qc_waithand(struct qcam_device *q, int val) | |||
236 | while (!((status = read_lpstatus(q)) & 8)) | 236 | while (!((status = read_lpstatus(q)) & 8)) |
237 | { | 237 | { |
238 | /* 1000 is enough spins on the I/O for all normal | 238 | /* 1000 is enough spins on the I/O for all normal |
239 | cases, at that point we start to poll slowly | 239 | cases, at that point we start to poll slowly |
240 | until the camera wakes up. However, we are | 240 | until the camera wakes up. However, we are |
241 | busy blocked until the camera responds, so | 241 | busy blocked until the camera responds, so |
242 | setting it lower is much better for interactive | 242 | setting it lower is much better for interactive |
243 | response. */ | 243 | response. */ |
244 | 244 | ||
245 | if(runs++>maxpoll) | 245 | if(runs++>maxpoll) |
246 | { | 246 | { |
247 | msleep_interruptible(5); | 247 | msleep_interruptible(5); |
@@ -255,12 +255,12 @@ static int qc_waithand(struct qcam_device *q, int val) | |||
255 | while (((status = read_lpstatus(q)) & 8)) | 255 | while (((status = read_lpstatus(q)) & 8)) |
256 | { | 256 | { |
257 | /* 1000 is enough spins on the I/O for all normal | 257 | /* 1000 is enough spins on the I/O for all normal |
258 | cases, at that point we start to poll slowly | 258 | cases, at that point we start to poll slowly |
259 | until the camera wakes up. However, we are | 259 | until the camera wakes up. However, we are |
260 | busy blocked until the camera responds, so | 260 | busy blocked until the camera responds, so |
261 | setting it lower is much better for interactive | 261 | setting it lower is much better for interactive |
262 | response. */ | 262 | response. */ |
263 | 263 | ||
264 | if(runs++>maxpoll) | 264 | if(runs++>maxpoll) |
265 | { | 265 | { |
266 | msleep_interruptible(5); | 266 | msleep_interruptible(5); |
@@ -282,17 +282,17 @@ static unsigned int qc_waithand2(struct qcam_device *q, int val) | |||
282 | { | 282 | { |
283 | unsigned int status; | 283 | unsigned int status; |
284 | int runs=0; | 284 | int runs=0; |
285 | 285 | ||
286 | do | 286 | do |
287 | { | 287 | { |
288 | status = read_lpdata(q); | 288 | status = read_lpdata(q); |
289 | /* 1000 is enough spins on the I/O for all normal | 289 | /* 1000 is enough spins on the I/O for all normal |
290 | cases, at that point we start to poll slowly | 290 | cases, at that point we start to poll slowly |
291 | until the camera wakes up. However, we are | 291 | until the camera wakes up. However, we are |
292 | busy blocked until the camera responds, so | 292 | busy blocked until the camera responds, so |
293 | setting it lower is much better for interactive | 293 | setting it lower is much better for interactive |
294 | response. */ | 294 | response. */ |
295 | 295 | ||
296 | if(runs++>maxpoll) | 296 | if(runs++>maxpoll) |
297 | { | 297 | { |
298 | msleep_interruptible(5); | 298 | msleep_interruptible(5); |
@@ -321,7 +321,7 @@ static int qc_detect(struct qcam_device *q) | |||
321 | 321 | ||
322 | lastreg = reg = read_lpstatus(q) & 0xf0; | 322 | lastreg = reg = read_lpstatus(q) & 0xf0; |
323 | 323 | ||
324 | for (i = 0; i < 500; i++) | 324 | for (i = 0; i < 500; i++) |
325 | { | 325 | { |
326 | reg = read_lpstatus(q) & 0xf0; | 326 | reg = read_lpstatus(q) & 0xf0; |
327 | if (reg != lastreg) | 327 | if (reg != lastreg) |
@@ -357,7 +357,7 @@ static int qc_detect(struct qcam_device *q) | |||
357 | 357 | ||
358 | static void qc_reset(struct qcam_device *q) | 358 | static void qc_reset(struct qcam_device *q) |
359 | { | 359 | { |
360 | switch (q->port_mode & QC_FORCE_MASK) | 360 | switch (q->port_mode & QC_FORCE_MASK) |
361 | { | 361 | { |
362 | case QC_FORCE_UNIDIR: | 362 | case QC_FORCE_UNIDIR: |
363 | q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; | 363 | q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; |
@@ -370,7 +370,7 @@ static void qc_reset(struct qcam_device *q) | |||
370 | case QC_ANY: | 370 | case QC_ANY: |
371 | write_lpcontrol(q, 0x20); | 371 | write_lpcontrol(q, 0x20); |
372 | write_lpdata(q, 0x75); | 372 | write_lpdata(q, 0x75); |
373 | 373 | ||
374 | if (read_lpdata(q) != 0x75) { | 374 | if (read_lpdata(q) != 0x75) { |
375 | q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; | 375 | q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; |
376 | } else { | 376 | } else { |
@@ -398,8 +398,8 @@ static void qc_reset(struct qcam_device *q) | |||
398 | static int qc_setscanmode(struct qcam_device *q) | 398 | static int qc_setscanmode(struct qcam_device *q) |
399 | { | 399 | { |
400 | int old_mode = q->mode; | 400 | int old_mode = q->mode; |
401 | 401 | ||
402 | switch (q->transfer_scale) | 402 | switch (q->transfer_scale) |
403 | { | 403 | { |
404 | case 1: | 404 | case 1: |
405 | q->mode = 0; | 405 | q->mode = 0; |
@@ -412,7 +412,7 @@ static int qc_setscanmode(struct qcam_device *q) | |||
412 | break; | 412 | break; |
413 | } | 413 | } |
414 | 414 | ||
415 | switch (q->bpp) | 415 | switch (q->bpp) |
416 | { | 416 | { |
417 | case 4: | 417 | case 4: |
418 | break; | 418 | break; |
@@ -421,7 +421,7 @@ static int qc_setscanmode(struct qcam_device *q) | |||
421 | break; | 421 | break; |
422 | } | 422 | } |
423 | 423 | ||
424 | switch (q->port_mode & QC_MODE_MASK) | 424 | switch (q->port_mode & QC_MODE_MASK) |
425 | { | 425 | { |
426 | case QC_BIDIR: | 426 | case QC_BIDIR: |
427 | q->mode += 1; | 427 | q->mode += 1; |
@@ -430,10 +430,10 @@ static int qc_setscanmode(struct qcam_device *q) | |||
430 | case QC_UNIDIR: | 430 | case QC_UNIDIR: |
431 | break; | 431 | break; |
432 | } | 432 | } |
433 | 433 | ||
434 | if (q->mode != old_mode) | 434 | if (q->mode != old_mode) |
435 | q->status |= QC_PARAM_CHANGE; | 435 | q->status |= QC_PARAM_CHANGE; |
436 | 436 | ||
437 | return 0; | 437 | return 0; |
438 | } | 438 | } |
439 | 439 | ||
@@ -451,7 +451,7 @@ static void qc_set(struct qcam_device *q) | |||
451 | /* Set the brightness. Yes, this is repetitive, but it works. | 451 | /* Set the brightness. Yes, this is repetitive, but it works. |
452 | * Shorter versions seem to fail subtly. Feel free to try :-). */ | 452 | * Shorter versions seem to fail subtly. Feel free to try :-). */ |
453 | /* I think the problem was in qc_command, not here -- bls */ | 453 | /* I think the problem was in qc_command, not here -- bls */ |
454 | 454 | ||
455 | qc_command(q, 0xb); | 455 | qc_command(q, 0xb); |
456 | qc_command(q, q->brightness); | 456 | qc_command(q, q->brightness); |
457 | 457 | ||
@@ -502,13 +502,13 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) | |||
502 | unsigned int hi2, lo2; | 502 | unsigned int hi2, lo2; |
503 | static int state = 0; | 503 | static int state = 0; |
504 | 504 | ||
505 | if (buffer == NULL) | 505 | if (buffer == NULL) |
506 | { | 506 | { |
507 | state = 0; | 507 | state = 0; |
508 | return 0; | 508 | return 0; |
509 | } | 509 | } |
510 | 510 | ||
511 | switch (q->port_mode & QC_MODE_MASK) | 511 | switch (q->port_mode & QC_MODE_MASK) |
512 | { | 512 | { |
513 | case QC_BIDIR: /* Bi-directional Port */ | 513 | case QC_BIDIR: /* Bi-directional Port */ |
514 | write_lpcontrol(q, 0x26); | 514 | write_lpcontrol(q, 0x26); |
@@ -517,7 +517,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) | |||
517 | write_lpcontrol(q, 0x2e); | 517 | write_lpcontrol(q, 0x2e); |
518 | lo2 = (qc_waithand2(q, 0) >> 1); | 518 | lo2 = (qc_waithand2(q, 0) >> 1); |
519 | hi2 = (read_lpstatus(q) >> 3) & 0x1f; | 519 | hi2 = (read_lpstatus(q) >> 3) & 0x1f; |
520 | switch (q->bpp) | 520 | switch (q->bpp) |
521 | { | 521 | { |
522 | case 4: | 522 | case 4: |
523 | buffer[0] = lo & 0xf; | 523 | buffer[0] = lo & 0xf; |
@@ -544,7 +544,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) | |||
544 | write_lpcontrol(q, 0xe); | 544 | write_lpcontrol(q, 0xe); |
545 | hi = (qc_waithand(q, 0) & 0xf0) >> 4; | 545 | hi = (qc_waithand(q, 0) & 0xf0) >> 4; |
546 | 546 | ||
547 | switch (q->bpp) | 547 | switch (q->bpp) |
548 | { | 548 | { |
549 | case 4: | 549 | case 4: |
550 | buffer[0] = lo; | 550 | buffer[0] = lo; |
@@ -552,7 +552,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) | |||
552 | ret = 2; | 552 | ret = 2; |
553 | break; | 553 | break; |
554 | case 6: | 554 | case 6: |
555 | switch (state) | 555 | switch (state) |
556 | { | 556 | { |
557 | case 0: | 557 | case 0: |
558 | buffer[0] = (lo << 2) | ((hi & 0xc) >> 2); | 558 | buffer[0] = (lo << 2) | ((hi & 0xc) >> 2); |
@@ -604,13 +604,13 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
604 | int shift=8-q->bpp; | 604 | int shift=8-q->bpp; |
605 | char invert; | 605 | char invert; |
606 | 606 | ||
607 | if (q->mode == -1) | 607 | if (q->mode == -1) |
608 | return -ENXIO; | 608 | return -ENXIO; |
609 | 609 | ||
610 | qc_command(q, 0x7); | 610 | qc_command(q, 0x7); |
611 | qc_command(q, q->mode); | 611 | qc_command(q, q->mode); |
612 | 612 | ||
613 | if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) | 613 | if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) |
614 | { | 614 | { |
615 | write_lpcontrol(q, 0x2e); /* turn port around */ | 615 | write_lpcontrol(q, 0x2e); /* turn port around */ |
616 | write_lpcontrol(q, 0x26); | 616 | write_lpcontrol(q, 0x26); |
@@ -618,7 +618,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
618 | write_lpcontrol(q, 0x2e); | 618 | write_lpcontrol(q, 0x2e); |
619 | (void) qc_waithand(q, 0); | 619 | (void) qc_waithand(q, 0); |
620 | } | 620 | } |
621 | 621 | ||
622 | /* strange -- should be 15:63 below, but 4bpp is odd */ | 622 | /* strange -- should be 15:63 below, but 4bpp is odd */ |
623 | invert = (q->bpp == 4) ? 16 : 63; | 623 | invert = (q->bpp == 4) ? 16 : 63; |
624 | 624 | ||
@@ -629,15 +629,15 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
629 | q->transfer_scale; | 629 | q->transfer_scale; |
630 | transperline = (transperline + divisor - 1) / divisor; | 630 | transperline = (transperline + divisor - 1) / divisor; |
631 | 631 | ||
632 | for (i = 0, yield = yieldlines; i < linestotrans; i++) | 632 | for (i = 0, yield = yieldlines; i < linestotrans; i++) |
633 | { | 633 | { |
634 | for (pixels_read = j = 0; j < transperline; j++) | 634 | for (pixels_read = j = 0; j < transperline; j++) |
635 | { | 635 | { |
636 | bytes = qc_readbytes(q, buffer); | 636 | bytes = qc_readbytes(q, buffer); |
637 | for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) | 637 | for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) |
638 | { | 638 | { |
639 | int o; | 639 | int o; |
640 | if (buffer[k] == 0 && invert == 16) | 640 | if (buffer[k] == 0 && invert == 16) |
641 | { | 641 | { |
642 | /* 4bpp is odd (again) -- inverter is 16, not 15, but output | 642 | /* 4bpp is odd (again) -- inverter is 16, not 15, but output |
643 | must be 0-15 -- bls */ | 643 | must be 0-15 -- bls */ |
@@ -653,7 +653,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
653 | pixels_read += bytes; | 653 | pixels_read += bytes; |
654 | } | 654 | } |
655 | (void) qc_readbytes(q, NULL); /* reset state machine */ | 655 | (void) qc_readbytes(q, NULL); /* reset state machine */ |
656 | 656 | ||
657 | /* Grabbing an entire frame from the quickcam is a lengthy | 657 | /* Grabbing an entire frame from the quickcam is a lengthy |
658 | process. We don't (usually) want to busy-block the | 658 | process. We don't (usually) want to busy-block the |
659 | processor for the entire frame. yieldlines is a module | 659 | processor for the entire frame. yieldlines is a module |
@@ -666,7 +666,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
666 | } | 666 | } |
667 | } | 667 | } |
668 | 668 | ||
669 | if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) | 669 | if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) |
670 | { | 670 | { |
671 | write_lpcontrol(q, 2); | 671 | write_lpcontrol(q, 2); |
672 | write_lpcontrol(q, 6); | 672 | write_lpcontrol(q, 6); |
@@ -687,7 +687,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
687 | { | 687 | { |
688 | struct video_device *dev = video_devdata(file); | 688 | struct video_device *dev = video_devdata(file); |
689 | struct qcam_device *qcam=(struct qcam_device *)dev; | 689 | struct qcam_device *qcam=(struct qcam_device *)dev; |
690 | 690 | ||
691 | switch(cmd) | 691 | switch(cmd) |
692 | { | 692 | { |
693 | case VIDIOCGCAP: | 693 | case VIDIOCGCAP: |
@@ -762,7 +762,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
762 | return -EINVAL; | 762 | return -EINVAL; |
763 | if(p->depth!=4 && p->depth!=6) | 763 | if(p->depth!=4 && p->depth!=6) |
764 | return -EINVAL; | 764 | return -EINVAL; |
765 | 765 | ||
766 | /* | 766 | /* |
767 | * Now load the camera. | 767 | * Now load the camera. |
768 | */ | 768 | */ |
@@ -790,11 +790,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
790 | return -EINVAL; | 790 | return -EINVAL; |
791 | if(vw->width<80||vw->width>320) | 791 | if(vw->width<80||vw->width>320) |
792 | return -EINVAL; | 792 | return -EINVAL; |
793 | 793 | ||
794 | qcam->width = 320; | 794 | qcam->width = 320; |
795 | qcam->height = 240; | 795 | qcam->height = 240; |
796 | qcam->transfer_scale = 4; | 796 | qcam->transfer_scale = 4; |
797 | 797 | ||
798 | if(vw->width>=160 && vw->height>=120) | 798 | if(vw->width>=160 && vw->height>=120) |
799 | { | 799 | { |
800 | qcam->transfer_scale = 2; | 800 | qcam->transfer_scale = 2; |
@@ -808,11 +808,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
808 | mutex_lock(&qcam->lock); | 808 | mutex_lock(&qcam->lock); |
809 | qc_setscanmode(qcam); | 809 | qc_setscanmode(qcam); |
810 | mutex_unlock(&qcam->lock); | 810 | mutex_unlock(&qcam->lock); |
811 | 811 | ||
812 | /* We must update the camera before we grab. We could | 812 | /* We must update the camera before we grab. We could |
813 | just have changed the grab size */ | 813 | just have changed the grab size */ |
814 | qcam->status |= QC_PARAM_CHANGE; | 814 | qcam->status |= QC_PARAM_CHANGE; |
815 | 815 | ||
816 | /* Ok we figured out what to use from our wide choice */ | 816 | /* Ok we figured out what to use from our wide choice */ |
817 | return 0; | 817 | return 0; |
818 | } | 818 | } |
@@ -853,9 +853,9 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
853 | struct qcam_device *qcam=(struct qcam_device *)v; | 853 | struct qcam_device *qcam=(struct qcam_device *)v; |
854 | int len; | 854 | int len; |
855 | parport_claim_or_block(qcam->pdev); | 855 | parport_claim_or_block(qcam->pdev); |
856 | 856 | ||
857 | mutex_lock(&qcam->lock); | 857 | mutex_lock(&qcam->lock); |
858 | 858 | ||
859 | qc_reset(qcam); | 859 | qc_reset(qcam); |
860 | 860 | ||
861 | /* Update the camera parameters if we need to */ | 861 | /* Update the camera parameters if we need to */ |
@@ -863,13 +863,13 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
863 | qc_set(qcam); | 863 | qc_set(qcam); |
864 | 864 | ||
865 | len=qc_capture(qcam, buf,count); | 865 | len=qc_capture(qcam, buf,count); |
866 | 866 | ||
867 | mutex_unlock(&qcam->lock); | 867 | mutex_unlock(&qcam->lock); |
868 | 868 | ||
869 | parport_release(qcam->pdev); | 869 | parport_release(qcam->pdev); |
870 | return len; | 870 | return len; |
871 | } | 871 | } |
872 | 872 | ||
873 | static struct file_operations qcam_fops = { | 873 | static struct file_operations qcam_fops = { |
874 | .owner = THIS_MODULE, | 874 | .owner = THIS_MODULE, |
875 | .open = video_exclusive_open, | 875 | .open = video_exclusive_open, |
@@ -905,11 +905,11 @@ static int init_bwqcam(struct parport *port) | |||
905 | qcam=qcam_init(port); | 905 | qcam=qcam_init(port); |
906 | if(qcam==NULL) | 906 | if(qcam==NULL) |
907 | return -ENODEV; | 907 | return -ENODEV; |
908 | 908 | ||
909 | parport_claim_or_block(qcam->pdev); | 909 | parport_claim_or_block(qcam->pdev); |
910 | 910 | ||
911 | qc_reset(qcam); | 911 | qc_reset(qcam); |
912 | 912 | ||
913 | if(qc_detect(qcam)==0) | 913 | if(qc_detect(qcam)==0) |
914 | { | 914 | { |
915 | parport_release(qcam->pdev); | 915 | parport_release(qcam->pdev); |
@@ -920,9 +920,9 @@ static int init_bwqcam(struct parport *port) | |||
920 | qc_calibrate(qcam); | 920 | qc_calibrate(qcam); |
921 | 921 | ||
922 | parport_release(qcam->pdev); | 922 | parport_release(qcam->pdev); |
923 | 923 | ||
924 | printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name); | 924 | printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name); |
925 | 925 | ||
926 | if(video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) | 926 | if(video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) |
927 | { | 927 | { |
928 | parport_unregister_device(qcam->pdev); | 928 | parport_unregister_device(qcam->pdev); |
@@ -1013,7 +1013,7 @@ static int __init init_bw_qcams(void) | |||
1013 | printk("Connectix Quickcam max-poll was above 5000. Using 5000.\n"); | 1013 | printk("Connectix Quickcam max-poll was above 5000. Using 5000.\n"); |
1014 | maxpoll = 5000; | 1014 | maxpoll = 5000; |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | if (yieldlines < 1) { | 1017 | if (yieldlines < 1) { |
1018 | printk("Connectix Quickcam yieldlines was less than 1. Using 1.\n"); | 1018 | printk("Connectix Quickcam yieldlines was less than 1. Using 1.\n"); |
1019 | yieldlines = 1; | 1019 | yieldlines = 1; |
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index 8211fd8d7cbf..22a7386bbea6 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * | 16 | * |
17 | * The parport parameter controls which parports will be scanned. | 17 | * The parport parameter controls which parports will be scanned. |
18 | * Scanning all parports causes some printers to print a garbage page. | 18 | * Scanning all parports causes some printers to print a garbage page. |
19 | * -- March 14, 1999 Billy Donahue <billy@escape.com> | 19 | * -- March 14, 1999 Billy Donahue <billy@escape.com> |
20 | * | 20 | * |
21 | * Fixed data format to BGR, added force_rgb parameter. Added missing | 21 | * Fixed data format to BGR, added force_rgb parameter. Added missing |
22 | * parport_unregister_driver() on module removal. | 22 | * parport_unregister_driver() on module removal. |
@@ -88,7 +88,7 @@ static inline unsigned int qcam_ready2(struct qcam_device *qcam) | |||
88 | return (parport_read_data(qcam->pport) & 0x1)?1:0; | 88 | return (parport_read_data(qcam->pport) & 0x1)?1:0; |
89 | } | 89 | } |
90 | 90 | ||
91 | static unsigned int qcam_await_ready1(struct qcam_device *qcam, | 91 | static unsigned int qcam_await_ready1(struct qcam_device *qcam, |
92 | int value) | 92 | int value) |
93 | { | 93 | { |
94 | unsigned long oldjiffies = jiffies; | 94 | unsigned long oldjiffies = jiffies; |
@@ -98,7 +98,7 @@ static unsigned int qcam_await_ready1(struct qcam_device *qcam, | |||
98 | if (qcam_ready1(qcam) == value) | 98 | if (qcam_ready1(qcam) == value) |
99 | return 0; | 99 | return 0; |
100 | 100 | ||
101 | /* If the camera didn't respond within 1/25 second, poll slowly | 101 | /* If the camera didn't respond within 1/25 second, poll slowly |
102 | for a while. */ | 102 | for a while. */ |
103 | for (i = 0; i < 50; i++) | 103 | for (i = 0; i < 50; i++) |
104 | { | 104 | { |
@@ -123,7 +123,7 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value) | |||
123 | if (qcam_ready2(qcam) == value) | 123 | if (qcam_ready2(qcam) == value) |
124 | return 0; | 124 | return 0; |
125 | 125 | ||
126 | /* If the camera didn't respond within 1/25 second, poll slowly | 126 | /* If the camera didn't respond within 1/25 second, poll slowly |
127 | for a while. */ | 127 | for a while. */ |
128 | for (i = 0; i < 50; i++) | 128 | for (i = 0; i < 50; i++) |
129 | { | 129 | { |
@@ -157,12 +157,12 @@ static int qcam_write_data(struct qcam_device *qcam, unsigned int data) | |||
157 | unsigned int idata; | 157 | unsigned int idata; |
158 | parport_write_data(qcam->pport, data); | 158 | parport_write_data(qcam->pport, data); |
159 | idata = qcam_read_data(qcam); | 159 | idata = qcam_read_data(qcam); |
160 | if (data != idata) | 160 | if (data != idata) |
161 | { | 161 | { |
162 | printk(KERN_WARNING "cqcam: sent %x but received %x\n", data, | 162 | printk(KERN_WARNING "cqcam: sent %x but received %x\n", data, |
163 | idata); | 163 | idata); |
164 | return 1; | 164 | return 1; |
165 | } | 165 | } |
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | 168 | ||
@@ -193,12 +193,12 @@ static int qc_detect(struct qcam_device *qcam) | |||
193 | no device was found". Fix this one day. */ | 193 | no device was found". Fix this one day. */ |
194 | if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA | 194 | if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA |
195 | && qcam->pport->probe_info[0].model | 195 | && qcam->pport->probe_info[0].model |
196 | && !strcmp(qcam->pdev->port->probe_info[0].model, | 196 | && !strcmp(qcam->pdev->port->probe_info[0].model, |
197 | "Color QuickCam 2.0")) { | 197 | "Color QuickCam 2.0")) { |
198 | printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n"); | 198 | printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n"); |
199 | return 1; | 199 | return 1; |
200 | } | 200 | } |
201 | 201 | ||
202 | if (probe < 2) | 202 | if (probe < 2) |
203 | return 0; | 203 | return 0; |
204 | 204 | ||
@@ -206,11 +206,11 @@ static int qc_detect(struct qcam_device *qcam) | |||
206 | 206 | ||
207 | /* look for a heartbeat */ | 207 | /* look for a heartbeat */ |
208 | ostat = stat = parport_read_status(qcam->pport); | 208 | ostat = stat = parport_read_status(qcam->pport); |
209 | for (i=0; i<250; i++) | 209 | for (i=0; i<250; i++) |
210 | { | 210 | { |
211 | mdelay(1); | 211 | mdelay(1); |
212 | stat = parport_read_status(qcam->pport); | 212 | stat = parport_read_status(qcam->pport); |
213 | if (ostat != stat) | 213 | if (ostat != stat) |
214 | { | 214 | { |
215 | if (++count >= 3) return 1; | 215 | if (++count >= 3) return 1; |
216 | ostat = stat; | 216 | ostat = stat; |
@@ -226,11 +226,11 @@ static int qc_detect(struct qcam_device *qcam) | |||
226 | count = 0; | 226 | count = 0; |
227 | 227 | ||
228 | ostat = stat = parport_read_status(qcam->pport); | 228 | ostat = stat = parport_read_status(qcam->pport); |
229 | for (i=0; i<250; i++) | 229 | for (i=0; i<250; i++) |
230 | { | 230 | { |
231 | mdelay(1); | 231 | mdelay(1); |
232 | stat = parport_read_status(qcam->pport); | 232 | stat = parport_read_status(qcam->pport); |
233 | if (ostat != stat) | 233 | if (ostat != stat) |
234 | { | 234 | { |
235 | if (++count >= 3) return 1; | 235 | if (++count >= 3) return 1; |
236 | ostat = stat; | 236 | ostat = stat; |
@@ -247,7 +247,7 @@ static void qc_reset(struct qcam_device *qcam) | |||
247 | parport_write_control(qcam->pport, 0x8); | 247 | parport_write_control(qcam->pport, 0x8); |
248 | mdelay(1); | 248 | mdelay(1); |
249 | parport_write_control(qcam->pport, 0xc); | 249 | parport_write_control(qcam->pport, 0xc); |
250 | mdelay(1); | 250 | mdelay(1); |
251 | } | 251 | } |
252 | 252 | ||
253 | /* Reset the QuickCam and program for brightness, contrast, | 253 | /* Reset the QuickCam and program for brightness, contrast, |
@@ -258,7 +258,7 @@ static void qc_setup(struct qcam_device *q) | |||
258 | qc_reset(q); | 258 | qc_reset(q); |
259 | 259 | ||
260 | /* Set the brightness. */ | 260 | /* Set the brightness. */ |
261 | qcam_set(q, 11, q->brightness); | 261 | qcam_set(q, 11, q->brightness); |
262 | 262 | ||
263 | /* Set the height and width. These refer to the actual | 263 | /* Set the height and width. These refer to the actual |
264 | CCD area *before* applying the selected decimation. */ | 264 | CCD area *before* applying the selected decimation. */ |
@@ -272,12 +272,12 @@ static void qc_setup(struct qcam_device *q) | |||
272 | /* Set contrast and white balance. */ | 272 | /* Set contrast and white balance. */ |
273 | qcam_set(q, 0x19, q->contrast); | 273 | qcam_set(q, 0x19, q->contrast); |
274 | qcam_set(q, 0x1f, q->whitebal); | 274 | qcam_set(q, 0x1f, q->whitebal); |
275 | 275 | ||
276 | /* Set the speed. */ | 276 | /* Set the speed. */ |
277 | qcam_set(q, 45, 2); | 277 | qcam_set(q, 45, 2); |
278 | } | 278 | } |
279 | 279 | ||
280 | /* Read some bytes from the camera and put them in the buffer. | 280 | /* Read some bytes from the camera and put them in the buffer. |
281 | nbytes should be a multiple of 3, because bidirectional mode gives | 281 | nbytes should be a multiple of 3, because bidirectional mode gives |
282 | us three bytes at a time. */ | 282 | us three bytes at a time. */ |
283 | 283 | ||
@@ -383,7 +383,7 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le | |||
383 | 383 | ||
384 | if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1)) | 384 | if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1)) |
385 | return -EIO; | 385 | return -EIO; |
386 | 386 | ||
387 | lines = q->height; | 387 | lines = q->height; |
388 | pixelsperline = q->width; | 388 | pixelsperline = q->width; |
389 | bitsperxfer = (is_bi_dir) ? 24 : 8; | 389 | bitsperxfer = (is_bi_dir) ? 24 : 8; |
@@ -499,7 +499,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
499 | { | 499 | { |
500 | struct video_device *dev = video_devdata(file); | 500 | struct video_device *dev = video_devdata(file); |
501 | struct qcam_device *qcam=(struct qcam_device *)dev; | 501 | struct qcam_device *qcam=(struct qcam_device *)dev; |
502 | 502 | ||
503 | switch(cmd) | 503 | switch(cmd) |
504 | { | 504 | { |
505 | case VIDIOCGCAP: | 505 | case VIDIOCGCAP: |
@@ -574,7 +574,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
574 | */ | 574 | */ |
575 | if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24) | 575 | if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24) |
576 | return -EINVAL; | 576 | return -EINVAL; |
577 | 577 | ||
578 | /* | 578 | /* |
579 | * Now load the camera. | 579 | * Now load the camera. |
580 | */ | 580 | */ |
@@ -584,7 +584,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
584 | 584 | ||
585 | mutex_lock(&qcam->lock); | 585 | mutex_lock(&qcam->lock); |
586 | parport_claim_or_block(qcam->pdev); | 586 | parport_claim_or_block(qcam->pdev); |
587 | qc_setup(qcam); | 587 | qc_setup(qcam); |
588 | parport_release(qcam->pdev); | 588 | parport_release(qcam->pdev); |
589 | mutex_unlock(&qcam->lock); | 589 | mutex_unlock(&qcam->lock); |
590 | return 0; | 590 | return 0; |
@@ -601,11 +601,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
601 | return -EINVAL; | 601 | return -EINVAL; |
602 | if(vw->width<80||vw->width>320) | 602 | if(vw->width<80||vw->width>320) |
603 | return -EINVAL; | 603 | return -EINVAL; |
604 | 604 | ||
605 | qcam->width = 80; | 605 | qcam->width = 80; |
606 | qcam->height = 60; | 606 | qcam->height = 60; |
607 | qcam->mode = QC_DECIMATION_4; | 607 | qcam->mode = QC_DECIMATION_4; |
608 | 608 | ||
609 | if(vw->width>=160 && vw->height>=120) | 609 | if(vw->width>=160 && vw->height>=120) |
610 | { | 610 | { |
611 | qcam->width = 160; | 611 | qcam->width = 160; |
@@ -627,7 +627,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
627 | qcam->mode = QC_BILLIONS | QC_DECIMATION_1; | 627 | qcam->mode = QC_BILLIONS | QC_DECIMATION_1; |
628 | } | 628 | } |
629 | #endif | 629 | #endif |
630 | /* Ok we figured out what to use from our | 630 | /* Ok we figured out what to use from our |
631 | wide choice */ | 631 | wide choice */ |
632 | mutex_lock(&qcam->lock); | 632 | mutex_lock(&qcam->lock); |
633 | parport_claim_or_block(qcam->pdev); | 633 | parport_claim_or_block(qcam->pdev); |
@@ -676,7 +676,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
676 | mutex_lock(&qcam->lock); | 676 | mutex_lock(&qcam->lock); |
677 | parport_claim_or_block(qcam->pdev); | 677 | parport_claim_or_block(qcam->pdev); |
678 | /* Probably should have a semaphore against multiple users */ | 678 | /* Probably should have a semaphore against multiple users */ |
679 | len = qc_capture(qcam, buf,count); | 679 | len = qc_capture(qcam, buf,count); |
680 | parport_release(qcam->pdev); | 680 | parport_release(qcam->pdev); |
681 | mutex_unlock(&qcam->lock); | 681 | mutex_unlock(&qcam->lock); |
682 | return len; | 682 | return len; |
@@ -707,7 +707,7 @@ static struct video_device qcam_template= | |||
707 | static struct qcam_device *qcam_init(struct parport *port) | 707 | static struct qcam_device *qcam_init(struct parport *port) |
708 | { | 708 | { |
709 | struct qcam_device *q; | 709 | struct qcam_device *q; |
710 | 710 | ||
711 | q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); | 711 | q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); |
712 | if(q==NULL) | 712 | if(q==NULL) |
713 | return NULL; | 713 | return NULL; |
@@ -718,14 +718,14 @@ static struct qcam_device *qcam_init(struct parport *port) | |||
718 | 718 | ||
719 | q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0; | 719 | q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0; |
720 | 720 | ||
721 | if (q->pdev == NULL) | 721 | if (q->pdev == NULL) |
722 | { | 722 | { |
723 | printk(KERN_ERR "c-qcam: couldn't register for %s.\n", | 723 | printk(KERN_ERR "c-qcam: couldn't register for %s.\n", |
724 | port->name); | 724 | port->name); |
725 | kfree(q); | 725 | kfree(q); |
726 | return NULL; | 726 | return NULL; |
727 | } | 727 | } |
728 | 728 | ||
729 | memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); | 729 | memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); |
730 | 730 | ||
731 | mutex_init(&q->lock); | 731 | mutex_init(&q->lock); |
@@ -766,11 +766,11 @@ static int init_cqcam(struct parport *port) | |||
766 | qcam = qcam_init(port); | 766 | qcam = qcam_init(port); |
767 | if (qcam==NULL) | 767 | if (qcam==NULL) |
768 | return -ENODEV; | 768 | return -ENODEV; |
769 | 769 | ||
770 | parport_claim_or_block(qcam->pdev); | 770 | parport_claim_or_block(qcam->pdev); |
771 | 771 | ||
772 | qc_reset(qcam); | 772 | qc_reset(qcam); |
773 | 773 | ||
774 | if (probe && qc_detect(qcam)==0) | 774 | if (probe && qc_detect(qcam)==0) |
775 | { | 775 | { |
776 | parport_release(qcam->pdev); | 776 | parport_release(qcam->pdev); |
@@ -782,7 +782,7 @@ static int init_cqcam(struct parport *port) | |||
782 | qc_setup(qcam); | 782 | qc_setup(qcam); |
783 | 783 | ||
784 | parport_release(qcam->pdev); | 784 | parport_release(qcam->pdev); |
785 | 785 | ||
786 | if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) | 786 | if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) |
787 | { | 787 | { |
788 | printk(KERN_ERR "Unable to register Colour QuickCam on %s\n", | 788 | printk(KERN_ERR "Unable to register Colour QuickCam on %s\n", |
@@ -792,9 +792,9 @@ static int init_cqcam(struct parport *port) | |||
792 | return -ENODEV; | 792 | return -ENODEV; |
793 | } | 793 | } |
794 | 794 | ||
795 | printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", | 795 | printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", |
796 | qcam->vdev.minor, qcam->pport->name); | 796 | qcam->vdev.minor, qcam->pport->name); |
797 | 797 | ||
798 | qcams[num_cams++] = qcam; | 798 | qcams[num_cams++] = qcam; |
799 | 799 | ||
800 | return 0; | 800 | return 0; |
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index 3cebfa91ca14..2227c5640c12 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c | |||
@@ -24,7 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ | 26 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ |
27 | /* #define _CPIA_DEBUG_ 1 */ | 27 | /* #define _CPIA_DEBUG_ 1 */ |
28 | 28 | ||
29 | #include <linux/config.h> | 29 | #include <linux/config.h> |
30 | 30 | ||
@@ -67,11 +67,11 @@ MODULE_SUPPORTED_DEVICE("video"); | |||
67 | static unsigned short colorspace_conv = 0; | 67 | static unsigned short colorspace_conv = 0; |
68 | module_param(colorspace_conv, ushort, 0444); | 68 | module_param(colorspace_conv, ushort, 0444); |
69 | MODULE_PARM_DESC(colorspace_conv, | 69 | MODULE_PARM_DESC(colorspace_conv, |
70 | "\n<n> Colorspace conversion:" | 70 | "\n<n> Colorspace conversion:" |
71 | "\n0 = disable" | 71 | "\n0 = disable" |
72 | "\n1 = enable" | 72 | "\n1 = enable" |
73 | "\nDefault value is 0" | 73 | "\nDefault value is 0" |
74 | "\n"); | 74 | "\n"); |
75 | 75 | ||
76 | #define ABOUT "V4L-Driver for Vision CPiA based cameras" | 76 | #define ABOUT "V4L-Driver for Vision CPiA based cameras" |
77 | 77 | ||
@@ -189,8 +189,8 @@ enum { | |||
189 | #define TC 94 | 189 | #define TC 94 |
190 | #define EXP_ACC_DARK 50 | 190 | #define EXP_ACC_DARK 50 |
191 | #define EXP_ACC_LIGHT 90 | 191 | #define EXP_ACC_LIGHT 90 |
192 | #define HIGH_COMP_102 160 | 192 | #define HIGH_COMP_102 160 |
193 | #define MAX_COMP 239 | 193 | #define MAX_COMP 239 |
194 | #define DARK_TIME 3 | 194 | #define DARK_TIME 3 |
195 | #define LIGHT_TIME 3 | 195 | #define LIGHT_TIME 3 |
196 | 196 | ||
@@ -208,7 +208,7 @@ static u8 flicker_jumps[2][2][4] = | |||
208 | static void reset_camera_struct(struct cam_data *cam); | 208 | static void reset_camera_struct(struct cam_data *cam); |
209 | static int find_over_exposure(int brightness); | 209 | static int find_over_exposure(int brightness); |
210 | static void set_flicker(struct cam_params *params, volatile u32 *command_flags, | 210 | static void set_flicker(struct cam_params *params, volatile u32 *command_flags, |
211 | int on); | 211 | int on); |
212 | 212 | ||
213 | 213 | ||
214 | /********************************************************************** | 214 | /********************************************************************** |
@@ -262,7 +262,7 @@ static void rvfree(void *mem, unsigned long size) | |||
262 | static struct proc_dir_entry *cpia_proc_root=NULL; | 262 | static struct proc_dir_entry *cpia_proc_root=NULL; |
263 | 263 | ||
264 | static int cpia_read_proc(char *page, char **start, off_t off, | 264 | static int cpia_read_proc(char *page, char **start, off_t off, |
265 | int count, int *eof, void *data) | 265 | int count, int *eof, void *data) |
266 | { | 266 | { |
267 | char *out = page; | 267 | char *out = page; |
268 | int len, tmp; | 268 | int len, tmp; |
@@ -276,58 +276,58 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
276 | out += sprintf(out, "V4L Driver version: %d.%d.%d\n", | 276 | out += sprintf(out, "V4L Driver version: %d.%d.%d\n", |
277 | CPIA_MAJ_VER, CPIA_MIN_VER, CPIA_PATCH_VER); | 277 | CPIA_MAJ_VER, CPIA_MIN_VER, CPIA_PATCH_VER); |
278 | out += sprintf(out, "CPIA Version: %d.%02d (%d.%d)\n", | 278 | out += sprintf(out, "CPIA Version: %d.%02d (%d.%d)\n", |
279 | cam->params.version.firmwareVersion, | 279 | cam->params.version.firmwareVersion, |
280 | cam->params.version.firmwareRevision, | 280 | cam->params.version.firmwareRevision, |
281 | cam->params.version.vcVersion, | 281 | cam->params.version.vcVersion, |
282 | cam->params.version.vcRevision); | 282 | cam->params.version.vcRevision); |
283 | out += sprintf(out, "CPIA PnP-ID: %04x:%04x:%04x\n", | 283 | out += sprintf(out, "CPIA PnP-ID: %04x:%04x:%04x\n", |
284 | cam->params.pnpID.vendor, cam->params.pnpID.product, | 284 | cam->params.pnpID.vendor, cam->params.pnpID.product, |
285 | cam->params.pnpID.deviceRevision); | 285 | cam->params.pnpID.deviceRevision); |
286 | out += sprintf(out, "VP-Version: %d.%d %04x\n", | 286 | out += sprintf(out, "VP-Version: %d.%d %04x\n", |
287 | cam->params.vpVersion.vpVersion, | 287 | cam->params.vpVersion.vpVersion, |
288 | cam->params.vpVersion.vpRevision, | 288 | cam->params.vpVersion.vpRevision, |
289 | cam->params.vpVersion.cameraHeadID); | 289 | cam->params.vpVersion.cameraHeadID); |
290 | 290 | ||
291 | out += sprintf(out, "system_state: %#04x\n", | 291 | out += sprintf(out, "system_state: %#04x\n", |
292 | cam->params.status.systemState); | 292 | cam->params.status.systemState); |
293 | out += sprintf(out, "grab_state: %#04x\n", | 293 | out += sprintf(out, "grab_state: %#04x\n", |
294 | cam->params.status.grabState); | 294 | cam->params.status.grabState); |
295 | out += sprintf(out, "stream_state: %#04x\n", | 295 | out += sprintf(out, "stream_state: %#04x\n", |
296 | cam->params.status.streamState); | 296 | cam->params.status.streamState); |
297 | out += sprintf(out, "fatal_error: %#04x\n", | 297 | out += sprintf(out, "fatal_error: %#04x\n", |
298 | cam->params.status.fatalError); | 298 | cam->params.status.fatalError); |
299 | out += sprintf(out, "cmd_error: %#04x\n", | 299 | out += sprintf(out, "cmd_error: %#04x\n", |
300 | cam->params.status.cmdError); | 300 | cam->params.status.cmdError); |
301 | out += sprintf(out, "debug_flags: %#04x\n", | 301 | out += sprintf(out, "debug_flags: %#04x\n", |
302 | cam->params.status.debugFlags); | 302 | cam->params.status.debugFlags); |
303 | out += sprintf(out, "vp_status: %#04x\n", | 303 | out += sprintf(out, "vp_status: %#04x\n", |
304 | cam->params.status.vpStatus); | 304 | cam->params.status.vpStatus); |
305 | out += sprintf(out, "error_code: %#04x\n", | 305 | out += sprintf(out, "error_code: %#04x\n", |
306 | cam->params.status.errorCode); | 306 | cam->params.status.errorCode); |
307 | /* QX3 specific entries */ | 307 | /* QX3 specific entries */ |
308 | if (cam->params.qx3.qx3_detected) { | 308 | if (cam->params.qx3.qx3_detected) { |
309 | out += sprintf(out, "button: %4d\n", | 309 | out += sprintf(out, "button: %4d\n", |
310 | cam->params.qx3.button); | 310 | cam->params.qx3.button); |
311 | out += sprintf(out, "cradled: %4d\n", | 311 | out += sprintf(out, "cradled: %4d\n", |
312 | cam->params.qx3.cradled); | 312 | cam->params.qx3.cradled); |
313 | } | 313 | } |
314 | out += sprintf(out, "video_size: %s\n", | 314 | out += sprintf(out, "video_size: %s\n", |
315 | cam->params.format.videoSize == VIDEOSIZE_CIF ? | 315 | cam->params.format.videoSize == VIDEOSIZE_CIF ? |
316 | "CIF " : "QCIF"); | 316 | "CIF " : "QCIF"); |
317 | out += sprintf(out, "roi: (%3d, %3d) to (%3d, %3d)\n", | 317 | out += sprintf(out, "roi: (%3d, %3d) to (%3d, %3d)\n", |
318 | cam->params.roi.colStart*8, | 318 | cam->params.roi.colStart*8, |
319 | cam->params.roi.rowStart*4, | 319 | cam->params.roi.rowStart*4, |
320 | cam->params.roi.colEnd*8, | 320 | cam->params.roi.colEnd*8, |
321 | cam->params.roi.rowEnd*4); | 321 | cam->params.roi.rowEnd*4); |
322 | out += sprintf(out, "actual_fps: %3d\n", cam->fps); | 322 | out += sprintf(out, "actual_fps: %3d\n", cam->fps); |
323 | out += sprintf(out, "transfer_rate: %4dkB/s\n", | 323 | out += sprintf(out, "transfer_rate: %4dkB/s\n", |
324 | cam->transfer_rate); | 324 | cam->transfer_rate); |
325 | 325 | ||
326 | out += sprintf(out, "\nread-write\n"); | 326 | out += sprintf(out, "\nread-write\n"); |
327 | out += sprintf(out, "----------------------- current min" | 327 | out += sprintf(out, "----------------------- current min" |
328 | " max default comment\n"); | 328 | " max default comment\n"); |
329 | out += sprintf(out, "brightness: %8d %8d %8d %8d\n", | 329 | out += sprintf(out, "brightness: %8d %8d %8d %8d\n", |
330 | cam->params.colourParams.brightness, 0, 100, 50); | 330 | cam->params.colourParams.brightness, 0, 100, 50); |
331 | if (cam->params.version.firmwareVersion == 1 && | 331 | if (cam->params.version.firmwareVersion == 1 && |
332 | cam->params.version.firmwareRevision == 2) | 332 | cam->params.version.firmwareRevision == 2) |
333 | /* 1-02 firmware limits contrast to 80 */ | 333 | /* 1-02 firmware limits contrast to 80 */ |
@@ -336,26 +336,26 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
336 | tmp = 96; | 336 | tmp = 96; |
337 | 337 | ||
338 | out += sprintf(out, "contrast: %8d %8d %8d %8d" | 338 | out += sprintf(out, "contrast: %8d %8d %8d %8d" |
339 | " steps of 8\n", | 339 | " steps of 8\n", |
340 | cam->params.colourParams.contrast, 0, tmp, 48); | 340 | cam->params.colourParams.contrast, 0, tmp, 48); |
341 | out += sprintf(out, "saturation: %8d %8d %8d %8d\n", | 341 | out += sprintf(out, "saturation: %8d %8d %8d %8d\n", |
342 | cam->params.colourParams.saturation, 0, 100, 50); | 342 | cam->params.colourParams.saturation, 0, 100, 50); |
343 | tmp = (25000+5000*cam->params.sensorFps.baserate)/ | 343 | tmp = (25000+5000*cam->params.sensorFps.baserate)/ |
344 | (1<<cam->params.sensorFps.divisor); | 344 | (1<<cam->params.sensorFps.divisor); |
345 | out += sprintf(out, "sensor_fps: %4d.%03d %8d %8d %8d\n", | 345 | out += sprintf(out, "sensor_fps: %4d.%03d %8d %8d %8d\n", |
346 | tmp/1000, tmp%1000, 3, 30, 15); | 346 | tmp/1000, tmp%1000, 3, 30, 15); |
347 | out += sprintf(out, "stream_start_line: %8d %8d %8d %8d\n", | 347 | out += sprintf(out, "stream_start_line: %8d %8d %8d %8d\n", |
348 | 2*cam->params.streamStartLine, 0, | 348 | 2*cam->params.streamStartLine, 0, |
349 | cam->params.format.videoSize == VIDEOSIZE_CIF ? 288:144, | 349 | cam->params.format.videoSize == VIDEOSIZE_CIF ? 288:144, |
350 | cam->params.format.videoSize == VIDEOSIZE_CIF ? 240:120); | 350 | cam->params.format.videoSize == VIDEOSIZE_CIF ? 240:120); |
351 | out += sprintf(out, "sub_sample: %8s %8s %8s %8s\n", | 351 | out += sprintf(out, "sub_sample: %8s %8s %8s %8s\n", |
352 | cam->params.format.subSample == SUBSAMPLE_420 ? | 352 | cam->params.format.subSample == SUBSAMPLE_420 ? |
353 | "420" : "422", "420", "422", "422"); | 353 | "420" : "422", "420", "422", "422"); |
354 | out += sprintf(out, "yuv_order: %8s %8s %8s %8s\n", | 354 | out += sprintf(out, "yuv_order: %8s %8s %8s %8s\n", |
355 | cam->params.format.yuvOrder == YUVORDER_YUYV ? | 355 | cam->params.format.yuvOrder == YUVORDER_YUYV ? |
356 | "YUYV" : "UYVY", "YUYV" , "UYVY", "YUYV"); | 356 | "YUYV" : "UYVY", "YUYV" , "UYVY", "YUYV"); |
357 | out += sprintf(out, "ecp_timing: %8s %8s %8s %8s\n", | 357 | out += sprintf(out, "ecp_timing: %8s %8s %8s %8s\n", |
358 | cam->params.ecpTiming ? "slow" : "normal", "slow", | 358 | cam->params.ecpTiming ? "slow" : "normal", "slow", |
359 | "normal", "normal"); | 359 | "normal", "normal"); |
360 | 360 | ||
361 | if (cam->params.colourBalance.balanceMode == 2) { | 361 | if (cam->params.colourBalance.balanceMode == 2) { |
@@ -366,11 +366,11 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
366 | out += sprintf(out, "color_balance_mode: %8s %8s %8s" | 366 | out += sprintf(out, "color_balance_mode: %8s %8s %8s" |
367 | " %8s\n", tmpstr, "manual", "auto", "auto"); | 367 | " %8s\n", tmpstr, "manual", "auto", "auto"); |
368 | out += sprintf(out, "red_gain: %8d %8d %8d %8d\n", | 368 | out += sprintf(out, "red_gain: %8d %8d %8d %8d\n", |
369 | cam->params.colourBalance.redGain, 0, 212, 32); | 369 | cam->params.colourBalance.redGain, 0, 212, 32); |
370 | out += sprintf(out, "green_gain: %8d %8d %8d %8d\n", | 370 | out += sprintf(out, "green_gain: %8d %8d %8d %8d\n", |
371 | cam->params.colourBalance.greenGain, 0, 212, 6); | 371 | cam->params.colourBalance.greenGain, 0, 212, 6); |
372 | out += sprintf(out, "blue_gain: %8d %8d %8d %8d\n", | 372 | out += sprintf(out, "blue_gain: %8d %8d %8d %8d\n", |
373 | cam->params.colourBalance.blueGain, 0, 212, 92); | 373 | cam->params.colourBalance.blueGain, 0, 212, 92); |
374 | 374 | ||
375 | if (cam->params.version.firmwareVersion == 1 && | 375 | if (cam->params.version.firmwareVersion == 1 && |
376 | cam->params.version.firmwareRevision == 2) | 376 | cam->params.version.firmwareRevision == 2) |
@@ -381,11 +381,11 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
381 | 381 | ||
382 | if (cam->params.exposure.gainMode == 0) | 382 | if (cam->params.exposure.gainMode == 0) |
383 | out += sprintf(out, "max_gain: unknown %28s" | 383 | out += sprintf(out, "max_gain: unknown %28s" |
384 | " powers of 2\n", tmpstr); | 384 | " powers of 2\n", tmpstr); |
385 | else | 385 | else |
386 | out += sprintf(out, "max_gain: %8d %28s" | 386 | out += sprintf(out, "max_gain: %8d %28s" |
387 | " 1,2,4 or 8 \n", | 387 | " 1,2,4 or 8 \n", |
388 | 1<<(cam->params.exposure.gainMode-1), tmpstr); | 388 | 1<<(cam->params.exposure.gainMode-1), tmpstr); |
389 | 389 | ||
390 | switch(cam->params.exposure.expMode) { | 390 | switch(cam->params.exposure.expMode) { |
391 | case 1: | 391 | case 1: |
@@ -402,10 +402,10 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
402 | out += sprintf(out, "exposure_mode: %8s %8s %8s" | 402 | out += sprintf(out, "exposure_mode: %8s %8s %8s" |
403 | " %8s\n", tmpstr, "manual", "auto", "auto"); | 403 | " %8s\n", tmpstr, "manual", "auto", "auto"); |
404 | out += sprintf(out, "centre_weight: %8s %8s %8s %8s\n", | 404 | out += sprintf(out, "centre_weight: %8s %8s %8s %8s\n", |
405 | (2-cam->params.exposure.centreWeight) ? "on" : "off", | 405 | (2-cam->params.exposure.centreWeight) ? "on" : "off", |
406 | "off", "on", "on"); | 406 | "off", "on", "on"); |
407 | out += sprintf(out, "gain: %8d %8d max_gain %8d 1,2,4,8 possible\n", | 407 | out += sprintf(out, "gain: %8d %8d max_gain %8d 1,2,4,8 possible\n", |
408 | 1<<cam->params.exposure.gain, 1, 1); | 408 | 1<<cam->params.exposure.gain, 1, 1); |
409 | if (cam->params.version.firmwareVersion == 1 && | 409 | if (cam->params.version.firmwareVersion == 1 && |
410 | cam->params.version.firmwareRevision == 2) | 410 | cam->params.version.firmwareRevision == 2) |
411 | /* 1-02 firmware limits fineExp/2 to 127 */ | 411 | /* 1-02 firmware limits fineExp/2 to 127 */ |
@@ -414,7 +414,7 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
414 | tmp = 510; | 414 | tmp = 510; |
415 | 415 | ||
416 | out += sprintf(out, "fine_exp: %8d %8d %8d %8d\n", | 416 | out += sprintf(out, "fine_exp: %8d %8d %8d %8d\n", |
417 | cam->params.exposure.fineExp*2, 0, tmp, 0); | 417 | cam->params.exposure.fineExp*2, 0, tmp, 0); |
418 | if (cam->params.version.firmwareVersion == 1 && | 418 | if (cam->params.version.firmwareVersion == 1 && |
419 | cam->params.version.firmwareRevision == 2) | 419 | cam->params.version.firmwareRevision == 2) |
420 | /* 1-02 firmware limits coarseExpHi to 0 */ | 420 | /* 1-02 firmware limits coarseExpHi to 0 */ |
@@ -426,46 +426,46 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
426 | " %8d\n", cam->params.exposure.coarseExpLo+ | 426 | " %8d\n", cam->params.exposure.coarseExpLo+ |
427 | 256*cam->params.exposure.coarseExpHi, 0, tmp, 185); | 427 | 256*cam->params.exposure.coarseExpHi, 0, tmp, 185); |
428 | out += sprintf(out, "red_comp: %8d %8d %8d %8d\n", | 428 | out += sprintf(out, "red_comp: %8d %8d %8d %8d\n", |
429 | cam->params.exposure.redComp, COMP_RED, 255, COMP_RED); | 429 | cam->params.exposure.redComp, COMP_RED, 255, COMP_RED); |
430 | out += sprintf(out, "green1_comp: %8d %8d %8d %8d\n", | 430 | out += sprintf(out, "green1_comp: %8d %8d %8d %8d\n", |
431 | cam->params.exposure.green1Comp, COMP_GREEN1, 255, | 431 | cam->params.exposure.green1Comp, COMP_GREEN1, 255, |
432 | COMP_GREEN1); | 432 | COMP_GREEN1); |
433 | out += sprintf(out, "green2_comp: %8d %8d %8d %8d\n", | 433 | out += sprintf(out, "green2_comp: %8d %8d %8d %8d\n", |
434 | cam->params.exposure.green2Comp, COMP_GREEN2, 255, | 434 | cam->params.exposure.green2Comp, COMP_GREEN2, 255, |
435 | COMP_GREEN2); | 435 | COMP_GREEN2); |
436 | out += sprintf(out, "blue_comp: %8d %8d %8d %8d\n", | 436 | out += sprintf(out, "blue_comp: %8d %8d %8d %8d\n", |
437 | cam->params.exposure.blueComp, COMP_BLUE, 255, COMP_BLUE); | 437 | cam->params.exposure.blueComp, COMP_BLUE, 255, COMP_BLUE); |
438 | 438 | ||
439 | out += sprintf(out, "apcor_gain1: %#8x %#8x %#8x %#8x\n", | 439 | out += sprintf(out, "apcor_gain1: %#8x %#8x %#8x %#8x\n", |
440 | cam->params.apcor.gain1, 0, 0xff, 0x1c); | 440 | cam->params.apcor.gain1, 0, 0xff, 0x1c); |
441 | out += sprintf(out, "apcor_gain2: %#8x %#8x %#8x %#8x\n", | 441 | out += sprintf(out, "apcor_gain2: %#8x %#8x %#8x %#8x\n", |
442 | cam->params.apcor.gain2, 0, 0xff, 0x1a); | 442 | cam->params.apcor.gain2, 0, 0xff, 0x1a); |
443 | out += sprintf(out, "apcor_gain4: %#8x %#8x %#8x %#8x\n", | 443 | out += sprintf(out, "apcor_gain4: %#8x %#8x %#8x %#8x\n", |
444 | cam->params.apcor.gain4, 0, 0xff, 0x2d); | 444 | cam->params.apcor.gain4, 0, 0xff, 0x2d); |
445 | out += sprintf(out, "apcor_gain8: %#8x %#8x %#8x %#8x\n", | 445 | out += sprintf(out, "apcor_gain8: %#8x %#8x %#8x %#8x\n", |
446 | cam->params.apcor.gain8, 0, 0xff, 0x2a); | 446 | cam->params.apcor.gain8, 0, 0xff, 0x2a); |
447 | out += sprintf(out, "vl_offset_gain1: %8d %8d %8d %8d\n", | 447 | out += sprintf(out, "vl_offset_gain1: %8d %8d %8d %8d\n", |
448 | cam->params.vlOffset.gain1, 0, 255, 24); | 448 | cam->params.vlOffset.gain1, 0, 255, 24); |
449 | out += sprintf(out, "vl_offset_gain2: %8d %8d %8d %8d\n", | 449 | out += sprintf(out, "vl_offset_gain2: %8d %8d %8d %8d\n", |
450 | cam->params.vlOffset.gain2, 0, 255, 28); | 450 | cam->params.vlOffset.gain2, 0, 255, 28); |
451 | out += sprintf(out, "vl_offset_gain4: %8d %8d %8d %8d\n", | 451 | out += sprintf(out, "vl_offset_gain4: %8d %8d %8d %8d\n", |
452 | cam->params.vlOffset.gain4, 0, 255, 30); | 452 | cam->params.vlOffset.gain4, 0, 255, 30); |
453 | out += sprintf(out, "vl_offset_gain8: %8d %8d %8d %8d\n", | 453 | out += sprintf(out, "vl_offset_gain8: %8d %8d %8d %8d\n", |
454 | cam->params.vlOffset.gain8, 0, 255, 30); | 454 | cam->params.vlOffset.gain8, 0, 255, 30); |
455 | out += sprintf(out, "flicker_control: %8s %8s %8s %8s\n", | 455 | out += sprintf(out, "flicker_control: %8s %8s %8s %8s\n", |
456 | cam->params.flickerControl.flickerMode ? "on" : "off", | 456 | cam->params.flickerControl.flickerMode ? "on" : "off", |
457 | "off", "on", "off"); | 457 | "off", "on", "off"); |
458 | out += sprintf(out, "mains_frequency: %8d %8d %8d %8d" | 458 | out += sprintf(out, "mains_frequency: %8d %8d %8d %8d" |
459 | " only 50/60\n", | 459 | " only 50/60\n", |
460 | cam->mainsFreq ? 60 : 50, 50, 60, 50); | 460 | cam->mainsFreq ? 60 : 50, 50, 60, 50); |
461 | if(cam->params.flickerControl.allowableOverExposure < 0) | 461 | if(cam->params.flickerControl.allowableOverExposure < 0) |
462 | out += sprintf(out, "allowable_overexposure: %4dauto auto %8d auto\n", | 462 | out += sprintf(out, "allowable_overexposure: %4dauto auto %8d auto\n", |
463 | -cam->params.flickerControl.allowableOverExposure, | 463 | -cam->params.flickerControl.allowableOverExposure, |
464 | 255); | 464 | 255); |
465 | else | 465 | else |
466 | out += sprintf(out, "allowable_overexposure: %8d auto %8d auto\n", | 466 | out += sprintf(out, "allowable_overexposure: %8d auto %8d auto\n", |
467 | cam->params.flickerControl.allowableOverExposure, | 467 | cam->params.flickerControl.allowableOverExposure, |
468 | 255); | 468 | 255); |
469 | out += sprintf(out, "compression_mode: "); | 469 | out += sprintf(out, "compression_mode: "); |
470 | switch(cam->params.compression.mode) { | 470 | switch(cam->params.compression.mode) { |
471 | case CPIA_COMPRESSION_NONE: | 471 | case CPIA_COMPRESSION_NONE: |
@@ -483,52 +483,52 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
483 | } | 483 | } |
484 | out += sprintf(out, " none,auto,manual auto\n"); | 484 | out += sprintf(out, " none,auto,manual auto\n"); |
485 | out += sprintf(out, "decimation_enable: %8s %8s %8s %8s\n", | 485 | out += sprintf(out, "decimation_enable: %8s %8s %8s %8s\n", |
486 | cam->params.compression.decimation == | 486 | cam->params.compression.decimation == |
487 | DECIMATION_ENAB ? "on":"off", "off", "on", | 487 | DECIMATION_ENAB ? "on":"off", "off", "on", |
488 | "off"); | 488 | "off"); |
489 | out += sprintf(out, "compression_target: %9s %9s %9s %9s\n", | 489 | out += sprintf(out, "compression_target: %9s %9s %9s %9s\n", |
490 | cam->params.compressionTarget.frTargeting == | 490 | cam->params.compressionTarget.frTargeting == |
491 | CPIA_COMPRESSION_TARGET_FRAMERATE ? | 491 | CPIA_COMPRESSION_TARGET_FRAMERATE ? |
492 | "framerate":"quality", | 492 | "framerate":"quality", |
493 | "framerate", "quality", "quality"); | 493 | "framerate", "quality", "quality"); |
494 | out += sprintf(out, "target_framerate: %8d %8d %8d %8d\n", | 494 | out += sprintf(out, "target_framerate: %8d %8d %8d %8d\n", |
495 | cam->params.compressionTarget.targetFR, 1, 30, 15); | 495 | cam->params.compressionTarget.targetFR, 1, 30, 15); |
496 | out += sprintf(out, "target_quality: %8d %8d %8d %8d\n", | 496 | out += sprintf(out, "target_quality: %8d %8d %8d %8d\n", |
497 | cam->params.compressionTarget.targetQ, 1, 64, 5); | 497 | cam->params.compressionTarget.targetQ, 1, 64, 5); |
498 | out += sprintf(out, "y_threshold: %8d %8d %8d %8d\n", | 498 | out += sprintf(out, "y_threshold: %8d %8d %8d %8d\n", |
499 | cam->params.yuvThreshold.yThreshold, 0, 31, 6); | 499 | cam->params.yuvThreshold.yThreshold, 0, 31, 6); |
500 | out += sprintf(out, "uv_threshold: %8d %8d %8d %8d\n", | 500 | out += sprintf(out, "uv_threshold: %8d %8d %8d %8d\n", |
501 | cam->params.yuvThreshold.uvThreshold, 0, 31, 6); | 501 | cam->params.yuvThreshold.uvThreshold, 0, 31, 6); |
502 | out += sprintf(out, "hysteresis: %8d %8d %8d %8d\n", | 502 | out += sprintf(out, "hysteresis: %8d %8d %8d %8d\n", |
503 | cam->params.compressionParams.hysteresis, 0, 255, 3); | 503 | cam->params.compressionParams.hysteresis, 0, 255, 3); |
504 | out += sprintf(out, "threshold_max: %8d %8d %8d %8d\n", | 504 | out += sprintf(out, "threshold_max: %8d %8d %8d %8d\n", |
505 | cam->params.compressionParams.threshMax, 0, 255, 11); | 505 | cam->params.compressionParams.threshMax, 0, 255, 11); |
506 | out += sprintf(out, "small_step: %8d %8d %8d %8d\n", | 506 | out += sprintf(out, "small_step: %8d %8d %8d %8d\n", |
507 | cam->params.compressionParams.smallStep, 0, 255, 1); | 507 | cam->params.compressionParams.smallStep, 0, 255, 1); |
508 | out += sprintf(out, "large_step: %8d %8d %8d %8d\n", | 508 | out += sprintf(out, "large_step: %8d %8d %8d %8d\n", |
509 | cam->params.compressionParams.largeStep, 0, 255, 3); | 509 | cam->params.compressionParams.largeStep, 0, 255, 3); |
510 | out += sprintf(out, "decimation_hysteresis: %8d %8d %8d %8d\n", | 510 | out += sprintf(out, "decimation_hysteresis: %8d %8d %8d %8d\n", |
511 | cam->params.compressionParams.decimationHysteresis, | 511 | cam->params.compressionParams.decimationHysteresis, |
512 | 0, 255, 2); | 512 | 0, 255, 2); |
513 | out += sprintf(out, "fr_diff_step_thresh: %8d %8d %8d %8d\n", | 513 | out += sprintf(out, "fr_diff_step_thresh: %8d %8d %8d %8d\n", |
514 | cam->params.compressionParams.frDiffStepThresh, | 514 | cam->params.compressionParams.frDiffStepThresh, |
515 | 0, 255, 5); | 515 | 0, 255, 5); |
516 | out += sprintf(out, "q_diff_step_thresh: %8d %8d %8d %8d\n", | 516 | out += sprintf(out, "q_diff_step_thresh: %8d %8d %8d %8d\n", |
517 | cam->params.compressionParams.qDiffStepThresh, | 517 | cam->params.compressionParams.qDiffStepThresh, |
518 | 0, 255, 3); | 518 | 0, 255, 3); |
519 | out += sprintf(out, "decimation_thresh_mod: %8d %8d %8d %8d\n", | 519 | out += sprintf(out, "decimation_thresh_mod: %8d %8d %8d %8d\n", |
520 | cam->params.compressionParams.decimationThreshMod, | 520 | cam->params.compressionParams.decimationThreshMod, |
521 | 0, 255, 2); | 521 | 0, 255, 2); |
522 | /* QX3 specific entries */ | 522 | /* QX3 specific entries */ |
523 | if (cam->params.qx3.qx3_detected) { | 523 | if (cam->params.qx3.qx3_detected) { |
524 | out += sprintf(out, "toplight: %8s %8s %8s %8s\n", | 524 | out += sprintf(out, "toplight: %8s %8s %8s %8s\n", |
525 | cam->params.qx3.toplight ? "on" : "off", | 525 | cam->params.qx3.toplight ? "on" : "off", |
526 | "off", "on", "off"); | 526 | "off", "on", "off"); |
527 | out += sprintf(out, "bottomlight: %8s %8s %8s %8s\n", | 527 | out += sprintf(out, "bottomlight: %8s %8s %8s %8s\n", |
528 | cam->params.qx3.bottomlight ? "on" : "off", | 528 | cam->params.qx3.bottomlight ? "on" : "off", |
529 | "off", "on", "off"); | 529 | "off", "on", "off"); |
530 | } | 530 | } |
531 | 531 | ||
532 | len = out - page; | 532 | len = out - page; |
533 | len -= off; | 533 | len -= off; |
534 | if (len < count) { | 534 | if (len < count) { |
@@ -543,7 +543,7 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
543 | 543 | ||
544 | 544 | ||
545 | static int match(char *checkstr, char **buffer, unsigned long *count, | 545 | static int match(char *checkstr, char **buffer, unsigned long *count, |
546 | int *find_colon, int *err) | 546 | int *find_colon, int *err) |
547 | { | 547 | { |
548 | int ret, colon_found = 1; | 548 | int ret, colon_found = 1; |
549 | int len = strlen(checkstr); | 549 | int len = strlen(checkstr); |
@@ -583,7 +583,7 @@ static unsigned long int value(char **buffer, unsigned long *count, int *err) | |||
583 | } | 583 | } |
584 | 584 | ||
585 | static int cpia_write_proc(struct file *file, const char __user *buf, | 585 | static int cpia_write_proc(struct file *file, const char __user *buf, |
586 | unsigned long count, void *data) | 586 | unsigned long count, void *data) |
587 | { | 587 | { |
588 | struct cam_data *cam = data; | 588 | struct cam_data *cam = data; |
589 | struct cam_params new_params; | 589 | struct cam_params new_params; |
@@ -619,12 +619,12 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
619 | retval = -EINVAL; | 619 | retval = -EINVAL; |
620 | goto out; | 620 | goto out; |
621 | } | 621 | } |
622 | 622 | ||
623 | buffer = page; | 623 | buffer = page; |
624 | 624 | ||
625 | if (mutex_lock_interruptible(&cam->param_lock)) | 625 | if (mutex_lock_interruptible(&cam->param_lock)) |
626 | return -ERESTARTSYS; | 626 | return -ERESTARTSYS; |
627 | 627 | ||
628 | /* | 628 | /* |
629 | * Skip over leading whitespace | 629 | * Skip over leading whitespace |
630 | */ | 630 | */ |
@@ -632,15 +632,15 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
632 | --count; | 632 | --count; |
633 | ++buffer; | 633 | ++buffer; |
634 | } | 634 | } |
635 | 635 | ||
636 | memcpy(&new_params, &cam->params, sizeof(struct cam_params)); | 636 | memcpy(&new_params, &cam->params, sizeof(struct cam_params)); |
637 | new_mains = cam->mainsFreq; | 637 | new_mains = cam->mainsFreq; |
638 | 638 | ||
639 | #define MATCH(x) (match(x, &buffer, &count, &find_colon, &retval)) | 639 | #define MATCH(x) (match(x, &buffer, &count, &find_colon, &retval)) |
640 | #define VALUE (value(&buffer,&count, &retval)) | 640 | #define VALUE (value(&buffer,&count, &retval)) |
641 | #define FIRMWARE_VERSION(x,y) (new_params.version.firmwareVersion == (x) && \ | 641 | #define FIRMWARE_VERSION(x,y) (new_params.version.firmwareVersion == (x) && \ |
642 | new_params.version.firmwareRevision == (y)) | 642 | new_params.version.firmwareRevision == (y)) |
643 | 643 | ||
644 | retval = 0; | 644 | retval = 0; |
645 | while (count && !retval) { | 645 | while (count && !retval) { |
646 | find_colon = 1; | 646 | find_colon = 1; |
@@ -656,7 +656,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
656 | } | 656 | } |
657 | command_flags |= COMMAND_SETCOLOURPARAMS; | 657 | command_flags |= COMMAND_SETCOLOURPARAMS; |
658 | if(new_params.flickerControl.allowableOverExposure < 0) | 658 | if(new_params.flickerControl.allowableOverExposure < 0) |
659 | new_params.flickerControl.allowableOverExposure = | 659 | new_params.flickerControl.allowableOverExposure = |
660 | -find_over_exposure(new_params.colourParams.brightness); | 660 | -find_over_exposure(new_params.colourParams.brightness); |
661 | if(new_params.flickerControl.flickerMode != 0) | 661 | if(new_params.flickerControl.flickerMode != 0) |
662 | command_flags |= COMMAND_SETFLICKERCTRL; | 662 | command_flags |= COMMAND_SETFLICKERCTRL; |
@@ -721,7 +721,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
721 | /* Either base rate would work here */ | 721 | /* Either base rate would work here */ |
722 | new_params.sensorFps.baserate = 1; | 722 | new_params.sensorFps.baserate = 1; |
723 | } | 723 | } |
724 | new_params.flickerControl.coarseJump = | 724 | new_params.flickerControl.coarseJump = |
725 | flicker_jumps[new_mains] | 725 | flicker_jumps[new_mains] |
726 | [new_params.sensorFps.baserate] | 726 | [new_params.sensorFps.baserate] |
727 | [new_params.sensorFps.divisor]; | 727 | [new_params.sensorFps.divisor]; |
@@ -1085,7 +1085,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1085 | } else if (MATCH("mains_frequency")) { | 1085 | } else if (MATCH("mains_frequency")) { |
1086 | if (!retval && MATCH("50")) { | 1086 | if (!retval && MATCH("50")) { |
1087 | new_mains = 0; | 1087 | new_mains = 0; |
1088 | new_params.flickerControl.coarseJump = | 1088 | new_params.flickerControl.coarseJump = |
1089 | flicker_jumps[new_mains] | 1089 | flicker_jumps[new_mains] |
1090 | [new_params.sensorFps.baserate] | 1090 | [new_params.sensorFps.baserate] |
1091 | [new_params.sensorFps.divisor]; | 1091 | [new_params.sensorFps.divisor]; |
@@ -1093,7 +1093,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1093 | command_flags |= COMMAND_SETFLICKERCTRL; | 1093 | command_flags |= COMMAND_SETFLICKERCTRL; |
1094 | } else if (!retval && MATCH("60")) { | 1094 | } else if (!retval && MATCH("60")) { |
1095 | new_mains = 1; | 1095 | new_mains = 1; |
1096 | new_params.flickerControl.coarseJump = | 1096 | new_params.flickerControl.coarseJump = |
1097 | flicker_jumps[new_mains] | 1097 | flicker_jumps[new_mains] |
1098 | [new_params.sensorFps.baserate] | 1098 | [new_params.sensorFps.baserate] |
1099 | [new_params.sensorFps.divisor]; | 1099 | [new_params.sensorFps.divisor]; |
@@ -1103,7 +1103,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1103 | retval = -EINVAL; | 1103 | retval = -EINVAL; |
1104 | } else if (MATCH("allowable_overexposure")) { | 1104 | } else if (MATCH("allowable_overexposure")) { |
1105 | if (!retval && MATCH("auto")) { | 1105 | if (!retval && MATCH("auto")) { |
1106 | new_params.flickerControl.allowableOverExposure = | 1106 | new_params.flickerControl.allowableOverExposure = |
1107 | -find_over_exposure(new_params.colourParams.brightness); | 1107 | -find_over_exposure(new_params.colourParams.brightness); |
1108 | if(new_params.flickerControl.flickerMode != 0) | 1108 | if(new_params.flickerControl.flickerMode != 0) |
1109 | command_flags |= COMMAND_SETFLICKERCTRL; | 1109 | command_flags |= COMMAND_SETFLICKERCTRL; |
@@ -1146,10 +1146,10 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1146 | command_flags |= COMMAND_SETCOMPRESSION; | 1146 | command_flags |= COMMAND_SETCOMPRESSION; |
1147 | } else if (MATCH("compression_target")) { | 1147 | } else if (MATCH("compression_target")) { |
1148 | if (!retval && MATCH("quality")) | 1148 | if (!retval && MATCH("quality")) |
1149 | new_params.compressionTarget.frTargeting = | 1149 | new_params.compressionTarget.frTargeting = |
1150 | CPIA_COMPRESSION_TARGET_QUALITY; | 1150 | CPIA_COMPRESSION_TARGET_QUALITY; |
1151 | else if (!retval && MATCH("framerate")) | 1151 | else if (!retval && MATCH("framerate")) |
1152 | new_params.compressionTarget.frTargeting = | 1152 | new_params.compressionTarget.frTargeting = |
1153 | CPIA_COMPRESSION_TARGET_FRAMERATE; | 1153 | CPIA_COMPRESSION_TARGET_FRAMERATE; |
1154 | else | 1154 | else |
1155 | retval = -EINVAL; | 1155 | retval = -EINVAL; |
@@ -1173,7 +1173,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1173 | if (!retval) { | 1173 | if (!retval) { |
1174 | if(val > 0 && val <= 64) | 1174 | if(val > 0 && val <= 64) |
1175 | new_params.compressionTarget.targetQ = val; | 1175 | new_params.compressionTarget.targetQ = val; |
1176 | else | 1176 | else |
1177 | retval = -EINVAL; | 1177 | retval = -EINVAL; |
1178 | } | 1178 | } |
1179 | command_flags |= COMMAND_SETCOMPRESSIONTARGET; | 1179 | command_flags |= COMMAND_SETCOMPRESSIONTARGET; |
@@ -1288,19 +1288,19 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1288 | } | 1288 | } |
1289 | command_flags |= COMMAND_SETCOMPRESSIONPARAMS; | 1289 | command_flags |= COMMAND_SETCOMPRESSIONPARAMS; |
1290 | } else if (MATCH("toplight")) { | 1290 | } else if (MATCH("toplight")) { |
1291 | if (!retval && MATCH("on")) | 1291 | if (!retval && MATCH("on")) |
1292 | new_params.qx3.toplight = 1; | 1292 | new_params.qx3.toplight = 1; |
1293 | else if (!retval && MATCH("off")) | 1293 | else if (!retval && MATCH("off")) |
1294 | new_params.qx3.toplight = 0; | 1294 | new_params.qx3.toplight = 0; |
1295 | else | 1295 | else |
1296 | retval = -EINVAL; | 1296 | retval = -EINVAL; |
1297 | command_flags |= COMMAND_SETLIGHTS; | 1297 | command_flags |= COMMAND_SETLIGHTS; |
1298 | } else if (MATCH("bottomlight")) { | 1298 | } else if (MATCH("bottomlight")) { |
1299 | if (!retval && MATCH("on")) | 1299 | if (!retval && MATCH("on")) |
1300 | new_params.qx3.bottomlight = 1; | 1300 | new_params.qx3.bottomlight = 1; |
1301 | else if (!retval && MATCH("off")) | 1301 | else if (!retval && MATCH("off")) |
1302 | new_params.qx3.bottomlight = 0; | 1302 | new_params.qx3.bottomlight = 0; |
1303 | else | 1303 | else |
1304 | retval = -EINVAL; | 1304 | retval = -EINVAL; |
1305 | command_flags |= COMMAND_SETLIGHTS; | 1305 | command_flags |= COMMAND_SETLIGHTS; |
1306 | } else { | 1306 | } else { |
@@ -1326,7 +1326,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1326 | } | 1326 | } |
1327 | } | 1327 | } |
1328 | } | 1328 | } |
1329 | #undef MATCH | 1329 | #undef MATCH |
1330 | #undef VALUE | 1330 | #undef VALUE |
1331 | #undef FIRMWARE_VERSION | 1331 | #undef FIRMWARE_VERSION |
1332 | if (!retval) { | 1332 | if (!retval) { |
@@ -1349,24 +1349,24 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1349 | retval = size; | 1349 | retval = size; |
1350 | } else | 1350 | } else |
1351 | DBG("error: %d\n", retval); | 1351 | DBG("error: %d\n", retval); |
1352 | 1352 | ||
1353 | mutex_unlock(&cam->param_lock); | 1353 | mutex_unlock(&cam->param_lock); |
1354 | 1354 | ||
1355 | out: | 1355 | out: |
1356 | free_page((unsigned long)page); | 1356 | free_page((unsigned long)page); |
1357 | return retval; | 1357 | return retval; |
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | static void create_proc_cpia_cam(struct cam_data *cam) | 1360 | static void create_proc_cpia_cam(struct cam_data *cam) |
1361 | { | 1361 | { |
1362 | char name[7]; | 1362 | char name[7]; |
1363 | struct proc_dir_entry *ent; | 1363 | struct proc_dir_entry *ent; |
1364 | 1364 | ||
1365 | if (!cpia_proc_root || !cam) | 1365 | if (!cpia_proc_root || !cam) |
1366 | return; | 1366 | return; |
1367 | 1367 | ||
1368 | sprintf(name, "video%d", cam->vdev.minor); | 1368 | sprintf(name, "video%d", cam->vdev.minor); |
1369 | 1369 | ||
1370 | ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root); | 1370 | ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root); |
1371 | if (!ent) | 1371 | if (!ent) |
1372 | return; | 1372 | return; |
@@ -1374,9 +1374,9 @@ static void create_proc_cpia_cam(struct cam_data *cam) | |||
1374 | ent->data = cam; | 1374 | ent->data = cam; |
1375 | ent->read_proc = cpia_read_proc; | 1375 | ent->read_proc = cpia_read_proc; |
1376 | ent->write_proc = cpia_write_proc; | 1376 | ent->write_proc = cpia_write_proc; |
1377 | /* | 1377 | /* |
1378 | size of the proc entry is 3736 bytes for the standard webcam; | 1378 | size of the proc entry is 3736 bytes for the standard webcam; |
1379 | the extra features of the QX3 microscope add 189 bytes. | 1379 | the extra features of the QX3 microscope add 189 bytes. |
1380 | (we have not yet probed the camera to see which type it is). | 1380 | (we have not yet probed the camera to see which type it is). |
1381 | */ | 1381 | */ |
1382 | ent->size = 3736 + 189; | 1382 | ent->size = 3736 + 189; |
@@ -1386,10 +1386,10 @@ static void create_proc_cpia_cam(struct cam_data *cam) | |||
1386 | static void destroy_proc_cpia_cam(struct cam_data *cam) | 1386 | static void destroy_proc_cpia_cam(struct cam_data *cam) |
1387 | { | 1387 | { |
1388 | char name[7]; | 1388 | char name[7]; |
1389 | 1389 | ||
1390 | if (!cam || !cam->proc_entry) | 1390 | if (!cam || !cam->proc_entry) |
1391 | return; | 1391 | return; |
1392 | 1392 | ||
1393 | sprintf(name, "video%d", cam->vdev.minor); | 1393 | sprintf(name, "video%d", cam->vdev.minor); |
1394 | remove_proc_entry(name, cpia_proc_root); | 1394 | remove_proc_entry(name, cpia_proc_root); |
1395 | cam->proc_entry = NULL; | 1395 | cam->proc_entry = NULL; |
@@ -1596,13 +1596,13 @@ static void set_vw_size(struct cam_data *cam) | |||
1596 | cam->vc.width = cam->vw.width; | 1596 | cam->vc.width = cam->vw.width; |
1597 | if(cam->vc.height == 0) | 1597 | if(cam->vc.height == 0) |
1598 | cam->vc.height = cam->vw.height; | 1598 | cam->vc.height = cam->vw.height; |
1599 | 1599 | ||
1600 | cam->params.roi.colStart += cam->vc.x >> 3; | 1600 | cam->params.roi.colStart += cam->vc.x >> 3; |
1601 | cam->params.roi.colEnd = cam->params.roi.colStart + | 1601 | cam->params.roi.colEnd = cam->params.roi.colStart + |
1602 | (cam->vc.width >> 3); | 1602 | (cam->vc.width >> 3); |
1603 | cam->params.roi.rowStart += cam->vc.y >> 2; | 1603 | cam->params.roi.rowStart += cam->vc.y >> 2; |
1604 | cam->params.roi.rowEnd = cam->params.roi.rowStart + | 1604 | cam->params.roi.rowEnd = cam->params.roi.rowStart + |
1605 | (cam->vc.height >> 2); | 1605 | (cam->vc.height >> 2); |
1606 | 1606 | ||
1607 | return; | 1607 | return; |
1608 | } | 1608 | } |
@@ -1624,7 +1624,7 @@ static int allocate_frame_buf(struct cam_data *cam) | |||
1624 | static int free_frame_buf(struct cam_data *cam) | 1624 | static int free_frame_buf(struct cam_data *cam) |
1625 | { | 1625 | { |
1626 | int i; | 1626 | int i; |
1627 | 1627 | ||
1628 | rvfree(cam->frame_buf, FRAME_NUM*CPIA_MAX_FRAME_SIZE); | 1628 | rvfree(cam->frame_buf, FRAME_NUM*CPIA_MAX_FRAME_SIZE); |
1629 | cam->frame_buf = NULL; | 1629 | cam->frame_buf = NULL; |
1630 | for (i=0; i < FRAME_NUM; i++) | 1630 | for (i=0; i < FRAME_NUM; i++) |
@@ -1667,7 +1667,7 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d) | |||
1667 | mutex_lock(&cam->param_lock); | 1667 | mutex_lock(&cam->param_lock); |
1668 | datasize=8; | 1668 | datasize=8; |
1669 | break; | 1669 | break; |
1670 | case CPIA_COMMAND_ReadMCPorts: | 1670 | case CPIA_COMMAND_ReadMCPorts: |
1671 | case CPIA_COMMAND_ReadVCRegs: | 1671 | case CPIA_COMMAND_ReadVCRegs: |
1672 | datasize = 4; | 1672 | datasize = 4; |
1673 | break; | 1673 | break; |
@@ -1746,10 +1746,10 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d) | |||
1746 | mutex_unlock(&cam->param_lock); | 1746 | mutex_unlock(&cam->param_lock); |
1747 | break; | 1747 | break; |
1748 | 1748 | ||
1749 | case CPIA_COMMAND_ReadMCPorts: | 1749 | case CPIA_COMMAND_ReadMCPorts: |
1750 | if (!cam->params.qx3.qx3_detected) | 1750 | if (!cam->params.qx3.qx3_detected) |
1751 | break; | 1751 | break; |
1752 | /* test button press */ | 1752 | /* test button press */ |
1753 | cam->params.qx3.button = ((data[1] & 0x02) == 0); | 1753 | cam->params.qx3.button = ((data[1] & 0x02) == 0); |
1754 | if (cam->params.qx3.button) { | 1754 | if (cam->params.qx3.button) { |
1755 | /* button pressed - unlock the latch */ | 1755 | /* button pressed - unlock the latch */ |
@@ -1770,9 +1770,9 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d) | |||
1770 | 1770 | ||
1771 | /* send a command to the camera with an additional data transaction */ | 1771 | /* send a command to the camera with an additional data transaction */ |
1772 | static int do_command_extended(struct cam_data *cam, u16 command, | 1772 | static int do_command_extended(struct cam_data *cam, u16 command, |
1773 | u8 a, u8 b, u8 c, u8 d, | 1773 | u8 a, u8 b, u8 c, u8 d, |
1774 | u8 e, u8 f, u8 g, u8 h, | 1774 | u8 e, u8 f, u8 g, u8 h, |
1775 | u8 i, u8 j, u8 k, u8 l) | 1775 | u8 i, u8 j, u8 k, u8 l) |
1776 | { | 1776 | { |
1777 | int retval; | 1777 | int retval; |
1778 | u8 cmd[8], data[8]; | 1778 | u8 cmd[8], data[8]; |
@@ -1809,10 +1809,10 @@ static int do_command_extended(struct cam_data *cam, u16 command, | |||
1809 | #define LIMIT(x) ((((x)>0xffffff)?0xff0000:(((x)<=0xffff)?0:(x)&0xff0000))>>16) | 1809 | #define LIMIT(x) ((((x)>0xffffff)?0xff0000:(((x)<=0xffff)?0:(x)&0xff0000))>>16) |
1810 | 1810 | ||
1811 | static int convert420(unsigned char *yuv, unsigned char *rgb, int out_fmt, | 1811 | static int convert420(unsigned char *yuv, unsigned char *rgb, int out_fmt, |
1812 | int linesize, int mmap_kludge) | 1812 | int linesize, int mmap_kludge) |
1813 | { | 1813 | { |
1814 | int y, u, v, r, g, b, y1; | 1814 | int y, u, v, r, g, b, y1; |
1815 | 1815 | ||
1816 | /* Odd lines use the same u and v as the previous line. | 1816 | /* Odd lines use the same u and v as the previous line. |
1817 | * Because of compression, it is necessary to get this | 1817 | * Because of compression, it is necessary to get this |
1818 | * information from the decoded image. */ | 1818 | * information from the decoded image. */ |
@@ -1925,7 +1925,7 @@ static int convert420(unsigned char *yuv, unsigned char *rgb, int out_fmt, | |||
1925 | 1925 | ||
1926 | 1926 | ||
1927 | static int yuvconvert(unsigned char *yuv, unsigned char *rgb, int out_fmt, | 1927 | static int yuvconvert(unsigned char *yuv, unsigned char *rgb, int out_fmt, |
1928 | int in_uyvy, int mmap_kludge) | 1928 | int in_uyvy, int mmap_kludge) |
1929 | { | 1929 | { |
1930 | int y, u, v, r, g, b, y1; | 1930 | int y, u, v, r, g, b, y1; |
1931 | 1931 | ||
@@ -2078,21 +2078,21 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2078 | mutex_unlock(&cam->param_lock); | 2078 | mutex_unlock(&cam->param_lock); |
2079 | return -1; | 2079 | return -1; |
2080 | } | 2080 | } |
2081 | 2081 | ||
2082 | if (ibuf[17] != SUBSAMPLE_420 && ibuf[17] != SUBSAMPLE_422) { | 2082 | if (ibuf[17] != SUBSAMPLE_420 && ibuf[17] != SUBSAMPLE_422) { |
2083 | LOG("illegal subtype %d\n",ibuf[17]); | 2083 | LOG("illegal subtype %d\n",ibuf[17]); |
2084 | mutex_unlock(&cam->param_lock); | 2084 | mutex_unlock(&cam->param_lock); |
2085 | return -1; | 2085 | return -1; |
2086 | } | 2086 | } |
2087 | subsample_422 = ibuf[17] == SUBSAMPLE_422; | 2087 | subsample_422 = ibuf[17] == SUBSAMPLE_422; |
2088 | 2088 | ||
2089 | if (ibuf[18] != YUVORDER_YUYV && ibuf[18] != YUVORDER_UYVY) { | 2089 | if (ibuf[18] != YUVORDER_YUYV && ibuf[18] != YUVORDER_UYVY) { |
2090 | LOG("illegal yuvorder %d\n",ibuf[18]); | 2090 | LOG("illegal yuvorder %d\n",ibuf[18]); |
2091 | mutex_unlock(&cam->param_lock); | 2091 | mutex_unlock(&cam->param_lock); |
2092 | return -1; | 2092 | return -1; |
2093 | } | 2093 | } |
2094 | in_uyvy = ibuf[18] == YUVORDER_UYVY; | 2094 | in_uyvy = ibuf[18] == YUVORDER_UYVY; |
2095 | 2095 | ||
2096 | if ((ibuf[24] != cam->params.roi.colStart) || | 2096 | if ((ibuf[24] != cam->params.roi.colStart) || |
2097 | (ibuf[25] != cam->params.roi.colEnd) || | 2097 | (ibuf[25] != cam->params.roi.colEnd) || |
2098 | (ibuf[26] != cam->params.roi.rowStart) || | 2098 | (ibuf[26] != cam->params.roi.rowStart) || |
@@ -2104,20 +2104,20 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2104 | cols = 8*(ibuf[25] - ibuf[24]); | 2104 | cols = 8*(ibuf[25] - ibuf[24]); |
2105 | rows = 4*(ibuf[27] - ibuf[26]); | 2105 | rows = 4*(ibuf[27] - ibuf[26]); |
2106 | 2106 | ||
2107 | 2107 | ||
2108 | if ((ibuf[28] != NOT_COMPRESSED) && (ibuf[28] != COMPRESSED)) { | 2108 | if ((ibuf[28] != NOT_COMPRESSED) && (ibuf[28] != COMPRESSED)) { |
2109 | LOG("illegal compression %d\n",ibuf[28]); | 2109 | LOG("illegal compression %d\n",ibuf[28]); |
2110 | mutex_unlock(&cam->param_lock); | 2110 | mutex_unlock(&cam->param_lock); |
2111 | return -1; | 2111 | return -1; |
2112 | } | 2112 | } |
2113 | compressed = (ibuf[28] == COMPRESSED); | 2113 | compressed = (ibuf[28] == COMPRESSED); |
2114 | 2114 | ||
2115 | if (ibuf[29] != NO_DECIMATION && ibuf[29] != DECIMATION_ENAB) { | 2115 | if (ibuf[29] != NO_DECIMATION && ibuf[29] != DECIMATION_ENAB) { |
2116 | LOG("illegal decimation %d\n",ibuf[29]); | 2116 | LOG("illegal decimation %d\n",ibuf[29]); |
2117 | mutex_unlock(&cam->param_lock); | 2117 | mutex_unlock(&cam->param_lock); |
2118 | return -1; | 2118 | return -1; |
2119 | } | 2119 | } |
2120 | decimation = (ibuf[29] == DECIMATION_ENAB); | 2120 | decimation = (ibuf[29] == DECIMATION_ENAB); |
2121 | 2121 | ||
2122 | cam->params.yuvThreshold.yThreshold = ibuf[30]; | 2122 | cam->params.yuvThreshold.yThreshold = ibuf[30]; |
2123 | cam->params.yuvThreshold.uvThreshold = ibuf[31]; | 2123 | cam->params.yuvThreshold.uvThreshold = ibuf[31]; |
@@ -2131,7 +2131,7 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2131 | cam->params.status.errorCode = ibuf[39]; | 2131 | cam->params.status.errorCode = ibuf[39]; |
2132 | cam->fps = ibuf[41]; | 2132 | cam->fps = ibuf[41]; |
2133 | mutex_unlock(&cam->param_lock); | 2133 | mutex_unlock(&cam->param_lock); |
2134 | 2134 | ||
2135 | linesize = skipcount(cols, out_fmt); | 2135 | linesize = skipcount(cols, out_fmt); |
2136 | ibuf += FRAME_HEADER_SIZE; | 2136 | ibuf += FRAME_HEADER_SIZE; |
2137 | size -= FRAME_HEADER_SIZE; | 2137 | size -= FRAME_HEADER_SIZE; |
@@ -2150,14 +2150,14 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2150 | if (!compressed || (compressed && !(*ibuf & 1))) { | 2150 | if (!compressed || (compressed && !(*ibuf & 1))) { |
2151 | if(subsample_422 || even_line) { | 2151 | if(subsample_422 || even_line) { |
2152 | obuf += yuvconvert(ibuf, obuf, out_fmt, | 2152 | obuf += yuvconvert(ibuf, obuf, out_fmt, |
2153 | in_uyvy, cam->mmap_kludge); | 2153 | in_uyvy, cam->mmap_kludge); |
2154 | ibuf += 4; | 2154 | ibuf += 4; |
2155 | ll -= 4; | 2155 | ll -= 4; |
2156 | } else { | 2156 | } else { |
2157 | /* SUBSAMPLE_420 on an odd line */ | 2157 | /* SUBSAMPLE_420 on an odd line */ |
2158 | obuf += convert420(ibuf, obuf, | 2158 | obuf += convert420(ibuf, obuf, |
2159 | out_fmt, linesize, | 2159 | out_fmt, linesize, |
2160 | cam->mmap_kludge); | 2160 | cam->mmap_kludge); |
2161 | ibuf += 2; | 2161 | ibuf += 2; |
2162 | ll -= 2; | 2162 | ll -= 2; |
2163 | } | 2163 | } |
@@ -2183,7 +2183,7 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2183 | 2183 | ||
2184 | if ((size > 3) && (ibuf[0] == EOI) && (ibuf[1] == EOI) && | 2184 | if ((size > 3) && (ibuf[0] == EOI) && (ibuf[1] == EOI) && |
2185 | (ibuf[2] == EOI) && (ibuf[3] == EOI)) { | 2185 | (ibuf[2] == EOI) && (ibuf[3] == EOI)) { |
2186 | size -= 4; | 2186 | size -= 4; |
2187 | break; | 2187 | break; |
2188 | } | 2188 | } |
2189 | 2189 | ||
@@ -2204,7 +2204,7 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2204 | return -1; | 2204 | return -1; |
2205 | } | 2205 | } |
2206 | } | 2206 | } |
2207 | 2207 | ||
2208 | if(decimation) { | 2208 | if(decimation) { |
2209 | /* interpolate odd rows */ | 2209 | /* interpolate odd rows */ |
2210 | int i, j; | 2210 | int i, j; |
@@ -2233,7 +2233,7 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2233 | static inline int init_stream_cap(struct cam_data *cam) | 2233 | static inline int init_stream_cap(struct cam_data *cam) |
2234 | { | 2234 | { |
2235 | return do_command(cam, CPIA_COMMAND_InitStreamCap, | 2235 | return do_command(cam, CPIA_COMMAND_InitStreamCap, |
2236 | 0, cam->params.streamStartLine, 0, 0); | 2236 | 0, cam->params.streamStartLine, 0, 0); |
2237 | } | 2237 | } |
2238 | 2238 | ||
2239 | 2239 | ||
@@ -2254,7 +2254,7 @@ static int find_over_exposure(int brightness) | |||
2254 | int MaxAllowableOverExposure, OverExposure; | 2254 | int MaxAllowableOverExposure, OverExposure; |
2255 | 2255 | ||
2256 | MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness - | 2256 | MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness - |
2257 | FLICKER_BRIGHTNESS_CONSTANT; | 2257 | FLICKER_BRIGHTNESS_CONSTANT; |
2258 | 2258 | ||
2259 | if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE) { | 2259 | if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE) { |
2260 | OverExposure = MaxAllowableOverExposure; | 2260 | OverExposure = MaxAllowableOverExposure; |
@@ -2280,62 +2280,62 @@ static void dispatch_commands(struct cam_data *cam) | |||
2280 | DEB_BYTE(cam->cmd_queue>>8); | 2280 | DEB_BYTE(cam->cmd_queue>>8); |
2281 | if (cam->cmd_queue & COMMAND_SETFORMAT) { | 2281 | if (cam->cmd_queue & COMMAND_SETFORMAT) { |
2282 | do_command(cam, CPIA_COMMAND_SetFormat, | 2282 | do_command(cam, CPIA_COMMAND_SetFormat, |
2283 | cam->params.format.videoSize, | 2283 | cam->params.format.videoSize, |
2284 | cam->params.format.subSample, | 2284 | cam->params.format.subSample, |
2285 | cam->params.format.yuvOrder, 0); | 2285 | cam->params.format.yuvOrder, 0); |
2286 | do_command(cam, CPIA_COMMAND_SetROI, | 2286 | do_command(cam, CPIA_COMMAND_SetROI, |
2287 | cam->params.roi.colStart, cam->params.roi.colEnd, | 2287 | cam->params.roi.colStart, cam->params.roi.colEnd, |
2288 | cam->params.roi.rowStart, cam->params.roi.rowEnd); | 2288 | cam->params.roi.rowStart, cam->params.roi.rowEnd); |
2289 | cam->first_frame = 1; | 2289 | cam->first_frame = 1; |
2290 | } | 2290 | } |
2291 | 2291 | ||
2292 | if (cam->cmd_queue & COMMAND_SETCOLOURPARAMS) | 2292 | if (cam->cmd_queue & COMMAND_SETCOLOURPARAMS) |
2293 | do_command(cam, CPIA_COMMAND_SetColourParams, | 2293 | do_command(cam, CPIA_COMMAND_SetColourParams, |
2294 | cam->params.colourParams.brightness, | 2294 | cam->params.colourParams.brightness, |
2295 | cam->params.colourParams.contrast, | 2295 | cam->params.colourParams.contrast, |
2296 | cam->params.colourParams.saturation, 0); | 2296 | cam->params.colourParams.saturation, 0); |
2297 | 2297 | ||
2298 | if (cam->cmd_queue & COMMAND_SETAPCOR) | 2298 | if (cam->cmd_queue & COMMAND_SETAPCOR) |
2299 | do_command(cam, CPIA_COMMAND_SetApcor, | 2299 | do_command(cam, CPIA_COMMAND_SetApcor, |
2300 | cam->params.apcor.gain1, | 2300 | cam->params.apcor.gain1, |
2301 | cam->params.apcor.gain2, | 2301 | cam->params.apcor.gain2, |
2302 | cam->params.apcor.gain4, | 2302 | cam->params.apcor.gain4, |
2303 | cam->params.apcor.gain8); | 2303 | cam->params.apcor.gain8); |
2304 | 2304 | ||
2305 | if (cam->cmd_queue & COMMAND_SETVLOFFSET) | 2305 | if (cam->cmd_queue & COMMAND_SETVLOFFSET) |
2306 | do_command(cam, CPIA_COMMAND_SetVLOffset, | 2306 | do_command(cam, CPIA_COMMAND_SetVLOffset, |
2307 | cam->params.vlOffset.gain1, | 2307 | cam->params.vlOffset.gain1, |
2308 | cam->params.vlOffset.gain2, | 2308 | cam->params.vlOffset.gain2, |
2309 | cam->params.vlOffset.gain4, | 2309 | cam->params.vlOffset.gain4, |
2310 | cam->params.vlOffset.gain8); | 2310 | cam->params.vlOffset.gain8); |
2311 | 2311 | ||
2312 | if (cam->cmd_queue & COMMAND_SETEXPOSURE) { | 2312 | if (cam->cmd_queue & COMMAND_SETEXPOSURE) { |
2313 | do_command_extended(cam, CPIA_COMMAND_SetExposure, | 2313 | do_command_extended(cam, CPIA_COMMAND_SetExposure, |
2314 | cam->params.exposure.gainMode, | 2314 | cam->params.exposure.gainMode, |
2315 | 1, | 2315 | 1, |
2316 | cam->params.exposure.compMode, | 2316 | cam->params.exposure.compMode, |
2317 | cam->params.exposure.centreWeight, | 2317 | cam->params.exposure.centreWeight, |
2318 | cam->params.exposure.gain, | 2318 | cam->params.exposure.gain, |
2319 | cam->params.exposure.fineExp, | 2319 | cam->params.exposure.fineExp, |
2320 | cam->params.exposure.coarseExpLo, | 2320 | cam->params.exposure.coarseExpLo, |
2321 | cam->params.exposure.coarseExpHi, | 2321 | cam->params.exposure.coarseExpHi, |
2322 | cam->params.exposure.redComp, | 2322 | cam->params.exposure.redComp, |
2323 | cam->params.exposure.green1Comp, | 2323 | cam->params.exposure.green1Comp, |
2324 | cam->params.exposure.green2Comp, | 2324 | cam->params.exposure.green2Comp, |
2325 | cam->params.exposure.blueComp); | 2325 | cam->params.exposure.blueComp); |
2326 | if(cam->params.exposure.expMode != 1) { | 2326 | if(cam->params.exposure.expMode != 1) { |
2327 | do_command_extended(cam, CPIA_COMMAND_SetExposure, | 2327 | do_command_extended(cam, CPIA_COMMAND_SetExposure, |
2328 | 0, | 2328 | 0, |
2329 | cam->params.exposure.expMode, | 2329 | cam->params.exposure.expMode, |
2330 | 0, 0, | 2330 | 0, 0, |
2331 | cam->params.exposure.gain, | 2331 | cam->params.exposure.gain, |
2332 | cam->params.exposure.fineExp, | 2332 | cam->params.exposure.fineExp, |
2333 | cam->params.exposure.coarseExpLo, | 2333 | cam->params.exposure.coarseExpLo, |
2334 | cam->params.exposure.coarseExpHi, | 2334 | cam->params.exposure.coarseExpHi, |
2335 | 0, 0, 0, 0); | 2335 | 0, 0, 0, 0); |
2336 | } | 2336 | } |
2337 | } | 2337 | } |
2338 | 2338 | ||
2339 | if (cam->cmd_queue & COMMAND_SETCOLOURBALANCE) { | 2339 | if (cam->cmd_queue & COMMAND_SETCOLOURBALANCE) { |
2340 | if (cam->params.colourBalance.balanceMode == 1) { | 2340 | if (cam->params.colourBalance.balanceMode == 1) { |
2341 | do_command(cam, CPIA_COMMAND_SetColourBalance, | 2341 | do_command(cam, CPIA_COMMAND_SetColourBalance, |
@@ -2358,47 +2358,47 @@ static void dispatch_commands(struct cam_data *cam) | |||
2358 | 2358 | ||
2359 | if (cam->cmd_queue & COMMAND_SETCOMPRESSIONTARGET) | 2359 | if (cam->cmd_queue & COMMAND_SETCOMPRESSIONTARGET) |
2360 | do_command(cam, CPIA_COMMAND_SetCompressionTarget, | 2360 | do_command(cam, CPIA_COMMAND_SetCompressionTarget, |
2361 | cam->params.compressionTarget.frTargeting, | 2361 | cam->params.compressionTarget.frTargeting, |
2362 | cam->params.compressionTarget.targetFR, | 2362 | cam->params.compressionTarget.targetFR, |
2363 | cam->params.compressionTarget.targetQ, 0); | 2363 | cam->params.compressionTarget.targetQ, 0); |
2364 | 2364 | ||
2365 | if (cam->cmd_queue & COMMAND_SETYUVTHRESH) | 2365 | if (cam->cmd_queue & COMMAND_SETYUVTHRESH) |
2366 | do_command(cam, CPIA_COMMAND_SetYUVThresh, | 2366 | do_command(cam, CPIA_COMMAND_SetYUVThresh, |
2367 | cam->params.yuvThreshold.yThreshold, | 2367 | cam->params.yuvThreshold.yThreshold, |
2368 | cam->params.yuvThreshold.uvThreshold, 0, 0); | 2368 | cam->params.yuvThreshold.uvThreshold, 0, 0); |
2369 | 2369 | ||
2370 | if (cam->cmd_queue & COMMAND_SETCOMPRESSIONPARAMS) | 2370 | if (cam->cmd_queue & COMMAND_SETCOMPRESSIONPARAMS) |
2371 | do_command_extended(cam, CPIA_COMMAND_SetCompressionParams, | 2371 | do_command_extended(cam, CPIA_COMMAND_SetCompressionParams, |
2372 | 0, 0, 0, 0, | 2372 | 0, 0, 0, 0, |
2373 | cam->params.compressionParams.hysteresis, | 2373 | cam->params.compressionParams.hysteresis, |
2374 | cam->params.compressionParams.threshMax, | 2374 | cam->params.compressionParams.threshMax, |
2375 | cam->params.compressionParams.smallStep, | 2375 | cam->params.compressionParams.smallStep, |
2376 | cam->params.compressionParams.largeStep, | 2376 | cam->params.compressionParams.largeStep, |
2377 | cam->params.compressionParams.decimationHysteresis, | 2377 | cam->params.compressionParams.decimationHysteresis, |
2378 | cam->params.compressionParams.frDiffStepThresh, | 2378 | cam->params.compressionParams.frDiffStepThresh, |
2379 | cam->params.compressionParams.qDiffStepThresh, | 2379 | cam->params.compressionParams.qDiffStepThresh, |
2380 | cam->params.compressionParams.decimationThreshMod); | 2380 | cam->params.compressionParams.decimationThreshMod); |
2381 | 2381 | ||
2382 | if (cam->cmd_queue & COMMAND_SETCOMPRESSION) | 2382 | if (cam->cmd_queue & COMMAND_SETCOMPRESSION) |
2383 | do_command(cam, CPIA_COMMAND_SetCompression, | 2383 | do_command(cam, CPIA_COMMAND_SetCompression, |
2384 | cam->params.compression.mode, | 2384 | cam->params.compression.mode, |
2385 | cam->params.compression.decimation, 0, 0); | 2385 | cam->params.compression.decimation, 0, 0); |
2386 | 2386 | ||
2387 | if (cam->cmd_queue & COMMAND_SETSENSORFPS) | 2387 | if (cam->cmd_queue & COMMAND_SETSENSORFPS) |
2388 | do_command(cam, CPIA_COMMAND_SetSensorFPS, | 2388 | do_command(cam, CPIA_COMMAND_SetSensorFPS, |
2389 | cam->params.sensorFps.divisor, | 2389 | cam->params.sensorFps.divisor, |
2390 | cam->params.sensorFps.baserate, 0, 0); | 2390 | cam->params.sensorFps.baserate, 0, 0); |
2391 | 2391 | ||
2392 | if (cam->cmd_queue & COMMAND_SETFLICKERCTRL) | 2392 | if (cam->cmd_queue & COMMAND_SETFLICKERCTRL) |
2393 | do_command(cam, CPIA_COMMAND_SetFlickerCtrl, | 2393 | do_command(cam, CPIA_COMMAND_SetFlickerCtrl, |
2394 | cam->params.flickerControl.flickerMode, | 2394 | cam->params.flickerControl.flickerMode, |
2395 | cam->params.flickerControl.coarseJump, | 2395 | cam->params.flickerControl.coarseJump, |
2396 | abs(cam->params.flickerControl.allowableOverExposure), | 2396 | abs(cam->params.flickerControl.allowableOverExposure), |
2397 | 0); | 2397 | 0); |
2398 | 2398 | ||
2399 | if (cam->cmd_queue & COMMAND_SETECPTIMING) | 2399 | if (cam->cmd_queue & COMMAND_SETECPTIMING) |
2400 | do_command(cam, CPIA_COMMAND_SetECPTiming, | 2400 | do_command(cam, CPIA_COMMAND_SetECPTiming, |
2401 | cam->params.ecpTiming, 0, 0, 0); | 2401 | cam->params.ecpTiming, 0, 0, 0); |
2402 | 2402 | ||
2403 | if (cam->cmd_queue & COMMAND_PAUSE) | 2403 | if (cam->cmd_queue & COMMAND_PAUSE) |
2404 | do_command(cam, CPIA_COMMAND_EndStreamCap, 0, 0, 0, 0); | 2404 | do_command(cam, CPIA_COMMAND_EndStreamCap, 0, 0, 0, 0); |
@@ -2409,9 +2409,9 @@ static void dispatch_commands(struct cam_data *cam) | |||
2409 | if (cam->cmd_queue & COMMAND_SETLIGHTS && cam->params.qx3.qx3_detected) | 2409 | if (cam->cmd_queue & COMMAND_SETLIGHTS && cam->params.qx3.qx3_detected) |
2410 | { | 2410 | { |
2411 | int p1 = (cam->params.qx3.bottomlight == 0) << 1; | 2411 | int p1 = (cam->params.qx3.bottomlight == 0) << 1; |
2412 | int p2 = (cam->params.qx3.toplight == 0) << 3; | 2412 | int p2 = (cam->params.qx3.toplight == 0) << 3; |
2413 | do_command(cam, CPIA_COMMAND_WriteVCReg, 0x90, 0x8F, 0x50, 0); | 2413 | do_command(cam, CPIA_COMMAND_WriteVCReg, 0x90, 0x8F, 0x50, 0); |
2414 | do_command(cam, CPIA_COMMAND_WriteMCPort, 2, 0, (p1|p2|0xE0), 0); | 2414 | do_command(cam, CPIA_COMMAND_WriteMCPort, 2, 0, (p1|p2|0xE0), 0); |
2415 | } | 2415 | } |
2416 | 2416 | ||
2417 | cam->cmd_queue = COMMAND_NONE; | 2417 | cam->cmd_queue = COMMAND_NONE; |
@@ -2422,11 +2422,11 @@ static void dispatch_commands(struct cam_data *cam) | |||
2422 | 2422 | ||
2423 | 2423 | ||
2424 | static void set_flicker(struct cam_params *params, volatile u32 *command_flags, | 2424 | static void set_flicker(struct cam_params *params, volatile u32 *command_flags, |
2425 | int on) | 2425 | int on) |
2426 | { | 2426 | { |
2427 | /* Everything in here is from the Windows driver */ | 2427 | /* Everything in here is from the Windows driver */ |
2428 | #define FIRMWARE_VERSION(x,y) (params->version.firmwareVersion == (x) && \ | 2428 | #define FIRMWARE_VERSION(x,y) (params->version.firmwareVersion == (x) && \ |
2429 | params->version.firmwareRevision == (y)) | 2429 | params->version.firmwareRevision == (y)) |
2430 | /* define for compgain calculation */ | 2430 | /* define for compgain calculation */ |
2431 | #if 0 | 2431 | #if 0 |
2432 | #define COMPGAIN(base, curexp, newexp) \ | 2432 | #define COMPGAIN(base, curexp, newexp) \ |
@@ -2441,7 +2441,7 @@ static void set_flicker(struct cam_params *params, volatile u32 *command_flags, | |||
2441 | (u16)(((u32)(curexp * (u8)(curcomp + 128)) / (u8)(basecomp - 128))) | 2441 | (u16)(((u32)(curexp * (u8)(curcomp + 128)) / (u8)(basecomp - 128))) |
2442 | #endif | 2442 | #endif |
2443 | 2443 | ||
2444 | 2444 | ||
2445 | int currentexp = params->exposure.coarseExpLo + | 2445 | int currentexp = params->exposure.coarseExpLo + |
2446 | params->exposure.coarseExpHi*256; | 2446 | params->exposure.coarseExpHi*256; |
2447 | int startexp; | 2447 | int startexp; |
@@ -2482,7 +2482,7 @@ static void set_flicker(struct cam_params *params, volatile u32 *command_flags, | |||
2482 | } | 2482 | } |
2483 | if(FIRMWARE_VERSION(1,2)) | 2483 | if(FIRMWARE_VERSION(1,2)) |
2484 | params->exposure.compMode = 0; | 2484 | params->exposure.compMode = 0; |
2485 | else | 2485 | else |
2486 | params->exposure.compMode = 1; | 2486 | params->exposure.compMode = 1; |
2487 | 2487 | ||
2488 | params->apcor.gain1 = 0x18; | 2488 | params->apcor.gain1 = 0x18; |
@@ -2533,14 +2533,14 @@ static void set_flicker(struct cam_params *params, volatile u32 *command_flags, | |||
2533 | } | 2533 | } |
2534 | 2534 | ||
2535 | #define FIRMWARE_VERSION(x,y) (cam->params.version.firmwareVersion == (x) && \ | 2535 | #define FIRMWARE_VERSION(x,y) (cam->params.version.firmwareVersion == (x) && \ |
2536 | cam->params.version.firmwareRevision == (y)) | 2536 | cam->params.version.firmwareRevision == (y)) |
2537 | /* monitor the exposure and adjust the sensor frame rate if needed */ | 2537 | /* monitor the exposure and adjust the sensor frame rate if needed */ |
2538 | static void monitor_exposure(struct cam_data *cam) | 2538 | static void monitor_exposure(struct cam_data *cam) |
2539 | { | 2539 | { |
2540 | u8 exp_acc, bcomp, gain, coarseL, cmd[8], data[8]; | 2540 | u8 exp_acc, bcomp, gain, coarseL, cmd[8], data[8]; |
2541 | int retval, light_exp, dark_exp, very_dark_exp; | 2541 | int retval, light_exp, dark_exp, very_dark_exp; |
2542 | int old_exposure, new_exposure, framerate; | 2542 | int old_exposure, new_exposure, framerate; |
2543 | 2543 | ||
2544 | /* get necessary stats and register settings from camera */ | 2544 | /* get necessary stats and register settings from camera */ |
2545 | /* do_command can't handle this, so do it ourselves */ | 2545 | /* do_command can't handle this, so do it ourselves */ |
2546 | cmd[0] = CPIA_COMMAND_ReadVPRegs>>8; | 2546 | cmd[0] = CPIA_COMMAND_ReadVPRegs>>8; |
@@ -2564,17 +2564,17 @@ static void monitor_exposure(struct cam_data *cam) | |||
2564 | 2564 | ||
2565 | mutex_lock(&cam->param_lock); | 2565 | mutex_lock(&cam->param_lock); |
2566 | light_exp = cam->params.colourParams.brightness + | 2566 | light_exp = cam->params.colourParams.brightness + |
2567 | TC - 50 + EXP_ACC_LIGHT; | 2567 | TC - 50 + EXP_ACC_LIGHT; |
2568 | if(light_exp > 255) | 2568 | if(light_exp > 255) |
2569 | light_exp = 255; | 2569 | light_exp = 255; |
2570 | dark_exp = cam->params.colourParams.brightness + | 2570 | dark_exp = cam->params.colourParams.brightness + |
2571 | TC - 50 - EXP_ACC_DARK; | 2571 | TC - 50 - EXP_ACC_DARK; |
2572 | if(dark_exp < 0) | 2572 | if(dark_exp < 0) |
2573 | dark_exp = 0; | 2573 | dark_exp = 0; |
2574 | very_dark_exp = dark_exp/2; | 2574 | very_dark_exp = dark_exp/2; |
2575 | 2575 | ||
2576 | old_exposure = cam->params.exposure.coarseExpHi * 256 + | 2576 | old_exposure = cam->params.exposure.coarseExpHi * 256 + |
2577 | cam->params.exposure.coarseExpLo; | 2577 | cam->params.exposure.coarseExpLo; |
2578 | 2578 | ||
2579 | if(!cam->params.flickerControl.disabled) { | 2579 | if(!cam->params.flickerControl.disabled) { |
2580 | /* Flicker control on */ | 2580 | /* Flicker control on */ |
@@ -2667,11 +2667,11 @@ static void monitor_exposure(struct cam_data *cam) | |||
2667 | cam->exposure_status = EXPOSURE_NORMAL; | 2667 | cam->exposure_status = EXPOSURE_NORMAL; |
2668 | } | 2668 | } |
2669 | } | 2669 | } |
2670 | 2670 | ||
2671 | framerate = cam->fps; | 2671 | framerate = cam->fps; |
2672 | if(framerate > 30 || framerate < 1) | 2672 | if(framerate > 30 || framerate < 1) |
2673 | framerate = 1; | 2673 | framerate = 1; |
2674 | 2674 | ||
2675 | if(!cam->params.flickerControl.disabled) { | 2675 | if(!cam->params.flickerControl.disabled) { |
2676 | /* Flicker control on */ | 2676 | /* Flicker control on */ |
2677 | if((cam->exposure_status == EXPOSURE_VERY_DARK || | 2677 | if((cam->exposure_status == EXPOSURE_VERY_DARK || |
@@ -2683,10 +2683,10 @@ static void monitor_exposure(struct cam_data *cam) | |||
2683 | ++cam->params.sensorFps.divisor; | 2683 | ++cam->params.sensorFps.divisor; |
2684 | cam->cmd_queue |= COMMAND_SETSENSORFPS; | 2684 | cam->cmd_queue |= COMMAND_SETSENSORFPS; |
2685 | 2685 | ||
2686 | cam->params.flickerControl.coarseJump = | 2686 | cam->params.flickerControl.coarseJump = |
2687 | flicker_jumps[cam->mainsFreq] | 2687 | flicker_jumps[cam->mainsFreq] |
2688 | [cam->params.sensorFps.baserate] | 2688 | [cam->params.sensorFps.baserate] |
2689 | [cam->params.sensorFps.divisor]; | 2689 | [cam->params.sensorFps.divisor]; |
2690 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; | 2690 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; |
2691 | 2691 | ||
2692 | new_exposure = cam->params.flickerControl.coarseJump-1; | 2692 | new_exposure = cam->params.flickerControl.coarseJump-1; |
@@ -2704,15 +2704,15 @@ static void monitor_exposure(struct cam_data *cam) | |||
2704 | cam->params.sensorFps.divisor > 0) { | 2704 | cam->params.sensorFps.divisor > 0) { |
2705 | 2705 | ||
2706 | /* light for too long */ | 2706 | /* light for too long */ |
2707 | int max_exp = FIRMWARE_VERSION(1,2) ? MAX_EXP_102 : MAX_EXP ; | 2707 | int max_exp = FIRMWARE_VERSION(1,2) ? MAX_EXP_102 : MAX_EXP ; |
2708 | 2708 | ||
2709 | --cam->params.sensorFps.divisor; | 2709 | --cam->params.sensorFps.divisor; |
2710 | cam->cmd_queue |= COMMAND_SETSENSORFPS; | 2710 | cam->cmd_queue |= COMMAND_SETSENSORFPS; |
2711 | 2711 | ||
2712 | cam->params.flickerControl.coarseJump = | 2712 | cam->params.flickerControl.coarseJump = |
2713 | flicker_jumps[cam->mainsFreq] | 2713 | flicker_jumps[cam->mainsFreq] |
2714 | [cam->params.sensorFps.baserate] | 2714 | [cam->params.sensorFps.baserate] |
2715 | [cam->params.sensorFps.divisor]; | 2715 | [cam->params.sensorFps.divisor]; |
2716 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; | 2716 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; |
2717 | 2717 | ||
2718 | new_exposure = cam->params.flickerControl.coarseJump-1; | 2718 | new_exposure = cam->params.flickerControl.coarseJump-1; |
@@ -2772,7 +2772,7 @@ static void monitor_exposure(struct cam_data *cam) | |||
2772 | 2772 | ||
2773 | It also adjust the colour balance when an exposure step is detected - as | 2773 | It also adjust the colour balance when an exposure step is detected - as |
2774 | long as flicker is running | 2774 | long as flicker is running |
2775 | */ | 2775 | */ |
2776 | static void restart_flicker(struct cam_data *cam) | 2776 | static void restart_flicker(struct cam_data *cam) |
2777 | { | 2777 | { |
2778 | int cam_exposure, old_exp; | 2778 | int cam_exposure, old_exp; |
@@ -2786,22 +2786,22 @@ static void restart_flicker(struct cam_data *cam) | |||
2786 | } | 2786 | } |
2787 | cam_exposure = cam->raw_image[39]*2; | 2787 | cam_exposure = cam->raw_image[39]*2; |
2788 | old_exp = cam->params.exposure.coarseExpLo + | 2788 | old_exp = cam->params.exposure.coarseExpLo + |
2789 | cam->params.exposure.coarseExpHi*256; | 2789 | cam->params.exposure.coarseExpHi*256; |
2790 | /* | 2790 | /* |
2791 | see how far away camera exposure is from a valid | 2791 | see how far away camera exposure is from a valid |
2792 | flicker exposure value | 2792 | flicker exposure value |
2793 | */ | 2793 | */ |
2794 | cam_exposure %= cam->params.flickerControl.coarseJump; | 2794 | cam_exposure %= cam->params.flickerControl.coarseJump; |
2795 | if(!cam->params.flickerControl.disabled && | 2795 | if(!cam->params.flickerControl.disabled && |
2796 | cam_exposure <= cam->params.flickerControl.coarseJump - 3) { | 2796 | cam_exposure <= cam->params.flickerControl.coarseJump - 3) { |
2797 | /* Flicker control auto-disabled */ | 2797 | /* Flicker control auto-disabled */ |
2798 | cam->params.flickerControl.disabled = 1; | 2798 | cam->params.flickerControl.disabled = 1; |
2799 | } | 2799 | } |
2800 | 2800 | ||
2801 | if(cam->params.flickerControl.disabled && | 2801 | if(cam->params.flickerControl.disabled && |
2802 | cam->params.flickerControl.flickerMode && | 2802 | cam->params.flickerControl.flickerMode && |
2803 | old_exp > cam->params.flickerControl.coarseJump + | 2803 | old_exp > cam->params.flickerControl.coarseJump + |
2804 | ROUND_UP_EXP_FOR_FLICKER) { | 2804 | ROUND_UP_EXP_FOR_FLICKER) { |
2805 | /* exposure is now high enough to switch | 2805 | /* exposure is now high enough to switch |
2806 | flicker control back on */ | 2806 | flicker control back on */ |
2807 | set_flicker(&cam->params, &cam->cmd_queue, 1); | 2807 | set_flicker(&cam->params, &cam->cmd_queue, 1); |
@@ -2818,7 +2818,7 @@ static int clear_stall(struct cam_data *cam) | |||
2818 | { | 2818 | { |
2819 | /* FIXME: Does this actually work? */ | 2819 | /* FIXME: Does this actually work? */ |
2820 | LOG("Clearing stall\n"); | 2820 | LOG("Clearing stall\n"); |
2821 | 2821 | ||
2822 | cam->ops->streamRead(cam->lowlevel_data, cam->raw_image, 0); | 2822 | cam->ops->streamRead(cam->lowlevel_data, cam->raw_image, 0); |
2823 | do_command(cam, CPIA_COMMAND_GetCameraStatus,0,0,0,0); | 2823 | do_command(cam, CPIA_COMMAND_GetCameraStatus,0,0,0,0); |
2824 | return cam->params.status.streamState != STREAM_PAUSED; | 2824 | return cam->params.status.streamState != STREAM_PAUSED; |
@@ -2878,7 +2878,7 @@ static int fetch_frame(void *data) | |||
2878 | return -EINTR; | 2878 | return -EINTR; |
2879 | 2879 | ||
2880 | do_command(cam, CPIA_COMMAND_GetCameraStatus, | 2880 | do_command(cam, CPIA_COMMAND_GetCameraStatus, |
2881 | 0, 0, 0, 0); | 2881 | 0, 0, 0, 0); |
2882 | } | 2882 | } |
2883 | if(cam->params.status.streamState != STREAM_READY) { | 2883 | if(cam->params.status.streamState != STREAM_READY) { |
2884 | continue; | 2884 | continue; |
@@ -2903,18 +2903,18 @@ static int fetch_frame(void *data) | |||
2903 | 2903 | ||
2904 | /* Switch flicker control back on if it got turned off */ | 2904 | /* Switch flicker control back on if it got turned off */ |
2905 | restart_flicker(cam); | 2905 | restart_flicker(cam); |
2906 | 2906 | ||
2907 | /* If AEC is enabled, monitor the exposure and | 2907 | /* If AEC is enabled, monitor the exposure and |
2908 | adjust the sensor frame rate if needed */ | 2908 | adjust the sensor frame rate if needed */ |
2909 | if(cam->params.exposure.expMode == 2) | 2909 | if(cam->params.exposure.expMode == 2) |
2910 | monitor_exposure(cam); | 2910 | monitor_exposure(cam); |
2911 | 2911 | ||
2912 | /* camera idle now so dispatch queued commands */ | 2912 | /* camera idle now so dispatch queued commands */ |
2913 | dispatch_commands(cam); | 2913 | dispatch_commands(cam); |
2914 | 2914 | ||
2915 | /* Update our knowledge of the camera state */ | 2915 | /* Update our knowledge of the camera state */ |
2916 | do_command(cam, CPIA_COMMAND_GetColourBalance, 0, 0, 0, 0); | 2916 | do_command(cam, CPIA_COMMAND_GetColourBalance, 0, 0, 0, 0); |
2917 | do_command(cam, CPIA_COMMAND_GetExposure, 0, 0, 0, 0); | 2917 | do_command(cam, CPIA_COMMAND_GetExposure, 0, 0, 0, 0); |
2918 | do_command(cam, CPIA_COMMAND_ReadMCPorts, 0, 0, 0, 0); | 2918 | do_command(cam, CPIA_COMMAND_ReadMCPorts, 0, 0, 0, 0); |
2919 | 2919 | ||
2920 | /* decompress and convert image to by copying it from | 2920 | /* decompress and convert image to by copying it from |
@@ -2933,7 +2933,7 @@ static int fetch_frame(void *data) | |||
2933 | uncompressed. */ | 2933 | uncompressed. */ |
2934 | cam->first_frame = 1; | 2934 | cam->first_frame = 1; |
2935 | do_command(cam, CPIA_COMMAND_SetGrabMode, | 2935 | do_command(cam, CPIA_COMMAND_SetGrabMode, |
2936 | CPIA_GRAB_SINGLE, 0, 0, 0); | 2936 | CPIA_GRAB_SINGLE, 0, 0, 0); |
2937 | /* FIXME: Trial & error - need up to 70ms for | 2937 | /* FIXME: Trial & error - need up to 70ms for |
2938 | the grab mode change to complete ? */ | 2938 | the grab mode change to complete ? */ |
2939 | msleep_interruptible(70); | 2939 | msleep_interruptible(70); |
@@ -2957,12 +2957,12 @@ static int fetch_frame(void *data) | |||
2957 | if (cam->first_frame) { | 2957 | if (cam->first_frame) { |
2958 | cam->first_frame = 0; | 2958 | cam->first_frame = 0; |
2959 | do_command(cam, CPIA_COMMAND_SetCompression, | 2959 | do_command(cam, CPIA_COMMAND_SetCompression, |
2960 | cam->params.compression.mode, | 2960 | cam->params.compression.mode, |
2961 | cam->params.compression.decimation, 0, 0); | 2961 | cam->params.compression.decimation, 0, 0); |
2962 | 2962 | ||
2963 | /* Switch from single-grab to continuous grab */ | 2963 | /* Switch from single-grab to continuous grab */ |
2964 | do_command(cam, CPIA_COMMAND_SetGrabMode, | 2964 | do_command(cam, CPIA_COMMAND_SetGrabMode, |
2965 | CPIA_GRAB_CONTINUOUS, 0, 0, 0); | 2965 | CPIA_GRAB_CONTINUOUS, 0, 0, 0); |
2966 | } | 2966 | } |
2967 | return 0; | 2967 | return 0; |
2968 | } | 2968 | } |
@@ -2977,12 +2977,12 @@ static int capture_frame(struct cam_data *cam, struct video_mmap *vm) | |||
2977 | if ((err = allocate_frame_buf(cam))) | 2977 | if ((err = allocate_frame_buf(cam))) |
2978 | return err; | 2978 | return err; |
2979 | } | 2979 | } |
2980 | 2980 | ||
2981 | cam->curframe = vm->frame; | 2981 | cam->curframe = vm->frame; |
2982 | cam->frame[cam->curframe].state = FRAME_READY; | 2982 | cam->frame[cam->curframe].state = FRAME_READY; |
2983 | return fetch_frame(cam); | 2983 | return fetch_frame(cam); |
2984 | } | 2984 | } |
2985 | 2985 | ||
2986 | static int goto_high_power(struct cam_data *cam) | 2986 | static int goto_high_power(struct cam_data *cam) |
2987 | { | 2987 | { |
2988 | if (do_command(cam, CPIA_COMMAND_GotoHiPower, 0, 0, 0, 0)) | 2988 | if (do_command(cam, CPIA_COMMAND_GotoHiPower, 0, 0, 0, 0)) |
@@ -3039,22 +3039,22 @@ static void save_camera_state(struct cam_data *cam) | |||
3039 | static int set_camera_state(struct cam_data *cam) | 3039 | static int set_camera_state(struct cam_data *cam) |
3040 | { | 3040 | { |
3041 | cam->cmd_queue = COMMAND_SETCOMPRESSION | | 3041 | cam->cmd_queue = COMMAND_SETCOMPRESSION | |
3042 | COMMAND_SETCOMPRESSIONTARGET | | 3042 | COMMAND_SETCOMPRESSIONTARGET | |
3043 | COMMAND_SETCOLOURPARAMS | | 3043 | COMMAND_SETCOLOURPARAMS | |
3044 | COMMAND_SETFORMAT | | 3044 | COMMAND_SETFORMAT | |
3045 | COMMAND_SETYUVTHRESH | | 3045 | COMMAND_SETYUVTHRESH | |
3046 | COMMAND_SETECPTIMING | | 3046 | COMMAND_SETECPTIMING | |
3047 | COMMAND_SETCOMPRESSIONPARAMS | | 3047 | COMMAND_SETCOMPRESSIONPARAMS | |
3048 | COMMAND_SETEXPOSURE | | 3048 | COMMAND_SETEXPOSURE | |
3049 | COMMAND_SETCOLOURBALANCE | | 3049 | COMMAND_SETCOLOURBALANCE | |
3050 | COMMAND_SETSENSORFPS | | 3050 | COMMAND_SETSENSORFPS | |
3051 | COMMAND_SETAPCOR | | 3051 | COMMAND_SETAPCOR | |
3052 | COMMAND_SETFLICKERCTRL | | 3052 | COMMAND_SETFLICKERCTRL | |
3053 | COMMAND_SETVLOFFSET; | 3053 | COMMAND_SETVLOFFSET; |
3054 | 3054 | ||
3055 | do_command(cam, CPIA_COMMAND_SetGrabMode, CPIA_GRAB_SINGLE,0,0,0); | 3055 | do_command(cam, CPIA_COMMAND_SetGrabMode, CPIA_GRAB_SINGLE,0,0,0); |
3056 | dispatch_commands(cam); | 3056 | dispatch_commands(cam); |
3057 | 3057 | ||
3058 | /* Wait 6 frames for the sensor to get all settings and | 3058 | /* Wait 6 frames for the sensor to get all settings and |
3059 | AEC/ACB to settle */ | 3059 | AEC/ACB to settle */ |
3060 | msleep_interruptible(6*(cam->params.sensorFps.baserate ? 33 : 40) * | 3060 | msleep_interruptible(6*(cam->params.sensorFps.baserate ? 33 : 40) * |
@@ -3062,7 +3062,7 @@ static int set_camera_state(struct cam_data *cam) | |||
3062 | 3062 | ||
3063 | if(signal_pending(current)) | 3063 | if(signal_pending(current)) |
3064 | return -EINTR; | 3064 | return -EINTR; |
3065 | 3065 | ||
3066 | save_camera_state(cam); | 3066 | save_camera_state(cam); |
3067 | 3067 | ||
3068 | return 0; | 3068 | return 0; |
@@ -3094,9 +3094,9 @@ static int reset_camera(struct cam_data *cam) | |||
3094 | if (goto_low_power(cam)) | 3094 | if (goto_low_power(cam)) |
3095 | return -ENODEV; | 3095 | return -ENODEV; |
3096 | } | 3096 | } |
3097 | 3097 | ||
3098 | /* procedure described in developer's guide p3-28 */ | 3098 | /* procedure described in developer's guide p3-28 */ |
3099 | 3099 | ||
3100 | /* Check the firmware version. */ | 3100 | /* Check the firmware version. */ |
3101 | cam->params.version.firmwareVersion = 0; | 3101 | cam->params.version.firmwareVersion = 0; |
3102 | get_version_information(cam); | 3102 | get_version_information(cam); |
@@ -3113,14 +3113,14 @@ static int reset_camera(struct cam_data *cam) | |||
3113 | cam->params.qx3.qx3_detected = (cam->params.pnpID.vendor == 0x0813 && | 3113 | cam->params.qx3.qx3_detected = (cam->params.pnpID.vendor == 0x0813 && |
3114 | cam->params.pnpID.product == 0x0001); | 3114 | cam->params.pnpID.product == 0x0001); |
3115 | 3115 | ||
3116 | /* The fatal error checking should be done after | 3116 | /* The fatal error checking should be done after |
3117 | * the camera powers up (developer's guide p 3-38) */ | 3117 | * the camera powers up (developer's guide p 3-38) */ |
3118 | 3118 | ||
3119 | /* Set streamState before transition to high power to avoid bug | 3119 | /* Set streamState before transition to high power to avoid bug |
3120 | * in firmware 1-02 */ | 3120 | * in firmware 1-02 */ |
3121 | do_command(cam, CPIA_COMMAND_ModifyCameraStatus, STREAMSTATE, 0, | 3121 | do_command(cam, CPIA_COMMAND_ModifyCameraStatus, STREAMSTATE, 0, |
3122 | STREAM_NOT_READY, 0); | 3122 | STREAM_NOT_READY, 0); |
3123 | 3123 | ||
3124 | /* GotoHiPower */ | 3124 | /* GotoHiPower */ |
3125 | err = goto_high_power(cam); | 3125 | err = goto_high_power(cam); |
3126 | if (err) | 3126 | if (err) |
@@ -3142,16 +3142,16 @@ static int reset_camera(struct cam_data *cam) | |||
3142 | /* Firmware 1-02 may do this for parallel port cameras, | 3142 | /* Firmware 1-02 may do this for parallel port cameras, |
3143 | * just clear the flags (developer's guide p 3-38) */ | 3143 | * just clear the flags (developer's guide p 3-38) */ |
3144 | do_command(cam, CPIA_COMMAND_ModifyCameraStatus, | 3144 | do_command(cam, CPIA_COMMAND_ModifyCameraStatus, |
3145 | FATALERROR, ~(COM_FLAG|CPIA_FLAG), 0, 0); | 3145 | FATALERROR, ~(COM_FLAG|CPIA_FLAG), 0, 0); |
3146 | } | 3146 | } |
3147 | } | 3147 | } |
3148 | 3148 | ||
3149 | /* Check the camera status again */ | 3149 | /* Check the camera status again */ |
3150 | if (cam->params.status.fatalError) { | 3150 | if (cam->params.status.fatalError) { |
3151 | if (cam->params.status.fatalError) | 3151 | if (cam->params.status.fatalError) |
3152 | return -EIO; | 3152 | return -EIO; |
3153 | } | 3153 | } |
3154 | 3154 | ||
3155 | /* VPVersion can't be retrieved before the camera is in HiPower, | 3155 | /* VPVersion can't be retrieved before the camera is in HiPower, |
3156 | * so get it here instead of in get_version_information. */ | 3156 | * so get it here instead of in get_version_information. */ |
3157 | do_command(cam, CPIA_COMMAND_GetVPVersion, 0, 0, 0, 0); | 3157 | do_command(cam, CPIA_COMMAND_GetVPVersion, 0, 0, 0, 0); |
@@ -3193,24 +3193,24 @@ static int cpia_open(struct inode *inode, struct file *file) | |||
3193 | if (!cam->raw_image) | 3193 | if (!cam->raw_image) |
3194 | goto oops; | 3194 | goto oops; |
3195 | } | 3195 | } |
3196 | 3196 | ||
3197 | if (!cam->decompressed_frame.data) { | 3197 | if (!cam->decompressed_frame.data) { |
3198 | cam->decompressed_frame.data = rvmalloc(CPIA_MAX_FRAME_SIZE); | 3198 | cam->decompressed_frame.data = rvmalloc(CPIA_MAX_FRAME_SIZE); |
3199 | if (!cam->decompressed_frame.data) | 3199 | if (!cam->decompressed_frame.data) |
3200 | goto oops; | 3200 | goto oops; |
3201 | } | 3201 | } |
3202 | 3202 | ||
3203 | /* open cpia */ | 3203 | /* open cpia */ |
3204 | err = -ENODEV; | 3204 | err = -ENODEV; |
3205 | if (cam->ops->open(cam->lowlevel_data)) | 3205 | if (cam->ops->open(cam->lowlevel_data)) |
3206 | goto oops; | 3206 | goto oops; |
3207 | 3207 | ||
3208 | /* reset the camera */ | 3208 | /* reset the camera */ |
3209 | if ((err = reset_camera(cam)) != 0) { | 3209 | if ((err = reset_camera(cam)) != 0) { |
3210 | cam->ops->close(cam->lowlevel_data); | 3210 | cam->ops->close(cam->lowlevel_data); |
3211 | goto oops; | 3211 | goto oops; |
3212 | } | 3212 | } |
3213 | 3213 | ||
3214 | err = -EINTR; | 3214 | err = -EINTR; |
3215 | if(signal_pending(current)) | 3215 | if(signal_pending(current)) |
3216 | goto oops; | 3216 | goto oops; |
@@ -3224,7 +3224,7 @@ static int cpia_open(struct inode *inode, struct file *file) | |||
3224 | 3224 | ||
3225 | /* init it to something */ | 3225 | /* init it to something */ |
3226 | cam->mmap_kludge = 0; | 3226 | cam->mmap_kludge = 0; |
3227 | 3227 | ||
3228 | ++cam->open_count; | 3228 | ++cam->open_count; |
3229 | file->private_data = dev; | 3229 | file->private_data = dev; |
3230 | mutex_unlock(&cam->busy_lock); | 3230 | mutex_unlock(&cam->busy_lock); |
@@ -3250,10 +3250,10 @@ static int cpia_close(struct inode *inode, struct file *file) | |||
3250 | struct cam_data *cam = dev->priv; | 3250 | struct cam_data *cam = dev->priv; |
3251 | 3251 | ||
3252 | if (cam->ops) { | 3252 | if (cam->ops) { |
3253 | /* Return ownership of /proc/cpia/videoX to root */ | 3253 | /* Return ownership of /proc/cpia/videoX to root */ |
3254 | if(cam->proc_entry) | 3254 | if(cam->proc_entry) |
3255 | cam->proc_entry->uid = 0; | 3255 | cam->proc_entry->uid = 0; |
3256 | 3256 | ||
3257 | /* save camera state for later open (developers guide ch 3.5.3) */ | 3257 | /* save camera state for later open (developers guide ch 3.5.3) */ |
3258 | save_camera_state(cam); | 3258 | save_camera_state(cam); |
3259 | 3259 | ||
@@ -3342,7 +3342,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf, | |||
3342 | return -EFAULT; | 3342 | return -EFAULT; |
3343 | } | 3343 | } |
3344 | if (copy_to_user(buf, cam->decompressed_frame.data, | 3344 | if (copy_to_user(buf, cam->decompressed_frame.data, |
3345 | cam->decompressed_frame.count)) { | 3345 | cam->decompressed_frame.count)) { |
3346 | DBG("copy_to_user failed\n"); | 3346 | DBG("copy_to_user failed\n"); |
3347 | mutex_unlock(&cam->busy_lock); | 3347 | mutex_unlock(&cam->busy_lock); |
3348 | return -EFAULT; | 3348 | return -EFAULT; |
@@ -3361,7 +3361,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3361 | 3361 | ||
3362 | if (!cam || !cam->ops) | 3362 | if (!cam || !cam->ops) |
3363 | return -ENODEV; | 3363 | return -ENODEV; |
3364 | 3364 | ||
3365 | /* make this _really_ smp-safe */ | 3365 | /* make this _really_ smp-safe */ |
3366 | if (mutex_lock_interruptible(&cam->busy_lock)) | 3366 | if (mutex_lock_interruptible(&cam->busy_lock)) |
3367 | return -EINTR; | 3367 | return -EINTR; |
@@ -3405,7 +3405,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3405 | v->norm = 0; | 3405 | v->norm = 0; |
3406 | break; | 3406 | break; |
3407 | } | 3407 | } |
3408 | 3408 | ||
3409 | case VIDIOCSCHAN: | 3409 | case VIDIOCSCHAN: |
3410 | { | 3410 | { |
3411 | struct video_channel *v = arg; | 3411 | struct video_channel *v = arg; |
@@ -3424,7 +3424,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3424 | *pic = cam->vp; | 3424 | *pic = cam->vp; |
3425 | break; | 3425 | break; |
3426 | } | 3426 | } |
3427 | 3427 | ||
3428 | case VIDIOCSPICT: | 3428 | case VIDIOCSPICT: |
3429 | { | 3429 | { |
3430 | struct video_picture *vp = arg; | 3430 | struct video_picture *vp = arg; |
@@ -3458,11 +3458,11 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3458 | 3458 | ||
3459 | /* Adjust flicker control if necessary */ | 3459 | /* Adjust flicker control if necessary */ |
3460 | if(cam->params.flickerControl.allowableOverExposure < 0) | 3460 | if(cam->params.flickerControl.allowableOverExposure < 0) |
3461 | cam->params.flickerControl.allowableOverExposure = | 3461 | cam->params.flickerControl.allowableOverExposure = |
3462 | -find_over_exposure(cam->params.colourParams.brightness); | 3462 | -find_over_exposure(cam->params.colourParams.brightness); |
3463 | if(cam->params.flickerControl.flickerMode != 0) | 3463 | if(cam->params.flickerControl.flickerMode != 0) |
3464 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; | 3464 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; |
3465 | 3465 | ||
3466 | 3466 | ||
3467 | /* queue command to update camera */ | 3467 | /* queue command to update camera */ |
3468 | cam->cmd_queue |= COMMAND_SETCOLOURPARAMS; | 3468 | cam->cmd_queue |= COMMAND_SETCOLOURPARAMS; |
@@ -3482,7 +3482,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3482 | *vw = cam->vw; | 3482 | *vw = cam->vw; |
3483 | break; | 3483 | break; |
3484 | } | 3484 | } |
3485 | 3485 | ||
3486 | case VIDIOCSWIN: | 3486 | case VIDIOCSWIN: |
3487 | { | 3487 | { |
3488 | /* copy_from_user, check validity, copy to internal structure */ | 3488 | /* copy_from_user, check validity, copy to internal structure */ |
@@ -3514,7 +3514,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3514 | 3514 | ||
3515 | /* video size is changing, reset the subcapture area */ | 3515 | /* video size is changing, reset the subcapture area */ |
3516 | memset(&cam->vc, 0, sizeof(cam->vc)); | 3516 | memset(&cam->vc, 0, sizeof(cam->vc)); |
3517 | 3517 | ||
3518 | set_vw_size(cam); | 3518 | set_vw_size(cam); |
3519 | DBG("%d / %d\n", cam->vw.width, cam->vw.height); | 3519 | DBG("%d / %d\n", cam->vw.width, cam->vw.height); |
3520 | cam->cmd_queue |= COMMAND_SETFORMAT; | 3520 | cam->cmd_queue |= COMMAND_SETFORMAT; |
@@ -3547,7 +3547,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3547 | vm->offsets[i] = CPIA_MAX_FRAME_SIZE * i; | 3547 | vm->offsets[i] = CPIA_MAX_FRAME_SIZE * i; |
3548 | break; | 3548 | break; |
3549 | } | 3549 | } |
3550 | 3550 | ||
3551 | case VIDIOCMCAPTURE: | 3551 | case VIDIOCMCAPTURE: |
3552 | { | 3552 | { |
3553 | struct video_mmap *vm = arg; | 3553 | struct video_mmap *vm = arg; |
@@ -3597,7 +3597,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3597 | 3597 | ||
3598 | /* video size is changing, reset the subcapture area */ | 3598 | /* video size is changing, reset the subcapture area */ |
3599 | memset(&cam->vc, 0, sizeof(cam->vc)); | 3599 | memset(&cam->vc, 0, sizeof(cam->vc)); |
3600 | 3600 | ||
3601 | set_vw_size(cam); | 3601 | set_vw_size(cam); |
3602 | cam->cmd_queue |= COMMAND_SETFORMAT; | 3602 | cam->cmd_queue |= COMMAND_SETFORMAT; |
3603 | dispatch_commands(cam); | 3603 | dispatch_commands(cam); |
@@ -3608,7 +3608,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3608 | 3608 | ||
3609 | break; | 3609 | break; |
3610 | } | 3610 | } |
3611 | 3611 | ||
3612 | case VIDIOCSYNC: | 3612 | case VIDIOCSYNC: |
3613 | { | 3613 | { |
3614 | int *frame = arg; | 3614 | int *frame = arg; |
@@ -3649,7 +3649,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3649 | *vc = cam->vc; | 3649 | *vc = cam->vc; |
3650 | 3650 | ||
3651 | break; | 3651 | break; |
3652 | } | 3652 | } |
3653 | 3653 | ||
3654 | case VIDIOCSCAPTURE: | 3654 | case VIDIOCSCAPTURE: |
3655 | { | 3655 | { |
@@ -3665,7 +3665,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3665 | retval = -EINVAL; | 3665 | retval = -EINVAL; |
3666 | break; | 3666 | break; |
3667 | } | 3667 | } |
3668 | 3668 | ||
3669 | /* Clip to the resolution we can set for the ROI | 3669 | /* Clip to the resolution we can set for the ROI |
3670 | (every 8 columns and 4 rows) */ | 3670 | (every 8 columns and 4 rows) */ |
3671 | vc->x = vc->x & ~(__u32)7; | 3671 | vc->x = vc->x & ~(__u32)7; |
@@ -3681,14 +3681,14 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3681 | } | 3681 | } |
3682 | 3682 | ||
3683 | DBG("%d,%d/%dx%d\n", vc->x,vc->y,vc->width, vc->height); | 3683 | DBG("%d,%d/%dx%d\n", vc->x,vc->y,vc->width, vc->height); |
3684 | 3684 | ||
3685 | mutex_lock(&cam->param_lock); | 3685 | mutex_lock(&cam->param_lock); |
3686 | 3686 | ||
3687 | cam->vc.x = vc->x; | 3687 | cam->vc.x = vc->x; |
3688 | cam->vc.y = vc->y; | 3688 | cam->vc.y = vc->y; |
3689 | cam->vc.width = vc->width; | 3689 | cam->vc.width = vc->width; |
3690 | cam->vc.height = vc->height; | 3690 | cam->vc.height = vc->height; |
3691 | 3691 | ||
3692 | set_vw_size(cam); | 3692 | set_vw_size(cam); |
3693 | cam->cmd_queue |= COMMAND_SETFORMAT; | 3693 | cam->cmd_queue |= COMMAND_SETFORMAT; |
3694 | 3694 | ||
@@ -3699,7 +3699,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3699 | dispatch_commands(cam); | 3699 | dispatch_commands(cam); |
3700 | break; | 3700 | break; |
3701 | } | 3701 | } |
3702 | 3702 | ||
3703 | case VIDIOCGUNIT: | 3703 | case VIDIOCGUNIT: |
3704 | { | 3704 | { |
3705 | struct video_unit *vu = arg; | 3705 | struct video_unit *vu = arg; |
@@ -3715,7 +3715,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3715 | break; | 3715 | break; |
3716 | } | 3716 | } |
3717 | 3717 | ||
3718 | 3718 | ||
3719 | /* pointless to implement overlay with this camera */ | 3719 | /* pointless to implement overlay with this camera */ |
3720 | case VIDIOCCAPTURE: | 3720 | case VIDIOCCAPTURE: |
3721 | case VIDIOCGFBUF: | 3721 | case VIDIOCGFBUF: |
@@ -3738,7 +3738,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3738 | 3738 | ||
3739 | mutex_unlock(&cam->busy_lock); | 3739 | mutex_unlock(&cam->busy_lock); |
3740 | return retval; | 3740 | return retval; |
3741 | } | 3741 | } |
3742 | 3742 | ||
3743 | static int cpia_ioctl(struct inode *inode, struct file *file, | 3743 | static int cpia_ioctl(struct inode *inode, struct file *file, |
3744 | unsigned int cmd, unsigned long arg) | 3744 | unsigned int cmd, unsigned long arg) |
@@ -3759,7 +3759,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma) | |||
3759 | 3759 | ||
3760 | if (!cam || !cam->ops) | 3760 | if (!cam || !cam->ops) |
3761 | return -ENODEV; | 3761 | return -ENODEV; |
3762 | 3762 | ||
3763 | DBG("cpia_mmap: %ld\n", size); | 3763 | DBG("cpia_mmap: %ld\n", size); |
3764 | 3764 | ||
3765 | if (size > FRAME_NUM*CPIA_MAX_FRAME_SIZE) | 3765 | if (size > FRAME_NUM*CPIA_MAX_FRAME_SIZE) |
@@ -3767,7 +3767,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma) | |||
3767 | 3767 | ||
3768 | if (!cam || !cam->ops) | 3768 | if (!cam || !cam->ops) |
3769 | return -ENODEV; | 3769 | return -ENODEV; |
3770 | 3770 | ||
3771 | /* make this _really_ smp-safe */ | 3771 | /* make this _really_ smp-safe */ |
3772 | if (mutex_lock_interruptible(&cam->busy_lock)) | 3772 | if (mutex_lock_interruptible(&cam->busy_lock)) |
3773 | return -EINTR; | 3773 | return -EINTR; |
@@ -3851,11 +3851,11 @@ static void reset_camera_struct(struct cam_data *cam) | |||
3851 | cam->params.flickerControl.flickerMode = 0; | 3851 | cam->params.flickerControl.flickerMode = 0; |
3852 | cam->params.flickerControl.disabled = 1; | 3852 | cam->params.flickerControl.disabled = 1; |
3853 | 3853 | ||
3854 | cam->params.flickerControl.coarseJump = | 3854 | cam->params.flickerControl.coarseJump = |
3855 | flicker_jumps[cam->mainsFreq] | 3855 | flicker_jumps[cam->mainsFreq] |
3856 | [cam->params.sensorFps.baserate] | 3856 | [cam->params.sensorFps.baserate] |
3857 | [cam->params.sensorFps.divisor]; | 3857 | [cam->params.sensorFps.divisor]; |
3858 | cam->params.flickerControl.allowableOverExposure = | 3858 | cam->params.flickerControl.allowableOverExposure = |
3859 | -find_over_exposure(cam->params.colourParams.brightness); | 3859 | -find_over_exposure(cam->params.colourParams.brightness); |
3860 | cam->params.vlOffset.gain1 = 20; | 3860 | cam->params.vlOffset.gain1 = 20; |
3861 | cam->params.vlOffset.gain2 = 24; | 3861 | cam->params.vlOffset.gain2 = 24; |
@@ -3870,21 +3870,21 @@ static void reset_camera_struct(struct cam_data *cam) | |||
3870 | cam->params.compressionParams.qDiffStepThresh = 3; | 3870 | cam->params.compressionParams.qDiffStepThresh = 3; |
3871 | cam->params.compressionParams.decimationThreshMod = 2; | 3871 | cam->params.compressionParams.decimationThreshMod = 2; |
3872 | /* End of default values from Software Developer's Guide */ | 3872 | /* End of default values from Software Developer's Guide */ |
3873 | 3873 | ||
3874 | cam->transfer_rate = 0; | 3874 | cam->transfer_rate = 0; |
3875 | cam->exposure_status = EXPOSURE_NORMAL; | 3875 | cam->exposure_status = EXPOSURE_NORMAL; |
3876 | 3876 | ||
3877 | /* Set Sensor FPS to 15fps. This seems better than 30fps | 3877 | /* Set Sensor FPS to 15fps. This seems better than 30fps |
3878 | * for indoor lighting. */ | 3878 | * for indoor lighting. */ |
3879 | cam->params.sensorFps.divisor = 1; | 3879 | cam->params.sensorFps.divisor = 1; |
3880 | cam->params.sensorFps.baserate = 1; | 3880 | cam->params.sensorFps.baserate = 1; |
3881 | 3881 | ||
3882 | cam->params.yuvThreshold.yThreshold = 6; /* From windows driver */ | 3882 | cam->params.yuvThreshold.yThreshold = 6; /* From windows driver */ |
3883 | cam->params.yuvThreshold.uvThreshold = 6; /* From windows driver */ | 3883 | cam->params.yuvThreshold.uvThreshold = 6; /* From windows driver */ |
3884 | 3884 | ||
3885 | cam->params.format.subSample = SUBSAMPLE_422; | 3885 | cam->params.format.subSample = SUBSAMPLE_422; |
3886 | cam->params.format.yuvOrder = YUVORDER_YUYV; | 3886 | cam->params.format.yuvOrder = YUVORDER_YUYV; |
3887 | 3887 | ||
3888 | cam->params.compression.mode = CPIA_COMPRESSION_AUTO; | 3888 | cam->params.compression.mode = CPIA_COMPRESSION_AUTO; |
3889 | cam->params.compressionTarget.frTargeting = | 3889 | cam->params.compressionTarget.frTargeting = |
3890 | CPIA_COMPRESSION_TARGET_QUALITY; | 3890 | CPIA_COMPRESSION_TARGET_QUALITY; |
@@ -3898,7 +3898,7 @@ static void reset_camera_struct(struct cam_data *cam) | |||
3898 | cam->params.qx3.cradled = 0; | 3898 | cam->params.qx3.cradled = 0; |
3899 | 3899 | ||
3900 | cam->video_size = VIDEOSIZE_CIF; | 3900 | cam->video_size = VIDEOSIZE_CIF; |
3901 | 3901 | ||
3902 | cam->vp.colour = 32768; /* 50% */ | 3902 | cam->vp.colour = 32768; /* 50% */ |
3903 | cam->vp.hue = 32768; /* 50% */ | 3903 | cam->vp.hue = 32768; /* 50% */ |
3904 | cam->vp.brightness = 32768; /* 50% */ | 3904 | cam->vp.brightness = 32768; /* 50% */ |
@@ -3911,7 +3911,7 @@ static void reset_camera_struct(struct cam_data *cam) | |||
3911 | cam->vc.y = 0; | 3911 | cam->vc.y = 0; |
3912 | cam->vc.width = 0; | 3912 | cam->vc.width = 0; |
3913 | cam->vc.height = 0; | 3913 | cam->vc.height = 0; |
3914 | 3914 | ||
3915 | cam->vw.x = 0; | 3915 | cam->vw.x = 0; |
3916 | cam->vw.y = 0; | 3916 | cam->vw.y = 0; |
3917 | set_vw_size(cam); | 3917 | set_vw_size(cam); |
@@ -3928,7 +3928,7 @@ static void reset_camera_struct(struct cam_data *cam) | |||
3928 | 3928 | ||
3929 | /* initialize cam_data structure */ | 3929 | /* initialize cam_data structure */ |
3930 | static void init_camera_struct(struct cam_data *cam, | 3930 | static void init_camera_struct(struct cam_data *cam, |
3931 | struct cpia_camera_ops *ops ) | 3931 | struct cpia_camera_ops *ops ) |
3932 | { | 3932 | { |
3933 | int i; | 3933 | int i; |
3934 | 3934 | ||
@@ -3945,7 +3945,7 @@ static void init_camera_struct(struct cam_data *cam, | |||
3945 | 3945 | ||
3946 | memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template)); | 3946 | memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template)); |
3947 | cam->vdev.priv = cam; | 3947 | cam->vdev.priv = cam; |
3948 | 3948 | ||
3949 | cam->curframe = 0; | 3949 | cam->curframe = 0; |
3950 | for (i = 0; i < FRAME_NUM; i++) { | 3950 | for (i = 0; i < FRAME_NUM; i++) { |
3951 | cam->frame[i].width = 0; | 3951 | cam->frame[i].width = 0; |
@@ -3961,15 +3961,15 @@ static void init_camera_struct(struct cam_data *cam, | |||
3961 | 3961 | ||
3962 | struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowlevel) | 3962 | struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowlevel) |
3963 | { | 3963 | { |
3964 | struct cam_data *camera; | 3964 | struct cam_data *camera; |
3965 | 3965 | ||
3966 | if ((camera = kmalloc(sizeof(struct cam_data), GFP_KERNEL)) == NULL) | 3966 | if ((camera = kmalloc(sizeof(struct cam_data), GFP_KERNEL)) == NULL) |
3967 | return NULL; | 3967 | return NULL; |
3968 | 3968 | ||
3969 | 3969 | ||
3970 | init_camera_struct( camera, ops ); | 3970 | init_camera_struct( camera, ops ); |
3971 | camera->lowlevel_data = lowlevel; | 3971 | camera->lowlevel_data = lowlevel; |
3972 | 3972 | ||
3973 | /* register v4l device */ | 3973 | /* register v4l device */ |
3974 | if (video_register_device(&camera->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { | 3974 | if (video_register_device(&camera->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { |
3975 | kfree(camera); | 3975 | kfree(camera); |
@@ -3982,7 +3982,7 @@ struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowleve | |||
3982 | /* open cpia */ | 3982 | /* open cpia */ |
3983 | if (camera->ops->open(camera->lowlevel_data)) | 3983 | if (camera->ops->open(camera->lowlevel_data)) |
3984 | return camera; | 3984 | return camera; |
3985 | 3985 | ||
3986 | /* reset the camera */ | 3986 | /* reset the camera */ |
3987 | if (reset_camera(camera) != 0) { | 3987 | if (reset_camera(camera) != 0) { |
3988 | camera->ops->close(camera->lowlevel_data); | 3988 | camera->ops->close(camera->lowlevel_data); |
@@ -4022,11 +4022,11 @@ void cpia_unregister_camera(struct cam_data *cam) | |||
4022 | DBG("camera open -- setting ops to NULL\n"); | 4022 | DBG("camera open -- setting ops to NULL\n"); |
4023 | cam->ops = NULL; | 4023 | cam->ops = NULL; |
4024 | } | 4024 | } |
4025 | 4025 | ||
4026 | #ifdef CONFIG_PROC_FS | 4026 | #ifdef CONFIG_PROC_FS |
4027 | DBG("destroying /proc/cpia/video%d\n", cam->vdev.minor); | 4027 | DBG("destroying /proc/cpia/video%d\n", cam->vdev.minor); |
4028 | destroy_proc_cpia_cam(cam); | 4028 | destroy_proc_cpia_cam(cam); |
4029 | #endif | 4029 | #endif |
4030 | if (!cam->open_count) { | 4030 | if (!cam->open_count) { |
4031 | DBG("freeing camera\n"); | 4031 | DBG("freeing camera\n"); |
4032 | kfree(cam); | 4032 | kfree(cam); |
diff --git a/drivers/media/video/cpia.h b/drivers/media/video/cpia.h index de6678200a57..dde27a6a4a09 100644 --- a/drivers/media/video/cpia.h +++ b/drivers/media/video/cpia.h | |||
@@ -52,10 +52,10 @@ | |||
52 | struct cpia_camera_ops | 52 | struct cpia_camera_ops |
53 | { | 53 | { |
54 | /* open sets privdata to point to structure for this camera. | 54 | /* open sets privdata to point to structure for this camera. |
55 | * Returns negative value on error, otherwise 0. | 55 | * Returns negative value on error, otherwise 0. |
56 | */ | 56 | */ |
57 | int (*open)(void *privdata); | 57 | int (*open)(void *privdata); |
58 | 58 | ||
59 | /* Registers callback function cb to be called with cbdata | 59 | /* Registers callback function cb to be called with cbdata |
60 | * when an image is ready. If cb is NULL, only single image grabs | 60 | * when an image is ready. If cb is NULL, only single image grabs |
61 | * should be used. cb should immediately call streamRead to read | 61 | * should be used. cb should immediately call streamRead to read |
@@ -63,8 +63,8 @@ struct cpia_camera_ops | |||
63 | * otherwise 0. | 63 | * otherwise 0. |
64 | */ | 64 | */ |
65 | int (*registerCallback)(void *privdata, void (*cb)(void *cbdata), | 65 | int (*registerCallback)(void *privdata, void (*cb)(void *cbdata), |
66 | void *cbdata); | 66 | void *cbdata); |
67 | 67 | ||
68 | /* transferCmd sends commands to the camera. command MUST point to | 68 | /* transferCmd sends commands to the camera. command MUST point to |
69 | * an 8 byte buffer in kernel space. data can be NULL if no extra | 69 | * an 8 byte buffer in kernel space. data can be NULL if no extra |
70 | * data is needed. The size of the data is given by the last 2 | 70 | * data is needed. The size of the data is given by the last 2 |
@@ -77,30 +77,30 @@ struct cpia_camera_ops | |||
77 | * Returns negative value on error, otherwise 0. | 77 | * Returns negative value on error, otherwise 0. |
78 | */ | 78 | */ |
79 | int (*streamStart)(void *privdata); | 79 | int (*streamStart)(void *privdata); |
80 | 80 | ||
81 | /* streamStop terminates stream capture mode. | 81 | /* streamStop terminates stream capture mode. |
82 | * Returns negative value on error, otherwise 0. | 82 | * Returns negative value on error, otherwise 0. |
83 | */ | 83 | */ |
84 | int (*streamStop)(void *privdata); | 84 | int (*streamStop)(void *privdata); |
85 | 85 | ||
86 | /* streamRead reads a frame from the camera. buffer points to a | 86 | /* streamRead reads a frame from the camera. buffer points to a |
87 | * buffer large enough to hold a complete frame in kernel space. | 87 | * buffer large enough to hold a complete frame in kernel space. |
88 | * noblock indicates if this should be a non blocking read. | 88 | * noblock indicates if this should be a non blocking read. |
89 | * Returns the number of bytes read, or negative value on error. | 89 | * Returns the number of bytes read, or negative value on error. |
90 | */ | 90 | */ |
91 | int (*streamRead)(void *privdata, u8 *buffer, int noblock); | 91 | int (*streamRead)(void *privdata, u8 *buffer, int noblock); |
92 | 92 | ||
93 | /* close disables the device until open() is called again. | 93 | /* close disables the device until open() is called again. |
94 | * Returns negative value on error, otherwise 0. | 94 | * Returns negative value on error, otherwise 0. |
95 | */ | 95 | */ |
96 | int (*close)(void *privdata); | 96 | int (*close)(void *privdata); |
97 | 97 | ||
98 | /* If wait_for_stream_ready is non-zero, wait until the streamState | 98 | /* If wait_for_stream_ready is non-zero, wait until the streamState |
99 | * is STREAM_READY before calling streamRead. | 99 | * is STREAM_READY before calling streamRead. |
100 | */ | 100 | */ |
101 | int wait_for_stream_ready; | 101 | int wait_for_stream_ready; |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Used to maintain lowlevel module usage counts | 104 | * Used to maintain lowlevel module usage counts |
105 | */ | 105 | */ |
106 | struct module *owner; | 106 | struct module *owner; |
@@ -215,14 +215,14 @@ struct cam_params { | |||
215 | u8 videoSize; /* CIF/QCIF */ | 215 | u8 videoSize; /* CIF/QCIF */ |
216 | u8 subSample; | 216 | u8 subSample; |
217 | u8 yuvOrder; | 217 | u8 yuvOrder; |
218 | } format; | 218 | } format; |
219 | struct { /* Intel QX3 specific data */ | 219 | struct { /* Intel QX3 specific data */ |
220 | u8 qx3_detected; /* a QX3 is present */ | 220 | u8 qx3_detected; /* a QX3 is present */ |
221 | u8 toplight; /* top light lit , R/W */ | 221 | u8 toplight; /* top light lit , R/W */ |
222 | u8 bottomlight; /* bottom light lit, R/W */ | 222 | u8 bottomlight; /* bottom light lit, R/W */ |
223 | u8 button; /* snapshot button pressed (R/O) */ | 223 | u8 button; /* snapshot button pressed (R/O) */ |
224 | u8 cradled; /* microscope is in cradle (R/O) */ | 224 | u8 cradled; /* microscope is in cradle (R/O) */ |
225 | } qx3; | 225 | } qx3; |
226 | struct { | 226 | struct { |
227 | u8 colStart; /* skip first 8*colStart pixels */ | 227 | u8 colStart; /* skip first 8*colStart pixels */ |
228 | u8 colEnd; /* finish at 8*colEnd pixels */ | 228 | u8 colEnd; /* finish at 8*colEnd pixels */ |
@@ -247,13 +247,13 @@ enum v4l_camstates { | |||
247 | struct cam_data { | 247 | struct cam_data { |
248 | struct list_head cam_data_list; | 248 | struct list_head cam_data_list; |
249 | 249 | ||
250 | struct mutex busy_lock; /* guard against SMP multithreading */ | 250 | struct mutex busy_lock; /* guard against SMP multithreading */ |
251 | struct cpia_camera_ops *ops; /* lowlevel driver operations */ | 251 | struct cpia_camera_ops *ops; /* lowlevel driver operations */ |
252 | void *lowlevel_data; /* private data for lowlevel driver */ | 252 | void *lowlevel_data; /* private data for lowlevel driver */ |
253 | u8 *raw_image; /* buffer for raw image data */ | 253 | u8 *raw_image; /* buffer for raw image data */ |
254 | struct cpia_frame decompressed_frame; | 254 | struct cpia_frame decompressed_frame; |
255 | /* buffer to hold decompressed frame */ | 255 | /* buffer to hold decompressed frame */ |
256 | int image_size; /* sizeof last decompressed image */ | 256 | int image_size; /* sizeof last decompressed image */ |
257 | int open_count; /* # of process that have camera open */ | 257 | int open_count; /* # of process that have camera open */ |
258 | 258 | ||
259 | /* camera status */ | 259 | /* camera status */ |
@@ -265,7 +265,7 @@ struct cam_data { | |||
265 | struct mutex param_lock; /* params lock for this camera */ | 265 | struct mutex param_lock; /* params lock for this camera */ |
266 | struct cam_params params; /* camera settings */ | 266 | struct cam_params params; /* camera settings */ |
267 | struct proc_dir_entry *proc_entry; /* /proc/cpia/videoX */ | 267 | struct proc_dir_entry *proc_entry; /* /proc/cpia/videoX */ |
268 | 268 | ||
269 | /* v4l */ | 269 | /* v4l */ |
270 | int video_size; /* VIDEO_SIZE_ */ | 270 | int video_size; /* VIDEO_SIZE_ */ |
271 | volatile enum v4l_camstates camstate; /* v4l layer status */ | 271 | volatile enum v4l_camstates camstate; /* v4l layer status */ |
@@ -277,7 +277,7 @@ struct cam_data { | |||
277 | /* mmap interface */ | 277 | /* mmap interface */ |
278 | int curframe; /* the current frame to grab into */ | 278 | int curframe; /* the current frame to grab into */ |
279 | u8 *frame_buf; /* frame buffer data */ | 279 | u8 *frame_buf; /* frame buffer data */ |
280 | struct cpia_frame frame[FRAME_NUM]; | 280 | struct cpia_frame frame[FRAME_NUM]; |
281 | /* FRAME_NUM-buffering, so we need a array */ | 281 | /* FRAME_NUM-buffering, so we need a array */ |
282 | 282 | ||
283 | int first_frame; | 283 | int first_frame; |
@@ -424,7 +424,7 @@ void cpia_unregister_camera(struct cam_data *cam); | |||
424 | #define DEB_BYTE(p)\ | 424 | #define DEB_BYTE(p)\ |
425 | DBG("%1d %1d %1d %1d %1d %1d %1d %1d \n",\ | 425 | DBG("%1d %1d %1d %1d %1d %1d %1d %1d \n",\ |
426 | (p)&0x80?1:0, (p)&0x40?1:0, (p)&0x20?1:0, (p)&0x10?1:0,\ | 426 | (p)&0x80?1:0, (p)&0x40?1:0, (p)&0x20?1:0, (p)&0x10?1:0,\ |
427 | (p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0); | 427 | (p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0); |
428 | 428 | ||
429 | #endif /* __KERNEL__ */ | 429 | #endif /* __KERNEL__ */ |
430 | 430 | ||
diff --git a/drivers/media/video/cpia2/cpia2.h b/drivers/media/video/cpia2/cpia2.h index 95d3afa94a3d..8394283993f6 100644 --- a/drivers/media/video/cpia2/cpia2.h +++ b/drivers/media/video/cpia2/cpia2.h | |||
@@ -381,7 +381,7 @@ struct cpia2_fh { | |||
381 | 381 | ||
382 | struct camera_data { | 382 | struct camera_data { |
383 | /* locks */ | 383 | /* locks */ |
384 | struct semaphore busy_lock; /* guard against SMP multithreading */ | 384 | struct mutex busy_lock; /* guard against SMP multithreading */ |
385 | struct v4l2_prio_state prio; | 385 | struct v4l2_prio_state prio; |
386 | 386 | ||
387 | /* camera status */ | 387 | /* camera status */ |
diff --git a/drivers/media/video/cpia2/cpia2_core.c b/drivers/media/video/cpia2/cpia2_core.c index 5dfb242d5b8c..fd771c7a2fe2 100644 --- a/drivers/media/video/cpia2/cpia2_core.c +++ b/drivers/media/video/cpia2/cpia2_core.c | |||
@@ -2238,7 +2238,7 @@ struct camera_data *cpia2_init_camera_struct(void) | |||
2238 | memset(cam, 0, sizeof(struct camera_data)); | 2238 | memset(cam, 0, sizeof(struct camera_data)); |
2239 | 2239 | ||
2240 | cam->present = 1; | 2240 | cam->present = 1; |
2241 | init_MUTEX(&cam->busy_lock); | 2241 | mutex_init(&cam->busy_lock); |
2242 | init_waitqueue_head(&cam->wq_stream); | 2242 | init_waitqueue_head(&cam->wq_stream); |
2243 | 2243 | ||
2244 | return cam; | 2244 | return cam; |
@@ -2371,12 +2371,12 @@ long cpia2_read(struct camera_data *cam, | |||
2371 | } | 2371 | } |
2372 | 2372 | ||
2373 | /* make this _really_ smp and multithread-safe */ | 2373 | /* make this _really_ smp and multithread-safe */ |
2374 | if (down_interruptible(&cam->busy_lock)) | 2374 | if (mutex_lock_interruptible(&cam->busy_lock)) |
2375 | return -ERESTARTSYS; | 2375 | return -ERESTARTSYS; |
2376 | 2376 | ||
2377 | if (!cam->present) { | 2377 | if (!cam->present) { |
2378 | LOG("%s: camera removed\n",__FUNCTION__); | 2378 | LOG("%s: camera removed\n",__FUNCTION__); |
2379 | up(&cam->busy_lock); | 2379 | mutex_unlock(&cam->busy_lock); |
2380 | return 0; /* EOF */ | 2380 | return 0; /* EOF */ |
2381 | } | 2381 | } |
2382 | 2382 | ||
@@ -2389,34 +2389,34 @@ long cpia2_read(struct camera_data *cam, | |||
2389 | /* Copy cam->curbuff in case it changes while we're processing */ | 2389 | /* Copy cam->curbuff in case it changes while we're processing */ |
2390 | frame = cam->curbuff; | 2390 | frame = cam->curbuff; |
2391 | if (noblock && frame->status != FRAME_READY) { | 2391 | if (noblock && frame->status != FRAME_READY) { |
2392 | up(&cam->busy_lock); | 2392 | mutex_unlock(&cam->busy_lock); |
2393 | return -EAGAIN; | 2393 | return -EAGAIN; |
2394 | } | 2394 | } |
2395 | 2395 | ||
2396 | if(frame->status != FRAME_READY) { | 2396 | if(frame->status != FRAME_READY) { |
2397 | up(&cam->busy_lock); | 2397 | mutex_unlock(&cam->busy_lock); |
2398 | wait_event_interruptible(cam->wq_stream, | 2398 | wait_event_interruptible(cam->wq_stream, |
2399 | !cam->present || | 2399 | !cam->present || |
2400 | (frame = cam->curbuff)->status == FRAME_READY); | 2400 | (frame = cam->curbuff)->status == FRAME_READY); |
2401 | if (signal_pending(current)) | 2401 | if (signal_pending(current)) |
2402 | return -ERESTARTSYS; | 2402 | return -ERESTARTSYS; |
2403 | /* make this _really_ smp and multithread-safe */ | 2403 | /* make this _really_ smp and multithread-safe */ |
2404 | if (down_interruptible(&cam->busy_lock)) { | 2404 | if (mutex_lock_interruptible(&cam->busy_lock)) { |
2405 | return -ERESTARTSYS; | 2405 | return -ERESTARTSYS; |
2406 | } | 2406 | } |
2407 | if(!cam->present) { | 2407 | if(!cam->present) { |
2408 | up(&cam->busy_lock); | 2408 | mutex_unlock(&cam->busy_lock); |
2409 | return 0; | 2409 | return 0; |
2410 | } | 2410 | } |
2411 | } | 2411 | } |
2412 | 2412 | ||
2413 | /* copy data to user space */ | 2413 | /* copy data to user space */ |
2414 | if (frame->length > count) { | 2414 | if (frame->length > count) { |
2415 | up(&cam->busy_lock); | 2415 | mutex_unlock(&cam->busy_lock); |
2416 | return -EFAULT; | 2416 | return -EFAULT; |
2417 | } | 2417 | } |
2418 | if (copy_to_user(buf, frame->data, frame->length)) { | 2418 | if (copy_to_user(buf, frame->data, frame->length)) { |
2419 | up(&cam->busy_lock); | 2419 | mutex_unlock(&cam->busy_lock); |
2420 | return -EFAULT; | 2420 | return -EFAULT; |
2421 | } | 2421 | } |
2422 | 2422 | ||
@@ -2424,7 +2424,7 @@ long cpia2_read(struct camera_data *cam, | |||
2424 | 2424 | ||
2425 | frame->status = FRAME_EMPTY; | 2425 | frame->status = FRAME_EMPTY; |
2426 | 2426 | ||
2427 | up(&cam->busy_lock); | 2427 | mutex_unlock(&cam->busy_lock); |
2428 | return count; | 2428 | return count; |
2429 | } | 2429 | } |
2430 | 2430 | ||
@@ -2443,10 +2443,10 @@ unsigned int cpia2_poll(struct camera_data *cam, struct file *filp, | |||
2443 | return POLLERR; | 2443 | return POLLERR; |
2444 | } | 2444 | } |
2445 | 2445 | ||
2446 | down(&cam->busy_lock); | 2446 | mutex_lock(&cam->busy_lock); |
2447 | 2447 | ||
2448 | if(!cam->present) { | 2448 | if(!cam->present) { |
2449 | up(&cam->busy_lock); | 2449 | mutex_unlock(&cam->busy_lock); |
2450 | return POLLHUP; | 2450 | return POLLHUP; |
2451 | } | 2451 | } |
2452 | 2452 | ||
@@ -2456,16 +2456,16 @@ unsigned int cpia2_poll(struct camera_data *cam, struct file *filp, | |||
2456 | cam->params.camera_state.stream_mode); | 2456 | cam->params.camera_state.stream_mode); |
2457 | } | 2457 | } |
2458 | 2458 | ||
2459 | up(&cam->busy_lock); | 2459 | mutex_unlock(&cam->busy_lock); |
2460 | poll_wait(filp, &cam->wq_stream, wait); | 2460 | poll_wait(filp, &cam->wq_stream, wait); |
2461 | down(&cam->busy_lock); | 2461 | mutex_lock(&cam->busy_lock); |
2462 | 2462 | ||
2463 | if(!cam->present) | 2463 | if(!cam->present) |
2464 | status = POLLHUP; | 2464 | status = POLLHUP; |
2465 | else if(cam->curbuff->status == FRAME_READY) | 2465 | else if(cam->curbuff->status == FRAME_READY) |
2466 | status = POLLIN | POLLRDNORM; | 2466 | status = POLLIN | POLLRDNORM; |
2467 | 2467 | ||
2468 | up(&cam->busy_lock); | 2468 | mutex_unlock(&cam->busy_lock); |
2469 | return status; | 2469 | return status; |
2470 | } | 2470 | } |
2471 | 2471 | ||
@@ -2488,18 +2488,18 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) | |||
2488 | DBG("mmap offset:%ld size:%ld\n", start_offset, size); | 2488 | DBG("mmap offset:%ld size:%ld\n", start_offset, size); |
2489 | 2489 | ||
2490 | /* make this _really_ smp-safe */ | 2490 | /* make this _really_ smp-safe */ |
2491 | if (down_interruptible(&cam->busy_lock)) | 2491 | if (mutex_lock_interruptible(&cam->busy_lock)) |
2492 | return -ERESTARTSYS; | 2492 | return -ERESTARTSYS; |
2493 | 2493 | ||
2494 | if (!cam->present) { | 2494 | if (!cam->present) { |
2495 | up(&cam->busy_lock); | 2495 | mutex_unlock(&cam->busy_lock); |
2496 | return -ENODEV; | 2496 | return -ENODEV; |
2497 | } | 2497 | } |
2498 | 2498 | ||
2499 | if (size > cam->frame_size*cam->num_frames || | 2499 | if (size > cam->frame_size*cam->num_frames || |
2500 | (start_offset % cam->frame_size) != 0 || | 2500 | (start_offset % cam->frame_size) != 0 || |
2501 | (start_offset+size > cam->frame_size*cam->num_frames)) { | 2501 | (start_offset+size > cam->frame_size*cam->num_frames)) { |
2502 | up(&cam->busy_lock); | 2502 | mutex_unlock(&cam->busy_lock); |
2503 | return -EINVAL; | 2503 | return -EINVAL; |
2504 | } | 2504 | } |
2505 | 2505 | ||
@@ -2507,7 +2507,7 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) | |||
2507 | while (size > 0) { | 2507 | while (size > 0) { |
2508 | page = kvirt_to_pa(pos); | 2508 | page = kvirt_to_pa(pos); |
2509 | if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED)) { | 2509 | if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED)) { |
2510 | up(&cam->busy_lock); | 2510 | mutex_unlock(&cam->busy_lock); |
2511 | return -EAGAIN; | 2511 | return -EAGAIN; |
2512 | } | 2512 | } |
2513 | start += PAGE_SIZE; | 2513 | start += PAGE_SIZE; |
@@ -2519,7 +2519,7 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) | |||
2519 | } | 2519 | } |
2520 | 2520 | ||
2521 | cam->mmapped = true; | 2521 | cam->mmapped = true; |
2522 | up(&cam->busy_lock); | 2522 | mutex_unlock(&cam->busy_lock); |
2523 | return 0; | 2523 | return 0; |
2524 | } | 2524 | } |
2525 | 2525 | ||
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 08f8be345fa8..481e178ef56d 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c | |||
@@ -255,7 +255,7 @@ static int cpia2_open(struct inode *inode, struct file *file) | |||
255 | return -ENODEV; | 255 | return -ENODEV; |
256 | } | 256 | } |
257 | 257 | ||
258 | if(down_interruptible(&cam->busy_lock)) | 258 | if(mutex_lock_interruptible(&cam->busy_lock)) |
259 | return -ERESTARTSYS; | 259 | return -ERESTARTSYS; |
260 | 260 | ||
261 | if(!cam->present) { | 261 | if(!cam->present) { |
@@ -299,7 +299,7 @@ skip_init: | |||
299 | cpia2_dbg_dump_registers(cam); | 299 | cpia2_dbg_dump_registers(cam); |
300 | 300 | ||
301 | err_return: | 301 | err_return: |
302 | up(&cam->busy_lock); | 302 | mutex_unlock(&cam->busy_lock); |
303 | return retval; | 303 | return retval; |
304 | } | 304 | } |
305 | 305 | ||
@@ -314,7 +314,7 @@ static int cpia2_close(struct inode *inode, struct file *file) | |||
314 | struct camera_data *cam = video_get_drvdata(dev); | 314 | struct camera_data *cam = video_get_drvdata(dev); |
315 | struct cpia2_fh *fh = file->private_data; | 315 | struct cpia2_fh *fh = file->private_data; |
316 | 316 | ||
317 | down(&cam->busy_lock); | 317 | mutex_lock(&cam->busy_lock); |
318 | 318 | ||
319 | if (cam->present && | 319 | if (cam->present && |
320 | (cam->open_count == 1 | 320 | (cam->open_count == 1 |
@@ -347,7 +347,7 @@ static int cpia2_close(struct inode *inode, struct file *file) | |||
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | up(&cam->busy_lock); | 350 | mutex_unlock(&cam->busy_lock); |
351 | 351 | ||
352 | return 0; | 352 | return 0; |
353 | } | 353 | } |
@@ -523,11 +523,11 @@ static int sync(struct camera_data *cam, int frame_nr) | |||
523 | return 0; | 523 | return 0; |
524 | } | 524 | } |
525 | 525 | ||
526 | up(&cam->busy_lock); | 526 | mutex_unlock(&cam->busy_lock); |
527 | wait_event_interruptible(cam->wq_stream, | 527 | wait_event_interruptible(cam->wq_stream, |
528 | !cam->streaming || | 528 | !cam->streaming || |
529 | frame->status == FRAME_READY); | 529 | frame->status == FRAME_READY); |
530 | down(&cam->busy_lock); | 530 | mutex_lock(&cam->busy_lock); |
531 | if (signal_pending(current)) | 531 | if (signal_pending(current)) |
532 | return -ERESTARTSYS; | 532 | return -ERESTARTSYS; |
533 | if(!cam->present) | 533 | if(!cam->present) |
@@ -1544,11 +1544,11 @@ static int ioctl_dqbuf(void *arg,struct camera_data *cam, struct file *file) | |||
1544 | if(frame < 0) { | 1544 | if(frame < 0) { |
1545 | /* Wait for a frame to become available */ | 1545 | /* Wait for a frame to become available */ |
1546 | struct framebuf *cb=cam->curbuff; | 1546 | struct framebuf *cb=cam->curbuff; |
1547 | up(&cam->busy_lock); | 1547 | mutex_unlock(&cam->busy_lock); |
1548 | wait_event_interruptible(cam->wq_stream, | 1548 | wait_event_interruptible(cam->wq_stream, |
1549 | !cam->present || | 1549 | !cam->present || |
1550 | (cb=cam->curbuff)->status == FRAME_READY); | 1550 | (cb=cam->curbuff)->status == FRAME_READY); |
1551 | down(&cam->busy_lock); | 1551 | mutex_lock(&cam->busy_lock); |
1552 | if (signal_pending(current)) | 1552 | if (signal_pending(current)) |
1553 | return -ERESTARTSYS; | 1553 | return -ERESTARTSYS; |
1554 | if(!cam->present) | 1554 | if(!cam->present) |
@@ -1591,11 +1591,11 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1591 | return -ENOTTY; | 1591 | return -ENOTTY; |
1592 | 1592 | ||
1593 | /* make this _really_ smp-safe */ | 1593 | /* make this _really_ smp-safe */ |
1594 | if (down_interruptible(&cam->busy_lock)) | 1594 | if (mutex_lock_interruptible(&cam->busy_lock)) |
1595 | return -ERESTARTSYS; | 1595 | return -ERESTARTSYS; |
1596 | 1596 | ||
1597 | if (!cam->present) { | 1597 | if (!cam->present) { |
1598 | up(&cam->busy_lock); | 1598 | mutex_unlock(&cam->busy_lock); |
1599 | return -ENODEV; | 1599 | return -ENODEV; |
1600 | } | 1600 | } |
1601 | 1601 | ||
@@ -1608,7 +1608,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1608 | struct cpia2_fh *fh = file->private_data; | 1608 | struct cpia2_fh *fh = file->private_data; |
1609 | retval = v4l2_prio_check(&cam->prio, &fh->prio); | 1609 | retval = v4l2_prio_check(&cam->prio, &fh->prio); |
1610 | if(retval) { | 1610 | if(retval) { |
1611 | up(&cam->busy_lock); | 1611 | mutex_unlock(&cam->busy_lock); |
1612 | return retval; | 1612 | return retval; |
1613 | } | 1613 | } |
1614 | break; | 1614 | break; |
@@ -1618,7 +1618,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1618 | { | 1618 | { |
1619 | struct cpia2_fh *fh = file->private_data; | 1619 | struct cpia2_fh *fh = file->private_data; |
1620 | if(fh->prio != V4L2_PRIORITY_RECORD) { | 1620 | if(fh->prio != V4L2_PRIORITY_RECORD) { |
1621 | up(&cam->busy_lock); | 1621 | mutex_unlock(&cam->busy_lock); |
1622 | return -EBUSY; | 1622 | return -EBUSY; |
1623 | } | 1623 | } |
1624 | break; | 1624 | break; |
@@ -1847,7 +1847,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1847 | break; | 1847 | break; |
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | up(&cam->busy_lock); | 1850 | mutex_unlock(&cam->busy_lock); |
1851 | return retval; | 1851 | return retval; |
1852 | } | 1852 | } |
1853 | 1853 | ||
@@ -1924,14 +1924,15 @@ static void reset_camera_struct_v4l(struct camera_data *cam) | |||
1924 | * The v4l video device structure initialized for this device | 1924 | * The v4l video device structure initialized for this device |
1925 | ***/ | 1925 | ***/ |
1926 | static struct file_operations fops_template = { | 1926 | static struct file_operations fops_template = { |
1927 | .owner= THIS_MODULE, | 1927 | .owner = THIS_MODULE, |
1928 | .open= cpia2_open, | 1928 | .open = cpia2_open, |
1929 | .release= cpia2_close, | 1929 | .release = cpia2_close, |
1930 | .read= cpia2_v4l_read, | 1930 | .read = cpia2_v4l_read, |
1931 | .poll= cpia2_v4l_poll, | 1931 | .poll = cpia2_v4l_poll, |
1932 | .ioctl= cpia2_ioctl, | 1932 | .ioctl = cpia2_ioctl, |
1933 | .llseek= no_llseek, | 1933 | .llseek = no_llseek, |
1934 | .mmap= cpia2_mmap, | 1934 | .compat_ioctl = v4l_compat_ioctl32, |
1935 | .mmap = cpia2_mmap, | ||
1935 | }; | 1936 | }; |
1936 | 1937 | ||
1937 | static struct video_device cpia2_template = { | 1938 | static struct video_device cpia2_template = { |
diff --git a/drivers/media/video/cpia_pp.c b/drivers/media/video/cpia_pp.c index 74cff626e044..3021f21aae36 100644 --- a/drivers/media/video/cpia_pp.c +++ b/drivers/media/video/cpia_pp.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ | 25 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ |
26 | /* #define _CPIA_DEBUG_ 1 */ | 26 | /* #define _CPIA_DEBUG_ 1 */ |
27 | 27 | ||
28 | #include <linux/config.h> | 28 | #include <linux/config.h> |
29 | 29 | ||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | static int cpia_pp_open(void *privdata); | 46 | static int cpia_pp_open(void *privdata); |
47 | static int cpia_pp_registerCallback(void *privdata, void (*cb) (void *cbdata), | 47 | static int cpia_pp_registerCallback(void *privdata, void (*cb) (void *cbdata), |
48 | void *cbdata); | 48 | void *cbdata); |
49 | static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data); | 49 | static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data); |
50 | static int cpia_pp_streamStart(void *privdata); | 50 | static int cpia_pp_streamStart(void *privdata); |
51 | static int cpia_pp_streamStop(void *privdata); | 51 | static int cpia_pp_streamStop(void *privdata); |
@@ -93,7 +93,7 @@ struct pp_cam_entry { | |||
93 | int stream_irq; | 93 | int stream_irq; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static struct cpia_camera_ops cpia_pp_ops = | 96 | static struct cpia_camera_ops cpia_pp_ops = |
97 | { | 97 | { |
98 | cpia_pp_open, | 98 | cpia_pp_open, |
99 | cpia_pp_registerCallback, | 99 | cpia_pp_registerCallback, |
@@ -123,7 +123,7 @@ static void cpia_parport_disable_irq( struct parport *port ) { | |||
123 | } | 123 | } |
124 | 124 | ||
125 | /* Special CPiA PPC modes: These are invoked by using the 1284 Extensibility | 125 | /* Special CPiA PPC modes: These are invoked by using the 1284 Extensibility |
126 | * Link Flag during negotiation */ | 126 | * Link Flag during negotiation */ |
127 | #define UPLOAD_FLAG 0x08 | 127 | #define UPLOAD_FLAG 0x08 |
128 | #define NIBBLE_TRANSFER 0x01 | 128 | #define NIBBLE_TRANSFER 0x01 |
129 | #define ECP_TRANSFER 0x03 | 129 | #define ECP_TRANSFER 0x03 |
@@ -139,17 +139,17 @@ static void cpia_parport_disable_irq( struct parport *port ) { | |||
139 | /* CPiA nonstandard "Nibble" mode (no nDataAvail signal after each byte). */ | 139 | /* CPiA nonstandard "Nibble" mode (no nDataAvail signal after each byte). */ |
140 | /* The standard kernel parport_ieee1284_read_nibble() fails with the CPiA... */ | 140 | /* The standard kernel parport_ieee1284_read_nibble() fails with the CPiA... */ |
141 | 141 | ||
142 | static size_t cpia_read_nibble (struct parport *port, | 142 | static size_t cpia_read_nibble (struct parport *port, |
143 | void *buffer, size_t len, | 143 | void *buffer, size_t len, |
144 | int flags) | 144 | int flags) |
145 | { | 145 | { |
146 | /* adapted verbatim, with one change, from | 146 | /* adapted verbatim, with one change, from |
147 | parport_ieee1284_read_nibble() in drivers/parport/ieee1284-ops.c */ | 147 | parport_ieee1284_read_nibble() in drivers/parport/ieee1284-ops.c */ |
148 | 148 | ||
149 | unsigned char *buf = buffer; | 149 | unsigned char *buf = buffer; |
150 | int i; | 150 | int i; |
151 | unsigned char byte = 0; | 151 | unsigned char byte = 0; |
152 | 152 | ||
153 | len *= 2; /* in nibbles */ | 153 | len *= 2; /* in nibbles */ |
154 | for (i=0; i < len; i++) { | 154 | for (i=0; i < len; i++) { |
155 | unsigned char nibble; | 155 | unsigned char nibble; |
@@ -158,12 +158,12 @@ static size_t cpia_read_nibble (struct parport *port, | |||
158 | * after every second nibble to signal that more | 158 | * after every second nibble to signal that more |
159 | * data is available. (the total number of Bytes that | 159 | * data is available. (the total number of Bytes that |
160 | * should be sent is known; if too few are received, an error | 160 | * should be sent is known; if too few are received, an error |
161 | * will be recorded after a timeout). | 161 | * will be recorded after a timeout). |
162 | * This is incompatible with parport_ieee1284_read_nibble(), | 162 | * This is incompatible with parport_ieee1284_read_nibble(), |
163 | * which expects to find nFault LO after every second nibble. | 163 | * which expects to find nFault LO after every second nibble. |
164 | */ | 164 | */ |
165 | 165 | ||
166 | /* Solution: modify cpia_read_nibble to only check for | 166 | /* Solution: modify cpia_read_nibble to only check for |
167 | * nDataAvail before the first nibble is sent. | 167 | * nDataAvail before the first nibble is sent. |
168 | */ | 168 | */ |
169 | 169 | ||
@@ -216,7 +216,7 @@ static size_t cpia_read_nibble (struct parport *port, | |||
216 | /* Second nibble */ | 216 | /* Second nibble */ |
217 | byte |= nibble << 4; | 217 | byte |= nibble << 4; |
218 | *buf++ = byte; | 218 | *buf++ = byte; |
219 | } else | 219 | } else |
220 | byte = nibble; | 220 | byte = nibble; |
221 | } | 221 | } |
222 | 222 | ||
@@ -238,18 +238,18 @@ static size_t cpia_read_nibble (struct parport *port, | |||
238 | } | 238 | } |
239 | 239 | ||
240 | /* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1) | 240 | /* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1) |
241 | * (See CPiA Data sheet p. 31) | 241 | * (See CPiA Data sheet p. 31) |
242 | * | 242 | * |
243 | * "Nibble Stream" mode used by CPiA for uploads to non-ECP ports is a | 243 | * "Nibble Stream" mode used by CPiA for uploads to non-ECP ports is a |
244 | * nonstandard variant of nibble mode which allows the same (mediocre) | 244 | * nonstandard variant of nibble mode which allows the same (mediocre) |
245 | * data flow of 8 bits per cycle as software-enabled ECP by TRISTATE-capable | 245 | * data flow of 8 bits per cycle as software-enabled ECP by TRISTATE-capable |
246 | * parallel ports, but works also for non-TRISTATE-capable ports. | 246 | * parallel ports, but works also for non-TRISTATE-capable ports. |
247 | * (Standard nibble mode only send 4 bits per cycle) | 247 | * (Standard nibble mode only send 4 bits per cycle) |
248 | * | 248 | * |
249 | */ | 249 | */ |
250 | 250 | ||
251 | static size_t cpia_read_nibble_stream(struct parport *port, | 251 | static size_t cpia_read_nibble_stream(struct parport *port, |
252 | void *buffer, size_t len, | 252 | void *buffer, size_t len, |
253 | int flags) | 253 | int flags) |
254 | { | 254 | { |
255 | int i; | 255 | int i; |
@@ -260,7 +260,7 @@ static size_t cpia_read_nibble_stream(struct parport *port, | |||
260 | unsigned char nibble[2], byte = 0; | 260 | unsigned char nibble[2], byte = 0; |
261 | int j; | 261 | int j; |
262 | 262 | ||
263 | /* Image Data is complete when 4 consecutive EOI bytes (0xff) are seen */ | 263 | /* Image Data is complete when 4 consecutive EOI bytes (0xff) are seen */ |
264 | if (endseen > 3 ) | 264 | if (endseen > 3 ) |
265 | break; | 265 | break; |
266 | 266 | ||
@@ -268,7 +268,7 @@ static size_t cpia_read_nibble_stream(struct parport *port, | |||
268 | parport_frob_control (port, | 268 | parport_frob_control (port, |
269 | PARPORT_CONTROL_AUTOFD, | 269 | PARPORT_CONTROL_AUTOFD, |
270 | PARPORT_CONTROL_AUTOFD); | 270 | PARPORT_CONTROL_AUTOFD); |
271 | 271 | ||
272 | /* Event 9: nAck goes low. */ | 272 | /* Event 9: nAck goes low. */ |
273 | port->ieee1284.phase = IEEE1284_PH_REV_DATA; | 273 | port->ieee1284.phase = IEEE1284_PH_REV_DATA; |
274 | if (parport_wait_peripheral (port, | 274 | if (parport_wait_peripheral (port, |
@@ -282,7 +282,7 @@ static size_t cpia_read_nibble_stream(struct parport *port, | |||
282 | 282 | ||
283 | /* Read lower nibble */ | 283 | /* Read lower nibble */ |
284 | nibble[0] = parport_read_status (port) >>3; | 284 | nibble[0] = parport_read_status (port) >>3; |
285 | 285 | ||
286 | /* Event 10: Set nAutoFd high. */ | 286 | /* Event 10: Set nAutoFd high. */ |
287 | parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); | 287 | parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); |
288 | 288 | ||
@@ -295,10 +295,10 @@ static size_t cpia_read_nibble_stream(struct parport *port, | |||
295 | port->name); | 295 | port->name); |
296 | break; | 296 | break; |
297 | } | 297 | } |
298 | 298 | ||
299 | /* Read upper nibble */ | 299 | /* Read upper nibble */ |
300 | nibble[1] = parport_read_status (port) >>3; | 300 | nibble[1] = parport_read_status (port) >>3; |
301 | 301 | ||
302 | /* reassemble the byte */ | 302 | /* reassemble the byte */ |
303 | for (j = 0; j < 2 ; j++ ) { | 303 | for (j = 0; j < 2 ; j++ ) { |
304 | nibble[j] &= ~8; | 304 | nibble[j] &= ~8; |
@@ -335,8 +335,8 @@ static void EndTransferMode(struct pp_cam_entry *cam) | |||
335 | static int ForwardSetup(struct pp_cam_entry *cam) | 335 | static int ForwardSetup(struct pp_cam_entry *cam) |
336 | { | 336 | { |
337 | int retry; | 337 | int retry; |
338 | 338 | ||
339 | /* The CPiA uses ECP protocol for Downloads from the Host to the camera. | 339 | /* The CPiA uses ECP protocol for Downloads from the Host to the camera. |
340 | * This will be software-emulated if ECP hardware is not present | 340 | * This will be software-emulated if ECP hardware is not present |
341 | */ | 341 | */ |
342 | 342 | ||
@@ -375,9 +375,9 @@ static int ReverseSetup(struct pp_cam_entry *cam, int extensibility) | |||
375 | upload_mode = mode; | 375 | upload_mode = mode; |
376 | if(extensibility) mode = UPLOAD_FLAG|transfer_mode|IEEE1284_EXT_LINK; | 376 | if(extensibility) mode = UPLOAD_FLAG|transfer_mode|IEEE1284_EXT_LINK; |
377 | 377 | ||
378 | /* the usual camera maximum response time is 10ms, but after | 378 | /* the usual camera maximum response time is 10ms, but after |
379 | * receiving some commands, it needs up to 40ms. */ | 379 | * receiving some commands, it needs up to 40ms. */ |
380 | 380 | ||
381 | for(retry = 0; retry < 4; ++retry) { | 381 | for(retry = 0; retry < 4; ++retry) { |
382 | if(!parport_negotiate(cam->port, mode)) { | 382 | if(!parport_negotiate(cam->port, mode)) { |
383 | break; | 383 | break; |
@@ -439,10 +439,10 @@ static int ReadPacket(struct pp_cam_entry *cam, u8 *packet, size_t size) | |||
439 | 439 | ||
440 | /* support for CPiA variant nibble reads */ | 440 | /* support for CPiA variant nibble reads */ |
441 | if(cam->port->ieee1284.mode == IEEE1284_MODE_NIBBLE) { | 441 | if(cam->port->ieee1284.mode == IEEE1284_MODE_NIBBLE) { |
442 | if(cpia_read_nibble(cam->port, packet, size, 0) != size) | 442 | if(cpia_read_nibble(cam->port, packet, size, 0) != size) |
443 | retval = -EIO; | 443 | retval = -EIO; |
444 | } else { | 444 | } else { |
445 | if(parport_read(cam->port, packet, size) != size) | 445 | if(parport_read(cam->port, packet, size) != size) |
446 | retval = -EIO; | 446 | retval = -EIO; |
447 | } | 447 | } |
448 | EndTransferMode(cam); | 448 | EndTransferMode(cam); |
@@ -542,18 +542,18 @@ static int cpia_pp_streamRead(void *privdata, u8 *buffer, int noblock) | |||
542 | block_size = PARPORT_CHUNK_SIZE; | 542 | block_size = PARPORT_CHUNK_SIZE; |
543 | while( !cam->image_complete ) { | 543 | while( !cam->image_complete ) { |
544 | cond_resched(); | 544 | cond_resched(); |
545 | 545 | ||
546 | new_bytes = cpia_pp_read(cam->port, buffer, block_size ); | 546 | new_bytes = cpia_pp_read(cam->port, buffer, block_size ); |
547 | if( new_bytes <= 0 ) { | 547 | if( new_bytes <= 0 ) { |
548 | break; | 548 | break; |
549 | } | 549 | } |
550 | i=-1; | 550 | i=-1; |
551 | while(++i<new_bytes && endseen<4) { | 551 | while(++i<new_bytes && endseen<4) { |
552 | if(*buffer==EOI) { | 552 | if(*buffer==EOI) { |
553 | endseen++; | 553 | endseen++; |
554 | } else { | 554 | } else { |
555 | endseen=0; | 555 | endseen=0; |
556 | } | 556 | } |
557 | buffer++; | 557 | buffer++; |
558 | } | 558 | } |
559 | read_bytes += i; | 559 | read_bytes += i; |
@@ -601,7 +601,7 @@ static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data) | |||
601 | } | 601 | } |
602 | if((err = ReadPacket(cam, buffer, 8)) < 0) { | 602 | if((err = ReadPacket(cam, buffer, 8)) < 0) { |
603 | DBG("Error reading command result\n"); | 603 | DBG("Error reading command result\n"); |
604 | return err; | 604 | return err; |
605 | } | 605 | } |
606 | memcpy(data, buffer, databytes); | 606 | memcpy(data, buffer, databytes); |
607 | } else if(command[0] == DATA_OUT) { | 607 | } else if(command[0] == DATA_OUT) { |
@@ -631,10 +631,10 @@ static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data) | |||
631 | static int cpia_pp_open(void *privdata) | 631 | static int cpia_pp_open(void *privdata) |
632 | { | 632 | { |
633 | struct pp_cam_entry *cam = (struct pp_cam_entry *)privdata; | 633 | struct pp_cam_entry *cam = (struct pp_cam_entry *)privdata; |
634 | 634 | ||
635 | if (cam == NULL) | 635 | if (cam == NULL) |
636 | return -EINVAL; | 636 | return -EINVAL; |
637 | 637 | ||
638 | if(cam->open_count == 0) { | 638 | if(cam->open_count == 0) { |
639 | if (parport_claim(cam->pdev)) { | 639 | if (parport_claim(cam->pdev)) { |
640 | DBG("failed to claim the port\n"); | 640 | DBG("failed to claim the port\n"); |
@@ -645,12 +645,12 @@ static int cpia_pp_open(void *privdata) | |||
645 | parport_write_control(cam->port, PARPORT_CONTROL_SELECT); | 645 | parport_write_control(cam->port, PARPORT_CONTROL_SELECT); |
646 | udelay(50); | 646 | udelay(50); |
647 | parport_write_control(cam->port, | 647 | parport_write_control(cam->port, |
648 | PARPORT_CONTROL_SELECT | 648 | PARPORT_CONTROL_SELECT |
649 | | PARPORT_CONTROL_INIT); | 649 | | PARPORT_CONTROL_INIT); |
650 | } | 650 | } |
651 | 651 | ||
652 | ++cam->open_count; | 652 | ++cam->open_count; |
653 | 653 | ||
654 | return 0; | 654 | return 0; |
655 | } | 655 | } |
656 | 656 | ||
@@ -663,7 +663,7 @@ static int cpia_pp_registerCallback(void *privdata, void (*cb)(void *cbdata), vo | |||
663 | { | 663 | { |
664 | struct pp_cam_entry *cam = privdata; | 664 | struct pp_cam_entry *cam = privdata; |
665 | int retval = 0; | 665 | int retval = 0; |
666 | 666 | ||
667 | if(cam->port->irq != PARPORT_IRQ_NONE) { | 667 | if(cam->port->irq != PARPORT_IRQ_NONE) { |
668 | INIT_WORK(&cam->cb_task, cb, cbdata); | 668 | INIT_WORK(&cam->cb_task, cb, cbdata); |
669 | } else { | 669 | } else { |
@@ -707,9 +707,9 @@ static int cpia_pp_register(struct parport *port) | |||
707 | LOG("failed to allocate camera structure\n"); | 707 | LOG("failed to allocate camera structure\n"); |
708 | return -ENOMEM; | 708 | return -ENOMEM; |
709 | } | 709 | } |
710 | 710 | ||
711 | pdev = parport_register_device(port, "cpia_pp", NULL, NULL, | 711 | pdev = parport_register_device(port, "cpia_pp", NULL, NULL, |
712 | NULL, 0, cam); | 712 | NULL, 0, cam); |
713 | 713 | ||
714 | if (!pdev) { | 714 | if (!pdev) { |
715 | LOG("failed to parport_register_device\n"); | 715 | LOG("failed to parport_register_device\n"); |
@@ -753,19 +753,19 @@ static void cpia_pp_detach (struct parport *port) | |||
753 | } | 753 | } |
754 | cpia = NULL; | 754 | cpia = NULL; |
755 | } | 755 | } |
756 | spin_unlock( &cam_list_lock_pp ); | 756 | spin_unlock( &cam_list_lock_pp ); |
757 | 757 | ||
758 | if (!cpia) { | 758 | if (!cpia) { |
759 | DBG("cpia_pp_detach failed to find cam_data in cam_list\n"); | 759 | DBG("cpia_pp_detach failed to find cam_data in cam_list\n"); |
760 | return; | 760 | return; |
761 | } | 761 | } |
762 | 762 | ||
763 | cam = (struct pp_cam_entry *) cpia->lowlevel_data; | 763 | cam = (struct pp_cam_entry *) cpia->lowlevel_data; |
764 | cpia_unregister_camera(cpia); | 764 | cpia_unregister_camera(cpia); |
765 | if(cam->open_count > 0) | 765 | if(cam->open_count > 0) |
766 | cpia_pp_close(cam); | 766 | cpia_pp_close(cam); |
767 | parport_unregister_device(cam->pdev); | 767 | parport_unregister_device(cam->pdev); |
768 | cpia->lowlevel_data = NULL; | 768 | cpia->lowlevel_data = NULL; |
769 | kfree(cam); | 769 | kfree(cam); |
770 | } | 770 | } |
771 | 771 | ||
@@ -805,14 +805,14 @@ static struct parport_driver cpia_pp_driver = { | |||
805 | 805 | ||
806 | int cpia_pp_init(void) | 806 | int cpia_pp_init(void) |
807 | { | 807 | { |
808 | printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, | 808 | printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, |
809 | CPIA_PP_MAJ_VER,CPIA_PP_MIN_VER,CPIA_PP_PATCH_VER); | 809 | CPIA_PP_MAJ_VER,CPIA_PP_MIN_VER,CPIA_PP_PATCH_VER); |
810 | 810 | ||
811 | if(parport_nr[0] == PPCPIA_PARPORT_OFF) { | 811 | if(parport_nr[0] == PPCPIA_PARPORT_OFF) { |
812 | printk(" disabled\n"); | 812 | printk(" disabled\n"); |
813 | return 0; | 813 | return 0; |
814 | } | 814 | } |
815 | 815 | ||
816 | spin_lock_init( &cam_list_lock_pp ); | 816 | spin_lock_init( &cam_list_lock_pp ); |
817 | 817 | ||
818 | if (parport_register_driver (&cpia_pp_driver)) { | 818 | if (parport_register_driver (&cpia_pp_driver)) { |
diff --git a/drivers/media/video/cpia_usb.c b/drivers/media/video/cpia_usb.c index 03275c37c5d3..9c49a4b00116 100644 --- a/drivers/media/video/cpia_usb.c +++ b/drivers/media/video/cpia_usb.c | |||
@@ -22,7 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ | 24 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ |
25 | /* #define _CPIA_DEBUG_ 1 */ | 25 | /* #define _CPIA_DEBUG_ 1 */ |
26 | 26 | ||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
@@ -85,7 +85,7 @@ struct usb_cpia { | |||
85 | 85 | ||
86 | static int cpia_usb_open(void *privdata); | 86 | static int cpia_usb_open(void *privdata); |
87 | static int cpia_usb_registerCallback(void *privdata, void (*cb) (void *cbdata), | 87 | static int cpia_usb_registerCallback(void *privdata, void (*cb) (void *cbdata), |
88 | void *cbdata); | 88 | void *cbdata); |
89 | static int cpia_usb_transferCmd(void *privdata, u8 *command, u8 *data); | 89 | static int cpia_usb_transferCmd(void *privdata, u8 *command, u8 *data); |
90 | static int cpia_usb_streamStart(void *privdata); | 90 | static int cpia_usb_streamStart(void *privdata); |
91 | static int cpia_usb_streamStop(void *privdata); | 91 | static int cpia_usb_streamStop(void *privdata); |
@@ -127,7 +127,7 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs) | |||
127 | ucpia->workbuff->status = FRAME_READING; | 127 | ucpia->workbuff->status = FRAME_READING; |
128 | ucpia->workbuff->length = 0; | 128 | ucpia->workbuff->length = 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | for (i = 0; i < urb->number_of_packets; i++) { | 131 | for (i = 0; i < urb->number_of_packets; i++) { |
132 | int n = urb->iso_frame_desc[i].actual_length; | 132 | int n = urb->iso_frame_desc[i].actual_length; |
133 | int st = urb->iso_frame_desc[i].status; | 133 | int st = urb->iso_frame_desc[i].status; |
@@ -141,9 +141,9 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs) | |||
141 | printk(KERN_DEBUG "cpia: scratch buf overflow!scr_len: %d, n: %d\n", ucpia->workbuff->length, n); | 141 | printk(KERN_DEBUG "cpia: scratch buf overflow!scr_len: %d, n: %d\n", ucpia->workbuff->length, n); |
142 | return; | 142 | return; |
143 | } | 143 | } |
144 | 144 | ||
145 | if (n) { | 145 | if (n) { |
146 | if ((ucpia->workbuff->length > 0) || | 146 | if ((ucpia->workbuff->length > 0) || |
147 | (0x19 == cdata[0] && 0x68 == cdata[1])) { | 147 | (0x19 == cdata[0] && 0x68 == cdata[1])) { |
148 | memcpy(ucpia->workbuff->data + ucpia->workbuff->length, cdata, n); | 148 | memcpy(ucpia->workbuff->data + ucpia->workbuff->length, cdata, n); |
149 | ucpia->workbuff->length += n; | 149 | ucpia->workbuff->length += n; |
@@ -160,7 +160,7 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs) | |||
160 | ucpia->workbuff = ucpia->workbuff->next; | 160 | ucpia->workbuff = ucpia->workbuff->next; |
161 | ucpia->workbuff->status = FRAME_EMPTY; | 161 | ucpia->workbuff->status = FRAME_EMPTY; |
162 | ucpia->workbuff->length = 0; | 162 | ucpia->workbuff->length = 0; |
163 | 163 | ||
164 | if (waitqueue_active(&ucpia->wq_stream)) | 164 | if (waitqueue_active(&ucpia->wq_stream)) |
165 | wake_up_interruptible(&ucpia->wq_stream); | 165 | wake_up_interruptible(&ucpia->wq_stream); |
166 | } | 166 | } |
@@ -178,7 +178,7 @@ static int cpia_usb_open(void *privdata) | |||
178 | struct usb_cpia *ucpia = (struct usb_cpia *) privdata; | 178 | struct usb_cpia *ucpia = (struct usb_cpia *) privdata; |
179 | struct urb *urb; | 179 | struct urb *urb; |
180 | int ret, retval = 0, fx, err; | 180 | int ret, retval = 0, fx, err; |
181 | 181 | ||
182 | if (!ucpia) | 182 | if (!ucpia) |
183 | return -EINVAL; | 183 | return -EINVAL; |
184 | 184 | ||
@@ -191,7 +191,7 @@ static int cpia_usb_open(void *privdata) | |||
191 | retval = -EINVAL; | 191 | retval = -EINVAL; |
192 | goto error_0; | 192 | goto error_0; |
193 | } | 193 | } |
194 | 194 | ||
195 | ret = usb_set_interface(ucpia->dev, ucpia->iface, 3); | 195 | ret = usb_set_interface(ucpia->dev, ucpia->iface, 3); |
196 | if (ret < 0) { | 196 | if (ret < 0) { |
197 | printk(KERN_ERR "cpia_usb_open: usb_set_interface error (ret = %d)\n", ret); | 197 | printk(KERN_ERR "cpia_usb_open: usb_set_interface error (ret = %d)\n", ret); |
@@ -286,7 +286,7 @@ error_1: | |||
286 | error_0: | 286 | error_0: |
287 | kfree (ucpia->sbuf[0].data); | 287 | kfree (ucpia->sbuf[0].data); |
288 | ucpia->sbuf[0].data = NULL; | 288 | ucpia->sbuf[0].data = NULL; |
289 | 289 | ||
290 | return retval; | 290 | return retval; |
291 | } | 291 | } |
292 | 292 | ||
@@ -307,7 +307,7 @@ static int WritePacket(struct usb_device *udev, const u8 *packet, u8 *buf, size_ | |||
307 | return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 307 | return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
308 | packet[1] + (packet[0] << 8), | 308 | packet[1] + (packet[0] << 8), |
309 | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 309 | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
310 | packet[2] + (packet[3] << 8), | 310 | packet[2] + (packet[3] << 8), |
311 | packet[4] + (packet[5] << 8), buf, size, 1000); | 311 | packet[4] + (packet[5] << 8), buf, size, 1000); |
312 | } | 312 | } |
313 | 313 | ||
@@ -324,7 +324,7 @@ static int ReadPacket(struct usb_device *udev, u8 *packet, u8 *buf, size_t size) | |||
324 | return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 324 | return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
325 | packet[1] + (packet[0] << 8), | 325 | packet[1] + (packet[0] << 8), |
326 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 326 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
327 | packet[2] + (packet[3] << 8), | 327 | packet[2] + (packet[3] << 8), |
328 | packet[4] + (packet[5] << 8), buf, size, 1000); | 328 | packet[4] + (packet[5] << 8), buf, size, 1000); |
329 | } | 329 | } |
330 | 330 | ||
@@ -393,7 +393,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock) | |||
393 | 393 | ||
394 | if (!ucpia || !ucpia->present) | 394 | if (!ucpia || !ucpia->present) |
395 | return -1; | 395 | return -1; |
396 | 396 | ||
397 | if (ucpia->curbuff->status != FRAME_READY) | 397 | if (ucpia->curbuff->status != FRAME_READY) |
398 | interruptible_sleep_on(&ucpia->wq_stream); | 398 | interruptible_sleep_on(&ucpia->wq_stream); |
399 | else | 399 | else |
@@ -403,7 +403,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock) | |||
403 | 403 | ||
404 | if (!mybuff) | 404 | if (!mybuff) |
405 | return -1; | 405 | return -1; |
406 | 406 | ||
407 | if (mybuff->status != FRAME_READY || mybuff->length < 4) { | 407 | if (mybuff->status != FRAME_READY || mybuff->length < 4) { |
408 | DBG("Something went wrong!\n"); | 408 | DBG("Something went wrong!\n"); |
409 | return -1; | 409 | return -1; |
@@ -411,7 +411,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock) | |||
411 | 411 | ||
412 | memcpy(frame, mybuff->data, mybuff->length); | 412 | memcpy(frame, mybuff->data, mybuff->length); |
413 | mybuff->status = FRAME_EMPTY; | 413 | mybuff->status = FRAME_EMPTY; |
414 | 414 | ||
415 | /* DBG("read done, %d bytes, Header: %x/%x, Footer: %x%x%x%x\n", */ | 415 | /* DBG("read done, %d bytes, Header: %x/%x, Footer: %x%x%x%x\n", */ |
416 | /* mybuff->length, frame[0], frame[1], */ | 416 | /* mybuff->length, frame[0], frame[1], */ |
417 | /* frame[mybuff->length-4], frame[mybuff->length-3], */ | 417 | /* frame[mybuff->length-4], frame[mybuff->length-3], */ |
@@ -447,7 +447,7 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try) | |||
447 | 447 | ||
448 | kfree(ucpia->sbuf[1].data); | 448 | kfree(ucpia->sbuf[1].data); |
449 | ucpia->sbuf[1].data = NULL; | 449 | ucpia->sbuf[1].data = NULL; |
450 | 450 | ||
451 | if (ucpia->sbuf[0].urb) { | 451 | if (ucpia->sbuf[0].urb) { |
452 | usb_kill_urb(ucpia->sbuf[0].urb); | 452 | usb_kill_urb(ucpia->sbuf[0].urb); |
453 | usb_free_urb(ucpia->sbuf[0].urb); | 453 | usb_free_urb(ucpia->sbuf[0].urb); |
@@ -490,7 +490,7 @@ static int cpia_probe(struct usb_interface *intf, | |||
490 | struct usb_cpia *ucpia; | 490 | struct usb_cpia *ucpia; |
491 | struct cam_data *cam; | 491 | struct cam_data *cam; |
492 | int ret; | 492 | int ret; |
493 | 493 | ||
494 | /* A multi-config CPiA camera? */ | 494 | /* A multi-config CPiA camera? */ |
495 | if (udev->descriptor.bNumConfigurations != 1) | 495 | if (udev->descriptor.bNumConfigurations != 1) |
496 | return -ENODEV; | 496 | return -ENODEV; |
@@ -539,7 +539,7 @@ static int cpia_probe(struct usb_interface *intf, | |||
539 | 539 | ||
540 | /* Before register_camera, important */ | 540 | /* Before register_camera, important */ |
541 | ucpia->present = 1; | 541 | ucpia->present = 1; |
542 | 542 | ||
543 | cam = cpia_register_camera(&cpia_usb_ops, ucpia); | 543 | cam = cpia_register_camera(&cpia_usb_ops, ucpia); |
544 | if (!cam) { | 544 | if (!cam) { |
545 | LOG("failed to cpia_register_camera\n"); | 545 | LOG("failed to cpia_register_camera\n"); |
@@ -591,7 +591,7 @@ static void cpia_disconnect(struct usb_interface *intf) | |||
591 | struct cam_data *cam = usb_get_intfdata(intf); | 591 | struct cam_data *cam = usb_get_intfdata(intf); |
592 | struct usb_cpia *ucpia; | 592 | struct usb_cpia *ucpia; |
593 | struct usb_device *udev; | 593 | struct usb_device *udev; |
594 | 594 | ||
595 | usb_set_intfdata(intf, NULL); | 595 | usb_set_intfdata(intf, NULL); |
596 | if (!cam) | 596 | if (!cam) |
597 | return; | 597 | return; |
@@ -600,7 +600,7 @@ static void cpia_disconnect(struct usb_interface *intf) | |||
600 | spin_lock( &cam_list_lock_usb ); | 600 | spin_lock( &cam_list_lock_usb ); |
601 | list_del(&cam->cam_data_list); | 601 | list_del(&cam->cam_data_list); |
602 | spin_unlock( &cam_list_lock_usb ); | 602 | spin_unlock( &cam_list_lock_usb ); |
603 | 603 | ||
604 | ucpia->present = 0; | 604 | ucpia->present = 0; |
605 | 605 | ||
606 | cpia_unregister_camera(cam); | 606 | cpia_unregister_camera(cam); |
@@ -631,7 +631,7 @@ static void cpia_disconnect(struct usb_interface *intf) | |||
631 | 631 | ||
632 | static int __init usb_cpia_init(void) | 632 | static int __init usb_cpia_init(void) |
633 | { | 633 | { |
634 | printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, | 634 | printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, |
635 | CPIA_USB_MAJ_VER,CPIA_USB_MIN_VER,CPIA_USB_PATCH_VER); | 635 | CPIA_USB_MAJ_VER,CPIA_USB_MIN_VER,CPIA_USB_PATCH_VER); |
636 | 636 | ||
637 | spin_lock_init(&cam_list_lock_usb); | 637 | spin_lock_init(&cam_list_lock_usb); |
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index 8739c64785ef..de87247c74ee 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c | |||
@@ -59,25 +59,25 @@ static int cs53l32a_read(struct i2c_client *client, u8 reg) | |||
59 | static int cs53l32a_command(struct i2c_client *client, unsigned int cmd, | 59 | static int cs53l32a_command(struct i2c_client *client, unsigned int cmd, |
60 | void *arg) | 60 | void *arg) |
61 | { | 61 | { |
62 | struct v4l2_audio *input = arg; | 62 | struct v4l2_routing *route = arg; |
63 | struct v4l2_control *ctrl = arg; | 63 | struct v4l2_control *ctrl = arg; |
64 | 64 | ||
65 | switch (cmd) { | 65 | switch (cmd) { |
66 | case VIDIOC_S_AUDIO: | 66 | case VIDIOC_INT_G_AUDIO_ROUTING: |
67 | route->input = (cs53l32a_read(client, 0x01) >> 4) & 3; | ||
68 | route->output = 0; | ||
69 | break; | ||
70 | |||
71 | case VIDIOC_INT_S_AUDIO_ROUTING: | ||
67 | /* There are 2 physical inputs, but the second input can be | 72 | /* There are 2 physical inputs, but the second input can be |
68 | placed in two modes, the first mode bypasses the PGA (gain), | 73 | placed in two modes, the first mode bypasses the PGA (gain), |
69 | the second goes through the PGA. Hence there are three | 74 | the second goes through the PGA. Hence there are three |
70 | possible inputs to choose from. */ | 75 | possible inputs to choose from. */ |
71 | if (input->index > 2) { | 76 | if (route->input > 2) { |
72 | v4l_err(client, "Invalid input %d.\n", input->index); | 77 | v4l_err(client, "Invalid input %d.\n", route->input); |
73 | return -EINVAL; | 78 | return -EINVAL; |
74 | } | 79 | } |
75 | cs53l32a_write(client, 0x01, 0x01 + (input->index << 4)); | 80 | cs53l32a_write(client, 0x01, 0x01 + (route->input << 4)); |
76 | break; | ||
77 | |||
78 | case VIDIOC_G_AUDIO: | ||
79 | memset(input, 0, sizeof(*input)); | ||
80 | input->index = (cs53l32a_read(client, 0x01) >> 4) & 3; | ||
81 | break; | 81 | break; |
82 | 82 | ||
83 | case VIDIOC_G_CTRL: | 83 | case VIDIOC_G_CTRL: |
diff --git a/drivers/media/video/cs8420.h b/drivers/media/video/cs8420.h index 2b22f3a38de5..621c0c6678ea 100644 --- a/drivers/media/video/cs8420.h +++ b/drivers/media/video/cs8420.h | |||
@@ -20,7 +20,7 @@ | |||
20 | #define __CS8420_H__ | 20 | #define __CS8420_H__ |
21 | 21 | ||
22 | /* Initialization Sequence */ | 22 | /* Initialization Sequence */ |
23 | 23 | ||
24 | static __u8 init8420[] = { | 24 | static __u8 init8420[] = { |
25 | 1, 0x01, 2, 0x02, 3, 0x00, 4, 0x46, | 25 | 1, 0x01, 2, 0x02, 3, 0x00, 4, 0x46, |
26 | 5, 0x24, 6, 0x84, 18, 0x18, 19, 0x13, | 26 | 5, 0x24, 6, 0x84, 18, 0x18, 19, 0x13, |
diff --git a/drivers/media/video/cx25840/cx25840-audio.c b/drivers/media/video/cx25840/cx25840-audio.c index cb9a7981e408..a4540e858f21 100644 --- a/drivers/media/video/cx25840/cx25840-audio.c +++ b/drivers/media/video/cx25840/cx25840-audio.c | |||
@@ -18,7 +18,6 @@ | |||
18 | 18 | ||
19 | #include <linux/videodev2.h> | 19 | #include <linux/videodev2.h> |
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <media/audiochip.h> | ||
22 | #include <media/v4l2-common.h> | 21 | #include <media/v4l2-common.h> |
23 | 22 | ||
24 | #include "cx25840.h" | 23 | #include "cx25840.h" |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 8a257978056f..a65b3cc4bf03 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/videodev2.h> | 32 | #include <linux/videodev2.h> |
33 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
34 | #include <media/audiochip.h> | ||
35 | #include <media/v4l2-common.h> | 34 | #include <media/v4l2-common.h> |
36 | 35 | ||
37 | #include "cx25840.h" | 36 | #include "cx25840.h" |
@@ -176,9 +175,9 @@ static void cx25840_initialize(struct i2c_client *client, int loadfw) | |||
176 | cx25840_write(client, 0x4a5, 0x00); | 175 | cx25840_write(client, 0x4a5, 0x00); |
177 | cx25840_write(client, 0x402, 0x00); | 176 | cx25840_write(client, 0x402, 0x00); |
178 | /* 8. */ | 177 | /* 8. */ |
179 | cx25840_write(client, 0x401, 0x18); | 178 | cx25840_and_or(client, 0x401, ~0x18, 0); |
180 | cx25840_write(client, 0x4a2, 0x10); | 179 | cx25840_and_or(client, 0x4a2, ~0x10, 0x10); |
181 | cx25840_write(client, 0x402, 0x04); | 180 | /* steps 8c and 8d are done in change_input() */ |
182 | /* 10. */ | 181 | /* 10. */ |
183 | cx25840_write(client, 0x8d3, 0x1f); | 182 | cx25840_write(client, 0x8d3, 0x1f); |
184 | cx25840_write(client, 0x8e3, 0x03); | 183 | cx25840_write(client, 0x8e3, 0x03); |
@@ -209,6 +208,17 @@ static void input_change(struct i2c_client *client) | |||
209 | struct cx25840_state *state = i2c_get_clientdata(client); | 208 | struct cx25840_state *state = i2c_get_clientdata(client); |
210 | v4l2_std_id std = cx25840_get_v4lstd(client); | 209 | v4l2_std_id std = cx25840_get_v4lstd(client); |
211 | 210 | ||
211 | /* Follow step 8c and 8d of section 3.16 in the cx25840 datasheet */ | ||
212 | if (std & V4L2_STD_SECAM) { | ||
213 | cx25840_write(client, 0x402, 0); | ||
214 | } | ||
215 | else { | ||
216 | cx25840_write(client, 0x402, 0x04); | ||
217 | cx25840_write(client, 0x49f, (std & V4L2_STD_NTSC) ? 0x14 : 0x11); | ||
218 | } | ||
219 | cx25840_and_or(client, 0x401, ~0x60, 0); | ||
220 | cx25840_and_or(client, 0x401, ~0x60, 0x60); | ||
221 | |||
212 | /* Note: perhaps V4L2_STD_PAL_M should be handled as V4L2_STD_NTSC | 222 | /* Note: perhaps V4L2_STD_PAL_M should be handled as V4L2_STD_NTSC |
213 | instead of V4L2_STD_PAL. Someone needs to test this. */ | 223 | instead of V4L2_STD_PAL. Someone needs to test this. */ |
214 | if (std & V4L2_STD_PAL) { | 224 | if (std & V4L2_STD_PAL) { |
@@ -343,6 +353,15 @@ static int set_v4lstd(struct i2c_client *client, v4l2_std_id std) | |||
343 | } | 353 | } |
344 | } | 354 | } |
345 | 355 | ||
356 | /* Follow step 9 of section 3.16 in the cx25840 datasheet. | ||
357 | Without this PAL may display a vertical ghosting effect. | ||
358 | This happens for example with the Yuan MPC622. */ | ||
359 | if (fmt >= 4 && fmt < 8) { | ||
360 | /* Set format to NTSC-M */ | ||
361 | cx25840_and_or(client, 0x400, ~0xf, 1); | ||
362 | /* Turn off LCOMB */ | ||
363 | cx25840_and_or(client, 0x47b, ~6, 0); | ||
364 | } | ||
346 | cx25840_and_or(client, 0x400, ~0xf, fmt); | 365 | cx25840_and_or(client, 0x400, ~0xf, fmt); |
347 | cx25840_vbi_setup(client); | 366 | cx25840_vbi_setup(client); |
348 | return 0; | 367 | return 0; |
@@ -359,7 +378,14 @@ v4l2_std_id cx25840_get_v4lstd(struct i2c_client * client) | |||
359 | } | 378 | } |
360 | 379 | ||
361 | switch (fmt) { | 380 | switch (fmt) { |
362 | case 0x1: return V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR; | 381 | case 0x1: |
382 | { | ||
383 | /* if the audio std is A2-M, then this is the South Korean | ||
384 | NTSC standard */ | ||
385 | if (cx25840_read(client, 0x805) == 2) | ||
386 | return V4L2_STD_NTSC_M_KR; | ||
387 | return V4L2_STD_NTSC_M; | ||
388 | } | ||
363 | case 0x2: return V4L2_STD_NTSC_M_JP; | 389 | case 0x2: return V4L2_STD_NTSC_M_JP; |
364 | case 0x3: return V4L2_STD_NTSC_443; | 390 | case 0x3: return V4L2_STD_NTSC_443; |
365 | case 0x4: return V4L2_STD_PAL; | 391 | case 0x4: return V4L2_STD_PAL; |
@@ -737,16 +763,6 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
737 | return set_input(client, state->vid_input, input->index); | 763 | return set_input(client, state->vid_input, input->index); |
738 | } | 764 | } |
739 | 765 | ||
740 | case VIDIOC_G_AUDIO: | ||
741 | { | ||
742 | struct v4l2_audio *input = arg; | ||
743 | |||
744 | memset(input, 0, sizeof(*input)); | ||
745 | input->index = state->aud_input; | ||
746 | input->capability = V4L2_AUDCAP_STEREO; | ||
747 | break; | ||
748 | } | ||
749 | |||
750 | case VIDIOC_S_FREQUENCY: | 766 | case VIDIOC_S_FREQUENCY: |
751 | input_change(client); | 767 | input_change(client); |
752 | break; | 768 | break; |
@@ -794,13 +810,14 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
794 | bilingual -> lang1 */ | 810 | bilingual -> lang1 */ |
795 | cx25840_and_or(client, 0x809, ~0xf, 0x00); | 811 | cx25840_and_or(client, 0x809, ~0xf, 0x00); |
796 | break; | 812 | break; |
813 | case V4L2_TUNER_MODE_STEREO: | ||
797 | case V4L2_TUNER_MODE_LANG1: | 814 | case V4L2_TUNER_MODE_LANG1: |
798 | /* mono -> mono | 815 | /* mono -> mono |
799 | stereo -> stereo | 816 | stereo -> stereo |
800 | bilingual -> lang1 */ | 817 | bilingual -> lang1 */ |
801 | cx25840_and_or(client, 0x809, ~0xf, 0x04); | 818 | cx25840_and_or(client, 0x809, ~0xf, 0x04); |
802 | break; | 819 | break; |
803 | case V4L2_TUNER_MODE_STEREO: | 820 | case V4L2_TUNER_MODE_LANG1_LANG2: |
804 | /* mono -> mono | 821 | /* mono -> mono |
805 | stereo -> stereo | 822 | stereo -> stereo |
806 | bilingual -> lang1/lang2 */ | 823 | bilingual -> lang1/lang2 */ |
@@ -808,7 +825,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
808 | break; | 825 | break; |
809 | case V4L2_TUNER_MODE_LANG2: | 826 | case V4L2_TUNER_MODE_LANG2: |
810 | /* mono -> mono | 827 | /* mono -> mono |
811 | stereo ->stereo | 828 | stereo -> stereo |
812 | bilingual -> lang2 */ | 829 | bilingual -> lang2 */ |
813 | cx25840_and_or(client, 0x809, ~0xf, 0x01); | 830 | cx25840_and_or(client, 0x809, ~0xf, 0x01); |
814 | break; | 831 | break; |
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index e140996e6ee4..ff0f72340d69 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig | |||
@@ -16,12 +16,13 @@ config VIDEO_CX88 | |||
16 | module will be called cx8800 | 16 | module will be called cx8800 |
17 | 17 | ||
18 | config VIDEO_CX88_ALSA | 18 | config VIDEO_CX88_ALSA |
19 | tristate "ALSA DMA audio support" | 19 | tristate "Conexant 2388x DMA audio support" |
20 | depends on VIDEO_CX88 && SND && EXPERIMENTAL | 20 | depends on VIDEO_CX88 && SND && EXPERIMENTAL |
21 | select SND_PCM | 21 | select SND_PCM |
22 | ---help--- | 22 | ---help--- |
23 | This is a video4linux driver for direct (DMA) audio on | 23 | This is a video4linux driver for direct (DMA) audio on |
24 | Conexant 2388x based TV cards. | 24 | Conexant 2388x based TV cards using ALSA. |
25 | |||
25 | It only works with boards with function 01 enabled. | 26 | It only works with boards with function 01 enabled. |
26 | To check if your board supports, use lspci -n. | 27 | To check if your board supports, use lspci -n. |
27 | If supported, you should see 1471:8801 or 1471:8811 | 28 | If supported, you should see 1471:8801 or 1471:8811 |
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 3170b8f72c68..f9d87b86492c 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c | |||
@@ -303,7 +303,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip) | |||
303 | BUG_ON(!chip->dma_size); | 303 | BUG_ON(!chip->dma_size); |
304 | 304 | ||
305 | dprintk(2,"Freeing buffer\n"); | 305 | dprintk(2,"Freeing buffer\n"); |
306 | videobuf_dma_pci_unmap(chip->pci, &chip->dma_risc); | 306 | videobuf_pci_dma_unmap(chip->pci, &chip->dma_risc); |
307 | videobuf_dma_free(&chip->dma_risc); | 307 | videobuf_dma_free(&chip->dma_risc); |
308 | btcx_riscmem_free(chip->pci,&chip->buf->risc); | 308 | btcx_riscmem_free(chip->pci,&chip->buf->risc); |
309 | kfree(chip->buf); | 309 | kfree(chip->buf); |
@@ -429,7 +429,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, | |||
429 | videobuf_dma_init_kernel(&buf->vb.dma,PCI_DMA_FROMDEVICE, | 429 | videobuf_dma_init_kernel(&buf->vb.dma,PCI_DMA_FROMDEVICE, |
430 | (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); | 430 | (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); |
431 | 431 | ||
432 | videobuf_dma_pci_map(chip->pci,&buf->vb.dma); | 432 | videobuf_pci_dma_map(chip->pci,&buf->vb.dma); |
433 | 433 | ||
434 | 434 | ||
435 | cx88_risc_databuffer(chip->pci, &buf->risc, | 435 | cx88_risc_databuffer(chip->pci, &buf->risc, |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index a502a4d6e4ae..e100d8ef369a 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1341,7 +1341,7 @@ bb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
1341 | enum v4l2_field field) | 1341 | enum v4l2_field field) |
1342 | { | 1342 | { |
1343 | struct cx8802_fh *fh = q->priv_data; | 1343 | struct cx8802_fh *fh = q->priv_data; |
1344 | return cx8802_buf_prepare(fh->dev, (struct cx88_buffer*)vb, field); | 1344 | return cx8802_buf_prepare(q, fh->dev, (struct cx88_buffer*)vb, field); |
1345 | } | 1345 | } |
1346 | 1346 | ||
1347 | static void | 1347 | static void |
@@ -1354,8 +1354,7 @@ bb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1354 | static void | 1354 | static void |
1355 | bb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 1355 | bb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
1356 | { | 1356 | { |
1357 | struct cx8802_fh *fh = q->priv_data; | 1357 | cx88_free_buffer(q, (struct cx88_buffer*)vb); |
1358 | cx88_free_buffer(fh->dev->pci, (struct cx88_buffer*)vb); | ||
1359 | } | 1358 | } |
1360 | 1359 | ||
1361 | static struct videobuf_queue_ops blackbird_qops = { | 1360 | static struct videobuf_queue_ops blackbird_qops = { |
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index c2cdbafdb77b..2c3d9f1999be 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -213,13 +213,13 @@ int cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
213 | } | 213 | } |
214 | 214 | ||
215 | void | 215 | void |
216 | cx88_free_buffer(struct pci_dev *pci, struct cx88_buffer *buf) | 216 | cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf) |
217 | { | 217 | { |
218 | BUG_ON(in_interrupt()); | 218 | BUG_ON(in_interrupt()); |
219 | videobuf_waiton(&buf->vb,0,0); | 219 | videobuf_waiton(&buf->vb,0,0); |
220 | videobuf_dma_pci_unmap(pci, &buf->vb.dma); | 220 | videobuf_dma_unmap(q, &buf->vb.dma); |
221 | videobuf_dma_free(&buf->vb.dma); | 221 | videobuf_dma_free(&buf->vb.dma); |
222 | btcx_riscmem_free(pci, &buf->risc); | 222 | btcx_riscmem_free((struct pci_dev *)q->dev, &buf->risc); |
223 | buf->vb.state = STATE_NEEDS_INIT; | 223 | buf->vb.state = STATE_NEEDS_INIT; |
224 | } | 224 | } |
225 | 225 | ||
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index a9fc2695b157..f0ea9b5cdbc2 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -90,7 +90,7 @@ static int dvb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
90 | enum v4l2_field field) | 90 | enum v4l2_field field) |
91 | { | 91 | { |
92 | struct cx8802_dev *dev = q->priv_data; | 92 | struct cx8802_dev *dev = q->priv_data; |
93 | return cx8802_buf_prepare(dev, (struct cx88_buffer*)vb,field); | 93 | return cx8802_buf_prepare(q, dev, (struct cx88_buffer*)vb,field); |
94 | } | 94 | } |
95 | 95 | ||
96 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | 96 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) |
@@ -101,8 +101,7 @@ static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
101 | 101 | ||
102 | static void dvb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 102 | static void dvb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
103 | { | 103 | { |
104 | struct cx8802_dev *dev = q->priv_data; | 104 | cx88_free_buffer(q, (struct cx88_buffer*)vb); |
105 | cx88_free_buffer(dev->pci, (struct cx88_buffer*)vb); | ||
106 | } | 105 | } |
107 | 106 | ||
108 | static struct videobuf_queue_ops dvb_qops = { | 107 | static struct videobuf_queue_ops dvb_qops = { |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index c79cc1d2bf8b..7d16888b4a86 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -163,8 +163,8 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, | |||
163 | 163 | ||
164 | /* ------------------------------------------------------------------ */ | 164 | /* ------------------------------------------------------------------ */ |
165 | 165 | ||
166 | int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | 166 | int cx8802_buf_prepare(struct videobuf_queue *q, struct cx8802_dev *dev, |
167 | enum v4l2_field field) | 167 | struct cx88_buffer *buf, enum v4l2_field field) |
168 | { | 168 | { |
169 | int size = dev->ts_packet_size * dev->ts_packet_count; | 169 | int size = dev->ts_packet_size * dev->ts_packet_count; |
170 | int rc; | 170 | int rc; |
@@ -179,7 +179,7 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | |||
179 | buf->vb.size = size; | 179 | buf->vb.size = size; |
180 | buf->vb.field = field /*V4L2_FIELD_TOP*/; | 180 | buf->vb.field = field /*V4L2_FIELD_TOP*/; |
181 | 181 | ||
182 | if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) | 182 | if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) |
183 | goto fail; | 183 | goto fail; |
184 | cx88_risc_databuffer(dev->pci, &buf->risc, | 184 | cx88_risc_databuffer(dev->pci, &buf->risc, |
185 | buf->vb.dma.sglist, | 185 | buf->vb.dma.sglist, |
@@ -189,36 +189,36 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | |||
189 | return 0; | 189 | return 0; |
190 | 190 | ||
191 | fail: | 191 | fail: |
192 | cx88_free_buffer(dev->pci,buf); | 192 | cx88_free_buffer(q,buf); |
193 | return rc; | 193 | return rc; |
194 | } | 194 | } |
195 | 195 | ||
196 | void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) | 196 | void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) |
197 | { | 197 | { |
198 | struct cx88_buffer *prev; | 198 | struct cx88_buffer *prev; |
199 | struct cx88_dmaqueue *q = &dev->mpegq; | 199 | struct cx88_dmaqueue *cx88q = &dev->mpegq; |
200 | 200 | ||
201 | dprintk( 1, "cx8802_buf_queue\n" ); | 201 | dprintk( 1, "cx8802_buf_queue\n" ); |
202 | /* add jump to stopper */ | 202 | /* add jump to stopper */ |
203 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); | 203 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); |
204 | buf->risc.jmp[1] = cpu_to_le32(q->stopper.dma); | 204 | buf->risc.jmp[1] = cpu_to_le32(cx88q->stopper.dma); |
205 | 205 | ||
206 | if (list_empty(&q->active)) { | 206 | if (list_empty(&cx88q->active)) { |
207 | dprintk( 0, "queue is empty - first active\n" ); | 207 | dprintk( 0, "queue is empty - first active\n" ); |
208 | list_add_tail(&buf->vb.queue,&q->active); | 208 | list_add_tail(&buf->vb.queue,&cx88q->active); |
209 | cx8802_start_dma(dev, q, buf); | 209 | cx8802_start_dma(dev, cx88q, buf); |
210 | buf->vb.state = STATE_ACTIVE; | 210 | buf->vb.state = STATE_ACTIVE; |
211 | buf->count = q->count++; | 211 | buf->count = cx88q->count++; |
212 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 212 | mod_timer(&cx88q->timeout, jiffies+BUFFER_TIMEOUT); |
213 | dprintk(0,"[%p/%d] %s - first active\n", | 213 | dprintk(0,"[%p/%d] %s - first active\n", |
214 | buf, buf->vb.i, __FUNCTION__); | 214 | buf, buf->vb.i, __FUNCTION__); |
215 | 215 | ||
216 | } else { | 216 | } else { |
217 | dprintk( 1, "queue is not empty - append to active\n" ); | 217 | dprintk( 1, "queue is not empty - append to active\n" ); |
218 | prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); | 218 | prev = list_entry(cx88q->active.prev, struct cx88_buffer, vb.queue); |
219 | list_add_tail(&buf->vb.queue,&q->active); | 219 | list_add_tail(&buf->vb.queue,&cx88q->active); |
220 | buf->vb.state = STATE_ACTIVE; | 220 | buf->vb.state = STATE_ACTIVE; |
221 | buf->count = q->count++; | 221 | buf->count = cx88q->count++; |
222 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 222 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
223 | dprintk( 1, "[%p/%d] %s - append to active\n", | 223 | dprintk( 1, "[%p/%d] %s - append to active\n", |
224 | buf, buf->vb.i, __FUNCTION__); | 224 | buf, buf->vb.i, __FUNCTION__); |
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index da8d97ce0c4b..641a0c5a6490 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c | |||
@@ -885,6 +885,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) | |||
885 | set_audio_standard_BTSC(core, 1, EN_BTSC_FORCE_SAP); | 885 | set_audio_standard_BTSC(core, 1, EN_BTSC_FORCE_SAP); |
886 | break; | 886 | break; |
887 | case V4L2_TUNER_MODE_STEREO: | 887 | case V4L2_TUNER_MODE_STEREO: |
888 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
888 | set_audio_standard_BTSC(core, 0, EN_BTSC_FORCE_STEREO); | 889 | set_audio_standard_BTSC(core, 0, EN_BTSC_FORCE_STEREO); |
889 | break; | 890 | break; |
890 | } | 891 | } |
@@ -905,6 +906,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) | |||
905 | EN_NICAM_FORCE_MONO2); | 906 | EN_NICAM_FORCE_MONO2); |
906 | break; | 907 | break; |
907 | case V4L2_TUNER_MODE_STEREO: | 908 | case V4L2_TUNER_MODE_STEREO: |
909 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
908 | set_audio_standard_NICAM(core, | 910 | set_audio_standard_NICAM(core, |
909 | EN_NICAM_FORCE_STEREO); | 911 | EN_NICAM_FORCE_STEREO); |
910 | break; | 912 | break; |
@@ -926,6 +928,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) | |||
926 | EN_A2_FORCE_MONO2); | 928 | EN_A2_FORCE_MONO2); |
927 | break; | 929 | break; |
928 | case V4L2_TUNER_MODE_STEREO: | 930 | case V4L2_TUNER_MODE_STEREO: |
931 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
929 | set_audio_standard_A2(core, | 932 | set_audio_standard_A2(core, |
930 | EN_A2_FORCE_STEREO); | 933 | EN_A2_FORCE_STEREO); |
931 | break; | 934 | break; |
diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c index 9bc6c8995581..846faadc9f1c 100644 --- a/drivers/media/video/cx88/cx88-vbi.c +++ b/drivers/media/video/cx88/cx88-vbi.c | |||
@@ -175,7 +175,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
175 | buf->vb.size = size; | 175 | buf->vb.size = size; |
176 | buf->vb.field = V4L2_FIELD_SEQ_TB; | 176 | buf->vb.field = V4L2_FIELD_SEQ_TB; |
177 | 177 | ||
178 | if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) | 178 | if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) |
179 | goto fail; | 179 | goto fail; |
180 | cx88_risc_buffer(dev->pci, &buf->risc, | 180 | cx88_risc_buffer(dev->pci, &buf->risc, |
181 | buf->vb.dma.sglist, | 181 | buf->vb.dma.sglist, |
@@ -187,7 +187,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
187 | return 0; | 187 | return 0; |
188 | 188 | ||
189 | fail: | 189 | fail: |
190 | cx88_free_buffer(dev->pci,buf); | 190 | cx88_free_buffer(q,buf); |
191 | return rc; | 191 | return rc; |
192 | } | 192 | } |
193 | 193 | ||
@@ -227,9 +227,8 @@ vbi_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
227 | static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 227 | static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
228 | { | 228 | { |
229 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); | 229 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); |
230 | struct cx8800_fh *fh = q->priv_data; | ||
231 | 230 | ||
232 | cx88_free_buffer(fh->dev->pci,buf); | 231 | cx88_free_buffer(q,buf); |
233 | } | 232 | } |
234 | 233 | ||
235 | struct videobuf_queue_ops cx8800_vbi_qops = { | 234 | struct videobuf_queue_ops cx8800_vbi_qops = { |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 6c97aa740d27..72a417b31745 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -564,7 +564,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
564 | 564 | ||
565 | if (STATE_NEEDS_INIT == buf->vb.state) { | 565 | if (STATE_NEEDS_INIT == buf->vb.state) { |
566 | init_buffer = 1; | 566 | init_buffer = 1; |
567 | if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) | 567 | if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) |
568 | goto fail; | 568 | goto fail; |
569 | } | 569 | } |
570 | 570 | ||
@@ -614,7 +614,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
614 | return 0; | 614 | return 0; |
615 | 615 | ||
616 | fail: | 616 | fail: |
617 | cx88_free_buffer(dev->pci,buf); | 617 | cx88_free_buffer(q,buf); |
618 | return rc; | 618 | return rc; |
619 | } | 619 | } |
620 | 620 | ||
@@ -671,9 +671,8 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
671 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 671 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
672 | { | 672 | { |
673 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); | 673 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); |
674 | struct cx8800_fh *fh = q->priv_data; | ||
675 | 674 | ||
676 | cx88_free_buffer(fh->dev->pci,buf); | 675 | cx88_free_buffer(q,buf); |
677 | } | 676 | } |
678 | 677 | ||
679 | static struct videobuf_queue_ops cx8800_video_qops = { | 678 | static struct videobuf_queue_ops cx8800_video_qops = { |
@@ -1251,9 +1250,17 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1251 | { | 1250 | { |
1252 | int err; | 1251 | int err; |
1253 | 1252 | ||
1254 | dprintk(2, "CORE IOCTL: 0x%x\n", cmd ); | 1253 | if (video_debug) { |
1255 | if (video_debug > 1) | 1254 | if (video_debug > 1) { |
1256 | v4l_print_ioctl(core->name,cmd); | 1255 | if (_IOC_DIR(cmd) & _IOC_WRITE) |
1256 | v4l_printk_ioctl_arg("cx88(w)",cmd, arg); | ||
1257 | else if (!_IOC_DIR(cmd) & _IOC_READ) { | ||
1258 | v4l_print_ioctl("cx88", cmd); | ||
1259 | } | ||
1260 | } else | ||
1261 | v4l_print_ioctl(core->name,cmd); | ||
1262 | |||
1263 | } | ||
1257 | 1264 | ||
1258 | switch (cmd) { | 1265 | switch (cmd) { |
1259 | /* ---------- tv norms ---------- */ | 1266 | /* ---------- tv norms ---------- */ |
@@ -1460,7 +1467,19 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1460 | static int video_ioctl(struct inode *inode, struct file *file, | 1467 | static int video_ioctl(struct inode *inode, struct file *file, |
1461 | unsigned int cmd, unsigned long arg) | 1468 | unsigned int cmd, unsigned long arg) |
1462 | { | 1469 | { |
1463 | return video_usercopy(inode, file, cmd, arg, video_do_ioctl); | 1470 | int retval; |
1471 | |||
1472 | retval=video_usercopy(inode, file, cmd, arg, video_do_ioctl); | ||
1473 | |||
1474 | if (video_debug > 1) { | ||
1475 | if (retval < 0) { | ||
1476 | v4l_print_ioctl("cx88(err)", cmd); | ||
1477 | printk(KERN_DEBUG "cx88(err): errcode=%d\n",retval); | ||
1478 | } else if (_IOC_DIR(cmd) & _IOC_READ) | ||
1479 | v4l_printk_ioctl_arg("cx88(r)",cmd, (void *)arg); | ||
1480 | } | ||
1481 | |||
1482 | return retval; | ||
1464 | } | 1483 | } |
1465 | 1484 | ||
1466 | /* ----------------------------------------------------------- */ | 1485 | /* ----------------------------------------------------------- */ |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index cfa8668784b4..326a25f147f6 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | #include <media/tuner.h> | 28 | #include <media/tuner.h> |
29 | #include <media/tveeprom.h> | 29 | #include <media/tveeprom.h> |
30 | #include <media/audiochip.h> | ||
31 | #include <media/video-buf.h> | 30 | #include <media/video-buf.h> |
32 | #include <media/video-buf-dvb.h> | 31 | #include <media/video-buf-dvb.h> |
33 | 32 | ||
@@ -485,7 +484,7 @@ extern int | |||
485 | cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | 484 | cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, |
486 | u32 reg, u32 mask, u32 value); | 485 | u32 reg, u32 mask, u32 value); |
487 | extern void | 486 | extern void |
488 | cx88_free_buffer(struct pci_dev *pci, struct cx88_buffer *buf); | 487 | cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf); |
489 | 488 | ||
490 | extern void cx88_risc_disasm(struct cx88_core *core, | 489 | extern void cx88_risc_disasm(struct cx88_core *core, |
491 | struct btcx_riscmem *risc); | 490 | struct btcx_riscmem *risc); |
@@ -577,8 +576,8 @@ void cx88_ir_irq(struct cx88_core *core); | |||
577 | /* ----------------------------------------------------------- */ | 576 | /* ----------------------------------------------------------- */ |
578 | /* cx88-mpeg.c */ | 577 | /* cx88-mpeg.c */ |
579 | 578 | ||
580 | int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | 579 | int cx8802_buf_prepare(struct videobuf_queue *q,struct cx8802_dev *dev, |
581 | enum v4l2_field field); | 580 | struct cx88_buffer *buf, enum v4l2_field field); |
582 | void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf); | 581 | void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf); |
583 | void cx8802_cancel_buffers(struct cx8802_dev *dev); | 582 | void cx8802_cancel_buffers(struct cx8802_dev *dev); |
584 | 583 | ||
diff --git a/drivers/usb/media/dabfirmware.h b/drivers/media/video/dabfirmware.h index d14d803566a3..d14d803566a3 100644 --- a/drivers/usb/media/dabfirmware.h +++ b/drivers/media/video/dabfirmware.h | |||
diff --git a/drivers/usb/media/dabusb.c b/drivers/media/video/dabusb.c index 1774ab7a40d2..b9ba95f5e026 100644 --- a/drivers/usb/media/dabusb.c +++ b/drivers/media/video/dabusb.c | |||
@@ -86,7 +86,7 @@ static int dabusb_add_buf_tail (pdabusb_t s, struct list_head *dst, struct list_ | |||
86 | return ret; | 86 | return ret; |
87 | } | 87 | } |
88 | /*-------------------------------------------------------------------*/ | 88 | /*-------------------------------------------------------------------*/ |
89 | #ifdef DEBUG | 89 | #ifdef DEBUG |
90 | static void dump_urb (struct urb *urb) | 90 | static void dump_urb (struct urb *urb) |
91 | { | 91 | { |
92 | dbg("urb :%p", urb); | 92 | dbg("urb :%p", urb); |
@@ -136,7 +136,7 @@ static int dabusb_free_queue (struct list_head *q) | |||
136 | for (p = q->next; p != q;) { | 136 | for (p = q->next; p != q;) { |
137 | b = list_entry (p, buff_t, buff_list); | 137 | b = list_entry (p, buff_t, buff_list); |
138 | 138 | ||
139 | #ifdef DEBUG | 139 | #ifdef DEBUG |
140 | dump_urb(b->purb); | 140 | dump_urb(b->purb); |
141 | #endif | 141 | #endif |
142 | kfree(b->purb->transfer_buffer); | 142 | kfree(b->purb->transfer_buffer); |
@@ -287,7 +287,7 @@ static int dabusb_bulk (pdabusb_t s, pbulk_transfer_t pb) | |||
287 | } | 287 | } |
288 | 288 | ||
289 | } | 289 | } |
290 | 290 | ||
291 | if( ret == -EPIPE ) { | 291 | if( ret == -EPIPE ) { |
292 | warn("CLEAR_FEATURE request to remove STALL condition."); | 292 | warn("CLEAR_FEATURE request to remove STALL condition."); |
293 | if(usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe))) | 293 | if(usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe))) |
@@ -328,7 +328,7 @@ static int dabusb_loadmem (pdabusb_t s, const char *fname) | |||
328 | PINTEL_HEX_RECORD ptr = firmware; | 328 | PINTEL_HEX_RECORD ptr = firmware; |
329 | 329 | ||
330 | dbg("Enter dabusb_loadmem (internal)"); | 330 | dbg("Enter dabusb_loadmem (internal)"); |
331 | 331 | ||
332 | ret = dabusb_8051_reset (s, 1); | 332 | ret = dabusb_8051_reset (s, 1); |
333 | while (ptr->Type == 0) { | 333 | while (ptr->Type == 0) { |
334 | 334 | ||
@@ -449,7 +449,7 @@ static int dabusb_startrek (pdabusb_t s) | |||
449 | if (!list_empty (&s->free_buff_list)) { | 449 | if (!list_empty (&s->free_buff_list)) { |
450 | pbuff_t end; | 450 | pbuff_t end; |
451 | int ret; | 451 | int ret; |
452 | 452 | ||
453 | while (!dabusb_add_buf_tail (s, &s->rec_buff_list, &s->free_buff_list)) { | 453 | while (!dabusb_add_buf_tail (s, &s->rec_buff_list, &s->free_buff_list)) { |
454 | 454 | ||
455 | dbg("submitting: end:%p s->rec_buff_list:%p", s->rec_buff_list.prev, &s->rec_buff_list); | 455 | dbg("submitting: end:%p s->rec_buff_list:%p", s->rec_buff_list.prev, &s->rec_buff_list); |
@@ -506,7 +506,7 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l | |||
506 | err("error: rec_buf_list is empty"); | 506 | err("error: rec_buf_list is empty"); |
507 | goto err; | 507 | goto err; |
508 | } | 508 | } |
509 | 509 | ||
510 | b = list_entry (s->rec_buff_list.next, buff_t, buff_list); | 510 | b = list_entry (s->rec_buff_list.next, buff_t, buff_list); |
511 | purb = b->purb; | 511 | purb = b->purb; |
512 | 512 | ||
@@ -783,9 +783,9 @@ static void dabusb_disconnect (struct usb_interface *intf) | |||
783 | pdabusb_t s = usb_get_intfdata (intf); | 783 | pdabusb_t s = usb_get_intfdata (intf); |
784 | 784 | ||
785 | dbg("dabusb_disconnect"); | 785 | dbg("dabusb_disconnect"); |
786 | 786 | ||
787 | init_waitqueue_entry(&__wait, current); | 787 | init_waitqueue_entry(&__wait, current); |
788 | 788 | ||
789 | usb_set_intfdata (intf, NULL); | 789 | usb_set_intfdata (intf, NULL); |
790 | if (s) { | 790 | if (s) { |
791 | usb_deregister_dev (intf, &dabusb_class); | 791 | usb_deregister_dev (intf, &dabusb_class); |
@@ -797,7 +797,7 @@ static void dabusb_disconnect (struct usb_interface *intf) | |||
797 | schedule(); | 797 | schedule(); |
798 | current->state = TASK_RUNNING; | 798 | current->state = TASK_RUNNING; |
799 | remove_wait_queue(&s->remove_ok, &__wait); | 799 | remove_wait_queue(&s->remove_ok, &__wait); |
800 | 800 | ||
801 | s->usbdev = NULL; | 801 | s->usbdev = NULL; |
802 | s->overruns = 0; | 802 | s->overruns = 0; |
803 | } | 803 | } |
diff --git a/drivers/usb/media/dabusb.h b/drivers/media/video/dabusb.h index 96b03e4af8b9..00eb34c863eb 100644 --- a/drivers/usb/media/dabusb.h +++ b/drivers/media/video/dabusb.h | |||
@@ -10,7 +10,7 @@ typedef struct | |||
10 | #define DABUSB_VERSION 0x1000 | 10 | #define DABUSB_VERSION 0x1000 |
11 | #define IOCTL_DAB_BULK _IOWR('d', 0x30, bulk_transfer_t) | 11 | #define IOCTL_DAB_BULK _IOWR('d', 0x30, bulk_transfer_t) |
12 | #define IOCTL_DAB_OVERRUNS _IOR('d', 0x15, int) | 12 | #define IOCTL_DAB_OVERRUNS _IOR('d', 0x15, int) |
13 | #define IOCTL_DAB_VERSION _IOR('d', 0x3f, int) | 13 | #define IOCTL_DAB_VERSION _IOR('d', 0x3f, int) |
14 | 14 | ||
15 | #ifdef __KERNEL__ | 15 | #ifdef __KERNEL__ |
16 | 16 | ||
@@ -36,7 +36,7 @@ typedef struct | |||
36 | struct list_head rec_buff_list; | 36 | struct list_head rec_buff_list; |
37 | } dabusb_t,*pdabusb_t; | 37 | } dabusb_t,*pdabusb_t; |
38 | 38 | ||
39 | typedef struct | 39 | typedef struct |
40 | { | 40 | { |
41 | pdabusb_t s; | 41 | pdabusb_t s; |
42 | struct urb *purb; | 42 | struct urb *purb; |
diff --git a/drivers/usb/media/dsbr100.c b/drivers/media/video/dsbr100.c index 25646804d5be..3b4e9985c3d7 100644 --- a/drivers/usb/media/dsbr100.c +++ b/drivers/media/video/dsbr100.c | |||
@@ -37,28 +37,28 @@ | |||
37 | Markus: Updates for 2.6.x kernels, code layout changes, name sanitizing | 37 | Markus: Updates for 2.6.x kernels, code layout changes, name sanitizing |
38 | 38 | ||
39 | Version 0.30: | 39 | Version 0.30: |
40 | Markus: Updates for 2.5.x kernel and more ISO compliant source | 40 | Markus: Updates for 2.5.x kernel and more ISO compliant source |
41 | 41 | ||
42 | Version 0.25: | 42 | Version 0.25: |
43 | PSL and Markus: Cleanup, radio now doesn't stop on device close | 43 | PSL and Markus: Cleanup, radio now doesn't stop on device close |
44 | 44 | ||
45 | Version 0.24: | 45 | Version 0.24: |
46 | Markus: Hope I got these silly VIDEO_TUNER_LOW issues finally | 46 | Markus: Hope I got these silly VIDEO_TUNER_LOW issues finally |
47 | right. Some minor cleanup, improved standalone compilation | 47 | right. Some minor cleanup, improved standalone compilation |
48 | 48 | ||
49 | Version 0.23: | 49 | Version 0.23: |
50 | Markus: Sign extension bug fixed by declaring transfer_buffer unsigned | 50 | Markus: Sign extension bug fixed by declaring transfer_buffer unsigned |
51 | 51 | ||
52 | Version 0.22: | 52 | Version 0.22: |
53 | Markus: Some (brown bag) cleanup in what VIDIOCSTUNER returns, | 53 | Markus: Some (brown bag) cleanup in what VIDIOCSTUNER returns, |
54 | thanks to Mike Cox for pointing the problem out. | 54 | thanks to Mike Cox for pointing the problem out. |
55 | 55 | ||
56 | Version 0.21: | 56 | Version 0.21: |
57 | Markus: Minor cleanup, warnings if something goes wrong, lame attempt | 57 | Markus: Minor cleanup, warnings if something goes wrong, lame attempt |
58 | to adhere to Documentation/CodingStyle | 58 | to adhere to Documentation/CodingStyle |
59 | 59 | ||
60 | Version 0.2: | 60 | Version 0.2: |
61 | Brad Hards <bradh@dynamite.com.au>: Fixes to make it work as non-module | 61 | Brad Hards <bradh@dynamite.com.au>: Fixes to make it work as non-module |
62 | Markus: Copyright clarification | 62 | Markus: Copyright clarification |
63 | 63 | ||
64 | Version 0.01: Markus: initial release | 64 | Version 0.01: Markus: initial release |
@@ -163,11 +163,11 @@ static struct usb_driver usb_dsbr100_driver = { | |||
163 | static int dsbr100_start(dsbr100_device *radio) | 163 | static int dsbr100_start(dsbr100_device *radio) |
164 | { | 164 | { |
165 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 165 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
166 | USB_REQ_GET_STATUS, | 166 | USB_REQ_GET_STATUS, |
167 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 167 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
168 | 0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 || | 168 | 0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 || |
169 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 169 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
170 | DSB100_ONOFF, | 170 | DSB100_ONOFF, |
171 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 171 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
172 | 0x01, 0x00, radio->transfer_buffer, 8, 300)<0) | 172 | 0x01, 0x00, radio->transfer_buffer, 8, 300)<0) |
173 | return -1; | 173 | return -1; |
@@ -179,11 +179,11 @@ static int dsbr100_start(dsbr100_device *radio) | |||
179 | static int dsbr100_stop(dsbr100_device *radio) | 179 | static int dsbr100_stop(dsbr100_device *radio) |
180 | { | 180 | { |
181 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 181 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
182 | USB_REQ_GET_STATUS, | 182 | USB_REQ_GET_STATUS, |
183 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 183 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
184 | 0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 || | 184 | 0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 || |
185 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 185 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
186 | DSB100_ONOFF, | 186 | DSB100_ONOFF, |
187 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 187 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
188 | 0x00, 0x00, radio->transfer_buffer, 8, 300)<0) | 188 | 0x00, 0x00, radio->transfer_buffer, 8, 300)<0) |
189 | return -1; | 189 | return -1; |
@@ -195,16 +195,16 @@ static int dsbr100_setfreq(dsbr100_device *radio, int freq) | |||
195 | { | 195 | { |
196 | freq = (freq/16*80)/1000+856; | 196 | freq = (freq/16*80)/1000+856; |
197 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 197 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
198 | DSB100_TUNE, | 198 | DSB100_TUNE, |
199 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 199 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
200 | (freq>>8)&0x00ff, freq&0xff, | 200 | (freq>>8)&0x00ff, freq&0xff, |
201 | radio->transfer_buffer, 8, 300)<0 || | 201 | radio->transfer_buffer, 8, 300)<0 || |
202 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 202 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
203 | USB_REQ_GET_STATUS, | 203 | USB_REQ_GET_STATUS, |
204 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 204 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
205 | 0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 || | 205 | 0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 || |
206 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 206 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
207 | USB_REQ_GET_STATUS, | 207 | USB_REQ_GET_STATUS, |
208 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 208 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
209 | 0x00, 0x24, radio->transfer_buffer, 8, 300)<0) { | 209 | 0x00, 0x24, radio->transfer_buffer, 8, 300)<0) { |
210 | radio->stereo = -1; | 210 | radio->stereo = -1; |
@@ -219,7 +219,7 @@ sees a stereo signal or not. Pity. */ | |||
219 | static void dsbr100_getstat(dsbr100_device *radio) | 219 | static void dsbr100_getstat(dsbr100_device *radio) |
220 | { | 220 | { |
221 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 221 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
222 | USB_REQ_GET_STATUS, | 222 | USB_REQ_GET_STATUS, |
223 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 223 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
224 | 0x00 , 0x24, radio->transfer_buffer, 8, 300)<0) | 224 | 0x00 , 0x24, radio->transfer_buffer, 8, 300)<0) |
225 | radio->stereo = -1; | 225 | radio->stereo = -1; |
@@ -232,7 +232,7 @@ static void dsbr100_getstat(dsbr100_device *radio) | |||
232 | 232 | ||
233 | /* check if the device is present and register with v4l and | 233 | /* check if the device is present and register with v4l and |
234 | usb if it is */ | 234 | usb if it is */ |
235 | static int usb_dsbr100_probe(struct usb_interface *intf, | 235 | static int usb_dsbr100_probe(struct usb_interface *intf, |
236 | const struct usb_device_id *id) | 236 | const struct usb_device_id *id) |
237 | { | 237 | { |
238 | dsbr100_device *radio; | 238 | dsbr100_device *radio; |
@@ -243,7 +243,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf, | |||
243 | kfree(radio); | 243 | kfree(radio); |
244 | return -ENOMEM; | 244 | return -ENOMEM; |
245 | } | 245 | } |
246 | memcpy(radio->videodev, &dsbr100_videodev_template, | 246 | memcpy(radio->videodev, &dsbr100_videodev_template, |
247 | sizeof(dsbr100_videodev_template)); | 247 | sizeof(dsbr100_videodev_template)); |
248 | radio->removed = 0; | 248 | radio->removed = 0; |
249 | radio->users = 0; | 249 | radio->users = 0; |
@@ -310,7 +310,7 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, | |||
310 | struct video_tuner *v = arg; | 310 | struct video_tuner *v = arg; |
311 | 311 | ||
312 | dsbr100_getstat(radio); | 312 | dsbr100_getstat(radio); |
313 | if(v->tuner) /* Only 1 tuner */ | 313 | if(v->tuner) /* Only 1 tuner */ |
314 | return -EINVAL; | 314 | return -EINVAL; |
315 | v->rangelow = FREQ_MIN*FREQ_MUL; | 315 | v->rangelow = FREQ_MIN*FREQ_MUL; |
316 | v->rangehigh = FREQ_MAX*FREQ_MUL; | 316 | v->rangehigh = FREQ_MAX*FREQ_MUL; |
@@ -355,12 +355,12 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, | |||
355 | v->volume = 1; | 355 | v->volume = 1; |
356 | v->step = 1; | 356 | v->step = 1; |
357 | strcpy(v->name, "Radio"); | 357 | strcpy(v->name, "Radio"); |
358 | return 0; | 358 | return 0; |
359 | } | 359 | } |
360 | case VIDIOCSAUDIO: { | 360 | case VIDIOCSAUDIO: { |
361 | struct video_audio *v = arg; | 361 | struct video_audio *v = arg; |
362 | 362 | ||
363 | if (v->audio) | 363 | if (v->audio) |
364 | return -EINVAL; | 364 | return -EINVAL; |
365 | if (v->flags&VIDEO_AUDIO_MUTE) { | 365 | if (v->flags&VIDEO_AUDIO_MUTE) { |
366 | if (dsbr100_stop(radio)==-1) | 366 | if (dsbr100_stop(radio)==-1) |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 4e22fc4889e1..f62fd706b45a 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -28,10 +28,10 @@ | |||
28 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
29 | #include <linux/usb.h> | 29 | #include <linux/usb.h> |
30 | #include <media/tuner.h> | 30 | #include <media/tuner.h> |
31 | #include <media/audiochip.h> | 31 | #include <media/msp3400.h> |
32 | #include <media/tveeprom.h> | 32 | #include <media/tveeprom.h> |
33 | #include <media/audiochip.h> | ||
33 | #include <media/v4l2-common.h> | 34 | #include <media/v4l2-common.h> |
34 | #include "msp3400.h" | ||
35 | 35 | ||
36 | #include "em28xx.h" | 36 | #include "em28xx.h" |
37 | 37 | ||
@@ -147,11 +147,12 @@ struct em28xx_board em28xx_boards[] = { | |||
147 | .input = {{ | 147 | .input = {{ |
148 | .type = EM28XX_VMUX_TELEVISION, | 148 | .type = EM28XX_VMUX_TELEVISION, |
149 | .vmux = 0, | 149 | .vmux = 0, |
150 | .amux = 6, | 150 | .amux = MSP_INPUT_DEFAULT, |
151 | },{ | 151 | },{ |
152 | .type = EM28XX_VMUX_SVIDEO, | 152 | .type = EM28XX_VMUX_SVIDEO, |
153 | .vmux = 2, | 153 | .vmux = 2, |
154 | .amux = 1, | 154 | .amux = MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, |
155 | MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART), | ||
155 | }}, | 156 | }}, |
156 | }, | 157 | }, |
157 | [EM2820_BOARD_MSI_VOX_USB_2] = { | 158 | [EM2820_BOARD_MSI_VOX_USB_2] = { |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 780342f7b239..dfba33d0fa61 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "em28xx.h" | 38 | #include "em28xx.h" |
39 | #include <media/tuner.h> | 39 | #include <media/tuner.h> |
40 | #include <media/v4l2-common.h> | 40 | #include <media/v4l2-common.h> |
41 | #include <media/msp3400.h> | ||
41 | 42 | ||
42 | #define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \ | 43 | #define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \ |
43 | "Markus Rechberger <mrechberger@gmail.com>, " \ | 44 | "Markus Rechberger <mrechberger@gmail.com>, " \ |
@@ -216,9 +217,14 @@ static void video_mux(struct em28xx *dev, int index) | |||
216 | em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); | 217 | em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); |
217 | 218 | ||
218 | if (dev->has_msp34xx) { | 219 | if (dev->has_msp34xx) { |
220 | struct v4l2_routing route; | ||
221 | |||
219 | if (dev->i2s_speed) | 222 | if (dev->i2s_speed) |
220 | em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed); | 223 | em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed); |
221 | em28xx_i2c_call_clients(dev, VIDIOC_S_AUDIO, &dev->ctl_ainput); | 224 | route.input = dev->ctl_ainput; |
225 | route.output = MSP_OUTPUT(MSP_OUT_SCART1_DA); | ||
226 | /* Note: this is msp3400 specific */ | ||
227 | em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, &route); | ||
222 | ainput = EM28XX_AUDIO_SRC_TUNER; | 228 | ainput = EM28XX_AUDIO_SRC_TUNER; |
223 | em28xx_audio_source(dev, ainput); | 229 | em28xx_audio_source(dev, ainput); |
224 | } else { | 230 | } else { |
diff --git a/drivers/media/video/et61x251/Makefile b/drivers/media/video/et61x251/Makefile new file mode 100644 index 000000000000..2ff4db9ec882 --- /dev/null +++ b/drivers/media/video/et61x251/Makefile | |||
@@ -0,0 +1,4 @@ | |||
1 | et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o | ||
2 | |||
3 | obj-$(CONFIG_USB_ET61X251) += et61x251.o | ||
4 | |||
diff --git a/drivers/usb/media/et61x251.h b/drivers/media/video/et61x251/et61x251.h index eee8afc9be72..2e5ca4032489 100644 --- a/drivers/usb/media/et61x251.h +++ b/drivers/media/video/et61x251/et61x251.h | |||
@@ -180,7 +180,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id) | |||
180 | 180 | ||
181 | void | 181 | void |
182 | et61x251_attach_sensor(struct et61x251_device* cam, | 182 | et61x251_attach_sensor(struct et61x251_device* cam, |
183 | struct et61x251_sensor* sensor) | 183 | struct et61x251_sensor* sensor) |
184 | { | 184 | { |
185 | memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); | 185 | memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); |
186 | } | 186 | } |
@@ -199,7 +199,7 @@ do { \ | |||
199 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ | 199 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
200 | else if ((level) >= 3) \ | 200 | else if ((level) >= 3) \ |
201 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 201 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
202 | __FUNCTION__, __LINE__ , ## args); \ | 202 | __FUNCTION__, __LINE__ , ## args); \ |
203 | } \ | 203 | } \ |
204 | } while (0) | 204 | } while (0) |
205 | # define KDBG(level, fmt, args...) \ | 205 | # define KDBG(level, fmt, args...) \ |
@@ -209,7 +209,7 @@ do { \ | |||
209 | pr_info("et61x251: " fmt "\n", ## args); \ | 209 | pr_info("et61x251: " fmt "\n", ## args); \ |
210 | else if ((level) == 3) \ | 210 | else if ((level) == 3) \ |
211 | pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ | 211 | pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ |
212 | __LINE__ , ## args); \ | 212 | __LINE__ , ## args); \ |
213 | } \ | 213 | } \ |
214 | } while (0) | 214 | } while (0) |
215 | # define V4LDBG(level, name, cmd) \ | 215 | # define V4LDBG(level, name, cmd) \ |
@@ -226,7 +226,7 @@ do { \ | |||
226 | #undef PDBG | 226 | #undef PDBG |
227 | #define PDBG(fmt, args...) \ | 227 | #define PDBG(fmt, args...) \ |
228 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 228 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
229 | __FUNCTION__, __LINE__ , ## args) | 229 | __FUNCTION__, __LINE__ , ## args) |
230 | 230 | ||
231 | #undef PDBGG | 231 | #undef PDBGG |
232 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | 232 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |
diff --git a/drivers/usb/media/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index 7cc01b828b3d..dfc9dd732c9d 100644 --- a/drivers/usb/media/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c | |||
@@ -44,7 +44,7 @@ | |||
44 | /*****************************************************************************/ | 44 | /*****************************************************************************/ |
45 | 45 | ||
46 | #define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \ | 46 | #define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \ |
47 | "PC Camera Controllers" | 47 | "PC Camera Controllers" |
48 | #define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia" | 48 | #define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia" |
49 | #define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | 49 | #define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" |
50 | #define ET61X251_MODULE_LICENSE "GPL" | 50 | #define ET61X251_MODULE_LICENSE "GPL" |
@@ -63,68 +63,68 @@ MODULE_LICENSE(ET61X251_MODULE_LICENSE); | |||
63 | static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1}; | 63 | static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1}; |
64 | module_param_array(video_nr, short, NULL, 0444); | 64 | module_param_array(video_nr, short, NULL, 0444); |
65 | MODULE_PARM_DESC(video_nr, | 65 | MODULE_PARM_DESC(video_nr, |
66 | "\n<-1|n[,...]> Specify V4L2 minor mode number." | 66 | "\n<-1|n[,...]> Specify V4L2 minor mode number." |
67 | "\n -1 = use next available (default)" | 67 | "\n -1 = use next available (default)" |
68 | "\n n = use minor number n (integer >= 0)" | 68 | "\n n = use minor number n (integer >= 0)" |
69 | "\nYou can specify up to " | 69 | "\nYou can specify up to " |
70 | __MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way." | 70 | __MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way." |
71 | "\nFor example:" | 71 | "\nFor example:" |
72 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" | 72 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" |
73 | "\nthe second registered camera and use auto for the first" | 73 | "\nthe second registered camera and use auto for the first" |
74 | "\none and for every other camera." | 74 | "\none and for every other camera." |
75 | "\n"); | 75 | "\n"); |
76 | 76 | ||
77 | static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] = | 77 | static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] = |
78 | ET61X251_FORCE_MUNMAP}; | 78 | ET61X251_FORCE_MUNMAP}; |
79 | module_param_array(force_munmap, bool, NULL, 0444); | 79 | module_param_array(force_munmap, bool, NULL, 0444); |
80 | MODULE_PARM_DESC(force_munmap, | 80 | MODULE_PARM_DESC(force_munmap, |
81 | "\n<0|1[,...]> Force the application to unmap previously" | 81 | "\n<0|1[,...]> Force the application to unmap previously" |
82 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" | 82 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" |
83 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" | 83 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" |
84 | "\nthis feature. This parameter is specific for each" | 84 | "\nthis feature. This parameter is specific for each" |
85 | "\ndetected camera." | 85 | "\ndetected camera." |
86 | "\n 0 = do not force memory unmapping" | 86 | "\n 0 = do not force memory unmapping" |
87 | "\n 1 = force memory unmapping (save memory)" | 87 | "\n 1 = force memory unmapping (save memory)" |
88 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." | 88 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." |
89 | "\n"); | 89 | "\n"); |
90 | 90 | ||
91 | static unsigned int frame_timeout[] = {[0 ... ET61X251_MAX_DEVICES-1] = | 91 | static unsigned int frame_timeout[] = {[0 ... ET61X251_MAX_DEVICES-1] = |
92 | ET61X251_FRAME_TIMEOUT}; | 92 | ET61X251_FRAME_TIMEOUT}; |
93 | module_param_array(frame_timeout, uint, NULL, 0644); | 93 | module_param_array(frame_timeout, uint, NULL, 0644); |
94 | MODULE_PARM_DESC(frame_timeout, | 94 | MODULE_PARM_DESC(frame_timeout, |
95 | "\n<n[,...]> Timeout for a video frame in seconds." | 95 | "\n<n[,...]> Timeout for a video frame in seconds." |
96 | "\nThis parameter is specific for each detected camera." | 96 | "\nThis parameter is specific for each detected camera." |
97 | "\nDefault value is " | 97 | "\nDefault value is " |
98 | __MODULE_STRING(ET61X251_FRAME_TIMEOUT)"." | 98 | __MODULE_STRING(ET61X251_FRAME_TIMEOUT)"." |
99 | "\n"); | 99 | "\n"); |
100 | 100 | ||
101 | #ifdef ET61X251_DEBUG | 101 | #ifdef ET61X251_DEBUG |
102 | static unsigned short debug = ET61X251_DEBUG_LEVEL; | 102 | static unsigned short debug = ET61X251_DEBUG_LEVEL; |
103 | module_param(debug, ushort, 0644); | 103 | module_param(debug, ushort, 0644); |
104 | MODULE_PARM_DESC(debug, | 104 | MODULE_PARM_DESC(debug, |
105 | "\n<n> Debugging information level, from 0 to 3:" | 105 | "\n<n> Debugging information level, from 0 to 3:" |
106 | "\n0 = none (use carefully)" | 106 | "\n0 = none (use carefully)" |
107 | "\n1 = critical errors" | 107 | "\n1 = critical errors" |
108 | "\n2 = significant informations" | 108 | "\n2 = significant informations" |
109 | "\n3 = more verbose messages" | 109 | "\n3 = more verbose messages" |
110 | "\nLevel 3 is useful for testing only, when only " | 110 | "\nLevel 3 is useful for testing only, when only " |
111 | "one device is used." | 111 | "one device is used." |
112 | "\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"." | 112 | "\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"." |
113 | "\n"); | 113 | "\n"); |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | /*****************************************************************************/ | 116 | /*****************************************************************************/ |
117 | 117 | ||
118 | static u32 | 118 | static u32 |
119 | et61x251_request_buffers(struct et61x251_device* cam, u32 count, | 119 | et61x251_request_buffers(struct et61x251_device* cam, u32 count, |
120 | enum et61x251_io_method io) | 120 | enum et61x251_io_method io) |
121 | { | 121 | { |
122 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); | 122 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); |
123 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); | 123 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); |
124 | const size_t imagesize = cam->module_param.force_munmap || | 124 | const size_t imagesize = cam->module_param.force_munmap || |
125 | io == IO_READ ? | 125 | io == IO_READ ? |
126 | (p->width * p->height * p->priv) / 8 : | 126 | (p->width * p->height * p->priv) / 8 : |
127 | (r->width * r->height * p->priv) / 8; | 127 | (r->width * r->height * p->priv) / 8; |
128 | void* buff = NULL; | 128 | void* buff = NULL; |
129 | u32 i; | 129 | u32 i; |
130 | 130 | ||
@@ -216,7 +216,7 @@ int et61x251_write_reg(struct et61x251_device* cam, u8 value, u16 index) | |||
216 | *buff = value; | 216 | *buff = value; |
217 | 217 | ||
218 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 218 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
219 | 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); | 219 | 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); |
220 | if (res < 0) { | 220 | if (res < 0) { |
221 | DBG(3, "Failed to write a register (value 0x%02X, index " | 221 | DBG(3, "Failed to write a register (value 0x%02X, index " |
222 | "0x%02X, error %d)", value, index, res); | 222 | "0x%02X, error %d)", value, index, res); |
@@ -234,7 +234,7 @@ int et61x251_read_reg(struct et61x251_device* cam, u16 index) | |||
234 | int res; | 234 | int res; |
235 | 235 | ||
236 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, | 236 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, |
237 | 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); | 237 | 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); |
238 | if (res < 0) | 238 | if (res < 0) |
239 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", | 239 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", |
240 | index, res); | 240 | index, res); |
@@ -269,7 +269,7 @@ et61x251_i2c_wait(struct et61x251_device* cam, struct et61x251_sensor* sensor) | |||
269 | 269 | ||
270 | int | 270 | int |
271 | et61x251_i2c_try_read(struct et61x251_device* cam, | 271 | et61x251_i2c_try_read(struct et61x251_device* cam, |
272 | struct et61x251_sensor* sensor, u8 address) | 272 | struct et61x251_sensor* sensor, u8 address) |
273 | { | 273 | { |
274 | struct usb_device* udev = cam->usbdev; | 274 | struct usb_device* udev = cam->usbdev; |
275 | u8* data = cam->control_buffer; | 275 | u8* data = cam->control_buffer; |
@@ -280,14 +280,14 @@ et61x251_i2c_try_read(struct et61x251_device* cam, | |||
280 | data[2] = cam->sensor.rsta | 0x10; | 280 | data[2] = cam->sensor.rsta | 0x10; |
281 | data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02); | 281 | data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02); |
282 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 282 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
283 | 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT); | 283 | 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT); |
284 | if (res < 0) | 284 | if (res < 0) |
285 | err += res; | 285 | err += res; |
286 | 286 | ||
287 | err += et61x251_i2c_wait(cam, sensor); | 287 | err += et61x251_i2c_wait(cam, sensor); |
288 | 288 | ||
289 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, | 289 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, |
290 | 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT); | 290 | 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT); |
291 | if (res < 0) | 291 | if (res < 0) |
292 | err += res; | 292 | err += res; |
293 | 293 | ||
@@ -302,7 +302,7 @@ et61x251_i2c_try_read(struct et61x251_device* cam, | |||
302 | 302 | ||
303 | int | 303 | int |
304 | et61x251_i2c_try_write(struct et61x251_device* cam, | 304 | et61x251_i2c_try_write(struct et61x251_device* cam, |
305 | struct et61x251_sensor* sensor, u8 address, u8 value) | 305 | struct et61x251_sensor* sensor, u8 address, u8 value) |
306 | { | 306 | { |
307 | struct usb_device* udev = cam->usbdev; | 307 | struct usb_device* udev = cam->usbdev; |
308 | u8* data = cam->control_buffer; | 308 | u8* data = cam->control_buffer; |
@@ -312,13 +312,13 @@ et61x251_i2c_try_write(struct et61x251_device* cam, | |||
312 | data[1] = cam->sensor.i2c_slave_id; | 312 | data[1] = cam->sensor.i2c_slave_id; |
313 | data[2] = cam->sensor.rsta | 0x12; | 313 | data[2] = cam->sensor.rsta | 0x12; |
314 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 314 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
315 | 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); | 315 | 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); |
316 | if (res < 0) | 316 | if (res < 0) |
317 | err += res; | 317 | err += res; |
318 | 318 | ||
319 | data[0] = value; | 319 | data[0] = value; |
320 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 320 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
321 | 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); | 321 | 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); |
322 | if (res < 0) | 322 | if (res < 0) |
323 | err += res; | 323 | err += res; |
324 | 324 | ||
@@ -335,8 +335,8 @@ et61x251_i2c_try_write(struct et61x251_device* cam, | |||
335 | 335 | ||
336 | int | 336 | int |
337 | et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, | 337 | et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, |
338 | u8 data3, u8 data4, u8 data5, u8 data6, u8 data7, | 338 | u8 data3, u8 data4, u8 data5, u8 data6, u8 data7, |
339 | u8 data8, u8 address) | 339 | u8 data8, u8 address) |
340 | { | 340 | { |
341 | struct usb_device* udev = cam->usbdev; | 341 | struct usb_device* udev = cam->usbdev; |
342 | u8* data = cam->control_buffer; | 342 | u8* data = cam->control_buffer; |
@@ -350,7 +350,7 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, | |||
350 | data[5] = data7; | 350 | data[5] = data7; |
351 | data[6] = data8; | 351 | data[6] = data8; |
352 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 352 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
353 | 0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT); | 353 | 0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT); |
354 | if (res < 0) | 354 | if (res < 0) |
355 | err += res; | 355 | err += res; |
356 | 356 | ||
@@ -358,14 +358,14 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, | |||
358 | data[1] = cam->sensor.i2c_slave_id; | 358 | data[1] = cam->sensor.i2c_slave_id; |
359 | data[2] = cam->sensor.rsta | 0x02 | (n << 4); | 359 | data[2] = cam->sensor.rsta | 0x02 | (n << 4); |
360 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 360 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
361 | 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); | 361 | 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); |
362 | if (res < 0) | 362 | if (res < 0) |
363 | err += res; | 363 | err += res; |
364 | 364 | ||
365 | /* Start writing through the serial interface */ | 365 | /* Start writing through the serial interface */ |
366 | data[0] = data1; | 366 | data[0] = data1; |
367 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 367 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
368 | 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); | 368 | 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); |
369 | if (res < 0) | 369 | if (res < 0) |
370 | err += res; | 370 | err += res; |
371 | 371 | ||
@@ -432,11 +432,11 @@ static void et61x251_urb_complete(struct urb *urb, struct pt_regs* regs) | |||
432 | 432 | ||
433 | if (!(*f)) | 433 | if (!(*f)) |
434 | (*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t, | 434 | (*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t, |
435 | frame); | 435 | frame); |
436 | 436 | ||
437 | imagesize = (cam->sensor.pix_format.width * | 437 | imagesize = (cam->sensor.pix_format.width * |
438 | cam->sensor.pix_format.height * | 438 | cam->sensor.pix_format.height * |
439 | cam->sensor.pix_format.priv) / 8; | 439 | cam->sensor.pix_format.priv) / 8; |
440 | 440 | ||
441 | for (i = 0; i < urb->number_of_packets; i++) { | 441 | for (i = 0; i < urb->number_of_packets; i++) { |
442 | unsigned int len, status; | 442 | unsigned int len, status; |
@@ -476,7 +476,7 @@ start_of_frame: | |||
476 | if ((*f)->state == F_GRABBING) { | 476 | if ((*f)->state == F_GRABBING) { |
477 | if (sof && (*f)->buf.bytesused) { | 477 | if (sof && (*f)->buf.bytesused) { |
478 | if (cam->sensor.pix_format.pixelformat == | 478 | if (cam->sensor.pix_format.pixelformat == |
479 | V4L2_PIX_FMT_ET61X251) | 479 | V4L2_PIX_FMT_ET61X251) |
480 | goto end_of_frame; | 480 | goto end_of_frame; |
481 | else { | 481 | else { |
482 | DBG(3, "Not expected SOF detected " | 482 | DBG(3, "Not expected SOF detected " |
@@ -508,8 +508,8 @@ end_of_frame: | |||
508 | list_move_tail(&(*f)->frame, &cam->outqueue); | 508 | list_move_tail(&(*f)->frame, &cam->outqueue); |
509 | if (!list_empty(&cam->inqueue)) | 509 | if (!list_empty(&cam->inqueue)) |
510 | (*f) = list_entry(cam->inqueue.next, | 510 | (*f) = list_entry(cam->inqueue.next, |
511 | struct et61x251_frame_t, | 511 | struct et61x251_frame_t, |
512 | frame); | 512 | frame); |
513 | else | 513 | else |
514 | (*f) = NULL; | 514 | (*f) = NULL; |
515 | spin_unlock(&cam->queue_lock); | 515 | spin_unlock(&cam->queue_lock); |
@@ -521,7 +521,7 @@ end_of_frame: | |||
521 | 521 | ||
522 | if (sof && | 522 | if (sof && |
523 | cam->sensor.pix_format.pixelformat == | 523 | cam->sensor.pix_format.pixelformat == |
524 | V4L2_PIX_FMT_ET61X251) | 524 | V4L2_PIX_FMT_ET61X251) |
525 | goto start_of_frame; | 525 | goto start_of_frame; |
526 | } | 526 | } |
527 | } | 527 | } |
@@ -544,15 +544,15 @@ static int et61x251_start_transfer(struct et61x251_device* cam) | |||
544 | struct usb_device *udev = cam->usbdev; | 544 | struct usb_device *udev = cam->usbdev; |
545 | struct urb* urb; | 545 | struct urb* urb; |
546 | const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832, | 546 | const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832, |
547 | 864, 896, 920, 956, 980, 1000, | 547 | 864, 896, 920, 956, 980, 1000, |
548 | 1022}; | 548 | 1022}; |
549 | const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING]; | 549 | const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING]; |
550 | s8 i, j; | 550 | s8 i, j; |
551 | int err = 0; | 551 | int err = 0; |
552 | 552 | ||
553 | for (i = 0; i < ET61X251_URBS; i++) { | 553 | for (i = 0; i < ET61X251_URBS; i++) { |
554 | cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz, | 554 | cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz, |
555 | GFP_KERNEL); | 555 | GFP_KERNEL); |
556 | if (!cam->transfer_buffer[i]) { | 556 | if (!cam->transfer_buffer[i]) { |
557 | err = -ENOMEM; | 557 | err = -ENOMEM; |
558 | DBG(1, "Not enough memory"); | 558 | DBG(1, "Not enough memory"); |
@@ -653,9 +653,9 @@ static int et61x251_stream_interrupt(struct et61x251_device* cam) | |||
653 | 653 | ||
654 | cam->stream = STREAM_INTERRUPT; | 654 | cam->stream = STREAM_INTERRUPT; |
655 | timeout = wait_event_timeout(cam->wait_stream, | 655 | timeout = wait_event_timeout(cam->wait_stream, |
656 | (cam->stream == STREAM_OFF) || | 656 | (cam->stream == STREAM_OFF) || |
657 | (cam->state & DEV_DISCONNECTED), | 657 | (cam->state & DEV_DISCONNECTED), |
658 | ET61X251_URB_TIMEOUT); | 658 | ET61X251_URB_TIMEOUT); |
659 | if (cam->state & DEV_DISCONNECTED) | 659 | if (cam->state & DEV_DISCONNECTED) |
660 | return -ENODEV; | 660 | return -ENODEV; |
661 | else if (cam->stream != STREAM_OFF) { | 661 | else if (cam->stream != STREAM_OFF) { |
@@ -699,7 +699,7 @@ static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count) | |||
699 | 699 | ||
700 | /* | 700 | /* |
701 | NOTE 1: being inside one of the following methods implies that the v4l | 701 | NOTE 1: being inside one of the following methods implies that the v4l |
702 | device exists for sure (see kobjects and reference counters) | 702 | device exists for sure (see kobjects and reference counters) |
703 | NOTE 2: buffers are PAGE_SIZE long | 703 | NOTE 2: buffers are PAGE_SIZE long |
704 | */ | 704 | */ |
705 | 705 | ||
@@ -964,13 +964,13 @@ et61x251_store_i2c_val(struct class_device* cd, const char* buf, size_t len) | |||
964 | 964 | ||
965 | 965 | ||
966 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, | 966 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, |
967 | et61x251_show_reg, et61x251_store_reg); | 967 | et61x251_show_reg, et61x251_store_reg); |
968 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, | 968 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, |
969 | et61x251_show_val, et61x251_store_val); | 969 | et61x251_show_val, et61x251_store_val); |
970 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, | 970 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, |
971 | et61x251_show_i2c_reg, et61x251_store_i2c_reg); | 971 | et61x251_show_i2c_reg, et61x251_store_i2c_reg); |
972 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, | 972 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, |
973 | et61x251_show_i2c_val, et61x251_store_i2c_val); | 973 | et61x251_show_i2c_val, et61x251_store_i2c_val); |
974 | 974 | ||
975 | 975 | ||
976 | static void et61x251_create_sysfs(struct et61x251_device* cam) | 976 | static void et61x251_create_sysfs(struct et61x251_device* cam) |
@@ -990,7 +990,7 @@ static void et61x251_create_sysfs(struct et61x251_device* cam) | |||
990 | 990 | ||
991 | static int | 991 | static int |
992 | et61x251_set_pix_format(struct et61x251_device* cam, | 992 | et61x251_set_pix_format(struct et61x251_device* cam, |
993 | struct v4l2_pix_format* pix) | 993 | struct v4l2_pix_format* pix) |
994 | { | 994 | { |
995 | int r, err = 0; | 995 | int r, err = 0; |
996 | 996 | ||
@@ -1007,7 +1007,7 @@ et61x251_set_pix_format(struct et61x251_device* cam, | |||
1007 | 1007 | ||
1008 | static int | 1008 | static int |
1009 | et61x251_set_compression(struct et61x251_device* cam, | 1009 | et61x251_set_compression(struct et61x251_device* cam, |
1010 | struct v4l2_jpegcompression* compression) | 1010 | struct v4l2_jpegcompression* compression) |
1011 | { | 1011 | { |
1012 | int r, err = 0; | 1012 | int r, err = 0; |
1013 | 1013 | ||
@@ -1049,9 +1049,9 @@ et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect) | |||
1049 | { | 1049 | { |
1050 | struct et61x251_sensor* s = &cam->sensor; | 1050 | struct et61x251_sensor* s = &cam->sensor; |
1051 | u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left + | 1051 | u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left + |
1052 | s->active_pixel.left), | 1052 | s->active_pixel.left), |
1053 | fmw_sy = (u16)(rect->top - s->cropcap.bounds.top + | 1053 | fmw_sy = (u16)(rect->top - s->cropcap.bounds.top + |
1054 | s->active_pixel.top), | 1054 | s->active_pixel.top), |
1055 | fmw_length = (u16)(rect->width), | 1055 | fmw_length = (u16)(rect->width), |
1056 | fmw_height = (u16)(rect->height); | 1056 | fmw_height = (u16)(rect->height); |
1057 | int err = 0; | 1057 | int err = 0; |
@@ -1061,8 +1061,8 @@ et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect) | |||
1061 | err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b); | 1061 | err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b); |
1062 | err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c); | 1062 | err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c); |
1063 | err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6) | 1063 | err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6) |
1064 | | ((fmw_length & 0x300) >> 4) | 1064 | | ((fmw_length & 0x300) >> 4) |
1065 | | ((fmw_height & 0x300) >> 2), 0x6d); | 1065 | | ((fmw_height & 0x300) >> 2), 0x6d); |
1066 | if (err) | 1066 | if (err) |
1067 | return -EIO; | 1067 | return -EIO; |
1068 | 1068 | ||
@@ -1203,8 +1203,8 @@ static int et61x251_open(struct inode* inode, struct file* filp) | |||
1203 | } | 1203 | } |
1204 | mutex_unlock(&cam->dev_mutex); | 1204 | mutex_unlock(&cam->dev_mutex); |
1205 | err = wait_event_interruptible_exclusive(cam->open, | 1205 | err = wait_event_interruptible_exclusive(cam->open, |
1206 | cam->state & DEV_DISCONNECTED | 1206 | cam->state & DEV_DISCONNECTED |
1207 | || !cam->users); | 1207 | || !cam->users); |
1208 | if (err) { | 1208 | if (err) { |
1209 | up_read(&et61x251_disconnect); | 1209 | up_read(&et61x251_disconnect); |
1210 | return err; | 1210 | return err; |
@@ -1277,7 +1277,7 @@ static int et61x251_release(struct inode* inode, struct file* filp) | |||
1277 | 1277 | ||
1278 | static ssize_t | 1278 | static ssize_t |
1279 | et61x251_read(struct file* filp, char __user * buf, | 1279 | et61x251_read(struct file* filp, char __user * buf, |
1280 | size_t count, loff_t* f_pos) | 1280 | size_t count, loff_t* f_pos) |
1281 | { | 1281 | { |
1282 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | 1282 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); |
1283 | struct et61x251_frame_t* f, * i; | 1283 | struct et61x251_frame_t* f, * i; |
@@ -1310,7 +1310,7 @@ et61x251_read(struct file* filp, char __user * buf, | |||
1310 | 1310 | ||
1311 | if (cam->io == IO_NONE) { | 1311 | if (cam->io == IO_NONE) { |
1312 | if (!et61x251_request_buffers(cam, cam->nreadbuffers, | 1312 | if (!et61x251_request_buffers(cam, cam->nreadbuffers, |
1313 | IO_READ)) { | 1313 | IO_READ)) { |
1314 | DBG(1, "read() failed, not enough memory"); | 1314 | DBG(1, "read() failed, not enough memory"); |
1315 | mutex_unlock(&cam->fileop_mutex); | 1315 | mutex_unlock(&cam->fileop_mutex); |
1316 | return -ENOMEM; | 1316 | return -ENOMEM; |
@@ -1336,12 +1336,12 @@ et61x251_read(struct file* filp, char __user * buf, | |||
1336 | return -EAGAIN; | 1336 | return -EAGAIN; |
1337 | } | 1337 | } |
1338 | timeout = wait_event_interruptible_timeout | 1338 | timeout = wait_event_interruptible_timeout |
1339 | ( cam->wait_frame, | 1339 | ( cam->wait_frame, |
1340 | (!list_empty(&cam->outqueue)) || | 1340 | (!list_empty(&cam->outqueue)) || |
1341 | (cam->state & DEV_DISCONNECTED) || | 1341 | (cam->state & DEV_DISCONNECTED) || |
1342 | (cam->state & DEV_MISCONFIGURED), | 1342 | (cam->state & DEV_MISCONFIGURED), |
1343 | cam->module_param.frame_timeout * | 1343 | cam->module_param.frame_timeout * |
1344 | 1000 * msecs_to_jiffies(1) ); | 1344 | 1000 * msecs_to_jiffies(1) ); |
1345 | if (timeout < 0) { | 1345 | if (timeout < 0) { |
1346 | mutex_unlock(&cam->fileop_mutex); | 1346 | mutex_unlock(&cam->fileop_mutex); |
1347 | return timeout; | 1347 | return timeout; |
@@ -1408,7 +1408,7 @@ static unsigned int et61x251_poll(struct file *filp, poll_table *wait) | |||
1408 | 1408 | ||
1409 | if (cam->io == IO_NONE) { | 1409 | if (cam->io == IO_NONE) { |
1410 | if (!et61x251_request_buffers(cam, cam->nreadbuffers, | 1410 | if (!et61x251_request_buffers(cam, cam->nreadbuffers, |
1411 | IO_READ)) { | 1411 | IO_READ)) { |
1412 | DBG(1, "poll() failed, not enough memory"); | 1412 | DBG(1, "poll() failed, not enough memory"); |
1413 | goto error; | 1413 | goto error; |
1414 | } | 1414 | } |
@@ -1465,7 +1465,7 @@ static int et61x251_mmap(struct file* filp, struct vm_area_struct *vma) | |||
1465 | { | 1465 | { |
1466 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | 1466 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); |
1467 | unsigned long size = vma->vm_end - vma->vm_start, | 1467 | unsigned long size = vma->vm_end - vma->vm_start, |
1468 | start = vma->vm_start; | 1468 | start = vma->vm_start; |
1469 | void *pos; | 1469 | void *pos; |
1470 | u32 i; | 1470 | u32 i; |
1471 | 1471 | ||
@@ -1533,13 +1533,13 @@ et61x251_vidioc_querycap(struct et61x251_device* cam, void __user * arg) | |||
1533 | .driver = "et61x251", | 1533 | .driver = "et61x251", |
1534 | .version = ET61X251_MODULE_VERSION_CODE, | 1534 | .version = ET61X251_MODULE_VERSION_CODE, |
1535 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | | 1535 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
1536 | V4L2_CAP_STREAMING, | 1536 | V4L2_CAP_STREAMING, |
1537 | }; | 1537 | }; |
1538 | 1538 | ||
1539 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); | 1539 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); |
1540 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) | 1540 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) |
1541 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, | 1541 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, |
1542 | sizeof(cap.bus_info)); | 1542 | sizeof(cap.bus_info)); |
1543 | 1543 | ||
1544 | if (copy_to_user(arg, &cap, sizeof(cap))) | 1544 | if (copy_to_user(arg, &cap, sizeof(cap))) |
1545 | return -EFAULT; | 1545 | return -EFAULT; |
@@ -1871,7 +1871,7 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg) | |||
1871 | return -EINVAL; | 1871 | return -EINVAL; |
1872 | 1872 | ||
1873 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251) | 1873 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251) |
1874 | ? 0 : (pfmt->width * pfmt->priv) / 8; | 1874 | ? 0 : (pfmt->width * pfmt->priv) / 8; |
1875 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); | 1875 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); |
1876 | pfmt->field = V4L2_FIELD_NONE; | 1876 | pfmt->field = V4L2_FIELD_NONE; |
1877 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); | 1877 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); |
@@ -1885,7 +1885,7 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg) | |||
1885 | 1885 | ||
1886 | static int | 1886 | static int |
1887 | et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, | 1887 | et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, |
1888 | void __user * arg) | 1888 | void __user * arg) |
1889 | { | 1889 | { |
1890 | struct et61x251_sensor* s = &cam->sensor; | 1890 | struct et61x251_sensor* s = &cam->sensor; |
1891 | struct v4l2_format format; | 1891 | struct v4l2_format format; |
@@ -1947,7 +1947,7 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, | |||
1947 | pix->priv = pfmt->priv; /* bpp */ | 1947 | pix->priv = pfmt->priv; /* bpp */ |
1948 | pix->colorspace = pfmt->colorspace; | 1948 | pix->colorspace = pfmt->colorspace; |
1949 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) | 1949 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) |
1950 | ? 0 : (pix->width * pix->priv) / 8; | 1950 | ? 0 : (pix->width * pix->priv) / 8; |
1951 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); | 1951 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); |
1952 | pix->field = V4L2_FIELD_NONE; | 1952 | pix->field = V4L2_FIELD_NONE; |
1953 | 1953 | ||
@@ -2020,7 +2020,7 @@ static int | |||
2020 | et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg) | 2020 | et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg) |
2021 | { | 2021 | { |
2022 | if (copy_to_user(arg, &cam->compression, | 2022 | if (copy_to_user(arg, &cam->compression, |
2023 | sizeof(cam->compression))) | 2023 | sizeof(cam->compression))) |
2024 | return -EFAULT; | 2024 | return -EFAULT; |
2025 | 2025 | ||
2026 | return 0; | 2026 | return 0; |
@@ -2169,7 +2169,7 @@ et61x251_vidioc_qbuf(struct et61x251_device* cam, void __user * arg) | |||
2169 | 2169 | ||
2170 | static int | 2170 | static int |
2171 | et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, | 2171 | et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, |
2172 | void __user * arg) | 2172 | void __user * arg) |
2173 | { | 2173 | { |
2174 | struct v4l2_buffer b; | 2174 | struct v4l2_buffer b; |
2175 | struct et61x251_frame_t *f; | 2175 | struct et61x251_frame_t *f; |
@@ -2188,12 +2188,12 @@ et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, | |||
2188 | if (filp->f_flags & O_NONBLOCK) | 2188 | if (filp->f_flags & O_NONBLOCK) |
2189 | return -EAGAIN; | 2189 | return -EAGAIN; |
2190 | timeout = wait_event_interruptible_timeout | 2190 | timeout = wait_event_interruptible_timeout |
2191 | ( cam->wait_frame, | 2191 | ( cam->wait_frame, |
2192 | (!list_empty(&cam->outqueue)) || | 2192 | (!list_empty(&cam->outqueue)) || |
2193 | (cam->state & DEV_DISCONNECTED) || | 2193 | (cam->state & DEV_DISCONNECTED) || |
2194 | (cam->state & DEV_MISCONFIGURED), | 2194 | (cam->state & DEV_MISCONFIGURED), |
2195 | cam->module_param.frame_timeout * | 2195 | cam->module_param.frame_timeout * |
2196 | 1000 * msecs_to_jiffies(1) ); | 2196 | 1000 * msecs_to_jiffies(1) ); |
2197 | if (timeout < 0) | 2197 | if (timeout < 0) |
2198 | return timeout; | 2198 | return timeout; |
2199 | if (cam->state & DEV_DISCONNECTED) | 2199 | if (cam->state & DEV_DISCONNECTED) |
@@ -2317,7 +2317,7 @@ et61x251_vidioc_s_parm(struct et61x251_device* cam, void __user * arg) | |||
2317 | 2317 | ||
2318 | 2318 | ||
2319 | static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, | 2319 | static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, |
2320 | unsigned int cmd, void __user * arg) | 2320 | unsigned int cmd, void __user * arg) |
2321 | { | 2321 | { |
2322 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | 2322 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); |
2323 | 2323 | ||
@@ -2411,7 +2411,7 @@ static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, | |||
2411 | 2411 | ||
2412 | 2412 | ||
2413 | static int et61x251_ioctl(struct inode* inode, struct file* filp, | 2413 | static int et61x251_ioctl(struct inode* inode, struct file* filp, |
2414 | unsigned int cmd, unsigned long arg) | 2414 | unsigned int cmd, unsigned long arg) |
2415 | { | 2415 | { |
2416 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | 2416 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); |
2417 | int err = 0; | 2417 | int err = 0; |
@@ -2518,7 +2518,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2518 | mutex_lock(&cam->dev_mutex); | 2518 | mutex_lock(&cam->dev_mutex); |
2519 | 2519 | ||
2520 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 2520 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
2521 | video_nr[dev_nr]); | 2521 | video_nr[dev_nr]); |
2522 | if (err) { | 2522 | if (err) { |
2523 | DBG(1, "V4L2 device registration failed"); | 2523 | DBG(1, "V4L2 device registration failed"); |
2524 | if (err == -ENFILE && video_nr[dev_nr] == -1) | 2524 | if (err == -ENFILE && video_nr[dev_nr] == -1) |
diff --git a/drivers/usb/media/et61x251_sensor.h b/drivers/media/video/et61x251/et61x251_sensor.h index 56841ae8a207..65edd08dc386 100644 --- a/drivers/usb/media/et61x251_sensor.h +++ b/drivers/media/video/et61x251/et61x251_sensor.h | |||
@@ -47,7 +47,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id); | |||
47 | 47 | ||
48 | extern void | 48 | extern void |
49 | et61x251_attach_sensor(struct et61x251_device* cam, | 49 | et61x251_attach_sensor(struct et61x251_device* cam, |
50 | struct et61x251_sensor* sensor); | 50 | struct et61x251_sensor* sensor); |
51 | 51 | ||
52 | /*****************************************************************************/ | 52 | /*****************************************************************************/ |
53 | 53 | ||
@@ -56,13 +56,13 @@ extern int et61x251_read_reg(struct et61x251_device*, u16 index); | |||
56 | extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value); | 56 | extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value); |
57 | extern int et61x251_i2c_read(struct et61x251_device*, u8 address); | 57 | extern int et61x251_i2c_read(struct et61x251_device*, u8 address); |
58 | extern int et61x251_i2c_try_write(struct et61x251_device*, | 58 | extern int et61x251_i2c_try_write(struct et61x251_device*, |
59 | struct et61x251_sensor*, u8 address, | 59 | struct et61x251_sensor*, u8 address, |
60 | u8 value); | 60 | u8 value); |
61 | extern int et61x251_i2c_try_read(struct et61x251_device*, | 61 | extern int et61x251_i2c_try_read(struct et61x251_device*, |
62 | struct et61x251_sensor*, u8 address); | 62 | struct et61x251_sensor*, u8 address); |
63 | extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1, | 63 | extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1, |
64 | u8 data2, u8 data3, u8 data4, u8 data5, | 64 | u8 data2, u8 data3, u8 data4, u8 data5, |
65 | u8 data6, u8 data7, u8 data8, u8 address); | 65 | u8 data6, u8 data7, u8 data8, u8 address); |
66 | 66 | ||
67 | /*****************************************************************************/ | 67 | /*****************************************************************************/ |
68 | 68 | ||
@@ -100,13 +100,13 @@ struct et61x251_sensor { | |||
100 | 100 | ||
101 | int (*init)(struct et61x251_device* cam); | 101 | int (*init)(struct et61x251_device* cam); |
102 | int (*get_ctrl)(struct et61x251_device* cam, | 102 | int (*get_ctrl)(struct et61x251_device* cam, |
103 | struct v4l2_control* ctrl); | 103 | struct v4l2_control* ctrl); |
104 | int (*set_ctrl)(struct et61x251_device* cam, | 104 | int (*set_ctrl)(struct et61x251_device* cam, |
105 | const struct v4l2_control* ctrl); | 105 | const struct v4l2_control* ctrl); |
106 | int (*set_crop)(struct et61x251_device* cam, | 106 | int (*set_crop)(struct et61x251_device* cam, |
107 | const struct v4l2_rect* rect); | 107 | const struct v4l2_rect* rect); |
108 | int (*set_pix_format)(struct et61x251_device* cam, | 108 | int (*set_pix_format)(struct et61x251_device* cam, |
109 | const struct v4l2_pix_format* pix); | 109 | const struct v4l2_pix_format* pix); |
110 | 110 | ||
111 | /* Private */ | 111 | /* Private */ |
112 | struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS]; | 112 | struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS]; |
diff --git a/drivers/usb/media/et61x251_tas5130d1b.c b/drivers/media/video/et61x251/et61x251_tas5130d1b.c index 3998d76a307a..a7d65b82b2fb 100644 --- a/drivers/usb/media/et61x251_tas5130d1b.c +++ b/drivers/media/video/et61x251/et61x251_tas5130d1b.c | |||
@@ -46,20 +46,20 @@ static int tas5130d1b_init(struct et61x251_device* cam) | |||
46 | 46 | ||
47 | 47 | ||
48 | static int tas5130d1b_set_ctrl(struct et61x251_device* cam, | 48 | static int tas5130d1b_set_ctrl(struct et61x251_device* cam, |
49 | const struct v4l2_control* ctrl) | 49 | const struct v4l2_control* ctrl) |
50 | { | 50 | { |
51 | int err = 0; | 51 | int err = 0; |
52 | 52 | ||
53 | switch (ctrl->id) { | 53 | switch (ctrl->id) { |
54 | case V4L2_CID_GAIN: | 54 | case V4L2_CID_GAIN: |
55 | err += et61x251_i2c_raw_write(cam, 2, 0x20, | 55 | err += et61x251_i2c_raw_write(cam, 2, 0x20, |
56 | 0xf6-ctrl->value, 0, 0, 0, | 56 | 0xf6-ctrl->value, 0, 0, 0, |
57 | 0, 0, 0, 0); | 57 | 0, 0, 0, 0); |
58 | break; | 58 | break; |
59 | case V4L2_CID_EXPOSURE: | 59 | case V4L2_CID_EXPOSURE: |
60 | err += et61x251_i2c_raw_write(cam, 2, 0x40, | 60 | err += et61x251_i2c_raw_write(cam, 2, 0x40, |
61 | 0x47-ctrl->value, 0, 0, 0, | 61 | 0x47-ctrl->value, 0, 0, 0, |
62 | 0, 0, 0, 0); | 62 | 0, 0, 0, 0); |
63 | break; | 63 | break; |
64 | default: | 64 | default: |
65 | return -EINVAL; | 65 | return -EINVAL; |
diff --git a/drivers/media/video/font.h b/drivers/media/video/font.h new file mode 100644 index 000000000000..8b1fecc37599 --- /dev/null +++ b/drivers/media/video/font.h | |||
@@ -0,0 +1,407 @@ | |||
1 | static unsigned char rom8x16_bits[] = { | ||
2 | /* Character 0 (0x30): | ||
3 | ht=16, width=8 | ||
4 | +--------+ | ||
5 | | | | ||
6 | | | | ||
7 | | ***** | | ||
8 | |** ** | | ||
9 | |** ** | | ||
10 | |** *** | | ||
11 | |** **** | | ||
12 | |**** ** | | ||
13 | |*** ** | | ||
14 | |** ** | | ||
15 | |** ** | | ||
16 | | ***** | | ||
17 | | | | ||
18 | | | | ||
19 | | | | ||
20 | | | | ||
21 | +--------+ */ | ||
22 | 0x00, | ||
23 | 0x00, | ||
24 | 0x7c, | ||
25 | 0xc6, | ||
26 | 0xc6, | ||
27 | 0xce, | ||
28 | 0xde, | ||
29 | 0xf6, | ||
30 | 0xe6, | ||
31 | 0xc6, | ||
32 | 0xc6, | ||
33 | 0x7c, | ||
34 | 0x00, | ||
35 | 0x00, | ||
36 | 0x00, | ||
37 | 0x00, | ||
38 | |||
39 | /* Character 1 (0x31): | ||
40 | ht=16, width=8 | ||
41 | +--------+ | ||
42 | | | | ||
43 | | | | ||
44 | | ** | | ||
45 | | **** | | ||
46 | | ** | | ||
47 | | ** | | ||
48 | | ** | | ||
49 | | ** | | ||
50 | | ** | | ||
51 | | ** | | ||
52 | | ** | | ||
53 | | ****** | | ||
54 | | | | ||
55 | | | | ||
56 | | | | ||
57 | | | | ||
58 | +--------+ */ | ||
59 | 0x00, | ||
60 | 0x00, | ||
61 | 0x18, | ||
62 | 0x78, | ||
63 | 0x18, | ||
64 | 0x18, | ||
65 | 0x18, | ||
66 | 0x18, | ||
67 | 0x18, | ||
68 | 0x18, | ||
69 | 0x18, | ||
70 | 0x7e, | ||
71 | 0x00, | ||
72 | 0x00, | ||
73 | 0x00, | ||
74 | 0x00, | ||
75 | |||
76 | /* Character 2 (0x32): | ||
77 | ht=16, width=8 | ||
78 | +--------+ | ||
79 | | | | ||
80 | | | | ||
81 | | ***** | | ||
82 | |** ** | | ||
83 | |** ** | | ||
84 | | ** | | ||
85 | | ** | | ||
86 | | ** | | ||
87 | | ** | | ||
88 | | ** | | ||
89 | |** ** | | ||
90 | |******* | | ||
91 | | | | ||
92 | | | | ||
93 | | | | ||
94 | | | | ||
95 | +--------+ */ | ||
96 | 0x00, | ||
97 | 0x00, | ||
98 | 0x7c, | ||
99 | 0xc6, | ||
100 | 0xc6, | ||
101 | 0x06, | ||
102 | 0x0c, | ||
103 | 0x18, | ||
104 | 0x30, | ||
105 | 0x60, | ||
106 | 0xc6, | ||
107 | 0xfe, | ||
108 | 0x00, | ||
109 | 0x00, | ||
110 | 0x00, | ||
111 | 0x00, | ||
112 | |||
113 | /* Character 3 (0x33): | ||
114 | ht=16, width=8 | ||
115 | +--------+ | ||
116 | | | | ||
117 | | | | ||
118 | | ***** | | ||
119 | |** ** | | ||
120 | | ** | | ||
121 | | ** | | ||
122 | | **** | | ||
123 | | ** | | ||
124 | | ** | | ||
125 | | ** | | ||
126 | |** ** | | ||
127 | | ***** | | ||
128 | | | | ||
129 | | | | ||
130 | | | | ||
131 | | | | ||
132 | +--------+ */ | ||
133 | 0x00, | ||
134 | 0x00, | ||
135 | 0x7c, | ||
136 | 0xc6, | ||
137 | 0x06, | ||
138 | 0x06, | ||
139 | 0x3c, | ||
140 | 0x06, | ||
141 | 0x06, | ||
142 | 0x06, | ||
143 | 0xc6, | ||
144 | 0x7c, | ||
145 | 0x00, | ||
146 | 0x00, | ||
147 | 0x00, | ||
148 | 0x00, | ||
149 | |||
150 | /* Character 4 (0x34): | ||
151 | ht=16, width=8 | ||
152 | +--------+ | ||
153 | | | | ||
154 | | | | ||
155 | | ** | | ||
156 | | *** | | ||
157 | | **** | | ||
158 | | ** ** | | ||
159 | |** ** | | ||
160 | |** ** | | ||
161 | |******* | | ||
162 | | ** | | ||
163 | | ** | | ||
164 | | **** | | ||
165 | | | | ||
166 | | | | ||
167 | | | | ||
168 | | | | ||
169 | +--------+ */ | ||
170 | 0x00, | ||
171 | 0x00, | ||
172 | 0x0c, | ||
173 | 0x1c, | ||
174 | 0x3c, | ||
175 | 0x6c, | ||
176 | 0xcc, | ||
177 | 0xcc, | ||
178 | 0xfe, | ||
179 | 0x0c, | ||
180 | 0x0c, | ||
181 | 0x1e, | ||
182 | 0x00, | ||
183 | 0x00, | ||
184 | 0x00, | ||
185 | 0x00, | ||
186 | |||
187 | /* Character 5 (0x35): | ||
188 | ht=16, width=8 | ||
189 | +--------+ | ||
190 | | | | ||
191 | | | | ||
192 | |******* | | ||
193 | |** | | ||
194 | |** | | ||
195 | |** | | ||
196 | |****** | | ||
197 | | ** | | ||
198 | | ** | | ||
199 | | ** | | ||
200 | |** ** | | ||
201 | | ***** | | ||
202 | | | | ||
203 | | | | ||
204 | | | | ||
205 | | | | ||
206 | +--------+ */ | ||
207 | 0x00, | ||
208 | 0x00, | ||
209 | 0xfe, | ||
210 | 0xc0, | ||
211 | 0xc0, | ||
212 | 0xc0, | ||
213 | 0xfc, | ||
214 | 0x06, | ||
215 | 0x06, | ||
216 | 0x06, | ||
217 | 0xc6, | ||
218 | 0x7c, | ||
219 | 0x00, | ||
220 | 0x00, | ||
221 | 0x00, | ||
222 | 0x00, | ||
223 | |||
224 | /* Character 6 (0x36): | ||
225 | ht=16, width=8 | ||
226 | +--------+ | ||
227 | | | | ||
228 | | | | ||
229 | | ***** | | ||
230 | |** ** | | ||
231 | |** | | ||
232 | |** | | ||
233 | |****** | | ||
234 | |** ** | | ||
235 | |** ** | | ||
236 | |** ** | | ||
237 | |** ** | | ||
238 | | ***** | | ||
239 | | | | ||
240 | | | | ||
241 | | | | ||
242 | | | | ||
243 | +--------+ */ | ||
244 | 0x00, | ||
245 | 0x00, | ||
246 | 0x7c, | ||
247 | 0xc6, | ||
248 | 0xc0, | ||
249 | 0xc0, | ||
250 | 0xfc, | ||
251 | 0xc6, | ||
252 | 0xc6, | ||
253 | 0xc6, | ||
254 | 0xc6, | ||
255 | 0x7c, | ||
256 | 0x00, | ||
257 | 0x00, | ||
258 | 0x00, | ||
259 | 0x00, | ||
260 | |||
261 | /* Character 7 (0x37): | ||
262 | ht=16, width=8 | ||
263 | +--------+ | ||
264 | | | | ||
265 | | | | ||
266 | |******* | | ||
267 | |** ** | | ||
268 | | ** | | ||
269 | | ** | | ||
270 | | ** | | ||
271 | | ** | | ||
272 | | ** | | ||
273 | | ** | | ||
274 | | ** | | ||
275 | | ** | | ||
276 | | | | ||
277 | | | | ||
278 | | | | ||
279 | | | | ||
280 | +--------+ */ | ||
281 | 0x00, | ||
282 | 0x00, | ||
283 | 0xfe, | ||
284 | 0xc6, | ||
285 | 0x06, | ||
286 | 0x0c, | ||
287 | 0x18, | ||
288 | 0x30, | ||
289 | 0x30, | ||
290 | 0x30, | ||
291 | 0x30, | ||
292 | 0x30, | ||
293 | 0x00, | ||
294 | 0x00, | ||
295 | 0x00, | ||
296 | 0x00, | ||
297 | |||
298 | /* Character 8 (0x38): | ||
299 | ht=16, width=8 | ||
300 | +--------+ | ||
301 | | | | ||
302 | | | | ||
303 | | ***** | | ||
304 | |** ** | | ||
305 | |** ** | | ||
306 | |** ** | | ||
307 | | ***** | | ||
308 | |** ** | | ||
309 | |** ** | | ||
310 | |** ** | | ||
311 | |** ** | | ||
312 | | ***** | | ||
313 | | | | ||
314 | | | | ||
315 | | | | ||
316 | | | | ||
317 | +--------+ */ | ||
318 | 0x00, | ||
319 | 0x00, | ||
320 | 0x7c, | ||
321 | 0xc6, | ||
322 | 0xc6, | ||
323 | 0xc6, | ||
324 | 0x7c, | ||
325 | 0xc6, | ||
326 | 0xc6, | ||
327 | 0xc6, | ||
328 | 0xc6, | ||
329 | 0x7c, | ||
330 | 0x00, | ||
331 | 0x00, | ||
332 | 0x00, | ||
333 | 0x00, | ||
334 | |||
335 | /* Character 9 (0x39): | ||
336 | ht=16, width=8 | ||
337 | +--------+ | ||
338 | | | | ||
339 | | | | ||
340 | | ***** | | ||
341 | |** ** | | ||
342 | |** ** | | ||
343 | |** ** | | ||
344 | |** ** | | ||
345 | | ****** | | ||
346 | | ** | | ||
347 | | ** | | ||
348 | |** ** | | ||
349 | | ***** | | ||
350 | | | | ||
351 | | | | ||
352 | | | | ||
353 | | | | ||
354 | +--------+ */ | ||
355 | 0x00, | ||
356 | 0x00, | ||
357 | 0x7c, | ||
358 | 0xc6, | ||
359 | 0xc6, | ||
360 | 0xc6, | ||
361 | 0xc6, | ||
362 | 0x7e, | ||
363 | 0x06, | ||
364 | 0x06, | ||
365 | 0xc6, | ||
366 | 0x7c, | ||
367 | 0x00, | ||
368 | 0x00, | ||
369 | 0x00, | ||
370 | 0x00, | ||
371 | /* Character : (0x3a): | ||
372 | ht=16, width=8 | ||
373 | +--------+ | ||
374 | | | | ||
375 | | | | ||
376 | | | | ||
377 | | | | ||
378 | | | | ||
379 | | ** | | ||
380 | | ** | | ||
381 | | | | ||
382 | | | | ||
383 | | ** | | ||
384 | | ** | | ||
385 | | | | ||
386 | | | | ||
387 | | | | ||
388 | | | | ||
389 | | | | ||
390 | +--------+ */ | ||
391 | 0x00, | ||
392 | 0x00, | ||
393 | 0x00, | ||
394 | 0x00, | ||
395 | 0x00, | ||
396 | 0x0c, | ||
397 | 0x0c, | ||
398 | 0x00, | ||
399 | 0x00, | ||
400 | 0x0c, | ||
401 | 0x0c, | ||
402 | 0x00, | ||
403 | 0x00, | ||
404 | 0x00, | ||
405 | 0x00, | ||
406 | 0x00, | ||
407 | }; | ||
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 11ea9765769c..c40e8ba9a2ea 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -53,10 +53,11 @@ | |||
53 | #include <linux/videodev.h> | 53 | #include <linux/videodev.h> |
54 | #include <linux/videodev2.h> | 54 | #include <linux/videodev2.h> |
55 | #include <media/v4l2-common.h> | 55 | #include <media/v4l2-common.h> |
56 | #include <media/audiochip.h> | 56 | #include <media/tvaudio.h> |
57 | #include <media/msp3400.h> | ||
57 | #include <linux/kthread.h> | 58 | #include <linux/kthread.h> |
58 | #include <linux/suspend.h> | 59 | #include <linux/suspend.h> |
59 | #include "msp3400.h" | 60 | #include "msp3400-driver.h" |
60 | 61 | ||
61 | /* ---------------------------------------------------------------------- */ | 62 | /* ---------------------------------------------------------------------- */ |
62 | 63 | ||
@@ -245,31 +246,31 @@ int msp_write_dsp(struct i2c_client *client, int addr, int val) | |||
245 | * ----------------------------------------------------------------------- */ | 246 | * ----------------------------------------------------------------------- */ |
246 | 247 | ||
247 | static int scarts[3][9] = { | 248 | static int scarts[3][9] = { |
248 | /* MASK IN1 IN2 IN1_DA IN2_DA IN3 IN4 MONO MUTE */ | 249 | /* MASK IN1 IN2 IN3 IN4 IN1_DA IN2_DA MONO MUTE */ |
249 | /* SCART DSP Input select */ | 250 | /* SCART DSP Input select */ |
250 | { 0x0320, 0x0000, 0x0200, -1, -1, 0x0300, 0x0020, 0x0100, 0x0320 }, | 251 | { 0x0320, 0x0000, 0x0200, 0x0300, 0x0020, -1, -1, 0x0100, 0x0320 }, |
251 | /* SCART1 Output select */ | 252 | /* SCART1 Output select */ |
252 | { 0x0c40, 0x0440, 0x0400, 0x0c00, 0x0040, 0x0000, 0x0840, 0x0800, 0x0c40 }, | 253 | { 0x0c40, 0x0440, 0x0400, 0x0000, 0x0840, 0x0c00, 0x0040, 0x0800, 0x0c40 }, |
253 | /* SCART2 Output select */ | 254 | /* SCART2 Output select */ |
254 | { 0x3080, 0x1000, 0x1080, 0x0000, 0x0080, 0x2080, 0x3080, 0x2000, 0x3000 }, | 255 | { 0x3080, 0x1000, 0x1080, 0x2080, 0x3080, 0x0000, 0x0080, 0x2000, 0x3000 }, |
255 | }; | 256 | }; |
256 | 257 | ||
257 | static char *scart_names[] = { | 258 | static char *scart_names[] = { |
258 | "mask", "in1", "in2", "in1 da", "in2 da", "in3", "in4", "mono", "mute" | 259 | "in1", "in2", "in3", "in4", "in1 da", "in2 da", "mono", "mute" |
259 | }; | 260 | }; |
260 | 261 | ||
261 | void msp_set_scart(struct i2c_client *client, int in, int out) | 262 | void msp_set_scart(struct i2c_client *client, int in, int out) |
262 | { | 263 | { |
263 | struct msp_state *state = i2c_get_clientdata(client); | 264 | struct msp_state *state = i2c_get_clientdata(client); |
264 | 265 | ||
265 | state->in_scart=in; | 266 | state->in_scart = in; |
266 | 267 | ||
267 | if (in >= 1 && in <= 8 && out >= 0 && out <= 2) { | 268 | if (in >= 0 && in <= 7 && out >= 0 && out <= 2) { |
268 | if (-1 == scarts[out][in]) | 269 | if (-1 == scarts[out][in + 1]) |
269 | return; | 270 | return; |
270 | 271 | ||
271 | state->acb &= ~scarts[out][SCART_MASK]; | 272 | state->acb &= ~scarts[out][0]; |
272 | state->acb |= scarts[out][in]; | 273 | state->acb |= scarts[out][in + 1]; |
273 | } else | 274 | } else |
274 | state->acb = 0xf60; /* Mute Input and SCART 1 Output */ | 275 | state->acb = 0xf60; /* Mute Input and SCART 1 Output */ |
275 | 276 | ||
@@ -336,37 +337,6 @@ void msp_set_audio(struct i2c_client *client) | |||
336 | msp_write_dsp(client, 0x0033, loudness); | 337 | msp_write_dsp(client, 0x0033, loudness); |
337 | } | 338 | } |
338 | 339 | ||
339 | int msp_modus(struct i2c_client *client) | ||
340 | { | ||
341 | struct msp_state *state = i2c_get_clientdata(client); | ||
342 | |||
343 | if (state->radio) { | ||
344 | v4l_dbg(1, msp_debug, client, "video mode selected to Radio\n"); | ||
345 | return 0x0003; | ||
346 | } | ||
347 | |||
348 | if (state->v4l2_std & V4L2_STD_PAL) { | ||
349 | v4l_dbg(1, msp_debug, client, "video mode selected to PAL\n"); | ||
350 | |||
351 | #if 1 | ||
352 | /* experimental: not sure this works with all chip versions */ | ||
353 | return 0x7003; | ||
354 | #else | ||
355 | /* previous value, try this if it breaks ... */ | ||
356 | return 0x1003; | ||
357 | #endif | ||
358 | } | ||
359 | if (state->v4l2_std & V4L2_STD_NTSC) { | ||
360 | v4l_dbg(1, msp_debug, client, "video mode selected to NTSC\n"); | ||
361 | return 0x2003; | ||
362 | } | ||
363 | if (state->v4l2_std & V4L2_STD_SECAM) { | ||
364 | v4l_dbg(1, msp_debug, client, "video mode selected to SECAM\n"); | ||
365 | return 0x0003; | ||
366 | } | ||
367 | return 0x0003; | ||
368 | } | ||
369 | |||
370 | /* ------------------------------------------------------------------------ */ | 340 | /* ------------------------------------------------------------------------ */ |
371 | 341 | ||
372 | 342 | ||
@@ -585,51 +555,11 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) | |||
585 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | 555 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) |
586 | { | 556 | { |
587 | struct msp_state *state = i2c_get_clientdata(client); | 557 | struct msp_state *state = i2c_get_clientdata(client); |
588 | u16 *sarg = arg; | ||
589 | int scart = 0; | ||
590 | 558 | ||
591 | if (msp_debug >= 2) | 559 | if (msp_debug >= 2) |
592 | v4l_i2c_print_ioctl(client, cmd); | 560 | v4l_i2c_print_ioctl(client, cmd); |
593 | 561 | ||
594 | switch (cmd) { | 562 | switch (cmd) { |
595 | case AUDC_SET_INPUT: | ||
596 | if (*sarg == state->input) | ||
597 | break; | ||
598 | state->input = *sarg; | ||
599 | switch (*sarg) { | ||
600 | case AUDIO_RADIO: | ||
601 | /* Hauppauge uses IN2 for the radio */ | ||
602 | state->mode = MSP_MODE_FM_RADIO; | ||
603 | scart = SCART_IN2; | ||
604 | break; | ||
605 | case AUDIO_EXTERN_1: | ||
606 | /* IN1 is often used for external input ... */ | ||
607 | state->mode = MSP_MODE_EXTERN; | ||
608 | scart = SCART_IN1; | ||
609 | break; | ||
610 | case AUDIO_EXTERN_2: | ||
611 | /* ... sometimes it is IN2 through ;) */ | ||
612 | state->mode = MSP_MODE_EXTERN; | ||
613 | scart = SCART_IN2; | ||
614 | break; | ||
615 | case AUDIO_TUNER: | ||
616 | state->mode = -1; | ||
617 | break; | ||
618 | default: | ||
619 | if (*sarg & AUDIO_MUTE) | ||
620 | msp_set_scart(client, SCART_MUTE, 0); | ||
621 | break; | ||
622 | } | ||
623 | if (scart) { | ||
624 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | ||
625 | msp_set_scart(client, scart, 0); | ||
626 | msp_write_dsp(client, 0x000d, 0x1900); | ||
627 | if (state->opmode != OPMODE_AUTOSELECT) | ||
628 | msp_set_audmode(client); | ||
629 | } | ||
630 | msp_wake_thread(client); | ||
631 | break; | ||
632 | |||
633 | case AUDC_SET_RADIO: | 563 | case AUDC_SET_RADIO: |
634 | if (state->radio) | 564 | if (state->radio) |
635 | return 0; | 565 | return 0; |
@@ -692,6 +622,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
692 | 622 | ||
693 | if (va->mode != 0 && state->radio == 0) { | 623 | if (va->mode != 0 && state->radio == 0) { |
694 | state->audmode = msp_mode_v4l1_to_v4l2(va->mode); | 624 | state->audmode = msp_mode_v4l1_to_v4l2(va->mode); |
625 | msp_set_audmode(client); | ||
695 | } | 626 | } |
696 | break; | 627 | break; |
697 | } | 628 | } |
@@ -728,15 +659,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
728 | break; | 659 | break; |
729 | } | 660 | } |
730 | 661 | ||
731 | /* msp34xx specific */ | ||
732 | case MSP_SET_MATRIX: | ||
733 | { | ||
734 | struct msp_matrix *mspm = arg; | ||
735 | |||
736 | msp_set_scart(client, mspm->input, mspm->output); | ||
737 | break; | ||
738 | } | ||
739 | |||
740 | /* --- v4l2 ioctls --- */ | 662 | /* --- v4l2 ioctls --- */ |
741 | case VIDIOC_S_STD: | 663 | case VIDIOC_S_STD: |
742 | { | 664 | { |
@@ -750,90 +672,34 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
750 | return 0; | 672 | return 0; |
751 | } | 673 | } |
752 | 674 | ||
753 | case VIDIOC_ENUMINPUT: | 675 | case VIDIOC_INT_G_AUDIO_ROUTING: |
754 | { | ||
755 | struct v4l2_input *i = arg; | ||
756 | |||
757 | if (i->index != 0) | ||
758 | return -EINVAL; | ||
759 | |||
760 | i->type = V4L2_INPUT_TYPE_TUNER; | ||
761 | switch (i->index) { | ||
762 | case AUDIO_RADIO: | ||
763 | strcpy(i->name, "Radio"); | ||
764 | break; | ||
765 | case AUDIO_EXTERN_1: | ||
766 | strcpy(i->name, "Extern 1"); | ||
767 | break; | ||
768 | case AUDIO_EXTERN_2: | ||
769 | strcpy(i->name, "Extern 2"); | ||
770 | break; | ||
771 | case AUDIO_TUNER: | ||
772 | strcpy(i->name, "Television"); | ||
773 | break; | ||
774 | default: | ||
775 | return -EINVAL; | ||
776 | } | ||
777 | return 0; | ||
778 | } | ||
779 | |||
780 | case VIDIOC_G_AUDIO: | ||
781 | { | 676 | { |
782 | struct v4l2_audio *a = arg; | 677 | struct v4l2_routing *rt = arg; |
783 | 678 | ||
784 | memset(a, 0, sizeof(*a)); | 679 | *rt = state->routing; |
785 | |||
786 | switch (a->index) { | ||
787 | case AUDIO_RADIO: | ||
788 | strcpy(a->name, "Radio"); | ||
789 | break; | ||
790 | case AUDIO_EXTERN_1: | ||
791 | strcpy(a->name, "Extern 1"); | ||
792 | break; | ||
793 | case AUDIO_EXTERN_2: | ||
794 | strcpy(a->name, "Extern 2"); | ||
795 | break; | ||
796 | case AUDIO_TUNER: | ||
797 | strcpy(a->name, "Television"); | ||
798 | break; | ||
799 | default: | ||
800 | return -EINVAL; | ||
801 | } | ||
802 | |||
803 | a->capability = V4L2_AUDCAP_STEREO; | ||
804 | a->mode = 0; /* TODO: add support for AVL */ | ||
805 | break; | 680 | break; |
806 | } | 681 | } |
807 | 682 | ||
808 | case VIDIOC_S_AUDIO: | 683 | case VIDIOC_INT_S_AUDIO_ROUTING: |
809 | { | 684 | { |
810 | struct v4l2_audio *sarg = arg; | 685 | struct v4l2_routing *rt = arg; |
811 | 686 | int tuner = (rt->input >> 3) & 1; | |
812 | switch (sarg->index) { | 687 | int sc_in = rt->input & 0x7; |
813 | case AUDIO_RADIO: | 688 | int sc1_out = rt->output & 0xf; |
814 | /* Hauppauge uses IN2 for the radio */ | 689 | int sc2_out = (rt->output >> 4) & 0xf; |
815 | state->mode = MSP_MODE_FM_RADIO; | 690 | u16 val; |
816 | scart = SCART_IN2; | 691 | |
817 | break; | 692 | state->routing = *rt; |
818 | case AUDIO_EXTERN_1: | 693 | if (state->opmode == OPMODE_AUTOSELECT) { |
819 | /* IN1 is often used for external input ... */ | 694 | val = msp_read_dem(client, 0x30) & ~0x100; |
820 | state->mode = MSP_MODE_EXTERN; | 695 | msp_write_dem(client, 0x30, val | (tuner ? 0x100 : 0)); |
821 | scart = SCART_IN1; | 696 | } else { |
822 | break; | 697 | val = msp_read_dem(client, 0xbb) & ~0x100; |
823 | case AUDIO_EXTERN_2: | 698 | msp_write_dem(client, 0xbb, val | (tuner ? 0x100 : 0)); |
824 | /* ... sometimes it is IN2 through ;) */ | ||
825 | state->mode = MSP_MODE_EXTERN; | ||
826 | scart = SCART_IN2; | ||
827 | break; | ||
828 | case AUDIO_TUNER: | ||
829 | state->mode = -1; | ||
830 | break; | ||
831 | } | ||
832 | if (scart) { | ||
833 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | ||
834 | msp_set_scart(client, scart, 0); | ||
835 | msp_write_dsp(client, 0x000d, 0x1900); | ||
836 | } | 699 | } |
700 | msp_set_scart(client, sc_in, 0); | ||
701 | msp_set_scart(client, sc1_out, 1); | ||
702 | msp_set_scart(client, sc2_out, 2); | ||
837 | msp_set_audmode(client); | 703 | msp_set_audmode(client); |
838 | msp_wake_thread(client); | 704 | msp_wake_thread(client); |
839 | break; | 705 | break; |
@@ -866,42 +732,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
866 | break; | 732 | break; |
867 | } | 733 | } |
868 | 734 | ||
869 | case VIDIOC_G_AUDOUT: | ||
870 | { | ||
871 | struct v4l2_audioout *a = (struct v4l2_audioout *)arg; | ||
872 | int idx = a->index; | ||
873 | |||
874 | memset(a, 0, sizeof(*a)); | ||
875 | |||
876 | switch (idx) { | ||
877 | case 0: | ||
878 | strcpy(a->name, "Scart1 Out"); | ||
879 | break; | ||
880 | case 1: | ||
881 | strcpy(a->name, "Scart2 Out"); | ||
882 | break; | ||
883 | case 2: | ||
884 | strcpy(a->name, "I2S Out"); | ||
885 | break; | ||
886 | default: | ||
887 | return -EINVAL; | ||
888 | } | ||
889 | break; | ||
890 | } | ||
891 | |||
892 | case VIDIOC_S_AUDOUT: | ||
893 | { | ||
894 | struct v4l2_audioout *a = (struct v4l2_audioout *)arg; | ||
895 | |||
896 | if (a->index < 0 || a->index > 2) | ||
897 | return -EINVAL; | ||
898 | |||
899 | v4l_dbg(1, msp_debug, client, "Setting audio out on msp34xx to input %i\n", a->index); | ||
900 | msp_set_scart(client, state->in_scart, a->index + 1); | ||
901 | |||
902 | break; | ||
903 | } | ||
904 | |||
905 | case VIDIOC_INT_I2S_CLOCK_FREQ: | 735 | case VIDIOC_INT_I2S_CLOCK_FREQ: |
906 | { | 736 | { |
907 | u32 *a = (u32 *)arg; | 737 | u32 *a = (u32 *)arg; |
@@ -979,12 +809,16 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
979 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", | 809 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", |
980 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); | 810 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); |
981 | } else { | 811 | } else { |
982 | v4l_info(client, "Mode: %s\n", p); | 812 | if (state->opmode == OPMODE_AUTODETECT) |
813 | v4l_info(client, "Mode: %s\n", p); | ||
983 | v4l_info(client, "Standard: %s (%s%s)\n", | 814 | v4l_info(client, "Standard: %s (%s%s)\n", |
984 | msp_standard_std_name(state->std), | 815 | msp_standard_std_name(state->std), |
985 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", | 816 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", |
986 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); | 817 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); |
987 | } | 818 | } |
819 | v4l_info(client, "Audmode: 0x%04x\n", state->audmode); | ||
820 | v4l_info(client, "Routing: 0x%08x (input) 0x%08x (output)\n", | ||
821 | state->routing.input, state->routing.output); | ||
988 | v4l_info(client, "ACB: 0x%04x\n", state->acb); | 822 | v4l_info(client, "ACB: 0x%04x\n", state->acb); |
989 | break; | 823 | break; |
990 | } | 824 | } |
@@ -1063,6 +897,9 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1063 | state->muted = 0; | 897 | state->muted = 0; |
1064 | state->i2s_mode = 0; | 898 | state->i2s_mode = 0; |
1065 | init_waitqueue_head(&state->wq); | 899 | init_waitqueue_head(&state->wq); |
900 | /* These are the reset input/output positions */ | ||
901 | state->routing.input = MSP_INPUT_DEFAULT; | ||
902 | state->routing.output = MSP_OUTPUT_DEFAULT; | ||
1066 | 903 | ||
1067 | state->rev1 = msp_read_dsp(client, 0x1e); | 904 | state->rev1 = msp_read_dsp(client, 0x1e); |
1068 | if (state->rev1 != -1) | 905 | if (state->rev1 != -1) |
diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400-driver.h index 6fb5c8c994e7..1940748bb633 100644 --- a/drivers/media/video/msp3400.h +++ b/drivers/media/video/msp3400-driver.h | |||
@@ -1,8 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #ifndef MSP3400_H | 4 | #ifndef MSP3400_DRIVER_H |
5 | #define MSP3400_H | 5 | #define MSP3400_DRIVER_H |
6 | |||
7 | #include <media/msp3400.h> | ||
6 | 8 | ||
7 | /* ---------------------------------------------------------------------- */ | 9 | /* ---------------------------------------------------------------------- */ |
8 | 10 | ||
@@ -20,15 +22,14 @@ | |||
20 | #define MSP_MODE_BTSC 8 | 22 | #define MSP_MODE_BTSC 8 |
21 | #define MSP_MODE_EXTERN 9 | 23 | #define MSP_MODE_EXTERN 9 |
22 | 24 | ||
23 | #define SCART_MASK 0 | 25 | #define SCART_IN1 0 |
24 | #define SCART_IN1 1 | 26 | #define SCART_IN2 1 |
25 | #define SCART_IN2 2 | 27 | #define SCART_IN3 2 |
26 | #define SCART_IN1_DA 3 | 28 | #define SCART_IN4 3 |
27 | #define SCART_IN2_DA 4 | 29 | #define SCART_IN1_DA 4 |
28 | #define SCART_IN3 5 | 30 | #define SCART_IN2_DA 5 |
29 | #define SCART_IN4 6 | 31 | #define SCART_MONO 6 |
30 | #define SCART_MONO 7 | 32 | #define SCART_MUTE 7 |
31 | #define SCART_MUTE 8 | ||
32 | 33 | ||
33 | #define SCART_DSP_IN 0 | 34 | #define SCART_DSP_IN 0 |
34 | #define SCART1_OUT 1 | 35 | #define SCART1_OUT 1 |
@@ -73,7 +74,7 @@ struct msp_state { | |||
73 | int i2s_mode; | 74 | int i2s_mode; |
74 | int main, second; /* sound carrier */ | 75 | int main, second; /* sound carrier */ |
75 | int input; | 76 | int input; |
76 | int source; /* see msp34xxg_set_source */ | 77 | struct v4l2_routing routing; |
77 | 78 | ||
78 | /* v4l2 */ | 79 | /* v4l2 */ |
79 | int audmode; | 80 | int audmode; |
@@ -99,17 +100,16 @@ int msp_reset(struct i2c_client *client); | |||
99 | void msp_set_scart(struct i2c_client *client, int in, int out); | 100 | void msp_set_scart(struct i2c_client *client, int in, int out); |
100 | void msp_set_mute(struct i2c_client *client); | 101 | void msp_set_mute(struct i2c_client *client); |
101 | void msp_set_audio(struct i2c_client *client); | 102 | void msp_set_audio(struct i2c_client *client); |
102 | int msp_modus(struct i2c_client *client); | ||
103 | int msp_sleep(struct msp_state *state, int timeout); | 103 | int msp_sleep(struct msp_state *state, int timeout); |
104 | 104 | ||
105 | /* msp3400-kthreads.c */ | 105 | /* msp3400-kthreads.c */ |
106 | const char *msp_standard_std_name(int std); | 106 | const char *msp_standard_std_name(int std); |
107 | void msp_set_audmode(struct i2c_client *client); | 107 | void msp_set_audmode(struct i2c_client *client); |
108 | void msp_detect_stereo(struct i2c_client *client); | 108 | int msp_detect_stereo(struct i2c_client *client); |
109 | int msp3400c_thread(void *data); | 109 | int msp3400c_thread(void *data); |
110 | int msp3410d_thread(void *data); | 110 | int msp3410d_thread(void *data); |
111 | int msp34xxg_thread(void *data); | 111 | int msp34xxg_thread(void *data); |
112 | void msp3400c_set_mode(struct i2c_client *client, int mode); | 112 | void msp3400c_set_mode(struct i2c_client *client, int mode); |
113 | void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2); | 113 | void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2); |
114 | 114 | ||
115 | #endif /* MSP3400_H */ | 115 | #endif /* MSP3400_DRIVER_H */ |
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c index 852ab6a115fa..c3984ea9ca07 100644 --- a/drivers/media/video/msp3400-kthreads.c +++ b/drivers/media/video/msp3400-kthreads.c | |||
@@ -26,10 +26,10 @@ | |||
26 | #include <linux/videodev.h> | 26 | #include <linux/videodev.h> |
27 | #include <linux/videodev2.h> | 27 | #include <linux/videodev2.h> |
28 | #include <media/v4l2-common.h> | 28 | #include <media/v4l2-common.h> |
29 | #include <media/audiochip.h> | 29 | #include <media/msp3400.h> |
30 | #include <linux/kthread.h> | 30 | #include <linux/kthread.h> |
31 | #include <linux/suspend.h> | 31 | #include <linux/suspend.h> |
32 | #include "msp3400.h" | 32 | #include "msp3400-driver.h" |
33 | 33 | ||
34 | /* this one uses the automatic sound standard detection of newer msp34xx | 34 | /* this one uses the automatic sound standard detection of newer msp34xx |
35 | chip versions */ | 35 | chip versions */ |
@@ -45,11 +45,13 @@ static struct { | |||
45 | { 0x0004, MSP_CARRIER(6.5), MSP_CARRIER(6.2578125), "6.5/6.25 D/K1 Dual FM-Stereo" }, | 45 | { 0x0004, MSP_CARRIER(6.5), MSP_CARRIER(6.2578125), "6.5/6.25 D/K1 Dual FM-Stereo" }, |
46 | { 0x0005, MSP_CARRIER(6.5), MSP_CARRIER(6.7421875), "6.5/6.74 D/K2 Dual FM-Stereo" }, | 46 | { 0x0005, MSP_CARRIER(6.5), MSP_CARRIER(6.7421875), "6.5/6.74 D/K2 Dual FM-Stereo" }, |
47 | { 0x0006, MSP_CARRIER(6.5), MSP_CARRIER(6.5), "6.5 D/K FM-Mono (HDEV3)" }, | 47 | { 0x0006, MSP_CARRIER(6.5), MSP_CARRIER(6.5), "6.5 D/K FM-Mono (HDEV3)" }, |
48 | { 0x0007, MSP_CARRIER(6.5), MSP_CARRIER(5.7421875), "6.5/5.74 D/K3 Dual FM-Stereo" }, | ||
48 | { 0x0008, MSP_CARRIER(5.5), MSP_CARRIER(5.85), "5.5/5.85 B/G NICAM FM" }, | 49 | { 0x0008, MSP_CARRIER(5.5), MSP_CARRIER(5.85), "5.5/5.85 B/G NICAM FM" }, |
49 | { 0x0009, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 L NICAM AM" }, | 50 | { 0x0009, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 L NICAM AM" }, |
50 | { 0x000a, MSP_CARRIER(6.0), MSP_CARRIER(6.55), "6.0/6.55 I NICAM FM" }, | 51 | { 0x000a, MSP_CARRIER(6.0), MSP_CARRIER(6.55), "6.0/6.55 I NICAM FM" }, |
51 | { 0x000b, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM" }, | 52 | { 0x000b, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM" }, |
52 | { 0x000c, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM (HDEV2)" }, | 53 | { 0x000c, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM (HDEV2)" }, |
54 | { 0x000d, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM (HDEV3)" }, | ||
53 | { 0x0020, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M BTSC-Stereo" }, | 55 | { 0x0020, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M BTSC-Stereo" }, |
54 | { 0x0021, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M BTSC-Mono + SAP" }, | 56 | { 0x0021, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M BTSC-Mono + SAP" }, |
55 | { 0x0030, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M EIA-J Japan Stereo" }, | 57 | { 0x0030, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M EIA-J Japan Stereo" }, |
@@ -185,13 +187,14 @@ void msp3400c_set_mode(struct i2c_client *client, int mode) | |||
185 | { | 187 | { |
186 | struct msp_state *state = i2c_get_clientdata(client); | 188 | struct msp_state *state = i2c_get_clientdata(client); |
187 | struct msp3400c_init_data_dem *data = &msp3400c_init_data[mode]; | 189 | struct msp3400c_init_data_dem *data = &msp3400c_init_data[mode]; |
190 | int tuner = (state->routing.input >> 3) & 1; | ||
188 | int i; | 191 | int i; |
189 | 192 | ||
190 | v4l_dbg(1, msp_debug, client, "set_mode: %d\n", mode); | 193 | v4l_dbg(1, msp_debug, client, "set_mode: %d\n", mode); |
191 | state->mode = mode; | 194 | state->mode = mode; |
192 | state->rxsubchans = V4L2_TUNER_SUB_MONO; | 195 | state->rxsubchans = V4L2_TUNER_SUB_MONO; |
193 | 196 | ||
194 | msp_write_dem(client, 0x00bb, data->ad_cv); | 197 | msp_write_dem(client, 0x00bb, data->ad_cv | (tuner ? 0x100 : 0)); |
195 | 198 | ||
196 | for (i = 5; i >= 0; i--) /* fir 1 */ | 199 | for (i = 5; i >= 0; i--) /* fir 1 */ |
197 | msp_write_dem(client, 0x0001, data->fir1[i]); | 200 | msp_write_dem(client, 0x0001, data->fir1[i]); |
@@ -207,21 +210,22 @@ void msp3400c_set_mode(struct i2c_client *client, int mode) | |||
207 | msp3400c_set_carrier(client, data->cdo1, data->cdo2); | 210 | msp3400c_set_carrier(client, data->cdo1, data->cdo2); |
208 | 211 | ||
209 | msp_set_source(client, data->dsp_src); | 212 | msp_set_source(client, data->dsp_src); |
210 | msp_write_dsp(client, 0x000e, data->dsp_matrix); | 213 | /* set prescales */ |
211 | 214 | ||
212 | if (state->has_nicam) { | 215 | /* volume prescale for SCART (AM mono input) */ |
213 | /* nicam prescale */ | 216 | msp_write_dsp(client, 0x000d, 0x1900); |
214 | msp_write_dsp(client, 0x0010, 0x5a00); /* was: 0x3000 */ | 217 | msp_write_dsp(client, 0x000e, data->dsp_matrix); |
215 | } | 218 | if (state->has_nicam) /* nicam prescale */ |
219 | msp_write_dsp(client, 0x0010, 0x5a00); | ||
216 | } | 220 | } |
217 | 221 | ||
218 | /* Set audio mode. Note that the pre-'G' models do not support BTSC+SAP, | 222 | /* Set audio mode. Note that the pre-'G' models do not support BTSC+SAP, |
219 | nor do they support stereo BTSC. */ | 223 | nor do they support stereo BTSC. */ |
220 | static void msp3400c_set_audmode(struct i2c_client *client) | 224 | static void msp3400c_set_audmode(struct i2c_client *client) |
221 | { | 225 | { |
222 | static char *strmode[] = { "mono", "stereo", "lang2", "lang1" }; | 226 | static char *strmode[] = { "mono", "stereo", "lang2", "lang1", "lang1+lang2" }; |
223 | struct msp_state *state = i2c_get_clientdata(client); | 227 | struct msp_state *state = i2c_get_clientdata(client); |
224 | char *modestr = (state->audmode >= 0 && state->audmode < 4) ? | 228 | char *modestr = (state->audmode >= 0 && state->audmode < 5) ? |
225 | strmode[state->audmode] : "unknown"; | 229 | strmode[state->audmode] : "unknown"; |
226 | int src = 0; /* channel source: FM/AM, nicam or SCART */ | 230 | int src = 0; /* channel source: FM/AM, nicam or SCART */ |
227 | 231 | ||
@@ -246,6 +250,7 @@ static void msp3400c_set_audmode(struct i2c_client *client) | |||
246 | case V4L2_TUNER_MODE_MONO: | 250 | case V4L2_TUNER_MODE_MONO: |
247 | case V4L2_TUNER_MODE_LANG1: | 251 | case V4L2_TUNER_MODE_LANG1: |
248 | case V4L2_TUNER_MODE_LANG2: | 252 | case V4L2_TUNER_MODE_LANG2: |
253 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
249 | msp_write_dsp(client, 0x000e, 0x3000); | 254 | msp_write_dsp(client, 0x000e, 0x3000); |
250 | break; | 255 | break; |
251 | } | 256 | } |
@@ -257,6 +262,7 @@ static void msp3400c_set_audmode(struct i2c_client *client) | |||
257 | msp3400c_set_carrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); | 262 | msp3400c_set_carrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); |
258 | break; | 263 | break; |
259 | case V4L2_TUNER_MODE_STEREO: | 264 | case V4L2_TUNER_MODE_STEREO: |
265 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
260 | msp3400c_set_carrier(client, MSP_CARRIER(7.2), MSP_CARRIER(7.02)); | 266 | msp3400c_set_carrier(client, MSP_CARRIER(7.2), MSP_CARRIER(7.02)); |
261 | break; | 267 | break; |
262 | case V4L2_TUNER_MODE_LANG1: | 268 | case V4L2_TUNER_MODE_LANG1: |
@@ -271,7 +277,6 @@ static void msp3400c_set_audmode(struct i2c_client *client) | |||
271 | case MSP_MODE_FM_NICAM2: | 277 | case MSP_MODE_FM_NICAM2: |
272 | case MSP_MODE_AM_NICAM: | 278 | case MSP_MODE_AM_NICAM: |
273 | v4l_dbg(1, msp_debug, client, "NICAM set_audmode: %s\n",modestr); | 279 | v4l_dbg(1, msp_debug, client, "NICAM set_audmode: %s\n",modestr); |
274 | msp3400c_set_carrier(client, state->second, state->main); | ||
275 | if (state->nicam_on) | 280 | if (state->nicam_on) |
276 | src = 0x0100; /* NICAM */ | 281 | src = 0x0100; /* NICAM */ |
277 | break; | 282 | break; |
@@ -293,6 +298,7 @@ static void msp3400c_set_audmode(struct i2c_client *client) | |||
293 | /* switch audio */ | 298 | /* switch audio */ |
294 | switch (state->audmode) { | 299 | switch (state->audmode) { |
295 | case V4L2_TUNER_MODE_STEREO: | 300 | case V4L2_TUNER_MODE_STEREO: |
301 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
296 | src |= 0x0020; | 302 | src |= 0x0020; |
297 | break; | 303 | break; |
298 | case V4L2_TUNER_MODE_MONO: | 304 | case V4L2_TUNER_MODE_MONO: |
@@ -427,8 +433,8 @@ static void watch_stereo(struct i2c_client *client) | |||
427 | { | 433 | { |
428 | struct msp_state *state = i2c_get_clientdata(client); | 434 | struct msp_state *state = i2c_get_clientdata(client); |
429 | 435 | ||
430 | if (msp3400c_detect_stereo(client)) { | 436 | if (msp_detect_stereo(client)) { |
431 | msp3400c_set_audmode(client); | 437 | msp_set_audmode(client); |
432 | } | 438 | } |
433 | 439 | ||
434 | if (msp_once) | 440 | if (msp_once) |
@@ -464,7 +470,7 @@ int msp3400c_thread(void *data) | |||
464 | 470 | ||
465 | /* mute */ | 471 | /* mute */ |
466 | msp_set_mute(client); | 472 | msp_set_mute(client); |
467 | msp3400c_set_mode(client, MSP_MODE_AM_DETECT /* +1 */ ); | 473 | msp3400c_set_mode(client, MSP_MODE_AM_DETECT); |
468 | val1 = val2 = 0; | 474 | val1 = val2 = 0; |
469 | max1 = max2 = -1; | 475 | max1 = max2 = -1; |
470 | state->watch_stereo = 0; | 476 | state->watch_stereo = 0; |
@@ -572,8 +578,6 @@ int msp3400c_thread(void *data) | |||
572 | state->second = msp3400c_carrier_detect_65[max2].cdo; | 578 | state->second = msp3400c_carrier_detect_65[max2].cdo; |
573 | msp3400c_set_mode(client, MSP_MODE_AM_NICAM); | 579 | msp3400c_set_mode(client, MSP_MODE_AM_NICAM); |
574 | msp3400c_set_carrier(client, state->second, state->main); | 580 | msp3400c_set_carrier(client, state->second, state->main); |
575 | /* volume prescale for SCART (AM mono input) */ | ||
576 | msp_write_dsp(client, 0x000d, 0x1900); | ||
577 | state->watch_stereo = 1; | 581 | state->watch_stereo = 1; |
578 | } else if (max2 == 0 && state->has_nicam) { | 582 | } else if (max2 == 0 && state->has_nicam) { |
579 | /* D/K NICAM */ | 583 | /* D/K NICAM */ |
@@ -651,7 +655,8 @@ int msp3410d_thread(void *data) | |||
651 | if (msp_sleep(state,200)) | 655 | if (msp_sleep(state,200)) |
652 | goto restart; | 656 | goto restart; |
653 | 657 | ||
654 | /* start autodetect */ | 658 | /* start autodetect. Note: autodetect is not supported for |
659 | NTSC-M and radio, hence we force the standard in those cases. */ | ||
655 | if (state->radio) | 660 | if (state->radio) |
656 | std = 0x40; | 661 | std = 0x40; |
657 | else | 662 | else |
@@ -695,23 +700,19 @@ int msp3410d_thread(void *data) | |||
695 | v4l_dbg(1, msp_debug, client, "autodetection failed," | 700 | v4l_dbg(1, msp_debug, client, "autodetection failed," |
696 | " switching to backup standard: %s (0x%04x)\n", | 701 | " switching to backup standard: %s (0x%04x)\n", |
697 | msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val); | 702 | msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val); |
698 | val = 0x0009; | 703 | state->std = val = 0x0009; |
699 | msp_write_dem(client, 0x20, val); | 704 | msp_write_dem(client, 0x20, val); |
700 | } | 705 | } |
701 | 706 | ||
702 | /* set various prescales */ | ||
703 | msp_write_dsp(client, 0x0d, 0x1900); /* scart */ | ||
704 | msp_write_dsp(client, 0x0e, 0x2403); /* FM */ | ||
705 | msp_write_dsp(client, 0x10, 0x5a00); /* nicam */ | ||
706 | |||
707 | /* set stereo */ | 707 | /* set stereo */ |
708 | switch (val) { | 708 | switch (val) { |
709 | case 0x0008: /* B/G NICAM */ | 709 | case 0x0008: /* B/G NICAM */ |
710 | case 0x000a: /* I NICAM */ | 710 | case 0x000a: /* I NICAM */ |
711 | if (val == 0x0008) | 711 | case 0x000b: /* D/K NICAM */ |
712 | state->mode = MSP_MODE_FM_NICAM1; | 712 | if (val == 0x000a) |
713 | else | ||
714 | state->mode = MSP_MODE_FM_NICAM2; | 713 | state->mode = MSP_MODE_FM_NICAM2; |
714 | else | ||
715 | state->mode = MSP_MODE_FM_NICAM1; | ||
715 | /* just turn on stereo */ | 716 | /* just turn on stereo */ |
716 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | 717 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; |
717 | state->nicam_on = 1; | 718 | state->nicam_on = 1; |
@@ -739,6 +740,7 @@ int msp3410d_thread(void *data) | |||
739 | /* scart routing (this doesn't belong here I think) */ | 740 | /* scart routing (this doesn't belong here I think) */ |
740 | msp_set_scart(client,SCART_IN2,0); | 741 | msp_set_scart(client,SCART_IN2,0); |
741 | break; | 742 | break; |
743 | case 0x0002: | ||
742 | case 0x0003: | 744 | case 0x0003: |
743 | case 0x0004: | 745 | case 0x0004: |
744 | case 0x0005: | 746 | case 0x0005: |
@@ -748,12 +750,19 @@ int msp3410d_thread(void *data) | |||
748 | break; | 750 | break; |
749 | } | 751 | } |
750 | 752 | ||
751 | /* unmute, restore misc registers */ | 753 | /* set various prescales */ |
752 | msp_set_audio(client); | 754 | msp_write_dsp(client, 0x0d, 0x1900); /* scart */ |
753 | msp_write_dsp(client, 0x13, state->acb); | 755 | msp_write_dsp(client, 0x0e, 0x3000); /* FM */ |
756 | if (state->has_nicam) | ||
757 | msp_write_dsp(client, 0x10, 0x5a00); /* nicam */ | ||
758 | |||
754 | if (state->has_i2s_conf) | 759 | if (state->has_i2s_conf) |
755 | msp_write_dem(client, 0x40, state->i2s_mode); | 760 | msp_write_dem(client, 0x40, state->i2s_mode); |
756 | 761 | ||
762 | /* unmute, restore misc registers */ | ||
763 | msp_set_audio(client); | ||
764 | |||
765 | msp_write_dsp(client, 0x13, state->acb); | ||
757 | msp3400c_set_audmode(client); | 766 | msp3400c_set_audmode(client); |
758 | 767 | ||
759 | /* monitor tv audio mode, the first time don't wait | 768 | /* monitor tv audio mode, the first time don't wait |
@@ -772,97 +781,154 @@ int msp3410d_thread(void *data) | |||
772 | 781 | ||
773 | /* ----------------------------------------------------------------------- */ | 782 | /* ----------------------------------------------------------------------- */ |
774 | 783 | ||
775 | /* msp34xxG + (autoselect no-thread) */ | 784 | /* msp34xxG + (autoselect no-thread) |
776 | /* this one uses both automatic standard detection and automatic sound */ | 785 | * this one uses both automatic standard detection and automatic sound |
777 | /* select which are available in the newer G versions */ | 786 | * select which are available in the newer G versions |
778 | /* struct msp: only norm, acb and source are really used in this mode */ | 787 | * struct msp: only norm, acb and source are really used in this mode |
779 | |||
780 | /* set the same 'source' for the loudspeaker, scart and quasi-peak detector | ||
781 | * the value for source is the same as bit 15:8 of DSP registers 0x08, | ||
782 | * 0x0a and 0x0c: 0=mono, 1=stereo or A|B, 2=SCART, 3=stereo or A, 4=stereo or B | ||
783 | * | ||
784 | * this function replaces msp3400c_set_audmode | ||
785 | */ | 788 | */ |
786 | static void msp34xxg_set_source(struct i2c_client *client, int source) | 789 | |
790 | static int msp34xxg_modus(struct i2c_client *client) | ||
787 | { | 791 | { |
788 | struct msp_state *state = i2c_get_clientdata(client); | 792 | struct msp_state *state = i2c_get_clientdata(client); |
789 | 793 | ||
790 | /* fix matrix mode to stereo and let the msp choose what | 794 | if (state->radio) { |
791 | * to output according to 'source', as recommended | 795 | v4l_dbg(1, msp_debug, client, "selected radio modus\n"); |
792 | * for MONO (source==0) downmixing set bit[7:0] to 0x30 | 796 | return 0x0001; |
793 | */ | 797 | } |
794 | int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20); | ||
795 | 798 | ||
796 | v4l_dbg(1, msp_debug, client, "set source to %d (0x%x)\n", source, value); | 799 | if (state->v4l2_std & V4L2_STD_PAL) { |
797 | msp_set_source(client, value); | 800 | v4l_dbg(1, msp_debug, client, "selected PAL modus\n"); |
798 | /* | 801 | return 0x7001; |
799 | * set identification threshold. Personally, I | 802 | } |
800 | * I set it to a higher value that the default | 803 | if (state->v4l2_std == V4L2_STD_NTSC_M_JP) { |
801 | * of 0x190 to ignore noisy stereo signals. | 804 | v4l_dbg(1, msp_debug, client, "selected M (EIA-J) modus\n"); |
802 | * this needs tuning. (recommended range 0x00a0-0x03c0) | 805 | return 0x4001; |
803 | * 0x7f0 = forced mono mode | 806 | } |
804 | */ | 807 | if (state->v4l2_std == V4L2_STD_NTSC_M_KR) { |
805 | /* a2 threshold for stereo/bilingual */ | 808 | v4l_dbg(1, msp_debug, client, "selected M (A2) modus\n"); |
806 | msp_write_dem(client, 0x22, msp_stereo_thresh); | 809 | return 0x0001; |
807 | state->source = source; | 810 | } |
811 | if (state->v4l2_std & V4L2_STD_MN) { | ||
812 | v4l_dbg(1, msp_debug, client, "selected M (BTSC) modus\n"); | ||
813 | return 0x2001; | ||
814 | } | ||
815 | if (state->v4l2_std & V4L2_STD_SECAM) { | ||
816 | v4l_dbg(1, msp_debug, client, "selected SECAM modus\n"); | ||
817 | return 0x6001; | ||
818 | } | ||
819 | return 0x0001; | ||
808 | } | 820 | } |
809 | 821 | ||
810 | /* (re-)initialize the msp34xxg, according to the current norm in state->norm | 822 | static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in) |
811 | * return 0 if it worked, -1 if it failed | 823 | { |
812 | */ | 824 | struct msp_state *state = i2c_get_clientdata(client); |
813 | static int msp34xxg_reset(struct i2c_client *client) | 825 | int source, matrix; |
826 | |||
827 | switch (state->audmode) { | ||
828 | case V4L2_TUNER_MODE_MONO: | ||
829 | source = 0; /* mono only */ | ||
830 | matrix = 0x30; | ||
831 | break; | ||
832 | case V4L2_TUNER_MODE_LANG1: | ||
833 | source = 3; /* stereo or A */ | ||
834 | matrix = 0x00; | ||
835 | break; | ||
836 | case V4L2_TUNER_MODE_LANG2: | ||
837 | source = 4; /* stereo or B */ | ||
838 | matrix = 0x10; | ||
839 | break; | ||
840 | case V4L2_TUNER_MODE_STEREO: | ||
841 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
842 | default: | ||
843 | source = 1; /* stereo or A|B */ | ||
844 | matrix = 0x20; | ||
845 | break; | ||
846 | } | ||
847 | |||
848 | if (in == MSP_DSP_OUT_TUNER) | ||
849 | source = (source << 8) | 0x20; | ||
850 | /* the msp34x2g puts the MAIN_AVC, MAIN and AUX sources in 12, 13, 14 | ||
851 | instead of 11, 12, 13. So we add one for that msp version. */ | ||
852 | else if (in >= MSP_DSP_OUT_MAIN_AVC && state->has_dolby_pro_logic) | ||
853 | source = ((in + 1) << 8) | matrix; | ||
854 | else | ||
855 | source = (in << 8) | matrix; | ||
856 | |||
857 | v4l_dbg(1, msp_debug, client, "set source to %d (0x%x) for output %02x\n", | ||
858 | in, source, reg); | ||
859 | msp_write_dsp(client, reg, source); | ||
860 | } | ||
861 | |||
862 | static void msp34xxg_set_sources(struct i2c_client *client) | ||
863 | { | ||
864 | struct msp_state *state = i2c_get_clientdata(client); | ||
865 | u32 in = state->routing.input; | ||
866 | |||
867 | msp34xxg_set_source(client, 0x0008, (in >> 4) & 0xf); | ||
868 | /* quasi-peak detector is set to same input as the loudspeaker (MAIN) */ | ||
869 | msp34xxg_set_source(client, 0x000c, (in >> 4) & 0xf); | ||
870 | msp34xxg_set_source(client, 0x0009, (in >> 8) & 0xf); | ||
871 | msp34xxg_set_source(client, 0x000a, (in >> 12) & 0xf); | ||
872 | if (state->has_scart23_in_scart2_out) | ||
873 | msp34xxg_set_source(client, 0x0041, (in >> 16) & 0xf); | ||
874 | msp34xxg_set_source(client, 0x000b, (in >> 20) & 0xf); | ||
875 | } | ||
876 | |||
877 | /* (re-)initialize the msp34xxg */ | ||
878 | static void msp34xxg_reset(struct i2c_client *client) | ||
814 | { | 879 | { |
815 | struct msp_state *state = i2c_get_clientdata(client); | 880 | struct msp_state *state = i2c_get_clientdata(client); |
816 | int modus, std; | 881 | int tuner = (state->routing.input >> 3) & 1; |
882 | int modus; | ||
883 | |||
884 | /* initialize std to 1 (autodetect) to signal that no standard is | ||
885 | selected yet. */ | ||
886 | state->std = 1; | ||
817 | 887 | ||
818 | if (msp_reset(client)) | 888 | msp_reset(client); |
819 | return -1; | ||
820 | 889 | ||
821 | /* make sure that input/output is muted (paranoid mode) */ | 890 | /* make sure that input/output is muted (paranoid mode) */ |
822 | /* ACB, mute DSP input, mute SCART 1 */ | 891 | /* ACB, mute DSP input, mute SCART 1 */ |
823 | if (msp_write_dsp(client, 0x13, 0x0f20)) | 892 | msp_write_dsp(client, 0x13, 0x0f20); |
824 | return -1; | ||
825 | 893 | ||
826 | if (state->has_i2s_conf) | 894 | if (state->has_i2s_conf) |
827 | msp_write_dem(client, 0x40, state->i2s_mode); | 895 | msp_write_dem(client, 0x40, state->i2s_mode); |
828 | 896 | ||
829 | /* step-by-step initialisation, as described in the manual */ | 897 | /* step-by-step initialisation, as described in the manual */ |
830 | modus = msp_modus(client); | 898 | modus = msp34xxg_modus(client); |
831 | if (state->radio) | 899 | modus |= tuner ? 0x100 : 0; |
832 | std = 0x40; | 900 | msp_write_dem(client, 0x30, modus); |
833 | else | ||
834 | std = (state->v4l2_std & V4L2_STD_NTSC) ? 0x20 : 1; | ||
835 | modus &= ~0x03; /* STATUS_CHANGE = 0 */ | ||
836 | modus |= 0x01; /* AUTOMATIC_SOUND_DETECTION = 1 */ | ||
837 | if (msp_write_dem(client, 0x30, modus)) | ||
838 | return -1; | ||
839 | if (msp_write_dem(client, 0x20, std)) | ||
840 | return -1; | ||
841 | 901 | ||
842 | /* write the dsps that may have an influence on | 902 | /* write the dsps that may have an influence on |
843 | standard/audio autodetection right now */ | 903 | standard/audio autodetection right now */ |
844 | msp34xxg_set_source(client, state->source); | 904 | msp34xxg_set_sources(client); |
845 | |||
846 | /* AM/FM Prescale [15:8] 75khz deviation */ | ||
847 | if (msp_write_dsp(client, 0x0e, 0x3000)) | ||
848 | return -1; | ||
849 | 905 | ||
850 | /* NICAM Prescale 9db gain (as recommended) */ | 906 | msp_write_dsp(client, 0x0d, 0x1900); /* scart */ |
851 | if (msp_write_dsp(client, 0x10, 0x5a00)) | 907 | msp_write_dsp(client, 0x0e, 0x3000); /* FM */ |
852 | return -1; | 908 | if (state->has_nicam) |
909 | msp_write_dsp(client, 0x10, 0x5a00); /* nicam */ | ||
853 | 910 | ||
854 | return 0; | 911 | /* set identification threshold. Personally, I |
912 | * I set it to a higher value than the default | ||
913 | * of 0x190 to ignore noisy stereo signals. | ||
914 | * this needs tuning. (recommended range 0x00a0-0x03c0) | ||
915 | * 0x7f0 = forced mono mode | ||
916 | * | ||
917 | * a2 threshold for stereo/bilingual. | ||
918 | * Note: this register is part of the Manual/Compatibility mode. | ||
919 | * It is supported by all 'G'-family chips. | ||
920 | */ | ||
921 | msp_write_dem(client, 0x22, msp_stereo_thresh); | ||
855 | } | 922 | } |
856 | 923 | ||
857 | int msp34xxg_thread(void *data) | 924 | int msp34xxg_thread(void *data) |
858 | { | 925 | { |
859 | struct i2c_client *client = data; | 926 | struct i2c_client *client = data; |
860 | struct msp_state *state = i2c_get_clientdata(client); | 927 | struct msp_state *state = i2c_get_clientdata(client); |
861 | int val, std, i; | 928 | int val, i; |
862 | 929 | ||
863 | v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n"); | 930 | v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n"); |
864 | 931 | ||
865 | state->source = 1; /* default */ | ||
866 | for (;;) { | 932 | for (;;) { |
867 | v4l_dbg(2, msp_debug, client, "msp34xxg thread: sleep\n"); | 933 | v4l_dbg(2, msp_debug, client, "msp34xxg thread: sleep\n"); |
868 | msp_sleep(state, -1); | 934 | msp_sleep(state, -1); |
@@ -876,12 +942,14 @@ int msp34xxg_thread(void *data) | |||
876 | 942 | ||
877 | /* setup the chip*/ | 943 | /* setup the chip*/ |
878 | msp34xxg_reset(client); | 944 | msp34xxg_reset(client); |
879 | std = msp_standard; | 945 | state->std = state->radio ? 0x40 : msp_standard; |
880 | if (std != 0x01) | 946 | if (state->std != 1) |
881 | goto unmute; | 947 | goto unmute; |
948 | /* start autodetect */ | ||
949 | msp_write_dem(client, 0x20, state->std); | ||
882 | 950 | ||
883 | /* watch autodetect */ | 951 | /* watch autodetect */ |
884 | v4l_dbg(1, msp_debug, client, "triggered autodetect, waiting for result\n"); | 952 | v4l_dbg(1, msp_debug, client, "started autodetect, waiting for result\n"); |
885 | for (i = 0; i < 10; i++) { | 953 | for (i = 0; i < 10; i++) { |
886 | if (msp_sleep(state, 100)) | 954 | if (msp_sleep(state, 100)) |
887 | goto restart; | 955 | goto restart; |
@@ -889,20 +957,19 @@ int msp34xxg_thread(void *data) | |||
889 | /* check results */ | 957 | /* check results */ |
890 | val = msp_read_dem(client, 0x7e); | 958 | val = msp_read_dem(client, 0x7e); |
891 | if (val < 0x07ff) { | 959 | if (val < 0x07ff) { |
892 | std = val; | 960 | state->std = val; |
893 | break; | 961 | break; |
894 | } | 962 | } |
895 | v4l_dbg(2, msp_debug, client, "detection still in progress\n"); | 963 | v4l_dbg(2, msp_debug, client, "detection still in progress\n"); |
896 | } | 964 | } |
897 | if (std == 1) { | 965 | if (state->std == 1) { |
898 | v4l_dbg(1, msp_debug, client, "detection still in progress after 10 tries. giving up.\n"); | 966 | v4l_dbg(1, msp_debug, client, "detection still in progress after 10 tries. giving up.\n"); |
899 | continue; | 967 | continue; |
900 | } | 968 | } |
901 | 969 | ||
902 | unmute: | 970 | unmute: |
903 | state->std = std; | 971 | v4l_dbg(1, msp_debug, client, "detected standard: %s (0x%04x)\n", |
904 | v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n", | 972 | msp_standard_std_name(state->std), state->std); |
905 | msp_standard_std_name(std), std); | ||
906 | 973 | ||
907 | /* unmute: dispatch sound to scart output, set scart volume */ | 974 | /* unmute: dispatch sound to scart output, set scart volume */ |
908 | msp_set_audio(client); | 975 | msp_set_audio(client); |
@@ -911,20 +978,33 @@ int msp34xxg_thread(void *data) | |||
911 | if (msp_write_dsp(client, 0x13, state->acb)) | 978 | if (msp_write_dsp(client, 0x13, state->acb)) |
912 | return -1; | 979 | return -1; |
913 | 980 | ||
914 | if (state->has_i2s_conf) | 981 | /* the periodic stereo/SAP check is only relevant for |
915 | msp_write_dem(client, 0x40, state->i2s_mode); | 982 | the 0x20 standard (BTSC) */ |
983 | if (state->std != 0x20) | ||
984 | continue; | ||
985 | |||
986 | state->watch_stereo = 1; | ||
987 | |||
988 | /* monitor tv audio mode, the first time don't wait | ||
989 | in order to get a quick stereo/SAP update */ | ||
990 | watch_stereo(client); | ||
991 | while (state->watch_stereo) { | ||
992 | watch_stereo(client); | ||
993 | if (msp_sleep(state, 5000)) | ||
994 | goto restart; | ||
995 | } | ||
916 | } | 996 | } |
917 | v4l_dbg(1, msp_debug, client, "thread: exit\n"); | 997 | v4l_dbg(1, msp_debug, client, "thread: exit\n"); |
918 | return 0; | 998 | return 0; |
919 | } | 999 | } |
920 | 1000 | ||
921 | static void msp34xxg_detect_stereo(struct i2c_client *client) | 1001 | static int msp34xxg_detect_stereo(struct i2c_client *client) |
922 | { | 1002 | { |
923 | struct msp_state *state = i2c_get_clientdata(client); | 1003 | struct msp_state *state = i2c_get_clientdata(client); |
924 | |||
925 | int status = msp_read_dem(client, 0x0200); | 1004 | int status = msp_read_dem(client, 0x0200); |
926 | int is_bilingual = status & 0x100; | 1005 | int is_bilingual = status & 0x100; |
927 | int is_stereo = status & 0x40; | 1006 | int is_stereo = status & 0x40; |
1007 | int oldrx = state->rxsubchans; | ||
928 | 1008 | ||
929 | state->rxsubchans = 0; | 1009 | state->rxsubchans = 0; |
930 | if (is_stereo) | 1010 | if (is_stereo) |
@@ -932,42 +1012,31 @@ static void msp34xxg_detect_stereo(struct i2c_client *client) | |||
932 | else | 1012 | else |
933 | state->rxsubchans = V4L2_TUNER_SUB_MONO; | 1013 | state->rxsubchans = V4L2_TUNER_SUB_MONO; |
934 | if (is_bilingual) { | 1014 | if (is_bilingual) { |
935 | state->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; | 1015 | if (state->std == 0x20) |
936 | /* I'm supposed to check whether it's SAP or not | 1016 | state->rxsubchans |= V4L2_TUNER_SUB_SAP; |
937 | * and set only LANG2/SAP in this case. Yet, the MSP | 1017 | else |
938 | * does a lot of work to hide this and handle everything | 1018 | state->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
939 | * the same way. I don't want to work around it so unless | ||
940 | * this is a problem, I'll handle SAP just like lang1/lang2. | ||
941 | */ | ||
942 | } | 1019 | } |
943 | v4l_dbg(1, msp_debug, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", | 1020 | v4l_dbg(1, msp_debug, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", |
944 | status, is_stereo, is_bilingual, state->rxsubchans); | 1021 | status, is_stereo, is_bilingual, state->rxsubchans); |
1022 | return (oldrx != state->rxsubchans); | ||
945 | } | 1023 | } |
946 | 1024 | ||
947 | static void msp34xxg_set_audmode(struct i2c_client *client) | 1025 | static void msp34xxg_set_audmode(struct i2c_client *client) |
948 | { | 1026 | { |
949 | struct msp_state *state = i2c_get_clientdata(client); | 1027 | struct msp_state *state = i2c_get_clientdata(client); |
950 | int source; | ||
951 | 1028 | ||
952 | switch (state->audmode) { | 1029 | if (state->std == 0x20) { |
953 | case V4L2_TUNER_MODE_MONO: | 1030 | if ((state->rxsubchans & V4L2_TUNER_SUB_SAP) && |
954 | source = 0; /* mono only */ | 1031 | (state->audmode == V4L2_TUNER_MODE_STEREO || |
955 | break; | 1032 | state->audmode == V4L2_TUNER_MODE_LANG2)) { |
956 | case V4L2_TUNER_MODE_STEREO: | 1033 | msp_write_dem(client, 0x20, 0x21); |
957 | source = 1; /* stereo or A|B, see comment in msp34xxg_get_v4l2_stereo() */ | 1034 | } else { |
958 | /* problem: that could also mean 2 (scart input) */ | 1035 | msp_write_dem(client, 0x20, 0x20); |
959 | break; | 1036 | } |
960 | case V4L2_TUNER_MODE_LANG1: | ||
961 | source = 3; /* stereo or A */ | ||
962 | break; | ||
963 | case V4L2_TUNER_MODE_LANG2: | ||
964 | source = 4; /* stereo or B */ | ||
965 | break; | ||
966 | default: | ||
967 | source = 1; | ||
968 | break; | ||
969 | } | 1037 | } |
970 | msp34xxg_set_source(client, source); | 1038 | |
1039 | msp34xxg_set_sources(client); | ||
971 | } | 1040 | } |
972 | 1041 | ||
973 | void msp_set_audmode(struct i2c_client *client) | 1042 | void msp_set_audmode(struct i2c_client *client) |
@@ -977,7 +1046,6 @@ void msp_set_audmode(struct i2c_client *client) | |||
977 | switch (state->opmode) { | 1046 | switch (state->opmode) { |
978 | case OPMODE_MANUAL: | 1047 | case OPMODE_MANUAL: |
979 | case OPMODE_AUTODETECT: | 1048 | case OPMODE_AUTODETECT: |
980 | state->watch_stereo = 0; | ||
981 | msp3400c_set_audmode(client); | 1049 | msp3400c_set_audmode(client); |
982 | break; | 1050 | break; |
983 | case OPMODE_AUTOSELECT: | 1051 | case OPMODE_AUTOSELECT: |
@@ -986,18 +1054,17 @@ void msp_set_audmode(struct i2c_client *client) | |||
986 | } | 1054 | } |
987 | } | 1055 | } |
988 | 1056 | ||
989 | void msp_detect_stereo(struct i2c_client *client) | 1057 | int msp_detect_stereo(struct i2c_client *client) |
990 | { | 1058 | { |
991 | struct msp_state *state = i2c_get_clientdata(client); | 1059 | struct msp_state *state = i2c_get_clientdata(client); |
992 | 1060 | ||
993 | switch (state->opmode) { | 1061 | switch (state->opmode) { |
994 | case OPMODE_MANUAL: | 1062 | case OPMODE_MANUAL: |
995 | case OPMODE_AUTODETECT: | 1063 | case OPMODE_AUTODETECT: |
996 | msp3400c_detect_stereo(client); | 1064 | return msp3400c_detect_stereo(client); |
997 | break; | ||
998 | case OPMODE_AUTOSELECT: | 1065 | case OPMODE_AUTOSELECT: |
999 | msp34xxg_detect_stereo(client); | 1066 | return msp34xxg_detect_stereo(client); |
1000 | break; | ||
1001 | } | 1067 | } |
1068 | return 0; | ||
1002 | } | 1069 | } |
1003 | 1070 | ||
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index eb3b31867494..b0aea4002d11 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -198,13 +198,13 @@ static int mxb_probe(struct saa7146_dev* dev) | |||
198 | /* loop through all i2c-devices on the bus and look who is there */ | 198 | /* loop through all i2c-devices on the bus and look who is there */ |
199 | list_for_each(item,&mxb->i2c_adapter.clients) { | 199 | list_for_each(item,&mxb->i2c_adapter.clients) { |
200 | client = list_entry(item, struct i2c_client, list); | 200 | client = list_entry(item, struct i2c_client, list); |
201 | if( I2C_TEA6420_1 == client->addr ) | 201 | if( I2C_ADDR_TEA6420_1 == client->addr ) |
202 | mxb->tea6420_1 = client; | 202 | mxb->tea6420_1 = client; |
203 | if( I2C_TEA6420_2 == client->addr ) | 203 | if( I2C_ADDR_TEA6420_2 == client->addr ) |
204 | mxb->tea6420_2 = client; | 204 | mxb->tea6420_2 = client; |
205 | if( I2C_TEA6415C_2 == client->addr ) | 205 | if( I2C_TEA6415C_2 == client->addr ) |
206 | mxb->tea6415c = client; | 206 | mxb->tea6415c = client; |
207 | if( I2C_TDA9840 == client->addr ) | 207 | if( I2C_ADDR_TDA9840 == client->addr ) |
208 | mxb->tda9840 = client; | 208 | mxb->tda9840 = client; |
209 | if( I2C_SAA7111 == client->addr ) | 209 | if( I2C_SAA7111 == client->addr ) |
210 | mxb->saa7111a = client; | 210 | mxb->saa7111a = client; |
@@ -790,6 +790,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
790 | DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_STEREO\n")); | 790 | DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_STEREO\n")); |
791 | break; | 791 | break; |
792 | } | 792 | } |
793 | case V4L2_TUNER_MODE_LANG1_LANG2: { | ||
794 | mxb->cur_mode = V4L2_TUNER_MODE_LANG1_LANG2; | ||
795 | byte = TDA9840_SET_BOTH; | ||
796 | DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1_LANG2\n")); | ||
797 | break; | ||
798 | } | ||
793 | case V4L2_TUNER_MODE_LANG1: { | 799 | case V4L2_TUNER_MODE_LANG1: { |
794 | mxb->cur_mode = V4L2_TUNER_MODE_LANG1; | 800 | mxb->cur_mode = V4L2_TUNER_MODE_LANG1; |
795 | byte = TDA9840_SET_LANG1; | 801 | byte = TDA9840_SET_LANG1; |
diff --git a/drivers/usb/media/ov511.c b/drivers/media/video/ov511.c index da44579d6f29..fdc8e3f13937 100644 --- a/drivers/usb/media/ov511.c +++ b/drivers/media/video/ov511.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * | 15 | * |
16 | * Based on the Linux CPiA driver written by Peter Pregler, | 16 | * Based on the Linux CPiA driver written by Peter Pregler, |
17 | * Scott J. Bertin and Johannes Erdfelt. | 17 | * Scott J. Bertin and Johannes Erdfelt. |
18 | * | 18 | * |
19 | * Please see the file: Documentation/usb/ov511.txt | 19 | * Please see the file: Documentation/usb/ov511.txt |
20 | * and the website at: http://alpha.dyndns.org/ov511 | 20 | * and the website at: http://alpha.dyndns.org/ov511 |
21 | * for more info. | 21 | * for more info. |
@@ -433,7 +433,7 @@ reg_w_mask(struct usb_ov511 *ov, | |||
433 | return (reg_w(ov, reg, newval)); | 433 | return (reg_w(ov, reg, newval)); |
434 | } | 434 | } |
435 | 435 | ||
436 | /* | 436 | /* |
437 | * Writes multiple (n) byte value to a single register. Only valid with certain | 437 | * Writes multiple (n) byte value to a single register. Only valid with certain |
438 | * registers (0x30 and 0xc4 - 0xce). | 438 | * registers (0x30 and 0xc4 - 0xce). |
439 | */ | 439 | */ |
@@ -629,7 +629,7 @@ ov511_i2c_write_internal(struct usb_ov511 *ov, | |||
629 | /* Retry until idle */ | 629 | /* Retry until idle */ |
630 | do | 630 | do |
631 | rc = reg_r(ov, R511_I2C_CTL); | 631 | rc = reg_r(ov, R511_I2C_CTL); |
632 | while (rc > 0 && ((rc&1) == 0)); | 632 | while (rc > 0 && ((rc&1) == 0)); |
633 | if (rc < 0) | 633 | if (rc < 0) |
634 | break; | 634 | break; |
635 | 635 | ||
@@ -1752,7 +1752,7 @@ sensor_set_picture(struct usb_ov511 *ov, struct video_picture *p) | |||
1752 | ov->whiteness = p->whiteness; | 1752 | ov->whiteness = p->whiteness; |
1753 | 1753 | ||
1754 | /* Don't return error if a setting is unsupported, or rest of settings | 1754 | /* Don't return error if a setting is unsupported, or rest of settings |
1755 | * will not be performed */ | 1755 | * will not be performed */ |
1756 | 1756 | ||
1757 | rc = sensor_set_contrast(ov, p->contrast); | 1757 | rc = sensor_set_contrast(ov, p->contrast); |
1758 | if (FATAL_ERROR(rc)) | 1758 | if (FATAL_ERROR(rc)) |
@@ -1781,7 +1781,7 @@ sensor_get_picture(struct usb_ov511 *ov, struct video_picture *p) | |||
1781 | PDEBUG(4, "sensor_get_picture"); | 1781 | PDEBUG(4, "sensor_get_picture"); |
1782 | 1782 | ||
1783 | /* Don't return error if a setting is unsupported, or rest of settings | 1783 | /* Don't return error if a setting is unsupported, or rest of settings |
1784 | * will not be performed */ | 1784 | * will not be performed */ |
1785 | 1785 | ||
1786 | rc = sensor_get_contrast(ov, &(p->contrast)); | 1786 | rc = sensor_get_contrast(ov, &(p->contrast)); |
1787 | if (FATAL_ERROR(rc)) | 1787 | if (FATAL_ERROR(rc)) |
@@ -2251,7 +2251,7 @@ mode_init_ov_sensor_regs(struct usb_ov511 *ov, int width, int height, | |||
2251 | 2251 | ||
2252 | /******** Clock programming ********/ | 2252 | /******** Clock programming ********/ |
2253 | 2253 | ||
2254 | /* The OV6620 needs special handling. This prevents the | 2254 | /* The OV6620 needs special handling. This prevents the |
2255 | * severe banding that normally occurs */ | 2255 | * severe banding that normally occurs */ |
2256 | if (ov->sensor == SEN_OV6620 || ov->sensor == SEN_OV6630) | 2256 | if (ov->sensor == SEN_OV6620 || ov->sensor == SEN_OV6630) |
2257 | { | 2257 | { |
@@ -2326,7 +2326,7 @@ set_ov_sensor_window(struct usb_ov511 *ov, int width, int height, int mode, | |||
2326 | int sub_flag) | 2326 | int sub_flag) |
2327 | { | 2327 | { |
2328 | int ret; | 2328 | int ret; |
2329 | int hwsbase, hwebase, vwsbase, vwebase, hwsize, vwsize; | 2329 | int hwsbase, hwebase, vwsbase, vwebase, hwsize, vwsize; |
2330 | int hoffset, voffset, hwscale = 0, vwscale = 0; | 2330 | int hoffset, voffset, hwscale = 0, vwscale = 0; |
2331 | 2331 | ||
2332 | /* The different sensor ICs handle setting up of window differently. | 2332 | /* The different sensor ICs handle setting up of window differently. |
@@ -2575,7 +2575,7 @@ ov518_mode_init_regs(struct usb_ov511 *ov, | |||
2575 | /* OV518 needs U and V swapped */ | 2575 | /* OV518 needs U and V swapped */ |
2576 | i2c_w_mask(ov, 0x15, 0x00, 0x01); | 2576 | i2c_w_mask(ov, 0x15, 0x00, 0x01); |
2577 | 2577 | ||
2578 | if (mode == VIDEO_PALETTE_GREY) { | 2578 | if (mode == VIDEO_PALETTE_GREY) { |
2579 | /* Set 16-bit input format (UV data are ignored) */ | 2579 | /* Set 16-bit input format (UV data are ignored) */ |
2580 | reg_w_mask(ov, 0x20, 0x00, 0x08); | 2580 | reg_w_mask(ov, 0x20, 0x00, 0x08); |
2581 | 2581 | ||
@@ -2894,7 +2894,7 @@ make_8x8(unsigned char *pIn, unsigned char *pOut, int w) | |||
2894 | * ... ... ... | 2894 | * ... ... ... |
2895 | * 56 57 ... 63 120 121 ... 127 248 249 ... 255 | 2895 | * 56 57 ... 63 120 121 ... 127 248 249 ... 255 |
2896 | * | 2896 | * |
2897 | */ | 2897 | */ |
2898 | static void | 2898 | static void |
2899 | yuv400raw_to_yuv400p(struct ov511_frame *frame, | 2899 | yuv400raw_to_yuv400p(struct ov511_frame *frame, |
2900 | unsigned char *pIn0, unsigned char *pOut0) | 2900 | unsigned char *pIn0, unsigned char *pOut0) |
@@ -2923,7 +2923,7 @@ yuv400raw_to_yuv400p(struct ov511_frame *frame, | |||
2923 | * | 2923 | * |
2924 | * 0 1 ... 7 | 2924 | * 0 1 ... 7 |
2925 | * 8 9 ... 15 | 2925 | * 8 9 ... 15 |
2926 | * ... | 2926 | * ... |
2927 | * 56 57 ... 63 | 2927 | * 56 57 ... 63 |
2928 | * | 2928 | * |
2929 | * U and V are shipped at half resolution (1 U,V sample -> one 2x2 block). | 2929 | * U and V are shipped at half resolution (1 U,V sample -> one 2x2 block). |
@@ -3034,7 +3034,7 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame, | |||
3034 | */ | 3034 | */ |
3035 | static void | 3035 | static void |
3036 | deinterlace(struct ov511_frame *frame, int rawformat, | 3036 | deinterlace(struct ov511_frame *frame, int rawformat, |
3037 | unsigned char *pIn0, unsigned char *pOut0) | 3037 | unsigned char *pIn0, unsigned char *pOut0) |
3038 | { | 3038 | { |
3039 | const int fieldheight = frame->rawheight / 2; | 3039 | const int fieldheight = frame->rawheight / 2; |
3040 | const int fieldpix = fieldheight * frame->rawwidth; | 3040 | const int fieldpix = fieldheight * frame->rawwidth; |
@@ -3112,7 +3112,7 @@ ov51x_postprocess_grey(struct usb_ov511 *ov, struct ov511_frame *frame) | |||
3112 | frame->tempdata); | 3112 | frame->tempdata); |
3113 | 3113 | ||
3114 | deinterlace(frame, RAWFMT_YUV400, frame->tempdata, | 3114 | deinterlace(frame, RAWFMT_YUV400, frame->tempdata, |
3115 | frame->data); | 3115 | frame->data); |
3116 | } else { | 3116 | } else { |
3117 | if (frame->compressed) | 3117 | if (frame->compressed) |
3118 | decompress(ov, frame, frame->rawdata, | 3118 | decompress(ov, frame, frame->rawdata, |
@@ -3136,7 +3136,7 @@ ov51x_postprocess_yuv420(struct usb_ov511 *ov, struct ov511_frame *frame) | |||
3136 | frame->tempdata); | 3136 | frame->tempdata); |
3137 | 3137 | ||
3138 | deinterlace(frame, RAWFMT_YUV420, frame->tempdata, | 3138 | deinterlace(frame, RAWFMT_YUV420, frame->tempdata, |
3139 | frame->data); | 3139 | frame->data); |
3140 | } else { | 3140 | } else { |
3141 | if (frame->compressed) | 3141 | if (frame->compressed) |
3142 | decompress(ov, frame, frame->rawdata, frame->data); | 3142 | decompress(ov, frame, frame->rawdata, frame->data); |
@@ -3226,7 +3226,7 @@ ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n) | |||
3226 | frame->rawwidth = ((int)(in[9]) + 1) * 8; | 3226 | frame->rawwidth = ((int)(in[9]) + 1) * 8; |
3227 | frame->rawheight = ((int)(in[10]) + 1) * 8; | 3227 | frame->rawheight = ((int)(in[10]) + 1) * 8; |
3228 | 3228 | ||
3229 | PDEBUG(4, "Frame end, frame=%d, pnum=%d, w=%d, h=%d, recvd=%d", | 3229 | PDEBUG(4, "Frame end, frame=%d, pnum=%d, w=%d, h=%d, recvd=%d", |
3230 | ov->curframe, pnum, frame->rawwidth, frame->rawheight, | 3230 | ov->curframe, pnum, frame->rawwidth, frame->rawheight, |
3231 | frame->bytes_recvd); | 3231 | frame->bytes_recvd); |
3232 | 3232 | ||
@@ -3527,10 +3527,10 @@ ov51x_isoc_irq(struct urb *urb, struct pt_regs *regs) | |||
3527 | return; | 3527 | return; |
3528 | } | 3528 | } |
3529 | 3529 | ||
3530 | if (urb->status == -ENOENT || urb->status == -ECONNRESET) { | 3530 | if (urb->status == -ENOENT || urb->status == -ECONNRESET) { |
3531 | PDEBUG(4, "URB unlinked"); | 3531 | PDEBUG(4, "URB unlinked"); |
3532 | return; | 3532 | return; |
3533 | } | 3533 | } |
3534 | 3534 | ||
3535 | if (urb->status != -EINPROGRESS && urb->status != 0) { | 3535 | if (urb->status != -EINPROGRESS && urb->status != 0) { |
3536 | err("ERROR: urb->status=%d: %s", urb->status, | 3536 | err("ERROR: urb->status=%d: %s", urb->status, |
@@ -4627,8 +4627,8 @@ ov51x_v4l1_mmap(struct file *file, struct vm_area_struct *vma) | |||
4627 | PDEBUG(4, "mmap: %ld (%lX) bytes", size, size); | 4627 | PDEBUG(4, "mmap: %ld (%lX) bytes", size, size); |
4628 | 4628 | ||
4629 | if (size > (((OV511_NUMFRAMES | 4629 | if (size > (((OV511_NUMFRAMES |
4630 | * MAX_DATA_SIZE(ov->maxwidth, ov->maxheight) | 4630 | * MAX_DATA_SIZE(ov->maxwidth, ov->maxheight) |
4631 | + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))) | 4631 | + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))) |
4632 | return -EINVAL; | 4632 | return -EINVAL; |
4633 | 4633 | ||
4634 | if (mutex_lock_interruptible(&ov->lock)) | 4634 | if (mutex_lock_interruptible(&ov->lock)) |
@@ -5062,7 +5062,7 @@ ov6xx0_configure(struct usb_ov511 *ov) | |||
5062 | } | 5062 | } |
5063 | 5063 | ||
5064 | /* This initializes the KS0127 and KS0127B video decoders. */ | 5064 | /* This initializes the KS0127 and KS0127B video decoders. */ |
5065 | static int | 5065 | static int |
5066 | ks0127_configure(struct usb_ov511 *ov) | 5066 | ks0127_configure(struct usb_ov511 *ov) |
5067 | { | 5067 | { |
5068 | int rc; | 5068 | int rc; |
@@ -5193,7 +5193,7 @@ saa7111a_configure(struct usb_ov511 *ov) | |||
5193 | return -1; | 5193 | return -1; |
5194 | 5194 | ||
5195 | /* Detect version of decoder. This must be done after writing the | 5195 | /* Detect version of decoder. This must be done after writing the |
5196 | * initial regs or the decoder will lock up. */ | 5196 | * initial regs or the decoder will lock up. */ |
5197 | rc = i2c_r(ov, 0x00); | 5197 | rc = i2c_r(ov, 0x00); |
5198 | 5198 | ||
5199 | if (rc < 0) { | 5199 | if (rc < 0) { |
@@ -5216,13 +5216,13 @@ saa7111a_configure(struct usb_ov511 *ov) | |||
5216 | } | 5216 | } |
5217 | 5217 | ||
5218 | /* This initializes the OV511/OV511+ and the sensor */ | 5218 | /* This initializes the OV511/OV511+ and the sensor */ |
5219 | static int | 5219 | static int |
5220 | ov511_configure(struct usb_ov511 *ov) | 5220 | ov511_configure(struct usb_ov511 *ov) |
5221 | { | 5221 | { |
5222 | static struct ov511_regvals aRegvalsInit511[] = { | 5222 | static struct ov511_regvals aRegvalsInit511[] = { |
5223 | { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, | 5223 | { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, |
5224 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, | 5224 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, |
5225 | { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, | 5225 | { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, |
5226 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, | 5226 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, |
5227 | { OV511_REG_BUS, R51x_SYS_RESET, 0x3f }, | 5227 | { OV511_REG_BUS, R51x_SYS_RESET, 0x3f }, |
5228 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, | 5228 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, |
@@ -5269,7 +5269,7 @@ ov511_configure(struct usb_ov511 *ov) | |||
5269 | err("Please notify " EMAIL " of the name,"); | 5269 | err("Please notify " EMAIL " of the name,"); |
5270 | err("manufacturer, model, and this number of your camera."); | 5270 | err("manufacturer, model, and this number of your camera."); |
5271 | err("Also include the output of the detection process."); | 5271 | err("Also include the output of the detection process."); |
5272 | } | 5272 | } |
5273 | 5273 | ||
5274 | if (ov->customid == 70) /* USB Life TV (PAL/SECAM) */ | 5274 | if (ov->customid == 70) /* USB Life TV (PAL/SECAM) */ |
5275 | ov->pal = 1; | 5275 | ov->pal = 1; |
@@ -5336,17 +5336,17 @@ ov511_configure(struct usb_ov511 *ov) | |||
5336 | 5336 | ||
5337 | if (i2c_w(ov, 0x10, 0x00) < 0) { | 5337 | if (i2c_w(ov, 0x10, 0x00) < 0) { |
5338 | err("Can't determine sensor slave IDs"); | 5338 | err("Can't determine sensor slave IDs"); |
5339 | goto error; | 5339 | goto error; |
5340 | } else { | 5340 | } else { |
5341 | if (ks0127_configure(ov) < 0) { | 5341 | if (ks0127_configure(ov) < 0) { |
5342 | err("Failed to configure KS0127"); | 5342 | err("Failed to configure KS0127"); |
5343 | goto error; | 5343 | goto error; |
5344 | } | 5344 | } |
5345 | } | 5345 | } |
5346 | } else { | 5346 | } else { |
5347 | if (saa7111a_configure(ov) < 0) { | 5347 | if (saa7111a_configure(ov) < 0) { |
5348 | err("Failed to configure SAA7111A"); | 5348 | err("Failed to configure SAA7111A"); |
5349 | goto error; | 5349 | goto error; |
5350 | } | 5350 | } |
5351 | } | 5351 | } |
5352 | } else { | 5352 | } else { |
@@ -5356,13 +5356,13 @@ ov511_configure(struct usb_ov511 *ov) | |||
5356 | } else { | 5356 | } else { |
5357 | if (ov6xx0_configure(ov) < 0) { | 5357 | if (ov6xx0_configure(ov) < 0) { |
5358 | err("Failed to configure OV6xx0"); | 5358 | err("Failed to configure OV6xx0"); |
5359 | goto error; | 5359 | goto error; |
5360 | } | 5360 | } |
5361 | } | 5361 | } |
5362 | } else { | 5362 | } else { |
5363 | if (ov7xx0_configure(ov) < 0) { | 5363 | if (ov7xx0_configure(ov) < 0) { |
5364 | err("Failed to configure OV7xx0"); | 5364 | err("Failed to configure OV7xx0"); |
5365 | goto error; | 5365 | goto error; |
5366 | } | 5366 | } |
5367 | } | 5367 | } |
5368 | 5368 | ||
@@ -5381,12 +5381,12 @@ ov518_configure(struct usb_ov511 *ov) | |||
5381 | /* For 518 and 518+ */ | 5381 | /* For 518 and 518+ */ |
5382 | static struct ov511_regvals aRegvalsInit518[] = { | 5382 | static struct ov511_regvals aRegvalsInit518[] = { |
5383 | { OV511_REG_BUS, R51x_SYS_RESET, 0x40 }, | 5383 | { OV511_REG_BUS, R51x_SYS_RESET, 0x40 }, |
5384 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, | 5384 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, |
5385 | { OV511_REG_BUS, R51x_SYS_RESET, 0x3e }, | 5385 | { OV511_REG_BUS, R51x_SYS_RESET, 0x3e }, |
5386 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, | 5386 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, |
5387 | { OV511_REG_BUS, R51x_SYS_RESET, 0x00 }, | 5387 | { OV511_REG_BUS, R51x_SYS_RESET, 0x00 }, |
5388 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, | 5388 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, |
5389 | { OV511_REG_BUS, 0x46, 0x00 }, | 5389 | { OV511_REG_BUS, 0x46, 0x00 }, |
5390 | { OV511_REG_BUS, 0x5d, 0x03 }, | 5390 | { OV511_REG_BUS, 0x5d, 0x03 }, |
5391 | { OV511_DONE_BUS, 0x0, 0x00}, | 5391 | { OV511_DONE_BUS, 0x0, 0x00}, |
5392 | }; | 5392 | }; |
@@ -5517,7 +5517,7 @@ ov518_configure(struct usb_ov511 *ov) | |||
5517 | 5517 | ||
5518 | if (init_ov_sensor(ov) < 0) { | 5518 | if (init_ov_sensor(ov) < 0) { |
5519 | err("Can't determine sensor slave IDs"); | 5519 | err("Can't determine sensor slave IDs"); |
5520 | goto error; | 5520 | goto error; |
5521 | } else { | 5521 | } else { |
5522 | err("Detected unsupported OV8xx0 sensor"); | 5522 | err("Detected unsupported OV8xx0 sensor"); |
5523 | goto error; | 5523 | goto error; |
@@ -5525,13 +5525,13 @@ ov518_configure(struct usb_ov511 *ov) | |||
5525 | } else { | 5525 | } else { |
5526 | if (ov6xx0_configure(ov) < 0) { | 5526 | if (ov6xx0_configure(ov) < 0) { |
5527 | err("Failed to configure OV6xx0"); | 5527 | err("Failed to configure OV6xx0"); |
5528 | goto error; | 5528 | goto error; |
5529 | } | 5529 | } |
5530 | } | 5530 | } |
5531 | } else { | 5531 | } else { |
5532 | if (ov7xx0_configure(ov) < 0) { | 5532 | if (ov7xx0_configure(ov) < 0) { |
5533 | err("Failed to configure OV7xx0"); | 5533 | err("Failed to configure OV7xx0"); |
5534 | goto error; | 5534 | goto error; |
5535 | } | 5535 | } |
5536 | } | 5536 | } |
5537 | 5537 | ||
@@ -5564,28 +5564,28 @@ static ssize_t show_custom_id(struct class_device *cd, char *buf) | |||
5564 | { | 5564 | { |
5565 | struct usb_ov511 *ov = cd_to_ov(cd); | 5565 | struct usb_ov511 *ov = cd_to_ov(cd); |
5566 | return sprintf(buf, "%d\n", ov->customid); | 5566 | return sprintf(buf, "%d\n", ov->customid); |
5567 | } | 5567 | } |
5568 | static CLASS_DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL); | 5568 | static CLASS_DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL); |
5569 | 5569 | ||
5570 | static ssize_t show_model(struct class_device *cd, char *buf) | 5570 | static ssize_t show_model(struct class_device *cd, char *buf) |
5571 | { | 5571 | { |
5572 | struct usb_ov511 *ov = cd_to_ov(cd); | 5572 | struct usb_ov511 *ov = cd_to_ov(cd); |
5573 | return sprintf(buf, "%s\n", ov->desc); | 5573 | return sprintf(buf, "%s\n", ov->desc); |
5574 | } | 5574 | } |
5575 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); | 5575 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); |
5576 | 5576 | ||
5577 | static ssize_t show_bridge(struct class_device *cd, char *buf) | 5577 | static ssize_t show_bridge(struct class_device *cd, char *buf) |
5578 | { | 5578 | { |
5579 | struct usb_ov511 *ov = cd_to_ov(cd); | 5579 | struct usb_ov511 *ov = cd_to_ov(cd); |
5580 | return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge)); | 5580 | return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge)); |
5581 | } | 5581 | } |
5582 | static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL); | 5582 | static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL); |
5583 | 5583 | ||
5584 | static ssize_t show_sensor(struct class_device *cd, char *buf) | 5584 | static ssize_t show_sensor(struct class_device *cd, char *buf) |
5585 | { | 5585 | { |
5586 | struct usb_ov511 *ov = cd_to_ov(cd); | 5586 | struct usb_ov511 *ov = cd_to_ov(cd); |
5587 | return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor)); | 5587 | return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor)); |
5588 | } | 5588 | } |
5589 | static CLASS_DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL); | 5589 | static CLASS_DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL); |
5590 | 5590 | ||
5591 | static ssize_t show_brightness(struct class_device *cd, char *buf) | 5591 | static ssize_t show_brightness(struct class_device *cd, char *buf) |
@@ -5597,7 +5597,7 @@ static ssize_t show_brightness(struct class_device *cd, char *buf) | |||
5597 | return -ENODEV; | 5597 | return -ENODEV; |
5598 | sensor_get_brightness(ov, &x); | 5598 | sensor_get_brightness(ov, &x); |
5599 | return sprintf(buf, "%d\n", x >> 8); | 5599 | return sprintf(buf, "%d\n", x >> 8); |
5600 | } | 5600 | } |
5601 | static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); | 5601 | static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); |
5602 | 5602 | ||
5603 | static ssize_t show_saturation(struct class_device *cd, char *buf) | 5603 | static ssize_t show_saturation(struct class_device *cd, char *buf) |
@@ -5609,7 +5609,7 @@ static ssize_t show_saturation(struct class_device *cd, char *buf) | |||
5609 | return -ENODEV; | 5609 | return -ENODEV; |
5610 | sensor_get_saturation(ov, &x); | 5610 | sensor_get_saturation(ov, &x); |
5611 | return sprintf(buf, "%d\n", x >> 8); | 5611 | return sprintf(buf, "%d\n", x >> 8); |
5612 | } | 5612 | } |
5613 | static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); | 5613 | static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); |
5614 | 5614 | ||
5615 | static ssize_t show_contrast(struct class_device *cd, char *buf) | 5615 | static ssize_t show_contrast(struct class_device *cd, char *buf) |
@@ -5621,7 +5621,7 @@ static ssize_t show_contrast(struct class_device *cd, char *buf) | |||
5621 | return -ENODEV; | 5621 | return -ENODEV; |
5622 | sensor_get_contrast(ov, &x); | 5622 | sensor_get_contrast(ov, &x); |
5623 | return sprintf(buf, "%d\n", x >> 8); | 5623 | return sprintf(buf, "%d\n", x >> 8); |
5624 | } | 5624 | } |
5625 | static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); | 5625 | static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); |
5626 | 5626 | ||
5627 | static ssize_t show_hue(struct class_device *cd, char *buf) | 5627 | static ssize_t show_hue(struct class_device *cd, char *buf) |
@@ -5633,7 +5633,7 @@ static ssize_t show_hue(struct class_device *cd, char *buf) | |||
5633 | return -ENODEV; | 5633 | return -ENODEV; |
5634 | sensor_get_hue(ov, &x); | 5634 | sensor_get_hue(ov, &x); |
5635 | return sprintf(buf, "%d\n", x >> 8); | 5635 | return sprintf(buf, "%d\n", x >> 8); |
5636 | } | 5636 | } |
5637 | static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); | 5637 | static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); |
5638 | 5638 | ||
5639 | static ssize_t show_exposure(struct class_device *cd, char *buf) | 5639 | static ssize_t show_exposure(struct class_device *cd, char *buf) |
@@ -5645,7 +5645,7 @@ static ssize_t show_exposure(struct class_device *cd, char *buf) | |||
5645 | return -ENODEV; | 5645 | return -ENODEV; |
5646 | sensor_get_exposure(ov, &exp); | 5646 | sensor_get_exposure(ov, &exp); |
5647 | return sprintf(buf, "%d\n", exp >> 8); | 5647 | return sprintf(buf, "%d\n", exp >> 8); |
5648 | } | 5648 | } |
5649 | static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); | 5649 | static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); |
5650 | 5650 | ||
5651 | static void ov_create_sysfs(struct video_device *vdev) | 5651 | static void ov_create_sysfs(struct video_device *vdev) |
diff --git a/drivers/usb/media/ov511.h b/drivers/media/video/ov511.h index bce9b3633889..12b3d51e1c34 100644 --- a/drivers/usb/media/ov511.h +++ b/drivers/media/video/ov511.h | |||
@@ -130,7 +130,7 @@ | |||
130 | #define R511_COMP_QVY 0x76 | 130 | #define R511_COMP_QVY 0x76 |
131 | #define R511_COMP_QVUV 0x77 | 131 | #define R511_COMP_QVUV 0x77 |
132 | #define R511_COMP_EN 0x78 | 132 | #define R511_COMP_EN 0x78 |
133 | #define R511_COMP_LUT_EN 0x79 | 133 | #define R511_COMP_LUT_EN 0x79 |
134 | #define R511_COMP_LUT_BEGIN 0x80 | 134 | #define R511_COMP_LUT_BEGIN 0x80 |
135 | 135 | ||
136 | /* --------------------------------- */ | 136 | /* --------------------------------- */ |
@@ -459,14 +459,14 @@ struct usb_ov511 { | |||
459 | int subh; /* Pix Array subcapture height */ | 459 | int subh; /* Pix Array subcapture height */ |
460 | 460 | ||
461 | int curframe; /* Current receiving sbuf */ | 461 | int curframe; /* Current receiving sbuf */ |
462 | struct ov511_frame frame[OV511_NUMFRAMES]; | 462 | struct ov511_frame frame[OV511_NUMFRAMES]; |
463 | 463 | ||
464 | struct ov511_sbuf sbuf[OV511_NUMSBUF]; | 464 | struct ov511_sbuf sbuf[OV511_NUMSBUF]; |
465 | 465 | ||
466 | wait_queue_head_t wq; /* Processes waiting */ | 466 | wait_queue_head_t wq; /* Processes waiting */ |
467 | 467 | ||
468 | int snap_enabled; /* Snapshot mode enabled */ | 468 | int snap_enabled; /* Snapshot mode enabled */ |
469 | 469 | ||
470 | int bridge; /* Type of bridge (BRG_*) */ | 470 | int bridge; /* Type of bridge (BRG_*) */ |
471 | int bclass; /* Class of bridge (BCL_*) */ | 471 | int bclass; /* Class of bridge (BCL_*) */ |
472 | int sensor; /* Type of image sensor chip (SEN_*) */ | 472 | int sensor; /* Type of image sensor chip (SEN_*) */ |
@@ -512,7 +512,7 @@ struct symbolic_list { | |||
512 | /* Returns the name of the matching element in the symbolic_list array. The | 512 | /* Returns the name of the matching element in the symbolic_list array. The |
513 | * end of the list must be marked with an element that has a NULL name. | 513 | * end of the list must be marked with an element that has a NULL name. |
514 | */ | 514 | */ |
515 | static inline char * | 515 | static inline char * |
516 | symbolic(struct symbolic_list list[], int num) | 516 | symbolic(struct symbolic_list list[], int num) |
517 | { | 517 | { |
518 | int i; | 518 | int i; |
diff --git a/drivers/media/video/ovcamchip/Makefile b/drivers/media/video/ovcamchip/Makefile index bca41ad93de8..cba4cdf20f49 100644 --- a/drivers/media/video/ovcamchip/Makefile +++ b/drivers/media/video/ovcamchip/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | ovcamchip-objs := ovcamchip_core.o ov6x20.o ov6x30.o ov7x10.o ov7x20.o \ | 1 | ovcamchip-objs := ovcamchip_core.o ov6x20.o ov6x30.o ov7x10.o ov7x20.o \ |
2 | ov76be.o | 2 | ov76be.o |
3 | 3 | ||
4 | obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip.o | 4 | obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip.o |
diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index e76b53d5909c..3fe9fa04cd84 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c | |||
@@ -266,17 +266,17 @@ static int ovcamchip_detect(struct i2c_client *c) | |||
266 | PDEBUG(3, "Testing for 0V6xx0"); | 266 | PDEBUG(3, "Testing for 0V6xx0"); |
267 | c->addr = OV6xx0_SID; | 267 | c->addr = OV6xx0_SID; |
268 | if (init_camchip(c) < 0) { | 268 | if (init_camchip(c) < 0) { |
269 | return -ENODEV; | 269 | return -ENODEV; |
270 | } else { | 270 | } else { |
271 | if (ov6xx0_detect(c) < 0) { | 271 | if (ov6xx0_detect(c) < 0) { |
272 | PERROR("Failed to init OV6xx0"); | 272 | PERROR("Failed to init OV6xx0"); |
273 | return -EIO; | 273 | return -EIO; |
274 | } | 274 | } |
275 | } | 275 | } |
276 | } else { | 276 | } else { |
277 | if (ov7xx0_detect(c) < 0) { | 277 | if (ov7xx0_detect(c) < 0) { |
278 | PERROR("Failed to init OV7xx0"); | 278 | PERROR("Failed to init OV7xx0"); |
279 | return -EIO; | 279 | return -EIO; |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
diff --git a/drivers/media/video/ovcamchip/ovcamchip_priv.h b/drivers/media/video/ovcamchip/ovcamchip_priv.h index 575e612a5546..1231335a9f4a 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_priv.h +++ b/drivers/media/video/ovcamchip/ovcamchip_priv.h | |||
@@ -82,6 +82,6 @@ extern int ov_write_regvals(struct i2c_client *c, | |||
82 | struct ovcamchip_regvals *rvals); | 82 | struct ovcamchip_regvals *rvals); |
83 | 83 | ||
84 | extern int ov_write_mask(struct i2c_client *c, unsigned char reg, | 84 | extern int ov_write_mask(struct i2c_client *c, unsigned char reg, |
85 | unsigned char value, unsigned char mask); | 85 | unsigned char value, unsigned char mask); |
86 | 86 | ||
87 | #endif | 87 | #endif |
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c index 15fd85acabda..522e9ddeb089 100644 --- a/drivers/media/video/planb.c +++ b/drivers/media/video/planb.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | planb - PlanB frame grabber driver | 2 | planb - PlanB frame grabber driver |
3 | 3 | ||
4 | PlanB is used in the 7x00/8x00 series of PowerMacintosh | 4 | PlanB is used in the 7x00/8x00 series of PowerMacintosh |
@@ -584,7 +584,7 @@ finish: | |||
584 | wake_up_interruptible(&pb->suspendq); | 584 | wake_up_interruptible(&pb->suspendq); |
585 | } | 585 | } |
586 | 586 | ||
587 | static void add_clip(struct planb *pb, struct video_clip *clip) | 587 | static void add_clip(struct planb *pb, struct video_clip *clip) |
588 | { | 588 | { |
589 | volatile unsigned char *base; | 589 | volatile unsigned char *base; |
590 | int xc = clip->x, yc = clip->y; | 590 | int xc = clip->x, yc = clip->y; |
@@ -758,7 +758,7 @@ static void cmd_buff(struct planb *pb) | |||
758 | PLANB_SET(CH_SYNC)); | 758 | PLANB_SET(CH_SYNC)); |
759 | tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), | 759 | tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), |
760 | PLANB_SET(DMA_ABORT)); | 760 | PLANB_SET(DMA_ABORT)); |
761 | 761 | ||
762 | /* odd field data: */ | 762 | /* odd field data: */ |
763 | jump = virt_to_bus(c1 + nlines / 2); | 763 | jump = virt_to_bus(c1 + nlines / 2); |
764 | for (i=1; i < nlines; i += stepsize, c1++) | 764 | for (i=1; i < nlines; i += stepsize, c1++) |
@@ -1247,7 +1247,7 @@ static volatile struct dbdma_cmd *setup_grab_cmd(int fr, struct planb *pb) | |||
1247 | tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++; | 1247 | tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++; |
1248 | tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), | 1248 | tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), |
1249 | PLANB_SET(DMA_ABORT)); | 1249 | PLANB_SET(DMA_ABORT)); |
1250 | 1250 | ||
1251 | /* odd field data: */ | 1251 | /* odd field data: */ |
1252 | jump_addr = c1 + TAB_FACTOR * nlines / 2; | 1252 | jump_addr = c1 + TAB_FACTOR * nlines / 2; |
1253 | jump = virt_to_bus(jump_addr); | 1253 | jump = virt_to_bus(jump_addr); |
@@ -1383,7 +1383,7 @@ static int planb_open(struct video_device *dev, int mode) | |||
1383 | pb->user++; | 1383 | pb->user++; |
1384 | 1384 | ||
1385 | DEBUG("PlanB: device opened\n"); | 1385 | DEBUG("PlanB: device opened\n"); |
1386 | return 0; | 1386 | return 0; |
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | static void planb_close(struct video_device *dev) | 1389 | static void planb_close(struct video_device *dev) |
@@ -1424,9 +1424,9 @@ static long planb_write(struct video_device *v, const char *buf, | |||
1424 | static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | 1424 | static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) |
1425 | { | 1425 | { |
1426 | struct planb *pb=(struct planb *)dev; | 1426 | struct planb *pb=(struct planb *)dev; |
1427 | 1427 | ||
1428 | switch (cmd) | 1428 | switch (cmd) |
1429 | { | 1429 | { |
1430 | case VIDIOCGCAP: | 1430 | case VIDIOCGCAP: |
1431 | { | 1431 | { |
1432 | struct video_capability b; | 1432 | struct video_capability b; |
@@ -1440,26 +1440,26 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1440 | b.channels = 2; /* composite & svhs */ | 1440 | b.channels = 2; /* composite & svhs */ |
1441 | b.audios = 0; | 1441 | b.audios = 0; |
1442 | b.maxwidth = PLANB_MAXPIXELS; | 1442 | b.maxwidth = PLANB_MAXPIXELS; |
1443 | b.maxheight = PLANB_MAXLINES; | 1443 | b.maxheight = PLANB_MAXLINES; |
1444 | b.minwidth = 32; /* wild guess */ | 1444 | b.minwidth = 32; /* wild guess */ |
1445 | b.minheight = 32; | 1445 | b.minheight = 32; |
1446 | if (copy_to_user(arg,&b,sizeof(b))) | 1446 | if (copy_to_user(arg,&b,sizeof(b))) |
1447 | return -EFAULT; | 1447 | return -EFAULT; |
1448 | return 0; | 1448 | return 0; |
1449 | } | 1449 | } |
1450 | case VIDIOCSFBUF: | 1450 | case VIDIOCSFBUF: |
1451 | { | 1451 | { |
1452 | struct video_buffer v; | 1452 | struct video_buffer v; |
1453 | unsigned short bpp; | 1453 | unsigned short bpp; |
1454 | unsigned int fmt; | 1454 | unsigned int fmt; |
1455 | 1455 | ||
1456 | DEBUG("PlanB: IOCTL VIDIOCSFBUF\n"); | 1456 | DEBUG("PlanB: IOCTL VIDIOCSFBUF\n"); |
1457 | 1457 | ||
1458 | if (!capable(CAP_SYS_ADMIN) | 1458 | if (!capable(CAP_SYS_ADMIN) |
1459 | || !capable(CAP_SYS_RAWIO)) | 1459 | || !capable(CAP_SYS_RAWIO)) |
1460 | return -EPERM; | 1460 | return -EPERM; |
1461 | if (copy_from_user(&v, arg,sizeof(v))) | 1461 | if (copy_from_user(&v, arg,sizeof(v))) |
1462 | return -EFAULT; | 1462 | return -EFAULT; |
1463 | planb_lock(pb); | 1463 | planb_lock(pb); |
1464 | switch(v.depth) { | 1464 | switch(v.depth) { |
1465 | case 8: | 1465 | case 8: |
@@ -1478,7 +1478,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1478 | break; | 1478 | break; |
1479 | default: | 1479 | default: |
1480 | planb_unlock(pb); | 1480 | planb_unlock(pb); |
1481 | return -EINVAL; | 1481 | return -EINVAL; |
1482 | } | 1482 | } |
1483 | if (bpp * v.width > v.bytesperline) { | 1483 | if (bpp * v.width > v.bytesperline) { |
1484 | planb_unlock(pb); | 1484 | planb_unlock(pb); |
@@ -1493,7 +1493,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1493 | pb->win.bpl = pb->win.bpp * pb->win.swidth; | 1493 | pb->win.bpl = pb->win.bpp * pb->win.swidth; |
1494 | pb->win.pad = v.bytesperline - pb->win.bpl; | 1494 | pb->win.pad = v.bytesperline - pb->win.bpl; |
1495 | 1495 | ||
1496 | DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d," | 1496 | DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d," |
1497 | " bpl %d (+ %d)\n", v.base, v.width,v.height, | 1497 | " bpl %d (+ %d)\n", v.base, v.width,v.height, |
1498 | pb->win.bpp, pb->win.bpl, pb->win.pad); | 1498 | pb->win.bpp, pb->win.bpl, pb->win.pad); |
1499 | 1499 | ||
@@ -1504,11 +1504,11 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1504 | resume_overlay(pb); | 1504 | resume_overlay(pb); |
1505 | } | 1505 | } |
1506 | planb_unlock(pb); | 1506 | planb_unlock(pb); |
1507 | return 0; | 1507 | return 0; |
1508 | } | 1508 | } |
1509 | case VIDIOCGFBUF: | 1509 | case VIDIOCGFBUF: |
1510 | { | 1510 | { |
1511 | struct video_buffer v; | 1511 | struct video_buffer v; |
1512 | 1512 | ||
1513 | DEBUG("PlanB: IOCTL VIDIOCGFBUF\n"); | 1513 | DEBUG("PlanB: IOCTL VIDIOCGFBUF\n"); |
1514 | 1514 | ||
@@ -1518,15 +1518,15 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1518 | v.depth = pb->win.depth; | 1518 | v.depth = pb->win.depth; |
1519 | v.bytesperline = pb->win.bpl + pb->win.pad; | 1519 | v.bytesperline = pb->win.bpl + pb->win.pad; |
1520 | if (copy_to_user(arg, &v, sizeof(v))) | 1520 | if (copy_to_user(arg, &v, sizeof(v))) |
1521 | return -EFAULT; | 1521 | return -EFAULT; |
1522 | return 0; | 1522 | return 0; |
1523 | } | 1523 | } |
1524 | case VIDIOCCAPTURE: | 1524 | case VIDIOCCAPTURE: |
1525 | { | 1525 | { |
1526 | int i; | 1526 | int i; |
1527 | 1527 | ||
1528 | if(copy_from_user(&i, arg, sizeof(i))) | 1528 | if(copy_from_user(&i, arg, sizeof(i))) |
1529 | return -EFAULT; | 1529 | return -EFAULT; |
1530 | if(i==0) { | 1530 | if(i==0) { |
1531 | DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n"); | 1531 | DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n"); |
1532 | 1532 | ||
@@ -1695,7 +1695,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1695 | struct video_window vw; | 1695 | struct video_window vw; |
1696 | struct video_clip clip; | 1696 | struct video_clip clip; |
1697 | int i; | 1697 | int i; |
1698 | 1698 | ||
1699 | DEBUG("PlanB: IOCTL VIDIOCSWIN\n"); | 1699 | DEBUG("PlanB: IOCTL VIDIOCSWIN\n"); |
1700 | 1700 | ||
1701 | if(copy_from_user(&vw,arg,sizeof(vw))) | 1701 | if(copy_from_user(&vw,arg,sizeof(vw))) |
@@ -1749,7 +1749,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1749 | return -EFAULT; | 1749 | return -EFAULT; |
1750 | return 0; | 1750 | return 0; |
1751 | } | 1751 | } |
1752 | case VIDIOCSYNC: { | 1752 | case VIDIOCSYNC: { |
1753 | int i; | 1753 | int i; |
1754 | 1754 | ||
1755 | IDEBUG("PlanB: IOCTL VIDIOCSYNC\n"); | 1755 | IDEBUG("PlanB: IOCTL VIDIOCSYNC\n"); |
@@ -1759,42 +1759,42 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1759 | 1759 | ||
1760 | IDEBUG("PlanB: sync to frame %d\n", i); | 1760 | IDEBUG("PlanB: sync to frame %d\n", i); |
1761 | 1761 | ||
1762 | if(i > (MAX_GBUFFERS - 1) || i < 0) | 1762 | if(i > (MAX_GBUFFERS - 1) || i < 0) |
1763 | return -EINVAL; | 1763 | return -EINVAL; |
1764 | chk_grab: | 1764 | chk_grab: |
1765 | switch (pb->frame_stat[i]) { | 1765 | switch (pb->frame_stat[i]) { |
1766 | case GBUFFER_UNUSED: | 1766 | case GBUFFER_UNUSED: |
1767 | return -EINVAL; | 1767 | return -EINVAL; |
1768 | case GBUFFER_GRABBING: | 1768 | case GBUFFER_GRABBING: |
1769 | IDEBUG("PlanB: waiting for grab" | 1769 | IDEBUG("PlanB: waiting for grab" |
1770 | " done (%d)\n", i); | 1770 | " done (%d)\n", i); |
1771 | interruptible_sleep_on(&pb->capq); | 1771 | interruptible_sleep_on(&pb->capq); |
1772 | if(signal_pending(current)) | 1772 | if(signal_pending(current)) |
1773 | return -EINTR; | 1773 | return -EINTR; |
1774 | goto chk_grab; | 1774 | goto chk_grab; |
1775 | case GBUFFER_DONE: | 1775 | case GBUFFER_DONE: |
1776 | pb->frame_stat[i] = GBUFFER_UNUSED; | 1776 | pb->frame_stat[i] = GBUFFER_UNUSED; |
1777 | break; | 1777 | break; |
1778 | } | 1778 | } |
1779 | return 0; | 1779 | return 0; |
1780 | } | 1780 | } |
1781 | 1781 | ||
1782 | case VIDIOCMCAPTURE: | 1782 | case VIDIOCMCAPTURE: |
1783 | { | 1783 | { |
1784 | struct video_mmap vm; | 1784 | struct video_mmap vm; |
1785 | volatile unsigned int status; | 1785 | volatile unsigned int status; |
1786 | 1786 | ||
1787 | IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n"); | 1787 | IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n"); |
1788 | 1788 | ||
1789 | if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm))) | 1789 | if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm))) |
1790 | return -EFAULT; | 1790 | return -EFAULT; |
1791 | status = pb->frame_stat[vm.frame]; | 1791 | status = pb->frame_stat[vm.frame]; |
1792 | if (status != GBUFFER_UNUSED) | 1792 | if (status != GBUFFER_UNUSED) |
1793 | return -EBUSY; | 1793 | return -EBUSY; |
1794 | 1794 | ||
1795 | return vgrab(pb, &vm); | 1795 | return vgrab(pb, &vm); |
1796 | } | 1796 | } |
1797 | 1797 | ||
1798 | case VIDIOCGMBUF: | 1798 | case VIDIOCGMBUF: |
1799 | { | 1799 | { |
1800 | int i; | 1800 | int i; |
@@ -1811,7 +1811,7 @@ chk_grab: | |||
1811 | return -EFAULT; | 1811 | return -EFAULT; |
1812 | return 0; | 1812 | return 0; |
1813 | } | 1813 | } |
1814 | 1814 | ||
1815 | case PLANBIOCGSAAREGS: | 1815 | case PLANBIOCGSAAREGS: |
1816 | { | 1816 | { |
1817 | struct planb_saa_regs preg; | 1817 | struct planb_saa_regs preg; |
@@ -1828,7 +1828,7 @@ chk_grab: | |||
1828 | return -EFAULT; | 1828 | return -EFAULT; |
1829 | return 0; | 1829 | return 0; |
1830 | } | 1830 | } |
1831 | 1831 | ||
1832 | case PLANBIOCSSAAREGS: | 1832 | case PLANBIOCSSAAREGS: |
1833 | { | 1833 | { |
1834 | struct planb_saa_regs preg; | 1834 | struct planb_saa_regs preg; |
@@ -1842,7 +1842,7 @@ chk_grab: | |||
1842 | saa_set (preg.addr, preg.val, pb); | 1842 | saa_set (preg.addr, preg.val, pb); |
1843 | return 0; | 1843 | return 0; |
1844 | } | 1844 | } |
1845 | 1845 | ||
1846 | case PLANBIOCGSTAT: | 1846 | case PLANBIOCGSTAT: |
1847 | { | 1847 | { |
1848 | struct planb_stat_regs pstat; | 1848 | struct planb_stat_regs pstat; |
@@ -1859,7 +1859,7 @@ chk_grab: | |||
1859 | return -EFAULT; | 1859 | return -EFAULT; |
1860 | return 0; | 1860 | return 0; |
1861 | } | 1861 | } |
1862 | 1862 | ||
1863 | case PLANBIOCSMODE: { | 1863 | case PLANBIOCSMODE: { |
1864 | int v; | 1864 | int v; |
1865 | 1865 | ||
@@ -1985,10 +1985,10 @@ static int planb_mmap(struct vm_area_struct *vma, struct video_device *dev, cons | |||
1985 | { | 1985 | { |
1986 | int i; | 1986 | int i; |
1987 | struct planb *pb = (struct planb *)dev; | 1987 | struct planb *pb = (struct planb *)dev; |
1988 | unsigned long start = (unsigned long)adr; | 1988 | unsigned long start = (unsigned long)adr; |
1989 | 1989 | ||
1990 | if (size > MAX_GBUFFERS * PLANB_MAX_FBUF) | 1990 | if (size > MAX_GBUFFERS * PLANB_MAX_FBUF) |
1991 | return -EINVAL; | 1991 | return -EINVAL; |
1992 | if (!pb->rawbuf) { | 1992 | if (!pb->rawbuf) { |
1993 | int err; | 1993 | int err; |
1994 | if((err=grabbuf_alloc(pb))) | 1994 | if((err=grabbuf_alloc(pb))) |
@@ -2091,10 +2091,10 @@ static int init_planb(struct planb *pb) | |||
2091 | /* clear interrupt mask */ | 2091 | /* clear interrupt mask */ |
2092 | pb->intr_mask = PLANB_CLR_IRQ; | 2092 | pb->intr_mask = PLANB_CLR_IRQ; |
2093 | 2093 | ||
2094 | result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); | 2094 | result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); |
2095 | if (result < 0) { | 2095 | if (result < 0) { |
2096 | if (result==-EINVAL) | 2096 | if (result==-EINVAL) |
2097 | printk(KERN_ERR "PlanB: Bad irq number (%d) " | 2097 | printk(KERN_ERR "PlanB: Bad irq number (%d) " |
2098 | "or handler\n", (int)pb->irq); | 2098 | "or handler\n", (int)pb->irq); |
2099 | else if (result==-EBUSY) | 2099 | else if (result==-EBUSY) |
2100 | printk(KERN_ERR "PlanB: I don't know why, " | 2100 | printk(KERN_ERR "PlanB: I don't know why, " |
@@ -2102,7 +2102,7 @@ static int init_planb(struct planb *pb) | |||
2102 | return result; | 2102 | return result; |
2103 | } | 2103 | } |
2104 | disable_irq(pb->irq); | 2104 | disable_irq(pb->irq); |
2105 | 2105 | ||
2106 | /* Now add the template and register the device unit. */ | 2106 | /* Now add the template and register the device unit. */ |
2107 | memcpy(&pb->video_dev,&planb_template,sizeof(planb_template)); | 2107 | memcpy(&pb->video_dev,&planb_template,sizeof(planb_template)); |
2108 | 2108 | ||
@@ -2143,7 +2143,7 @@ static int init_planb(struct planb *pb) | |||
2143 | } | 2143 | } |
2144 | 2144 | ||
2145 | /* | 2145 | /* |
2146 | * Scan for a PlanB controller, request the irq and map the io memory | 2146 | * Scan for a PlanB controller, request the irq and map the io memory |
2147 | */ | 2147 | */ |
2148 | 2148 | ||
2149 | static int find_planb(void) | 2149 | static int find_planb(void) |
@@ -2171,9 +2171,9 @@ static int find_planb(void) | |||
2171 | pb = &planbs[0]; | 2171 | pb = &planbs[0]; |
2172 | planb_num = 1; | 2172 | planb_num = 1; |
2173 | 2173 | ||
2174 | if (planb_devices->n_addrs != 1) { | 2174 | if (planb_devices->n_addrs != 1) { |
2175 | printk (KERN_WARNING "PlanB: expecting 1 address for planb " | 2175 | printk (KERN_WARNING "PlanB: expecting 1 address for planb " |
2176 | "(got %d)", planb_devices->n_addrs); | 2176 | "(got %d)", planb_devices->n_addrs); |
2177 | return 0; | 2177 | return 0; |
2178 | } | 2178 | } |
2179 | 2179 | ||
@@ -2236,7 +2236,7 @@ static int find_planb(void) | |||
2236 | pb->planb_base = planb_regs; | 2236 | pb->planb_base = planb_regs; |
2237 | pb->planb_base_phys = (struct planb_registers *)new_base; | 2237 | pb->planb_base_phys = (struct planb_registers *)new_base; |
2238 | pb->irq = irq; | 2238 | pb->irq = irq; |
2239 | 2239 | ||
2240 | return planb_num; | 2240 | return planb_num; |
2241 | 2241 | ||
2242 | err_out_disable: | 2242 | err_out_disable: |
@@ -2251,7 +2251,7 @@ static void release_planb(void) | |||
2251 | int i; | 2251 | int i; |
2252 | struct planb *pb; | 2252 | struct planb *pb; |
2253 | 2253 | ||
2254 | for (i=0;i<planb_num; i++) | 2254 | for (i=0;i<planb_num; i++) |
2255 | { | 2255 | { |
2256 | pb=&planbs[i]; | 2256 | pb=&planbs[i]; |
2257 | 2257 | ||
@@ -2278,7 +2278,7 @@ static void release_planb(void) | |||
2278 | static int __init init_planbs(void) | 2278 | static int __init init_planbs(void) |
2279 | { | 2279 | { |
2280 | int i; | 2280 | int i; |
2281 | 2281 | ||
2282 | if (find_planb()<=0) | 2282 | if (find_planb()<=0) |
2283 | return -EIO; | 2283 | return -EIO; |
2284 | 2284 | ||
@@ -2288,9 +2288,9 @@ static int __init init_planbs(void) | |||
2288 | " with v4l\n", i); | 2288 | " with v4l\n", i); |
2289 | release_planb(); | 2289 | release_planb(); |
2290 | return -EIO; | 2290 | return -EIO; |
2291 | } | 2291 | } |
2292 | printk(KERN_INFO "PlanB: registered device %d with v4l\n", i); | 2292 | printk(KERN_INFO "PlanB: registered device %d with v4l\n", i); |
2293 | } | 2293 | } |
2294 | return 0; | 2294 | return 0; |
2295 | } | 2295 | } |
2296 | 2296 | ||
diff --git a/drivers/media/video/planb.h b/drivers/media/video/planb.h index 79b6b561426e..92823211d0c5 100644 --- a/drivers/media/video/planb.h +++ b/drivers/media/video/planb.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | planb - PlanB frame grabber driver | 2 | planb - PlanB frame grabber driver |
3 | 3 | ||
4 | PlanB is used in the 7x00/8x00 series of PowerMacintosh | 4 | PlanB is used in the 7x00/8x00 series of PowerMacintosh |
@@ -167,7 +167,7 @@ struct planb { | |||
167 | struct video_device video_dev; | 167 | struct video_device video_dev; |
168 | struct video_picture picture; /* Current picture params */ | 168 | struct video_picture picture; /* Current picture params */ |
169 | struct video_audio audio_dev; /* Current audio params */ | 169 | struct video_audio audio_dev; /* Current audio params */ |
170 | 170 | ||
171 | volatile struct planb_registers *planb_base; /* virt base of planb */ | 171 | volatile struct planb_registers *planb_base; /* virt base of planb */ |
172 | struct planb_registers *planb_base_phys; /* phys base of planb */ | 172 | struct planb_registers *planb_base_phys; /* phys base of planb */ |
173 | void *priv_space; /* Org. alloc. mem for kfree */ | 173 | void *priv_space; /* Org. alloc. mem for kfree */ |
@@ -209,7 +209,7 @@ struct planb { | |||
209 | int gwidth[MAX_GBUFFERS], gheight[MAX_GBUFFERS]; | 209 | int gwidth[MAX_GBUFFERS], gheight[MAX_GBUFFERS]; |
210 | unsigned int gfmt[MAX_GBUFFERS]; | 210 | unsigned int gfmt[MAX_GBUFFERS]; |
211 | int gnorm_switch[MAX_GBUFFERS]; | 211 | int gnorm_switch[MAX_GBUFFERS]; |
212 | volatile unsigned int *frame_stat; | 212 | volatile unsigned int *frame_stat; |
213 | #define GBUFFER_UNUSED 0x00U | 213 | #define GBUFFER_UNUSED 0x00U |
214 | #define GBUFFER_GRABBING 0x01U | 214 | #define GBUFFER_GRABBING 0x01U |
215 | #define GBUFFER_DONE 0x02U | 215 | #define GBUFFER_DONE 0x02U |
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 05ca55939e77..09835ca098b1 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c | |||
@@ -12,10 +12,10 @@ | |||
12 | * Most of this code is directly derived from his userspace driver. | 12 | * Most of this code is directly derived from his userspace driver. |
13 | * His driver works so send any reports to alan@redhat.com unless the | 13 | * His driver works so send any reports to alan@redhat.com unless the |
14 | * userspace driver also doesn't work for you... | 14 | * userspace driver also doesn't work for you... |
15 | * | 15 | * |
16 | * Changes: | 16 | * Changes: |
17 | * 08/07/2003 Daniele Bellucci <bellucda@tiscali.it> | 17 | * 08/07/2003 Daniele Bellucci <bellucda@tiscali.it> |
18 | * - pms_capture: report back -EFAULT | 18 | * - pms_capture: report back -EFAULT |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
@@ -66,14 +66,14 @@ static int standard = 0; /* 0 - auto 1 - ntsc 2 - pal 3 - secam */ | |||
66 | /* | 66 | /* |
67 | * I/O ports and Shared Memory | 67 | * I/O ports and Shared Memory |
68 | */ | 68 | */ |
69 | 69 | ||
70 | static int io_port = 0x250; | 70 | static int io_port = 0x250; |
71 | static int data_port = 0x251; | 71 | static int data_port = 0x251; |
72 | static int mem_base = 0xC8000; | 72 | static int mem_base = 0xC8000; |
73 | static void __iomem *mem; | 73 | static void __iomem *mem; |
74 | static int video_nr = -1; | 74 | static int video_nr = -1; |
75 | 75 | ||
76 | 76 | ||
77 | 77 | ||
78 | static inline void mvv_write(u8 index, u8 value) | 78 | static inline void mvv_write(u8 index, u8 value) |
79 | { | 79 | { |
@@ -90,9 +90,9 @@ static int pms_i2c_stat(u8 slave) | |||
90 | { | 90 | { |
91 | int counter; | 91 | int counter; |
92 | int i; | 92 | int i; |
93 | 93 | ||
94 | outb(0x28, io_port); | 94 | outb(0x28, io_port); |
95 | 95 | ||
96 | counter=0; | 96 | counter=0; |
97 | while((inb(data_port)&0x01)==0) | 97 | while((inb(data_port)&0x01)==0) |
98 | if(counter++==256) | 98 | if(counter++==256) |
@@ -101,9 +101,9 @@ static int pms_i2c_stat(u8 slave) | |||
101 | while((inb(data_port)&0x01)!=0) | 101 | while((inb(data_port)&0x01)!=0) |
102 | if(counter++==256) | 102 | if(counter++==256) |
103 | break; | 103 | break; |
104 | 104 | ||
105 | outb(slave, io_port); | 105 | outb(slave, io_port); |
106 | 106 | ||
107 | counter=0; | 107 | counter=0; |
108 | while((inb(data_port)&0x01)==0) | 108 | while((inb(data_port)&0x01)==0) |
109 | if(counter++==256) | 109 | if(counter++==256) |
@@ -112,7 +112,7 @@ static int pms_i2c_stat(u8 slave) | |||
112 | while((inb(data_port)&0x01)!=0) | 112 | while((inb(data_port)&0x01)!=0) |
113 | if(counter++==256) | 113 | if(counter++==256) |
114 | break; | 114 | break; |
115 | 115 | ||
116 | for(i=0;i<12;i++) | 116 | for(i=0;i<12;i++) |
117 | { | 117 | { |
118 | char st=inb(data_port); | 118 | char st=inb(data_port); |
@@ -122,7 +122,7 @@ static int pms_i2c_stat(u8 slave) | |||
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | outb(0x29, io_port); | 124 | outb(0x29, io_port); |
125 | return inb(data_port); | 125 | return inb(data_port); |
126 | } | 126 | } |
127 | 127 | ||
128 | static int pms_i2c_write(u16 slave, u16 sub, u16 data) | 128 | static int pms_i2c_write(u16 slave, u16 sub, u16 data) |
@@ -130,19 +130,19 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data) | |||
130 | int skip=0; | 130 | int skip=0; |
131 | int count; | 131 | int count; |
132 | int i; | 132 | int i; |
133 | 133 | ||
134 | for(i=0;i<i2c_count;i++) | 134 | for(i=0;i<i2c_count;i++) |
135 | { | 135 | { |
136 | if((i2cinfo[i].slave==slave) && | 136 | if((i2cinfo[i].slave==slave) && |
137 | (i2cinfo[i].sub == sub)) | 137 | (i2cinfo[i].sub == sub)) |
138 | { | 138 | { |
139 | if(i2cinfo[i].data==data) | 139 | if(i2cinfo[i].data==data) |
140 | skip=1; | 140 | skip=1; |
141 | i2cinfo[i].data=data; | 141 | i2cinfo[i].data=data; |
142 | i=i2c_count+1; | 142 | i=i2c_count+1; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | if(i==i2c_count && i2c_count<64) | 146 | if(i==i2c_count && i2c_count<64) |
147 | { | 147 | { |
148 | i2cinfo[i2c_count].slave=slave; | 148 | i2cinfo[i2c_count].slave=slave; |
@@ -150,16 +150,16 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data) | |||
150 | i2cinfo[i2c_count].data=data; | 150 | i2cinfo[i2c_count].data=data; |
151 | i2c_count++; | 151 | i2c_count++; |
152 | } | 152 | } |
153 | 153 | ||
154 | if(skip) | 154 | if(skip) |
155 | return 0; | 155 | return 0; |
156 | 156 | ||
157 | mvv_write(0x29, sub); | 157 | mvv_write(0x29, sub); |
158 | mvv_write(0x2A, data); | 158 | mvv_write(0x2A, data); |
159 | mvv_write(0x28, slave); | 159 | mvv_write(0x28, slave); |
160 | 160 | ||
161 | outb(0x28, io_port); | 161 | outb(0x28, io_port); |
162 | 162 | ||
163 | count=0; | 163 | count=0; |
164 | while((inb(data_port)&1)==0) | 164 | while((inb(data_port)&1)==0) |
165 | if(count>255) | 165 | if(count>255) |
@@ -167,9 +167,9 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data) | |||
167 | while((inb(data_port)&1)!=0) | 167 | while((inb(data_port)&1)!=0) |
168 | if(count>255) | 168 | if(count>255) |
169 | break; | 169 | break; |
170 | 170 | ||
171 | count=inb(data_port); | 171 | count=inb(data_port); |
172 | 172 | ||
173 | if(count&2) | 173 | if(count&2) |
174 | return -1; | 174 | return -1; |
175 | return count; | 175 | return count; |
@@ -189,8 +189,8 @@ static int pms_i2c_read(int slave, int sub) | |||
189 | 189 | ||
190 | static void pms_i2c_andor(int slave, int sub, int and, int or) | 190 | static void pms_i2c_andor(int slave, int sub, int and, int or) |
191 | { | 191 | { |
192 | u8 tmp; | 192 | u8 tmp; |
193 | 193 | ||
194 | tmp=pms_i2c_read(slave, sub); | 194 | tmp=pms_i2c_read(slave, sub); |
195 | tmp = (tmp&and)|or; | 195 | tmp = (tmp&and)|or; |
196 | pms_i2c_write(slave, sub, tmp); | 196 | pms_i2c_write(slave, sub, tmp); |
@@ -199,7 +199,7 @@ static void pms_i2c_andor(int slave, int sub, int and, int or) | |||
199 | /* | 199 | /* |
200 | * Control functions | 200 | * Control functions |
201 | */ | 201 | */ |
202 | 202 | ||
203 | 203 | ||
204 | static void pms_videosource(short source) | 204 | static void pms_videosource(short source) |
205 | { | 205 | { |
@@ -234,8 +234,8 @@ static void pms_colour(short colour) | |||
234 | break; | 234 | break; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | 238 | ||
239 | static void pms_contrast(short contrast) | 239 | static void pms_contrast(short contrast) |
240 | { | 240 | { |
241 | switch(decoder) | 241 | switch(decoder) |
@@ -269,14 +269,14 @@ static void pms_format(short format) | |||
269 | { | 269 | { |
270 | int target; | 270 | int target; |
271 | standard = format; | 271 | standard = format; |
272 | 272 | ||
273 | if(decoder==PHILIPS1) | 273 | if(decoder==PHILIPS1) |
274 | target=0x42; | 274 | target=0x42; |
275 | else if(decoder==PHILIPS2) | 275 | else if(decoder==PHILIPS2) |
276 | target=0x8A; | 276 | target=0x8A; |
277 | else | 277 | else |
278 | return; | 278 | return; |
279 | 279 | ||
280 | switch(format) | 280 | switch(format) |
281 | { | 281 | { |
282 | case 0: /* Auto */ | 282 | case 0: /* Auto */ |
@@ -302,7 +302,7 @@ static void pms_format(short format) | |||
302 | 302 | ||
303 | /* | 303 | /* |
304 | * These features of the PMS card are not currently exposes. They | 304 | * These features of the PMS card are not currently exposes. They |
305 | * could become a private v4l ioctl for PMSCONFIG or somesuch if | 305 | * could become a private v4l ioctl for PMSCONFIG or somesuch if |
306 | * people need it. We also don't yet use the PMS interrupt. | 306 | * people need it. We also don't yet use the PMS interrupt. |
307 | */ | 307 | */ |
308 | 308 | ||
@@ -324,7 +324,7 @@ static void pms_hstart(short start) | |||
324 | /* | 324 | /* |
325 | * Bandpass filters | 325 | * Bandpass filters |
326 | */ | 326 | */ |
327 | 327 | ||
328 | static void pms_bandpass(short pass) | 328 | static void pms_bandpass(short pass) |
329 | { | 329 | { |
330 | if(decoder==PHILIPS2) | 330 | if(decoder==PHILIPS2) |
@@ -493,7 +493,7 @@ static void pms_vert(u8 deciden, u8 decinum) | |||
493 | /* | 493 | /* |
494 | * Turn 16bit ratios into best small ratio the chipset can grok | 494 | * Turn 16bit ratios into best small ratio the chipset can grok |
495 | */ | 495 | */ |
496 | 496 | ||
497 | static void pms_vertdeci(unsigned short decinum, unsigned short deciden) | 497 | static void pms_vertdeci(unsigned short decinum, unsigned short deciden) |
498 | { | 498 | { |
499 | /* Knock it down by /5 once */ | 499 | /* Knock it down by /5 once */ |
@@ -546,7 +546,7 @@ static void pms_horzdeci(short decinum, short deciden) | |||
546 | decinum=512; | 546 | decinum=512; |
547 | deciden=640; /* 768 would be ideal */ | 547 | deciden=640; /* 768 would be ideal */ |
548 | } | 548 | } |
549 | 549 | ||
550 | while(((decinum|deciden)&1)==0) | 550 | while(((decinum|deciden)&1)==0) |
551 | { | 551 | { |
552 | decinum>>=1; | 552 | decinum>>=1; |
@@ -559,7 +559,7 @@ static void pms_horzdeci(short decinum, short deciden) | |||
559 | } | 559 | } |
560 | if(deciden==32) | 560 | if(deciden==32) |
561 | deciden--; | 561 | deciden--; |
562 | 562 | ||
563 | mvv_write(0x24, 0x80|deciden); | 563 | mvv_write(0x24, 0x80|deciden); |
564 | mvv_write(0x25, decinum); | 564 | mvv_write(0x25, decinum); |
565 | } | 565 | } |
@@ -567,14 +567,14 @@ static void pms_horzdeci(short decinum, short deciden) | |||
567 | static void pms_resolution(short width, short height) | 567 | static void pms_resolution(short width, short height) |
568 | { | 568 | { |
569 | int fg_height; | 569 | int fg_height; |
570 | 570 | ||
571 | fg_height=height; | 571 | fg_height=height; |
572 | if(fg_height>280) | 572 | if(fg_height>280) |
573 | fg_height=280; | 573 | fg_height=280; |
574 | 574 | ||
575 | mvv_write(0x18, fg_height); | 575 | mvv_write(0x18, fg_height); |
576 | mvv_write(0x19, fg_height>>8); | 576 | mvv_write(0x19, fg_height>>8); |
577 | 577 | ||
578 | if(standard==1) | 578 | if(standard==1) |
579 | { | 579 | { |
580 | mvv_write(0x1A, 0xFC); | 580 | mvv_write(0x1A, 0xFC); |
@@ -598,7 +598,7 @@ static void pms_resolution(short width, short height) | |||
598 | mvv_write(0x42, 0x00); | 598 | mvv_write(0x42, 0x00); |
599 | mvv_write(0x43, 0x00); | 599 | mvv_write(0x43, 0x00); |
600 | mvv_write(0x44, MVVMEMORYWIDTH); | 600 | mvv_write(0x44, MVVMEMORYWIDTH); |
601 | 601 | ||
602 | mvv_write(0x22, width+8); | 602 | mvv_write(0x22, width+8); |
603 | mvv_write(0x23, (width+8)>> 8); | 603 | mvv_write(0x23, (width+8)>> 8); |
604 | 604 | ||
@@ -618,7 +618,7 @@ static void pms_resolution(short width, short height) | |||
618 | /* | 618 | /* |
619 | * Set Input | 619 | * Set Input |
620 | */ | 620 | */ |
621 | 621 | ||
622 | static void pms_vcrinput(short input) | 622 | static void pms_vcrinput(short input) |
623 | { | 623 | { |
624 | if(decoder==PHILIPS2) | 624 | if(decoder==PHILIPS2) |
@@ -643,20 +643,20 @@ static int pms_capture(struct pms_device *dev, char __user *buf, int rgb555, int | |||
643 | mvv_write(0x08,r8); /* capture rgb555/565, init DRAM, PC enable */ | 643 | mvv_write(0x08,r8); /* capture rgb555/565, init DRAM, PC enable */ |
644 | 644 | ||
645 | /* printf("%d %d %d %d %d %x %x\n",width,height,voff,nom,den,mvv_buf); */ | 645 | /* printf("%d %d %d %d %d %x %x\n",width,height,voff,nom,den,mvv_buf); */ |
646 | 646 | ||
647 | for (y = 0; y < dev->height; y++ ) | 647 | for (y = 0; y < dev->height; y++ ) |
648 | { | 648 | { |
649 | writeb(0, mem); /* synchronisiert neue Zeile */ | 649 | writeb(0, mem); /* synchronisiert neue Zeile */ |
650 | 650 | ||
651 | /* | 651 | /* |
652 | * This is in truth a fifo, be very careful as if you | 652 | * This is in truth a fifo, be very careful as if you |
653 | * forgot this odd things will occur 8) | 653 | * forgot this odd things will occur 8) |
654 | */ | 654 | */ |
655 | 655 | ||
656 | memcpy_fromio(tmp, mem, dw+32); /* discard 16 word */ | 656 | memcpy_fromio(tmp, mem, dw+32); /* discard 16 word */ |
657 | cnt -= dev->height; | 657 | cnt -= dev->height; |
658 | while (cnt <= 0) | 658 | while (cnt <= 0) |
659 | { | 659 | { |
660 | /* | 660 | /* |
661 | * Don't copy too far | 661 | * Don't copy too far |
662 | */ | 662 | */ |
@@ -666,7 +666,7 @@ static int pms_capture(struct pms_device *dev, char __user *buf, int rgb555, int | |||
666 | cnt += dev->height; | 666 | cnt += dev->height; |
667 | if (copy_to_user(buf, tmp+32, dt)) | 667 | if (copy_to_user(buf, tmp+32, dt)) |
668 | return len ? len : -EFAULT; | 668 | return len ? len : -EFAULT; |
669 | buf += dt; | 669 | buf += dt; |
670 | len += dt; | 670 | len += dt; |
671 | } | 671 | } |
672 | } | 672 | } |
@@ -683,7 +683,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
683 | { | 683 | { |
684 | struct video_device *dev = video_devdata(file); | 684 | struct video_device *dev = video_devdata(file); |
685 | struct pms_device *pd=(struct pms_device *)dev; | 685 | struct pms_device *pd=(struct pms_device *)dev; |
686 | 686 | ||
687 | switch(cmd) | 687 | switch(cmd) |
688 | { | 688 | { |
689 | case VIDIOCGCAP: | 689 | case VIDIOCGCAP: |
@@ -806,7 +806,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
806 | ||(p->palette==VIDEO_PALETTE_RGB555 && p->depth==15))) | 806 | ||(p->palette==VIDEO_PALETTE_RGB555 && p->depth==15))) |
807 | return -EINVAL; | 807 | return -EINVAL; |
808 | pd->picture= *p; | 808 | pd->picture= *p; |
809 | 809 | ||
810 | /* | 810 | /* |
811 | * Now load the card. | 811 | * Now load the card. |
812 | */ | 812 | */ |
@@ -815,7 +815,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
815 | pms_brightness(p->brightness>>8); | 815 | pms_brightness(p->brightness>>8); |
816 | pms_hue(p->hue>>8); | 816 | pms_hue(p->hue>>8); |
817 | pms_colour(p->colour>>8); | 817 | pms_colour(p->colour>>8); |
818 | pms_contrast(p->contrast>>8); | 818 | pms_contrast(p->contrast>>8); |
819 | mutex_unlock(&pd->lock); | 819 | mutex_unlock(&pd->lock); |
820 | return 0; | 820 | return 0; |
821 | } | 821 | } |
@@ -873,7 +873,7 @@ static ssize_t pms_read(struct file *file, char __user *buf, | |||
873 | struct video_device *v = video_devdata(file); | 873 | struct video_device *v = video_devdata(file); |
874 | struct pms_device *pd=(struct pms_device *)v; | 874 | struct pms_device *pd=(struct pms_device *)v; |
875 | int len; | 875 | int len; |
876 | 876 | ||
877 | mutex_lock(&pd->lock); | 877 | mutex_lock(&pd->lock); |
878 | len=pms_capture(pd, buf, (pd->picture.depth==16)?0:1,count); | 878 | len=pms_capture(pd, buf, (pd->picture.depth==16)?0:1,count); |
879 | mutex_unlock(&pd->lock); | 879 | mutex_unlock(&pd->lock); |
@@ -905,13 +905,13 @@ static struct pms_device pms_device; | |||
905 | /* | 905 | /* |
906 | * Probe for and initialise the Mediavision PMS | 906 | * Probe for and initialise the Mediavision PMS |
907 | */ | 907 | */ |
908 | 908 | ||
909 | static int init_mediavision(void) | 909 | static int init_mediavision(void) |
910 | { | 910 | { |
911 | int id; | 911 | int id; |
912 | int idec, decst; | 912 | int idec, decst; |
913 | int i; | 913 | int i; |
914 | 914 | ||
915 | unsigned char i2c_defs[]={ | 915 | unsigned char i2c_defs[]={ |
916 | 0x4C,0x30,0x00,0xE8, | 916 | 0x4C,0x30,0x00,0xE8, |
917 | 0xB6,0xE2,0x00,0x00, | 917 | 0xB6,0xE2,0x00,0x00, |
@@ -925,7 +925,7 @@ static int init_mediavision(void) | |||
925 | mem = ioremap(mem_base, 0x800); | 925 | mem = ioremap(mem_base, 0x800); |
926 | if (!mem) | 926 | if (!mem) |
927 | return -ENOMEM; | 927 | return -ENOMEM; |
928 | 928 | ||
929 | if (!request_region(0x9A01, 1, "Mediavision PMS config")) | 929 | if (!request_region(0x9A01, 1, "Mediavision PMS config")) |
930 | { | 930 | { |
931 | printk(KERN_WARNING "mediavision: unable to detect: 0x9A01 in use.\n"); | 931 | printk(KERN_WARNING "mediavision: unable to detect: 0x9A01 in use.\n"); |
@@ -941,18 +941,18 @@ static int init_mediavision(void) | |||
941 | } | 941 | } |
942 | outb(0xB8, 0x9A01); /* Unlock */ | 942 | outb(0xB8, 0x9A01); /* Unlock */ |
943 | outb(io_port>>4, 0x9A01); /* Set IO port */ | 943 | outb(io_port>>4, 0x9A01); /* Set IO port */ |
944 | 944 | ||
945 | 945 | ||
946 | id=mvv_read(3); | 946 | id=mvv_read(3); |
947 | decst=pms_i2c_stat(0x43); | 947 | decst=pms_i2c_stat(0x43); |
948 | 948 | ||
949 | if(decst!=-1) | 949 | if(decst!=-1) |
950 | idec=2; | 950 | idec=2; |
951 | else if(pms_i2c_stat(0xb9)!=-1) | 951 | else if(pms_i2c_stat(0xb9)!=-1) |
952 | idec=3; | 952 | idec=3; |
953 | else if(pms_i2c_stat(0x8b)!=-1) | 953 | else if(pms_i2c_stat(0x8b)!=-1) |
954 | idec=1; | 954 | idec=1; |
955 | else | 955 | else |
956 | idec=0; | 956 | idec=0; |
957 | 957 | ||
958 | printk(KERN_INFO "PMS type is %d\n", idec); | 958 | printk(KERN_INFO "PMS type is %d\n", idec); |
@@ -966,11 +966,11 @@ static int init_mediavision(void) | |||
966 | /* | 966 | /* |
967 | * Ok we have a PMS of some sort | 967 | * Ok we have a PMS of some sort |
968 | */ | 968 | */ |
969 | 969 | ||
970 | mvv_write(0x04, mem_base>>12); /* Set the memory area */ | 970 | mvv_write(0x04, mem_base>>12); /* Set the memory area */ |
971 | 971 | ||
972 | /* Ok now load the defaults */ | 972 | /* Ok now load the defaults */ |
973 | 973 | ||
974 | for(i=0;i<0x19;i++) | 974 | for(i=0;i<0x19;i++) |
975 | { | 975 | { |
976 | if(i2c_defs[i]==0xFF) | 976 | if(i2c_defs[i]==0xFF) |
@@ -978,7 +978,7 @@ static int init_mediavision(void) | |||
978 | else | 978 | else |
979 | pms_i2c_write(0x8A, i, i2c_defs[i]); | 979 | pms_i2c_write(0x8A, i, i2c_defs[i]); |
980 | } | 980 | } |
981 | 981 | ||
982 | pms_i2c_write(0xB8,0x00,0x12); | 982 | pms_i2c_write(0xB8,0x00,0x12); |
983 | pms_i2c_write(0xB8,0x04,0x00); | 983 | pms_i2c_write(0xB8,0x04,0x00); |
984 | pms_i2c_write(0xB8,0x07,0x00); | 984 | pms_i2c_write(0xB8,0x07,0x00); |
@@ -987,18 +987,18 @@ static int init_mediavision(void) | |||
987 | pms_i2c_write(0xB8,0x0A,0x00); | 987 | pms_i2c_write(0xB8,0x0A,0x00); |
988 | pms_i2c_write(0xB8,0x0B,0x10); | 988 | pms_i2c_write(0xB8,0x0B,0x10); |
989 | pms_i2c_write(0xB8,0x10,0x03); | 989 | pms_i2c_write(0xB8,0x10,0x03); |
990 | 990 | ||
991 | mvv_write(0x01, 0x00); | 991 | mvv_write(0x01, 0x00); |
992 | mvv_write(0x05, 0xA0); | 992 | mvv_write(0x05, 0xA0); |
993 | mvv_write(0x08, 0x25); | 993 | mvv_write(0x08, 0x25); |
994 | mvv_write(0x09, 0x00); | 994 | mvv_write(0x09, 0x00); |
995 | mvv_write(0x0A, 0x20|MVVMEMORYWIDTH); | 995 | mvv_write(0x0A, 0x20|MVVMEMORYWIDTH); |
996 | 996 | ||
997 | mvv_write(0x10, 0x02); | 997 | mvv_write(0x10, 0x02); |
998 | mvv_write(0x1E, 0x0C); | 998 | mvv_write(0x1E, 0x0C); |
999 | mvv_write(0x1F, 0x03); | 999 | mvv_write(0x1F, 0x03); |
1000 | mvv_write(0x26, 0x06); | 1000 | mvv_write(0x26, 0x06); |
1001 | 1001 | ||
1002 | mvv_write(0x2B, 0x00); | 1002 | mvv_write(0x2B, 0x00); |
1003 | mvv_write(0x2C, 0x20); | 1003 | mvv_write(0x2C, 0x20); |
1004 | mvv_write(0x2D, 0x00); | 1004 | mvv_write(0x2D, 0x00); |
@@ -1018,13 +1018,13 @@ static int init_mediavision(void) | |||
1018 | /* | 1018 | /* |
1019 | * Initialization and module stuff | 1019 | * Initialization and module stuff |
1020 | */ | 1020 | */ |
1021 | 1021 | ||
1022 | static int __init init_pms_cards(void) | 1022 | static int __init init_pms_cards(void) |
1023 | { | 1023 | { |
1024 | printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n"); | 1024 | printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n"); |
1025 | 1025 | ||
1026 | data_port = io_port +1; | 1026 | data_port = io_port +1; |
1027 | 1027 | ||
1028 | if(init_mediavision()) | 1028 | if(init_mediavision()) |
1029 | { | 1029 | { |
1030 | printk(KERN_INFO "Board not found.\n"); | 1030 | printk(KERN_INFO "Board not found.\n"); |
diff --git a/drivers/usb/media/pwc/Makefile b/drivers/media/video/pwc/Makefile index 2d93a775011a..8326684f49f3 100644 --- a/drivers/usb/media/pwc/Makefile +++ b/drivers/media/video/pwc/Makefile | |||
@@ -15,6 +15,6 @@ default: | |||
15 | endif | 15 | endif |
16 | 16 | ||
17 | clean: | 17 | clean: |
18 | rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c | 18 | rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c |
19 | rm -rf .tmp_versions | 19 | rm -rf .tmp_versions |
20 | 20 | ||
diff --git a/drivers/usb/media/pwc/philips.txt b/drivers/media/video/pwc/philips.txt index 04a640d723ed..11f751a6bda5 100644 --- a/drivers/usb/media/pwc/philips.txt +++ b/drivers/media/video/pwc/philips.txt | |||
@@ -47,17 +47,17 @@ don't know how to set it properly in the driver. The options are: | |||
47 | size | 47 | size |
48 | Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or | 48 | Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or |
49 | 'vga', for an image size of resp. 128x96, 160x120, 176x144, | 49 | 'vga', for an image size of resp. 128x96, 160x120, 176x144, |
50 | 320x240, 352x288 and 640x480 (of course, only for those cameras that | 50 | 320x240, 352x288 and 640x480 (of course, only for those cameras that |
51 | support these resolutions). | 51 | support these resolutions). |
52 | 52 | ||
53 | fps | 53 | fps |
54 | Specifies the desired framerate. Is an integer in the range of 4-30. | 54 | Specifies the desired framerate. Is an integer in the range of 4-30. |
55 | 55 | ||
56 | fbufs | 56 | fbufs |
57 | This paramter specifies the number of internal buffers to use for storing | 57 | This paramter specifies the number of internal buffers to use for storing |
58 | frames from the cam. This will help if the process that reads images from | 58 | frames from the cam. This will help if the process that reads images from |
59 | the cam is a bit slow or momentarely busy. However, on slow machines it | 59 | the cam is a bit slow or momentarely busy. However, on slow machines it |
60 | only introduces lag, so choose carefully. The default is 3, which is | 60 | only introduces lag, so choose carefully. The default is 3, which is |
61 | reasonable. You can set it between 2 and 5. | 61 | reasonable. You can set it between 2 and 5. |
62 | 62 | ||
63 | mbufs | 63 | mbufs |
@@ -65,9 +65,9 @@ mbufs | |||
65 | buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends. | 65 | buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends. |
66 | The default is 2, which is adequate for most applications (double | 66 | The default is 2, which is adequate for most applications (double |
67 | buffering). | 67 | buffering). |
68 | 68 | ||
69 | Should you experience a lot of 'Dumping frame...' messages during | 69 | Should you experience a lot of 'Dumping frame...' messages during |
70 | grabbing with a tool that uses mmap(), you might want to increase if. | 70 | grabbing with a tool that uses mmap(), you might want to increase if. |
71 | However, it doesn't really buffer images, it just gives you a bit more | 71 | However, it doesn't really buffer images, it just gives you a bit more |
72 | slack when your program is behind. But you need a multi-threaded or | 72 | slack when your program is behind. But you need a multi-threaded or |
73 | forked program to really take advantage of these buffers. | 73 | forked program to really take advantage of these buffers. |
@@ -88,15 +88,15 @@ power_save | |||
88 | 88 | ||
89 | compression (only useful with the plugin) | 89 | compression (only useful with the plugin) |
90 | With this option you can control the compression factor that the camera | 90 | With this option you can control the compression factor that the camera |
91 | uses to squeeze the image through the USB bus. You can set the | 91 | uses to squeeze the image through the USB bus. You can set the |
92 | parameter between 0 and 3: | 92 | parameter between 0 and 3: |
93 | 0 = prefer uncompressed images; if the requested mode is not available | 93 | 0 = prefer uncompressed images; if the requested mode is not available |
94 | in an uncompressed format, the driver will silently switch to low | 94 | in an uncompressed format, the driver will silently switch to low |
95 | compression. | 95 | compression. |
96 | 1 = low compression. | 96 | 1 = low compression. |
97 | 2 = medium compression. | 97 | 2 = medium compression. |
98 | 3 = high compression. | 98 | 3 = high compression. |
99 | 99 | ||
100 | High compression takes less bandwidth of course, but it could also | 100 | High compression takes less bandwidth of course, but it could also |
101 | introduce some unwanted artefacts. The default is 2, medium compression. | 101 | introduce some unwanted artefacts. The default is 2, medium compression. |
102 | See the FAQ on the website for an overview of which modes require | 102 | See the FAQ on the website for an overview of which modes require |
@@ -112,7 +112,7 @@ leds | |||
112 | this is let the LED blink while the camera is in use. This: | 112 | this is let the LED blink while the camera is in use. This: |
113 | 113 | ||
114 | leds=500,500 | 114 | leds=500,500 |
115 | 115 | ||
116 | will blink the LED once every second. But with: | 116 | will blink the LED once every second. But with: |
117 | 117 | ||
118 | leds=0,0 | 118 | leds=0,0 |
@@ -123,7 +123,7 @@ leds | |||
123 | when the camera is not used anymore. | 123 | when the camera is not used anymore. |
124 | 124 | ||
125 | This parameter works only with the ToUCam range of cameras (720, 730, 740, | 125 | This parameter works only with the ToUCam range of cameras (720, 730, 740, |
126 | 750) and OEMs. For other cameras this command is silently ignored, and | 126 | 750) and OEMs. For other cameras this command is silently ignored, and |
127 | the LED cannot be controlled. | 127 | the LED cannot be controlled. |
128 | 128 | ||
129 | Finally: this parameters does not take effect UNTIL the first time you | 129 | Finally: this parameters does not take effect UNTIL the first time you |
@@ -144,35 +144,35 @@ dev_hint | |||
144 | format: | 144 | format: |
145 | 145 | ||
146 | [type[.serialnumber]:]node | 146 | [type[.serialnumber]:]node |
147 | 147 | ||
148 | The square brackets mean that both the type and the serialnumber are | 148 | The square brackets mean that both the type and the serialnumber are |
149 | optional, but a serialnumber cannot be specified without a type (which | 149 | optional, but a serialnumber cannot be specified without a type (which |
150 | would be rather pointless). The serialnumber is separated from the type | 150 | would be rather pointless). The serialnumber is separated from the type |
151 | by a '.'; the node number by a ':'. | 151 | by a '.'; the node number by a ':'. |
152 | 152 | ||
153 | This somewhat cryptic syntax is best explained by a few examples: | 153 | This somewhat cryptic syntax is best explained by a few examples: |
154 | 154 | ||
155 | dev_hint=3,5 The first detected cam gets assigned | 155 | dev_hint=3,5 The first detected cam gets assigned |
156 | /dev/video3, the second /dev/video5. Any | 156 | /dev/video3, the second /dev/video5. Any |
157 | other cameras will get the first free | 157 | other cameras will get the first free |
158 | available slot (see below). | 158 | available slot (see below). |
159 | 159 | ||
160 | dev_hint=645:1,680:2 The PCA645 camera will get /dev/video1, | 160 | dev_hint=645:1,680:2 The PCA645 camera will get /dev/video1, |
161 | and a PCVC680 /dev/video2. | 161 | and a PCVC680 /dev/video2. |
162 | 162 | ||
163 | dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber | 163 | dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber |
164 | 0123 goes to /dev/video3, the same | 164 | 0123 goes to /dev/video3, the same |
165 | camera model with the 4567 serial | 165 | camera model with the 4567 serial |
166 | gets /dev/video0. | 166 | gets /dev/video0. |
167 | 167 | ||
168 | dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the | 168 | dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the |
169 | next 3 Philips cams will use /dev/video4 | 169 | next 3 Philips cams will use /dev/video4 |
170 | through /dev/video6. | 170 | through /dev/video6. |
171 | 171 | ||
172 | Some points worth knowing: | 172 | Some points worth knowing: |
173 | - Serialnumbers are case sensitive and must be written full, including | 173 | - Serialnumbers are case sensitive and must be written full, including |
174 | leading zeroes (it's treated as a string). | 174 | leading zeroes (it's treated as a string). |
175 | - If a device node is already occupied, registration will fail and | 175 | - If a device node is already occupied, registration will fail and |
176 | the webcam is not available. | 176 | the webcam is not available. |
177 | - You can have up to 64 video devices; be sure to make enough device | 177 | - You can have up to 64 video devices; be sure to make enough device |
178 | nodes in /dev if you want to spread the numbers (this does not apply | 178 | nodes in /dev if you want to spread the numbers (this does not apply |
@@ -186,13 +186,13 @@ trace | |||
186 | kernel log at debug level. | 186 | kernel log at debug level. |
187 | 187 | ||
188 | The trace variable is a bitmask; each bit represents a certain feature. | 188 | The trace variable is a bitmask; each bit represents a certain feature. |
189 | If you want to trace something, look up the bit value(s) in the table | 189 | If you want to trace something, look up the bit value(s) in the table |
190 | below, add the values together and supply that to the trace variable. | 190 | below, add the values together and supply that to the trace variable. |
191 | 191 | ||
192 | Value Value Description Default | 192 | Value Value Description Default |
193 | (dec) (hex) | 193 | (dec) (hex) |
194 | 1 0x1 Module initialization; this will log messages On | 194 | 1 0x1 Module initialization; this will log messages On |
195 | while loading and unloading the module | 195 | while loading and unloading the module |
196 | 196 | ||
197 | 2 0x2 probe() and disconnect() traces On | 197 | 2 0x2 probe() and disconnect() traces On |
198 | 198 | ||
@@ -203,7 +203,7 @@ trace | |||
203 | 16 0x10 Memory allocation of buffers, etc. Off | 203 | 16 0x10 Memory allocation of buffers, etc. Off |
204 | 204 | ||
205 | 32 0x20 Showing underflow, overflow and Dumping frame On | 205 | 32 0x20 Showing underflow, overflow and Dumping frame On |
206 | messages | 206 | messages |
207 | 207 | ||
208 | 64 0x40 Show viewport and image sizes Off | 208 | 64 0x40 Show viewport and image sizes Off |
209 | 209 | ||
@@ -217,7 +217,7 @@ trace | |||
217 | 217 | ||
218 | 218 | ||
219 | Example: | 219 | Example: |
220 | 220 | ||
221 | # modprobe pwc size=cif fps=15 power_save=1 | 221 | # modprobe pwc size=cif fps=15 power_save=1 |
222 | 222 | ||
223 | The fbufs, mbufs and trace parameters are global and apply to all connected | 223 | The fbufs, mbufs and trace parameters are global and apply to all connected |
diff --git a/drivers/usb/media/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index 0398b812e0ce..4ba549bfa0e0 100644 --- a/drivers/usb/media/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c | |||
@@ -31,17 +31,17 @@ | |||
31 | 31 | ||
32 | /* | 32 | /* |
33 | Changes | 33 | Changes |
34 | 2001/08/03 Alvarado Added methods for changing white balance and | 34 | 2001/08/03 Alvarado Added methods for changing white balance and |
35 | red/green gains | 35 | red/green gains |
36 | */ | 36 | */ |
37 | 37 | ||
38 | /* Control functions for the cam; brightness, contrast, video mode, etc. */ | 38 | /* Control functions for the cam; brightness, contrast, video mode, etc. */ |
39 | 39 | ||
40 | #ifdef __KERNEL__ | 40 | #ifdef __KERNEL__ |
41 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
42 | #endif | 42 | #endif |
43 | #include <asm/errno.h> | 43 | #include <asm/errno.h> |
44 | 44 | ||
45 | #include "pwc.h" | 45 | #include "pwc.h" |
46 | #include "pwc-ioctl.h" | 46 | #include "pwc-ioctl.h" |
47 | #include "pwc-uncompress.h" | 47 | #include "pwc-uncompress.h" |
@@ -116,13 +116,13 @@ static const char *size2name[PSZ_MAX] = | |||
116 | "SIF", | 116 | "SIF", |
117 | "CIF", | 117 | "CIF", |
118 | "VGA", | 118 | "VGA", |
119 | }; | 119 | }; |
120 | 120 | ||
121 | /********/ | 121 | /********/ |
122 | 122 | ||
123 | /* Entries for the Nala (645/646) camera; the Nala doesn't have compression | 123 | /* Entries for the Nala (645/646) camera; the Nala doesn't have compression |
124 | preferences, so you either get compressed or non-compressed streams. | 124 | preferences, so you either get compressed or non-compressed streams. |
125 | 125 | ||
126 | An alternate value of 0 means this mode is not available at all. | 126 | An alternate value of 0 means this mode is not available at all. |
127 | */ | 127 | */ |
128 | 128 | ||
@@ -205,13 +205,13 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
205 | { /* closest match of framerate */ | 205 | { /* closest match of framerate */ |
206 | 0, 0, 0, 0, 4, /* 0-4 */ | 206 | 0, 0, 0, 0, 4, /* 0-4 */ |
207 | 5, 5, 7, 7, 10, /* 5-9 */ | 207 | 5, 5, 7, 7, 10, /* 5-9 */ |
208 | 10, 10, 12, 12, 15, /* 10-14 */ | 208 | 10, 10, 12, 12, 15, /* 10-14 */ |
209 | 15, 15, 15, 20, 20, /* 15-19 */ | 209 | 15, 15, 15, 20, 20, /* 15-19 */ |
210 | 20, 20, 20, 24, 24, /* 20-24 */ | 210 | 20, 20, 20, 24, 24, /* 20-24 */ |
211 | 24, 24, 24, 24, 24, /* 25-29 */ | 211 | 24, 24, 24, 24, 24, /* 25-29 */ |
212 | 24 /* 30 */ | 212 | 24 /* 30 */ |
213 | }; | 213 | }; |
214 | int frames2table[31] = | 214 | int frames2table[31] = |
215 | { 0, 0, 0, 0, 0, /* 0-4 */ | 215 | { 0, 0, 0, 0, 0, /* 0-4 */ |
216 | 1, 1, 1, 2, 2, /* 5-9 */ | 216 | 1, 1, 1, 2, 2, /* 5-9 */ |
217 | 3, 3, 4, 4, 4, /* 10-14 */ | 217 | 3, 3, 4, 4, 4, /* 10-14 */ |
@@ -220,7 +220,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
220 | 7, 7, 7, 7, 7, /* 25-29 */ | 220 | 7, 7, 7, 7, 7, /* 25-29 */ |
221 | 7 /* 30 */ | 221 | 7 /* 30 */ |
222 | }; | 222 | }; |
223 | 223 | ||
224 | if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25) | 224 | if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25) |
225 | return -EINVAL; | 225 | return -EINVAL; |
226 | frames = frames2frames[frames]; | 226 | frames = frames2frames[frames]; |
@@ -232,7 +232,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
232 | if (pEntry->compressed) | 232 | if (pEntry->compressed) |
233 | return -ENOENT; /* Not supported. */ | 233 | return -ENOENT; /* Not supported. */ |
234 | 234 | ||
235 | memcpy(buf, pEntry->mode, 3); | 235 | memcpy(buf, pEntry->mode, 3); |
236 | ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3); | 236 | ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3); |
237 | if (ret < 0) { | 237 | if (ret < 0) { |
238 | Debug("Failed to send video command... %d\n", ret); | 238 | Debug("Failed to send video command... %d\n", ret); |
@@ -257,7 +257,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
257 | break; | 257 | break; |
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | pdev->cmd_len = 3; | 261 | pdev->cmd_len = 3; |
262 | memcpy(pdev->cmd_buf, buf, 3); | 262 | memcpy(pdev->cmd_buf, buf, 3); |
263 | 263 | ||
@@ -352,13 +352,13 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr | |||
352 | /* special case: VGA @ 5 fps and snapshot is raw bayer mode */ | 352 | /* special case: VGA @ 5 fps and snapshot is raw bayer mode */ |
353 | if (size == PSZ_VGA && frames == 5 && snapshot) | 353 | if (size == PSZ_VGA && frames == 5 && snapshot) |
354 | { | 354 | { |
355 | /* Only available in case the raw palette is selected or | 355 | /* Only available in case the raw palette is selected or |
356 | we have the decompressor available. This mode is | 356 | we have the decompressor available. This mode is |
357 | only available in compressed form | 357 | only available in compressed form |
358 | */ | 358 | */ |
359 | if (pdev->vpalette == VIDEO_PALETTE_RAW) | 359 | if (pdev->vpalette == VIDEO_PALETTE_RAW) |
360 | { | 360 | { |
361 | Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette); | 361 | Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette); |
362 | pChoose = &RawEntry; | 362 | pChoose = &RawEntry; |
363 | } | 363 | } |
364 | else | 364 | else |
@@ -368,9 +368,9 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr | |||
368 | } | 368 | } |
369 | else | 369 | else |
370 | { | 370 | { |
371 | /* Find a supported framerate with progressively higher compression ratios | 371 | /* Find a supported framerate with progressively higher compression ratios |
372 | if the preferred ratio is not available. | 372 | if the preferred ratio is not available. |
373 | Skip this step when using RAW modes. | 373 | Skip this step when using RAW modes. |
374 | */ | 374 | */ |
375 | while (compression <= 3) { | 375 | while (compression <= 3) { |
376 | pChoose = &Kiara_table[size][fps][compression]; | 376 | pChoose = &Kiara_table[size][fps][compression]; |
@@ -383,7 +383,7 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr | |||
383 | return -ENOENT; /* Not supported. */ | 383 | return -ENOENT; /* Not supported. */ |
384 | 384 | ||
385 | Debug("Using alternate setting %d.\n", pChoose->alternate); | 385 | Debug("Using alternate setting %d.\n", pChoose->alternate); |
386 | 386 | ||
387 | /* usb_control_msg won't take staticly allocated arrays as argument?? */ | 387 | /* usb_control_msg won't take staticly allocated arrays as argument?? */ |
388 | memcpy(buf, pChoose->mode, 12); | 388 | memcpy(buf, pChoose->mode, 12); |
389 | if (snapshot) | 389 | if (snapshot) |
@@ -463,9 +463,9 @@ static void pwc_set_image_buffer_size(struct pwc_device *pdev) | |||
463 | */ | 463 | */ |
464 | int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot) | 464 | int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot) |
465 | { | 465 | { |
466 | int ret, size; | 466 | int ret, size; |
467 | 467 | ||
468 | Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette); | 468 | Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette); |
469 | size = pwc_decode_size(pdev, width, height); | 469 | size = pwc_decode_size(pdev, width, height); |
470 | if (size < 0) { | 470 | if (size < 0) { |
471 | Debug("Could not find suitable size.\n"); | 471 | Debug("Could not find suitable size.\n"); |
@@ -473,7 +473,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame | |||
473 | } | 473 | } |
474 | Debug("decode_size = %d.\n", size); | 474 | Debug("decode_size = %d.\n", size); |
475 | 475 | ||
476 | ret = -EINVAL; | 476 | ret = -EINVAL; |
477 | switch(pdev->type) { | 477 | switch(pdev->type) { |
478 | case 645: | 478 | case 645: |
479 | case 646: | 479 | case 646: |
@@ -485,7 +485,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame | |||
485 | case 690: | 485 | case 690: |
486 | ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot); | 486 | ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot); |
487 | break; | 487 | break; |
488 | 488 | ||
489 | case 720: | 489 | case 720: |
490 | case 730: | 490 | case 730: |
491 | case 740: | 491 | case 740: |
@@ -517,7 +517,7 @@ int pwc_get_brightness(struct pwc_device *pdev) | |||
517 | char buf; | 517 | char buf; |
518 | int ret; | 518 | int ret; |
519 | 519 | ||
520 | ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); | 520 | ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); |
521 | if (ret < 0) | 521 | if (ret < 0) |
522 | return ret; | 522 | return ret; |
523 | return buf << 9; | 523 | return buf << 9; |
@@ -566,7 +566,7 @@ int pwc_get_gamma(struct pwc_device *pdev) | |||
566 | { | 566 | { |
567 | char buf; | 567 | char buf; |
568 | int ret; | 568 | int ret; |
569 | 569 | ||
570 | ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1); | 570 | ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1); |
571 | if (ret < 0) | 571 | if (ret < 0) |
572 | return ret; | 572 | return ret; |
@@ -622,14 +622,14 @@ static inline int pwc_set_agc(struct pwc_device *pdev, int mode, int value) | |||
622 | { | 622 | { |
623 | char buf; | 623 | char buf; |
624 | int ret; | 624 | int ret; |
625 | 625 | ||
626 | if (mode) | 626 | if (mode) |
627 | buf = 0x0; /* auto */ | 627 | buf = 0x0; /* auto */ |
628 | else | 628 | else |
629 | buf = 0xff; /* fixed */ | 629 | buf = 0xff; /* fixed */ |
630 | 630 | ||
631 | ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1); | 631 | ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1); |
632 | 632 | ||
633 | if (!mode && ret >= 0) { | 633 | if (!mode && ret >= 0) { |
634 | if (value < 0) | 634 | if (value < 0) |
635 | value = 0; | 635 | value = 0; |
@@ -647,7 +647,7 @@ static inline int pwc_get_agc(struct pwc_device *pdev, int *value) | |||
647 | { | 647 | { |
648 | unsigned char buf; | 648 | unsigned char buf; |
649 | int ret; | 649 | int ret; |
650 | 650 | ||
651 | ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1); | 651 | ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1); |
652 | if (ret < 0) | 652 | if (ret < 0) |
653 | return ret; | 653 | return ret; |
@@ -658,7 +658,7 @@ static inline int pwc_get_agc(struct pwc_device *pdev, int *value) | |||
658 | return ret; | 658 | return ret; |
659 | if (buf > 0x3F) | 659 | if (buf > 0x3F) |
660 | buf = 0x3F; | 660 | buf = 0x3F; |
661 | *value = (buf << 10); | 661 | *value = (buf << 10); |
662 | } | 662 | } |
663 | else { /* auto */ | 663 | else { /* auto */ |
664 | ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1); | 664 | ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1); |
@@ -683,7 +683,7 @@ static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int v | |||
683 | buf[0] = 0x0; /* auto */ | 683 | buf[0] = 0x0; /* auto */ |
684 | else | 684 | else |
685 | buf[0] = 0xff; /* fixed */ | 685 | buf[0] = 0xff; /* fixed */ |
686 | 686 | ||
687 | ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1); | 687 | ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1); |
688 | 688 | ||
689 | if (!mode && ret >= 0) { | 689 | if (!mode && ret >= 0) { |
@@ -713,7 +713,7 @@ static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int v | |||
713 | ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2); | 713 | ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2); |
714 | } | 714 | } |
715 | return ret; | 715 | return ret; |
716 | } | 716 | } |
717 | 717 | ||
718 | 718 | ||
719 | /* POWER */ | 719 | /* POWER */ |
@@ -765,22 +765,22 @@ static inline int pwc_restore_factory(struct pwc_device *pdev) | |||
765 | * 02: fluorescent lighting | 765 | * 02: fluorescent lighting |
766 | * 03: manual | 766 | * 03: manual |
767 | * 04: auto | 767 | * 04: auto |
768 | */ | 768 | */ |
769 | static inline int pwc_set_awb(struct pwc_device *pdev, int mode) | 769 | static inline int pwc_set_awb(struct pwc_device *pdev, int mode) |
770 | { | 770 | { |
771 | char buf; | 771 | char buf; |
772 | int ret; | 772 | int ret; |
773 | 773 | ||
774 | if (mode < 0) | 774 | if (mode < 0) |
775 | mode = 0; | 775 | mode = 0; |
776 | 776 | ||
777 | if (mode > 4) | 777 | if (mode > 4) |
778 | mode = 4; | 778 | mode = 4; |
779 | 779 | ||
780 | buf = mode & 0x07; /* just the lowest three bits */ | 780 | buf = mode & 0x07; /* just the lowest three bits */ |
781 | 781 | ||
782 | ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1); | 782 | ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1); |
783 | 783 | ||
784 | if (ret < 0) | 784 | if (ret < 0) |
785 | return ret; | 785 | return ret; |
786 | return 0; | 786 | return 0; |
@@ -790,17 +790,17 @@ static inline int pwc_get_awb(struct pwc_device *pdev) | |||
790 | { | 790 | { |
791 | unsigned char buf; | 791 | unsigned char buf; |
792 | int ret; | 792 | int ret; |
793 | 793 | ||
794 | ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1); | 794 | ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1); |
795 | 795 | ||
796 | if (ret < 0) | 796 | if (ret < 0) |
797 | return ret; | 797 | return ret; |
798 | return buf; | 798 | return buf; |
799 | } | 799 | } |
800 | 800 | ||
801 | static inline int pwc_set_red_gain(struct pwc_device *pdev, int value) | 801 | static inline int pwc_set_red_gain(struct pwc_device *pdev, int value) |
802 | { | 802 | { |
803 | unsigned char buf; | 803 | unsigned char buf; |
804 | 804 | ||
805 | if (value < 0) | 805 | if (value < 0) |
806 | value = 0; | 806 | value = 0; |
@@ -815,7 +815,7 @@ static inline int pwc_get_red_gain(struct pwc_device *pdev, int *value) | |||
815 | { | 815 | { |
816 | unsigned char buf; | 816 | unsigned char buf; |
817 | int ret; | 817 | int ret; |
818 | 818 | ||
819 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1); | 819 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1); |
820 | if (ret < 0) | 820 | if (ret < 0) |
821 | return ret; | 821 | return ret; |
@@ -841,7 +841,7 @@ static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value) | |||
841 | { | 841 | { |
842 | unsigned char buf; | 842 | unsigned char buf; |
843 | int ret; | 843 | int ret; |
844 | 844 | ||
845 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1); | 845 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1); |
846 | if (ret < 0) | 846 | if (ret < 0) |
847 | return ret; | 847 | return ret; |
@@ -851,14 +851,14 @@ static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value) | |||
851 | 851 | ||
852 | 852 | ||
853 | /* The following two functions are different, since they only read the | 853 | /* The following two functions are different, since they only read the |
854 | internal red/blue gains, which may be different from the manual | 854 | internal red/blue gains, which may be different from the manual |
855 | gains set or read above. | 855 | gains set or read above. |
856 | */ | 856 | */ |
857 | static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value) | 857 | static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value) |
858 | { | 858 | { |
859 | unsigned char buf; | 859 | unsigned char buf; |
860 | int ret; | 860 | int ret; |
861 | 861 | ||
862 | ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1); | 862 | ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1); |
863 | if (ret < 0) | 863 | if (ret < 0) |
864 | return ret; | 864 | return ret; |
@@ -870,7 +870,7 @@ static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value) | |||
870 | { | 870 | { |
871 | unsigned char buf; | 871 | unsigned char buf; |
872 | int ret; | 872 | int ret; |
873 | 873 | ||
874 | ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1); | 874 | ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1); |
875 | if (ret < 0) | 875 | if (ret < 0) |
876 | return ret; | 876 | return ret; |
@@ -882,7 +882,7 @@ static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value) | |||
882 | static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed) | 882 | static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed) |
883 | { | 883 | { |
884 | unsigned char buf; | 884 | unsigned char buf; |
885 | 885 | ||
886 | /* useful range is 0x01..0x20 */ | 886 | /* useful range is 0x01..0x20 */ |
887 | buf = speed / 0x7f0; | 887 | buf = speed / 0x7f0; |
888 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); | 888 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); |
@@ -892,7 +892,7 @@ static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value) | |||
892 | { | 892 | { |
893 | unsigned char buf; | 893 | unsigned char buf; |
894 | int ret; | 894 | int ret; |
895 | 895 | ||
896 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); | 896 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); |
897 | if (ret < 0) | 897 | if (ret < 0) |
898 | return ret; | 898 | return ret; |
@@ -904,7 +904,7 @@ static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value) | |||
904 | static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay) | 904 | static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay) |
905 | { | 905 | { |
906 | unsigned char buf; | 906 | unsigned char buf; |
907 | 907 | ||
908 | /* useful range is 0x01..0x3F */ | 908 | /* useful range is 0x01..0x3F */ |
909 | buf = (delay >> 10); | 909 | buf = (delay >> 10); |
910 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); | 910 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); |
@@ -914,7 +914,7 @@ static inline int pwc_get_wb_delay(struct pwc_device *pdev, int *value) | |||
914 | { | 914 | { |
915 | unsigned char buf; | 915 | unsigned char buf; |
916 | int ret; | 916 | int ret; |
917 | 917 | ||
918 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); | 918 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); |
919 | if (ret < 0) | 919 | if (ret < 0) |
920 | return ret; | 920 | return ret; |
@@ -950,7 +950,7 @@ static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) | |||
950 | { | 950 | { |
951 | unsigned char buf[2]; | 951 | unsigned char buf[2]; |
952 | int ret; | 952 | int ret; |
953 | 953 | ||
954 | if (pdev->type < 730) { | 954 | if (pdev->type < 730) { |
955 | *on_value = -1; | 955 | *on_value = -1; |
956 | *off_value = -1; | 956 | *off_value = -1; |
@@ -969,7 +969,7 @@ static inline int pwc_set_contour(struct pwc_device *pdev, int contour) | |||
969 | { | 969 | { |
970 | unsigned char buf; | 970 | unsigned char buf; |
971 | int ret; | 971 | int ret; |
972 | 972 | ||
973 | if (contour < 0) | 973 | if (contour < 0) |
974 | buf = 0xff; /* auto contour on */ | 974 | buf = 0xff; /* auto contour on */ |
975 | else | 975 | else |
@@ -977,16 +977,16 @@ static inline int pwc_set_contour(struct pwc_device *pdev, int contour) | |||
977 | ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); | 977 | ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); |
978 | if (ret < 0) | 978 | if (ret < 0) |
979 | return ret; | 979 | return ret; |
980 | 980 | ||
981 | if (contour < 0) | 981 | if (contour < 0) |
982 | return 0; | 982 | return 0; |
983 | if (contour > 0xffff) | 983 | if (contour > 0xffff) |
984 | contour = 0xffff; | 984 | contour = 0xffff; |
985 | 985 | ||
986 | buf = (contour >> 10); /* contour preset is [0..3f] */ | 986 | buf = (contour >> 10); /* contour preset is [0..3f] */ |
987 | ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); | 987 | ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); |
988 | if (ret < 0) | 988 | if (ret < 0) |
989 | return ret; | 989 | return ret; |
990 | return 0; | 990 | return 0; |
991 | } | 991 | } |
992 | 992 | ||
@@ -994,7 +994,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) | |||
994 | { | 994 | { |
995 | unsigned char buf; | 995 | unsigned char buf; |
996 | int ret; | 996 | int ret; |
997 | 997 | ||
998 | ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); | 998 | ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); |
999 | if (ret < 0) | 999 | if (ret < 0) |
1000 | return ret; | 1000 | return ret; |
@@ -1002,7 +1002,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) | |||
1002 | if (buf == 0) { | 1002 | if (buf == 0) { |
1003 | /* auto mode off, query current preset value */ | 1003 | /* auto mode off, query current preset value */ |
1004 | ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); | 1004 | ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); |
1005 | if (ret < 0) | 1005 | if (ret < 0) |
1006 | return ret; | 1006 | return ret; |
1007 | *contour = buf << 10; | 1007 | *contour = buf << 10; |
1008 | } | 1008 | } |
@@ -1015,7 +1015,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) | |||
1015 | static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight) | 1015 | static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight) |
1016 | { | 1016 | { |
1017 | unsigned char buf; | 1017 | unsigned char buf; |
1018 | 1018 | ||
1019 | if (backlight) | 1019 | if (backlight) |
1020 | buf = 0xff; | 1020 | buf = 0xff; |
1021 | else | 1021 | else |
@@ -1027,7 +1027,7 @@ static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight) | |||
1027 | { | 1027 | { |
1028 | int ret; | 1028 | int ret; |
1029 | unsigned char buf; | 1029 | unsigned char buf; |
1030 | 1030 | ||
1031 | ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1); | 1031 | ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1); |
1032 | if (ret < 0) | 1032 | if (ret < 0) |
1033 | return ret; | 1033 | return ret; |
@@ -1039,7 +1039,7 @@ static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight) | |||
1039 | static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker) | 1039 | static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker) |
1040 | { | 1040 | { |
1041 | unsigned char buf; | 1041 | unsigned char buf; |
1042 | 1042 | ||
1043 | if (flicker) | 1043 | if (flicker) |
1044 | buf = 0xff; | 1044 | buf = 0xff; |
1045 | else | 1045 | else |
@@ -1051,7 +1051,7 @@ static inline int pwc_get_flicker(struct pwc_device *pdev, int *flicker) | |||
1051 | { | 1051 | { |
1052 | int ret; | 1052 | int ret; |
1053 | unsigned char buf; | 1053 | unsigned char buf; |
1054 | 1054 | ||
1055 | ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1); | 1055 | ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1); |
1056 | if (ret < 0) | 1056 | if (ret < 0) |
1057 | return ret; | 1057 | return ret; |
@@ -1076,7 +1076,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) | |||
1076 | { | 1076 | { |
1077 | int ret; | 1077 | int ret; |
1078 | unsigned char buf; | 1078 | unsigned char buf; |
1079 | 1079 | ||
1080 | ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1); | 1080 | ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1); |
1081 | if (ret < 0) | 1081 | if (ret < 0) |
1082 | return ret; | 1082 | return ret; |
@@ -1087,7 +1087,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) | |||
1087 | static int pwc_mpt_reset(struct pwc_device *pdev, int flags) | 1087 | static int pwc_mpt_reset(struct pwc_device *pdev, int flags) |
1088 | { | 1088 | { |
1089 | unsigned char buf; | 1089 | unsigned char buf; |
1090 | 1090 | ||
1091 | buf = flags & 0x03; // only lower two bits are currently used | 1091 | buf = flags & 0x03; // only lower two bits are currently used |
1092 | return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1); | 1092 | return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1); |
1093 | } | 1093 | } |
@@ -1095,7 +1095,7 @@ static int pwc_mpt_reset(struct pwc_device *pdev, int flags) | |||
1095 | static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) | 1095 | static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) |
1096 | { | 1096 | { |
1097 | unsigned char buf[4]; | 1097 | unsigned char buf[4]; |
1098 | 1098 | ||
1099 | /* set new relative angle; angles are expressed in degrees * 100, | 1099 | /* set new relative angle; angles are expressed in degrees * 100, |
1100 | but cam as .5 degree resolution, hence divide by 200. Also | 1100 | but cam as .5 degree resolution, hence divide by 200. Also |
1101 | the angle must be multiplied by 64 before it's send to | 1101 | the angle must be multiplied by 64 before it's send to |
@@ -1114,7 +1114,7 @@ static inline int pwc_mpt_get_status(struct pwc_device *pdev, struct pwc_mpt_sta | |||
1114 | { | 1114 | { |
1115 | int ret; | 1115 | int ret; |
1116 | unsigned char buf[5]; | 1116 | unsigned char buf[5]; |
1117 | 1117 | ||
1118 | ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5); | 1118 | ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5); |
1119 | if (ret < 0) | 1119 | if (ret < 0) |
1120 | return ret; | 1120 | return ret; |
@@ -1129,14 +1129,14 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) | |||
1129 | { | 1129 | { |
1130 | unsigned char buf; | 1130 | unsigned char buf; |
1131 | int ret = -1, request; | 1131 | int ret = -1, request; |
1132 | 1132 | ||
1133 | if (pdev->type < 675) | 1133 | if (pdev->type < 675) |
1134 | request = SENSOR_TYPE_FORMATTER1; | 1134 | request = SENSOR_TYPE_FORMATTER1; |
1135 | else if (pdev->type < 730) | 1135 | else if (pdev->type < 730) |
1136 | return -1; /* The Vesta series doesn't have this call */ | 1136 | return -1; /* The Vesta series doesn't have this call */ |
1137 | else | 1137 | else |
1138 | request = SENSOR_TYPE_FORMATTER2; | 1138 | request = SENSOR_TYPE_FORMATTER2; |
1139 | 1139 | ||
1140 | ret = RecvControlMsg(GET_STATUS_CTL, request, 1); | 1140 | ret = RecvControlMsg(GET_STATUS_CTL, request, 1); |
1141 | if (ret < 0) | 1141 | if (ret < 0) |
1142 | return ret; | 1142 | return ret; |
@@ -1163,23 +1163,23 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1163 | ret = -EINVAL; | 1163 | ret = -EINVAL; |
1164 | break; | 1164 | break; |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | case VIDIOCPWCSUSER: | 1167 | case VIDIOCPWCSUSER: |
1168 | { | 1168 | { |
1169 | if (pwc_save_user(pdev)) | 1169 | if (pwc_save_user(pdev)) |
1170 | ret = -EINVAL; | 1170 | ret = -EINVAL; |
1171 | break; | 1171 | break; |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | case VIDIOCPWCFACTORY: | 1174 | case VIDIOCPWCFACTORY: |
1175 | { | 1175 | { |
1176 | if (pwc_restore_factory(pdev)) | 1176 | if (pwc_restore_factory(pdev)) |
1177 | ret = -EINVAL; | 1177 | ret = -EINVAL; |
1178 | break; | 1178 | break; |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | case VIDIOCPWCSCQUAL: | 1181 | case VIDIOCPWCSCQUAL: |
1182 | { | 1182 | { |
1183 | int *qual = arg; | 1183 | int *qual = arg; |
1184 | 1184 | ||
1185 | if (*qual < 0 || *qual > 3) | 1185 | if (*qual < 0 || *qual > 3) |
@@ -1190,14 +1190,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1190 | pdev->vcompression = *qual; | 1190 | pdev->vcompression = *qual; |
1191 | break; | 1191 | break; |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | case VIDIOCPWCGCQUAL: | 1194 | case VIDIOCPWCGCQUAL: |
1195 | { | 1195 | { |
1196 | int *qual = arg; | 1196 | int *qual = arg; |
1197 | *qual = pdev->vcompression; | 1197 | *qual = pdev->vcompression; |
1198 | break; | 1198 | break; |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | case VIDIOCPWCPROBE: | 1201 | case VIDIOCPWCPROBE: |
1202 | { | 1202 | { |
1203 | struct pwc_probe *probe = arg; | 1203 | struct pwc_probe *probe = arg; |
@@ -1220,27 +1220,27 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1220 | ret = -EINVAL; | 1220 | ret = -EINVAL; |
1221 | break; | 1221 | break; |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | case VIDIOCPWCGAGC: | 1224 | case VIDIOCPWCGAGC: |
1225 | { | 1225 | { |
1226 | int *agc = arg; | 1226 | int *agc = arg; |
1227 | 1227 | ||
1228 | if (pwc_get_agc(pdev, agc)) | 1228 | if (pwc_get_agc(pdev, agc)) |
1229 | ret = -EINVAL; | 1229 | ret = -EINVAL; |
1230 | break; | 1230 | break; |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | case VIDIOCPWCSSHUTTER: | 1233 | case VIDIOCPWCSSHUTTER: |
1234 | { | 1234 | { |
1235 | int *shutter_speed = arg; | 1235 | int *shutter_speed = arg; |
1236 | ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed); | 1236 | ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed); |
1237 | break; | 1237 | break; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | case VIDIOCPWCSAWB: | 1240 | case VIDIOCPWCSAWB: |
1241 | { | 1241 | { |
1242 | struct pwc_whitebalance *wb = arg; | 1242 | struct pwc_whitebalance *wb = arg; |
1243 | 1243 | ||
1244 | ret = pwc_set_awb(pdev, wb->mode); | 1244 | ret = pwc_set_awb(pdev, wb->mode); |
1245 | if (ret >= 0 && wb->mode == PWC_WB_MANUAL) { | 1245 | if (ret >= 0 && wb->mode == PWC_WB_MANUAL) { |
1246 | pwc_set_red_gain(pdev, wb->manual_red); | 1246 | pwc_set_red_gain(pdev, wb->manual_red); |
@@ -1270,18 +1270,18 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1270 | ret = pwc_read_red_gain(pdev, &wb->read_red); | 1270 | ret = pwc_read_red_gain(pdev, &wb->read_red); |
1271 | if (ret < 0) | 1271 | if (ret < 0) |
1272 | break; | 1272 | break; |
1273 | ret = pwc_read_blue_gain(pdev, &wb->read_blue); | 1273 | ret = pwc_read_blue_gain(pdev, &wb->read_blue); |
1274 | if (ret < 0) | 1274 | if (ret < 0) |
1275 | break; | 1275 | break; |
1276 | } | 1276 | } |
1277 | } | 1277 | } |
1278 | break; | 1278 | break; |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | case VIDIOCPWCSAWBSPEED: | 1281 | case VIDIOCPWCSAWBSPEED: |
1282 | { | 1282 | { |
1283 | struct pwc_wb_speed *wbs = arg; | 1283 | struct pwc_wb_speed *wbs = arg; |
1284 | 1284 | ||
1285 | if (wbs->control_speed > 0) { | 1285 | if (wbs->control_speed > 0) { |
1286 | ret = pwc_set_wb_speed(pdev, wbs->control_speed); | 1286 | ret = pwc_set_wb_speed(pdev, wbs->control_speed); |
1287 | } | 1287 | } |
@@ -1290,11 +1290,11 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1290 | } | 1290 | } |
1291 | break; | 1291 | break; |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | case VIDIOCPWCGAWBSPEED: | 1294 | case VIDIOCPWCGAWBSPEED: |
1295 | { | 1295 | { |
1296 | struct pwc_wb_speed *wbs = arg; | 1296 | struct pwc_wb_speed *wbs = arg; |
1297 | 1297 | ||
1298 | ret = pwc_get_wb_speed(pdev, &wbs->control_speed); | 1298 | ret = pwc_get_wb_speed(pdev, &wbs->control_speed); |
1299 | if (ret < 0) | 1299 | if (ret < 0) |
1300 | break; | 1300 | break; |
@@ -1304,7 +1304,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1304 | break; | 1304 | break; |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | case VIDIOCPWCSLED: | 1307 | case VIDIOCPWCSLED: |
1308 | { | 1308 | { |
1309 | struct pwc_leds *leds = arg; | 1309 | struct pwc_leds *leds = arg; |
1310 | ret = pwc_set_leds(pdev, leds->led_on, leds->led_off); | 1310 | ret = pwc_set_leds(pdev, leds->led_on, leds->led_off); |
@@ -1325,14 +1325,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1325 | ret = pwc_set_contour(pdev, *contour); | 1325 | ret = pwc_set_contour(pdev, *contour); |
1326 | break; | 1326 | break; |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | case VIDIOCPWCGCONTOUR: | 1329 | case VIDIOCPWCGCONTOUR: |
1330 | { | 1330 | { |
1331 | int *contour = arg; | 1331 | int *contour = arg; |
1332 | ret = pwc_get_contour(pdev, contour); | 1332 | ret = pwc_get_contour(pdev, contour); |
1333 | break; | 1333 | break; |
1334 | } | 1334 | } |
1335 | 1335 | ||
1336 | case VIDIOCPWCSBACKLIGHT: | 1336 | case VIDIOCPWCSBACKLIGHT: |
1337 | { | 1337 | { |
1338 | int *backlight = arg; | 1338 | int *backlight = arg; |
@@ -1346,7 +1346,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1346 | ret = pwc_get_backlight(pdev, backlight); | 1346 | ret = pwc_get_backlight(pdev, backlight); |
1347 | break; | 1347 | break; |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | case VIDIOCPWCSFLICKER: | 1350 | case VIDIOCPWCSFLICKER: |
1351 | { | 1351 | { |
1352 | int *flicker = arg; | 1352 | int *flicker = arg; |
@@ -1360,14 +1360,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1360 | ret = pwc_get_flicker(pdev, flicker); | 1360 | ret = pwc_get_flicker(pdev, flicker); |
1361 | break; | 1361 | break; |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | case VIDIOCPWCSDYNNOISE: | 1364 | case VIDIOCPWCSDYNNOISE: |
1365 | { | 1365 | { |
1366 | int *dynnoise = arg; | 1366 | int *dynnoise = arg; |
1367 | ret = pwc_set_dynamic_noise(pdev, *dynnoise); | 1367 | ret = pwc_set_dynamic_noise(pdev, *dynnoise); |
1368 | break; | 1368 | break; |
1369 | } | 1369 | } |
1370 | 1370 | ||
1371 | case VIDIOCPWCGDYNNOISE: | 1371 | case VIDIOCPWCGDYNNOISE: |
1372 | { | 1372 | { |
1373 | int *dynnoise = arg; | 1373 | int *dynnoise = arg; |
@@ -1381,61 +1381,61 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1381 | size->width = pdev->image.x; | 1381 | size->width = pdev->image.x; |
1382 | size->height = pdev->image.y; | 1382 | size->height = pdev->image.y; |
1383 | break; | 1383 | break; |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | case VIDIOCPWCMPTRESET: | 1386 | case VIDIOCPWCMPTRESET: |
1387 | { | 1387 | { |
1388 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1388 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1389 | { | 1389 | { |
1390 | int *flags = arg; | 1390 | int *flags = arg; |
1391 | 1391 | ||
1392 | ret = pwc_mpt_reset(pdev, *flags); | 1392 | ret = pwc_mpt_reset(pdev, *flags); |
1393 | if (ret >= 0) | 1393 | if (ret >= 0) |
1394 | { | 1394 | { |
1395 | pdev->pan_angle = 0; | 1395 | pdev->pan_angle = 0; |
1396 | pdev->tilt_angle = 0; | 1396 | pdev->tilt_angle = 0; |
1397 | } | 1397 | } |
1398 | } | 1398 | } |
1399 | else | 1399 | else |
1400 | { | 1400 | { |
1401 | ret = -ENXIO; | 1401 | ret = -ENXIO; |
1402 | } | 1402 | } |
1403 | break; | 1403 | break; |
1404 | } | 1404 | } |
1405 | 1405 | ||
1406 | case VIDIOCPWCMPTGRANGE: | 1406 | case VIDIOCPWCMPTGRANGE: |
1407 | { | 1407 | { |
1408 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1408 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1409 | { | 1409 | { |
1410 | struct pwc_mpt_range *range = arg; | 1410 | struct pwc_mpt_range *range = arg; |
1411 | *range = pdev->angle_range; | 1411 | *range = pdev->angle_range; |
1412 | } | 1412 | } |
1413 | else | 1413 | else |
1414 | { | 1414 | { |
1415 | ret = -ENXIO; | 1415 | ret = -ENXIO; |
1416 | } | 1416 | } |
1417 | break; | 1417 | break; |
1418 | } | 1418 | } |
1419 | 1419 | ||
1420 | case VIDIOCPWCMPTSANGLE: | 1420 | case VIDIOCPWCMPTSANGLE: |
1421 | { | 1421 | { |
1422 | int new_pan, new_tilt; | 1422 | int new_pan, new_tilt; |
1423 | 1423 | ||
1424 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1424 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1425 | { | 1425 | { |
1426 | struct pwc_mpt_angles *angles = arg; | 1426 | struct pwc_mpt_angles *angles = arg; |
1427 | /* The camera can only set relative angles, so | 1427 | /* The camera can only set relative angles, so |
1428 | do some calculations when getting an absolute angle . | 1428 | do some calculations when getting an absolute angle . |
1429 | */ | 1429 | */ |
1430 | if (angles->absolute) | 1430 | if (angles->absolute) |
1431 | { | 1431 | { |
1432 | new_pan = angles->pan; | 1432 | new_pan = angles->pan; |
1433 | new_tilt = angles->tilt; | 1433 | new_tilt = angles->tilt; |
1434 | } | 1434 | } |
1435 | else | 1435 | else |
1436 | { | 1436 | { |
1437 | new_pan = pdev->pan_angle + angles->pan; | 1437 | new_pan = pdev->pan_angle + angles->pan; |
1438 | new_tilt = pdev->tilt_angle + angles->tilt; | 1438 | new_tilt = pdev->tilt_angle + angles->tilt; |
1439 | } | 1439 | } |
1440 | /* check absolute ranges */ | 1440 | /* check absolute ranges */ |
1441 | if (new_pan < pdev->angle_range.pan_min || | 1441 | if (new_pan < pdev->angle_range.pan_min || |
@@ -1463,53 +1463,53 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1463 | pdev->tilt_angle += new_tilt; | 1463 | pdev->tilt_angle += new_tilt; |
1464 | } | 1464 | } |
1465 | if (ret == -EPIPE) /* stall -> out of range */ | 1465 | if (ret == -EPIPE) /* stall -> out of range */ |
1466 | ret = -ERANGE; | 1466 | ret = -ERANGE; |
1467 | } | 1467 | } |
1468 | } | 1468 | } |
1469 | else | 1469 | else |
1470 | { | 1470 | { |
1471 | ret = -ENXIO; | 1471 | ret = -ENXIO; |
1472 | } | 1472 | } |
1473 | break; | 1473 | break; |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | case VIDIOCPWCMPTGANGLE: | 1476 | case VIDIOCPWCMPTGANGLE: |
1477 | { | 1477 | { |
1478 | 1478 | ||
1479 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1479 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1480 | { | 1480 | { |
1481 | struct pwc_mpt_angles *angles = arg; | 1481 | struct pwc_mpt_angles *angles = arg; |
1482 | 1482 | ||
1483 | angles->absolute = 1; | 1483 | angles->absolute = 1; |
1484 | angles->pan = pdev->pan_angle; | 1484 | angles->pan = pdev->pan_angle; |
1485 | angles->tilt = pdev->tilt_angle; | 1485 | angles->tilt = pdev->tilt_angle; |
1486 | } | 1486 | } |
1487 | else | 1487 | else |
1488 | { | 1488 | { |
1489 | ret = -ENXIO; | 1489 | ret = -ENXIO; |
1490 | } | 1490 | } |
1491 | break; | 1491 | break; |
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | case VIDIOCPWCMPTSTATUS: | 1494 | case VIDIOCPWCMPTSTATUS: |
1495 | { | 1495 | { |
1496 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1496 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1497 | { | 1497 | { |
1498 | struct pwc_mpt_status *status = arg; | 1498 | struct pwc_mpt_status *status = arg; |
1499 | ret = pwc_mpt_get_status(pdev, status); | 1499 | ret = pwc_mpt_get_status(pdev, status); |
1500 | } | 1500 | } |
1501 | else | 1501 | else |
1502 | { | 1502 | { |
1503 | ret = -ENXIO; | 1503 | ret = -ENXIO; |
1504 | } | 1504 | } |
1505 | break; | 1505 | break; |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | case VIDIOCPWCGVIDCMD: | 1508 | case VIDIOCPWCGVIDCMD: |
1509 | { | 1509 | { |
1510 | struct pwc_video_command *cmd = arg; | 1510 | struct pwc_video_command *cmd = arg; |
1511 | 1511 | ||
1512 | cmd->type = pdev->type; | 1512 | cmd->type = pdev->type; |
1513 | cmd->release = pdev->release; | 1513 | cmd->release = pdev->release; |
1514 | cmd->command_len = pdev->cmd_len; | 1514 | cmd->command_len = pdev->cmd_len; |
1515 | memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len); | 1515 | memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len); |
@@ -1531,7 +1531,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1531 | ret = -ENOIOCTLCMD; | 1531 | ret = -ENOIOCTLCMD; |
1532 | break; | 1532 | break; |
1533 | } | 1533 | } |
1534 | 1534 | ||
1535 | if (ret > 0) | 1535 | if (ret > 0) |
1536 | return 0; | 1536 | return 0; |
1537 | return ret; | 1537 | return ret; |
diff --git a/drivers/usb/media/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 90eb26042817..41418294a32b 100644 --- a/drivers/usb/media/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -25,18 +25,18 @@ | |||
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* | 28 | /* |
29 | This code forms the interface between the USB layers and the Philips | 29 | This code forms the interface between the USB layers and the Philips |
30 | specific stuff. Some adanved stuff of the driver falls under an | 30 | specific stuff. Some adanved stuff of the driver falls under an |
31 | NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and | 31 | NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and |
32 | is thus not distributed in source form. The binary pwcx.o module | 32 | is thus not distributed in source form. The binary pwcx.o module |
33 | contains the code that falls under the NDA. | 33 | contains the code that falls under the NDA. |
34 | 34 | ||
35 | In case you're wondering: 'pwc' stands for "Philips WebCam", but | 35 | In case you're wondering: 'pwc' stands for "Philips WebCam", but |
36 | I really didn't want to type 'philips_web_cam' every time (I'm lazy as | 36 | I really didn't want to type 'philips_web_cam' every time (I'm lazy as |
37 | any Linux kernel hacker, but I don't like uncomprehensible abbreviations | 37 | any Linux kernel hacker, but I don't like uncomprehensible abbreviations |
38 | without explanation). | 38 | without explanation). |
39 | 39 | ||
40 | Oh yes, convention: to disctinguish between all the various pointers to | 40 | Oh yes, convention: to disctinguish between all the various pointers to |
41 | device-structures, I use these names for the pointer variables: | 41 | device-structures, I use these names for the pointer variables: |
42 | udev: struct usb_device * | 42 | udev: struct usb_device * |
@@ -170,14 +170,14 @@ static struct video_device pwc_template = { | |||
170 | 170 | ||
171 | /* Okay, this is some magic that I worked out and the reasoning behind it... | 171 | /* Okay, this is some magic that I worked out and the reasoning behind it... |
172 | 172 | ||
173 | The biggest problem with any USB device is of course: "what to do | 173 | The biggest problem with any USB device is of course: "what to do |
174 | when the user unplugs the device while it is in use by an application?" | 174 | when the user unplugs the device while it is in use by an application?" |
175 | We have several options: | 175 | We have several options: |
176 | 1) Curse them with the 7 plagues when they do (requires divine intervention) | 176 | 1) Curse them with the 7 plagues when they do (requires divine intervention) |
177 | 2) Tell them not to (won't work: they'll do it anyway) | 177 | 2) Tell them not to (won't work: they'll do it anyway) |
178 | 3) Oops the kernel (this will have a negative effect on a user's uptime) | 178 | 3) Oops the kernel (this will have a negative effect on a user's uptime) |
179 | 4) Do something sensible. | 179 | 4) Do something sensible. |
180 | 180 | ||
181 | Of course, we go for option 4. | 181 | Of course, we go for option 4. |
182 | 182 | ||
183 | It happens that this device will be linked to two times, once from | 183 | It happens that this device will be linked to two times, once from |
@@ -185,15 +185,15 @@ static struct video_device pwc_template = { | |||
185 | pointers. This is done when the device is probed() and all initialization | 185 | pointers. This is done when the device is probed() and all initialization |
186 | succeeded. The pwc_device struct links back to both structures. | 186 | succeeded. The pwc_device struct links back to both structures. |
187 | 187 | ||
188 | When a device is unplugged while in use it will be removed from the | 188 | When a device is unplugged while in use it will be removed from the |
189 | list of known USB devices; I also de-register it as a V4L device, but | 189 | list of known USB devices; I also de-register it as a V4L device, but |
190 | unfortunately I can't free the memory since the struct is still in use | 190 | unfortunately I can't free the memory since the struct is still in use |
191 | by the file descriptor. This free-ing is then deferend until the first | 191 | by the file descriptor. This free-ing is then deferend until the first |
192 | opportunity. Crude, but it works. | 192 | opportunity. Crude, but it works. |
193 | 193 | ||
194 | A small 'advantage' is that if a user unplugs the cam and plugs it back | 194 | A small 'advantage' is that if a user unplugs the cam and plugs it back |
195 | in, it should get assigned the same video device minor, but unfortunately | 195 | in, it should get assigned the same video device minor, but unfortunately |
196 | it's non-trivial to re-link the cam back to the video device... (that | 196 | it's non-trivial to re-link the cam back to the video device... (that |
197 | would surely be magic! :)) | 197 | would surely be magic! :)) |
198 | */ | 198 | */ |
199 | 199 | ||
@@ -203,14 +203,14 @@ static struct video_device pwc_template = { | |||
203 | /* Here we want the physical address of the memory. | 203 | /* Here we want the physical address of the memory. |
204 | * This is used when initializing the contents of the area. | 204 | * This is used when initializing the contents of the area. |
205 | */ | 205 | */ |
206 | static inline unsigned long kvirt_to_pa(unsigned long adr) | 206 | static inline unsigned long kvirt_to_pa(unsigned long adr) |
207 | { | 207 | { |
208 | unsigned long kva, ret; | 208 | unsigned long kva, ret; |
209 | 209 | ||
210 | kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); | 210 | kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); |
211 | kva |= adr & (PAGE_SIZE-1); /* restore the offset */ | 211 | kva |= adr & (PAGE_SIZE-1); /* restore the offset */ |
212 | ret = __pa(kva); | 212 | ret = __pa(kva); |
213 | return ret; | 213 | return ret; |
214 | } | 214 | } |
215 | 215 | ||
216 | static void * rvmalloc(unsigned long size) | 216 | static void * rvmalloc(unsigned long size) |
@@ -219,13 +219,13 @@ static void * rvmalloc(unsigned long size) | |||
219 | unsigned long adr; | 219 | unsigned long adr; |
220 | 220 | ||
221 | size=PAGE_ALIGN(size); | 221 | size=PAGE_ALIGN(size); |
222 | mem=vmalloc_32(size); | 222 | mem=vmalloc_32(size); |
223 | if (mem) | 223 | if (mem) |
224 | { | 224 | { |
225 | memset(mem, 0, size); /* Clear the ram out, no junk to the user */ | 225 | memset(mem, 0, size); /* Clear the ram out, no junk to the user */ |
226 | adr=(unsigned long) mem; | 226 | adr=(unsigned long) mem; |
227 | while (size > 0) | 227 | while (size > 0) |
228 | { | 228 | { |
229 | SetPageReserved(vmalloc_to_page((void *)adr)); | 229 | SetPageReserved(vmalloc_to_page((void *)adr)); |
230 | adr+=PAGE_SIZE; | 230 | adr+=PAGE_SIZE; |
231 | size-=PAGE_SIZE; | 231 | size-=PAGE_SIZE; |
@@ -236,13 +236,13 @@ static void * rvmalloc(unsigned long size) | |||
236 | 236 | ||
237 | static void rvfree(void * mem, unsigned long size) | 237 | static void rvfree(void * mem, unsigned long size) |
238 | { | 238 | { |
239 | unsigned long adr; | 239 | unsigned long adr; |
240 | 240 | ||
241 | if (mem) | 241 | if (mem) |
242 | { | 242 | { |
243 | adr=(unsigned long) mem; | 243 | adr=(unsigned long) mem; |
244 | while ((long) size > 0) | 244 | while ((long) size > 0) |
245 | { | 245 | { |
246 | ClearPageReserved(vmalloc_to_page((void *)adr)); | 246 | ClearPageReserved(vmalloc_to_page((void *)adr)); |
247 | adr+=PAGE_SIZE; | 247 | adr+=PAGE_SIZE; |
248 | size-=PAGE_SIZE; | 248 | size-=PAGE_SIZE; |
@@ -263,13 +263,13 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
263 | 263 | ||
264 | if (pdev == NULL) | 264 | if (pdev == NULL) |
265 | return -ENXIO; | 265 | return -ENXIO; |
266 | 266 | ||
267 | #ifdef PWC_MAGIC | 267 | #ifdef PWC_MAGIC |
268 | if (pdev->magic != PWC_MAGIC) { | 268 | if (pdev->magic != PWC_MAGIC) { |
269 | Err("allocate_buffers(): magic failed.\n"); | 269 | Err("allocate_buffers(): magic failed.\n"); |
270 | return -ENXIO; | 270 | return -ENXIO; |
271 | } | 271 | } |
272 | #endif | 272 | #endif |
273 | /* Allocate Isochronous pipe buffers */ | 273 | /* Allocate Isochronous pipe buffers */ |
274 | for (i = 0; i < MAX_ISO_BUFS; i++) { | 274 | for (i = 0; i < MAX_ISO_BUFS; i++) { |
275 | if (pdev->sbuf[i].data == NULL) { | 275 | if (pdev->sbuf[i].data == NULL) { |
@@ -308,7 +308,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
308 | memset(kbuf, 128, PWC_FRAME_SIZE); | 308 | memset(kbuf, 128, PWC_FRAME_SIZE); |
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | /* Allocate decompressor table space */ | 312 | /* Allocate decompressor table space */ |
313 | kbuf = NULL; | 313 | kbuf = NULL; |
314 | switch (pdev->type) | 314 | switch (pdev->type) |
@@ -320,7 +320,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
320 | case 730: | 320 | case 730: |
321 | case 740: | 321 | case 740: |
322 | case 750: | 322 | case 750: |
323 | #if 0 | 323 | #if 0 |
324 | Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private)); | 324 | Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private)); |
325 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */ | 325 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */ |
326 | break; | 326 | break; |
@@ -329,11 +329,11 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
329 | /* TODO & FIXME */ | 329 | /* TODO & FIXME */ |
330 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); | 330 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); |
331 | break; | 331 | break; |
332 | #endif | 332 | #endif |
333 | ; | 333 | ; |
334 | } | 334 | } |
335 | pdev->decompress_data = kbuf; | 335 | pdev->decompress_data = kbuf; |
336 | 336 | ||
337 | /* Allocate image buffer; double buffer for mmap() */ | 337 | /* Allocate image buffer; double buffer for mmap() */ |
338 | kbuf = rvmalloc(default_mbufs * pdev->len_per_image); | 338 | kbuf = rvmalloc(default_mbufs * pdev->len_per_image); |
339 | if (kbuf == NULL) { | 339 | if (kbuf == NULL) { |
@@ -348,7 +348,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
348 | pdev->image_ptr[i] = NULL; | 348 | pdev->image_ptr[i] = NULL; |
349 | 349 | ||
350 | kbuf = NULL; | 350 | kbuf = NULL; |
351 | 351 | ||
352 | Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n"); | 352 | Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n"); |
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
@@ -366,7 +366,7 @@ static void pwc_free_buffers(struct pwc_device *pdev) | |||
366 | Err("free_buffers(): magic failed.\n"); | 366 | Err("free_buffers(): magic failed.\n"); |
367 | return; | 367 | return; |
368 | } | 368 | } |
369 | #endif | 369 | #endif |
370 | 370 | ||
371 | /* Release Iso-pipe buffers */ | 371 | /* Release Iso-pipe buffers */ |
372 | for (i = 0; i < MAX_ISO_BUFS; i++) | 372 | for (i = 0; i < MAX_ISO_BUFS; i++) |
@@ -403,17 +403,17 @@ static void pwc_free_buffers(struct pwc_device *pdev) | |||
403 | rvfree(pdev->image_data, default_mbufs * pdev->len_per_image); | 403 | rvfree(pdev->image_data, default_mbufs * pdev->len_per_image); |
404 | } | 404 | } |
405 | pdev->image_data = NULL; | 405 | pdev->image_data = NULL; |
406 | 406 | ||
407 | Trace(TRACE_MEMORY, "Leaving free_buffers().\n"); | 407 | Trace(TRACE_MEMORY, "Leaving free_buffers().\n"); |
408 | } | 408 | } |
409 | 409 | ||
410 | /* The frame & image buffer mess. | 410 | /* The frame & image buffer mess. |
411 | 411 | ||
412 | Yes, this is a mess. Well, it used to be simple, but alas... In this | 412 | Yes, this is a mess. Well, it used to be simple, but alas... In this |
413 | module, 3 buffers schemes are used to get the data from the USB bus to | 413 | module, 3 buffers schemes are used to get the data from the USB bus to |
414 | the user program. The first scheme involves the ISO buffers (called thus | 414 | the user program. The first scheme involves the ISO buffers (called thus |
415 | since they transport ISO data from the USB controller), and not really | 415 | since they transport ISO data from the USB controller), and not really |
416 | interesting. Suffices to say the data from this buffer is quickly | 416 | interesting. Suffices to say the data from this buffer is quickly |
417 | gathered in an interrupt handler (pwc_isoc_handler) and placed into the | 417 | gathered in an interrupt handler (pwc_isoc_handler) and placed into the |
418 | frame buffer. | 418 | frame buffer. |
419 | 419 | ||
@@ -443,8 +443,8 @@ static void pwc_free_buffers(struct pwc_device *pdev) | |||
443 | and a 'full' frame list: | 443 | and a 'full' frame list: |
444 | * Initially, all frame buffers but one are on the 'empty' list; the one | 444 | * Initially, all frame buffers but one are on the 'empty' list; the one |
445 | remaining buffer is our initial fill frame. | 445 | remaining buffer is our initial fill frame. |
446 | * If a frame is needed for filling, we try to take it from the 'empty' | 446 | * If a frame is needed for filling, we try to take it from the 'empty' |
447 | list, unless that list is empty, in which case we take the buffer at | 447 | list, unless that list is empty, in which case we take the buffer at |
448 | the head of the 'full' list. | 448 | the head of the 'full' list. |
449 | * When our fill buffer has been filled, it is appended to the 'full' | 449 | * When our fill buffer has been filled, it is appended to the 'full' |
450 | list. | 450 | list. |
@@ -646,7 +646,7 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
646 | case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break; | 646 | case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break; |
647 | } | 647 | } |
648 | Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg); | 648 | Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg); |
649 | /* Give up after a number of contiguous errors on the USB bus. | 649 | /* Give up after a number of contiguous errors on the USB bus. |
650 | Appearantly something is wrong so we simulate an unplug event. | 650 | Appearantly something is wrong so we simulate an unplug event. |
651 | */ | 651 | */ |
652 | if (++pdev->visoc_errors > MAX_ISOC_ERRORS) | 652 | if (++pdev->visoc_errors > MAX_ISOC_ERRORS) |
@@ -673,8 +673,8 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
673 | pdev->visoc_errors = 0; | 673 | pdev->visoc_errors = 0; |
674 | 674 | ||
675 | /* vsync: 0 = don't copy data | 675 | /* vsync: 0 = don't copy data |
676 | 1 = sync-hunt | 676 | 1 = sync-hunt |
677 | 2 = synched | 677 | 2 = synched |
678 | */ | 678 | */ |
679 | /* Compact data */ | 679 | /* Compact data */ |
680 | for (i = 0; i < urb->number_of_packets; i++) { | 680 | for (i = 0; i < urb->number_of_packets; i++) { |
@@ -701,18 +701,18 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
701 | } /* ..flen > 0 */ | 701 | } /* ..flen > 0 */ |
702 | 702 | ||
703 | if (flen < pdev->vlast_packet_size) { | 703 | if (flen < pdev->vlast_packet_size) { |
704 | /* Shorter packet... We probably have the end of an image-frame; | 704 | /* Shorter packet... We probably have the end of an image-frame; |
705 | wake up read() process and let select()/poll() do something. | 705 | wake up read() process and let select()/poll() do something. |
706 | Decompression is done in user time over there. | 706 | Decompression is done in user time over there. |
707 | */ | 707 | */ |
708 | if (pdev->vsync == 2) { | 708 | if (pdev->vsync == 2) { |
709 | /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus | 709 | /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus |
710 | frames on the USB wire after an exposure change. This conditition is | 710 | frames on the USB wire after an exposure change. This conditition is |
711 | however detected in the cam and a bit is set in the header. | 711 | however detected in the cam and a bit is set in the header. |
712 | */ | 712 | */ |
713 | if (pdev->type == 730) { | 713 | if (pdev->type == 730) { |
714 | unsigned char *ptr = (unsigned char *)fbuf->data; | 714 | unsigned char *ptr = (unsigned char *)fbuf->data; |
715 | 715 | ||
716 | if (ptr[1] == 1 && ptr[0] & 0x10) { | 716 | if (ptr[1] == 1 && ptr[0] & 0x10) { |
717 | #if PWC_DEBUG | 717 | #if PWC_DEBUG |
718 | Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence); | 718 | Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence); |
@@ -733,13 +733,13 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
733 | Info("Image is normal.\n"); | 733 | Info("Image is normal.\n"); |
734 | } | 734 | } |
735 | pdev->vmirror = ptr[0] & 0x03; | 735 | pdev->vmirror = ptr[0] & 0x03; |
736 | /* Sometimes the trailer of the 730 is still sent as a 4 byte packet | 736 | /* Sometimes the trailer of the 730 is still sent as a 4 byte packet |
737 | after a short frame; this condition is filtered out specifically. A 4 byte | 737 | after a short frame; this condition is filtered out specifically. A 4 byte |
738 | frame doesn't make sense anyway. | 738 | frame doesn't make sense anyway. |
739 | So we get either this sequence: | 739 | So we get either this sequence: |
740 | drop_bit set -> 4 byte frame -> short frame -> good frame | 740 | drop_bit set -> 4 byte frame -> short frame -> good frame |
741 | Or this one: | 741 | Or this one: |
742 | drop_bit set -> short frame -> good frame | 742 | drop_bit set -> short frame -> good frame |
743 | So we drop either 3 or 2 frames in all! | 743 | So we drop either 3 or 2 frames in all! |
744 | */ | 744 | */ |
745 | if (fbuf->filled == 4) | 745 | if (fbuf->filled == 4) |
@@ -830,7 +830,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) | |||
830 | intf = usb_ifnum_to_if(udev, 0); | 830 | intf = usb_ifnum_to_if(udev, 0); |
831 | if (intf) | 831 | if (intf) |
832 | idesc = usb_altnum_to_altsetting(intf, pdev->valternate); | 832 | idesc = usb_altnum_to_altsetting(intf, pdev->valternate); |
833 | 833 | ||
834 | if (!idesc) | 834 | if (!idesc) |
835 | return -EFAULT; | 835 | return -EFAULT; |
836 | 836 | ||
@@ -841,7 +841,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) | |||
841 | pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize); | 841 | pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize); |
842 | break; | 842 | break; |
843 | } | 843 | } |
844 | 844 | ||
845 | if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { | 845 | if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { |
846 | Err("Failed to find packet size for video endpoint in current alternate setting.\n"); | 846 | Err("Failed to find packet size for video endpoint in current alternate setting.\n"); |
847 | return -ENFILE; /* Odd error, that should be noticeable */ | 847 | return -ENFILE; /* Odd error, that should be noticeable */ |
@@ -875,18 +875,18 @@ static int pwc_isoc_init(struct pwc_device *pdev) | |||
875 | return ret; | 875 | return ret; |
876 | } | 876 | } |
877 | 877 | ||
878 | /* init URB structure */ | 878 | /* init URB structure */ |
879 | for (i = 0; i < MAX_ISO_BUFS; i++) { | 879 | for (i = 0; i < MAX_ISO_BUFS; i++) { |
880 | urb = pdev->sbuf[i].urb; | 880 | urb = pdev->sbuf[i].urb; |
881 | 881 | ||
882 | urb->interval = 1; // devik | 882 | urb->interval = 1; // devik |
883 | urb->dev = udev; | 883 | urb->dev = udev; |
884 | urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); | 884 | urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); |
885 | urb->transfer_flags = URB_ISO_ASAP; | 885 | urb->transfer_flags = URB_ISO_ASAP; |
886 | urb->transfer_buffer = pdev->sbuf[i].data; | 886 | urb->transfer_buffer = pdev->sbuf[i].data; |
887 | urb->transfer_buffer_length = ISO_BUFFER_SIZE; | 887 | urb->transfer_buffer_length = ISO_BUFFER_SIZE; |
888 | urb->complete = pwc_isoc_handler; | 888 | urb->complete = pwc_isoc_handler; |
889 | urb->context = pdev; | 889 | urb->context = pdev; |
890 | urb->start_frame = 0; | 890 | urb->start_frame = 0; |
891 | urb->number_of_packets = ISO_FRAMES_PER_DESC; | 891 | urb->number_of_packets = ISO_FRAMES_PER_DESC; |
892 | for (j = 0; j < ISO_FRAMES_PER_DESC; j++) { | 892 | for (j = 0; j < ISO_FRAMES_PER_DESC; j++) { |
@@ -935,7 +935,7 @@ static void pwc_isoc_cleanup(struct pwc_device *pdev) | |||
935 | } | 935 | } |
936 | 936 | ||
937 | /* Stop camera, but only if we are sure the camera is still there (unplug | 937 | /* Stop camera, but only if we are sure the camera is still there (unplug |
938 | is signalled by EPIPE) | 938 | is signalled by EPIPE) |
939 | */ | 939 | */ |
940 | if (pdev->error_status && pdev->error_status != EPIPE) { | 940 | if (pdev->error_status && pdev->error_status != EPIPE) { |
941 | Trace(TRACE_OPEN, "Setting alternate interface 0.\n"); | 941 | Trace(TRACE_OPEN, "Setting alternate interface 0.\n"); |
@@ -956,12 +956,12 @@ int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_f | |||
956 | pwc_reset_buffers(pdev); | 956 | pwc_reset_buffers(pdev); |
957 | /* Try to set video mode... */ | 957 | /* Try to set video mode... */ |
958 | start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot); | 958 | start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot); |
959 | if (ret) { | 959 | if (ret) { |
960 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n"); | 960 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n"); |
961 | /* That failed... restore old mode (we know that worked) */ | 961 | /* That failed... restore old mode (we know that worked) */ |
962 | start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot); | 962 | start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot); |
963 | if (start) { | 963 | if (start) { |
964 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n"); | 964 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n"); |
965 | } | 965 | } |
966 | } | 966 | } |
967 | if (start == 0) | 967 | if (start == 0) |
@@ -987,18 +987,18 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
987 | struct pwc_device *pdev; | 987 | struct pwc_device *pdev; |
988 | 988 | ||
989 | Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev); | 989 | Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev); |
990 | 990 | ||
991 | pdev = (struct pwc_device *)vdev->priv; | 991 | pdev = (struct pwc_device *)vdev->priv; |
992 | if (pdev == NULL) | 992 | if (pdev == NULL) |
993 | BUG(); | 993 | BUG(); |
994 | if (pdev->vopen) | 994 | if (pdev->vopen) |
995 | return -EBUSY; | 995 | return -EBUSY; |
996 | 996 | ||
997 | down(&pdev->modlock); | 997 | down(&pdev->modlock); |
998 | if (!pdev->usb_init) { | 998 | if (!pdev->usb_init) { |
999 | Trace(TRACE_OPEN, "Doing first time initialization.\n"); | 999 | Trace(TRACE_OPEN, "Doing first time initialization.\n"); |
1000 | pdev->usb_init = 1; | 1000 | pdev->usb_init = 1; |
1001 | 1001 | ||
1002 | if (pwc_trace & TRACE_OPEN) | 1002 | if (pwc_trace & TRACE_OPEN) |
1003 | { | 1003 | { |
1004 | /* Query sensor type */ | 1004 | /* Query sensor type */ |
@@ -1036,7 +1036,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1036 | /* Set LED on/off time */ | 1036 | /* Set LED on/off time */ |
1037 | if (pwc_set_leds(pdev, led_on, led_off) < 0) | 1037 | if (pwc_set_leds(pdev, led_on, led_off) < 0) |
1038 | Info("Failed to set LED on/off time.\n"); | 1038 | Info("Failed to set LED on/off time.\n"); |
1039 | 1039 | ||
1040 | pwc_construct(pdev); /* set min/max sizes correct */ | 1040 | pwc_construct(pdev); /* set min/max sizes correct */ |
1041 | 1041 | ||
1042 | /* So far, so good. Allocate memory. */ | 1042 | /* So far, so good. Allocate memory. */ |
@@ -1046,7 +1046,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1046 | up(&pdev->modlock); | 1046 | up(&pdev->modlock); |
1047 | return i; | 1047 | return i; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | /* Reset buffers & parameters */ | 1050 | /* Reset buffers & parameters */ |
1051 | pwc_reset_buffers(pdev); | 1051 | pwc_reset_buffers(pdev); |
1052 | for (i = 0; i < default_mbufs; i++) | 1052 | for (i = 0; i < default_mbufs; i++) |
@@ -1081,7 +1081,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1081 | up(&pdev->modlock); | 1081 | up(&pdev->modlock); |
1082 | return i; | 1082 | return i; |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | i = pwc_isoc_init(pdev); | 1085 | i = pwc_isoc_init(pdev); |
1086 | if (i) { | 1086 | if (i) { |
1087 | Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i); | 1087 | Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i); |
@@ -1155,13 +1155,13 @@ static int pwc_video_close(struct inode *inode, struct file *file) | |||
1155 | /* | 1155 | /* |
1156 | * FIXME: what about two parallel reads ???? | 1156 | * FIXME: what about two parallel reads ???? |
1157 | * ANSWER: Not supported. You can't open the device more than once, | 1157 | * ANSWER: Not supported. You can't open the device more than once, |
1158 | despite what the V4L1 interface says. First, I don't see | 1158 | despite what the V4L1 interface says. First, I don't see |
1159 | the need, second there's no mechanism of alerting the | 1159 | the need, second there's no mechanism of alerting the |
1160 | 2nd/3rd/... process of events like changing image size. | 1160 | 2nd/3rd/... process of events like changing image size. |
1161 | And I don't see the point of blocking that for the | 1161 | And I don't see the point of blocking that for the |
1162 | 2nd/3rd/... process. | 1162 | 2nd/3rd/... process. |
1163 | In multi-threaded environments reading parallel from any | 1163 | In multi-threaded environments reading parallel from any |
1164 | device is tricky anyhow. | 1164 | device is tricky anyhow. |
1165 | */ | 1165 | */ |
1166 | 1166 | ||
1167 | static ssize_t pwc_video_read(struct file *file, char __user * buf, | 1167 | static ssize_t pwc_video_read(struct file *file, char __user * buf, |
@@ -1171,7 +1171,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, | |||
1171 | struct pwc_device *pdev; | 1171 | struct pwc_device *pdev; |
1172 | int noblock = file->f_flags & O_NONBLOCK; | 1172 | int noblock = file->f_flags & O_NONBLOCK; |
1173 | DECLARE_WAITQUEUE(wait, current); | 1173 | DECLARE_WAITQUEUE(wait, current); |
1174 | int bytes_to_read; | 1174 | int bytes_to_read; |
1175 | 1175 | ||
1176 | Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count); | 1176 | Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count); |
1177 | if (vdev == NULL) | 1177 | if (vdev == NULL) |
@@ -1193,22 +1193,22 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, | |||
1193 | set_current_state(TASK_RUNNING); | 1193 | set_current_state(TASK_RUNNING); |
1194 | return -pdev->error_status ; | 1194 | return -pdev->error_status ; |
1195 | } | 1195 | } |
1196 | if (noblock) { | 1196 | if (noblock) { |
1197 | remove_wait_queue(&pdev->frameq, &wait); | 1197 | remove_wait_queue(&pdev->frameq, &wait); |
1198 | set_current_state(TASK_RUNNING); | 1198 | set_current_state(TASK_RUNNING); |
1199 | return -EWOULDBLOCK; | 1199 | return -EWOULDBLOCK; |
1200 | } | 1200 | } |
1201 | if (signal_pending(current)) { | 1201 | if (signal_pending(current)) { |
1202 | remove_wait_queue(&pdev->frameq, &wait); | 1202 | remove_wait_queue(&pdev->frameq, &wait); |
1203 | set_current_state(TASK_RUNNING); | 1203 | set_current_state(TASK_RUNNING); |
1204 | return -ERESTARTSYS; | 1204 | return -ERESTARTSYS; |
1205 | } | 1205 | } |
1206 | schedule(); | 1206 | schedule(); |
1207 | set_current_state(TASK_INTERRUPTIBLE); | 1207 | set_current_state(TASK_INTERRUPTIBLE); |
1208 | } | 1208 | } |
1209 | remove_wait_queue(&pdev->frameq, &wait); | 1209 | remove_wait_queue(&pdev->frameq, &wait); |
1210 | set_current_state(TASK_RUNNING); | 1210 | set_current_state(TASK_RUNNING); |
1211 | 1211 | ||
1212 | /* Decompress and release frame */ | 1212 | /* Decompress and release frame */ |
1213 | if (pwc_handle_frame(pdev)) | 1213 | if (pwc_handle_frame(pdev)) |
1214 | return -EFAULT; | 1214 | return -EFAULT; |
@@ -1218,7 +1218,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, | |||
1218 | if (pdev->vpalette == VIDEO_PALETTE_RAW) | 1218 | if (pdev->vpalette == VIDEO_PALETTE_RAW) |
1219 | bytes_to_read = pdev->frame_size; | 1219 | bytes_to_read = pdev->frame_size; |
1220 | else | 1220 | else |
1221 | bytes_to_read = pdev->view.size; | 1221 | bytes_to_read = pdev->view.size; |
1222 | 1222 | ||
1223 | /* copy bytes to user space; we allow for partial reads */ | 1223 | /* copy bytes to user space; we allow for partial reads */ |
1224 | if (count + pdev->image_read_pos > bytes_to_read) | 1224 | if (count + pdev->image_read_pos > bytes_to_read) |
@@ -1348,11 +1348,11 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1348 | struct video_picture *p = arg; | 1348 | struct video_picture *p = arg; |
1349 | /* | 1349 | /* |
1350 | * FIXME: Suppose we are mid read | 1350 | * FIXME: Suppose we are mid read |
1351 | ANSWER: No problem: the firmware of the camera | 1351 | ANSWER: No problem: the firmware of the camera |
1352 | can handle brightness/contrast/etc | 1352 | can handle brightness/contrast/etc |
1353 | changes at _any_ time, and the palette | 1353 | changes at _any_ time, and the palette |
1354 | is used exactly once in the uncompress | 1354 | is used exactly once in the uncompress |
1355 | routine. | 1355 | routine. |
1356 | */ | 1356 | */ |
1357 | pwc_set_brightness(pdev, p->brightness); | 1357 | pwc_set_brightness(pdev, p->brightness); |
1358 | pwc_set_contrast(pdev, p->contrast); | 1358 | pwc_set_contrast(pdev, p->contrast); |
@@ -1373,21 +1373,21 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1373 | break; | 1373 | break; |
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | /* Window/size parameters */ | 1376 | /* Window/size parameters */ |
1377 | case VIDIOCGWIN: | 1377 | case VIDIOCGWIN: |
1378 | { | 1378 | { |
1379 | struct video_window *vw = arg; | 1379 | struct video_window *vw = arg; |
1380 | 1380 | ||
1381 | vw->x = 0; | 1381 | vw->x = 0; |
1382 | vw->y = 0; | 1382 | vw->y = 0; |
1383 | vw->width = pdev->view.x; | 1383 | vw->width = pdev->view.x; |
1384 | vw->height = pdev->view.y; | 1384 | vw->height = pdev->view.y; |
1385 | vw->chromakey = 0; | 1385 | vw->chromakey = 0; |
1386 | vw->flags = (pdev->vframes << PWC_FPS_SHIFT) | | 1386 | vw->flags = (pdev->vframes << PWC_FPS_SHIFT) | |
1387 | (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0); | 1387 | (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0); |
1388 | break; | 1388 | break; |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | case VIDIOCSWIN: | 1391 | case VIDIOCSWIN: |
1392 | { | 1392 | { |
1393 | struct video_window *vw = arg; | 1393 | struct video_window *vw = arg; |
@@ -1402,9 +1402,9 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1402 | ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot); | 1402 | ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot); |
1403 | if (ret) | 1403 | if (ret) |
1404 | return ret; | 1404 | return ret; |
1405 | break; | 1405 | break; |
1406 | } | 1406 | } |
1407 | 1407 | ||
1408 | /* We don't have overlay support (yet) */ | 1408 | /* We don't have overlay support (yet) */ |
1409 | case VIDIOCGFBUF: | 1409 | case VIDIOCGFBUF: |
1410 | { | 1410 | { |
@@ -1471,8 +1471,8 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1471 | return -EBUSY; /* buffer wasn't available. Bummer */ | 1471 | return -EBUSY; /* buffer wasn't available. Bummer */ |
1472 | pdev->image_used[vm->frame] = 1; | 1472 | pdev->image_used[vm->frame] = 1; |
1473 | 1473 | ||
1474 | /* Okay, we're done here. In the SYNC call we wait until a | 1474 | /* Okay, we're done here. In the SYNC call we wait until a |
1475 | frame comes available, then expand image into the given | 1475 | frame comes available, then expand image into the given |
1476 | buffer. | 1476 | buffer. |
1477 | In contrast to the CPiA cam the Philips cams deliver a | 1477 | In contrast to the CPiA cam the Philips cams deliver a |
1478 | constant stream, almost like a grabber card. Also, | 1478 | constant stream, almost like a grabber card. Also, |
@@ -1487,16 +1487,16 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1487 | { | 1487 | { |
1488 | /* The doc says: "Whenever a buffer is used it should | 1488 | /* The doc says: "Whenever a buffer is used it should |
1489 | call VIDIOCSYNC to free this frame up and continue." | 1489 | call VIDIOCSYNC to free this frame up and continue." |
1490 | 1490 | ||
1491 | The only odd thing about this whole procedure is | 1491 | The only odd thing about this whole procedure is |
1492 | that MCAPTURE flags the buffer as "in use", and | 1492 | that MCAPTURE flags the buffer as "in use", and |
1493 | SYNC immediately unmarks it, while it isn't | 1493 | SYNC immediately unmarks it, while it isn't |
1494 | after SYNC that you know that the buffer actually | 1494 | after SYNC that you know that the buffer actually |
1495 | got filled! So you better not start a CAPTURE in | 1495 | got filled! So you better not start a CAPTURE in |
1496 | the same frame immediately (use double buffering). | 1496 | the same frame immediately (use double buffering). |
1497 | This is not a problem for this cam, since it has | 1497 | This is not a problem for this cam, since it has |
1498 | extra intermediate buffers, but a hardware | 1498 | extra intermediate buffers, but a hardware |
1499 | grabber card will then overwrite the buffer | 1499 | grabber card will then overwrite the buffer |
1500 | you're working on. | 1500 | you're working on. |
1501 | */ | 1501 | */ |
1502 | int *mbuf = arg; | 1502 | int *mbuf = arg; |
@@ -1512,10 +1512,10 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1512 | return -EINVAL; | 1512 | return -EINVAL; |
1513 | 1513 | ||
1514 | /* Add ourselves to the frame wait-queue. | 1514 | /* Add ourselves to the frame wait-queue. |
1515 | 1515 | ||
1516 | FIXME: needs auditing for safety. | 1516 | FIXME: needs auditing for safety. |
1517 | QUESTION: In what respect? I think that using the | 1517 | QUESTION: In what respect? I think that using the |
1518 | frameq is safe now. | 1518 | frameq is safe now. |
1519 | */ | 1519 | */ |
1520 | add_wait_queue(&pdev->frameq, &wait); | 1520 | add_wait_queue(&pdev->frameq, &wait); |
1521 | while (pdev->full_frames == NULL) { | 1521 | while (pdev->full_frames == NULL) { |
@@ -1524,21 +1524,21 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1524 | set_current_state(TASK_RUNNING); | 1524 | set_current_state(TASK_RUNNING); |
1525 | return -pdev->error_status; | 1525 | return -pdev->error_status; |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | if (signal_pending(current)) { | 1528 | if (signal_pending(current)) { |
1529 | remove_wait_queue(&pdev->frameq, &wait); | 1529 | remove_wait_queue(&pdev->frameq, &wait); |
1530 | set_current_state(TASK_RUNNING); | 1530 | set_current_state(TASK_RUNNING); |
1531 | return -ERESTARTSYS; | 1531 | return -ERESTARTSYS; |
1532 | } | 1532 | } |
1533 | schedule(); | 1533 | schedule(); |
1534 | set_current_state(TASK_INTERRUPTIBLE); | 1534 | set_current_state(TASK_INTERRUPTIBLE); |
1535 | } | 1535 | } |
1536 | remove_wait_queue(&pdev->frameq, &wait); | 1536 | remove_wait_queue(&pdev->frameq, &wait); |
1537 | set_current_state(TASK_RUNNING); | 1537 | set_current_state(TASK_RUNNING); |
1538 | 1538 | ||
1539 | /* The frame is ready. Expand in the image buffer | 1539 | /* The frame is ready. Expand in the image buffer |
1540 | requested by the user. I don't care if you | 1540 | requested by the user. I don't care if you |
1541 | mmap() 5 buffers and request data in this order: | 1541 | mmap() 5 buffers and request data in this order: |
1542 | buffer 4 2 3 0 1 2 3 0 4 3 1 . . . | 1542 | buffer 4 2 3 0 1 2 3 0 4 3 1 . . . |
1543 | Grabber hardware may not be so forgiving. | 1543 | Grabber hardware may not be so forgiving. |
1544 | */ | 1544 | */ |
@@ -1551,11 +1551,11 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1551 | return -EFAULT; | 1551 | return -EFAULT; |
1552 | break; | 1552 | break; |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | case VIDIOCGAUDIO: | 1555 | case VIDIOCGAUDIO: |
1556 | { | 1556 | { |
1557 | struct video_audio *v = arg; | 1557 | struct video_audio *v = arg; |
1558 | 1558 | ||
1559 | strcpy(v->name, "Microphone"); | 1559 | strcpy(v->name, "Microphone"); |
1560 | v->audio = -1; /* unknown audio minor */ | 1560 | v->audio = -1; /* unknown audio minor */ |
1561 | v->flags = 0; | 1561 | v->flags = 0; |
@@ -1565,19 +1565,19 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1565 | v->treble = 0; | 1565 | v->treble = 0; |
1566 | v->balance = 0x8000; | 1566 | v->balance = 0x8000; |
1567 | v->step = 1; | 1567 | v->step = 1; |
1568 | break; | 1568 | break; |
1569 | } | 1569 | } |
1570 | 1570 | ||
1571 | case VIDIOCSAUDIO: | 1571 | case VIDIOCSAUDIO: |
1572 | { | 1572 | { |
1573 | /* Dummy: nothing can be set */ | 1573 | /* Dummy: nothing can be set */ |
1574 | break; | 1574 | break; |
1575 | } | 1575 | } |
1576 | 1576 | ||
1577 | case VIDIOCGUNIT: | 1577 | case VIDIOCGUNIT: |
1578 | { | 1578 | { |
1579 | struct video_unit *vu = arg; | 1579 | struct video_unit *vu = arg; |
1580 | 1580 | ||
1581 | vu->video = pdev->vdev->minor & 0x3F; | 1581 | vu->video = pdev->vdev->minor & 0x3F; |
1582 | vu->audio = -1; /* not known yet */ | 1582 | vu->audio = -1; /* not known yet */ |
1583 | vu->vbi = -1; | 1583 | vu->vbi = -1; |
@@ -1589,7 +1589,7 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1589 | return pwc_ioctl(pdev, cmd, arg); | 1589 | return pwc_ioctl(pdev, cmd, arg); |
1590 | } /* ..switch */ | 1590 | } /* ..switch */ |
1591 | return 0; | 1591 | return 0; |
1592 | } | 1592 | } |
1593 | 1593 | ||
1594 | static int pwc_video_ioctl(struct inode *inode, struct file *file, | 1594 | static int pwc_video_ioctl(struct inode *inode, struct file *file, |
1595 | unsigned int cmd, unsigned long arg) | 1595 | unsigned int cmd, unsigned long arg) |
@@ -1605,10 +1605,10 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma) | |||
1605 | unsigned long start = vma->vm_start; | 1605 | unsigned long start = vma->vm_start; |
1606 | unsigned long size = vma->vm_end-vma->vm_start; | 1606 | unsigned long size = vma->vm_end-vma->vm_start; |
1607 | unsigned long page, pos; | 1607 | unsigned long page, pos; |
1608 | 1608 | ||
1609 | Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size); | 1609 | Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size); |
1610 | pdev = vdev->priv; | 1610 | pdev = vdev->priv; |
1611 | 1611 | ||
1612 | vma->vm_flags |= VM_IO; | 1612 | vma->vm_flags |= VM_IO; |
1613 | 1613 | ||
1614 | pos = (unsigned long)pdev->image_data; | 1614 | pos = (unsigned long)pdev->image_data; |
@@ -1646,7 +1646,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1646 | char serial_number[30], *name; | 1646 | char serial_number[30], *name; |
1647 | 1647 | ||
1648 | /* Check if we can handle this device */ | 1648 | /* Check if we can handle this device */ |
1649 | Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n", | 1649 | Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n", |
1650 | le16_to_cpu(udev->descriptor.idVendor), | 1650 | le16_to_cpu(udev->descriptor.idVendor), |
1651 | le16_to_cpu(udev->descriptor.idProduct), | 1651 | le16_to_cpu(udev->descriptor.idProduct), |
1652 | intf->altsetting->desc.bInterfaceNumber); | 1652 | intf->altsetting->desc.bInterfaceNumber); |
@@ -1770,11 +1770,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1770 | name = "Logitech QuickCam (res.)"; | 1770 | name = "Logitech QuickCam (res.)"; |
1771 | type_id = 730; /* Assuming CMOS */ | 1771 | type_id = 730; /* Assuming CMOS */ |
1772 | break; | 1772 | break; |
1773 | default: | 1773 | default: |
1774 | return -ENODEV; | 1774 | return -ENODEV; |
1775 | break; | 1775 | break; |
1776 | } | 1776 | } |
1777 | } | 1777 | } |
1778 | else if (vendor_id == 0x055d) { | 1778 | else if (vendor_id == 0x055d) { |
1779 | /* I don't know the difference between the C10 and the C30; | 1779 | /* I don't know the difference between the C10 and the C30; |
1780 | I suppose the difference is the sensor, but both cameras | 1780 | I suppose the difference is the sensor, but both cameras |
@@ -1837,7 +1837,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1837 | return -ENODEV; | 1837 | return -ENODEV; |
1838 | break; | 1838 | break; |
1839 | } | 1839 | } |
1840 | 1840 | ||
1841 | } | 1841 | } |
1842 | else if (vendor_id == 0x0d81) { | 1842 | else if (vendor_id == 0x0d81) { |
1843 | switch(product_id) { | 1843 | switch(product_id) { |
@@ -1856,7 +1856,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1856 | break; | 1856 | break; |
1857 | } | 1857 | } |
1858 | } | 1858 | } |
1859 | else | 1859 | else |
1860 | return -ENODEV; /* Not any of the know types; but the list keeps growing. */ | 1860 | return -ENODEV; /* Not any of the know types; but the list keeps growing. */ |
1861 | 1861 | ||
1862 | memset(serial_number, 0, 30); | 1862 | memset(serial_number, 0, 30); |
@@ -1880,9 +1880,9 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1880 | if (vendor_id == 0x046D && product_id == 0x08B5) | 1880 | if (vendor_id == 0x046D && product_id == 0x08B5) |
1881 | { | 1881 | { |
1882 | /* Logitech QuickCam Orbit | 1882 | /* Logitech QuickCam Orbit |
1883 | The ranges have been determined experimentally; they may differ from cam to cam. | 1883 | The ranges have been determined experimentally; they may differ from cam to cam. |
1884 | Also, the exact ranges left-right and up-down are different for my cam | 1884 | Also, the exact ranges left-right and up-down are different for my cam |
1885 | */ | 1885 | */ |
1886 | pdev->angle_range.pan_min = -7000; | 1886 | pdev->angle_range.pan_min = -7000; |
1887 | pdev->angle_range.pan_max = 7000; | 1887 | pdev->angle_range.pan_max = 7000; |
1888 | pdev->angle_range.tilt_min = -3000; | 1888 | pdev->angle_range.tilt_min = -3000; |
@@ -1939,7 +1939,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1939 | } | 1939 | } |
1940 | 1940 | ||
1941 | /* occupy slot */ | 1941 | /* occupy slot */ |
1942 | if (hint < MAX_DEV_HINTS) | 1942 | if (hint < MAX_DEV_HINTS) |
1943 | device_hint[hint].pdev = pdev; | 1943 | device_hint[hint].pdev = pdev; |
1944 | 1944 | ||
1945 | Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev); | 1945 | Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev); |
@@ -1968,13 +1968,13 @@ static void usb_pwc_disconnect(struct usb_interface *intf) | |||
1968 | Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n"); | 1968 | Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n"); |
1969 | goto disconnect_out; | 1969 | goto disconnect_out; |
1970 | } | 1970 | } |
1971 | #ifdef PWC_MAGIC | 1971 | #ifdef PWC_MAGIC |
1972 | if (pdev->magic != PWC_MAGIC) { | 1972 | if (pdev->magic != PWC_MAGIC) { |
1973 | Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n"); | 1973 | Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n"); |
1974 | goto disconnect_out; | 1974 | goto disconnect_out; |
1975 | } | 1975 | } |
1976 | #endif | 1976 | #endif |
1977 | 1977 | ||
1978 | /* We got unplugged; this is signalled by an EPIPE error code */ | 1978 | /* We got unplugged; this is signalled by an EPIPE error code */ |
1979 | if (pdev->vopen) { | 1979 | if (pdev->vopen) { |
1980 | Info("Disconnected while webcam is in use!\n"); | 1980 | Info("Disconnected while webcam is in use!\n"); |
@@ -2017,8 +2017,8 @@ static int pwc_atoi(const char *s) | |||
2017 | } | 2017 | } |
2018 | 2018 | ||
2019 | 2019 | ||
2020 | /* | 2020 | /* |
2021 | * Initialization code & module stuff | 2021 | * Initialization code & module stuff |
2022 | */ | 2022 | */ |
2023 | 2023 | ||
2024 | static char size[10]; | 2024 | static char size[10]; |
@@ -2168,7 +2168,7 @@ static int __init usb_pwc_init(void) | |||
2168 | if (*dot != '\0') { | 2168 | if (*dot != '\0') { |
2169 | /* There's a serial number as well */ | 2169 | /* There's a serial number as well */ |
2170 | int k; | 2170 | int k; |
2171 | 2171 | ||
2172 | dot++; | 2172 | dot++; |
2173 | k = 0; | 2173 | k = 0; |
2174 | while (*dot != ':' && k < 29) { | 2174 | while (*dot != ':' && k < 29) { |
@@ -2178,18 +2178,18 @@ static int __init usb_pwc_init(void) | |||
2178 | device_hint[i].serial_number[k] = '\0'; | 2178 | device_hint[i].serial_number[k] = '\0'; |
2179 | } | 2179 | } |
2180 | } | 2180 | } |
2181 | #if PWC_DEBUG | 2181 | #if PWC_DEBUG |
2182 | Debug("device_hint[%d]:\n", i); | 2182 | Debug("device_hint[%d]:\n", i); |
2183 | Debug(" type : %d\n", device_hint[i].type); | 2183 | Debug(" type : %d\n", device_hint[i].type); |
2184 | Debug(" serial# : %s\n", device_hint[i].serial_number); | 2184 | Debug(" serial# : %s\n", device_hint[i].serial_number); |
2185 | Debug(" node : %d\n", device_hint[i].device_node); | 2185 | Debug(" node : %d\n", device_hint[i].device_node); |
2186 | #endif | 2186 | #endif |
2187 | } | 2187 | } |
2188 | else | 2188 | else |
2189 | device_hint[i].type = 0; /* not filled */ | 2189 | device_hint[i].type = 0; /* not filled */ |
2190 | } /* ..for MAX_DEV_HINTS */ | 2190 | } /* ..for MAX_DEV_HINTS */ |
2191 | 2191 | ||
2192 | Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver); | 2192 | Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver); |
2193 | return usb_register(&pwc_driver); | 2193 | return usb_register(&pwc_driver); |
2194 | } | 2194 | } |
2195 | 2195 | ||
diff --git a/drivers/usb/media/pwc/pwc-ioctl.h b/drivers/media/video/pwc/pwc-ioctl.h index 5f9cb08bc02e..784bc72521fa 100644 --- a/drivers/usb/media/pwc/pwc-ioctl.h +++ b/drivers/media/video/pwc/pwc-ioctl.h | |||
@@ -33,10 +33,10 @@ | |||
33 | /* | 33 | /* |
34 | Changes | 34 | Changes |
35 | 2001/08/03 Alvarado Added ioctl constants to access methods for | 35 | 2001/08/03 Alvarado Added ioctl constants to access methods for |
36 | changing white balance and red/blue gains | 36 | changing white balance and red/blue gains |
37 | 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE | 37 | 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE |
38 | 2003/12/13 Nemosft Unv. Some modifications to make interfacing to | 38 | 2003/12/13 Nemosft Unv. Some modifications to make interfacing to |
39 | PWCX easier | 39 | PWCX easier |
40 | */ | 40 | */ |
41 | 41 | ||
42 | /* These are private ioctl() commands, specific for the Philips webcams. | 42 | /* These are private ioctl() commands, specific for the Philips webcams. |
@@ -45,10 +45,10 @@ | |||
45 | 45 | ||
46 | The #define names are built up like follows: | 46 | The #define names are built up like follows: |
47 | VIDIOC VIDeo IOCtl prefix | 47 | VIDIOC VIDeo IOCtl prefix |
48 | PWC Philps WebCam | 48 | PWC Philps WebCam |
49 | G optional: Get | 49 | G optional: Get |
50 | S optional: Set | 50 | S optional: Set |
51 | ... the function | 51 | ... the function |
52 | */ | 52 | */ |
53 | 53 | ||
54 | 54 | ||
@@ -94,7 +94,7 @@ struct pwc_serial | |||
94 | { | 94 | { |
95 | char serial[30]; /* String with serial number. Contains terminating 0 */ | 95 | char serial[30]; /* String with serial number. Contains terminating 0 */ |
96 | }; | 96 | }; |
97 | 97 | ||
98 | /* pwc_whitebalance.mode values */ | 98 | /* pwc_whitebalance.mode values */ |
99 | #define PWC_WB_INDOOR 0 | 99 | #define PWC_WB_INDOOR 0 |
100 | #define PWC_WB_OUTDOOR 1 | 100 | #define PWC_WB_OUTDOOR 1 |
@@ -102,14 +102,14 @@ struct pwc_serial | |||
102 | #define PWC_WB_MANUAL 3 | 102 | #define PWC_WB_MANUAL 3 |
103 | #define PWC_WB_AUTO 4 | 103 | #define PWC_WB_AUTO 4 |
104 | 104 | ||
105 | /* Used with VIDIOCPWC[SG]AWB (Auto White Balance). | 105 | /* Used with VIDIOCPWC[SG]AWB (Auto White Balance). |
106 | Set mode to one of the PWC_WB_* values above. | 106 | Set mode to one of the PWC_WB_* values above. |
107 | *red and *blue are the respective gains of these colour components inside | 107 | *red and *blue are the respective gains of these colour components inside |
108 | the camera; range 0..65535 | 108 | the camera; range 0..65535 |
109 | When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; | 109 | When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; |
110 | otherwise undefined. | 110 | otherwise undefined. |
111 | 'read_red' and 'read_blue' are read-only. | 111 | 'read_red' and 'read_blue' are read-only. |
112 | */ | 112 | */ |
113 | struct pwc_whitebalance | 113 | struct pwc_whitebalance |
114 | { | 114 | { |
115 | int mode; | 115 | int mode; |
@@ -117,9 +117,9 @@ struct pwc_whitebalance | |||
117 | int read_red, read_blue; /* R/O */ | 117 | int read_red, read_blue; /* R/O */ |
118 | }; | 118 | }; |
119 | 119 | ||
120 | /* | 120 | /* |
121 | 'control_speed' and 'control_delay' are used in automatic whitebalance mode, | 121 | 'control_speed' and 'control_delay' are used in automatic whitebalance mode, |
122 | and tell the camera how fast it should react to changes in lighting, and | 122 | and tell the camera how fast it should react to changes in lighting, and |
123 | with how much delay. Valid values are 0..65535. | 123 | with how much delay. Valid values are 0..65535. |
124 | */ | 124 | */ |
125 | struct pwc_wb_speed | 125 | struct pwc_wb_speed |
@@ -148,11 +148,11 @@ struct pwc_imagesize | |||
148 | #define PWC_MPT_TILT 0x02 | 148 | #define PWC_MPT_TILT 0x02 |
149 | #define PWC_MPT_TIMEOUT 0x04 /* for status */ | 149 | #define PWC_MPT_TIMEOUT 0x04 /* for status */ |
150 | 150 | ||
151 | /* Set angles; when absolute != 0, the angle is absolute and the | 151 | /* Set angles; when absolute != 0, the angle is absolute and the |
152 | driver calculates the relative offset for you. This can only | 152 | driver calculates the relative offset for you. This can only |
153 | be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns | 153 | be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns |
154 | absolute angles. | 154 | absolute angles. |
155 | */ | 155 | */ |
156 | struct pwc_mpt_angles | 156 | struct pwc_mpt_angles |
157 | { | 157 | { |
158 | int absolute; /* write-only */ | 158 | int absolute; /* write-only */ |
@@ -179,14 +179,14 @@ struct pwc_mpt_status | |||
179 | /* This is used for out-of-kernel decompression. With it, you can get | 179 | /* This is used for out-of-kernel decompression. With it, you can get |
180 | all the necessary information to initialize and use the decompressor | 180 | all the necessary information to initialize and use the decompressor |
181 | routines in standalone applications. | 181 | routines in standalone applications. |
182 | */ | 182 | */ |
183 | struct pwc_video_command | 183 | struct pwc_video_command |
184 | { | 184 | { |
185 | int type; /* camera type (645, 675, 730, etc.) */ | 185 | int type; /* camera type (645, 675, 730, etc.) */ |
186 | int release; /* release number */ | 186 | int release; /* release number */ |
187 | 187 | ||
188 | int size; /* one of PSZ_* */ | 188 | int size; /* one of PSZ_* */ |
189 | int alternate; | 189 | int alternate; |
190 | int command_len; /* length of USB video command */ | 190 | int command_len; /* length of USB video command */ |
191 | unsigned char command_buf[13]; /* Actual USB video command */ | 191 | unsigned char command_buf[13]; /* Actual USB video command */ |
192 | int bandlength; /* >0 = compressed */ | 192 | int bandlength; /* >0 = compressed */ |
@@ -264,7 +264,7 @@ struct pwc_video_command | |||
264 | 264 | ||
265 | /* Flickerless mode; = 0 off, otherwise on */ | 265 | /* Flickerless mode; = 0 off, otherwise on */ |
266 | #define VIDIOCPWCSFLICKER _IOW('v', 208, int) | 266 | #define VIDIOCPWCSFLICKER _IOW('v', 208, int) |
267 | #define VIDIOCPWCGFLICKER _IOR('v', 208, int) | 267 | #define VIDIOCPWCGFLICKER _IOR('v', 208, int) |
268 | 268 | ||
269 | /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ | 269 | /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ |
270 | #define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) | 270 | #define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) |
@@ -273,7 +273,7 @@ struct pwc_video_command | |||
273 | /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ | 273 | /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ |
274 | #define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) | 274 | #define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) |
275 | 275 | ||
276 | /* Motorized pan & tilt functions */ | 276 | /* Motorized pan & tilt functions */ |
277 | #define VIDIOCPWCMPTRESET _IOW('v', 211, int) | 277 | #define VIDIOCPWCMPTRESET _IOW('v', 211, int) |
278 | #define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) | 278 | #define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) |
279 | #define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) | 279 | #define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) |
diff --git a/drivers/media/video/pwc/pwc-kiara.c b/drivers/media/video/pwc/pwc-kiara.c new file mode 100644 index 000000000000..4c96037f7be5 --- /dev/null +++ b/drivers/media/video/pwc/pwc-kiara.c | |||
@@ -0,0 +1,318 @@ | |||
1 | /* Linux driver for Philips webcam | ||
2 | (C) 2004 Luc Saillard (luc@saillard.org) | ||
3 | |||
4 | NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx | ||
5 | driver and thus may have bugs that are not present in the original version. | ||
6 | Please send bug reports and support requests to <luc@saillard.org>. | ||
7 | The decompression routines have been implemented by reverse-engineering the | ||
8 | Nemosoft binary pwcx module. Caveat emptor. | ||
9 | |||
10 | This program is free software; you can redistribute it and/or modify | ||
11 | it under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation; either version 2 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License | ||
21 | along with this program; if not, write to the Free Software | ||
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | |||
26 | /* This tables contains entries for the 730/740/750 (Kiara) camera, with | ||
27 | 4 different qualities (no compression, low, medium, high). | ||
28 | It lists the bandwidth requirements for said mode by its alternate interface | ||
29 | number. An alternate of 0 means that the mode is unavailable. | ||
30 | |||
31 | There are 6 * 4 * 4 entries: | ||
32 | 6 different resolutions subqcif, qsif, qcif, sif, cif, vga | ||
33 | 6 framerates: 5, 10, 15, 20, 25, 30 | ||
34 | 4 compression modi: none, low, medium, high | ||
35 | |||
36 | When an uncompressed mode is not available, the next available compressed mode | ||
37 | will be chosen (unless the decompressor is absent). Sometimes there are only | ||
38 | 1 or 2 compressed modes available; in that case entries are duplicated. | ||
39 | */ | ||
40 | |||
41 | |||
42 | #include "pwc-kiara.h" | ||
43 | #include "pwc-uncompress.h" | ||
44 | |||
45 | const struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] = | ||
46 | { | ||
47 | /* SQCIF */ | ||
48 | { | ||
49 | /* 5 fps */ | ||
50 | { | ||
51 | {0, }, | ||
52 | {0, }, | ||
53 | {0, }, | ||
54 | {0, }, | ||
55 | }, | ||
56 | /* 10 fps */ | ||
57 | { | ||
58 | {0, }, | ||
59 | {0, }, | ||
60 | {0, }, | ||
61 | {0, }, | ||
62 | }, | ||
63 | /* 15 fps */ | ||
64 | { | ||
65 | {0, }, | ||
66 | {0, }, | ||
67 | {0, }, | ||
68 | {0, }, | ||
69 | }, | ||
70 | /* 20 fps */ | ||
71 | { | ||
72 | {0, }, | ||
73 | {0, }, | ||
74 | {0, }, | ||
75 | {0, }, | ||
76 | }, | ||
77 | /* 25 fps */ | ||
78 | { | ||
79 | {0, }, | ||
80 | {0, }, | ||
81 | {0, }, | ||
82 | {0, }, | ||
83 | }, | ||
84 | /* 30 fps */ | ||
85 | { | ||
86 | {0, }, | ||
87 | {0, }, | ||
88 | {0, }, | ||
89 | {0, }, | ||
90 | }, | ||
91 | }, | ||
92 | /* QSIF */ | ||
93 | { | ||
94 | /* 5 fps */ | ||
95 | { | ||
96 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
97 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
98 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
99 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
100 | }, | ||
101 | /* 10 fps */ | ||
102 | { | ||
103 | {2, 291, 0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}}, | ||
104 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
105 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
106 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
107 | }, | ||
108 | /* 15 fps */ | ||
109 | { | ||
110 | {3, 437, 0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}}, | ||
111 | {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, | ||
112 | {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, | ||
113 | {1, 192, 420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, | ||
114 | }, | ||
115 | /* 20 fps */ | ||
116 | { | ||
117 | {4, 589, 0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}}, | ||
118 | {3, 448, 730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}}, | ||
119 | {2, 292, 476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}}, | ||
120 | {1, 192, 312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, | ||
121 | }, | ||
122 | /* 25 fps */ | ||
123 | { | ||
124 | {5, 703, 0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}}, | ||
125 | {3, 447, 610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}}, | ||
126 | {2, 292, 398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}}, | ||
127 | {1, 193, 262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}}, | ||
128 | }, | ||
129 | /* 30 fps */ | ||
130 | { | ||
131 | {8, 874, 0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}}, | ||
132 | {5, 704, 730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}}, | ||
133 | {3, 448, 492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}}, | ||
134 | {2, 292, 320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}}, | ||
135 | }, | ||
136 | }, | ||
137 | /* QCIF */ | ||
138 | { | ||
139 | /* 5 fps */ | ||
140 | { | ||
141 | {0, }, | ||
142 | {0, }, | ||
143 | {0, }, | ||
144 | {0, }, | ||
145 | }, | ||
146 | /* 10 fps */ | ||
147 | { | ||
148 | {0, }, | ||
149 | {0, }, | ||
150 | {0, }, | ||
151 | {0, }, | ||
152 | }, | ||
153 | /* 15 fps */ | ||
154 | { | ||
155 | {0, }, | ||
156 | {0, }, | ||
157 | {0, }, | ||
158 | {0, }, | ||
159 | }, | ||
160 | /* 20 fps */ | ||
161 | { | ||
162 | {0, }, | ||
163 | {0, }, | ||
164 | {0, }, | ||
165 | {0, }, | ||
166 | }, | ||
167 | /* 25 fps */ | ||
168 | { | ||
169 | {0, }, | ||
170 | {0, }, | ||
171 | {0, }, | ||
172 | {0, }, | ||
173 | }, | ||
174 | /* 30 fps */ | ||
175 | { | ||
176 | {0, }, | ||
177 | {0, }, | ||
178 | {0, }, | ||
179 | {0, }, | ||
180 | }, | ||
181 | }, | ||
182 | /* SIF */ | ||
183 | { | ||
184 | /* 5 fps */ | ||
185 | { | ||
186 | {4, 582, 0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}}, | ||
187 | {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}}, | ||
188 | {2, 291, 960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}}, | ||
189 | {1, 191, 630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}}, | ||
190 | }, | ||
191 | /* 10 fps */ | ||
192 | { | ||
193 | {0, }, | ||
194 | {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}}, | ||
195 | {3, 447, 736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}}, | ||
196 | {2, 292, 480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}}, | ||
197 | }, | ||
198 | /* 15 fps */ | ||
199 | { | ||
200 | {0, }, | ||
201 | {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}}, | ||
202 | {4, 592, 650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}}, | ||
203 | {3, 448, 492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}}, | ||
204 | }, | ||
205 | /* 20 fps */ | ||
206 | { | ||
207 | {0, }, | ||
208 | {9, 958, 782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}}, | ||
209 | {5, 703, 574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}}, | ||
210 | {3, 446, 364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}}, | ||
211 | }, | ||
212 | /* 25 fps */ | ||
213 | { | ||
214 | {0, }, | ||
215 | {9, 958, 654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}}, | ||
216 | {6, 776, 530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}}, | ||
217 | {4, 592, 404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}}, | ||
218 | }, | ||
219 | /* 30 fps */ | ||
220 | { | ||
221 | {0, }, | ||
222 | {9, 957, 526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}}, | ||
223 | {6, 775, 426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}}, | ||
224 | {4, 590, 324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}}, | ||
225 | }, | ||
226 | }, | ||
227 | /* CIF */ | ||
228 | { | ||
229 | /* 5 fps */ | ||
230 | { | ||
231 | {0, }, | ||
232 | {0, }, | ||
233 | {0, }, | ||
234 | {0, }, | ||
235 | }, | ||
236 | /* 10 fps */ | ||
237 | { | ||
238 | {0, }, | ||
239 | {0, }, | ||
240 | {0, }, | ||
241 | {0, }, | ||
242 | }, | ||
243 | /* 15 fps */ | ||
244 | { | ||
245 | {0, }, | ||
246 | {0, }, | ||
247 | {0, }, | ||
248 | {0, }, | ||
249 | }, | ||
250 | /* 20 fps */ | ||
251 | { | ||
252 | {0, }, | ||
253 | {0, }, | ||
254 | {0, }, | ||
255 | {0, }, | ||
256 | }, | ||
257 | /* 25 fps */ | ||
258 | { | ||
259 | {0, }, | ||
260 | {0, }, | ||
261 | {0, }, | ||
262 | {0, }, | ||
263 | }, | ||
264 | /* 30 fps */ | ||
265 | { | ||
266 | {0, }, | ||
267 | {0, }, | ||
268 | {0, }, | ||
269 | {0, }, | ||
270 | }, | ||
271 | }, | ||
272 | /* VGA */ | ||
273 | { | ||
274 | /* 5 fps */ | ||
275 | { | ||
276 | {0, }, | ||
277 | {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}}, | ||
278 | {4, 592, 976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}}, | ||
279 | {3, 448, 738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}}, | ||
280 | }, | ||
281 | /* 10 fps */ | ||
282 | { | ||
283 | {0, }, | ||
284 | {9, 956, 788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}}, | ||
285 | {6, 776, 640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}}, | ||
286 | {4, 592, 488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}}, | ||
287 | }, | ||
288 | /* 15 fps */ | ||
289 | { | ||
290 | {0, }, | ||
291 | {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, | ||
292 | {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, | ||
293 | {8, 895, 492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}}, | ||
294 | }, | ||
295 | /* 20 fps */ | ||
296 | { | ||
297 | {0, }, | ||
298 | {0, }, | ||
299 | {0, }, | ||
300 | {0, }, | ||
301 | }, | ||
302 | /* 25 fps */ | ||
303 | { | ||
304 | {0, }, | ||
305 | {0, }, | ||
306 | {0, }, | ||
307 | {0, }, | ||
308 | }, | ||
309 | /* 30 fps */ | ||
310 | { | ||
311 | {0, }, | ||
312 | {0, }, | ||
313 | {0, }, | ||
314 | {0, }, | ||
315 | }, | ||
316 | }, | ||
317 | }; | ||
318 | |||
diff --git a/drivers/usb/media/pwc/pwc-kiara.h b/drivers/media/video/pwc/pwc-kiara.h index 12929abbb1f0..12929abbb1f0 100644 --- a/drivers/usb/media/pwc/pwc-kiara.h +++ b/drivers/media/video/pwc/pwc-kiara.h | |||
diff --git a/drivers/usb/media/pwc/pwc-misc.c b/drivers/media/video/pwc/pwc-misc.c index b7a4bd3524c7..58fe79747992 100644 --- a/drivers/usb/media/pwc/pwc-misc.c +++ b/drivers/media/video/pwc/pwc-misc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Linux driver for Philips webcam | 1 | /* Linux driver for Philips webcam |
2 | Various miscellaneous functions and tables. | 2 | Various miscellaneous functions and tables. |
3 | (C) 1999-2003 Nemosoft Unv. | 3 | (C) 1999-2003 Nemosoft Unv. |
4 | (C) 2004 Luc Saillard (luc@saillard.org) | 4 | (C) 2004 Luc Saillard (luc@saillard.org) |
@@ -44,17 +44,17 @@ int pwc_decode_size(struct pwc_device *pdev, int width, int height) | |||
44 | int i, find; | 44 | int i, find; |
45 | 45 | ||
46 | /* Make sure we don't go beyond our max size. | 46 | /* Make sure we don't go beyond our max size. |
47 | NB: we have different limits for RAW and normal modes. In case | 47 | NB: we have different limits for RAW and normal modes. In case |
48 | you don't have the decompressor loaded or use RAW mode, | 48 | you don't have the decompressor loaded or use RAW mode, |
49 | the maximum viewable size is smaller. | 49 | the maximum viewable size is smaller. |
50 | */ | 50 | */ |
51 | if (pdev->vpalette == VIDEO_PALETTE_RAW) | 51 | if (pdev->vpalette == VIDEO_PALETTE_RAW) |
52 | { | 52 | { |
53 | if (width > pdev->abs_max.x || height > pdev->abs_max.y) | 53 | if (width > pdev->abs_max.x || height > pdev->abs_max.y) |
54 | { | 54 | { |
55 | Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n"); | 55 | Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n"); |
56 | return -1; | 56 | return -1; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | else | 59 | else |
60 | { | 60 | { |
@@ -88,8 +88,8 @@ void pwc_construct(struct pwc_device *pdev) | |||
88 | pdev->view_min.y = 96; | 88 | pdev->view_min.y = 96; |
89 | pdev->view_max.x = 352; | 89 | pdev->view_max.x = 352; |
90 | pdev->view_max.y = 288; | 90 | pdev->view_max.y = 288; |
91 | pdev->abs_max.x = 352; | 91 | pdev->abs_max.x = 352; |
92 | pdev->abs_max.y = 288; | 92 | pdev->abs_max.y = 288; |
93 | pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF; | 93 | pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF; |
94 | pdev->vcinterface = 2; | 94 | pdev->vcinterface = 2; |
95 | pdev->vendpoint = 4; | 95 | pdev->vendpoint = 4; |
@@ -105,8 +105,8 @@ void pwc_construct(struct pwc_device *pdev) | |||
105 | pdev->view_max.x = 640; | 105 | pdev->view_max.x = 640; |
106 | pdev->view_max.y = 480; | 106 | pdev->view_max.y = 480; |
107 | pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA; | 107 | pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA; |
108 | pdev->abs_max.x = 640; | 108 | pdev->abs_max.x = 640; |
109 | pdev->abs_max.y = 480; | 109 | pdev->abs_max.y = 480; |
110 | pdev->vcinterface = 3; | 110 | pdev->vcinterface = 3; |
111 | pdev->vendpoint = 4; | 111 | pdev->vendpoint = 4; |
112 | pdev->frame_header_size = 0; | 112 | pdev->frame_header_size = 0; |
@@ -121,8 +121,8 @@ void pwc_construct(struct pwc_device *pdev) | |||
121 | pdev->view_max.x = 640; | 121 | pdev->view_max.x = 640; |
122 | pdev->view_max.y = 480; | 122 | pdev->view_max.y = 480; |
123 | pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA; | 123 | pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA; |
124 | pdev->abs_max.x = 640; | 124 | pdev->abs_max.x = 640; |
125 | pdev->abs_max.y = 480; | 125 | pdev->abs_max.y = 480; |
126 | pdev->vcinterface = 3; | 126 | pdev->vcinterface = 3; |
127 | pdev->vendpoint = 5; | 127 | pdev->vendpoint = 5; |
128 | pdev->frame_header_size = TOUCAM_HEADER_SIZE; | 128 | pdev->frame_header_size = TOUCAM_HEADER_SIZE; |
diff --git a/drivers/usb/media/pwc/pwc-nala.h b/drivers/media/video/pwc/pwc-nala.h index e6c5cb69d03b..168c73ef75d8 100644 --- a/drivers/usb/media/pwc/pwc-nala.h +++ b/drivers/media/video/pwc/pwc-nala.h | |||
@@ -54,7 +54,7 @@ | |||
54 | {0}, | 54 | {0}, |
55 | }, | 55 | }, |
56 | /* VGA */ | 56 | /* VGA */ |
57 | { | 57 | { |
58 | {0}, | 58 | {0}, |
59 | {0}, | 59 | {0}, |
60 | {0}, | 60 | {0}, |
diff --git a/drivers/media/video/pwc/pwc-timon.c b/drivers/media/video/pwc/pwc-timon.c new file mode 100644 index 000000000000..175250d089cf --- /dev/null +++ b/drivers/media/video/pwc/pwc-timon.c | |||
@@ -0,0 +1,316 @@ | |||
1 | /* Linux driver for Philips webcam | ||
2 | (C) 2004 Luc Saillard (luc@saillard.org) | ||
3 | |||
4 | NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx | ||
5 | driver and thus may have bugs that are not present in the original version. | ||
6 | Please send bug reports and support requests to <luc@saillard.org>. | ||
7 | The decompression routines have been implemented by reverse-engineering the | ||
8 | Nemosoft binary pwcx module. Caveat emptor. | ||
9 | |||
10 | This program is free software; you can redistribute it and/or modify | ||
11 | it under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation; either version 2 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License | ||
21 | along with this program; if not, write to the Free Software | ||
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | |||
26 | /* This tables contains entries for the 675/680/690 (Timon) camera, with | ||
27 | 4 different qualities (no compression, low, medium, high). | ||
28 | It lists the bandwidth requirements for said mode by its alternate interface | ||
29 | number. An alternate of 0 means that the mode is unavailable. | ||
30 | |||
31 | There are 6 * 4 * 4 entries: | ||
32 | 6 different resolutions subqcif, qsif, qcif, sif, cif, vga | ||
33 | 6 framerates: 5, 10, 15, 20, 25, 30 | ||
34 | 4 compression modi: none, low, medium, high | ||
35 | |||
36 | When an uncompressed mode is not available, the next available compressed mode | ||
37 | will be chosen (unless the decompressor is absent). Sometimes there are only | ||
38 | 1 or 2 compressed modes available; in that case entries are duplicated. | ||
39 | */ | ||
40 | |||
41 | #include "pwc-timon.h" | ||
42 | |||
43 | const struct Timon_table_entry Timon_table[PSZ_MAX][6][4] = | ||
44 | { | ||
45 | /* SQCIF */ | ||
46 | { | ||
47 | /* 5 fps */ | ||
48 | { | ||
49 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
50 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
51 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
52 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
53 | }, | ||
54 | /* 10 fps */ | ||
55 | { | ||
56 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
57 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
58 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
59 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
60 | }, | ||
61 | /* 15 fps */ | ||
62 | { | ||
63 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
64 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
65 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
66 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
67 | }, | ||
68 | /* 20 fps */ | ||
69 | { | ||
70 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
71 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
72 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
73 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
74 | }, | ||
75 | /* 25 fps */ | ||
76 | { | ||
77 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
78 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
79 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
80 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
81 | }, | ||
82 | /* 30 fps */ | ||
83 | { | ||
84 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
85 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
86 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
87 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
88 | }, | ||
89 | }, | ||
90 | /* QSIF */ | ||
91 | { | ||
92 | /* 5 fps */ | ||
93 | { | ||
94 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
95 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
96 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
97 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
98 | }, | ||
99 | /* 10 fps */ | ||
100 | { | ||
101 | {2, 291, 0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}}, | ||
102 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
103 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
104 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
105 | }, | ||
106 | /* 15 fps */ | ||
107 | { | ||
108 | {3, 437, 0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}}, | ||
109 | {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
110 | {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
111 | {1, 191, 420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
112 | }, | ||
113 | /* 20 fps */ | ||
114 | { | ||
115 | {4, 588, 0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}}, | ||
116 | {3, 447, 730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
117 | {2, 292, 476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
118 | {1, 192, 312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, | ||
119 | }, | ||
120 | /* 25 fps */ | ||
121 | { | ||
122 | {5, 703, 0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}}, | ||
123 | {3, 447, 610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
124 | {2, 292, 398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
125 | {1, 192, 262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, | ||
126 | }, | ||
127 | /* 30 fps */ | ||
128 | { | ||
129 | {8, 873, 0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}}, | ||
130 | {5, 704, 774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}}, | ||
131 | {3, 448, 492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}}, | ||
132 | {2, 291, 320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, | ||
133 | }, | ||
134 | }, | ||
135 | /* QCIF */ | ||
136 | { | ||
137 | /* 5 fps */ | ||
138 | { | ||
139 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
140 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
141 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
142 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
143 | }, | ||
144 | /* 10 fps */ | ||
145 | { | ||
146 | {3, 385, 0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}}, | ||
147 | {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
148 | {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
149 | {1, 194, 532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}}, | ||
150 | }, | ||
151 | /* 15 fps */ | ||
152 | { | ||
153 | {4, 577, 0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}}, | ||
154 | {3, 447, 818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}}, | ||
155 | {2, 292, 534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}}, | ||
156 | {1, 195, 356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}}, | ||
157 | }, | ||
158 | /* 20 fps */ | ||
159 | { | ||
160 | {6, 776, 0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}}, | ||
161 | {4, 591, 804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}}, | ||
162 | {3, 447, 608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
163 | {2, 291, 396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, | ||
164 | }, | ||
165 | /* 25 fps */ | ||
166 | { | ||
167 | {9, 928, 0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}}, | ||
168 | {5, 703, 800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}}, | ||
169 | {3, 447, 508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
170 | {2, 292, 332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
171 | }, | ||
172 | /* 30 fps */ | ||
173 | { | ||
174 | {0, }, | ||
175 | {9, 956, 876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}}, | ||
176 | {4, 592, 542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}}, | ||
177 | {2, 291, 266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}}, | ||
178 | }, | ||
179 | }, | ||
180 | /* SIF */ | ||
181 | { | ||
182 | /* 5 fps */ | ||
183 | { | ||
184 | {4, 582, 0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}}, | ||
185 | {3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}}, | ||
186 | {2, 291, 960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}}, | ||
187 | {1, 191, 630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}}, | ||
188 | }, | ||
189 | /* 10 fps */ | ||
190 | { | ||
191 | {0, }, | ||
192 | {6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}}, | ||
193 | {3, 447, 736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}}, | ||
194 | {2, 291, 480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}}, | ||
195 | }, | ||
196 | /* 15 fps */ | ||
197 | { | ||
198 | {0, }, | ||
199 | {9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}}, | ||
200 | {4, 591, 650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}}, | ||
201 | {3, 448, 492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}}, | ||
202 | }, | ||
203 | /* 20 fps */ | ||
204 | { | ||
205 | {0, }, | ||
206 | {9, 958, 782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}}, | ||
207 | {5, 703, 574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}}, | ||
208 | {3, 446, 364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}}, | ||
209 | }, | ||
210 | /* 25 fps */ | ||
211 | { | ||
212 | {0, }, | ||
213 | {9, 958, 654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}}, | ||
214 | {6, 776, 530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}}, | ||
215 | {4, 592, 404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}}, | ||
216 | }, | ||
217 | /* 30 fps */ | ||
218 | { | ||
219 | {0, }, | ||
220 | {9, 957, 526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}}, | ||
221 | {6, 775, 426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}}, | ||
222 | {4, 590, 324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}}, | ||
223 | }, | ||
224 | }, | ||
225 | /* CIF */ | ||
226 | { | ||
227 | /* 5 fps */ | ||
228 | { | ||
229 | {6, 771, 0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}}, | ||
230 | {4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}}, | ||
231 | {2, 291, 800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}}, | ||
232 | {1, 193, 528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}}, | ||
233 | }, | ||
234 | /* 10 fps */ | ||
235 | { | ||
236 | {0, }, | ||
237 | {9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}}, | ||
238 | {4, 591, 812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}}, | ||
239 | {2, 291, 400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}}, | ||
240 | }, | ||
241 | /* 15 fps */ | ||
242 | { | ||
243 | {0, }, | ||
244 | {9, 956, 876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}}, | ||
245 | {5, 703, 644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}}, | ||
246 | {3, 448, 410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}}, | ||
247 | }, | ||
248 | /* 20 fps */ | ||
249 | { | ||
250 | {0, }, | ||
251 | {9, 956, 650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}}, | ||
252 | {6, 776, 528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}}, | ||
253 | {4, 591, 402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}}, | ||
254 | }, | ||
255 | /* 25 fps */ | ||
256 | { | ||
257 | {0, }, | ||
258 | {9, 956, 544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}}, | ||
259 | {7, 840, 478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}}, | ||
260 | {5, 703, 400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}}, | ||
261 | }, | ||
262 | /* 30 fps */ | ||
263 | { | ||
264 | {0, }, | ||
265 | {9, 956, 438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}}, | ||
266 | {7, 838, 384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}}, | ||
267 | {6, 773, 354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}}, | ||
268 | }, | ||
269 | }, | ||
270 | /* VGA */ | ||
271 | { | ||
272 | /* 5 fps */ | ||
273 | { | ||
274 | {0, }, | ||
275 | {6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}}, | ||
276 | {4, 592, 976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}}, | ||
277 | {3, 448, 738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}}, | ||
278 | }, | ||
279 | /* 10 fps */ | ||
280 | { | ||
281 | {0, }, | ||
282 | {9, 956, 788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}}, | ||
283 | {6, 776, 640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}}, | ||
284 | {4, 592, 488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}}, | ||
285 | }, | ||
286 | /* 15 fps */ | ||
287 | { | ||
288 | {0, }, | ||
289 | {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, | ||
290 | {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, | ||
291 | {8, 895, 492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}}, | ||
292 | }, | ||
293 | /* 20 fps */ | ||
294 | { | ||
295 | {0, }, | ||
296 | {0, }, | ||
297 | {0, }, | ||
298 | {0, }, | ||
299 | }, | ||
300 | /* 25 fps */ | ||
301 | { | ||
302 | {0, }, | ||
303 | {0, }, | ||
304 | {0, }, | ||
305 | {0, }, | ||
306 | }, | ||
307 | /* 30 fps */ | ||
308 | { | ||
309 | {0, }, | ||
310 | {0, }, | ||
311 | {0, }, | ||
312 | {0, }, | ||
313 | }, | ||
314 | }, | ||
315 | }; | ||
316 | |||
diff --git a/drivers/usb/media/pwc/pwc-timon.h b/drivers/media/video/pwc/pwc-timon.h index a86b3782a081..a86b3782a081 100644 --- a/drivers/usb/media/pwc/pwc-timon.h +++ b/drivers/media/video/pwc/pwc-timon.h | |||
diff --git a/drivers/usb/media/pwc/pwc-uncompress.c b/drivers/media/video/pwc/pwc-uncompress.c index ef4204eab6c4..b37a89a163f9 100644 --- a/drivers/usb/media/pwc/pwc-uncompress.c +++ b/drivers/media/video/pwc/pwc-uncompress.c | |||
@@ -109,9 +109,9 @@ int pwc_decompress(struct pwc_device *pdev) | |||
109 | in planar format immediately. | 109 | in planar format immediately. |
110 | */ | 110 | */ |
111 | int flags; | 111 | int flags; |
112 | 112 | ||
113 | flags = PWCX_FLAG_PLANAR; | 113 | flags = PWCX_FLAG_PLANAR; |
114 | if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot) | 114 | if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot) |
115 | { | 115 | { |
116 | printk(KERN_ERR "pwc: Mode Bayer is not supported for now\n"); | 116 | printk(KERN_ERR "pwc: Mode Bayer is not supported for now\n"); |
117 | flags |= PWCX_FLAG_BAYER; | 117 | flags |= PWCX_FLAG_BAYER; |
diff --git a/drivers/usb/media/pwc/pwc-uncompress.h b/drivers/media/video/pwc/pwc-uncompress.h index d3b9250e4ed3..f75e1b6cbe19 100644 --- a/drivers/usb/media/pwc/pwc-uncompress.h +++ b/drivers/media/video/pwc/pwc-uncompress.h | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | /* This file is the bridge between the kernel module and the plugin; it | 25 | /* This file is the bridge between the kernel module and the plugin; it |
26 | describes the structures and datatypes used in both modules. Any | 26 | describes the structures and datatypes used in both modules. Any |
27 | significant change should be reflected by increasing the | 27 | significant change should be reflected by increasing the |
28 | pwc_decompressor_version major number. | 28 | pwc_decompressor_version major number. |
29 | */ | 29 | */ |
30 | #ifndef PWC_UNCOMPRESS_H | 30 | #ifndef PWC_UNCOMPRESS_H |
diff --git a/drivers/usb/media/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 6dd76bb3dff1..1b0ee0ced0ed 100644 --- a/drivers/usb/media/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h | |||
@@ -123,7 +123,7 @@ struct pwc_device | |||
123 | #endif | 123 | #endif |
124 | /* Pointer to our usb_device */ | 124 | /* Pointer to our usb_device */ |
125 | struct usb_device *udev; | 125 | struct usb_device *udev; |
126 | 126 | ||
127 | int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ | 127 | int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ |
128 | int release; /* release number */ | 128 | int release; /* release number */ |
129 | int features; /* feature bits */ | 129 | int features; /* feature bits */ |
@@ -149,7 +149,7 @@ struct pwc_device | |||
149 | char vsnapshot; /* snapshot mode */ | 149 | char vsnapshot; /* snapshot mode */ |
150 | char vsync; /* used by isoc handler */ | 150 | char vsync; /* used by isoc handler */ |
151 | char vmirror; /* for ToUCaM series */ | 151 | char vmirror; /* for ToUCaM series */ |
152 | 152 | ||
153 | int cmd_len; | 153 | int cmd_len; |
154 | unsigned char cmd_buf[13]; | 154 | unsigned char cmd_buf[13]; |
155 | 155 | ||
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index a9f3cf0b1e3c..531e9461cb66 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c | |||
@@ -71,7 +71,7 @@ | |||
71 | #define NUM_BUFS 8 | 71 | #define NUM_BUFS 8 |
72 | #define IF_NAME "SAA5249" | 72 | #define IF_NAME "SAA5249" |
73 | 73 | ||
74 | static const int disp_modes[8][3] = | 74 | static const int disp_modes[8][3] = |
75 | { | 75 | { |
76 | { 0x46, 0x03, 0x03 }, /* DISPOFF */ | 76 | { 0x46, 0x03, 0x03 }, /* DISPOFF */ |
77 | { 0x46, 0xcc, 0xcc }, /* DISPNORM */ | 77 | { 0x46, 0xcc, 0xcc }, /* DISPNORM */ |
@@ -150,8 +150,8 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
150 | client=kmalloc(sizeof(*client), GFP_KERNEL); | 150 | client=kmalloc(sizeof(*client), GFP_KERNEL); |
151 | if(client==NULL) | 151 | if(client==NULL) |
152 | return -ENOMEM; | 152 | return -ENOMEM; |
153 | client_template.adapter = adap; | 153 | client_template.adapter = adap; |
154 | client_template.addr = addr; | 154 | client_template.addr = addr; |
155 | memcpy(client, &client_template, sizeof(*client)); | 155 | memcpy(client, &client_template, sizeof(*client)); |
156 | t = kzalloc(sizeof(*t), GFP_KERNEL); | 156 | t = kzalloc(sizeof(*t), GFP_KERNEL); |
157 | if(t==NULL) | 157 | if(t==NULL) |
@@ -161,11 +161,11 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
161 | } | 161 | } |
162 | strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); | 162 | strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); |
163 | mutex_init(&t->lock); | 163 | mutex_init(&t->lock); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | * Now create a video4linux device | 166 | * Now create a video4linux device |
167 | */ | 167 | */ |
168 | 168 | ||
169 | vd = kmalloc(sizeof(struct video_device), GFP_KERNEL); | 169 | vd = kmalloc(sizeof(struct video_device), GFP_KERNEL); |
170 | if(vd==NULL) | 170 | if(vd==NULL) |
171 | { | 171 | { |
@@ -175,8 +175,8 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
175 | } | 175 | } |
176 | i2c_set_clientdata(client, vd); | 176 | i2c_set_clientdata(client, vd); |
177 | memcpy(vd, &saa_template, sizeof(*vd)); | 177 | memcpy(vd, &saa_template, sizeof(*vd)); |
178 | 178 | ||
179 | for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) | 179 | for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) |
180 | { | 180 | { |
181 | memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); | 181 | memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); |
182 | memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); | 182 | memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); |
@@ -186,9 +186,9 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
186 | t->vdau[pgbuf].stopped = TRUE; | 186 | t->vdau[pgbuf].stopped = TRUE; |
187 | t->is_searching[pgbuf] = FALSE; | 187 | t->is_searching[pgbuf] = FALSE; |
188 | } | 188 | } |
189 | vd->priv=t; | 189 | vd->priv=t; |
190 | 190 | ||
191 | 191 | ||
192 | /* | 192 | /* |
193 | * Register it | 193 | * Register it |
194 | */ | 194 | */ |
@@ -208,7 +208,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
208 | /* | 208 | /* |
209 | * We do most of the hard work when we become a device on the i2c. | 209 | * We do most of the hard work when we become a device on the i2c. |
210 | */ | 210 | */ |
211 | 211 | ||
212 | static int saa5249_probe(struct i2c_adapter *adap) | 212 | static int saa5249_probe(struct i2c_adapter *adap) |
213 | { | 213 | { |
214 | if (adap->class & I2C_CLASS_TV_ANALOG) | 214 | if (adap->class & I2C_CLASS_TV_ANALOG) |
@@ -229,7 +229,7 @@ static int saa5249_detach(struct i2c_client *client) | |||
229 | 229 | ||
230 | /* new I2C driver support */ | 230 | /* new I2C driver support */ |
231 | 231 | ||
232 | static struct i2c_driver i2c_driver_videotext = | 232 | static struct i2c_driver i2c_driver_videotext = |
233 | { | 233 | { |
234 | .driver = { | 234 | .driver = { |
235 | .name = IF_NAME, /* name */ | 235 | .name = IF_NAME, /* name */ |
@@ -249,7 +249,7 @@ static struct i2c_client client_template = { | |||
249 | * delay may be longer. | 249 | * delay may be longer. |
250 | */ | 250 | */ |
251 | 251 | ||
252 | static void jdelay(unsigned long delay) | 252 | static void jdelay(unsigned long delay) |
253 | { | 253 | { |
254 | sigset_t oldblocked = current->blocked; | 254 | sigset_t oldblocked = current->blocked; |
255 | 255 | ||
@@ -269,14 +269,14 @@ static void jdelay(unsigned long delay) | |||
269 | /* | 269 | /* |
270 | * I2C interfaces | 270 | * I2C interfaces |
271 | */ | 271 | */ |
272 | 272 | ||
273 | static int i2c_sendbuf(struct saa5249_device *t, int reg, int count, u8 *data) | 273 | static int i2c_sendbuf(struct saa5249_device *t, int reg, int count, u8 *data) |
274 | { | 274 | { |
275 | char buf[64]; | 275 | char buf[64]; |
276 | 276 | ||
277 | buf[0] = reg; | 277 | buf[0] = reg; |
278 | memcpy(buf+1, data, count); | 278 | memcpy(buf+1, data, count); |
279 | 279 | ||
280 | if(i2c_master_send(t->client, buf, count+1)==count+1) | 280 | if(i2c_master_send(t->client, buf, count+1)==count+1) |
281 | return 0; | 281 | return 0; |
282 | return -1; | 282 | return -1; |
@@ -289,7 +289,7 @@ static int i2c_senddata(struct saa5249_device *t, ...) | |||
289 | int ct=0; | 289 | int ct=0; |
290 | va_list argp; | 290 | va_list argp; |
291 | va_start(argp,t); | 291 | va_start(argp,t); |
292 | 292 | ||
293 | while((v=va_arg(argp,int))!=-1) | 293 | while((v=va_arg(argp,int))!=-1) |
294 | buf[ct++]=v; | 294 | buf[ct++]=v; |
295 | return i2c_sendbuf(t, buf[0], ct-1, buf+1); | 295 | return i2c_sendbuf(t, buf[0], ct-1, buf+1); |
@@ -301,7 +301,7 @@ static int i2c_senddata(struct saa5249_device *t, ...) | |||
301 | * Returns -1 if I²C-device didn't send acknowledge, 0 otherwise | 301 | * Returns -1 if I²C-device didn't send acknowledge, 0 otherwise |
302 | */ | 302 | */ |
303 | 303 | ||
304 | static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf) | 304 | static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf) |
305 | { | 305 | { |
306 | if(i2c_master_recv(t->client, buf, count)!=count) | 306 | if(i2c_master_recv(t->client, buf, count)!=count) |
307 | return -1; | 307 | return -1; |
@@ -320,9 +320,9 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
320 | struct video_device *vd = video_devdata(file); | 320 | struct video_device *vd = video_devdata(file); |
321 | struct saa5249_device *t=vd->priv; | 321 | struct saa5249_device *t=vd->priv; |
322 | 322 | ||
323 | switch(cmd) | 323 | switch(cmd) |
324 | { | 324 | { |
325 | case VTXIOCGETINFO: | 325 | case VTXIOCGETINFO: |
326 | { | 326 | { |
327 | vtx_info_t *info = arg; | 327 | vtx_info_t *info = arg; |
328 | info->version_major = VTX_VER_MAJ; | 328 | info->version_major = VTX_VER_MAJ; |
@@ -332,10 +332,10 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
332 | return 0; | 332 | return 0; |
333 | } | 333 | } |
334 | 334 | ||
335 | case VTXIOCCLRPAGE: | 335 | case VTXIOCCLRPAGE: |
336 | { | 336 | { |
337 | vtx_pagereq_t *req = arg; | 337 | vtx_pagereq_t *req = arg; |
338 | 338 | ||
339 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) | 339 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) |
340 | return -EINVAL; | 340 | return -EINVAL; |
341 | memset(t->vdau[req->pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); | 341 | memset(t->vdau[req->pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); |
@@ -343,17 +343,17 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
343 | return 0; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
346 | case VTXIOCCLRFOUND: | 346 | case VTXIOCCLRFOUND: |
347 | { | 347 | { |
348 | vtx_pagereq_t *req = arg; | 348 | vtx_pagereq_t *req = arg; |
349 | 349 | ||
350 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) | 350 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) |
351 | return -EINVAL; | 351 | return -EINVAL; |
352 | t->vdau[req->pgbuf].clrfound = TRUE; | 352 | t->vdau[req->pgbuf].clrfound = TRUE; |
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
355 | 355 | ||
356 | case VTXIOCPAGEREQ: | 356 | case VTXIOCPAGEREQ: |
357 | { | 357 | { |
358 | vtx_pagereq_t *req = arg; | 358 | vtx_pagereq_t *req = arg; |
359 | if (!(req->pagemask & PGMASK_PAGE)) | 359 | if (!(req->pagemask & PGMASK_PAGE)) |
@@ -381,7 +381,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
381 | return 0; | 381 | return 0; |
382 | } | 382 | } |
383 | 383 | ||
384 | case VTXIOCGETSTAT: | 384 | case VTXIOCGETSTAT: |
385 | { | 385 | { |
386 | vtx_pagereq_t *req = arg; | 386 | vtx_pagereq_t *req = arg; |
387 | u8 infobits[10]; | 387 | u8 infobits[10]; |
@@ -390,7 +390,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
390 | 390 | ||
391 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) | 391 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) |
392 | return -EINVAL; | 392 | return -EINVAL; |
393 | if (!t->vdau[req->pgbuf].stopped) | 393 | if (!t->vdau[req->pgbuf].stopped) |
394 | { | 394 | { |
395 | if (i2c_senddata(t, 2, 0, -1) || | 395 | if (i2c_senddata(t, 2, 0, -1) || |
396 | i2c_sendbuf(t, 3, sizeof(t->vdau[0].sregs), t->vdau[req->pgbuf].sregs) || | 396 | i2c_sendbuf(t, 3, sizeof(t->vdau[0].sregs), t->vdau[req->pgbuf].sregs) || |
@@ -403,7 +403,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
403 | return -EIO; | 403 | return -EIO; |
404 | 404 | ||
405 | if (!(infobits[8] & 0x10) && !(infobits[7] & 0xf0) && /* check FOUND-bit */ | 405 | if (!(infobits[8] & 0x10) && !(infobits[7] & 0xf0) && /* check FOUND-bit */ |
406 | (memcmp(infobits, t->vdau[req->pgbuf].laststat, sizeof(infobits)) || | 406 | (memcmp(infobits, t->vdau[req->pgbuf].laststat, sizeof(infobits)) || |
407 | time_after_eq(jiffies, t->vdau[req->pgbuf].expire))) | 407 | time_after_eq(jiffies, t->vdau[req->pgbuf].expire))) |
408 | { /* check if new page arrived */ | 408 | { /* check if new page arrived */ |
409 | if (i2c_senddata(t, 8, 0, 0, 0, -1) || | 409 | if (i2c_senddata(t, 8, 0, 0, 0, -1) || |
@@ -411,7 +411,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
411 | return -EIO; | 411 | return -EIO; |
412 | t->vdau[req->pgbuf].expire = jiffies + PGBUF_EXPIRE; | 412 | t->vdau[req->pgbuf].expire = jiffies + PGBUF_EXPIRE; |
413 | memset(t->vdau[req->pgbuf].pgbuf + VTX_PAGESIZE, ' ', VTX_VIRTUALSIZE - VTX_PAGESIZE); | 413 | memset(t->vdau[req->pgbuf].pgbuf + VTX_PAGESIZE, ' ', VTX_VIRTUALSIZE - VTX_PAGESIZE); |
414 | if (t->virtual_mode) | 414 | if (t->virtual_mode) |
415 | { | 415 | { |
416 | /* Packet X/24 */ | 416 | /* Packet X/24 */ |
417 | if (i2c_senddata(t, 8, 0, 0x20, 0, -1) || | 417 | if (i2c_senddata(t, 8, 0, 0x20, 0, -1) || |
@@ -459,9 +459,9 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
459 | info.notfound = !!(infobits[8] & 0x10); | 459 | info.notfound = !!(infobits[8] & 0x10); |
460 | info.pblf = !!(infobits[9] & 0x20); | 460 | info.pblf = !!(infobits[9] & 0x20); |
461 | info.hamming = 0; | 461 | info.hamming = 0; |
462 | for (a = 0; a <= 7; a++) | 462 | for (a = 0; a <= 7; a++) |
463 | { | 463 | { |
464 | if (infobits[a] & 0xf0) | 464 | if (infobits[a] & 0xf0) |
465 | { | 465 | { |
466 | info.hamming = 1; | 466 | info.hamming = 1; |
467 | break; | 467 | break; |
@@ -471,14 +471,14 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
471 | info.notfound = 1; | 471 | info.notfound = 1; |
472 | if(copy_to_user(req->buffer, &info, sizeof(vtx_pageinfo_t))) | 472 | if(copy_to_user(req->buffer, &info, sizeof(vtx_pageinfo_t))) |
473 | return -EFAULT; | 473 | return -EFAULT; |
474 | if (!info.hamming && !info.notfound) | 474 | if (!info.hamming && !info.notfound) |
475 | { | 475 | { |
476 | t->is_searching[req->pgbuf] = FALSE; | 476 | t->is_searching[req->pgbuf] = FALSE; |
477 | } | 477 | } |
478 | return 0; | 478 | return 0; |
479 | } | 479 | } |
480 | 480 | ||
481 | case VTXIOCGETPAGE: | 481 | case VTXIOCGETPAGE: |
482 | { | 482 | { |
483 | vtx_pagereq_t *req = arg; | 483 | vtx_pagereq_t *req = arg; |
484 | int start, end; | 484 | int start, end; |
@@ -488,15 +488,15 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
488 | return -EINVAL; | 488 | return -EINVAL; |
489 | if(copy_to_user(req->buffer, &t->vdau[req->pgbuf].pgbuf[req->start], req->end - req->start + 1)) | 489 | if(copy_to_user(req->buffer, &t->vdau[req->pgbuf].pgbuf[req->start], req->end - req->start + 1)) |
490 | return -EFAULT; | 490 | return -EFAULT; |
491 | 491 | ||
492 | /* | 492 | /* |
493 | * Always read the time directly from SAA5249 | 493 | * Always read the time directly from SAA5249 |
494 | */ | 494 | */ |
495 | 495 | ||
496 | if (req->start <= 39 && req->end >= 32) | 496 | if (req->start <= 39 && req->end >= 32) |
497 | { | 497 | { |
498 | int len; | 498 | int len; |
499 | char buf[16]; | 499 | char buf[16]; |
500 | start = max(req->start, 32); | 500 | start = max(req->start, 32); |
501 | end = min(req->end, 39); | 501 | end = min(req->end, 39); |
502 | len=end-start+1; | 502 | len=end-start+1; |
@@ -507,7 +507,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
507 | return -EFAULT; | 507 | return -EFAULT; |
508 | } | 508 | } |
509 | /* Insert the current header if DAU is still searching for a page */ | 509 | /* Insert the current header if DAU is still searching for a page */ |
510 | if (req->start <= 31 && req->end >= 7 && t->is_searching[req->pgbuf]) | 510 | if (req->start <= 31 && req->end >= 7 && t->is_searching[req->pgbuf]) |
511 | { | 511 | { |
512 | char buf[32]; | 512 | char buf[32]; |
513 | int len; | 513 | int len; |
@@ -523,7 +523,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
523 | return 0; | 523 | return 0; |
524 | } | 524 | } |
525 | 525 | ||
526 | case VTXIOCSTOPDAU: | 526 | case VTXIOCSTOPDAU: |
527 | { | 527 | { |
528 | vtx_pagereq_t *req = arg; | 528 | vtx_pagereq_t *req = arg; |
529 | 529 | ||
@@ -534,12 +534,12 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
534 | return 0; | 534 | return 0; |
535 | } | 535 | } |
536 | 536 | ||
537 | case VTXIOCPUTPAGE: | 537 | case VTXIOCPUTPAGE: |
538 | case VTXIOCSETDISP: | 538 | case VTXIOCSETDISP: |
539 | case VTXIOCPUTSTAT: | 539 | case VTXIOCPUTSTAT: |
540 | return 0; | 540 | return 0; |
541 | 541 | ||
542 | case VTXIOCCLRCACHE: | 542 | case VTXIOCCLRCACHE: |
543 | { | 543 | { |
544 | if (i2c_senddata(t, 0, NUM_DAUS, 0, 8, -1) || i2c_senddata(t, 11, | 544 | if (i2c_senddata(t, 0, NUM_DAUS, 0, 8, -1) || i2c_senddata(t, 11, |
545 | ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', | 545 | ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', |
@@ -551,7 +551,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
551 | return 0; | 551 | return 0; |
552 | } | 552 | } |
553 | 553 | ||
554 | case VTXIOCSETVIRT: | 554 | case VTXIOCSETVIRT: |
555 | { | 555 | { |
556 | /* The SAA5249 has virtual-row reception turned on always */ | 556 | /* The SAA5249 has virtual-row reception turned on always */ |
557 | t->virtual_mode = (int)(long)arg; | 557 | t->virtual_mode = (int)(long)arg; |
@@ -612,14 +612,14 @@ static inline unsigned int vtx_fix_command(unsigned int cmd) | |||
612 | /* | 612 | /* |
613 | * Handle the locking | 613 | * Handle the locking |
614 | */ | 614 | */ |
615 | 615 | ||
616 | static int saa5249_ioctl(struct inode *inode, struct file *file, | 616 | static int saa5249_ioctl(struct inode *inode, struct file *file, |
617 | unsigned int cmd, unsigned long arg) | 617 | unsigned int cmd, unsigned long arg) |
618 | { | 618 | { |
619 | struct video_device *vd = video_devdata(file); | 619 | struct video_device *vd = video_devdata(file); |
620 | struct saa5249_device *t=vd->priv; | 620 | struct saa5249_device *t=vd->priv; |
621 | int err; | 621 | int err; |
622 | 622 | ||
623 | cmd = vtx_fix_command(cmd); | 623 | cmd = vtx_fix_command(cmd); |
624 | mutex_lock(&t->lock); | 624 | mutex_lock(&t->lock); |
625 | err = video_usercopy(inode,file,cmd,arg,do_saa5249_ioctl); | 625 | err = video_usercopy(inode,file,cmd,arg,do_saa5249_ioctl); |
@@ -627,7 +627,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file, | |||
627 | return err; | 627 | return err; |
628 | } | 628 | } |
629 | 629 | ||
630 | static int saa5249_open(struct inode *inode, struct file *file) | 630 | static int saa5249_open(struct inode *inode, struct file *file) |
631 | { | 631 | { |
632 | struct video_device *vd = video_devdata(file); | 632 | struct video_device *vd = video_devdata(file); |
633 | struct saa5249_device *t=vd->priv; | 633 | struct saa5249_device *t=vd->priv; |
@@ -636,7 +636,7 @@ static int saa5249_open(struct inode *inode, struct file *file) | |||
636 | err = video_exclusive_open(inode,file); | 636 | err = video_exclusive_open(inode,file); |
637 | if (err < 0) | 637 | if (err < 0) |
638 | return err; | 638 | return err; |
639 | 639 | ||
640 | if (t->client==NULL) { | 640 | if (t->client==NULL) { |
641 | err = -ENODEV; | 641 | err = -ENODEV; |
642 | goto fail; | 642 | goto fail; |
@@ -647,13 +647,13 @@ static int saa5249_open(struct inode *inode, struct file *file) | |||
647 | i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) || | 647 | i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) || |
648 | /* Display TV-picture, no virtual rows */ | 648 | /* Display TV-picture, no virtual rows */ |
649 | i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1)) /* Set display to page 4 */ | 649 | i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1)) /* Set display to page 4 */ |
650 | 650 | ||
651 | { | 651 | { |
652 | err = -EIO; | 652 | err = -EIO; |
653 | goto fail; | 653 | goto fail; |
654 | } | 654 | } |
655 | 655 | ||
656 | for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) | 656 | for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) |
657 | { | 657 | { |
658 | memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); | 658 | memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); |
659 | memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); | 659 | memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); |
@@ -673,7 +673,7 @@ static int saa5249_open(struct inode *inode, struct file *file) | |||
673 | 673 | ||
674 | 674 | ||
675 | 675 | ||
676 | static int saa5249_release(struct inode *inode, struct file *file) | 676 | static int saa5249_release(struct inode *inode, struct file *file) |
677 | { | 677 | { |
678 | struct video_device *vd = video_devdata(file); | 678 | struct video_device *vd = video_devdata(file); |
679 | struct saa5249_device *t=vd->priv; | 679 | struct saa5249_device *t=vd->priv; |
@@ -690,7 +690,7 @@ static int __init init_saa_5249 (void) | |||
690 | return i2c_add_driver(&i2c_driver_videotext); | 690 | return i2c_add_driver(&i2c_driver_videotext); |
691 | } | 691 | } |
692 | 692 | ||
693 | static void __exit cleanup_saa_5249 (void) | 693 | static void __exit cleanup_saa_5249 (void) |
694 | { | 694 | { |
695 | i2c_del_driver(&i2c_driver_videotext); | 695 | i2c_del_driver(&i2c_driver_videotext); |
696 | } | 696 | } |
diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index d17395c4f55c..a81285ca7d5b 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | 33 | ||
34 | 34 | ||
35 | #include "rds.h" | 35 | #include <media/rds.h> |
36 | 36 | ||
37 | /* Addresses to scan */ | 37 | /* Addresses to scan */ |
38 | static unsigned short normal_i2c[] = { | 38 | static unsigned short normal_i2c[] = { |
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index e18ea268384b..41d951db6ec0 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c | |||
@@ -139,7 +139,7 @@ saa7110_read (struct i2c_client *client) | |||
139 | 139 | ||
140 | static int | 140 | static int |
141 | saa7110_selmux (struct i2c_client *client, | 141 | saa7110_selmux (struct i2c_client *client, |
142 | int chan) | 142 | int chan) |
143 | { | 143 | { |
144 | static const unsigned char modes[9][8] = { | 144 | static const unsigned char modes[9][8] = { |
145 | /* mode 0 */ | 145 | /* mode 0 */ |
@@ -457,7 +457,7 @@ static unsigned short normal_i2c[] = { | |||
457 | }; | 457 | }; |
458 | 458 | ||
459 | static unsigned short ignore = I2C_CLIENT_END; | 459 | static unsigned short ignore = I2C_CLIENT_END; |
460 | 460 | ||
461 | static struct i2c_client_address_data addr_data = { | 461 | static struct i2c_client_address_data addr_data = { |
462 | .normal_i2c = normal_i2c, | 462 | .normal_i2c = normal_i2c, |
463 | .probe = &ignore, | 463 | .probe = &ignore, |
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index f9ba0c943adf..686fd4746205 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * saa7111 - Philips SAA7111A video decoder driver version 0.0.3 | 2 | * saa7111 - Philips SAA7111A video decoder driver version 0.0.3 |
3 | * | 3 | * |
4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> | 4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
@@ -482,7 +482,7 @@ saa7111_command (struct i2c_client *client, | |||
482 | static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END }; | 482 | static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END }; |
483 | 483 | ||
484 | static unsigned short ignore = I2C_CLIENT_END; | 484 | static unsigned short ignore = I2C_CLIENT_END; |
485 | 485 | ||
486 | static struct i2c_client_address_data addr_data = { | 486 | static struct i2c_client_address_data addr_data = { |
487 | .normal_i2c = normal_i2c, | 487 | .normal_i2c = normal_i2c, |
488 | .probe = &ignore, | 488 | .probe = &ignore, |
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index 4a1f841d0c77..90398ab8252e 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * saa7114 - Philips SAA7114H video decoder driver version 0.0.1 | 2 | * saa7114 - Philips SAA7114H video decoder driver version 0.0.1 |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com> | 4 | * Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com> |
@@ -300,7 +300,7 @@ static const unsigned char init[] = { | |||
300 | 0x55, 0xff, | 300 | 0x55, 0xff, |
301 | 0x56, 0xff, | 301 | 0x56, 0xff, |
302 | 0x57, 0xff, | 302 | 0x57, 0xff, |
303 | 0x58, 0x40, // framing code | 303 | 0x58, 0x40, // framing code |
304 | 0x59, 0x47, // horizontal offset | 304 | 0x59, 0x47, // horizontal offset |
305 | 0x5a, 0x06, // vertical offset | 305 | 0x5a, 0x06, // vertical offset |
306 | 0x5b, 0x83, // field offset | 306 | 0x5b, 0x83, // field offset |
@@ -345,7 +345,7 @@ static const unsigned char init[] = { | |||
345 | 0x82, 0x00, | 345 | 0x82, 0x00, |
346 | 0x83, 0x00, | 346 | 0x83, 0x00, |
347 | 0x84, 0xc5, | 347 | 0x84, 0xc5, |
348 | 0x85, 0x0d, // hsync and vsync ? | 348 | 0x85, 0x0d, // hsync and vsync ? |
349 | 0x86, 0x40, | 349 | 0x86, 0x40, |
350 | 0x87, 0x01, | 350 | 0x87, 0x01, |
351 | 0x88, 0x00, | 351 | 0x88, 0x00, |
@@ -434,7 +434,7 @@ static const unsigned char init[] = { | |||
434 | 0xd9, 0x04, | 434 | 0xd9, 0x04, |
435 | 0xda, 0x00, // horizontal luminance phase offset | 435 | 0xda, 0x00, // horizontal luminance phase offset |
436 | 0xdb, 0x00, | 436 | 0xdb, 0x00, |
437 | 0xdc, 0x00, // horizontal chrominance scaling increment | 437 | 0xdc, 0x00, // horizontal chrominance scaling increment |
438 | 0xdd, 0x02, | 438 | 0xdd, 0x02, |
439 | 0xde, 0x00, // horizontal chrominance phase offset | 439 | 0xde, 0x00, // horizontal chrominance phase offset |
440 | 0xdf, 0x00, | 440 | 0xdf, 0x00, |
@@ -754,7 +754,7 @@ saa7114_command (struct i2c_client *client, | |||
754 | saa7114_write(client, 0x87, | 754 | saa7114_write(client, 0x87, |
755 | decoder->reg[REG_ADDR(0x87)]); | 755 | decoder->reg[REG_ADDR(0x87)]); |
756 | saa7114_write(client, 0x88, 0xd8); // sw reset scaler | 756 | saa7114_write(client, 0x88, 0xd8); // sw reset scaler |
757 | saa7114_write(client, 0x88, 0xf8); // sw reset scaler release | 757 | saa7114_write(client, 0x88, 0xf8); // sw reset scaler release |
758 | saa7114_write(client, 0x80, 0x36); | 758 | saa7114_write(client, 0x80, 0x36); |
759 | 759 | ||
760 | } | 760 | } |
@@ -813,7 +813,7 @@ static unsigned short normal_i2c[] = | |||
813 | { I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END }; | 813 | { I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END }; |
814 | 814 | ||
815 | static unsigned short ignore = I2C_CLIENT_END; | 815 | static unsigned short ignore = I2C_CLIENT_END; |
816 | 816 | ||
817 | static struct i2c_client_address_data addr_data = { | 817 | static struct i2c_client_address_data addr_data = { |
818 | .normal_i2c = normal_i2c, | 818 | .normal_i2c = normal_i2c, |
819 | .probe = &ignore, | 819 | .probe = &ignore, |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index b184fd00b4e7..b05015282601 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <linux/i2c.h> | 40 | #include <linux/i2c.h> |
41 | #include <linux/videodev2.h> | 41 | #include <linux/videodev2.h> |
42 | #include <media/v4l2-common.h> | 42 | #include <media/v4l2-common.h> |
43 | #include <media/audiochip.h> | ||
44 | #include <asm/div64.h> | 43 | #include <asm/div64.h> |
45 | 44 | ||
46 | MODULE_DESCRIPTION("Philips SAA7113/SAA7114/SAA7115 video decoder driver"); | 45 | MODULE_DESCRIPTION("Philips SAA7113/SAA7114/SAA7115 video decoder driver"); |
diff --git a/drivers/media/video/saa7121.h b/drivers/media/video/saa7121.h index 74e37d405208..66967ae37494 100644 --- a/drivers/media/video/saa7121.h +++ b/drivers/media/video/saa7121.h | |||
@@ -64,7 +64,7 @@ | |||
64 | #define PAL_MSB_VERTICAL 0x40 /* 7c */ | 64 | #define PAL_MSB_VERTICAL 0x40 /* 7c */ |
65 | 65 | ||
66 | /* Initialization Sequence */ | 66 | /* Initialization Sequence */ |
67 | 67 | ||
68 | static __u8 init7121ntsc[] = { | 68 | static __u8 init7121ntsc[] = { |
69 | 0x26, 0x0, 0x27, 0x0, | 69 | 0x26, 0x0, 0x27, 0x0, |
70 | 0x28, NTSC_BURST_START, 0x29, NTSC_BURST_END, | 70 | 0x28, NTSC_BURST_START, 0x29, NTSC_BURST_END, |
@@ -95,7 +95,7 @@ static __u8 init7121ntsc[] = { | |||
95 | 0x78, 0x0, 0x79, 0x0, 0x7a, NTSC_FIRST_ACTIVE, | 95 | 0x78, 0x0, 0x79, 0x0, 0x7a, NTSC_FIRST_ACTIVE, |
96 | 0x7b, NTSC_LAST_ACTIVE, 0x7c, NTSC_MSB_VERTICAL, | 96 | 0x7b, NTSC_LAST_ACTIVE, 0x7c, NTSC_MSB_VERTICAL, |
97 | 0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0 | 97 | 0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0 |
98 | }; | 98 | }; |
99 | #define INIT7121LEN (sizeof(init7121ntsc)/2) | 99 | #define INIT7121LEN (sizeof(init7121ntsc)/2) |
100 | 100 | ||
101 | static __u8 init7121pal[] = { | 101 | static __u8 init7121pal[] = { |
@@ -128,5 +128,5 @@ static __u8 init7121pal[] = { | |||
128 | 0x78, 0x0, 0x79, 0x0, 0x7a, PAL_FIRST_ACTIVE, | 128 | 0x78, 0x0, 0x79, 0x0, 0x7a, PAL_FIRST_ACTIVE, |
129 | 0x7b, PAL_LAST_ACTIVE, 0x7c, PAL_MSB_VERTICAL, | 129 | 0x7b, PAL_LAST_ACTIVE, 0x7c, PAL_MSB_VERTICAL, |
130 | 0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0 | 130 | 0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0 |
131 | }; | 131 | }; |
132 | #endif | 132 | #endif |
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index aca84d2f9825..bb3e0ba946d3 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -507,7 +507,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
507 | /* release the old buffer */ | 507 | /* release the old buffer */ |
508 | if (substream->runtime->dma_area) { | 508 | if (substream->runtime->dma_area) { |
509 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); | 509 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); |
510 | videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); | 510 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); |
511 | dsp_buffer_free(dev); | 511 | dsp_buffer_free(dev); |
512 | substream->runtime->dma_area = NULL; | 512 | substream->runtime->dma_area = NULL; |
513 | } | 513 | } |
@@ -523,12 +523,12 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
523 | return err; | 523 | return err; |
524 | } | 524 | } |
525 | 525 | ||
526 | if (0 != (err = videobuf_dma_pci_map(dev->pci, &dev->dmasound.dma))) { | 526 | if (0 != (err = videobuf_pci_dma_map(dev->pci, &dev->dmasound.dma))) { |
527 | dsp_buffer_free(dev); | 527 | dsp_buffer_free(dev); |
528 | return err; | 528 | return err; |
529 | } | 529 | } |
530 | if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) { | 530 | if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) { |
531 | videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); | 531 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); |
532 | dsp_buffer_free(dev); | 532 | dsp_buffer_free(dev); |
533 | return err; | 533 | return err; |
534 | } | 534 | } |
@@ -537,7 +537,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
537 | dev->dmasound.dma.sglen, | 537 | dev->dmasound.dma.sglen, |
538 | 0))) { | 538 | 0))) { |
539 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); | 539 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); |
540 | videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); | 540 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); |
541 | dsp_buffer_free(dev); | 541 | dsp_buffer_free(dev); |
542 | return err; | 542 | return err; |
543 | } | 543 | } |
@@ -571,7 +571,7 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream) | |||
571 | 571 | ||
572 | if (substream->runtime->dma_area) { | 572 | if (substream->runtime->dma_area) { |
573 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); | 573 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); |
574 | videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); | 574 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); |
575 | dsp_buffer_free(dev); | 575 | dsp_buffer_free(dev); |
576 | substream->runtime->dma_area = NULL; | 576 | substream->runtime->dma_area = NULL; |
577 | } | 577 | } |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 58e568d7d2ee..c98571c9d5a6 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -254,12 +254,12 @@ void saa7134_pgtable_free(struct pci_dev *pci, struct saa7134_pgtable *pt) | |||
254 | 254 | ||
255 | /* ------------------------------------------------------------------ */ | 255 | /* ------------------------------------------------------------------ */ |
256 | 256 | ||
257 | void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf) | 257 | void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf) |
258 | { | 258 | { |
259 | BUG_ON(in_interrupt()); | 259 | BUG_ON(in_interrupt()); |
260 | 260 | ||
261 | videobuf_waiton(&buf->vb,0,0); | 261 | videobuf_waiton(&buf->vb,0,0); |
262 | videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma); | 262 | videobuf_dma_unmap(q, &buf->vb.dma); |
263 | videobuf_dma_free(&buf->vb.dma); | 263 | videobuf_dma_free(&buf->vb.dma); |
264 | buf->vb.state = STATE_NEEDS_INIT; | 264 | buf->vb.state = STATE_NEEDS_INIT; |
265 | } | 265 | } |
@@ -960,7 +960,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
960 | if (saa7134_no_overlay <= 0) { | 960 | if (saa7134_no_overlay <= 0) { |
961 | saa7134_video_template.type |= VID_TYPE_OVERLAY; | 961 | saa7134_video_template.type |= VID_TYPE_OVERLAY; |
962 | } else { | 962 | } else { |
963 | printk("bttv: Overlay support disabled.\n"); | 963 | printk("%s: Overlay support disabled.\n",dev->name); |
964 | } | 964 | } |
965 | dev->video_dev = vdev_init(dev,&saa7134_video_template,"video"); | 965 | dev->video_dev = vdev_init(dev,&saa7134_video_template,"video"); |
966 | err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, | 966 | err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, |
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index d79d05f88705..7aa02b34e012 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c | |||
@@ -124,7 +124,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) | |||
124 | unsigned long flags; | 124 | unsigned long flags; |
125 | 125 | ||
126 | /* prepare buffer */ | 126 | /* prepare buffer */ |
127 | if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->dmasound.dma))) | 127 | if (0 != (err = videobuf_pci_dma_map(dev->pci,&dev->dmasound.dma))) |
128 | return err; | 128 | return err; |
129 | if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) | 129 | if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) |
130 | goto fail1; | 130 | goto fail1; |
@@ -213,7 +213,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) | |||
213 | fail2: | 213 | fail2: |
214 | saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); | 214 | saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); |
215 | fail1: | 215 | fail1: |
216 | videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); | 216 | videobuf_pci_dma_unmap(dev->pci,&dev->dmasound.dma); |
217 | return err; | 217 | return err; |
218 | } | 218 | } |
219 | 219 | ||
@@ -231,7 +231,7 @@ static int dsp_rec_stop(struct saa7134_dev *dev) | |||
231 | 231 | ||
232 | /* unlock buffer */ | 232 | /* unlock buffer */ |
233 | saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); | 233 | saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); |
234 | videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); | 234 | videobuf_pci_dma_unmap(dev->pci,&dev->dmasound.dma); |
235 | return 0; | 235 | return 0; |
236 | } | 236 | } |
237 | 237 | ||
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 470903e2f5e5..60a90a2617ae 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c | |||
@@ -89,7 +89,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
89 | return -EINVAL; | 89 | return -EINVAL; |
90 | 90 | ||
91 | if (buf->vb.size != size) { | 91 | if (buf->vb.size != size) { |
92 | saa7134_dma_free(dev,buf); | 92 | saa7134_dma_free(q,buf); |
93 | } | 93 | } |
94 | 94 | ||
95 | if (STATE_NEEDS_INIT == buf->vb.state) { | 95 | if (STATE_NEEDS_INIT == buf->vb.state) { |
@@ -98,7 +98,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
98 | buf->vb.size = size; | 98 | buf->vb.size = size; |
99 | buf->pt = &dev->ts.pt_ts; | 99 | buf->pt = &dev->ts.pt_ts; |
100 | 100 | ||
101 | err = videobuf_iolock(dev->pci,&buf->vb,NULL); | 101 | err = videobuf_iolock(q,&buf->vb,NULL); |
102 | if (err) | 102 | if (err) |
103 | goto oops; | 103 | goto oops; |
104 | err = saa7134_pgtable_build(dev->pci,buf->pt, | 104 | err = saa7134_pgtable_build(dev->pci,buf->pt, |
@@ -126,7 +126,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
126 | return 0; | 126 | return 0; |
127 | 127 | ||
128 | oops: | 128 | oops: |
129 | saa7134_dma_free(dev,buf); | 129 | saa7134_dma_free(q,buf); |
130 | return err; | 130 | return err; |
131 | } | 131 | } |
132 | 132 | ||
@@ -152,10 +152,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
152 | 152 | ||
153 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 153 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
154 | { | 154 | { |
155 | struct saa7134_dev *dev = q->priv_data; | ||
156 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); | 155 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); |
157 | 156 | ||
158 | saa7134_dma_free(dev,buf); | 157 | saa7134_dma_free(q,buf); |
159 | } | 158 | } |
160 | 159 | ||
161 | struct videobuf_queue_ops saa7134_ts_qops = { | 160 | struct videobuf_queue_ops saa7134_ts_qops = { |
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 3043233a8b6e..0db53d192b2a 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c | |||
@@ -482,12 +482,14 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au | |||
482 | [ V4L2_TUNER_MODE_STEREO ] = "stereo", | 482 | [ V4L2_TUNER_MODE_STEREO ] = "stereo", |
483 | [ V4L2_TUNER_MODE_LANG1 ] = "lang1", | 483 | [ V4L2_TUNER_MODE_LANG1 ] = "lang1", |
484 | [ V4L2_TUNER_MODE_LANG2 ] = "lang2", | 484 | [ V4L2_TUNER_MODE_LANG2 ] = "lang2", |
485 | [ V4L2_TUNER_MODE_LANG1_LANG2 ] = "lang1+lang2", | ||
485 | }; | 486 | }; |
486 | static u32 fm[] = { | 487 | static u32 fm[] = { |
487 | [ V4L2_TUNER_MODE_MONO ] = 0x00, /* ch1 */ | 488 | [ V4L2_TUNER_MODE_MONO ] = 0x00, /* ch1 */ |
488 | [ V4L2_TUNER_MODE_STEREO ] = 0x80, /* auto */ | 489 | [ V4L2_TUNER_MODE_STEREO ] = 0x80, /* auto */ |
489 | [ V4L2_TUNER_MODE_LANG1 ] = 0x00, /* ch1 */ | 490 | [ V4L2_TUNER_MODE_LANG1 ] = 0x00, /* ch1 */ |
490 | [ V4L2_TUNER_MODE_LANG2 ] = 0x01, /* ch2 */ | 491 | [ V4L2_TUNER_MODE_LANG2 ] = 0x01, /* ch2 */ |
492 | [ V4L2_TUNER_MODE_LANG1_LANG2 ] = 0x80, /* auto */ | ||
491 | }; | 493 | }; |
492 | u32 reg; | 494 | u32 reg; |
493 | 495 | ||
diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c index f4aee0af80e1..f38366a470fa 100644 --- a/drivers/media/video/saa7134/saa7134-vbi.c +++ b/drivers/media/video/saa7134/saa7134-vbi.c | |||
@@ -135,7 +135,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
135 | return -EINVAL; | 135 | return -EINVAL; |
136 | 136 | ||
137 | if (buf->vb.size != size) | 137 | if (buf->vb.size != size) |
138 | saa7134_dma_free(dev,buf); | 138 | saa7134_dma_free(q,buf); |
139 | 139 | ||
140 | if (STATE_NEEDS_INIT == buf->vb.state) { | 140 | if (STATE_NEEDS_INIT == buf->vb.state) { |
141 | buf->vb.width = llength; | 141 | buf->vb.width = llength; |
@@ -143,7 +143,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
143 | buf->vb.size = size; | 143 | buf->vb.size = size; |
144 | buf->pt = &fh->pt_vbi; | 144 | buf->pt = &fh->pt_vbi; |
145 | 145 | ||
146 | err = videobuf_iolock(dev->pci,&buf->vb,NULL); | 146 | err = videobuf_iolock(q,&buf->vb,NULL); |
147 | if (err) | 147 | if (err) |
148 | goto oops; | 148 | goto oops; |
149 | err = saa7134_pgtable_build(dev->pci,buf->pt, | 149 | err = saa7134_pgtable_build(dev->pci,buf->pt, |
@@ -159,7 +159,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
159 | return 0; | 159 | return 0; |
160 | 160 | ||
161 | oops: | 161 | oops: |
162 | saa7134_dma_free(dev,buf); | 162 | saa7134_dma_free(q,buf); |
163 | return err; | 163 | return err; |
164 | } | 164 | } |
165 | 165 | ||
@@ -190,11 +190,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
190 | 190 | ||
191 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 191 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
192 | { | 192 | { |
193 | struct saa7134_fh *fh = q->priv_data; | ||
194 | struct saa7134_dev *dev = fh->dev; | ||
195 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); | 193 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); |
196 | 194 | ||
197 | saa7134_dma_free(dev,buf); | 195 | saa7134_dma_free(q,buf); |
198 | } | 196 | } |
199 | 197 | ||
200 | struct videobuf_queue_ops saa7134_vbi_qops = { | 198 | struct videobuf_queue_ops saa7134_vbi_qops = { |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 57a11e71d996..aeef80f88a6b 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -993,7 +993,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
993 | buf->vb.size != size || | 993 | buf->vb.size != size || |
994 | buf->vb.field != field || | 994 | buf->vb.field != field || |
995 | buf->fmt != fh->fmt) { | 995 | buf->fmt != fh->fmt) { |
996 | saa7134_dma_free(dev,buf); | 996 | saa7134_dma_free(q,buf); |
997 | } | 997 | } |
998 | 998 | ||
999 | if (STATE_NEEDS_INIT == buf->vb.state) { | 999 | if (STATE_NEEDS_INIT == buf->vb.state) { |
@@ -1004,7 +1004,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1004 | buf->fmt = fh->fmt; | 1004 | buf->fmt = fh->fmt; |
1005 | buf->pt = &fh->pt_cap; | 1005 | buf->pt = &fh->pt_cap; |
1006 | 1006 | ||
1007 | err = videobuf_iolock(dev->pci,&buf->vb,&dev->ovbuf); | 1007 | err = videobuf_iolock(q,&buf->vb,&dev->ovbuf); |
1008 | if (err) | 1008 | if (err) |
1009 | goto oops; | 1009 | goto oops; |
1010 | err = saa7134_pgtable_build(dev->pci,buf->pt, | 1010 | err = saa7134_pgtable_build(dev->pci,buf->pt, |
@@ -1019,7 +1019,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1019 | return 0; | 1019 | return 0; |
1020 | 1020 | ||
1021 | oops: | 1021 | oops: |
1022 | saa7134_dma_free(dev,buf); | 1022 | saa7134_dma_free(q,buf); |
1023 | return err; | 1023 | return err; |
1024 | } | 1024 | } |
1025 | 1025 | ||
@@ -1045,10 +1045,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1045 | 1045 | ||
1046 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 1046 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
1047 | { | 1047 | { |
1048 | struct saa7134_fh *fh = q->priv_data; | ||
1049 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); | 1048 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); |
1050 | 1049 | ||
1051 | saa7134_dma_free(fh->dev,buf); | 1050 | saa7134_dma_free(q,buf); |
1052 | } | 1051 | } |
1053 | 1052 | ||
1054 | static struct videobuf_queue_ops video_qops = { | 1053 | static struct videobuf_queue_ops video_qops = { |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ce1c2e0b065e..31ba293854c1 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <asm/io.h> | 34 | #include <asm/io.h> |
35 | 35 | ||
36 | #include <media/tuner.h> | 36 | #include <media/tuner.h> |
37 | #include <media/audiochip.h> | ||
38 | #include <media/ir-common.h> | 37 | #include <media/ir-common.h> |
39 | #include <media/ir-kbd-i2c.h> | 38 | #include <media/ir-kbd-i2c.h> |
40 | #include <media/video-buf.h> | 39 | #include <media/video-buf.h> |
@@ -579,7 +578,7 @@ void saa7134_buffer_finish(struct saa7134_dev *dev, struct saa7134_dmaqueue *q, | |||
579 | unsigned int state); | 578 | unsigned int state); |
580 | void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); | 579 | void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); |
581 | void saa7134_buffer_timeout(unsigned long data); | 580 | void saa7134_buffer_timeout(unsigned long data); |
582 | void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf); | 581 | void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf); |
583 | 582 | ||
584 | int saa7134_set_dmabits(struct saa7134_dev *dev); | 583 | int saa7134_set_dmabits(struct saa7134_dev *dev); |
585 | 584 | ||
diff --git a/drivers/media/video/saa7146.h b/drivers/media/video/saa7146.h index 756963f01bbd..2830b5e33aec 100644 --- a/drivers/media/video/saa7146.h +++ b/drivers/media/video/saa7146.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | saa7146.h - definitions philips saa7146 based cards | 2 | saa7146.h - definitions philips saa7146 based cards |
3 | Copyright (C) 1999 Nathan Laredo (laredo@gnu.org) | 3 | Copyright (C) 1999 Nathan Laredo (laredo@gnu.org) |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/videodev.h> | 28 | #include <linux/videodev.h> |
29 | 29 | ||
30 | #ifndef O_NONCAP | 30 | #ifndef O_NONCAP |
31 | #define O_NONCAP O_TRUNC | 31 | #define O_NONCAP O_TRUNC |
32 | #endif | 32 | #endif |
33 | 33 | ||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #ifdef __KERNEL__ | 37 | #ifdef __KERNEL__ |
38 | 38 | ||
39 | struct saa7146_window | 39 | struct saa7146_window |
40 | { | 40 | { |
41 | int x, y; | 41 | int x, y; |
42 | ushort width, height; | 42 | ushort width, height; |
@@ -70,7 +70,7 @@ struct saa7146 | |||
70 | int irqstate; /* irq routine is state driven */ | 70 | int irqstate; /* irq routine is state driven */ |
71 | int writemode; | 71 | int writemode; |
72 | int playmode; | 72 | int playmode; |
73 | unsigned int nr; | 73 | unsigned int nr; |
74 | unsigned long irq; /* IRQ used by SAA7146 card */ | 74 | unsigned long irq; /* IRQ used by SAA7146 card */ |
75 | unsigned short id; | 75 | unsigned short id; |
76 | unsigned char revision; | 76 | unsigned char revision; |
diff --git a/drivers/media/video/saa7146reg.h b/drivers/media/video/saa7146reg.h index 6cc910f50a4b..80ec2c146b4c 100644 --- a/drivers/media/video/saa7146reg.h +++ b/drivers/media/video/saa7146reg.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | saa7146.h - definitions philips saa7146 based cards | 2 | saa7146.h - definitions philips saa7146 based cards |
3 | Copyright (C) 1999 Nathan Laredo (laredo@gnu.org) | 3 | Copyright (C) 1999 Nathan Laredo (laredo@gnu.org) |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 9f99ee1303e0..9c308410856d 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * saa7185 - Philips SAA7185B video encoder driver version 0.0.3 | 2 | * saa7185 - Philips SAA7185B video encoder driver version 0.0.3 |
3 | * | 3 | * |
4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> | 4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
@@ -377,7 +377,7 @@ saa7185_command (struct i2c_client *client, | |||
377 | static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END }; | 377 | static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END }; |
378 | 378 | ||
379 | static unsigned short ignore = I2C_CLIENT_END; | 379 | static unsigned short ignore = I2C_CLIENT_END; |
380 | 380 | ||
381 | static struct i2c_client_address_data addr_data = { | 381 | static struct i2c_client_address_data addr_data = { |
382 | .normal_i2c = normal_i2c, | 382 | .normal_i2c = normal_i2c, |
383 | .probe = &ignore, | 383 | .probe = &ignore, |
diff --git a/drivers/media/video/saa7196.h b/drivers/media/video/saa7196.h index f92f21cfbcac..cd4b6354a7b3 100644 --- a/drivers/media/video/saa7196.h +++ b/drivers/media/video/saa7196.h | |||
@@ -2,14 +2,14 @@ | |||
2 | Definitions for the Philips SAA7196 digital video decoder, | 2 | Definitions for the Philips SAA7196 digital video decoder, |
3 | scaler, and clock generator circuit (DESCpro), as used in | 3 | scaler, and clock generator circuit (DESCpro), as used in |
4 | the PlanB video input of the Powermac 7x00/8x00 series. | 4 | the PlanB video input of the Powermac 7x00/8x00 series. |
5 | 5 | ||
6 | Copyright (C) 1998 Michel Lanners (mlan@cpu.lu) | 6 | Copyright (C) 1998 Michel Lanners (mlan@cpu.lu) |
7 | 7 | ||
8 | The register defines are shamelessly copied from the meteor | 8 | The register defines are shamelessly copied from the meteor |
9 | driver out of NetBSD (with permission), | 9 | driver out of NetBSD (with permission), |
10 | and are copyrighted (c) 1995 Mark Tinguely and Jim Lowe | 10 | and are copyrighted (c) 1995 Mark Tinguely and Jim Lowe |
11 | (Thanks !) | 11 | (Thanks !) |
12 | 12 | ||
13 | Additional debugging and coding by Takashi Oe (toe@unlinfo.unl.edu) | 13 | Additional debugging and coding by Takashi Oe (toe@unlinfo.unl.edu) |
14 | 14 | ||
15 | The default values used for PlanB are my mistakes. | 15 | The default values used for PlanB are my mistakes. |
diff --git a/drivers/usb/media/se401.c b/drivers/media/video/se401.c index f03ea7f89596..a846ebc78cd7 100644 --- a/drivers/usb/media/se401.c +++ b/drivers/media/video/se401.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) | 4 | * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) |
5 | * | 5 | * |
6 | * Still somewhat based on the Linux ov511 driver. | 6 | * Still somewhat based on the Linux ov511 driver. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 9 | * under the terms of the GNU General Public License as published by the |
10 | * Free Software Foundation; either version 2 of the License, or (at your | 10 | * Free Software Foundation; either version 2 of the License, or (at your |
@@ -114,16 +114,16 @@ static int se401_sndctrl(int set, struct usb_se401 *se401, unsigned short req, | |||
114 | unsigned short value, unsigned char *cp, int size) | 114 | unsigned short value, unsigned char *cp, int size) |
115 | { | 115 | { |
116 | return usb_control_msg ( | 116 | return usb_control_msg ( |
117 | se401->dev, | 117 | se401->dev, |
118 | set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0), | 118 | set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0), |
119 | req, | 119 | req, |
120 | (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 120 | (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
121 | value, | 121 | value, |
122 | 0, | 122 | 0, |
123 | cp, | 123 | cp, |
124 | size, | 124 | size, |
125 | 1000 | 125 | 1000 |
126 | ); | 126 | ); |
127 | } | 127 | } |
128 | 128 | ||
129 | static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, | 129 | static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, |
@@ -140,30 +140,30 @@ static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, | |||
140 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 140 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
141 | param, | 141 | param, |
142 | selector, | 142 | selector, |
143 | NULL, | 143 | NULL, |
144 | 0, | 144 | 0, |
145 | 1000 | 145 | 1000 |
146 | ); | 146 | ); |
147 | } | 147 | } |
148 | 148 | ||
149 | static unsigned short se401_get_feature(struct usb_se401 *se401, | 149 | static unsigned short se401_get_feature(struct usb_se401 *se401, |
150 | unsigned short selector) | 150 | unsigned short selector) |
151 | { | 151 | { |
152 | /* For 'set' the selecetor should be in index, not sure if the spec is | 152 | /* For 'set' the selecetor should be in index, not sure if the spec is |
153 | wrong here to.... | 153 | wrong here to.... |
154 | */ | 154 | */ |
155 | unsigned char cp[2]; | 155 | unsigned char cp[2]; |
156 | usb_control_msg ( | 156 | usb_control_msg ( |
157 | se401->dev, | 157 | se401->dev, |
158 | usb_rcvctrlpipe(se401->dev, 0), | 158 | usb_rcvctrlpipe(se401->dev, 0), |
159 | SE401_REQ_GET_EXT_FEATURE, | 159 | SE401_REQ_GET_EXT_FEATURE, |
160 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 160 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
161 | 0, | 161 | 0, |
162 | selector, | 162 | selector, |
163 | cp, | 163 | cp, |
164 | 2, | 164 | 2, |
165 | 1000 | 165 | 1000 |
166 | ); | 166 | ); |
167 | return cp[0]+cp[1]*256; | 167 | return cp[0]+cp[1]*256; |
168 | } | 168 | } |
169 | 169 | ||
@@ -183,14 +183,14 @@ static int se401_send_pict(struct usb_se401 *se401) | |||
183 | se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);/* red color gain */ | 183 | se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);/* red color gain */ |
184 | se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);/* green color gain */ | 184 | se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);/* green color gain */ |
185 | se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);/* blue color gain */ | 185 | se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);/* blue color gain */ |
186 | 186 | ||
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
190 | static void se401_set_exposure(struct usb_se401 *se401, int brightness) | 190 | static void se401_set_exposure(struct usb_se401 *se401, int brightness) |
191 | { | 191 | { |
192 | int integration=brightness<<5; | 192 | int integration=brightness<<5; |
193 | 193 | ||
194 | if (flickerless==50) { | 194 | if (flickerless==50) { |
195 | integration=integration-integration%106667; | 195 | integration=integration-integration%106667; |
196 | } | 196 | } |
@@ -255,11 +255,11 @@ static void se401_auto_resetlevel(struct usb_se401 *se401) | |||
255 | /* For some reason this normally read-only register doesn't get reset | 255 | /* For some reason this normally read-only register doesn't get reset |
256 | to zero after reading them just once... | 256 | to zero after reading them just once... |
257 | */ | 257 | */ |
258 | se401_get_feature(se401, HV7131_REG_HIREFNOH); | 258 | se401_get_feature(se401, HV7131_REG_HIREFNOH); |
259 | se401_get_feature(se401, HV7131_REG_HIREFNOL); | 259 | se401_get_feature(se401, HV7131_REG_HIREFNOL); |
260 | se401_get_feature(se401, HV7131_REG_LOREFNOH); | 260 | se401_get_feature(se401, HV7131_REG_LOREFNOH); |
261 | se401_get_feature(se401, HV7131_REG_LOREFNOL); | 261 | se401_get_feature(se401, HV7131_REG_LOREFNOL); |
262 | ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) + | 262 | ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) + |
263 | se401_get_feature(se401, HV7131_REG_HIREFNOL); | 263 | se401_get_feature(se401, HV7131_REG_HIREFNOL); |
264 | alrc=256*se401_get_feature(se401, HV7131_REG_LOREFNOH) + | 264 | alrc=256*se401_get_feature(se401, HV7131_REG_LOREFNOH) + |
265 | se401_get_feature(se401, HV7131_REG_LOREFNOL); | 265 | se401_get_feature(se401, HV7131_REG_LOREFNOL); |
@@ -287,12 +287,12 @@ static void se401_button_irq(struct urb *urb, struct pt_regs *regs) | |||
287 | { | 287 | { |
288 | struct usb_se401 *se401 = urb->context; | 288 | struct usb_se401 *se401 = urb->context; |
289 | int status; | 289 | int status; |
290 | 290 | ||
291 | if (!se401->dev) { | 291 | if (!se401->dev) { |
292 | info("ohoh: device vapourished"); | 292 | info("ohoh: device vapourished"); |
293 | return; | 293 | return; |
294 | } | 294 | } |
295 | 295 | ||
296 | switch (urb->status) { | 296 | switch (urb->status) { |
297 | case 0: | 297 | case 0: |
298 | /* success */ | 298 | /* success */ |
@@ -368,7 +368,7 @@ static void se401_video_irq(struct urb *urb, struct pt_regs *regs) | |||
368 | if (se401->nullpackets > SE401_MAX_NULLPACKETS) { | 368 | if (se401->nullpackets > SE401_MAX_NULLPACKETS) { |
369 | if (waitqueue_active(&se401->wq)) { | 369 | if (waitqueue_active(&se401->wq)) { |
370 | wake_up_interruptible(&se401->wq); | 370 | wake_up_interruptible(&se401->wq); |
371 | } | 371 | } |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
@@ -433,8 +433,8 @@ static int se401_start_stream(struct usb_se401 *se401) | |||
433 | int err=0, i; | 433 | int err=0, i; |
434 | se401->streaming=1; | 434 | se401->streaming=1; |
435 | 435 | ||
436 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); | 436 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); |
437 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); | 437 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); |
438 | 438 | ||
439 | /* Set picture settings */ | 439 | /* Set picture settings */ |
440 | se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);/*windowed + pix intg */ | 440 | se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);/*windowed + pix intg */ |
@@ -571,7 +571,7 @@ static inline void decode_JangGu_integrate(struct usb_se401 *se401, int data) | |||
571 | } | 571 | } |
572 | 572 | ||
573 | /* First three are absolute, all others relative. | 573 | /* First three are absolute, all others relative. |
574 | * Format is rgb from right to left (mirrorred image), | 574 | * Format is rgb from right to left (mirrorred image), |
575 | * we flip it to get bgr from left to right. */ | 575 | * we flip it to get bgr from left to right. */ |
576 | if (frame->curlinepix < 3) { | 576 | if (frame->curlinepix < 3) { |
577 | *(frame->curline-frame->curlinepix)=1+data*4; | 577 | *(frame->curline-frame->curlinepix)=1+data*4; |
@@ -703,7 +703,7 @@ static inline void decode_bayer (struct usb_se401 *se401, struct se401_scratch * | |||
703 | int width=se401->cwidth; | 703 | int width=se401->cwidth; |
704 | int blineoffset=0, bline; | 704 | int blineoffset=0, bline; |
705 | int linelength=width*3, i; | 705 | int linelength=width*3, i; |
706 | 706 | ||
707 | 707 | ||
708 | if (frame->curpix==0) { | 708 | if (frame->curpix==0) { |
709 | if (frame->grabstate==FRAME_READY) { | 709 | if (frame->grabstate==FRAME_READY) { |
@@ -831,7 +831,7 @@ static int se401_newframe(struct usb_se401 *se401, int framenr) | |||
831 | se401->nullpackets=0; | 831 | se401->nullpackets=0; |
832 | info("to many null length packets, restarting capture"); | 832 | info("to many null length packets, restarting capture"); |
833 | se401_stop_stream(se401); | 833 | se401_stop_stream(se401); |
834 | se401_start_stream(se401); | 834 | se401_start_stream(se401); |
835 | } else { | 835 | } else { |
836 | if (se401->scratch[se401->scratch_use].state!=BUFFER_READY) { | 836 | if (se401->scratch[se401->scratch_use].state!=BUFFER_READY) { |
837 | se401->frame[framenr].grabstate=FRAME_ERROR; | 837 | se401->frame[framenr].grabstate=FRAME_ERROR; |
@@ -866,7 +866,7 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) | |||
866 | { | 866 | { |
867 | int i; | 867 | int i; |
868 | 868 | ||
869 | se401->dev = NULL; | 869 | se401->dev = NULL; |
870 | 870 | ||
871 | for (i=0; i<SE401_NUMSBUF; i++) | 871 | for (i=0; i<SE401_NUMSBUF; i++) |
872 | if (se401->urb[i]) { | 872 | if (se401->urb[i]) { |
@@ -882,9 +882,9 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) | |||
882 | usb_kill_urb(se401->inturb); | 882 | usb_kill_urb(se401->inturb); |
883 | usb_free_urb(se401->inturb); | 883 | usb_free_urb(se401->inturb); |
884 | } | 884 | } |
885 | info("%s disconnected", se401->camera_name); | 885 | info("%s disconnected", se401->camera_name); |
886 | 886 | ||
887 | /* Free the memory */ | 887 | /* Free the memory */ |
888 | kfree(se401->width); | 888 | kfree(se401->width); |
889 | kfree(se401->height); | 889 | kfree(se401->height); |
890 | kfree(se401); | 890 | kfree(se401); |
@@ -910,7 +910,7 @@ static int se401_open(struct inode *inode, struct file *file) | |||
910 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); | 910 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); |
911 | if (se401->fbuf) | 911 | if (se401->fbuf) |
912 | file->private_data = dev; | 912 | file->private_data = dev; |
913 | else | 913 | else |
914 | err = -ENOMEM; | 914 | err = -ENOMEM; |
915 | se401->user = !err; | 915 | se401->user = !err; |
916 | 916 | ||
@@ -920,11 +920,11 @@ static int se401_open(struct inode *inode, struct file *file) | |||
920 | static int se401_close(struct inode *inode, struct file *file) | 920 | static int se401_close(struct inode *inode, struct file *file) |
921 | { | 921 | { |
922 | struct video_device *dev = file->private_data; | 922 | struct video_device *dev = file->private_data; |
923 | struct usb_se401 *se401 = (struct usb_se401 *)dev; | 923 | struct usb_se401 *se401 = (struct usb_se401 *)dev; |
924 | int i; | 924 | int i; |
925 | 925 | ||
926 | rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES); | 926 | rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES); |
927 | if (se401->removed) { | 927 | if (se401->removed) { |
928 | usb_se401_remove_disconnected(se401); | 928 | usb_se401_remove_disconnected(se401); |
929 | info("device unregistered"); | 929 | info("device unregistered"); |
930 | } else { | 930 | } else { |
@@ -942,12 +942,12 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
942 | unsigned int cmd, void *arg) | 942 | unsigned int cmd, void *arg) |
943 | { | 943 | { |
944 | struct video_device *vdev = file->private_data; | 944 | struct video_device *vdev = file->private_data; |
945 | struct usb_se401 *se401 = (struct usb_se401 *)vdev; | 945 | struct usb_se401 *se401 = (struct usb_se401 *)vdev; |
946 | 946 | ||
947 | if (!se401->dev) | 947 | if (!se401->dev) |
948 | return -EIO; | 948 | return -EIO; |
949 | 949 | ||
950 | switch (cmd) { | 950 | switch (cmd) { |
951 | case VIDIOCGCAP: | 951 | case VIDIOCGCAP: |
952 | { | 952 | { |
953 | struct video_capability *b = arg; | 953 | struct video_capability *b = arg; |
@@ -981,8 +981,8 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
981 | return -EINVAL; | 981 | return -EINVAL; |
982 | return 0; | 982 | return 0; |
983 | } | 983 | } |
984 | case VIDIOCGPICT: | 984 | case VIDIOCGPICT: |
985 | { | 985 | { |
986 | struct video_picture *p = arg; | 986 | struct video_picture *p = arg; |
987 | 987 | ||
988 | se401_get_pict(se401, p); | 988 | se401_get_pict(se401, p); |
@@ -1007,7 +1007,7 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
1007 | if (se401_set_size(se401, vw->width, vw->height)) | 1007 | if (se401_set_size(se401, vw->width, vw->height)) |
1008 | return -EINVAL; | 1008 | return -EINVAL; |
1009 | return 0; | 1009 | return 0; |
1010 | } | 1010 | } |
1011 | case VIDIOCGWIN: | 1011 | case VIDIOCGWIN: |
1012 | { | 1012 | { |
1013 | struct video_window *vw = arg; | 1013 | struct video_window *vw = arg; |
@@ -1095,11 +1095,11 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
1095 | case VIDIOCGAUDIO: | 1095 | case VIDIOCGAUDIO: |
1096 | case VIDIOCSAUDIO: | 1096 | case VIDIOCSAUDIO: |
1097 | return -EINVAL; | 1097 | return -EINVAL; |
1098 | default: | 1098 | default: |
1099 | return -ENOIOCTLCMD; | 1099 | return -ENOIOCTLCMD; |
1100 | } /* end switch */ | 1100 | } /* end switch */ |
1101 | 1101 | ||
1102 | return 0; | 1102 | return 0; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | static int se401_ioctl(struct inode *inode, struct file *file, | 1105 | static int se401_ioctl(struct inode *inode, struct file *file, |
@@ -1142,7 +1142,7 @@ static ssize_t se401_read(struct file *file, char __user *buf, | |||
1142 | 1142 | ||
1143 | se401->frame[0].grabstate=FRAME_UNUSED; | 1143 | se401->frame[0].grabstate=FRAME_UNUSED; |
1144 | if (ret) | 1144 | if (ret) |
1145 | return ret; | 1145 | return ret; |
1146 | if (copy_to_user(buf, se401->frame[0].data, realcount)) | 1146 | if (copy_to_user(buf, se401->frame[0].data, realcount)) |
1147 | return -EFAULT; | 1147 | return -EFAULT; |
1148 | 1148 | ||
@@ -1183,24 +1183,24 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma) | |||
1183 | } | 1183 | } |
1184 | mutex_unlock(&se401->lock); | 1184 | mutex_unlock(&se401->lock); |
1185 | 1185 | ||
1186 | return 0; | 1186 | return 0; |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | static struct file_operations se401_fops = { | 1189 | static struct file_operations se401_fops = { |
1190 | .owner = THIS_MODULE, | 1190 | .owner = THIS_MODULE, |
1191 | .open = se401_open, | 1191 | .open = se401_open, |
1192 | .release = se401_close, | 1192 | .release = se401_close, |
1193 | .read = se401_read, | 1193 | .read = se401_read, |
1194 | .mmap = se401_mmap, | 1194 | .mmap = se401_mmap, |
1195 | .ioctl = se401_ioctl, | 1195 | .ioctl = se401_ioctl, |
1196 | .compat_ioctl = v4l_compat_ioctl32, | 1196 | .compat_ioctl = v4l_compat_ioctl32, |
1197 | .llseek = no_llseek, | 1197 | .llseek = no_llseek, |
1198 | }; | 1198 | }; |
1199 | static struct video_device se401_template = { | 1199 | static struct video_device se401_template = { |
1200 | .owner = THIS_MODULE, | 1200 | .owner = THIS_MODULE, |
1201 | .name = "se401 USB camera", | 1201 | .name = "se401 USB camera", |
1202 | .type = VID_TYPE_CAPTURE, | 1202 | .type = VID_TYPE_CAPTURE, |
1203 | .hardware = VID_HARDWARE_SE401, | 1203 | .hardware = VID_HARDWARE_SE401, |
1204 | .fops = &se401_fops, | 1204 | .fops = &se401_fops, |
1205 | }; | 1205 | }; |
1206 | 1206 | ||
@@ -1209,12 +1209,12 @@ static struct video_device se401_template = { | |||
1209 | /***************************/ | 1209 | /***************************/ |
1210 | static int se401_init(struct usb_se401 *se401, int button) | 1210 | static int se401_init(struct usb_se401 *se401, int button) |
1211 | { | 1211 | { |
1212 | int i=0, rc; | 1212 | int i=0, rc; |
1213 | unsigned char cp[0x40]; | 1213 | unsigned char cp[0x40]; |
1214 | char temp[200]; | 1214 | char temp[200]; |
1215 | 1215 | ||
1216 | /* led on */ | 1216 | /* led on */ |
1217 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); | 1217 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); |
1218 | 1218 | ||
1219 | /* get camera descriptor */ | 1219 | /* get camera descriptor */ |
1220 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp)); | 1220 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp)); |
@@ -1254,7 +1254,7 @@ static int se401_init(struct usb_se401 *se401, int button) | |||
1254 | return 1; | 1254 | return 1; |
1255 | } | 1255 | } |
1256 | /* set output mode (BAYER) */ | 1256 | /* set output mode (BAYER) */ |
1257 | se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0); | 1257 | se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0); |
1258 | 1258 | ||
1259 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp)); | 1259 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp)); |
1260 | se401->brightness=cp[0]+cp[1]*256; | 1260 | se401->brightness=cp[0]+cp[1]*256; |
@@ -1292,71 +1292,71 @@ static int se401_init(struct usb_se401 *se401, int button) | |||
1292 | } else | 1292 | } else |
1293 | se401->inturb=NULL; | 1293 | se401->inturb=NULL; |
1294 | 1294 | ||
1295 | /* Flash the led */ | 1295 | /* Flash the led */ |
1296 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); | 1296 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); |
1297 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); | 1297 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); |
1298 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0); | 1298 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0); |
1299 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0); | 1299 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0); |
1300 | 1300 | ||
1301 | return 0; | 1301 | return 0; |
1302 | } | 1302 | } |
1303 | 1303 | ||
1304 | static int se401_probe(struct usb_interface *intf, | 1304 | static int se401_probe(struct usb_interface *intf, |
1305 | const struct usb_device_id *id) | 1305 | const struct usb_device_id *id) |
1306 | { | 1306 | { |
1307 | struct usb_device *dev = interface_to_usbdev(intf); | 1307 | struct usb_device *dev = interface_to_usbdev(intf); |
1308 | struct usb_interface_descriptor *interface; | 1308 | struct usb_interface_descriptor *interface; |
1309 | struct usb_se401 *se401; | 1309 | struct usb_se401 *se401; |
1310 | char *camera_name=NULL; | 1310 | char *camera_name=NULL; |
1311 | int button=1; | 1311 | int button=1; |
1312 | 1312 | ||
1313 | /* We don't handle multi-config cameras */ | 1313 | /* We don't handle multi-config cameras */ |
1314 | if (dev->descriptor.bNumConfigurations != 1) | 1314 | if (dev->descriptor.bNumConfigurations != 1) |
1315 | return -ENODEV; | 1315 | return -ENODEV; |
1316 | 1316 | ||
1317 | interface = &intf->cur_altsetting->desc; | 1317 | interface = &intf->cur_altsetting->desc; |
1318 | 1318 | ||
1319 | /* Is it an se401? */ | 1319 | /* Is it an se401? */ |
1320 | if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 && | 1320 | if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 && |
1321 | le16_to_cpu(dev->descriptor.idProduct) == 0x0004) { | 1321 | le16_to_cpu(dev->descriptor.idProduct) == 0x0004) { |
1322 | camera_name="Endpoints/Aox SE401"; | 1322 | camera_name="Endpoints/Aox SE401"; |
1323 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 && | 1323 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 && |
1324 | le16_to_cpu(dev->descriptor.idProduct) == 0x030b) { | 1324 | le16_to_cpu(dev->descriptor.idProduct) == 0x030b) { |
1325 | camera_name="Philips PCVC665K"; | 1325 | camera_name="Philips PCVC665K"; |
1326 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && | 1326 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && |
1327 | le16_to_cpu(dev->descriptor.idProduct) == 0x5001) { | 1327 | le16_to_cpu(dev->descriptor.idProduct) == 0x5001) { |
1328 | camera_name="Kensington VideoCAM 67014"; | 1328 | camera_name="Kensington VideoCAM 67014"; |
1329 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && | 1329 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && |
1330 | le16_to_cpu(dev->descriptor.idProduct) == 0x5002) { | 1330 | le16_to_cpu(dev->descriptor.idProduct) == 0x5002) { |
1331 | camera_name="Kensington VideoCAM 6701(5/7)"; | 1331 | camera_name="Kensington VideoCAM 6701(5/7)"; |
1332 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && | 1332 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && |
1333 | le16_to_cpu(dev->descriptor.idProduct) == 0x5003) { | 1333 | le16_to_cpu(dev->descriptor.idProduct) == 0x5003) { |
1334 | camera_name="Kensington VideoCAM 67016"; | 1334 | camera_name="Kensington VideoCAM 67016"; |
1335 | button=0; | 1335 | button=0; |
1336 | } else | 1336 | } else |
1337 | return -ENODEV; | 1337 | return -ENODEV; |
1338 | 1338 | ||
1339 | /* Checking vendor/product should be enough, but what the hell */ | 1339 | /* Checking vendor/product should be enough, but what the hell */ |
1340 | if (interface->bInterfaceClass != 0x00) | 1340 | if (interface->bInterfaceClass != 0x00) |
1341 | return -ENODEV; | 1341 | return -ENODEV; |
1342 | if (interface->bInterfaceSubClass != 0x00) | 1342 | if (interface->bInterfaceSubClass != 0x00) |
1343 | return -ENODEV; | 1343 | return -ENODEV; |
1344 | 1344 | ||
1345 | /* We found one */ | 1345 | /* We found one */ |
1346 | info("SE401 camera found: %s", camera_name); | 1346 | info("SE401 camera found: %s", camera_name); |
1347 | 1347 | ||
1348 | if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { | 1348 | if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { |
1349 | err("couldn't kmalloc se401 struct"); | 1349 | err("couldn't kmalloc se401 struct"); |
1350 | return -ENOMEM; | 1350 | return -ENOMEM; |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | se401->dev = dev; | 1353 | se401->dev = dev; |
1354 | se401->iface = interface->bInterfaceNumber; | 1354 | se401->iface = interface->bInterfaceNumber; |
1355 | se401->camera_name = camera_name; | 1355 | se401->camera_name = camera_name; |
1356 | 1356 | ||
1357 | info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255); | 1357 | info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255); |
1358 | 1358 | ||
1359 | if (se401_init(se401, button)) { | 1359 | if (se401_init(se401, button)) { |
1360 | kfree(se401); | 1360 | kfree(se401); |
1361 | return -EIO; | 1361 | return -EIO; |
1362 | } | 1362 | } |
@@ -1375,7 +1375,7 @@ static int se401_probe(struct usb_interface *intf, | |||
1375 | info("registered new video device: video%d", se401->vdev.minor); | 1375 | info("registered new video device: video%d", se401->vdev.minor); |
1376 | 1376 | ||
1377 | usb_set_intfdata (intf, se401); | 1377 | usb_set_intfdata (intf, se401); |
1378 | return 0; | 1378 | return 0; |
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | static void se401_disconnect(struct usb_interface *intf) | 1381 | static void se401_disconnect(struct usb_interface *intf) |
@@ -1400,10 +1400,10 @@ static void se401_disconnect(struct usb_interface *intf) | |||
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | static struct usb_driver se401_driver = { | 1402 | static struct usb_driver se401_driver = { |
1403 | .name = "se401", | 1403 | .name = "se401", |
1404 | .id_table = device_table, | 1404 | .id_table = device_table, |
1405 | .probe = se401_probe, | 1405 | .probe = se401_probe, |
1406 | .disconnect = se401_disconnect, | 1406 | .disconnect = se401_disconnect, |
1407 | }; | 1407 | }; |
1408 | 1408 | ||
1409 | 1409 | ||
diff --git a/drivers/usb/media/se401.h b/drivers/media/video/se401.h index e88a40d4c86a..a7a216bd4413 100644 --- a/drivers/usb/media/se401.h +++ b/drivers/media/video/se401.h | |||
@@ -177,7 +177,7 @@ struct usb_se401 { | |||
177 | int expose_m; | 177 | int expose_m; |
178 | int expose_l; | 178 | int expose_l; |
179 | int resetlevel; | 179 | int resetlevel; |
180 | 180 | ||
181 | int enhance; | 181 | int enhance; |
182 | 182 | ||
183 | int format; | 183 | int format; |
@@ -200,12 +200,12 @@ struct usb_se401 { | |||
200 | 200 | ||
201 | struct urb *urb[SE401_NUMSBUF]; | 201 | struct urb *urb[SE401_NUMSBUF]; |
202 | struct urb *inturb; | 202 | struct urb *inturb; |
203 | 203 | ||
204 | int button; | 204 | int button; |
205 | int buttonpressed; | 205 | int buttonpressed; |
206 | 206 | ||
207 | int curframe; /* Current receiving frame */ | 207 | int curframe; /* Current receiving frame */ |
208 | struct se401_frame frame[SE401_NUMFRAMES]; | 208 | struct se401_frame frame[SE401_NUMFRAMES]; |
209 | int readcount; | 209 | int readcount; |
210 | int framecount; | 210 | int framecount; |
211 | int error; | 211 | int error; |
diff --git a/drivers/media/video/sn9c102/Makefile b/drivers/media/video/sn9c102/Makefile new file mode 100644 index 000000000000..536ad3098da4 --- /dev/null +++ b/drivers/media/video/sn9c102/Makefile | |||
@@ -0,0 +1,7 @@ | |||
1 | sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o \ | ||
2 | sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bca.o \ | ||
3 | sn9c102_pas202bcb.o sn9c102_tas5110c1b.o \ | ||
4 | sn9c102_tas5130d1b.o | ||
5 | |||
6 | obj-$(CONFIG_USB_SN9C102) += sn9c102.o | ||
7 | |||
diff --git a/drivers/usb/media/sn9c102.h b/drivers/media/video/sn9c102/sn9c102.h index 1d70a62b9f23..2c6ff396dafc 100644 --- a/drivers/usb/media/sn9c102.h +++ b/drivers/media/video/sn9c102/sn9c102.h | |||
@@ -164,7 +164,7 @@ sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id) | |||
164 | 164 | ||
165 | void | 165 | void |
166 | sn9c102_attach_sensor(struct sn9c102_device* cam, | 166 | sn9c102_attach_sensor(struct sn9c102_device* cam, |
167 | struct sn9c102_sensor* sensor) | 167 | struct sn9c102_sensor* sensor) |
168 | { | 168 | { |
169 | memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor)); | 169 | memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor)); |
170 | } | 170 | } |
@@ -183,7 +183,7 @@ do { \ | |||
183 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ | 183 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
184 | else if ((level) >= 3) \ | 184 | else if ((level) >= 3) \ |
185 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 185 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
186 | __FUNCTION__, __LINE__ , ## args); \ | 186 | __FUNCTION__, __LINE__ , ## args); \ |
187 | } \ | 187 | } \ |
188 | } while (0) | 188 | } while (0) |
189 | # define V4LDBG(level, name, cmd) \ | 189 | # define V4LDBG(level, name, cmd) \ |
@@ -198,7 +198,7 @@ do { \ | |||
198 | pr_info("sn9c102: " fmt "\n", ## args); \ | 198 | pr_info("sn9c102: " fmt "\n", ## args); \ |
199 | else if ((level) == 3) \ | 199 | else if ((level) == 3) \ |
200 | pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \ | 200 | pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \ |
201 | __LINE__ , ## args); \ | 201 | __LINE__ , ## args); \ |
202 | } \ | 202 | } \ |
203 | } while (0) | 203 | } while (0) |
204 | #else | 204 | #else |
@@ -210,7 +210,7 @@ do { \ | |||
210 | #undef PDBG | 210 | #undef PDBG |
211 | #define PDBG(fmt, args...) \ | 211 | #define PDBG(fmt, args...) \ |
212 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 212 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
213 | __FUNCTION__, __LINE__ , ## args) | 213 | __FUNCTION__, __LINE__ , ## args) |
214 | 214 | ||
215 | #undef PDBGG | 215 | #undef PDBGG |
216 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | 216 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |
diff --git a/drivers/usb/media/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 4c6cc6395723..ea4394dc9415 100644 --- a/drivers/usb/media/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c | |||
@@ -62,53 +62,53 @@ MODULE_LICENSE(SN9C102_MODULE_LICENSE); | |||
62 | static short video_nr[] = {[0 ... SN9C102_MAX_DEVICES-1] = -1}; | 62 | static short video_nr[] = {[0 ... SN9C102_MAX_DEVICES-1] = -1}; |
63 | module_param_array(video_nr, short, NULL, 0444); | 63 | module_param_array(video_nr, short, NULL, 0444); |
64 | MODULE_PARM_DESC(video_nr, | 64 | MODULE_PARM_DESC(video_nr, |
65 | "\n<-1|n[,...]> Specify V4L2 minor mode number." | 65 | "\n<-1|n[,...]> Specify V4L2 minor mode number." |
66 | "\n -1 = use next available (default)" | 66 | "\n -1 = use next available (default)" |
67 | "\n n = use minor number n (integer >= 0)" | 67 | "\n n = use minor number n (integer >= 0)" |
68 | "\nYou can specify up to "__MODULE_STRING(SN9C102_MAX_DEVICES) | 68 | "\nYou can specify up to "__MODULE_STRING(SN9C102_MAX_DEVICES) |
69 | " cameras this way." | 69 | " cameras this way." |
70 | "\nFor example:" | 70 | "\nFor example:" |
71 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" | 71 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" |
72 | "\nthe second camera and use auto for the first" | 72 | "\nthe second camera and use auto for the first" |
73 | "\none and for every other camera." | 73 | "\none and for every other camera." |
74 | "\n"); | 74 | "\n"); |
75 | 75 | ||
76 | static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] = | 76 | static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] = |
77 | SN9C102_FORCE_MUNMAP}; | 77 | SN9C102_FORCE_MUNMAP}; |
78 | module_param_array(force_munmap, bool, NULL, 0444); | 78 | module_param_array(force_munmap, bool, NULL, 0444); |
79 | MODULE_PARM_DESC(force_munmap, | 79 | MODULE_PARM_DESC(force_munmap, |
80 | "\n<0|1[,...]> Force the application to unmap previously" | 80 | "\n<0|1[,...]> Force the application to unmap previously" |
81 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" | 81 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" |
82 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" | 82 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" |
83 | "\nthis feature. This parameter is specific for each" | 83 | "\nthis feature. This parameter is specific for each" |
84 | "\ndetected camera." | 84 | "\ndetected camera." |
85 | "\n 0 = do not force memory unmapping" | 85 | "\n 0 = do not force memory unmapping" |
86 | "\n 1 = force memory unmapping (save memory)" | 86 | "\n 1 = force memory unmapping (save memory)" |
87 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." | 87 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." |
88 | "\n"); | 88 | "\n"); |
89 | 89 | ||
90 | static unsigned int frame_timeout[] = {[0 ... SN9C102_MAX_DEVICES-1] = | 90 | static unsigned int frame_timeout[] = {[0 ... SN9C102_MAX_DEVICES-1] = |
91 | SN9C102_FRAME_TIMEOUT}; | 91 | SN9C102_FRAME_TIMEOUT}; |
92 | module_param_array(frame_timeout, uint, NULL, 0644); | 92 | module_param_array(frame_timeout, uint, NULL, 0644); |
93 | MODULE_PARM_DESC(frame_timeout, | 93 | MODULE_PARM_DESC(frame_timeout, |
94 | "\n<n[,...]> Timeout for a video frame in seconds." | 94 | "\n<n[,...]> Timeout for a video frame in seconds." |
95 | "\nThis parameter is specific for each detected camera." | 95 | "\nThis parameter is specific for each detected camera." |
96 | "\nDefault value is "__MODULE_STRING(SN9C102_FRAME_TIMEOUT)"." | 96 | "\nDefault value is "__MODULE_STRING(SN9C102_FRAME_TIMEOUT)"." |
97 | "\n"); | 97 | "\n"); |
98 | 98 | ||
99 | #ifdef SN9C102_DEBUG | 99 | #ifdef SN9C102_DEBUG |
100 | static unsigned short debug = SN9C102_DEBUG_LEVEL; | 100 | static unsigned short debug = SN9C102_DEBUG_LEVEL; |
101 | module_param(debug, ushort, 0644); | 101 | module_param(debug, ushort, 0644); |
102 | MODULE_PARM_DESC(debug, | 102 | MODULE_PARM_DESC(debug, |
103 | "\n<n> Debugging information level, from 0 to 3:" | 103 | "\n<n> Debugging information level, from 0 to 3:" |
104 | "\n0 = none (use carefully)" | 104 | "\n0 = none (use carefully)" |
105 | "\n1 = critical errors" | 105 | "\n1 = critical errors" |
106 | "\n2 = significant informations" | 106 | "\n2 = significant informations" |
107 | "\n3 = more verbose messages" | 107 | "\n3 = more verbose messages" |
108 | "\nLevel 3 is useful for testing only, when only " | 108 | "\nLevel 3 is useful for testing only, when only " |
109 | "one device is used." | 109 | "one device is used." |
110 | "\nDefault value is "__MODULE_STRING(SN9C102_DEBUG_LEVEL)"." | 110 | "\nDefault value is "__MODULE_STRING(SN9C102_DEBUG_LEVEL)"." |
111 | "\n"); | 111 | "\n"); |
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | /*****************************************************************************/ | 114 | /*****************************************************************************/ |
@@ -131,16 +131,16 @@ static sn9c102_eof_header_t sn9c102_eof_header[] = { | |||
131 | 131 | ||
132 | /*****************************************************************************/ | 132 | /*****************************************************************************/ |
133 | 133 | ||
134 | static u32 | 134 | static u32 |
135 | sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, | 135 | sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, |
136 | enum sn9c102_io_method io) | 136 | enum sn9c102_io_method io) |
137 | { | 137 | { |
138 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); | 138 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); |
139 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); | 139 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); |
140 | const size_t imagesize = cam->module_param.force_munmap || | 140 | const size_t imagesize = cam->module_param.force_munmap || |
141 | io == IO_READ ? | 141 | io == IO_READ ? |
142 | (p->width * p->height * p->priv) / 8 : | 142 | (p->width * p->height * p->priv) / 8 : |
143 | (r->width * r->height * p->priv) / 8; | 143 | (r->width * r->height * p->priv) / 8; |
144 | void* buff = NULL; | 144 | void* buff = NULL; |
145 | u32 i; | 145 | u32 i; |
146 | 146 | ||
@@ -232,8 +232,8 @@ int sn9c102_write_regs(struct sn9c102_device* cam, u8* buff, u16 index) | |||
232 | return -1; | 232 | return -1; |
233 | 233 | ||
234 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 234 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
235 | index, 0, buff, sizeof(buff), | 235 | index, 0, buff, sizeof(buff), |
236 | SN9C102_CTRL_TIMEOUT*sizeof(buff)); | 236 | SN9C102_CTRL_TIMEOUT*sizeof(buff)); |
237 | if (res < 0) { | 237 | if (res < 0) { |
238 | DBG(3, "Failed to write registers (index 0x%02X, error %d)", | 238 | DBG(3, "Failed to write registers (index 0x%02X, error %d)", |
239 | index, res); | 239 | index, res); |
@@ -259,7 +259,7 @@ int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index) | |||
259 | *buff = value; | 259 | *buff = value; |
260 | 260 | ||
261 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 261 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
262 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); | 262 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); |
263 | if (res < 0) { | 263 | if (res < 0) { |
264 | DBG(3, "Failed to write a register (value 0x%02X, index " | 264 | DBG(3, "Failed to write a register (value 0x%02X, index " |
265 | "0x%02X, error %d)", value, index, res); | 265 | "0x%02X, error %d)", value, index, res); |
@@ -280,7 +280,7 @@ static int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) | |||
280 | int res; | 280 | int res; |
281 | 281 | ||
282 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, | 282 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, |
283 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); | 283 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); |
284 | if (res < 0) | 284 | if (res < 0) |
285 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", | 285 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", |
286 | index, res); | 286 | index, res); |
@@ -319,8 +319,8 @@ sn9c102_i2c_wait(struct sn9c102_device* cam, struct sn9c102_sensor* sensor) | |||
319 | 319 | ||
320 | 320 | ||
321 | static int | 321 | static int |
322 | sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, | 322 | sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, |
323 | struct sn9c102_sensor* sensor) | 323 | struct sn9c102_sensor* sensor) |
324 | { | 324 | { |
325 | int r; | 325 | int r; |
326 | r = sn9c102_read_reg(cam, 0x08); | 326 | r = sn9c102_read_reg(cam, 0x08); |
@@ -329,8 +329,8 @@ sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, | |||
329 | 329 | ||
330 | 330 | ||
331 | static int | 331 | static int |
332 | sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, | 332 | sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, |
333 | struct sn9c102_sensor* sensor) | 333 | struct sn9c102_sensor* sensor) |
334 | { | 334 | { |
335 | int r; | 335 | int r; |
336 | r = sn9c102_read_reg(cam, 0x08); | 336 | r = sn9c102_read_reg(cam, 0x08); |
@@ -338,10 +338,10 @@ sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, | |||
338 | } | 338 | } |
339 | 339 | ||
340 | 340 | ||
341 | int | 341 | int |
342 | sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | 342 | sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, |
343 | struct sn9c102_sensor* sensor, u8 data0, u8 data1, | 343 | struct sn9c102_sensor* sensor, u8 data0, u8 data1, |
344 | u8 n, u8 buffer[]) | 344 | u8 n, u8 buffer[]) |
345 | { | 345 | { |
346 | struct usb_device* udev = cam->usbdev; | 346 | struct usb_device* udev = cam->usbdev; |
347 | u8* data = cam->control_buffer; | 347 | u8* data = cam->control_buffer; |
@@ -349,12 +349,12 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | |||
349 | 349 | ||
350 | /* Write cycle */ | 350 | /* Write cycle */ |
351 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | | 351 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | |
352 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | 0x10; | 352 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | 0x10; |
353 | data[1] = data0; /* I2C slave id */ | 353 | data[1] = data0; /* I2C slave id */ |
354 | data[2] = data1; /* address */ | 354 | data[2] = data1; /* address */ |
355 | data[7] = 0x10; | 355 | data[7] = 0x10; |
356 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 356 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
357 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); | 357 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); |
358 | if (res < 0) | 358 | if (res < 0) |
359 | err += res; | 359 | err += res; |
360 | 360 | ||
@@ -362,12 +362,12 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | |||
362 | 362 | ||
363 | /* Read cycle - n bytes */ | 363 | /* Read cycle - n bytes */ |
364 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | | 364 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | |
365 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | | 365 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | |
366 | (n << 4) | 0x02; | 366 | (n << 4) | 0x02; |
367 | data[1] = data0; | 367 | data[1] = data0; |
368 | data[7] = 0x10; | 368 | data[7] = 0x10; |
369 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 369 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
370 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); | 370 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); |
371 | if (res < 0) | 371 | if (res < 0) |
372 | err += res; | 372 | err += res; |
373 | 373 | ||
@@ -375,7 +375,7 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | |||
375 | 375 | ||
376 | /* The first read byte will be placed in data[4] */ | 376 | /* The first read byte will be placed in data[4] */ |
377 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, | 377 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, |
378 | 0x0a, 0, data, 5, SN9C102_CTRL_TIMEOUT); | 378 | 0x0a, 0, data, 5, SN9C102_CTRL_TIMEOUT); |
379 | if (res < 0) | 379 | if (res < 0) |
380 | err += res; | 380 | err += res; |
381 | 381 | ||
@@ -396,10 +396,10 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | |||
396 | } | 396 | } |
397 | 397 | ||
398 | 398 | ||
399 | int | 399 | int |
400 | sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | 400 | sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, |
401 | struct sn9c102_sensor* sensor, u8 n, u8 data0, | 401 | struct sn9c102_sensor* sensor, u8 n, u8 data0, |
402 | u8 data1, u8 data2, u8 data3, u8 data4, u8 data5) | 402 | u8 data1, u8 data2, u8 data3, u8 data4, u8 data5) |
403 | { | 403 | { |
404 | struct usb_device* udev = cam->usbdev; | 404 | struct usb_device* udev = cam->usbdev; |
405 | u8* data = cam->control_buffer; | 405 | u8* data = cam->control_buffer; |
@@ -407,8 +407,8 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | |||
407 | 407 | ||
408 | /* Write cycle. It usually is address + value */ | 408 | /* Write cycle. It usually is address + value */ |
409 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | | 409 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | |
410 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | 410 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) |
411 | | ((n - 1) << 4); | 411 | | ((n - 1) << 4); |
412 | data[1] = data0; | 412 | data[1] = data0; |
413 | data[2] = data1; | 413 | data[2] = data1; |
414 | data[3] = data2; | 414 | data[3] = data2; |
@@ -417,7 +417,7 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | |||
417 | data[6] = data5; | 417 | data[6] = data5; |
418 | data[7] = 0x14; | 418 | data[7] = 0x14; |
419 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 419 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
420 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); | 420 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); |
421 | if (res < 0) | 421 | if (res < 0) |
422 | err += res; | 422 | err += res; |
423 | 423 | ||
@@ -437,20 +437,20 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | |||
437 | 437 | ||
438 | int | 438 | int |
439 | sn9c102_i2c_try_read(struct sn9c102_device* cam, | 439 | sn9c102_i2c_try_read(struct sn9c102_device* cam, |
440 | struct sn9c102_sensor* sensor, u8 address) | 440 | struct sn9c102_sensor* sensor, u8 address) |
441 | { | 441 | { |
442 | return sn9c102_i2c_try_raw_read(cam, sensor, sensor->i2c_slave_id, | 442 | return sn9c102_i2c_try_raw_read(cam, sensor, sensor->i2c_slave_id, |
443 | address, 1, NULL); | 443 | address, 1, NULL); |
444 | } | 444 | } |
445 | 445 | ||
446 | 446 | ||
447 | int | 447 | int |
448 | sn9c102_i2c_try_write(struct sn9c102_device* cam, | 448 | sn9c102_i2c_try_write(struct sn9c102_device* cam, |
449 | struct sn9c102_sensor* sensor, u8 address, u8 value) | 449 | struct sn9c102_sensor* sensor, u8 address, u8 value) |
450 | { | 450 | { |
451 | return sn9c102_i2c_try_raw_write(cam, sensor, 3, | 451 | return sn9c102_i2c_try_raw_write(cam, sensor, 3, |
452 | sensor->i2c_slave_id, address, | 452 | sensor->i2c_slave_id, address, |
453 | value, 0, 0, 0); | 453 | value, 0, 0, 0); |
454 | } | 454 | } |
455 | 455 | ||
456 | 456 | ||
@@ -484,7 +484,7 @@ sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) | |||
484 | n = sizeof(sn9c103_sof_header) / soflen; | 484 | n = sizeof(sn9c103_sof_header) / soflen; |
485 | } | 485 | } |
486 | 486 | ||
487 | for (i = 0; (len >= soflen) && (i <= len - soflen); i++) | 487 | for (i = 0; (len >= soflen) && (i <= len - soflen); i++) |
488 | for (j = 0; j < n; j++) | 488 | for (j = 0; j < n; j++) |
489 | /* The invariable part of the header is 6 bytes long */ | 489 | /* The invariable part of the header is 6 bytes long */ |
490 | if ((cam->bridge != BRIDGE_SN9C103 && | 490 | if ((cam->bridge != BRIDGE_SN9C103 && |
@@ -552,15 +552,15 @@ static void sn9c102_urb_complete(struct urb *urb, struct pt_regs* regs) | |||
552 | 552 | ||
553 | if (!(*f)) | 553 | if (!(*f)) |
554 | (*f) = list_entry(cam->inqueue.next, struct sn9c102_frame_t, | 554 | (*f) = list_entry(cam->inqueue.next, struct sn9c102_frame_t, |
555 | frame); | 555 | frame); |
556 | 556 | ||
557 | imagesize = (cam->sensor.pix_format.width * | 557 | imagesize = (cam->sensor.pix_format.width * |
558 | cam->sensor.pix_format.height * | 558 | cam->sensor.pix_format.height * |
559 | cam->sensor.pix_format.priv) / 8; | 559 | cam->sensor.pix_format.priv) / 8; |
560 | 560 | ||
561 | soflen = (cam->bridge) == BRIDGE_SN9C103 ? | 561 | soflen = (cam->bridge) == BRIDGE_SN9C103 ? |
562 | sizeof(sn9c103_sof_header_t) : | 562 | sizeof(sn9c103_sof_header_t) : |
563 | sizeof(sn9c102_sof_header_t); | 563 | sizeof(sn9c102_sof_header_t); |
564 | 564 | ||
565 | for (i = 0; i < urb->number_of_packets; i++) { | 565 | for (i = 0; i < urb->number_of_packets; i++) { |
566 | unsigned int img, len, status; | 566 | unsigned int img, len, status; |
@@ -611,19 +611,19 @@ end_of_frame: | |||
611 | 611 | ||
612 | if ((*f)->buf.bytesused == imagesize || | 612 | if ((*f)->buf.bytesused == imagesize || |
613 | (cam->sensor.pix_format.pixelformat == | 613 | (cam->sensor.pix_format.pixelformat == |
614 | V4L2_PIX_FMT_SN9C10X && eof)) { | 614 | V4L2_PIX_FMT_SN9C10X && eof)) { |
615 | u32 b; | 615 | u32 b; |
616 | b = (*f)->buf.bytesused; | 616 | b = (*f)->buf.bytesused; |
617 | (*f)->state = F_DONE; | 617 | (*f)->state = F_DONE; |
618 | (*f)->buf.sequence= ++cam->frame_count; | 618 | (*f)->buf.sequence= ++cam->frame_count; |
619 | spin_lock(&cam->queue_lock); | 619 | spin_lock(&cam->queue_lock); |
620 | list_move_tail(&(*f)->frame, | 620 | list_move_tail(&(*f)->frame, |
621 | &cam->outqueue); | 621 | &cam->outqueue); |
622 | if (!list_empty(&cam->inqueue)) | 622 | if (!list_empty(&cam->inqueue)) |
623 | (*f) = list_entry( | 623 | (*f) = list_entry( |
624 | cam->inqueue.next, | 624 | cam->inqueue.next, |
625 | struct sn9c102_frame_t, | 625 | struct sn9c102_frame_t, |
626 | frame ); | 626 | frame ); |
627 | else | 627 | else |
628 | (*f) = NULL; | 628 | (*f) = NULL; |
629 | spin_unlock(&cam->queue_lock); | 629 | spin_unlock(&cam->queue_lock); |
@@ -638,7 +638,7 @@ end_of_frame: | |||
638 | } else if (eof) { | 638 | } else if (eof) { |
639 | (*f)->state = F_ERROR; | 639 | (*f)->state = F_ERROR; |
640 | DBG(3, "Not expected EOF after %lu " | 640 | DBG(3, "Not expected EOF after %lu " |
641 | "bytes of image data", | 641 | "bytes of image data", |
642 | (unsigned long) | 642 | (unsigned long) |
643 | ((*f)->buf.bytesused)); | 643 | ((*f)->buf.bytesused)); |
644 | } | 644 | } |
@@ -676,7 +676,7 @@ start_of_frame: | |||
676 | goto end_of_frame; | 676 | goto end_of_frame; |
677 | } else { | 677 | } else { |
678 | DBG(3, "SOF before expected EOF after " | 678 | DBG(3, "SOF before expected EOF after " |
679 | "%lu bytes of image data", | 679 | "%lu bytes of image data", |
680 | (unsigned long) | 680 | (unsigned long) |
681 | ((*f)->buf.bytesused)); | 681 | ((*f)->buf.bytesused)); |
682 | goto start_of_frame; | 682 | goto start_of_frame; |
@@ -702,18 +702,18 @@ static int sn9c102_start_transfer(struct sn9c102_device* cam) | |||
702 | struct usb_device *udev = cam->usbdev; | 702 | struct usb_device *udev = cam->usbdev; |
703 | struct urb* urb; | 703 | struct urb* urb; |
704 | const unsigned int sn9c102_wMaxPacketSize[] = {0, 128, 256, 384, 512, | 704 | const unsigned int sn9c102_wMaxPacketSize[] = {0, 128, 256, 384, 512, |
705 | 680, 800, 900, 1023}; | 705 | 680, 800, 900, 1023}; |
706 | const unsigned int sn9c103_wMaxPacketSize[] = {0, 128, 256, 384, 512, | 706 | const unsigned int sn9c103_wMaxPacketSize[] = {0, 128, 256, 384, 512, |
707 | 680, 800, 900, 1003}; | 707 | 680, 800, 900, 1003}; |
708 | const unsigned int psz = (cam->bridge == BRIDGE_SN9C103) ? | 708 | const unsigned int psz = (cam->bridge == BRIDGE_SN9C103) ? |
709 | sn9c103_wMaxPacketSize[SN9C102_ALTERNATE_SETTING] : | 709 | sn9c103_wMaxPacketSize[SN9C102_ALTERNATE_SETTING] : |
710 | sn9c102_wMaxPacketSize[SN9C102_ALTERNATE_SETTING]; | 710 | sn9c102_wMaxPacketSize[SN9C102_ALTERNATE_SETTING]; |
711 | s8 i, j; | 711 | s8 i, j; |
712 | int err = 0; | 712 | int err = 0; |
713 | 713 | ||
714 | for (i = 0; i < SN9C102_URBS; i++) { | 714 | for (i = 0; i < SN9C102_URBS; i++) { |
715 | cam->transfer_buffer[i] = kzalloc(SN9C102_ISO_PACKETS * psz, | 715 | cam->transfer_buffer[i] = kzalloc(SN9C102_ISO_PACKETS * psz, |
716 | GFP_KERNEL); | 716 | GFP_KERNEL); |
717 | if (!cam->transfer_buffer[i]) { | 717 | if (!cam->transfer_buffer[i]) { |
718 | err = -ENOMEM; | 718 | err = -ENOMEM; |
719 | DBG(1, "Not enough memory"); | 719 | DBG(1, "Not enough memory"); |
@@ -815,9 +815,9 @@ static int sn9c102_stream_interrupt(struct sn9c102_device* cam) | |||
815 | 815 | ||
816 | cam->stream = STREAM_INTERRUPT; | 816 | cam->stream = STREAM_INTERRUPT; |
817 | timeout = wait_event_timeout(cam->wait_stream, | 817 | timeout = wait_event_timeout(cam->wait_stream, |
818 | (cam->stream == STREAM_OFF) || | 818 | (cam->stream == STREAM_OFF) || |
819 | (cam->state & DEV_DISCONNECTED), | 819 | (cam->state & DEV_DISCONNECTED), |
820 | SN9C102_URB_TIMEOUT); | 820 | SN9C102_URB_TIMEOUT); |
821 | if (cam->state & DEV_DISCONNECTED) | 821 | if (cam->state & DEV_DISCONNECTED) |
822 | return -ENODEV; | 822 | return -ENODEV; |
823 | else if (cam->stream != STREAM_OFF) { | 823 | else if (cam->stream != STREAM_OFF) { |
@@ -861,7 +861,7 @@ static u8 sn9c102_strtou8(const char* buff, size_t len, ssize_t* count) | |||
861 | 861 | ||
862 | /* | 862 | /* |
863 | NOTE 1: being inside one of the following methods implies that the v4l | 863 | NOTE 1: being inside one of the following methods implies that the v4l |
864 | device exists for sure (see kobjects and reference counters) | 864 | device exists for sure (see kobjects and reference counters) |
865 | NOTE 2: buffers are PAGE_SIZE long | 865 | NOTE 2: buffers are PAGE_SIZE long |
866 | */ | 866 | */ |
867 | 867 | ||
@@ -884,10 +884,10 @@ static ssize_t sn9c102_show_reg(struct class_device* cd, char* buf) | |||
884 | mutex_unlock(&sn9c102_sysfs_lock); | 884 | mutex_unlock(&sn9c102_sysfs_lock); |
885 | 885 | ||
886 | return count; | 886 | return count; |
887 | } | 887 | } |
888 | 888 | ||
889 | 889 | ||
890 | static ssize_t | 890 | static ssize_t |
891 | sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len) | 891 | sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len) |
892 | { | 892 | { |
893 | struct sn9c102_device* cam; | 893 | struct sn9c102_device* cam; |
@@ -947,7 +947,7 @@ static ssize_t sn9c102_show_val(struct class_device* cd, char* buf) | |||
947 | mutex_unlock(&sn9c102_sysfs_lock); | 947 | mutex_unlock(&sn9c102_sysfs_lock); |
948 | 948 | ||
949 | return count; | 949 | return count; |
950 | } | 950 | } |
951 | 951 | ||
952 | 952 | ||
953 | static ssize_t | 953 | static ssize_t |
@@ -1013,7 +1013,7 @@ static ssize_t sn9c102_show_i2c_reg(struct class_device* cd, char* buf) | |||
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | 1015 | ||
1016 | static ssize_t | 1016 | static ssize_t |
1017 | sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) | 1017 | sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) |
1018 | { | 1018 | { |
1019 | struct sn9c102_device* cam; | 1019 | struct sn9c102_device* cam; |
@@ -1078,7 +1078,7 @@ static ssize_t sn9c102_show_i2c_val(struct class_device* cd, char* buf) | |||
1078 | mutex_unlock(&sn9c102_sysfs_lock); | 1078 | mutex_unlock(&sn9c102_sysfs_lock); |
1079 | 1079 | ||
1080 | return count; | 1080 | return count; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | 1083 | ||
1084 | static ssize_t | 1084 | static ssize_t |
@@ -1222,22 +1222,22 @@ static ssize_t sn9c102_show_frame_header(struct class_device* cd, char* buf) | |||
1222 | DBG(3, "Frame header, read bytes: %zd", count); | 1222 | DBG(3, "Frame header, read bytes: %zd", count); |
1223 | 1223 | ||
1224 | return count; | 1224 | return count; |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | 1227 | ||
1228 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, | 1228 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, |
1229 | sn9c102_show_reg, sn9c102_store_reg); | 1229 | sn9c102_show_reg, sn9c102_store_reg); |
1230 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, | 1230 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, |
1231 | sn9c102_show_val, sn9c102_store_val); | 1231 | sn9c102_show_val, sn9c102_store_val); |
1232 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, | 1232 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, |
1233 | sn9c102_show_i2c_reg, sn9c102_store_i2c_reg); | 1233 | sn9c102_show_i2c_reg, sn9c102_store_i2c_reg); |
1234 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, | 1234 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, |
1235 | sn9c102_show_i2c_val, sn9c102_store_i2c_val); | 1235 | sn9c102_show_i2c_val, sn9c102_store_i2c_val); |
1236 | static CLASS_DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green); | 1236 | static CLASS_DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green); |
1237 | static CLASS_DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue); | 1237 | static CLASS_DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue); |
1238 | static CLASS_DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red); | 1238 | static CLASS_DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red); |
1239 | static CLASS_DEVICE_ATTR(frame_header, S_IRUGO, | 1239 | static CLASS_DEVICE_ATTR(frame_header, S_IRUGO, |
1240 | sn9c102_show_frame_header, NULL); | 1240 | sn9c102_show_frame_header, NULL); |
1241 | 1241 | ||
1242 | 1242 | ||
1243 | static void sn9c102_create_sysfs(struct sn9c102_device* cam) | 1243 | static void sn9c102_create_sysfs(struct sn9c102_device* cam) |
@@ -1278,7 +1278,7 @@ sn9c102_set_pix_format(struct sn9c102_device* cam, struct v4l2_pix_format* pix) | |||
1278 | 1278 | ||
1279 | static int | 1279 | static int |
1280 | sn9c102_set_compression(struct sn9c102_device* cam, | 1280 | sn9c102_set_compression(struct sn9c102_device* cam, |
1281 | struct v4l2_jpegcompression* compression) | 1281 | struct v4l2_jpegcompression* compression) |
1282 | { | 1282 | { |
1283 | int err = 0; | 1283 | int err = 0; |
1284 | 1284 | ||
@@ -1469,8 +1469,8 @@ static int sn9c102_open(struct inode* inode, struct file* filp) | |||
1469 | } | 1469 | } |
1470 | mutex_unlock(&cam->dev_mutex); | 1470 | mutex_unlock(&cam->dev_mutex); |
1471 | err = wait_event_interruptible_exclusive(cam->open, | 1471 | err = wait_event_interruptible_exclusive(cam->open, |
1472 | cam->state & DEV_DISCONNECTED | 1472 | cam->state & DEV_DISCONNECTED |
1473 | || !cam->users); | 1473 | || !cam->users); |
1474 | if (err) { | 1474 | if (err) { |
1475 | up_read(&sn9c102_disconnect); | 1475 | up_read(&sn9c102_disconnect); |
1476 | return err; | 1476 | return err; |
@@ -1600,12 +1600,12 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
1600 | return -EAGAIN; | 1600 | return -EAGAIN; |
1601 | } | 1601 | } |
1602 | timeout = wait_event_interruptible_timeout | 1602 | timeout = wait_event_interruptible_timeout |
1603 | ( cam->wait_frame, | 1603 | ( cam->wait_frame, |
1604 | (!list_empty(&cam->outqueue)) || | 1604 | (!list_empty(&cam->outqueue)) || |
1605 | (cam->state & DEV_DISCONNECTED) || | 1605 | (cam->state & DEV_DISCONNECTED) || |
1606 | (cam->state & DEV_MISCONFIGURED), | 1606 | (cam->state & DEV_MISCONFIGURED), |
1607 | cam->module_param.frame_timeout * | 1607 | cam->module_param.frame_timeout * |
1608 | 1000 * msecs_to_jiffies(1) ); | 1608 | 1000 * msecs_to_jiffies(1) ); |
1609 | if (timeout < 0) { | 1609 | if (timeout < 0) { |
1610 | mutex_unlock(&cam->fileop_mutex); | 1610 | mutex_unlock(&cam->fileop_mutex); |
1611 | return timeout; | 1611 | return timeout; |
@@ -1672,7 +1672,7 @@ static unsigned int sn9c102_poll(struct file *filp, poll_table *wait) | |||
1672 | 1672 | ||
1673 | if (cam->io == IO_NONE) { | 1673 | if (cam->io == IO_NONE) { |
1674 | if (!sn9c102_request_buffers(cam, cam->nreadbuffers, | 1674 | if (!sn9c102_request_buffers(cam, cam->nreadbuffers, |
1675 | IO_READ)) { | 1675 | IO_READ)) { |
1676 | DBG(1, "poll() failed, not enough memory"); | 1676 | DBG(1, "poll() failed, not enough memory"); |
1677 | goto error; | 1677 | goto error; |
1678 | } | 1678 | } |
@@ -1729,7 +1729,7 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) | |||
1729 | { | 1729 | { |
1730 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | 1730 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); |
1731 | unsigned long size = vma->vm_end - vma->vm_start, | 1731 | unsigned long size = vma->vm_end - vma->vm_start, |
1732 | start = vma->vm_start; | 1732 | start = vma->vm_start; |
1733 | void *pos; | 1733 | void *pos; |
1734 | u32 i; | 1734 | u32 i; |
1735 | 1735 | ||
@@ -1797,13 +1797,13 @@ sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg) | |||
1797 | .driver = "sn9c102", | 1797 | .driver = "sn9c102", |
1798 | .version = SN9C102_MODULE_VERSION_CODE, | 1798 | .version = SN9C102_MODULE_VERSION_CODE, |
1799 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | | 1799 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
1800 | V4L2_CAP_STREAMING, | 1800 | V4L2_CAP_STREAMING, |
1801 | }; | 1801 | }; |
1802 | 1802 | ||
1803 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); | 1803 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); |
1804 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) | 1804 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) |
1805 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, | 1805 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, |
1806 | sizeof(cap.bus_info)); | 1806 | sizeof(cap.bus_info)); |
1807 | 1807 | ||
1808 | if (copy_to_user(arg, &cap, sizeof(cap))) | 1808 | if (copy_to_user(arg, &cap, sizeof(cap))) |
1809 | return -EFAULT; | 1809 | return -EFAULT; |
@@ -2138,7 +2138,7 @@ sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) | |||
2138 | return -EINVAL; | 2138 | return -EINVAL; |
2139 | 2139 | ||
2140 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X) | 2140 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X) |
2141 | ? 0 : (pfmt->width * pfmt->priv) / 8; | 2141 | ? 0 : (pfmt->width * pfmt->priv) / 8; |
2142 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); | 2142 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); |
2143 | pfmt->field = V4L2_FIELD_NONE; | 2143 | pfmt->field = V4L2_FIELD_NONE; |
2144 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); | 2144 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); |
@@ -2152,7 +2152,7 @@ sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) | |||
2152 | 2152 | ||
2153 | static int | 2153 | static int |
2154 | sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, | 2154 | sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, |
2155 | void __user * arg) | 2155 | void __user * arg) |
2156 | { | 2156 | { |
2157 | struct sn9c102_sensor* s = &cam->sensor; | 2157 | struct sn9c102_sensor* s = &cam->sensor; |
2158 | struct v4l2_format format; | 2158 | struct v4l2_format format; |
@@ -2214,7 +2214,7 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, | |||
2214 | pix->priv = pfmt->priv; /* bpp */ | 2214 | pix->priv = pfmt->priv; /* bpp */ |
2215 | pix->colorspace = pfmt->colorspace; | 2215 | pix->colorspace = pfmt->colorspace; |
2216 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) | 2216 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) |
2217 | ? 0 : (pix->width * pix->priv) / 8; | 2217 | ? 0 : (pix->width * pix->priv) / 8; |
2218 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); | 2218 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); |
2219 | pix->field = V4L2_FIELD_NONE; | 2219 | pix->field = V4L2_FIELD_NONE; |
2220 | 2220 | ||
@@ -2287,7 +2287,7 @@ static int | |||
2287 | sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) | 2287 | sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) |
2288 | { | 2288 | { |
2289 | if (copy_to_user(arg, &cam->compression, | 2289 | if (copy_to_user(arg, &cam->compression, |
2290 | sizeof(cam->compression))) | 2290 | sizeof(cam->compression))) |
2291 | return -EFAULT; | 2291 | return -EFAULT; |
2292 | 2292 | ||
2293 | return 0; | 2293 | return 0; |
@@ -2436,7 +2436,7 @@ sn9c102_vidioc_qbuf(struct sn9c102_device* cam, void __user * arg) | |||
2436 | 2436 | ||
2437 | static int | 2437 | static int |
2438 | sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, | 2438 | sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, |
2439 | void __user * arg) | 2439 | void __user * arg) |
2440 | { | 2440 | { |
2441 | struct v4l2_buffer b; | 2441 | struct v4l2_buffer b; |
2442 | struct sn9c102_frame_t *f; | 2442 | struct sn9c102_frame_t *f; |
@@ -2455,12 +2455,12 @@ sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, | |||
2455 | if (filp->f_flags & O_NONBLOCK) | 2455 | if (filp->f_flags & O_NONBLOCK) |
2456 | return -EAGAIN; | 2456 | return -EAGAIN; |
2457 | timeout = wait_event_interruptible_timeout | 2457 | timeout = wait_event_interruptible_timeout |
2458 | ( cam->wait_frame, | 2458 | ( cam->wait_frame, |
2459 | (!list_empty(&cam->outqueue)) || | 2459 | (!list_empty(&cam->outqueue)) || |
2460 | (cam->state & DEV_DISCONNECTED) || | 2460 | (cam->state & DEV_DISCONNECTED) || |
2461 | (cam->state & DEV_MISCONFIGURED), | 2461 | (cam->state & DEV_MISCONFIGURED), |
2462 | cam->module_param.frame_timeout * | 2462 | cam->module_param.frame_timeout * |
2463 | 1000 * msecs_to_jiffies(1) ); | 2463 | 1000 * msecs_to_jiffies(1) ); |
2464 | if (timeout < 0) | 2464 | if (timeout < 0) |
2465 | return timeout; | 2465 | return timeout; |
2466 | if (cam->state & DEV_DISCONNECTED) | 2466 | if (cam->state & DEV_DISCONNECTED) |
@@ -2584,7 +2584,7 @@ sn9c102_vidioc_s_parm(struct sn9c102_device* cam, void __user * arg) | |||
2584 | 2584 | ||
2585 | 2585 | ||
2586 | static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, | 2586 | static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, |
2587 | unsigned int cmd, void __user * arg) | 2587 | unsigned int cmd, void __user * arg) |
2588 | { | 2588 | { |
2589 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | 2589 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); |
2590 | 2590 | ||
@@ -2678,7 +2678,7 @@ static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, | |||
2678 | 2678 | ||
2679 | 2679 | ||
2680 | static int sn9c102_ioctl(struct inode* inode, struct file* filp, | 2680 | static int sn9c102_ioctl(struct inode* inode, struct file* filp, |
2681 | unsigned int cmd, unsigned long arg) | 2681 | unsigned int cmd, unsigned long arg) |
2682 | { | 2682 | { |
2683 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | 2683 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); |
2684 | int err = 0; | 2684 | int err = 0; |
@@ -2761,7 +2761,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2761 | } | 2761 | } |
2762 | 2762 | ||
2763 | cam->bridge = (id->idProduct & 0xffc0) == 0x6080 ? | 2763 | cam->bridge = (id->idProduct & 0xffc0) == 0x6080 ? |
2764 | BRIDGE_SN9C103 : BRIDGE_SN9C102; | 2764 | BRIDGE_SN9C103 : BRIDGE_SN9C102; |
2765 | switch (cam->bridge) { | 2765 | switch (cam->bridge) { |
2766 | case BRIDGE_SN9C101: | 2766 | case BRIDGE_SN9C101: |
2767 | case BRIDGE_SN9C102: | 2767 | case BRIDGE_SN9C102: |
@@ -2807,7 +2807,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2807 | mutex_lock(&cam->dev_mutex); | 2807 | mutex_lock(&cam->dev_mutex); |
2808 | 2808 | ||
2809 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 2809 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
2810 | video_nr[dev_nr]); | 2810 | video_nr[dev_nr]); |
2811 | if (err) { | 2811 | if (err) { |
2812 | DBG(1, "V4L2 device registration failed"); | 2812 | DBG(1, "V4L2 device registration failed"); |
2813 | if (err == -ENFILE && video_nr[dev_nr] == -1) | 2813 | if (err == -ENFILE && video_nr[dev_nr] == -1) |
diff --git a/drivers/usb/media/sn9c102_hv7131d.c b/drivers/media/video/sn9c102/sn9c102_hv7131d.c index 46c12ec3ca62..c4117bf64b69 100644 --- a/drivers/usb/media/sn9c102_hv7131d.c +++ b/drivers/media/video/sn9c102/sn9c102_hv7131d.c | |||
@@ -44,8 +44,8 @@ static int hv7131d_init(struct sn9c102_device* cam) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | static int hv7131d_get_ctrl(struct sn9c102_device* cam, | 47 | static int hv7131d_get_ctrl(struct sn9c102_device* cam, |
48 | struct v4l2_control* ctrl) | 48 | struct v4l2_control* ctrl) |
49 | { | 49 | { |
50 | switch (ctrl->id) { | 50 | switch (ctrl->id) { |
51 | case V4L2_CID_EXPOSURE: | 51 | case V4L2_CID_EXPOSURE: |
@@ -88,8 +88,8 @@ static int hv7131d_get_ctrl(struct sn9c102_device* cam, | |||
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | static int hv7131d_set_ctrl(struct sn9c102_device* cam, | 91 | static int hv7131d_set_ctrl(struct sn9c102_device* cam, |
92 | const struct v4l2_control* ctrl) | 92 | const struct v4l2_control* ctrl) |
93 | { | 93 | { |
94 | int err = 0; | 94 | int err = 0; |
95 | 95 | ||
@@ -121,8 +121,8 @@ static int hv7131d_set_ctrl(struct sn9c102_device* cam, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | static int hv7131d_set_crop(struct sn9c102_device* cam, | 124 | static int hv7131d_set_crop(struct sn9c102_device* cam, |
125 | const struct v4l2_rect* rect) | 125 | const struct v4l2_rect* rect) |
126 | { | 126 | { |
127 | struct sn9c102_sensor* s = &hv7131d; | 127 | struct sn9c102_sensor* s = &hv7131d; |
128 | int err = 0; | 128 | int err = 0; |
@@ -136,8 +136,8 @@ static int hv7131d_set_crop(struct sn9c102_device* cam, | |||
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | static int hv7131d_set_pix_format(struct sn9c102_device* cam, | 139 | static int hv7131d_set_pix_format(struct sn9c102_device* cam, |
140 | const struct v4l2_pix_format* pix) | 140 | const struct v4l2_pix_format* pix) |
141 | { | 141 | { |
142 | int err = 0; | 142 | int err = 0; |
143 | 143 | ||
diff --git a/drivers/usb/media/sn9c102_mi0343.c b/drivers/media/video/sn9c102/sn9c102_mi0343.c index d9aa7a61095d..4169ea4a2e20 100644 --- a/drivers/usb/media/sn9c102_mi0343.c +++ b/drivers/media/video/sn9c102/sn9c102_mi0343.c | |||
@@ -39,64 +39,64 @@ static int mi0343_init(struct sn9c102_device* cam) | |||
39 | err += sn9c102_write_reg(cam, 0xa0, 0x19); | 39 | err += sn9c102_write_reg(cam, 0xa0, 0x19); |
40 | 40 | ||
41 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 41 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
42 | 0x0d, 0x00, 0x01, 0, 0); | 42 | 0x0d, 0x00, 0x01, 0, 0); |
43 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 43 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
44 | 0x0d, 0x00, 0x00, 0, 0); | 44 | 0x0d, 0x00, 0x00, 0, 0); |
45 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 45 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
46 | 0x03, 0x01, 0xe1, 0, 0); | 46 | 0x03, 0x01, 0xe1, 0, 0); |
47 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 47 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
48 | 0x04, 0x02, 0x81, 0, 0); | 48 | 0x04, 0x02, 0x81, 0, 0); |
49 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 49 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
50 | 0x05, 0x00, 0x17, 0, 0); | 50 | 0x05, 0x00, 0x17, 0, 0); |
51 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 51 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
52 | 0x06, 0x00, 0x11, 0, 0); | 52 | 0x06, 0x00, 0x11, 0, 0); |
53 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 53 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
54 | 0x62, 0x04, 0x9a, 0, 0); | 54 | 0x62, 0x04, 0x9a, 0, 0); |
55 | 55 | ||
56 | return err; | 56 | return err; |
57 | } | 57 | } |
58 | 58 | ||
59 | 59 | ||
60 | static int mi0343_get_ctrl(struct sn9c102_device* cam, | 60 | static int mi0343_get_ctrl(struct sn9c102_device* cam, |
61 | struct v4l2_control* ctrl) | 61 | struct v4l2_control* ctrl) |
62 | { | 62 | { |
63 | switch (ctrl->id) { | 63 | switch (ctrl->id) { |
64 | case V4L2_CID_EXPOSURE: | 64 | case V4L2_CID_EXPOSURE: |
65 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 65 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
66 | 0x09, 2+1, mi0343_i2c_data) < 0) | 66 | 0x09, 2+1, mi0343_i2c_data) < 0) |
67 | return -EIO; | 67 | return -EIO; |
68 | ctrl->value = mi0343_i2c_data[2]; | 68 | ctrl->value = mi0343_i2c_data[2]; |
69 | return 0; | 69 | return 0; |
70 | case V4L2_CID_GAIN: | 70 | case V4L2_CID_GAIN: |
71 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 71 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
72 | 0x35, 2+1, mi0343_i2c_data) < 0) | 72 | 0x35, 2+1, mi0343_i2c_data) < 0) |
73 | return -EIO; | 73 | return -EIO; |
74 | break; | 74 | break; |
75 | case V4L2_CID_HFLIP: | 75 | case V4L2_CID_HFLIP: |
76 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 76 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
77 | 0x20, 2+1, mi0343_i2c_data) < 0) | 77 | 0x20, 2+1, mi0343_i2c_data) < 0) |
78 | return -EIO; | 78 | return -EIO; |
79 | ctrl->value = mi0343_i2c_data[3] & 0x20 ? 1 : 0; | 79 | ctrl->value = mi0343_i2c_data[3] & 0x20 ? 1 : 0; |
80 | return 0; | 80 | return 0; |
81 | case V4L2_CID_VFLIP: | 81 | case V4L2_CID_VFLIP: |
82 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 82 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
83 | 0x20, 2+1, mi0343_i2c_data) < 0) | 83 | 0x20, 2+1, mi0343_i2c_data) < 0) |
84 | return -EIO; | 84 | return -EIO; |
85 | ctrl->value = mi0343_i2c_data[3] & 0x80 ? 1 : 0; | 85 | ctrl->value = mi0343_i2c_data[3] & 0x80 ? 1 : 0; |
86 | return 0; | 86 | return 0; |
87 | case V4L2_CID_RED_BALANCE: | 87 | case V4L2_CID_RED_BALANCE: |
88 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 88 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
89 | 0x2d, 2+1, mi0343_i2c_data) < 0) | 89 | 0x2d, 2+1, mi0343_i2c_data) < 0) |
90 | return -EIO; | 90 | return -EIO; |
91 | break; | 91 | break; |
92 | case V4L2_CID_BLUE_BALANCE: | 92 | case V4L2_CID_BLUE_BALANCE: |
93 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 93 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
94 | 0x2c, 2+1, mi0343_i2c_data) < 0) | 94 | 0x2c, 2+1, mi0343_i2c_data) < 0) |
95 | return -EIO; | 95 | return -EIO; |
96 | break; | 96 | break; |
97 | case SN9C102_V4L2_CID_GREEN_BALANCE: | 97 | case SN9C102_V4L2_CID_GREEN_BALANCE: |
98 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 98 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
99 | 0x2e, 2+1, mi0343_i2c_data) < 0) | 99 | 0x2e, 2+1, mi0343_i2c_data) < 0) |
100 | return -EIO; | 100 | return -EIO; |
101 | break; | 101 | break; |
102 | default: | 102 | default: |
@@ -121,8 +121,8 @@ static int mi0343_get_ctrl(struct sn9c102_device* cam, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | static int mi0343_set_ctrl(struct sn9c102_device* cam, | 124 | static int mi0343_set_ctrl(struct sn9c102_device* cam, |
125 | const struct v4l2_control* ctrl) | 125 | const struct v4l2_control* ctrl) |
126 | { | 126 | { |
127 | u16 reg = 0; | 127 | u16 reg = 0; |
128 | int err = 0; | 128 | int err = 0; |
@@ -144,51 +144,51 @@ static int mi0343_set_ctrl(struct sn9c102_device* cam, | |||
144 | switch (ctrl->id) { | 144 | switch (ctrl->id) { |
145 | case V4L2_CID_EXPOSURE: | 145 | case V4L2_CID_EXPOSURE: |
146 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 146 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
147 | mi0343.i2c_slave_id, | 147 | mi0343.i2c_slave_id, |
148 | 0x09, ctrl->value, 0x00, | 148 | 0x09, ctrl->value, 0x00, |
149 | 0, 0); | 149 | 0, 0); |
150 | break; | 150 | break; |
151 | case V4L2_CID_GAIN: | 151 | case V4L2_CID_GAIN: |
152 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 152 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
153 | mi0343.i2c_slave_id, | 153 | mi0343.i2c_slave_id, |
154 | 0x35, reg >> 8, reg & 0xff, | 154 | 0x35, reg >> 8, reg & 0xff, |
155 | 0, 0); | 155 | 0, 0); |
156 | break; | 156 | break; |
157 | case V4L2_CID_HFLIP: | 157 | case V4L2_CID_HFLIP: |
158 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 158 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
159 | mi0343.i2c_slave_id, | 159 | mi0343.i2c_slave_id, |
160 | 0x20, ctrl->value ? 0x40:0x00, | 160 | 0x20, ctrl->value ? 0x40:0x00, |
161 | ctrl->value ? 0x20:0x00, | 161 | ctrl->value ? 0x20:0x00, |
162 | 0, 0); | 162 | 0, 0); |
163 | break; | 163 | break; |
164 | case V4L2_CID_VFLIP: | 164 | case V4L2_CID_VFLIP: |
165 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 165 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
166 | mi0343.i2c_slave_id, | 166 | mi0343.i2c_slave_id, |
167 | 0x20, ctrl->value ? 0x80:0x00, | 167 | 0x20, ctrl->value ? 0x80:0x00, |
168 | ctrl->value ? 0x80:0x00, | 168 | ctrl->value ? 0x80:0x00, |
169 | 0, 0); | 169 | 0, 0); |
170 | break; | 170 | break; |
171 | case V4L2_CID_RED_BALANCE: | 171 | case V4L2_CID_RED_BALANCE: |
172 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 172 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
173 | mi0343.i2c_slave_id, | 173 | mi0343.i2c_slave_id, |
174 | 0x2d, reg >> 8, reg & 0xff, | 174 | 0x2d, reg >> 8, reg & 0xff, |
175 | 0, 0); | 175 | 0, 0); |
176 | break; | 176 | break; |
177 | case V4L2_CID_BLUE_BALANCE: | 177 | case V4L2_CID_BLUE_BALANCE: |
178 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 178 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
179 | mi0343.i2c_slave_id, | 179 | mi0343.i2c_slave_id, |
180 | 0x2c, reg >> 8, reg & 0xff, | 180 | 0x2c, reg >> 8, reg & 0xff, |
181 | 0, 0); | 181 | 0, 0); |
182 | break; | 182 | break; |
183 | case SN9C102_V4L2_CID_GREEN_BALANCE: | 183 | case SN9C102_V4L2_CID_GREEN_BALANCE: |
184 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 184 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
185 | mi0343.i2c_slave_id, | 185 | mi0343.i2c_slave_id, |
186 | 0x2b, reg >> 8, reg & 0xff, | 186 | 0x2b, reg >> 8, reg & 0xff, |
187 | 0, 0); | 187 | 0, 0); |
188 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 188 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
189 | mi0343.i2c_slave_id, | 189 | mi0343.i2c_slave_id, |
190 | 0x2e, reg >> 8, reg & 0xff, | 190 | 0x2e, reg >> 8, reg & 0xff, |
191 | 0, 0); | 191 | 0, 0); |
192 | break; | 192 | break; |
193 | default: | 193 | default: |
194 | return -EINVAL; | 194 | return -EINVAL; |
@@ -198,8 +198,8 @@ static int mi0343_set_ctrl(struct sn9c102_device* cam, | |||
198 | } | 198 | } |
199 | 199 | ||
200 | 200 | ||
201 | static int mi0343_set_crop(struct sn9c102_device* cam, | 201 | static int mi0343_set_crop(struct sn9c102_device* cam, |
202 | const struct v4l2_rect* rect) | 202 | const struct v4l2_rect* rect) |
203 | { | 203 | { |
204 | struct sn9c102_sensor* s = &mi0343; | 204 | struct sn9c102_sensor* s = &mi0343; |
205 | int err = 0; | 205 | int err = 0; |
@@ -213,20 +213,20 @@ static int mi0343_set_crop(struct sn9c102_device* cam, | |||
213 | } | 213 | } |
214 | 214 | ||
215 | 215 | ||
216 | static int mi0343_set_pix_format(struct sn9c102_device* cam, | 216 | static int mi0343_set_pix_format(struct sn9c102_device* cam, |
217 | const struct v4l2_pix_format* pix) | 217 | const struct v4l2_pix_format* pix) |
218 | { | 218 | { |
219 | int err = 0; | 219 | int err = 0; |
220 | 220 | ||
221 | if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) { | 221 | if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) { |
222 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 222 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
223 | mi0343.i2c_slave_id, | 223 | mi0343.i2c_slave_id, |
224 | 0x0a, 0x00, 0x03, 0, 0); | 224 | 0x0a, 0x00, 0x03, 0, 0); |
225 | err += sn9c102_write_reg(cam, 0x20, 0x19); | 225 | err += sn9c102_write_reg(cam, 0x20, 0x19); |
226 | } else { | 226 | } else { |
227 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 227 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
228 | mi0343.i2c_slave_id, | 228 | mi0343.i2c_slave_id, |
229 | 0x0a, 0x00, 0x05, 0, 0); | 229 | 0x0a, 0x00, 0x05, 0, 0); |
230 | err += sn9c102_write_reg(cam, 0xa0, 0x19); | 230 | err += sn9c102_write_reg(cam, 0xa0, 0x19); |
231 | } | 231 | } |
232 | 232 | ||
@@ -351,7 +351,7 @@ int sn9c102_probe_mi0343(struct sn9c102_device* cam) | |||
351 | return -EIO; | 351 | return -EIO; |
352 | 352 | ||
353 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, 0x00, | 353 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, 0x00, |
354 | 2, mi0343_i2c_data) < 0) | 354 | 2, mi0343_i2c_data) < 0) |
355 | return -EIO; | 355 | return -EIO; |
356 | 356 | ||
357 | if (mi0343_i2c_data[4] != 0x32 && mi0343_i2c_data[3] != 0xe3) | 357 | if (mi0343_i2c_data[4] != 0x32 && mi0343_i2c_data[3] != 0xe3) |
diff --git a/drivers/usb/media/sn9c102_ov7630.c b/drivers/media/video/sn9c102/sn9c102_ov7630.c index 42852b7cb042..3da042021787 100644 --- a/drivers/usb/media/sn9c102_ov7630.c +++ b/drivers/media/video/sn9c102/sn9c102_ov7630.c | |||
@@ -69,7 +69,7 @@ static int ov7630_init(struct sn9c102_device* cam) | |||
69 | 69 | ||
70 | 70 | ||
71 | static int ov7630_set_ctrl(struct sn9c102_device* cam, | 71 | static int ov7630_set_ctrl(struct sn9c102_device* cam, |
72 | const struct v4l2_control* ctrl) | 72 | const struct v4l2_control* ctrl) |
73 | { | 73 | { |
74 | int err = 0; | 74 | int err = 0; |
75 | 75 | ||
@@ -89,8 +89,8 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, | |||
89 | break; | 89 | break; |
90 | case V4L2_CID_CONTRAST: | 90 | case V4L2_CID_CONTRAST: |
91 | err += ctrl->value ? sn9c102_i2c_write(cam, 0x05, | 91 | err += ctrl->value ? sn9c102_i2c_write(cam, 0x05, |
92 | (ctrl->value-1) | 0x20) | 92 | (ctrl->value-1) | 0x20) |
93 | : sn9c102_i2c_write(cam, 0x05, 0x00); | 93 | : sn9c102_i2c_write(cam, 0x05, 0x00); |
94 | break; | 94 | break; |
95 | case V4L2_CID_BRIGHTNESS: | 95 | case V4L2_CID_BRIGHTNESS: |
96 | err += sn9c102_i2c_write(cam, 0x06, ctrl->value); | 96 | err += sn9c102_i2c_write(cam, 0x06, ctrl->value); |
@@ -100,8 +100,8 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, | |||
100 | break; | 100 | break; |
101 | case V4L2_CID_HUE: | 101 | case V4L2_CID_HUE: |
102 | err += ctrl->value ? sn9c102_i2c_write(cam, 0x04, | 102 | err += ctrl->value ? sn9c102_i2c_write(cam, 0x04, |
103 | (ctrl->value-1) | 0x20) | 103 | (ctrl->value-1) | 0x20) |
104 | : sn9c102_i2c_write(cam, 0x04, 0x00); | 104 | : sn9c102_i2c_write(cam, 0x04, 0x00); |
105 | break; | 105 | break; |
106 | case V4L2_CID_DO_WHITE_BALANCE: | 106 | case V4L2_CID_DO_WHITE_BALANCE: |
107 | err += sn9c102_i2c_write(cam, 0x0c, ctrl->value); | 107 | err += sn9c102_i2c_write(cam, 0x0c, ctrl->value); |
@@ -139,7 +139,7 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, | |||
139 | 139 | ||
140 | 140 | ||
141 | static int ov7630_set_crop(struct sn9c102_device* cam, | 141 | static int ov7630_set_crop(struct sn9c102_device* cam, |
142 | const struct v4l2_rect* rect) | 142 | const struct v4l2_rect* rect) |
143 | { | 143 | { |
144 | struct sn9c102_sensor* s = &ov7630; | 144 | struct sn9c102_sensor* s = &ov7630; |
145 | int err = 0; | 145 | int err = 0; |
@@ -152,7 +152,7 @@ static int ov7630_set_crop(struct sn9c102_device* cam, | |||
152 | 152 | ||
153 | 153 | ||
154 | static int ov7630_set_pix_format(struct sn9c102_device* cam, | 154 | static int ov7630_set_pix_format(struct sn9c102_device* cam, |
155 | const struct v4l2_pix_format* pix) | 155 | const struct v4l2_pix_format* pix) |
156 | { | 156 | { |
157 | int err = 0; | 157 | int err = 0; |
158 | 158 | ||
diff --git a/drivers/usb/media/sn9c102_pas106b.c b/drivers/media/video/sn9c102/sn9c102_pas106b.c index b1dee78abe04..9915944235e8 100644 --- a/drivers/usb/media/sn9c102_pas106b.c +++ b/drivers/media/video/sn9c102/sn9c102_pas106b.c | |||
@@ -53,8 +53,8 @@ static int pas106b_init(struct sn9c102_device* cam) | |||
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | static int pas106b_get_ctrl(struct sn9c102_device* cam, | 56 | static int pas106b_get_ctrl(struct sn9c102_device* cam, |
57 | struct v4l2_control* ctrl) | 57 | struct v4l2_control* ctrl) |
58 | { | 58 | { |
59 | switch (ctrl->id) { | 59 | switch (ctrl->id) { |
60 | case V4L2_CID_EXPOSURE: | 60 | case V4L2_CID_EXPOSURE: |
@@ -102,8 +102,8 @@ static int pas106b_get_ctrl(struct sn9c102_device* cam, | |||
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | static int pas106b_set_ctrl(struct sn9c102_device* cam, | 105 | static int pas106b_set_ctrl(struct sn9c102_device* cam, |
106 | const struct v4l2_control* ctrl) | 106 | const struct v4l2_control* ctrl) |
107 | { | 107 | { |
108 | int err = 0; | 108 | int err = 0; |
109 | 109 | ||
@@ -140,8 +140,8 @@ static int pas106b_set_ctrl(struct sn9c102_device* cam, | |||
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||
143 | static int pas106b_set_crop(struct sn9c102_device* cam, | 143 | static int pas106b_set_crop(struct sn9c102_device* cam, |
144 | const struct v4l2_rect* rect) | 144 | const struct v4l2_rect* rect) |
145 | { | 145 | { |
146 | struct sn9c102_sensor* s = &pas106b; | 146 | struct sn9c102_sensor* s = &pas106b; |
147 | int err = 0; | 147 | int err = 0; |
@@ -155,8 +155,8 @@ static int pas106b_set_crop(struct sn9c102_device* cam, | |||
155 | } | 155 | } |
156 | 156 | ||
157 | 157 | ||
158 | static int pas106b_set_pix_format(struct sn9c102_device* cam, | 158 | static int pas106b_set_pix_format(struct sn9c102_device* cam, |
159 | const struct v4l2_pix_format* pix) | 159 | const struct v4l2_pix_format* pix) |
160 | { | 160 | { |
161 | int err = 0; | 161 | int err = 0; |
162 | 162 | ||
diff --git a/drivers/usb/media/sn9c102_pas202bca.c b/drivers/media/video/sn9c102/sn9c102_pas202bca.c index 3453237055bb..c8f1ae2152b8 100644 --- a/drivers/usb/media/sn9c102_pas202bca.c +++ b/drivers/media/video/sn9c102/sn9c102_pas202bca.c | |||
@@ -54,7 +54,7 @@ static int pas202bca_init(struct sn9c102_device* cam) | |||
54 | 54 | ||
55 | 55 | ||
56 | static int pas202bca_set_pix_format(struct sn9c102_device* cam, | 56 | static int pas202bca_set_pix_format(struct sn9c102_device* cam, |
57 | const struct v4l2_pix_format* pix) | 57 | const struct v4l2_pix_format* pix) |
58 | { | 58 | { |
59 | int err = 0; | 59 | int err = 0; |
60 | 60 | ||
@@ -68,7 +68,7 @@ static int pas202bca_set_pix_format(struct sn9c102_device* cam, | |||
68 | 68 | ||
69 | 69 | ||
70 | static int pas202bca_set_ctrl(struct sn9c102_device* cam, | 70 | static int pas202bca_set_ctrl(struct sn9c102_device* cam, |
71 | const struct v4l2_control* ctrl) | 71 | const struct v4l2_control* ctrl) |
72 | { | 72 | { |
73 | int err = 0; | 73 | int err = 0; |
74 | 74 | ||
@@ -102,7 +102,7 @@ static int pas202bca_set_ctrl(struct sn9c102_device* cam, | |||
102 | 102 | ||
103 | 103 | ||
104 | static int pas202bca_set_crop(struct sn9c102_device* cam, | 104 | static int pas202bca_set_crop(struct sn9c102_device* cam, |
105 | const struct v4l2_rect* rect) | 105 | const struct v4l2_rect* rect) |
106 | { | 106 | { |
107 | struct sn9c102_sensor* s = &pas202bca; | 107 | struct sn9c102_sensor* s = &pas202bca; |
108 | int err = 0; | 108 | int err = 0; |
diff --git a/drivers/usb/media/sn9c102_pas202bcb.c b/drivers/media/video/sn9c102/sn9c102_pas202bcb.c index d068616ab337..e3c1178e339c 100644 --- a/drivers/usb/media/sn9c102_pas202bcb.c +++ b/drivers/media/video/sn9c102/sn9c102_pas202bcb.c | |||
@@ -58,8 +58,8 @@ static int pas202bcb_init(struct sn9c102_device* cam) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | static int pas202bcb_get_ctrl(struct sn9c102_device* cam, | 61 | static int pas202bcb_get_ctrl(struct sn9c102_device* cam, |
62 | struct v4l2_control* ctrl) | 62 | struct v4l2_control* ctrl) |
63 | { | 63 | { |
64 | switch (ctrl->id) { | 64 | switch (ctrl->id) { |
65 | case V4L2_CID_EXPOSURE: | 65 | case V4L2_CID_EXPOSURE: |
@@ -101,8 +101,8 @@ static int pas202bcb_get_ctrl(struct sn9c102_device* cam, | |||
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | static int pas202bcb_set_pix_format(struct sn9c102_device* cam, | 104 | static int pas202bcb_set_pix_format(struct sn9c102_device* cam, |
105 | const struct v4l2_pix_format* pix) | 105 | const struct v4l2_pix_format* pix) |
106 | { | 106 | { |
107 | int err = 0; | 107 | int err = 0; |
108 | 108 | ||
@@ -115,8 +115,8 @@ static int pas202bcb_set_pix_format(struct sn9c102_device* cam, | |||
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | static int pas202bcb_set_ctrl(struct sn9c102_device* cam, | 118 | static int pas202bcb_set_ctrl(struct sn9c102_device* cam, |
119 | const struct v4l2_control* ctrl) | 119 | const struct v4l2_control* ctrl) |
120 | { | 120 | { |
121 | int err = 0; | 121 | int err = 0; |
122 | 122 | ||
@@ -149,8 +149,8 @@ static int pas202bcb_set_ctrl(struct sn9c102_device* cam, | |||
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | static int pas202bcb_set_crop(struct sn9c102_device* cam, | 152 | static int pas202bcb_set_crop(struct sn9c102_device* cam, |
153 | const struct v4l2_rect* rect) | 153 | const struct v4l2_rect* rect) |
154 | { | 154 | { |
155 | struct sn9c102_sensor* s = &pas202bcb; | 155 | struct sn9c102_sensor* s = &pas202bcb; |
156 | int err = 0; | 156 | int err = 0; |
@@ -167,7 +167,7 @@ static int pas202bcb_set_crop(struct sn9c102_device* cam, | |||
167 | static struct sn9c102_sensor pas202bcb = { | 167 | static struct sn9c102_sensor pas202bcb = { |
168 | .name = "PAS202BCB", | 168 | .name = "PAS202BCB", |
169 | .maintainer = "Carlos Eduardo Medaglia Dyonisio " | 169 | .maintainer = "Carlos Eduardo Medaglia Dyonisio " |
170 | "<medaglia@undl.org.br>", | 170 | "<medaglia@undl.org.br>", |
171 | .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE, | 171 | .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE, |
172 | .frequency = SN9C102_I2C_400KHZ | SN9C102_I2C_100KHZ, | 172 | .frequency = SN9C102_I2C_400KHZ | SN9C102_I2C_100KHZ, |
173 | .interface = SN9C102_I2C_2WIRES, | 173 | .interface = SN9C102_I2C_2WIRES, |
diff --git a/drivers/usb/media/sn9c102_sensor.h b/drivers/media/video/sn9c102/sn9c102_sensor.h index 2afd9e9d09bb..2a874ee6f9f5 100644 --- a/drivers/usb/media/sn9c102_sensor.h +++ b/drivers/media/video/sn9c102/sn9c102_sensor.h | |||
@@ -58,7 +58,7 @@ struct sn9c102_sensor; | |||
58 | Probing functions: on success, you must attach the sensor to the camera | 58 | Probing functions: on success, you must attach the sensor to the camera |
59 | by calling sn9c102_attach_sensor() provided below. | 59 | by calling sn9c102_attach_sensor() provided below. |
60 | To enable the I2C communication, you might need to perform a really basic | 60 | To enable the I2C communication, you might need to perform a really basic |
61 | initialization of the SN9C10X chip by using the write function declared | 61 | initialization of the SN9C10X chip by using the write function declared |
62 | ahead. | 62 | ahead. |
63 | Functions must return 0 on success, the appropriate error otherwise. | 63 | Functions must return 0 on success, the appropriate error otherwise. |
64 | */ | 64 | */ |
@@ -73,7 +73,7 @@ extern int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam); | |||
73 | 73 | ||
74 | /* | 74 | /* |
75 | Add the above entries to this table. Be sure to add the entry in the right | 75 | Add the above entries to this table. Be sure to add the entry in the right |
76 | place, since, on failure, the next probing routine is called according to | 76 | place, since, on failure, the next probing routine is called according to |
77 | the order of the list below, from top to bottom. | 77 | the order of the list below, from top to bottom. |
78 | */ | 78 | */ |
79 | #define SN9C102_SENSOR_TABLE \ | 79 | #define SN9C102_SENSOR_TABLE \ |
@@ -94,9 +94,9 @@ extern struct sn9c102_device* | |||
94 | sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id); | 94 | sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id); |
95 | 95 | ||
96 | /* Attach a probed sensor to the camera. */ | 96 | /* Attach a probed sensor to the camera. */ |
97 | extern void | 97 | extern void |
98 | sn9c102_attach_sensor(struct sn9c102_device* cam, | 98 | sn9c102_attach_sensor(struct sn9c102_device* cam, |
99 | struct sn9c102_sensor* sensor); | 99 | struct sn9c102_sensor* sensor); |
100 | 100 | ||
101 | /* | 101 | /* |
102 | Each SN9C10x camera has proper PID/VID identifiers. | 102 | Each SN9C10x camera has proper PID/VID identifiers. |
@@ -105,7 +105,7 @@ sn9c102_attach_sensor(struct sn9c102_device* cam, | |||
105 | */ | 105 | */ |
106 | #define SN9C102_USB_DEVICE(vend, prod, intclass) \ | 106 | #define SN9C102_USB_DEVICE(vend, prod, intclass) \ |
107 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | 107 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ |
108 | USB_DEVICE_ID_MATCH_INT_CLASS, \ | 108 | USB_DEVICE_ID_MATCH_INT_CLASS, \ |
109 | .idVendor = (vend), \ | 109 | .idVendor = (vend), \ |
110 | .idProduct = (prod), \ | 110 | .idProduct = (prod), \ |
111 | .bInterfaceClass = (intclass) | 111 | .bInterfaceClass = (intclass) |
@@ -162,19 +162,19 @@ static const struct usb_device_id sn9c102_id_table[] = { \ | |||
162 | Read/write routines: they always return -1 on error, 0 or the read value | 162 | Read/write routines: they always return -1 on error, 0 or the read value |
163 | otherwise. NOTE that a real read operation is not supported by the SN9C10X | 163 | otherwise. NOTE that a real read operation is not supported by the SN9C10X |
164 | chip for some of its registers. To work around this problem, a pseudo-read | 164 | chip for some of its registers. To work around this problem, a pseudo-read |
165 | call is provided instead: it returns the last successfully written value | 165 | call is provided instead: it returns the last successfully written value |
166 | on the register (0 if it has never been written), the usual -1 on error. | 166 | on the register (0 if it has never been written), the usual -1 on error. |
167 | */ | 167 | */ |
168 | 168 | ||
169 | /* The "try" I2C I/O versions are used when probing the sensor */ | 169 | /* The "try" I2C I/O versions are used when probing the sensor */ |
170 | extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*, | 170 | extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*, |
171 | u8 address, u8 value); | 171 | u8 address, u8 value); |
172 | extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, | 172 | extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, |
173 | u8 address); | 173 | u8 address); |
174 | 174 | ||
175 | /* | 175 | /* |
176 | These must be used if and only if the sensor doesn't implement the standard | 176 | These must be used if and only if the sensor doesn't implement the standard |
177 | I2C protocol. There are a number of good reasons why you must use the | 177 | I2C protocol. There are a number of good reasons why you must use the |
178 | single-byte versions of these functions: do not abuse. The first function | 178 | single-byte versions of these functions: do not abuse. The first function |
179 | writes n bytes, from data0 to datan, to registers 0x09 - 0x09+n of SN9C10X | 179 | writes n bytes, from data0 to datan, to registers 0x09 - 0x09+n of SN9C10X |
180 | chip. The second one programs the registers 0x09 and 0x10 with data0 and | 180 | chip. The second one programs the registers 0x09 and 0x10 with data0 and |
@@ -184,12 +184,12 @@ extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, | |||
184 | byte. | 184 | byte. |
185 | */ | 185 | */ |
186 | extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | 186 | extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, |
187 | struct sn9c102_sensor* sensor, u8 n, | 187 | struct sn9c102_sensor* sensor, u8 n, |
188 | u8 data0, u8 data1, u8 data2, u8 data3, | 188 | u8 data0, u8 data1, u8 data2, u8 data3, |
189 | u8 data4, u8 data5); | 189 | u8 data4, u8 data5); |
190 | extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | 190 | extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, |
191 | struct sn9c102_sensor* sensor, u8 data0, | 191 | struct sn9c102_sensor* sensor, u8 data0, |
192 | u8 data1, u8 n, u8 buffer[]); | 192 | u8 data1, u8 n, u8 buffer[]); |
193 | 193 | ||
194 | /* To be used after the sensor struct has been attached to the camera struct */ | 194 | /* To be used after the sensor struct has been attached to the camera struct */ |
195 | extern int sn9c102_i2c_write(struct sn9c102_device*, u8 address, u8 value); | 195 | extern int sn9c102_i2c_write(struct sn9c102_device*, u8 address, u8 value); |
@@ -252,17 +252,17 @@ struct sn9c102_sensor { | |||
252 | 252 | ||
253 | /* | 253 | /* |
254 | NOTE: Where not noted,most of the functions below are not mandatory. | 254 | NOTE: Where not noted,most of the functions below are not mandatory. |
255 | Set to null if you do not implement them. If implemented, | 255 | Set to null if you do not implement them. If implemented, |
256 | they must return 0 on success, the proper error otherwise. | 256 | they must return 0 on success, the proper error otherwise. |
257 | */ | 257 | */ |
258 | 258 | ||
259 | int (*init)(struct sn9c102_device* cam); | 259 | int (*init)(struct sn9c102_device* cam); |
260 | /* | 260 | /* |
261 | This function will be called after the sensor has been attached. | 261 | This function will be called after the sensor has been attached. |
262 | It should be used to initialize the sensor only, but may also | 262 | It should be used to initialize the sensor only, but may also |
263 | configure part of the SN9C10X chip if necessary. You don't need to | 263 | configure part of the SN9C10X chip if necessary. You don't need to |
264 | setup picture settings like brightness, contrast, etc.. here, if | 264 | setup picture settings like brightness, contrast, etc.. here, if |
265 | the corrisponding controls are implemented (see below), since | 265 | the corrisponding controls are implemented (see below), since |
266 | they are adjusted in the core driver by calling the set_ctrl() | 266 | they are adjusted in the core driver by calling the set_ctrl() |
267 | method after init(), where the arguments are the default values | 267 | method after init(), where the arguments are the default values |
268 | specified in the v4l2_queryctrl list of supported controls; | 268 | specified in the v4l2_queryctrl list of supported controls; |
@@ -273,13 +273,13 @@ struct sn9c102_sensor { | |||
273 | 273 | ||
274 | struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS]; | 274 | struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS]; |
275 | /* | 275 | /* |
276 | Optional list of default controls, defined as indicated in the | 276 | Optional list of default controls, defined as indicated in the |
277 | V4L2 API. Menu type controls are not handled by this interface. | 277 | V4L2 API. Menu type controls are not handled by this interface. |
278 | */ | 278 | */ |
279 | 279 | ||
280 | int (*get_ctrl)(struct sn9c102_device* cam, struct v4l2_control* ctrl); | 280 | int (*get_ctrl)(struct sn9c102_device* cam, struct v4l2_control* ctrl); |
281 | int (*set_ctrl)(struct sn9c102_device* cam, | 281 | int (*set_ctrl)(struct sn9c102_device* cam, |
282 | const struct v4l2_control* ctrl); | 282 | const struct v4l2_control* ctrl); |
283 | /* | 283 | /* |
284 | You must implement at least the set_ctrl method if you have defined | 284 | You must implement at least the set_ctrl method if you have defined |
285 | the list above. The returned value must follow the V4L2 | 285 | the list above. The returned value must follow the V4L2 |
@@ -306,7 +306,7 @@ struct sn9c102_sensor { | |||
306 | specified in the cropcap substructures 'bounds' and 'defrect'. | 306 | specified in the cropcap substructures 'bounds' and 'defrect'. |
307 | By default, the source rectangle should cover the largest possible | 307 | By default, the source rectangle should cover the largest possible |
308 | area. Again, it is not always true that the largest source rectangle | 308 | area. Again, it is not always true that the largest source rectangle |
309 | can cover the entire active window, although it is a rare case for | 309 | can cover the entire active window, although it is a rare case for |
310 | the hardware we have. The bounds of the source rectangle _must_ be | 310 | the hardware we have. The bounds of the source rectangle _must_ be |
311 | multiple of 16 and must use the same coordinate system as indicated | 311 | multiple of 16 and must use the same coordinate system as indicated |
312 | before; their centers shall align initially. | 312 | before; their centers shall align initially. |
@@ -317,13 +317,13 @@ struct sn9c102_sensor { | |||
317 | defined the correct default bounds in the structures. | 317 | defined the correct default bounds in the structures. |
318 | See the V4L2 API for further details. | 318 | See the V4L2 API for further details. |
319 | NOTE: once you have defined the bounds of the active window | 319 | NOTE: once you have defined the bounds of the active window |
320 | (struct cropcap.bounds) you must not change them.anymore. | 320 | (struct cropcap.bounds) you must not change them.anymore. |
321 | Only 'bounds' and 'defrect' fields are mandatory, other fields | 321 | Only 'bounds' and 'defrect' fields are mandatory, other fields |
322 | will be ignored. | 322 | will be ignored. |
323 | */ | 323 | */ |
324 | 324 | ||
325 | int (*set_crop)(struct sn9c102_device* cam, | 325 | int (*set_crop)(struct sn9c102_device* cam, |
326 | const struct v4l2_rect* rect); | 326 | const struct v4l2_rect* rect); |
327 | /* | 327 | /* |
328 | To be called on VIDIOC_C_SETCROP. The core module always calls a | 328 | To be called on VIDIOC_C_SETCROP. The core module always calls a |
329 | default routine which configures the appropriate SN9C10X regs (also | 329 | default routine which configures the appropriate SN9C10X regs (also |
@@ -332,12 +332,12 @@ struct sn9c102_sensor { | |||
332 | case you override the default function, you always have to program | 332 | case you override the default function, you always have to program |
333 | the chip to match those values; on error return the corresponding | 333 | the chip to match those values; on error return the corresponding |
334 | error code without rolling back. | 334 | error code without rolling back. |
335 | NOTE: in case, you must program the SN9C10X chip to get rid of | 335 | NOTE: in case, you must program the SN9C10X chip to get rid of |
336 | blank pixels or blank lines at the _start_ of each line or | 336 | blank pixels or blank lines at the _start_ of each line or |
337 | frame after each HSYNC or VSYNC, so that the image starts with | 337 | frame after each HSYNC or VSYNC, so that the image starts with |
338 | real RGB data (see regs 0x12, 0x13) (having set H_SIZE and, | 338 | real RGB data (see regs 0x12, 0x13) (having set H_SIZE and, |
339 | V_SIZE you don't have to care about blank pixels or blank | 339 | V_SIZE you don't have to care about blank pixels or blank |
340 | lines at the end of each line or frame). | 340 | lines at the end of each line or frame). |
341 | */ | 341 | */ |
342 | 342 | ||
343 | struct v4l2_pix_format pix_format; | 343 | struct v4l2_pix_format pix_format; |
@@ -349,17 +349,17 @@ struct sn9c102_sensor { | |||
349 | number of bits per pixel for uncompressed video, 8 or 9 (despite the | 349 | number of bits per pixel for uncompressed video, 8 or 9 (despite the |
350 | current value of 'pixelformat'). | 350 | current value of 'pixelformat'). |
351 | NOTE 1: both 'width' and 'height' _must_ be either 1/1 or 1/2 or 1/4 | 351 | NOTE 1: both 'width' and 'height' _must_ be either 1/1 or 1/2 or 1/4 |
352 | of cropcap.defrect.width and cropcap.defrect.height. I | 352 | of cropcap.defrect.width and cropcap.defrect.height. I |
353 | suggest 1/1. | 353 | suggest 1/1. |
354 | NOTE 2: The initial compression quality is defined by the first bit | 354 | NOTE 2: The initial compression quality is defined by the first bit |
355 | of reg 0x17 during the initialization of the image sensor. | 355 | of reg 0x17 during the initialization of the image sensor. |
356 | NOTE 3: as said above, you have to program the SN9C10X chip to get | 356 | NOTE 3: as said above, you have to program the SN9C10X chip to get |
357 | rid of any blank pixels, so that the output of the sensor | 357 | rid of any blank pixels, so that the output of the sensor |
358 | matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR). | 358 | matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR). |
359 | */ | 359 | */ |
360 | 360 | ||
361 | int (*set_pix_format)(struct sn9c102_device* cam, | 361 | int (*set_pix_format)(struct sn9c102_device* cam, |
362 | const struct v4l2_pix_format* pix); | 362 | const struct v4l2_pix_format* pix); |
363 | /* | 363 | /* |
364 | To be called on VIDIOC_S_FMT, when switching from the SBGGR8 to | 364 | To be called on VIDIOC_S_FMT, when switching from the SBGGR8 to |
365 | SN9C10X pixel format or viceversa. On error return the corresponding | 365 | SN9C10X pixel format or viceversa. On error return the corresponding |
diff --git a/drivers/usb/media/sn9c102_tas5110c1b.c b/drivers/media/video/sn9c102/sn9c102_tas5110c1b.c index 2e08c552f40a..294eb02fbd88 100644 --- a/drivers/usb/media/sn9c102_tas5110c1b.c +++ b/drivers/media/video/sn9c102/sn9c102_tas5110c1b.c | |||
@@ -44,8 +44,8 @@ static int tas5110c1b_init(struct sn9c102_device* cam) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, | 47 | static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, |
48 | const struct v4l2_control* ctrl) | 48 | const struct v4l2_control* ctrl) |
49 | { | 49 | { |
50 | int err = 0; | 50 | int err = 0; |
51 | 51 | ||
@@ -61,8 +61,8 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, | |||
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | static int tas5110c1b_set_crop(struct sn9c102_device* cam, | 64 | static int tas5110c1b_set_crop(struct sn9c102_device* cam, |
65 | const struct v4l2_rect* rect) | 65 | const struct v4l2_rect* rect) |
66 | { | 66 | { |
67 | struct sn9c102_sensor* s = &tas5110c1b; | 67 | struct sn9c102_sensor* s = &tas5110c1b; |
68 | int err = 0; | 68 | int err = 0; |
@@ -81,8 +81,8 @@ static int tas5110c1b_set_crop(struct sn9c102_device* cam, | |||
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | static int tas5110c1b_set_pix_format(struct sn9c102_device* cam, | 84 | static int tas5110c1b_set_pix_format(struct sn9c102_device* cam, |
85 | const struct v4l2_pix_format* pix) | 85 | const struct v4l2_pix_format* pix) |
86 | { | 86 | { |
87 | int err = 0; | 87 | int err = 0; |
88 | 88 | ||
diff --git a/drivers/usb/media/sn9c102_tas5130d1b.c b/drivers/media/video/sn9c102/sn9c102_tas5130d1b.c index c7b339740bbf..9ecb09032b68 100644 --- a/drivers/usb/media/sn9c102_tas5130d1b.c +++ b/drivers/media/video/sn9c102/sn9c102_tas5130d1b.c | |||
@@ -42,8 +42,8 @@ static int tas5130d1b_init(struct sn9c102_device* cam) | |||
42 | } | 42 | } |
43 | 43 | ||
44 | 44 | ||
45 | static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, | 45 | static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, |
46 | const struct v4l2_control* ctrl) | 46 | const struct v4l2_control* ctrl) |
47 | { | 47 | { |
48 | int err = 0; | 48 | int err = 0; |
49 | 49 | ||
@@ -62,8 +62,8 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, | |||
62 | } | 62 | } |
63 | 63 | ||
64 | 64 | ||
65 | static int tas5130d1b_set_crop(struct sn9c102_device* cam, | 65 | static int tas5130d1b_set_crop(struct sn9c102_device* cam, |
66 | const struct v4l2_rect* rect) | 66 | const struct v4l2_rect* rect) |
67 | { | 67 | { |
68 | struct sn9c102_sensor* s = &tas5130d1b; | 68 | struct sn9c102_sensor* s = &tas5130d1b; |
69 | u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 104, | 69 | u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 104, |
@@ -82,8 +82,8 @@ static int tas5130d1b_set_crop(struct sn9c102_device* cam, | |||
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | static int tas5130d1b_set_pix_format(struct sn9c102_device* cam, | 85 | static int tas5130d1b_set_pix_format(struct sn9c102_device* cam, |
86 | const struct v4l2_pix_format* pix) | 86 | const struct v4l2_pix_format* pix) |
87 | { | 87 | { |
88 | int err = 0; | 88 | int err = 0; |
89 | 89 | ||
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index 9d769264a329..07476c71174a 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * stradis.c - stradis 4:2:2 mpeg decoder driver | 2 | * stradis.c - stradis 4:2:2 mpeg decoder driver |
3 | * | 3 | * |
4 | * Stradis 4:2:2 MPEG-2 Decoder Driver | 4 | * Stradis 4:2:2 MPEG-2 Decoder Driver |
@@ -1191,9 +1191,9 @@ static void saa7146_set_winsize(struct saa7146 *saa) | |||
1191 | } | 1191 | } |
1192 | 1192 | ||
1193 | /* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area | 1193 | /* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area |
1194 | * bitmap is fixed width, 128 bytes (1024 pixels represented) | 1194 | * bitmap is fixed width, 128 bytes (1024 pixels represented) |
1195 | * arranged most-sigificant-bit-left in 32-bit words | 1195 | * arranged most-sigificant-bit-left in 32-bit words |
1196 | * based on saa7146 clipping hardware, it swaps bytes if LE | 1196 | * based on saa7146 clipping hardware, it swaps bytes if LE |
1197 | * much of this makes up for egcs brain damage -- so if you | 1197 | * much of this makes up for egcs brain damage -- so if you |
1198 | * are wondering "why did he do this?" it is because the C | 1198 | * are wondering "why did he do this?" it is because the C |
1199 | * was adjusted to generate the optimal asm output without | 1199 | * was adjusted to generate the optimal asm output without |
@@ -1259,7 +1259,7 @@ static void make_clip_tab(struct saa7146 *saa, struct video_clip *cr, int ncr) | |||
1259 | clip_draw_rectangle(clipmap, cr[i].x, cr[i].y, | 1259 | clip_draw_rectangle(clipmap, cr[i].x, cr[i].y, |
1260 | cr[i].width, cr[i].height); | 1260 | cr[i].width, cr[i].height); |
1261 | } | 1261 | } |
1262 | /* clip against viewing window AND screen | 1262 | /* clip against viewing window AND screen |
1263 | so we do not have to rely on the user program | 1263 | so we do not have to rely on the user program |
1264 | */ | 1264 | */ |
1265 | clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ? | 1265 | clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ? |
diff --git a/drivers/usb/media/stv680.c b/drivers/media/video/stv680.c index 9636da20748d..b38bda83a7c5 100644 --- a/drivers/usb/media/stv680.c +++ b/drivers/media/video/stv680.c | |||
@@ -1,16 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * STV0680 USB Camera Driver, by Kevin Sisson (kjsisson@bellsouth.net) | 2 | * STV0680 USB Camera Driver, by Kevin Sisson (kjsisson@bellsouth.net) |
3 | * | 3 | * |
4 | * Thanks to STMicroelectronics for information on the usb commands, and | 4 | * Thanks to STMicroelectronics for information on the usb commands, and |
5 | * to Steve Miller at STM for his help and encouragement while I was | 5 | * to Steve Miller at STM for his help and encouragement while I was |
6 | * writing this driver. | 6 | * writing this driver. |
7 | * | 7 | * |
8 | * This driver is based heavily on the | 8 | * This driver is based heavily on the |
9 | * Endpoints (formerly known as AOX) se401 USB Camera Driver | 9 | * Endpoints (formerly known as AOX) se401 USB Camera Driver |
10 | * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) | 10 | * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) |
11 | * | 11 | * |
12 | * Still somewhat based on the Linux ov511 driver. | 12 | * Still somewhat based on the Linux ov511 driver. |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or modify it | 14 | * This program is free software; you can redistribute it and/or modify it |
15 | * under the terms of the GNU General Public License as published by the | 15 | * under the terms of the GNU General Public License as published by the |
16 | * Free Software Foundation; either version 2 of the License, or (at your | 16 | * Free Software Foundation; either version 2 of the License, or (at your |
@@ -25,18 +25,18 @@ | |||
25 | * along with this program; if not, write to the Free Software Foundation, | 25 | * along with this program; if not, write to the Free Software Foundation, |
26 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 26 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
27 | * | 27 | * |
28 | * History: | 28 | * History: |
29 | * ver 0.1 October, 2001. Initial attempt. | 29 | * ver 0.1 October, 2001. Initial attempt. |
30 | * | 30 | * |
31 | * ver 0.2 November, 2001. Fixed asbility to resize, added brightness | 31 | * ver 0.2 November, 2001. Fixed asbility to resize, added brightness |
32 | * function, made more stable (?) | 32 | * function, made more stable (?) |
33 | * | 33 | * |
34 | * ver 0.21 Nov, 2001. Added gamma correction and white balance, | 34 | * ver 0.21 Nov, 2001. Added gamma correction and white balance, |
35 | * due to Alexander Schwartz. Still trying to | 35 | * due to Alexander Schwartz. Still trying to |
36 | * improve stablility. Moved stuff into stv680.h | 36 | * improve stablility. Moved stuff into stv680.h |
37 | * | 37 | * |
38 | * ver 0.22 Nov, 2001. Added sharpen function (by Michael Sweet, | 38 | * ver 0.22 Nov, 2001. Added sharpen function (by Michael Sweet, |
39 | * mike@easysw.com) from GIMP, also used in pencam. | 39 | * mike@easysw.com) from GIMP, also used in pencam. |
40 | * Simple, fast, good integer math routine. | 40 | * Simple, fast, good integer math routine. |
41 | * | 41 | * |
42 | * ver 0.23 Dec, 2001 (gkh) | 42 | * ver 0.23 Dec, 2001 (gkh) |
@@ -44,11 +44,11 @@ | |||
44 | * Lindent, and did other minor tweaks to get | 44 | * Lindent, and did other minor tweaks to get |
45 | * things to work properly with 2.5.1 | 45 | * things to work properly with 2.5.1 |
46 | * | 46 | * |
47 | * ver 0.24 Jan, 2002 (kjs) | 47 | * ver 0.24 Jan, 2002 (kjs) |
48 | * Fixed the problem with webcam crashing after | 48 | * Fixed the problem with webcam crashing after |
49 | * two pictures. Changed the way pic is halved to | 49 | * two pictures. Changed the way pic is halved to |
50 | * improve quality. Got rid of green line around | 50 | * improve quality. Got rid of green line around |
51 | * frame. Fix brightness reset when changing size | 51 | * frame. Fix brightness reset when changing size |
52 | * bug. Adjusted gamma filters slightly. | 52 | * bug. Adjusted gamma filters slightly. |
53 | * | 53 | * |
54 | * ver 0.25 Jan, 2002 (kjs) | 54 | * ver 0.25 Jan, 2002 (kjs) |
@@ -484,7 +484,7 @@ exit: | |||
484 | PDEBUG (1, "STV(i): swapRGB is (forced) ON"); | 484 | PDEBUG (1, "STV(i): swapRGB is (forced) ON"); |
485 | else if (swapRGB_on == -1) | 485 | else if (swapRGB_on == -1) |
486 | PDEBUG (1, "STV(i): swapRGB is (forced) OFF"); | 486 | PDEBUG (1, "STV(i): swapRGB is (forced) OFF"); |
487 | 487 | ||
488 | if (stv_set_video_mode (stv680) < 0) { | 488 | if (stv_set_video_mode (stv680) < 0) { |
489 | PDEBUG (0, "STV(e): Could not set video mode in stv_init"); | 489 | PDEBUG (0, "STV(e): Could not set video mode in stv_init"); |
490 | return -1; | 490 | return -1; |
@@ -570,7 +570,7 @@ static int stv680_set_pict (struct usb_stv *stv680, struct video_picture *p) | |||
570 | if (stv680->brightness != p->brightness) { | 570 | if (stv680->brightness != p->brightness) { |
571 | stv680->chgbright = 1; | 571 | stv680->chgbright = 1; |
572 | stv680->brightness = p->brightness; | 572 | stv680->brightness = p->brightness; |
573 | } | 573 | } |
574 | 574 | ||
575 | stv680->whiteness = p->whiteness; /* greyscale */ | 575 | stv680->whiteness = p->whiteness; /* greyscale */ |
576 | stv680->colour = p->colour; | 576 | stv680->colour = p->colour; |
@@ -612,7 +612,7 @@ static void stv680_video_irq (struct urb *urb, struct pt_regs *regs) | |||
612 | 612 | ||
613 | case BUFFER_UNUSED: | 613 | case BUFFER_UNUSED: |
614 | memcpy (stv680->scratch[stv680->scratch_next].data, | 614 | memcpy (stv680->scratch[stv680->scratch_next].data, |
615 | (unsigned char *) urb->transfer_buffer, length); | 615 | (unsigned char *) urb->transfer_buffer, length); |
616 | stv680->scratch[stv680->scratch_next].state = BUFFER_READY; | 616 | stv680->scratch[stv680->scratch_next].state = BUFFER_READY; |
617 | stv680->scratch[stv680->scratch_next].length = length; | 617 | stv680->scratch[stv680->scratch_next].length = length; |
618 | if (waitqueue_active (&stv680->wq)) { | 618 | if (waitqueue_active (&stv680->wq)) { |
@@ -752,7 +752,7 @@ static int stv680_set_size (struct usb_stv *stv680, int width, int height) | |||
752 | PDEBUG (1, "STV(e): request for non-supported size: request: v.width = %i, v.height = %i actual: stv.width = %i, stv.height = %i", width, height, stv680->vwidth, stv680->vheight); | 752 | PDEBUG (1, "STV(e): request for non-supported size: request: v.width = %i, v.height = %i actual: stv.width = %i, stv.height = %i", width, height, stv680->vwidth, stv680->vheight); |
753 | return 1; | 753 | return 1; |
754 | } | 754 | } |
755 | 755 | ||
756 | /* Stop a current stream and start it again at the new size */ | 756 | /* Stop a current stream and start it again at the new size */ |
757 | if (wasstreaming) | 757 | if (wasstreaming) |
758 | stv680_stop_stream (stv680); | 758 | stv680_stop_stream (stv680); |
@@ -773,7 +773,7 @@ static int stv680_set_size (struct usb_stv *stv680, int width, int height) | |||
773 | 773 | ||
774 | /* | 774 | /* |
775 | * STV0680 Vision Camera Chipset Driver | 775 | * STV0680 Vision Camera Chipset Driver |
776 | * Copyright (C) 2000 Adam Harrison <adam@antispin.org> | 776 | * Copyright (C) 2000 Adam Harrison <adam@antispin.org> |
777 | */ | 777 | */ |
778 | 778 | ||
779 | #define RED 0 | 779 | #define RED 0 |
@@ -842,7 +842,7 @@ static void bayer_unshuffle (struct usb_stv *stv680, struct stv680_scratch *buff | |||
842 | colour = 2; | 842 | colour = 2; |
843 | break; | 843 | break; |
844 | } | 844 | } |
845 | i = (y * vw + x) * 3; | 845 | i = (y * vw + x) * 3; |
846 | *(output + i + colour) = (unsigned char) p; | 846 | *(output + i + colour) = (unsigned char) p; |
847 | } /* for x */ | 847 | } /* for x */ |
848 | 848 | ||
@@ -850,9 +850,9 @@ static void bayer_unshuffle (struct usb_stv *stv680, struct stv680_scratch *buff | |||
850 | 850 | ||
851 | /****** gamma correction plus hardcoded white balance */ | 851 | /****** gamma correction plus hardcoded white balance */ |
852 | /* Thanks to Alexander Schwartx <alexander.schwartx@gmx.net> for this code. | 852 | /* Thanks to Alexander Schwartx <alexander.schwartx@gmx.net> for this code. |
853 | Correction values red[], green[], blue[], are generated by | 853 | Correction values red[], green[], blue[], are generated by |
854 | (pow(i/256.0, GAMMA)*255.0)*white balanceRGB where GAMMA=0.55, 1<i<255. | 854 | (pow(i/256.0, GAMMA)*255.0)*white balanceRGB where GAMMA=0.55, 1<i<255. |
855 | White balance (RGB)= 1.0, 1.17, 1.48. Values are calculated as double float and | 855 | White balance (RGB)= 1.0, 1.17, 1.48. Values are calculated as double float and |
856 | converted to unsigned char. Values are in stv680.h */ | 856 | converted to unsigned char. Values are in stv680.h */ |
857 | 857 | ||
858 | for (y = 0; y < vh; y++) { | 858 | for (y = 0; y < vh; y++) { |
diff --git a/drivers/usb/media/stv680.h b/drivers/media/video/stv680.h index ea46e0001e6d..a08f1b08a4b0 100644 --- a/drivers/usb/media/stv680.h +++ b/drivers/media/video/stv680.h | |||
@@ -9,12 +9,12 @@ | |||
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2 of the License, or | 10 | * the Free Software Foundation; either version 2 of the License, or |
11 | * (at your option) any later version. | 11 | * (at your option) any later version. |
12 | * | 12 | * |
13 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | * | 17 | * |
18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
@@ -152,76 +152,76 @@ struct usb_stv { | |||
152 | 152 | ||
153 | 153 | ||
154 | static const unsigned char red[256] = { | 154 | static const unsigned char red[256] = { |
155 | 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, | 155 | 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, |
156 | 18, 18, 18, 18, 18, 18, 18, 25, 30, 35, 38, 42, | 156 | 18, 18, 18, 18, 18, 18, 18, 25, 30, 35, 38, 42, |
157 | 44, 47, 50, 53, 54, 57, 59, 61, 63, 65, 67, 69, | 157 | 44, 47, 50, 53, 54, 57, 59, 61, 63, 65, 67, 69, |
158 | 71, 71, 73, 75, 77, 78, 80, 81, 82, 84, 85, 87, | 158 | 71, 71, 73, 75, 77, 78, 80, 81, 82, 84, 85, 87, |
159 | 88, 89, 90, 91, 93, 94, 95, 97, 98, 98, 99, 101, | 159 | 88, 89, 90, 91, 93, 94, 95, 97, 98, 98, 99, 101, |
160 | 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, | 160 | 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, |
161 | 114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 124, | 161 | 114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
162 | 125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, | 162 | 125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, |
163 | 134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, | 163 | 134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, |
164 | 143, 143, 144, 145, 146, 147, 147, 148, 149, 150, 150, 151, | 164 | 143, 143, 144, 145, 146, 147, 147, 148, 149, 150, 150, 151, |
165 | 152, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, | 165 | 152, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, |
166 | 159, 160, 161, 161, 161, 162, 163, 163, 164, 165, 165, 166, | 166 | 159, 160, 161, 161, 161, 162, 163, 163, 164, 165, 165, 166, |
167 | 167, 167, 168, 168, 169, 170, 170, 170, 171, 171, 172, 173, | 167 | 167, 167, 168, 168, 169, 170, 170, 170, 171, 171, 172, 173, |
168 | 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 179, 179, | 168 | 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 179, 179, |
169 | 180, 180, 181, 181, 182, 183, 183, 184, 184, 185, 185, 186, | 169 | 180, 180, 181, 181, 182, 183, 183, 184, 184, 185, 185, 186, |
170 | 187, 187, 188, 188, 188, 188, 189, 190, 190, 191, 191, 192, | 170 | 187, 187, 188, 188, 188, 188, 189, 190, 190, 191, 191, 192, |
171 | 192, 193, 193, 194, 195, 195, 196, 196, 197, 197, 197, 197, | 171 | 192, 193, 193, 194, 195, 195, 196, 196, 197, 197, 197, 197, |
172 | 198, 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, 204, | 172 | 198, 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, 204, |
173 | 204, 205, 205, 206, 206, 206, 206, 207, 207, 208, 208, 209, | 173 | 204, 205, 205, 206, 206, 206, 206, 207, 207, 208, 208, 209, |
174 | 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215, | 174 | 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215, |
175 | 215, 215, 215, 216, 216, 217, 217, 218, 218, 218, 219, 219, | 175 | 215, 215, 215, 216, 216, 217, 217, 218, 218, 218, 219, 219, |
176 | 220, 220, 221, 221 | 176 | 220, 220, 221, 221 |
177 | }; | 177 | }; |
178 | 178 | ||
179 | static const unsigned char green[256] = { | 179 | static const unsigned char green[256] = { |
180 | 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, | 180 | 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, |
181 | 21, 21, 21, 21, 21, 21, 21, 28, 34, 39, 43, 47, | 181 | 21, 21, 21, 21, 21, 21, 21, 28, 34, 39, 43, 47, |
182 | 50, 53, 56, 59, 61, 64, 66, 68, 71, 73, 75, 77, | 182 | 50, 53, 56, 59, 61, 64, 66, 68, 71, 73, 75, 77, |
183 | 79, 80, 82, 84, 86, 87, 89, 91, 92, 94, 95, 97, | 183 | 79, 80, 82, 84, 86, 87, 89, 91, 92, 94, 95, 97, |
184 | 98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 111, 113, | 184 | 98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 111, 113, |
185 | 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, | 185 | 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, |
186 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, | 186 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, |
187 | 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, | 187 | 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, |
188 | 150, 151, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, | 188 | 150, 151, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, |
189 | 160, 160, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, | 189 | 160, 160, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, |
190 | 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, | 190 | 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, |
191 | 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185, | 191 | 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185, |
192 | 186, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, | 192 | 186, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, |
193 | 193, 194, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200, | 193 | 193, 194, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200, |
194 | 201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206, 207, | 194 | 201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206, 207, |
195 | 208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, | 195 | 208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, |
196 | 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 220, | 196 | 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 220, |
197 | 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, | 197 | 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, |
198 | 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, | 198 | 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, |
199 | 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, | 199 | 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, |
200 | 239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 244, 244, | 200 | 239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 244, 244, |
201 | 245, 245, 246, 246 | 201 | 245, 245, 246, 246 |
202 | }; | 202 | }; |
203 | 203 | ||
204 | static const unsigned char blue[256] = { | 204 | static const unsigned char blue[256] = { |
205 | 0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, | 205 | 0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, |
206 | 23, 23, 23, 23, 23, 23, 23, 30, 37, 42, 47, 51, | 206 | 23, 23, 23, 23, 23, 23, 23, 30, 37, 42, 47, 51, |
207 | 55, 58, 61, 64, 67, 70, 72, 74, 78, 80, 82, 84, | 207 | 55, 58, 61, 64, 67, 70, 72, 74, 78, 80, 82, 84, |
208 | 86, 88, 90, 92, 94, 95, 97, 100, 101, 103, 104, 106, | 208 | 86, 88, 90, 92, 94, 95, 97, 100, 101, 103, 104, 106, |
209 | 107, 110, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, | 209 | 107, 110, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, |
210 | 125, 126, 127, 128, 129, 132, 133, 134, 135, 136, 137, 138, | 210 | 125, 126, 127, 128, 129, 132, 133, 134, 135, 136, 137, 138, |
211 | 139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151, | 211 | 139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151, |
212 | 152, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, | 212 | 152, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, |
213 | 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, | 213 | 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, |
214 | 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, | 214 | 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, |
215 | 185, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, | 215 | 185, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, |
216 | 194, 195, 196, 196, 198, 199, 200, 200, 201, 202, 202, 203, | 216 | 194, 195, 196, 196, 198, 199, 200, 200, 201, 202, 202, 203, |
217 | 204, 204, 205, 205, 206, 207, 207, 209, 210, 210, 211, 212, | 217 | 204, 204, 205, 205, 206, 207, 207, 209, 210, 210, 211, 212, |
218 | 212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 218, 220, | 218 | 212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 218, 220, |
219 | 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, | 219 | 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, |
220 | 228, 228, 229, 229, 231, 231, 232, 233, 233, 234, 234, 235, | 220 | 228, 228, 229, 229, 231, 231, 232, 233, 233, 234, 234, 235, |
221 | 235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 242, 242, | 221 | 235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 242, 242, |
222 | 243, 243, 244, 244, 245, 246, 246, 247, 247, 248, 248, 249, | 222 | 243, 243, 244, 244, 245, 246, 246, 247, 247, 248, 248, 249, |
223 | 249, 250, 250, 251, 251, 253, 253, 254, 254, 255, 255, 255, | 223 | 249, 250, 250, 251, 251, 253, 253, 254, 254, 255, 255, 255, |
224 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, | 224 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, |
225 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, | 225 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, |
226 | 255, 255, 255, 255 | 226 | 255, 255, 255, 255 |
227 | }; | 227 | }; |
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index fc3d5824efff..78e043ac9ea0 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c | |||
@@ -48,9 +48,8 @@ | |||
48 | #include <linux/i2c.h> | 48 | #include <linux/i2c.h> |
49 | #include <linux/i2c-algo-bit.h> | 49 | #include <linux/i2c-algo-bit.h> |
50 | 50 | ||
51 | #include "bttv.h" | ||
52 | #include <media/audiochip.h> | ||
53 | #include <media/v4l2-common.h> | 51 | #include <media/v4l2-common.h> |
52 | #include <media/i2c-addr.h> | ||
54 | 53 | ||
55 | #ifndef VIDEO_AUDIO_BALANCE | 54 | #ifndef VIDEO_AUDIO_BALANCE |
56 | # define VIDEO_AUDIO_BALANCE 32 | 55 | # define VIDEO_AUDIO_BALANCE 32 |
@@ -71,7 +70,7 @@ module_param(maxvol, int, S_IRUGO | S_IWUSR); | |||
71 | 70 | ||
72 | /* Address to scan (I2C address of this chip) */ | 71 | /* Address to scan (I2C address of this chip) */ |
73 | static unsigned short normal_i2c[] = { | 72 | static unsigned short normal_i2c[] = { |
74 | I2C_TDA7432 >> 1, | 73 | I2C_ADDR_TDA7432 >> 1, |
75 | I2C_CLIENT_END, | 74 | I2C_CLIENT_END, |
76 | }; | 75 | }; |
77 | I2C_CLIENT_INSMOD; | 76 | I2C_CLIENT_INSMOD; |
diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index 0243700f58ae..ef494febb5e4 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c | |||
@@ -35,7 +35,7 @@ static int debug = 0; /* insmod parameter */ | |||
35 | module_param(debug, int, 0644); | 35 | module_param(debug, int, 0644); |
36 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | 36 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); |
37 | #define dprintk(args...) \ | 37 | #define dprintk(args...) \ |
38 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) | 38 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) |
39 | 39 | ||
40 | #define SWITCH 0x00 | 40 | #define SWITCH 0x00 |
41 | #define LEVEL_ADJUST 0x02 | 41 | #define LEVEL_ADJUST 0x02 |
@@ -43,7 +43,7 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | |||
43 | #define TEST 0x04 | 43 | #define TEST 0x04 |
44 | 44 | ||
45 | /* addresses to scan, found only at 0x42 (7-Bit) */ | 45 | /* addresses to scan, found only at 0x42 (7-Bit) */ |
46 | static unsigned short normal_i2c[] = { I2C_TDA9840, I2C_CLIENT_END }; | 46 | static unsigned short normal_i2c[] = { I2C_ADDR_TDA9840, I2C_CLIENT_END }; |
47 | 47 | ||
48 | /* magic definition of all other variables and things */ | 48 | /* magic definition of all other variables and things */ |
49 | I2C_CLIENT_INSMOD; | 49 | I2C_CLIENT_INSMOD; |
diff --git a/drivers/media/video/tda9840.h b/drivers/media/video/tda9840.h index 28021053bd09..7da8432cdca7 100644 --- a/drivers/media/video/tda9840.h +++ b/drivers/media/video/tda9840.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef __INCLUDED_TDA9840__ | 1 | #ifndef __INCLUDED_TDA9840__ |
2 | #define __INCLUDED_TDA9840__ | 2 | #define __INCLUDED_TDA9840__ |
3 | 3 | ||
4 | #define I2C_TDA9840 0x42 | 4 | #define I2C_ADDR_TDA9840 0x42 |
5 | 5 | ||
6 | #define TDA9840_DETECT _IOR('v',1,int) | 6 | #define TDA9840_DETECT _IOR('v',1,int) |
7 | /* return values for TDA9840_DETCT */ | 7 | /* return values for TDA9840_DETCT */ |
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index ef98c4982250..103ccb919292 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c | |||
@@ -30,24 +30,22 @@ | |||
30 | #include <linux/i2c-algo-bit.h> | 30 | #include <linux/i2c-algo-bit.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | 32 | ||
33 | #include "bttv.h" | 33 | |
34 | #include <media/audiochip.h> | 34 | #include <media/i2c-addr.h> |
35 | 35 | ||
36 | static int debug; /* insmod parameter */ | 36 | static int debug; /* insmod parameter */ |
37 | module_param(debug, int, S_IRUGO | S_IWUSR); | 37 | module_param(debug, int, S_IRUGO | S_IWUSR); |
38 | MODULE_LICENSE("GPL"); | 38 | MODULE_LICENSE("GPL"); |
39 | 39 | ||
40 | |||
41 | /* Addresses to scan */ | 40 | /* Addresses to scan */ |
42 | static unsigned short normal_i2c[] = { | 41 | static unsigned short normal_i2c[] = { |
43 | I2C_TDA9875 >> 1, | 42 | I2C_ADDR_TDA9875 >> 1, |
44 | I2C_CLIENT_END | 43 | I2C_CLIENT_END |
45 | }; | 44 | }; |
46 | I2C_CLIENT_INSMOD; | 45 | I2C_CLIENT_INSMOD; |
47 | 46 | ||
48 | /* This is a superset of the TDA9875 */ | 47 | /* This is a superset of the TDA9875 */ |
49 | struct tda9875 { | 48 | struct tda9875 { |
50 | int mode; | ||
51 | int rvol, lvol; | 49 | int rvol, lvol; |
52 | int bass, treble; | 50 | int bass, treble; |
53 | struct i2c_client c; | 51 | struct i2c_client c; |
@@ -197,7 +195,6 @@ static void do_tda9875_init(struct i2c_client *client) | |||
197 | 195 | ||
198 | tda9875_write(client, TDA9875_MUT, 0xcc ); /* General mute */ | 196 | tda9875_write(client, TDA9875_MUT, 0xcc ); /* General mute */ |
199 | 197 | ||
200 | t->mode=AUDIO_UNMUTE; | ||
201 | t->lvol=t->rvol =0; /* 0dB */ | 198 | t->lvol=t->rvol =0; /* 0dB */ |
202 | t->bass=0; /* 0dB */ | 199 | t->bass=0; /* 0dB */ |
203 | t->treble=0; /* 0dB */ | 200 | t->treble=0; /* 0dB */ |
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index 774ed0dbc56d..523df0b8cc63 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c | |||
@@ -37,7 +37,7 @@ static int debug = 0; /* insmod parameter */ | |||
37 | module_param(debug, int, 0644); | 37 | module_param(debug, int, 0644); |
38 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | 38 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); |
39 | #define dprintk(args...) \ | 39 | #define dprintk(args...) \ |
40 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) | 40 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) |
41 | 41 | ||
42 | #define TEA6415C_NUM_INPUTS 8 | 42 | #define TEA6415C_NUM_INPUTS 8 |
43 | #define TEA6415C_NUM_OUTPUTS 6 | 43 | #define TEA6415C_NUM_OUTPUTS 6 |
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index ad7d2872cfbf..e0ff811fab6f 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c | |||
@@ -37,10 +37,10 @@ static int debug = 0; /* insmod parameter */ | |||
37 | module_param(debug, int, 0644); | 37 | module_param(debug, int, 0644); |
38 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | 38 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); |
39 | #define dprintk(args...) \ | 39 | #define dprintk(args...) \ |
40 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) | 40 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) |
41 | 41 | ||
42 | /* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */ | 42 | /* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */ |
43 | static unsigned short normal_i2c[] = { I2C_TEA6420_1, I2C_TEA6420_2, I2C_CLIENT_END }; | 43 | static unsigned short normal_i2c[] = { I2C_ADDR_TEA6420_1, I2C_ADDR_TEA6420_2, I2C_CLIENT_END }; |
44 | 44 | ||
45 | /* magic definition of all other variables and things */ | 45 | /* magic definition of all other variables and things */ |
46 | I2C_CLIENT_INSMOD; | 46 | I2C_CLIENT_INSMOD; |
diff --git a/drivers/media/video/tea6420.h b/drivers/media/video/tea6420.h index ea664df15ad4..5ef7c18e0c54 100644 --- a/drivers/media/video/tea6420.h +++ b/drivers/media/video/tea6420.h | |||
@@ -2,8 +2,8 @@ | |||
2 | #define __INCLUDED_TEA6420__ | 2 | #define __INCLUDED_TEA6420__ |
3 | 3 | ||
4 | /* possible addresses */ | 4 | /* possible addresses */ |
5 | #define I2C_TEA6420_1 0x4c | 5 | #define I2C_ADDR_TEA6420_1 0x4c |
6 | #define I2C_TEA6420_2 0x4d | 6 | #define I2C_ADDR_TEA6420_2 0x4d |
7 | 7 | ||
8 | struct tea6420_multiplex | 8 | struct tea6420_multiplex |
9 | { | 9 | { |
diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c index c4a78e7a5a58..74ab48c09c6a 100644 --- a/drivers/media/video/tuner-3036.c +++ b/drivers/media/video/tuner-3036.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * The SAB3036 is just about different enough from the chips that | 6 | * The SAB3036 is just about different enough from the chips that |
7 | * tuner.c copes with to make it not worth the effort to crowbar | 7 | * tuner.c copes with to make it not worth the effort to crowbar |
8 | * the support into that file. So instead we have a separate driver. | 8 | * the support into that file. So instead we have a separate driver. |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or | 10 | * This program is free software; you can redistribute it and/or |
11 | * modify it under the terms of the GNU General Public License | 11 | * modify it under the terms of the GNU General Public License |
@@ -56,15 +56,15 @@ tuner_getstatus (struct i2c_client *c) | |||
56 | 56 | ||
57 | #define TUNER_FL 0x80 | 57 | #define TUNER_FL 0x80 |
58 | 58 | ||
59 | static int | 59 | static int |
60 | tuner_islocked (struct i2c_client *c) | 60 | tuner_islocked (struct i2c_client *c) |
61 | { | 61 | { |
62 | return (tuner_getstatus(c) & TUNER_FL); | 62 | return (tuner_getstatus(c) & TUNER_FL); |
63 | } | 63 | } |
64 | 64 | ||
65 | /* ---------------------------------------------------------------------- */ | 65 | /* ---------------------------------------------------------------------- */ |
66 | 66 | ||
67 | static void | 67 | static void |
68 | set_tv_freq(struct i2c_client *c, int freq) | 68 | set_tv_freq(struct i2c_client *c, int freq) |
69 | { | 69 | { |
70 | u16 div = ((freq * 20) / 16); | 70 | u16 div = ((freq * 20) / 16); |
@@ -73,26 +73,26 @@ set_tv_freq(struct i2c_client *c, int freq) | |||
73 | 73 | ||
74 | if (debug) | 74 | if (debug) |
75 | printk(KERN_DEBUG "tuner: setting frequency %dMHz, divisor %x\n", freq / 16, div); | 75 | printk(KERN_DEBUG "tuner: setting frequency %dMHz, divisor %x\n", freq / 16, div); |
76 | 76 | ||
77 | /* Select high tuning current */ | 77 | /* Select high tuning current */ |
78 | buffer[0] = 0x29; | 78 | buffer[0] = 0x29; |
79 | buffer[1] = 0x3e; | 79 | buffer[1] = 0x3e; |
80 | 80 | ||
81 | if (i2c_master_send(c, buffer, 2) != 2) | 81 | if (i2c_master_send(c, buffer, 2) != 2) |
82 | printk("tuner: i2c i/o error 1\n"); | 82 | printk("tuner: i2c i/o error 1\n"); |
83 | 83 | ||
84 | buffer[0] = 0x80 | ((div>>8) & 0x7f); | 84 | buffer[0] = 0x80 | ((div>>8) & 0x7f); |
85 | buffer[1] = div & 0xff; | 85 | buffer[1] = div & 0xff; |
86 | 86 | ||
87 | if (i2c_master_send(c, buffer, 2) != 2) | 87 | if (i2c_master_send(c, buffer, 2) != 2) |
88 | printk("tuner: i2c i/o error 2\n"); | 88 | printk("tuner: i2c i/o error 2\n"); |
89 | 89 | ||
90 | while (!tuner_islocked(c) && time_before(jiffies, give_up)) | 90 | while (!tuner_islocked(c) && time_before(jiffies, give_up)) |
91 | schedule(); | 91 | schedule(); |
92 | 92 | ||
93 | if (!tuner_islocked(c)) | 93 | if (!tuner_islocked(c)) |
94 | printk(KERN_WARNING "tuner: failed to achieve PLL lock\n"); | 94 | printk(KERN_WARNING "tuner: failed to achieve PLL lock\n"); |
95 | 95 | ||
96 | /* Select low tuning current and engage AFC */ | 96 | /* Select low tuning current and engage AFC */ |
97 | buffer[0] = 0x29; | 97 | buffer[0] = 0x29; |
98 | buffer[1] = 0xb2; | 98 | buffer[1] = 0xb2; |
@@ -106,7 +106,7 @@ set_tv_freq(struct i2c_client *c, int freq) | |||
106 | 106 | ||
107 | /* ---------------------------------------------------------------------- */ | 107 | /* ---------------------------------------------------------------------- */ |
108 | 108 | ||
109 | static int | 109 | static int |
110 | tuner_attach(struct i2c_adapter *adap, int addr, int kind) | 110 | tuner_attach(struct i2c_adapter *adap, int addr, int kind) |
111 | { | 111 | { |
112 | static unsigned char buffer[] = { 0x29, 0x32, 0x2a, 0, 0x2b, 0 }; | 112 | static unsigned char buffer[] = { 0x29, 0x32, 0x2a, 0, 0x2b, 0 }; |
@@ -116,18 +116,18 @@ tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
116 | if (this_adap > 0) | 116 | if (this_adap > 0) |
117 | return -1; | 117 | return -1; |
118 | this_adap++; | 118 | this_adap++; |
119 | 119 | ||
120 | client_template.adapter = adap; | 120 | client_template.adapter = adap; |
121 | client_template.addr = addr; | 121 | client_template.addr = addr; |
122 | 122 | ||
123 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 123 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); |
124 | if (client == NULL) | 124 | if (client == NULL) |
125 | return -ENOMEM; | 125 | return -ENOMEM; |
126 | memcpy(client, &client_template, sizeof(struct i2c_client)); | 126 | memcpy(client, &client_template, sizeof(struct i2c_client)); |
127 | 127 | ||
128 | printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client)); | 128 | printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client)); |
129 | 129 | ||
130 | i2c_attach_client(client); | 130 | i2c_attach_client(client); |
131 | 131 | ||
132 | if (i2c_master_send(client, buffer, 2) != 2) | 132 | if (i2c_master_send(client, buffer, 2) != 2) |
133 | printk("tuner: i2c i/o error 1\n"); | 133 | printk("tuner: i2c i/o error 1\n"); |
@@ -138,30 +138,30 @@ tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | 140 | ||
141 | static int | 141 | static int |
142 | tuner_detach(struct i2c_client *c) | 142 | tuner_detach(struct i2c_client *c) |
143 | { | 143 | { |
144 | return 0; | 144 | return 0; |
145 | } | 145 | } |
146 | 146 | ||
147 | static int | 147 | static int |
148 | tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | 148 | tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) |
149 | { | 149 | { |
150 | int *iarg = (int*)arg; | 150 | int *iarg = (int*)arg; |
151 | 151 | ||
152 | switch (cmd) | 152 | switch (cmd) |
153 | { | 153 | { |
154 | case VIDIOCSFREQ: | 154 | case VIDIOCSFREQ: |
155 | set_tv_freq(client, *iarg); | 155 | set_tv_freq(client, *iarg); |
156 | break; | 156 | break; |
157 | 157 | ||
158 | default: | 158 | default: |
159 | return -EINVAL; | 159 | return -EINVAL; |
160 | } | 160 | } |
161 | return 0; | 161 | return 0; |
162 | } | 162 | } |
163 | 163 | ||
164 | static int | 164 | static int |
165 | tuner_probe(struct i2c_adapter *adap) | 165 | tuner_probe(struct i2c_adapter *adap) |
166 | { | 166 | { |
167 | this_adap = 0; | 167 | this_adap = 0; |
@@ -172,8 +172,8 @@ tuner_probe(struct i2c_adapter *adap) | |||
172 | 172 | ||
173 | /* ----------------------------------------------------------------------- */ | 173 | /* ----------------------------------------------------------------------- */ |
174 | 174 | ||
175 | static struct i2c_driver | 175 | static struct i2c_driver |
176 | i2c_driver_tuner = | 176 | i2c_driver_tuner = |
177 | { | 177 | { |
178 | .driver = { | 178 | .driver = { |
179 | .name = "sab3036", | 179 | .name = "sab3036", |
@@ -186,7 +186,7 @@ i2c_driver_tuner = | |||
186 | 186 | ||
187 | static struct i2c_client client_template = | 187 | static struct i2c_client client_template = |
188 | { | 188 | { |
189 | .driver = &i2c_driver_tuner, | 189 | .driver = &i2c_driver_tuner, |
190 | .name = "SAB3036", | 190 | .name = "SAB3036", |
191 | }; | 191 | }; |
192 | 192 | ||
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 32e1849441fb..df195c905366 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -21,7 +21,6 @@ | |||
21 | 21 | ||
22 | #include <media/tuner.h> | 22 | #include <media/tuner.h> |
23 | #include <media/v4l2-common.h> | 23 | #include <media/v4l2-common.h> |
24 | #include <media/audiochip.h> | ||
25 | 24 | ||
26 | #define UNSET (-1U) | 25 | #define UNSET (-1U) |
27 | 26 | ||
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 4efb01bb44ac..356bff455ad1 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -30,10 +30,10 @@ | |||
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/smp_lock.h> | 31 | #include <linux/smp_lock.h> |
32 | 32 | ||
33 | #include <media/audiochip.h> | 33 | #include <media/tvaudio.h> |
34 | #include <media/v4l2-common.h> | 34 | #include <media/v4l2-common.h> |
35 | 35 | ||
36 | #include "tvaudio.h" | 36 | #include <media/i2c-addr.h> |
37 | 37 | ||
38 | /* ---------------------------------------------------------------------- */ | 38 | /* ---------------------------------------------------------------------- */ |
39 | /* insmod args */ | 39 | /* insmod args */ |
@@ -102,7 +102,7 @@ struct CHIPDESC { | |||
102 | 102 | ||
103 | /* input switch register + values for v4l inputs */ | 103 | /* input switch register + values for v4l inputs */ |
104 | int inputreg; | 104 | int inputreg; |
105 | int inputmap[8]; | 105 | int inputmap[4]; |
106 | int inputmute; | 106 | int inputmute; |
107 | int inputmask; | 107 | int inputmask; |
108 | }; | 108 | }; |
@@ -119,9 +119,10 @@ struct CHIPSTATE { | |||
119 | audiocmd shadow; | 119 | audiocmd shadow; |
120 | 120 | ||
121 | /* current settings */ | 121 | /* current settings */ |
122 | __u16 left,right,treble,bass,mode; | 122 | __u16 left,right,treble,bass,muted,mode; |
123 | int prevmode; | 123 | int prevmode; |
124 | int radio; | 124 | int radio; |
125 | int input; | ||
125 | 126 | ||
126 | /* thread */ | 127 | /* thread */ |
127 | pid_t tpid; | 128 | pid_t tpid; |
@@ -137,14 +138,14 @@ struct CHIPSTATE { | |||
137 | /* i2c addresses */ | 138 | /* i2c addresses */ |
138 | 139 | ||
139 | static unsigned short normal_i2c[] = { | 140 | static unsigned short normal_i2c[] = { |
140 | I2C_TDA8425 >> 1, | 141 | I2C_ADDR_TDA8425 >> 1, |
141 | I2C_TEA6300 >> 1, | 142 | I2C_ADDR_TEA6300 >> 1, |
142 | I2C_TEA6420 >> 1, | 143 | I2C_ADDR_TEA6420 >> 1, |
143 | I2C_TDA9840 >> 1, | 144 | I2C_ADDR_TDA9840 >> 1, |
144 | I2C_TDA985x_L >> 1, | 145 | I2C_ADDR_TDA985x_L >> 1, |
145 | I2C_TDA985x_H >> 1, | 146 | I2C_ADDR_TDA985x_H >> 1, |
146 | I2C_TDA9874 >> 1, | 147 | I2C_ADDR_TDA9874 >> 1, |
147 | I2C_PIC16C54 >> 1, | 148 | I2C_ADDR_PIC16C54 >> 1, |
148 | I2C_CLIENT_END }; | 149 | I2C_CLIENT_END }; |
149 | I2C_CLIENT_INSMOD; | 150 | I2C_CLIENT_INSMOD; |
150 | 151 | ||
@@ -1101,9 +1102,8 @@ static int tda8425_shift12(int val) { return (val >> 12) | 0xf0; } | |||
1101 | static int tda8425_initialize(struct CHIPSTATE *chip) | 1102 | static int tda8425_initialize(struct CHIPSTATE *chip) |
1102 | { | 1103 | { |
1103 | struct CHIPDESC *desc = chiplist + chip->type; | 1104 | struct CHIPDESC *desc = chiplist + chip->type; |
1104 | int inputmap[8] = { /* tuner */ TDA8425_S1_CH2, /* radio */ TDA8425_S1_CH1, | 1105 | int inputmap[4] = { /* tuner */ TDA8425_S1_CH2, /* radio */ TDA8425_S1_CH1, |
1105 | /* extern */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF, | 1106 | /* extern */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF}; |
1106 | /* off */ TDA8425_S1_OFF, /* on */ TDA8425_S1_CH2}; | ||
1107 | 1107 | ||
1108 | if (chip->c.adapter->id == I2C_HW_B_RIVA) { | 1108 | if (chip->c.adapter->id == I2C_HW_B_RIVA) { |
1109 | memcpy (desc->inputmap, inputmap, sizeof (inputmap)); | 1109 | memcpy (desc->inputmap, inputmap, sizeof (inputmap)); |
@@ -1269,8 +1269,8 @@ static struct CHIPDESC chiplist[] = { | |||
1269 | .name = "tda9840", | 1269 | .name = "tda9840", |
1270 | .id = I2C_DRIVERID_TDA9840, | 1270 | .id = I2C_DRIVERID_TDA9840, |
1271 | .insmodopt = &tda9840, | 1271 | .insmodopt = &tda9840, |
1272 | .addr_lo = I2C_TDA9840 >> 1, | 1272 | .addr_lo = I2C_ADDR_TDA9840 >> 1, |
1273 | .addr_hi = I2C_TDA9840 >> 1, | 1273 | .addr_hi = I2C_ADDR_TDA9840 >> 1, |
1274 | .registers = 5, | 1274 | .registers = 5, |
1275 | 1275 | ||
1276 | .checkit = tda9840_checkit, | 1276 | .checkit = tda9840_checkit, |
@@ -1286,8 +1286,8 @@ static struct CHIPDESC chiplist[] = { | |||
1286 | .id = I2C_DRIVERID_TDA9873, | 1286 | .id = I2C_DRIVERID_TDA9873, |
1287 | .checkit = tda9873_checkit, | 1287 | .checkit = tda9873_checkit, |
1288 | .insmodopt = &tda9873, | 1288 | .insmodopt = &tda9873, |
1289 | .addr_lo = I2C_TDA985x_L >> 1, | 1289 | .addr_lo = I2C_ADDR_TDA985x_L >> 1, |
1290 | .addr_hi = I2C_TDA985x_H >> 1, | 1290 | .addr_hi = I2C_ADDR_TDA985x_H >> 1, |
1291 | .registers = 3, | 1291 | .registers = 3, |
1292 | .flags = CHIP_HAS_INPUTSEL, | 1292 | .flags = CHIP_HAS_INPUTSEL, |
1293 | 1293 | ||
@@ -1298,7 +1298,7 @@ static struct CHIPDESC chiplist[] = { | |||
1298 | .init = { 4, { TDA9873_SW, 0xa4, 0x06, 0x03 } }, | 1298 | .init = { 4, { TDA9873_SW, 0xa4, 0x06, 0x03 } }, |
1299 | .inputreg = TDA9873_SW, | 1299 | .inputreg = TDA9873_SW, |
1300 | .inputmute = TDA9873_MUTE | TDA9873_AUTOMUTE, | 1300 | .inputmute = TDA9873_MUTE | TDA9873_AUTOMUTE, |
1301 | .inputmap = {0xa0, 0xa2, 0xa0, 0xa0, 0xc0}, | 1301 | .inputmap = {0xa0, 0xa2, 0xa0, 0xa0}, |
1302 | .inputmask = TDA9873_INP_MASK|TDA9873_MUTE|TDA9873_AUTOMUTE, | 1302 | .inputmask = TDA9873_INP_MASK|TDA9873_MUTE|TDA9873_AUTOMUTE, |
1303 | 1303 | ||
1304 | }, | 1304 | }, |
@@ -1308,8 +1308,8 @@ static struct CHIPDESC chiplist[] = { | |||
1308 | .checkit = tda9874a_checkit, | 1308 | .checkit = tda9874a_checkit, |
1309 | .initialize = tda9874a_initialize, | 1309 | .initialize = tda9874a_initialize, |
1310 | .insmodopt = &tda9874a, | 1310 | .insmodopt = &tda9874a, |
1311 | .addr_lo = I2C_TDA9874 >> 1, | 1311 | .addr_lo = I2C_ADDR_TDA9874 >> 1, |
1312 | .addr_hi = I2C_TDA9874 >> 1, | 1312 | .addr_hi = I2C_ADDR_TDA9874 >> 1, |
1313 | 1313 | ||
1314 | .getmode = tda9874a_getmode, | 1314 | .getmode = tda9874a_getmode, |
1315 | .setmode = tda9874a_setmode, | 1315 | .setmode = tda9874a_setmode, |
@@ -1319,8 +1319,8 @@ static struct CHIPDESC chiplist[] = { | |||
1319 | .name = "tda9850", | 1319 | .name = "tda9850", |
1320 | .id = I2C_DRIVERID_TDA9850, | 1320 | .id = I2C_DRIVERID_TDA9850, |
1321 | .insmodopt = &tda9850, | 1321 | .insmodopt = &tda9850, |
1322 | .addr_lo = I2C_TDA985x_L >> 1, | 1322 | .addr_lo = I2C_ADDR_TDA985x_L >> 1, |
1323 | .addr_hi = I2C_TDA985x_H >> 1, | 1323 | .addr_hi = I2C_ADDR_TDA985x_H >> 1, |
1324 | .registers = 11, | 1324 | .registers = 11, |
1325 | 1325 | ||
1326 | .getmode = tda985x_getmode, | 1326 | .getmode = tda985x_getmode, |
@@ -1332,8 +1332,8 @@ static struct CHIPDESC chiplist[] = { | |||
1332 | .name = "tda9855", | 1332 | .name = "tda9855", |
1333 | .id = I2C_DRIVERID_TDA9855, | 1333 | .id = I2C_DRIVERID_TDA9855, |
1334 | .insmodopt = &tda9855, | 1334 | .insmodopt = &tda9855, |
1335 | .addr_lo = I2C_TDA985x_L >> 1, | 1335 | .addr_lo = I2C_ADDR_TDA985x_L >> 1, |
1336 | .addr_hi = I2C_TDA985x_H >> 1, | 1336 | .addr_hi = I2C_ADDR_TDA985x_H >> 1, |
1337 | .registers = 11, | 1337 | .registers = 11, |
1338 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE, | 1338 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE, |
1339 | 1339 | ||
@@ -1357,8 +1357,8 @@ static struct CHIPDESC chiplist[] = { | |||
1357 | .name = "tea6300", | 1357 | .name = "tea6300", |
1358 | .id = I2C_DRIVERID_TEA6300, | 1358 | .id = I2C_DRIVERID_TEA6300, |
1359 | .insmodopt = &tea6300, | 1359 | .insmodopt = &tea6300, |
1360 | .addr_lo = I2C_TEA6300 >> 1, | 1360 | .addr_lo = I2C_ADDR_TEA6300 >> 1, |
1361 | .addr_hi = I2C_TEA6300 >> 1, | 1361 | .addr_hi = I2C_ADDR_TEA6300 >> 1, |
1362 | .registers = 6, | 1362 | .registers = 6, |
1363 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, | 1363 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, |
1364 | 1364 | ||
@@ -1379,8 +1379,8 @@ static struct CHIPDESC chiplist[] = { | |||
1379 | .id = I2C_DRIVERID_TEA6300, | 1379 | .id = I2C_DRIVERID_TEA6300, |
1380 | .initialize = tea6320_initialize, | 1380 | .initialize = tea6320_initialize, |
1381 | .insmodopt = &tea6320, | 1381 | .insmodopt = &tea6320, |
1382 | .addr_lo = I2C_TEA6300 >> 1, | 1382 | .addr_lo = I2C_ADDR_TEA6300 >> 1, |
1383 | .addr_hi = I2C_TEA6300 >> 1, | 1383 | .addr_hi = I2C_ADDR_TEA6300 >> 1, |
1384 | .registers = 8, | 1384 | .registers = 8, |
1385 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, | 1385 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, |
1386 | 1386 | ||
@@ -1400,8 +1400,8 @@ static struct CHIPDESC chiplist[] = { | |||
1400 | .name = "tea6420", | 1400 | .name = "tea6420", |
1401 | .id = I2C_DRIVERID_TEA6420, | 1401 | .id = I2C_DRIVERID_TEA6420, |
1402 | .insmodopt = &tea6420, | 1402 | .insmodopt = &tea6420, |
1403 | .addr_lo = I2C_TEA6420 >> 1, | 1403 | .addr_lo = I2C_ADDR_TEA6420 >> 1, |
1404 | .addr_hi = I2C_TEA6420 >> 1, | 1404 | .addr_hi = I2C_ADDR_TEA6420 >> 1, |
1405 | .registers = 1, | 1405 | .registers = 1, |
1406 | .flags = CHIP_HAS_INPUTSEL, | 1406 | .flags = CHIP_HAS_INPUTSEL, |
1407 | 1407 | ||
@@ -1413,8 +1413,8 @@ static struct CHIPDESC chiplist[] = { | |||
1413 | .name = "tda8425", | 1413 | .name = "tda8425", |
1414 | .id = I2C_DRIVERID_TDA8425, | 1414 | .id = I2C_DRIVERID_TDA8425, |
1415 | .insmodopt = &tda8425, | 1415 | .insmodopt = &tda8425, |
1416 | .addr_lo = I2C_TDA8425 >> 1, | 1416 | .addr_lo = I2C_ADDR_TDA8425 >> 1, |
1417 | .addr_hi = I2C_TDA8425 >> 1, | 1417 | .addr_hi = I2C_ADDR_TDA8425 >> 1, |
1418 | .registers = 9, | 1418 | .registers = 9, |
1419 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, | 1419 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, |
1420 | 1420 | ||
@@ -1437,8 +1437,8 @@ static struct CHIPDESC chiplist[] = { | |||
1437 | .name = "pic16c54 (PV951)", | 1437 | .name = "pic16c54 (PV951)", |
1438 | .id = I2C_DRIVERID_PIC16C54_PV9, | 1438 | .id = I2C_DRIVERID_PIC16C54_PV9, |
1439 | .insmodopt = &pic16c54, | 1439 | .insmodopt = &pic16c54, |
1440 | .addr_lo = I2C_PIC16C54 >> 1, | 1440 | .addr_lo = I2C_ADDR_PIC16C54 >> 1, |
1441 | .addr_hi = I2C_PIC16C54>> 1, | 1441 | .addr_hi = I2C_ADDR_PIC16C54>> 1, |
1442 | .registers = 2, | 1442 | .registers = 2, |
1443 | .flags = CHIP_HAS_INPUTSEL, | 1443 | .flags = CHIP_HAS_INPUTSEL, |
1444 | 1444 | ||
@@ -1446,8 +1446,7 @@ static struct CHIPDESC chiplist[] = { | |||
1446 | .inputmap = {PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_TUNER, | 1446 | .inputmap = {PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_TUNER, |
1447 | PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE, | 1447 | PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE, |
1448 | PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE, | 1448 | PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE, |
1449 | PIC16C54_MISC_SND_MUTE,PIC16C54_MISC_SND_MUTE, | 1449 | PIC16C54_MISC_SND_MUTE}, |
1450 | PIC16C54_MISC_SND_NOTMUTE}, | ||
1451 | .inputmute = PIC16C54_MISC_SND_MUTE, | 1450 | .inputmute = PIC16C54_MISC_SND_MUTE, |
1452 | }, | 1451 | }, |
1453 | { | 1452 | { |
@@ -1456,8 +1455,8 @@ static struct CHIPDESC chiplist[] = { | |||
1456 | /*.id = I2C_DRIVERID_TA8874Z, */ | 1455 | /*.id = I2C_DRIVERID_TA8874Z, */ |
1457 | .checkit = ta8874z_checkit, | 1456 | .checkit = ta8874z_checkit, |
1458 | .insmodopt = &ta8874z, | 1457 | .insmodopt = &ta8874z, |
1459 | .addr_lo = I2C_TDA9840 >> 1, | 1458 | .addr_lo = I2C_ADDR_TDA9840 >> 1, |
1460 | .addr_hi = I2C_TDA9840 >> 1, | 1459 | .addr_hi = I2C_ADDR_TDA9840 >> 1, |
1461 | .registers = 2, | 1460 | .registers = 2, |
1462 | 1461 | ||
1463 | .getmode = ta8874z_getmode, | 1462 | .getmode = ta8874z_getmode, |
@@ -1583,28 +1582,40 @@ static int chip_detach(struct i2c_client *client) | |||
1583 | return 0; | 1582 | return 0; |
1584 | } | 1583 | } |
1585 | 1584 | ||
1585 | static int tvaudio_set_ctrl(struct CHIPSTATE *chip, struct v4l2_control *ctrl) | ||
1586 | { | ||
1587 | struct CHIPDESC *desc = chiplist + chip->type; | ||
1588 | |||
1589 | switch (ctrl->id) { | ||
1590 | case V4L2_CID_AUDIO_MUTE: | ||
1591 | if (ctrl->value < 0 || ctrl->value >= 2) | ||
1592 | return -ERANGE; | ||
1593 | chip->muted = ctrl->value; | ||
1594 | if (chip->muted) | ||
1595 | chip_write_masked(chip,desc->inputreg,desc->inputmute,desc->inputmask); | ||
1596 | else | ||
1597 | chip_write_masked(chip,desc->inputreg, | ||
1598 | desc->inputmap[chip->input],desc->inputmask); | ||
1599 | break; | ||
1600 | default: | ||
1601 | return -EINVAL; | ||
1602 | } | ||
1603 | return 0; | ||
1604 | } | ||
1605 | |||
1606 | |||
1586 | /* ---------------------------------------------------------------------- */ | 1607 | /* ---------------------------------------------------------------------- */ |
1587 | /* video4linux interface */ | 1608 | /* video4linux interface */ |
1588 | 1609 | ||
1589 | static int chip_command(struct i2c_client *client, | 1610 | static int chip_command(struct i2c_client *client, |
1590 | unsigned int cmd, void *arg) | 1611 | unsigned int cmd, void *arg) |
1591 | { | 1612 | { |
1592 | __u16 *sarg = arg; | ||
1593 | struct CHIPSTATE *chip = i2c_get_clientdata(client); | 1613 | struct CHIPSTATE *chip = i2c_get_clientdata(client); |
1594 | struct CHIPDESC *desc = chiplist + chip->type; | 1614 | struct CHIPDESC *desc = chiplist + chip->type; |
1595 | 1615 | ||
1596 | v4l_dbg(1, debug, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd); | 1616 | v4l_dbg(1, debug, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd); |
1597 | 1617 | ||
1598 | switch (cmd) { | 1618 | switch (cmd) { |
1599 | case AUDC_SET_INPUT: | ||
1600 | if (desc->flags & CHIP_HAS_INPUTSEL) { | ||
1601 | if (*sarg & 0x80) | ||
1602 | chip_write_masked(chip,desc->inputreg,desc->inputmute,desc->inputmask); | ||
1603 | else | ||
1604 | chip_write_masked(chip,desc->inputreg,desc->inputmap[*sarg],desc->inputmask); | ||
1605 | } | ||
1606 | break; | ||
1607 | |||
1608 | case AUDC_SET_RADIO: | 1619 | case AUDC_SET_RADIO: |
1609 | chip->radio = 1; | 1620 | chip->radio = 1; |
1610 | chip->watch_stereo = 0; | 1621 | chip->watch_stereo = 0; |
@@ -1668,6 +1679,48 @@ static int chip_command(struct i2c_client *client, | |||
1668 | break; | 1679 | break; |
1669 | } | 1680 | } |
1670 | 1681 | ||
1682 | case VIDIOC_S_CTRL: | ||
1683 | return tvaudio_set_ctrl(chip, arg); | ||
1684 | |||
1685 | case VIDIOC_INT_G_AUDIO_ROUTING: | ||
1686 | { | ||
1687 | struct v4l2_routing *rt = arg; | ||
1688 | |||
1689 | rt->input = chip->input; | ||
1690 | rt->output = 0; | ||
1691 | break; | ||
1692 | } | ||
1693 | |||
1694 | case VIDIOC_INT_S_AUDIO_ROUTING: | ||
1695 | { | ||
1696 | struct v4l2_routing *rt = arg; | ||
1697 | |||
1698 | if (!(desc->flags & CHIP_HAS_INPUTSEL) || rt->input >= 4) | ||
1699 | return -EINVAL; | ||
1700 | /* There are four inputs: tuner, radio, extern and intern. */ | ||
1701 | chip->input = rt->input; | ||
1702 | if (chip->muted) | ||
1703 | break; | ||
1704 | chip_write_masked(chip, desc->inputreg, | ||
1705 | desc->inputmap[chip->input], desc->inputmask); | ||
1706 | break; | ||
1707 | } | ||
1708 | |||
1709 | case VIDIOC_S_AUDIO: | ||
1710 | { | ||
1711 | struct v4l2_audio *sarg = arg; | ||
1712 | |||
1713 | if (!(desc->flags & CHIP_HAS_INPUTSEL) || sarg->index >= 4) | ||
1714 | return -EINVAL; | ||
1715 | /* There are four inputs: tuner, radio, extern and intern. */ | ||
1716 | chip->input = sarg->index; | ||
1717 | if (chip->muted) | ||
1718 | break; | ||
1719 | chip_write_masked(chip, desc->inputreg, | ||
1720 | desc->inputmap[chip->input], desc->inputmask); | ||
1721 | break; | ||
1722 | } | ||
1723 | |||
1671 | case VIDIOC_S_TUNER: | 1724 | case VIDIOC_S_TUNER: |
1672 | { | 1725 | { |
1673 | struct v4l2_tuner *vt = arg; | 1726 | struct v4l2_tuner *vt = arg; |
@@ -1680,6 +1733,7 @@ static int chip_command(struct i2c_client *client, | |||
1680 | mode = VIDEO_SOUND_MONO; | 1733 | mode = VIDEO_SOUND_MONO; |
1681 | break; | 1734 | break; |
1682 | case V4L2_TUNER_MODE_STEREO: | 1735 | case V4L2_TUNER_MODE_STEREO: |
1736 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
1683 | mode = VIDEO_SOUND_STEREO; | 1737 | mode = VIDEO_SOUND_STEREO; |
1684 | break; | 1738 | break; |
1685 | case V4L2_TUNER_MODE_LANG1: | 1739 | case V4L2_TUNER_MODE_LANG1: |
diff --git a/drivers/media/video/tvaudio.h b/drivers/media/video/tvaudio.h deleted file mode 100644 index af7e116af9a9..000000000000 --- a/drivers/media/video/tvaudio.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* | ||
2 | * i2c bus addresses for the chips supported by tvaudio.c | ||
3 | */ | ||
4 | |||
5 | #define I2C_TDA8425 0x82 | ||
6 | #define I2C_TDA9840 0x84 /* also used by TA8874Z */ | ||
7 | #define I2C_TDA985x_L 0xb4 /* also used by 9873 */ | ||
8 | #define I2C_TDA985x_H 0xb6 | ||
9 | #define I2C_TDA9874 0xb0 /* also used by 9875 */ | ||
10 | |||
11 | #define I2C_TEA6300 0x80 /* also used by 6320 */ | ||
12 | #define I2C_TEA6420 0x98 | ||
13 | |||
14 | #define I2C_PIC16C54 0x96 /* PV951 */ | ||
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 582551b0969b..e0d2ff83fc91 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -248,32 +248,32 @@ audioIC[] = | |||
248 | {AUDIO_CHIP_MSP34XX, "MSP3410D"}, | 248 | {AUDIO_CHIP_MSP34XX, "MSP3410D"}, |
249 | {AUDIO_CHIP_MSP34XX, "MSP3415"}, | 249 | {AUDIO_CHIP_MSP34XX, "MSP3415"}, |
250 | {AUDIO_CHIP_MSP34XX, "MSP3430"}, | 250 | {AUDIO_CHIP_MSP34XX, "MSP3430"}, |
251 | {AUDIO_CHIP_UNKNOWN, "MSP3438"}, | 251 | {AUDIO_CHIP_MSP34XX, "MSP3438"}, |
252 | {AUDIO_CHIP_UNKNOWN, "CS5331"}, | 252 | {AUDIO_CHIP_UNKNOWN, "CS5331"}, |
253 | /* 10-14 */ | 253 | /* 10-14 */ |
254 | {AUDIO_CHIP_MSP34XX, "MSP3435"}, | 254 | {AUDIO_CHIP_MSP34XX, "MSP3435"}, |
255 | {AUDIO_CHIP_MSP34XX, "MSP3440"}, | 255 | {AUDIO_CHIP_MSP34XX, "MSP3440"}, |
256 | {AUDIO_CHIP_MSP34XX, "MSP3445"}, | 256 | {AUDIO_CHIP_MSP34XX, "MSP3445"}, |
257 | {AUDIO_CHIP_UNKNOWN, "MSP3411"}, | 257 | {AUDIO_CHIP_MSP34XX, "MSP3411"}, |
258 | {AUDIO_CHIP_UNKNOWN, "MSP3416"}, | 258 | {AUDIO_CHIP_MSP34XX, "MSP3416"}, |
259 | /* 15-19 */ | 259 | /* 15-19 */ |
260 | {AUDIO_CHIP_MSP34XX, "MSP3425"}, | 260 | {AUDIO_CHIP_MSP34XX, "MSP3425"}, |
261 | {AUDIO_CHIP_UNKNOWN, "MSP3451"}, | 261 | {AUDIO_CHIP_MSP34XX, "MSP3451"}, |
262 | {AUDIO_CHIP_UNKNOWN, "MSP3418"}, | 262 | {AUDIO_CHIP_MSP34XX, "MSP3418"}, |
263 | {AUDIO_CHIP_UNKNOWN, "Type 0x12"}, | 263 | {AUDIO_CHIP_UNKNOWN, "Type 0x12"}, |
264 | {AUDIO_CHIP_UNKNOWN, "OKI7716"}, | 264 | {AUDIO_CHIP_UNKNOWN, "OKI7716"}, |
265 | /* 20-24 */ | 265 | /* 20-24 */ |
266 | {AUDIO_CHIP_UNKNOWN, "MSP4410"}, | 266 | {AUDIO_CHIP_MSP34XX, "MSP4410"}, |
267 | {AUDIO_CHIP_UNKNOWN, "MSP4420"}, | 267 | {AUDIO_CHIP_MSP34XX, "MSP4420"}, |
268 | {AUDIO_CHIP_UNKNOWN, "MSP4440"}, | 268 | {AUDIO_CHIP_MSP34XX, "MSP4440"}, |
269 | {AUDIO_CHIP_UNKNOWN, "MSP4450"}, | 269 | {AUDIO_CHIP_MSP34XX, "MSP4450"}, |
270 | {AUDIO_CHIP_UNKNOWN, "MSP4408"}, | 270 | {AUDIO_CHIP_MSP34XX, "MSP4408"}, |
271 | /* 25-29 */ | 271 | /* 25-29 */ |
272 | {AUDIO_CHIP_UNKNOWN, "MSP4418"}, | 272 | {AUDIO_CHIP_MSP34XX, "MSP4418"}, |
273 | {AUDIO_CHIP_UNKNOWN, "MSP4428"}, | 273 | {AUDIO_CHIP_MSP34XX, "MSP4428"}, |
274 | {AUDIO_CHIP_UNKNOWN, "MSP4448"}, | 274 | {AUDIO_CHIP_MSP34XX, "MSP4448"}, |
275 | {AUDIO_CHIP_UNKNOWN, "MSP4458"}, | 275 | {AUDIO_CHIP_MSP34XX, "MSP4458"}, |
276 | {AUDIO_CHIP_UNKNOWN, "Type 0x1d"}, | 276 | {AUDIO_CHIP_MSP34XX, "Type 0x1d"}, |
277 | /* 30-34 */ | 277 | /* 30-34 */ |
278 | {AUDIO_CHIP_INTERNAL, "CX880"}, | 278 | {AUDIO_CHIP_INTERNAL, "CX880"}, |
279 | {AUDIO_CHIP_INTERNAL, "CX881"}, | 279 | {AUDIO_CHIP_INTERNAL, "CX881"}, |
diff --git a/drivers/media/video/usbvideo/Makefile b/drivers/media/video/usbvideo/Makefile new file mode 100644 index 000000000000..ed410a5ee8c9 --- /dev/null +++ b/drivers/media/video/usbvideo/Makefile | |||
@@ -0,0 +1,4 @@ | |||
1 | obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o | ||
2 | obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o | ||
3 | obj-$(CONFIG_USB_VICAM) += vicam.o usbvideo.o | ||
4 | |||
diff --git a/drivers/usb/media/ibmcam.c b/drivers/media/video/usbvideo/ibmcam.c index a42c22294124..76f771b6a32f 100644 --- a/drivers/usb/media/ibmcam.c +++ b/drivers/media/video/usbvideo/ibmcam.c | |||
@@ -1300,11 +1300,11 @@ static void ibmcam_model2_Packet1(struct uvd *uvd, unsigned short v1, unsigned s | |||
1300 | /* | 1300 | /* |
1301 | * ibmcam_model3_Packet1() | 1301 | * ibmcam_model3_Packet1() |
1302 | * | 1302 | * |
1303 | * 00_0078_012d | 1303 | * 00_0078_012d |
1304 | * 00_0097_012f | 1304 | * 00_0097_012f |
1305 | * 00_d141_0124 | 1305 | * 00_d141_0124 |
1306 | * 00_0096_0127 | 1306 | * 00_0096_0127 |
1307 | * 00_fea8_0124 | 1307 | * 00_fea8_0124 |
1308 | */ | 1308 | */ |
1309 | static void ibmcam_model3_Packet1(struct uvd *uvd, unsigned short v1, unsigned short v2) | 1309 | static void ibmcam_model3_Packet1(struct uvd *uvd, unsigned short v1, unsigned short v2) |
1310 | { | 1310 | { |
@@ -2687,7 +2687,7 @@ static void ibmcam_model4_setup_after_video_if(struct uvd *uvd) | |||
2687 | ibmcam_veio(uvd, 0, 0x0004, 0x0127); | 2687 | ibmcam_veio(uvd, 0, 0x0004, 0x0127); |
2688 | ibmcam_veio(uvd, 0, 0xfea8, 0x0124); | 2688 | ibmcam_veio(uvd, 0, 0xfea8, 0x0124); |
2689 | ibmcam_veio(uvd, 0, 0x00c0, 0x010c); | 2689 | ibmcam_veio(uvd, 0, 0x00c0, 0x010c); |
2690 | break; | 2690 | break; |
2691 | } | 2691 | } |
2692 | usb_clear_halt(uvd->dev, usb_rcvisocpipe(uvd->dev, uvd->video_endp)); | 2692 | usb_clear_halt(uvd->dev, usb_rcvisocpipe(uvd->dev, uvd->video_endp)); |
2693 | } | 2693 | } |
@@ -3238,7 +3238,7 @@ static void ibmcam_model3_setup_after_video_if(struct uvd *uvd) | |||
3238 | {0, 0x0062, 0x0107}, | 3238 | {0, 0x0062, 0x0107}, |
3239 | {0, 0x0003, 0x0111}, | 3239 | {0, 0x0003, 0x0111}, |
3240 | }; | 3240 | }; |
3241 | #define NUM_INIT_DATA | 3241 | #define NUM_INIT_DATA |
3242 | 3242 | ||
3243 | unsigned short compression = 0; /* 0=none, 7=best frame rate */ | 3243 | unsigned short compression = 0; /* 0=none, 7=best frame rate */ |
3244 | int f_rate; /* 0=Fastest 7=slowest */ | 3244 | int f_rate; /* 0=Fastest 7=slowest */ |
diff --git a/drivers/usb/media/konicawc.c b/drivers/media/video/usbvideo/konicawc.c index e2ede583518f..c11f5d46b114 100644 --- a/drivers/usb/media/konicawc.c +++ b/drivers/media/video/usbvideo/konicawc.c | |||
@@ -36,7 +36,7 @@ | |||
36 | enum ctrl_req { | 36 | enum ctrl_req { |
37 | SetWhitebal = 0x01, | 37 | SetWhitebal = 0x01, |
38 | SetBrightness = 0x02, | 38 | SetBrightness = 0x02, |
39 | SetSharpness = 0x03, | 39 | SetSharpness = 0x03, |
40 | SetContrast = 0x04, | 40 | SetContrast = 0x04, |
41 | SetSaturation = 0x05, | 41 | SetSaturation = 0x05, |
42 | }; | 42 | }; |
@@ -47,7 +47,7 @@ enum frame_sizes { | |||
47 | SIZE_160X136 = 1, | 47 | SIZE_160X136 = 1, |
48 | SIZE_176X144 = 2, | 48 | SIZE_176X144 = 2, |
49 | SIZE_320X240 = 3, | 49 | SIZE_320X240 = 3, |
50 | 50 | ||
51 | }; | 51 | }; |
52 | 52 | ||
53 | #define MAX_FRAME_SIZE SIZE_320X240 | 53 | #define MAX_FRAME_SIZE SIZE_320X240 |
@@ -69,7 +69,7 @@ static const int debug = 0; | |||
69 | /* Some default values for initial camera settings, | 69 | /* Some default values for initial camera settings, |
70 | can be set by modprobe */ | 70 | can be set by modprobe */ |
71 | 71 | ||
72 | static int size; | 72 | static int size; |
73 | static int speed = 6; /* Speed (fps) 0 (slowest) to 6 (fastest) */ | 73 | static int speed = 6; /* Speed (fps) 0 (slowest) to 6 (fastest) */ |
74 | static int brightness = MAX_BRIGHTNESS/2; | 74 | static int brightness = MAX_BRIGHTNESS/2; |
75 | static int contrast = MAX_CONTRAST/2; | 75 | static int contrast = MAX_CONTRAST/2; |
@@ -132,24 +132,24 @@ struct konicawc { | |||
132 | 132 | ||
133 | static int konicawc_ctrl_msg(struct uvd *uvd, u8 dir, u8 request, u16 value, u16 index, void *buf, int len) | 133 | static int konicawc_ctrl_msg(struct uvd *uvd, u8 dir, u8 request, u16 value, u16 index, void *buf, int len) |
134 | { | 134 | { |
135 | int retval = usb_control_msg(uvd->dev, | 135 | int retval = usb_control_msg(uvd->dev, |
136 | dir ? usb_rcvctrlpipe(uvd->dev, 0) : usb_sndctrlpipe(uvd->dev, 0), | 136 | dir ? usb_rcvctrlpipe(uvd->dev, 0) : usb_sndctrlpipe(uvd->dev, 0), |
137 | request, 0x40 | dir, value, index, buf, len, 1000); | 137 | request, 0x40 | dir, value, index, buf, len, 1000); |
138 | return retval < 0 ? retval : 0; | 138 | return retval < 0 ? retval : 0; |
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | static inline void konicawc_camera_on(struct uvd *uvd) | 142 | static inline void konicawc_camera_on(struct uvd *uvd) |
143 | { | 143 | { |
144 | DEBUG(0, "camera on"); | 144 | DEBUG(0, "camera on"); |
145 | konicawc_set_misc(uvd, 0x2, 1, 0x0b); | 145 | konicawc_set_misc(uvd, 0x2, 1, 0x0b); |
146 | } | 146 | } |
147 | 147 | ||
148 | 148 | ||
149 | static inline void konicawc_camera_off(struct uvd *uvd) | 149 | static inline void konicawc_camera_off(struct uvd *uvd) |
150 | { | 150 | { |
151 | DEBUG(0, "camera off"); | 151 | DEBUG(0, "camera off"); |
152 | konicawc_set_misc(uvd, 0x2, 0, 0x0b); | 152 | konicawc_set_misc(uvd, 0x2, 0, 0x0b); |
153 | } | 153 | } |
154 | 154 | ||
155 | 155 | ||
@@ -317,7 +317,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur | |||
317 | button = !!(sts & 0x40); | 317 | button = !!(sts & 0x40); |
318 | sts &= ~0x40; | 318 | sts &= ~0x40; |
319 | } | 319 | } |
320 | 320 | ||
321 | /* work out the button status, but don't do | 321 | /* work out the button status, but don't do |
322 | anything with it for now */ | 322 | anything with it for now */ |
323 | 323 | ||
@@ -331,7 +331,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur | |||
331 | discard++; | 331 | discard++; |
332 | continue; | 332 | continue; |
333 | } | 333 | } |
334 | 334 | ||
335 | if((sts > 0x01) && (sts < 0x80)) { | 335 | if((sts > 0x01) && (sts < 0x80)) { |
336 | info("unknown status %2.2x", sts); | 336 | info("unknown status %2.2x", sts); |
337 | bad++; | 337 | bad++; |
@@ -350,7 +350,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur | |||
350 | DEBUG(2, "found initial image"); | 350 | DEBUG(2, "found initial image"); |
351 | cam->lastframe = -1; | 351 | cam->lastframe = -1; |
352 | } | 352 | } |
353 | 353 | ||
354 | marker[3] = sts & 0x7F; | 354 | marker[3] = sts & 0x7F; |
355 | RingQueue_Enqueue(&uvd->dp, marker, 4); | 355 | RingQueue_Enqueue(&uvd->dp, marker, 4); |
356 | totlen += 4; | 356 | totlen += 4; |
@@ -367,16 +367,16 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur | |||
367 | 367 | ||
368 | static void resubmit_urb(struct uvd *uvd, struct urb *urb) | 368 | static void resubmit_urb(struct uvd *uvd, struct urb *urb) |
369 | { | 369 | { |
370 | int i, ret; | 370 | int i, ret; |
371 | for (i = 0; i < FRAMES_PER_DESC; i++) { | 371 | for (i = 0; i < FRAMES_PER_DESC; i++) { |
372 | urb->iso_frame_desc[i].status = 0; | 372 | urb->iso_frame_desc[i].status = 0; |
373 | } | 373 | } |
374 | urb->dev = uvd->dev; | 374 | urb->dev = uvd->dev; |
375 | urb->status = 0; | 375 | urb->status = 0; |
376 | ret = usb_submit_urb(urb, GFP_ATOMIC); | 376 | ret = usb_submit_urb(urb, GFP_ATOMIC); |
377 | DEBUG(3, "submitting urb of length %d", urb->transfer_buffer_length); | 377 | DEBUG(3, "submitting urb of length %d", urb->transfer_buffer_length); |
378 | if(ret) | 378 | if(ret) |
379 | err("usb_submit_urb error (%d)", ret); | 379 | err("usb_submit_urb error (%d)", ret); |
380 | 380 | ||
381 | } | 381 | } |
382 | 382 | ||
@@ -490,7 +490,7 @@ static int konicawc_start_data(struct uvd *uvd) | |||
490 | } | 490 | } |
491 | 491 | ||
492 | cam->last_data_urb = NULL; | 492 | cam->last_data_urb = NULL; |
493 | 493 | ||
494 | /* Submit all URBs */ | 494 | /* Submit all URBs */ |
495 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { | 495 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { |
496 | errFlag = usb_submit_urb(cam->sts_urb[i], GFP_KERNEL); | 496 | errFlag = usb_submit_urb(cam->sts_urb[i], GFP_KERNEL); |
@@ -539,7 +539,7 @@ static void konicawc_stop_data(struct uvd *uvd) | |||
539 | 539 | ||
540 | 540 | ||
541 | static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame) | 541 | static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame) |
542 | { | 542 | { |
543 | struct konicawc *cam = (struct konicawc *)uvd->user_data; | 543 | struct konicawc *cam = (struct konicawc *)uvd->user_data; |
544 | int maxline = cam->maxline; | 544 | int maxline = cam->maxline; |
545 | int yplanesz = cam->yplanesz; | 545 | int yplanesz = cam->yplanesz; |
@@ -583,13 +583,13 @@ static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame) | |||
583 | 583 | ||
584 | if(frame->scanstate == ScanState_Scanning) | 584 | if(frame->scanstate == ScanState_Scanning) |
585 | return; | 585 | return; |
586 | 586 | ||
587 | /* Try to move data from queue into frame buffer | 587 | /* Try to move data from queue into frame buffer |
588 | * We get data in blocks of 384 bytes made up of: | 588 | * We get data in blocks of 384 bytes made up of: |
589 | * 256 Y, 64 U, 64 V. | 589 | * 256 Y, 64 U, 64 V. |
590 | * This needs to be written out as a Y plane, a U plane and a V plane. | 590 | * This needs to be written out as a Y plane, a U plane and a V plane. |
591 | */ | 591 | */ |
592 | 592 | ||
593 | while ( frame->curline < maxline && (RingQueue_GetLength(&uvd->dp) >= 384)) { | 593 | while ( frame->curline < maxline && (RingQueue_GetLength(&uvd->dp) >= 384)) { |
594 | /* Y */ | 594 | /* Y */ |
595 | RingQueue_Dequeue(&uvd->dp, frame->data + (frame->curline * 256), 256); | 595 | RingQueue_Dequeue(&uvd->dp, frame->data + (frame->curline * 256), 256); |
diff --git a/drivers/usb/media/ultracam.c b/drivers/media/video/usbvideo/ultracam.c index 75ff755224df..10c58b4a2e5b 100644 --- a/drivers/usb/media/ultracam.c +++ b/drivers/media/video/usbvideo/ultracam.c | |||
@@ -23,7 +23,7 @@ | |||
23 | typedef struct { | 23 | typedef struct { |
24 | int initialized; /* Had we already sent init sequence? */ | 24 | int initialized; /* Had we already sent init sequence? */ |
25 | int camera_model; /* What type of IBM camera we got? */ | 25 | int camera_model; /* What type of IBM camera we got? */ |
26 | int has_hdr; | 26 | int has_hdr; |
27 | } ultracam_t; | 27 | } ultracam_t; |
28 | #define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data)) | 28 | #define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data)) |
29 | 29 | ||
diff --git a/drivers/usb/media/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c index 0b51fae720a9..13b37c8c0d56 100644 --- a/drivers/usb/media/usbvideo.c +++ b/drivers/media/video/usbvideo/usbvideo.c | |||
@@ -574,7 +574,7 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode) | |||
574 | } else { | 574 | } else { |
575 | /* Just the blue screen */ | 575 | /* Just the blue screen */ |
576 | } | 576 | } |
577 | 577 | ||
578 | *f++ = cb; | 578 | *f++ = cb; |
579 | *f++ = cg; | 579 | *f++ = cg; |
580 | *f++ = cr; | 580 | *f++ = cr; |
@@ -1243,7 +1243,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file) | |||
1243 | 1243 | ||
1244 | #if USBVIDEO_REPORT_STATS | 1244 | #if USBVIDEO_REPORT_STATS |
1245 | usbvideo_ReportStatistics(uvd); | 1245 | usbvideo_ReportStatistics(uvd); |
1246 | #endif | 1246 | #endif |
1247 | 1247 | ||
1248 | uvd->user--; | 1248 | uvd->user--; |
1249 | if (uvd->remove_pending) { | 1249 | if (uvd->remove_pending) { |
@@ -1290,7 +1290,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
1290 | return 0; | 1290 | return 0; |
1291 | } | 1291 | } |
1292 | case VIDIOCSCHAN: | 1292 | case VIDIOCSCHAN: |
1293 | { | 1293 | { |
1294 | struct video_channel *v = arg; | 1294 | struct video_channel *v = arg; |
1295 | if (v->channel != 0) | 1295 | if (v->channel != 0) |
1296 | return -EINVAL; | 1296 | return -EINVAL; |
@@ -1347,7 +1347,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
1347 | vw->chromakey = 0; | 1347 | vw->chromakey = 0; |
1348 | if (VALID_CALLBACK(uvd, getFPS)) | 1348 | if (VALID_CALLBACK(uvd, getFPS)) |
1349 | vw->flags = GET_CALLBACK(uvd, getFPS)(uvd); | 1349 | vw->flags = GET_CALLBACK(uvd, getFPS)(uvd); |
1350 | else | 1350 | else |
1351 | vw->flags = 10; /* FIXME: do better! */ | 1351 | vw->flags = 10; /* FIXME: do better! */ |
1352 | return 0; | 1352 | return 0; |
1353 | } | 1353 | } |
@@ -1359,7 +1359,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
1359 | memset(vm, 0, sizeof(*vm)); | 1359 | memset(vm, 0, sizeof(*vm)); |
1360 | vm->size = uvd->max_frame_size * USBVIDEO_NUMFRAMES; | 1360 | vm->size = uvd->max_frame_size * USBVIDEO_NUMFRAMES; |
1361 | vm->frames = USBVIDEO_NUMFRAMES; | 1361 | vm->frames = USBVIDEO_NUMFRAMES; |
1362 | for(i = 0; i < USBVIDEO_NUMFRAMES; i++) | 1362 | for(i = 0; i < USBVIDEO_NUMFRAMES; i++) |
1363 | vm->offsets[i] = i * uvd->max_frame_size; | 1363 | vm->offsets[i] = i * uvd->max_frame_size; |
1364 | 1364 | ||
1365 | return 0; | 1365 | return 0; |
@@ -1425,7 +1425,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
1425 | 1425 | ||
1426 | if (*frameNum < 0 || *frameNum >= USBVIDEO_NUMFRAMES) | 1426 | if (*frameNum < 0 || *frameNum >= USBVIDEO_NUMFRAMES) |
1427 | return -EINVAL; | 1427 | return -EINVAL; |
1428 | 1428 | ||
1429 | if (uvd->debug >= 1) | 1429 | if (uvd->debug >= 1) |
1430 | info("VIDIOCSYNC: syncing to frame %d.", *frameNum); | 1430 | info("VIDIOCSYNC: syncing to frame %d.", *frameNum); |
1431 | if (uvd->flags & FLAGS_NO_DECODING) | 1431 | if (uvd->flags & FLAGS_NO_DECODING) |
@@ -1454,8 +1454,8 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
1454 | struct video_buffer *vb = arg; | 1454 | struct video_buffer *vb = arg; |
1455 | 1455 | ||
1456 | memset(vb, 0, sizeof(*vb)); | 1456 | memset(vb, 0, sizeof(*vb)); |
1457 | return 0; | 1457 | return 0; |
1458 | } | 1458 | } |
1459 | case VIDIOCKEY: | 1459 | case VIDIOCKEY: |
1460 | return 0; | 1460 | return 0; |
1461 | 1461 | ||
@@ -1704,7 +1704,7 @@ static void usbvideo_IsocIrq(struct urb *urb, struct pt_regs *regs) | |||
1704 | info("Not streaming, but interrupt!"); | 1704 | info("Not streaming, but interrupt!"); |
1705 | return; | 1705 | return; |
1706 | } | 1706 | } |
1707 | 1707 | ||
1708 | uvd->stats.urb_count++; | 1708 | uvd->stats.urb_count++; |
1709 | if (urb->actual_length <= 0) | 1709 | if (urb->actual_length <= 0) |
1710 | goto urb_done_with; | 1710 | goto urb_done_with; |
@@ -1763,7 +1763,7 @@ static int usbvideo_StartDataPump(struct uvd *uvd) | |||
1763 | } | 1763 | } |
1764 | if (VALID_CALLBACK(uvd, videoStart)) | 1764 | if (VALID_CALLBACK(uvd, videoStart)) |
1765 | GET_CALLBACK(uvd, videoStart)(uvd); | 1765 | GET_CALLBACK(uvd, videoStart)(uvd); |
1766 | else | 1766 | else |
1767 | err("%s: videoStart not set", __FUNCTION__); | 1767 | err("%s: videoStart not set", __FUNCTION__); |
1768 | 1768 | ||
1769 | /* We double buffer the Iso lists */ | 1769 | /* We double buffer the Iso lists */ |
@@ -1830,7 +1830,7 @@ static void usbvideo_StopDataPump(struct uvd *uvd) | |||
1830 | /* Invoke minidriver's magic to stop the camera */ | 1830 | /* Invoke minidriver's magic to stop the camera */ |
1831 | if (VALID_CALLBACK(uvd, videoStop)) | 1831 | if (VALID_CALLBACK(uvd, videoStop)) |
1832 | GET_CALLBACK(uvd, videoStop)(uvd); | 1832 | GET_CALLBACK(uvd, videoStop)(uvd); |
1833 | else | 1833 | else |
1834 | err("%s: videoStop not set", __FUNCTION__); | 1834 | err("%s: videoStop not set", __FUNCTION__); |
1835 | 1835 | ||
1836 | /* Set packet size to 0 */ | 1836 | /* Set packet size to 0 */ |
@@ -1963,14 +1963,14 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
1963 | info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum); | 1963 | info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum); |
1964 | 1964 | ||
1965 | switch (frame->frameState) { | 1965 | switch (frame->frameState) { |
1966 | case FrameState_Unused: | 1966 | case FrameState_Unused: |
1967 | if (uvd->debug >= 2) | 1967 | if (uvd->debug >= 2) |
1968 | info("%s: FrameState_Unused", __FUNCTION__); | 1968 | info("%s: FrameState_Unused", __FUNCTION__); |
1969 | return -EINVAL; | 1969 | return -EINVAL; |
1970 | case FrameState_Ready: | 1970 | case FrameState_Ready: |
1971 | case FrameState_Grabbing: | 1971 | case FrameState_Grabbing: |
1972 | case FrameState_Error: | 1972 | case FrameState_Error: |
1973 | { | 1973 | { |
1974 | int ntries, signalPending; | 1974 | int ntries, signalPending; |
1975 | redo: | 1975 | redo: |
1976 | if (!CAMERA_IS_OPERATIONAL(uvd)) { | 1976 | if (!CAMERA_IS_OPERATIONAL(uvd)) { |
@@ -1978,7 +1978,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
1978 | info("%s: Camera is not operational (1)", __FUNCTION__); | 1978 | info("%s: Camera is not operational (1)", __FUNCTION__); |
1979 | return -EIO; | 1979 | return -EIO; |
1980 | } | 1980 | } |
1981 | ntries = 0; | 1981 | ntries = 0; |
1982 | do { | 1982 | do { |
1983 | RingQueue_InterruptibleSleepOn(&uvd->dp); | 1983 | RingQueue_InterruptibleSleepOn(&uvd->dp); |
1984 | signalPending = signal_pending(current); | 1984 | signalPending = signal_pending(current); |
@@ -2010,7 +2010,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
2010 | usbvideo_CollectRawData(uvd, frame); | 2010 | usbvideo_CollectRawData(uvd, frame); |
2011 | else if (VALID_CALLBACK(uvd, processData)) | 2011 | else if (VALID_CALLBACK(uvd, processData)) |
2012 | GET_CALLBACK(uvd, processData)(uvd, frame); | 2012 | GET_CALLBACK(uvd, processData)(uvd, frame); |
2013 | else | 2013 | else |
2014 | err("%s: processData not set", __FUNCTION__); | 2014 | err("%s: processData not set", __FUNCTION__); |
2015 | } | 2015 | } |
2016 | } while (frame->frameState == FrameState_Grabbing); | 2016 | } while (frame->frameState == FrameState_Grabbing); |
@@ -2027,8 +2027,8 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
2027 | goto redo; | 2027 | goto redo; |
2028 | } | 2028 | } |
2029 | /* Note that we fall through to meet our destiny below */ | 2029 | /* Note that we fall through to meet our destiny below */ |
2030 | } | 2030 | } |
2031 | case FrameState_Done: | 2031 | case FrameState_Done: |
2032 | /* | 2032 | /* |
2033 | * Do all necessary postprocessing of data prepared in | 2033 | * Do all necessary postprocessing of data prepared in |
2034 | * "interrupt" code and the collecting code above. The | 2034 | * "interrupt" code and the collecting code above. The |
@@ -2157,7 +2157,7 @@ EXPORT_SYMBOL(usbvideo_DeinterlaceFrame); | |||
2157 | * History: | 2157 | * History: |
2158 | * 09-Feb-2001 Created. | 2158 | * 09-Feb-2001 Created. |
2159 | */ | 2159 | */ |
2160 | static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, | 2160 | static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, |
2161 | struct usbvideo_frame *frame) | 2161 | struct usbvideo_frame *frame) |
2162 | { | 2162 | { |
2163 | int i, j, v4l_linesize; | 2163 | int i, j, v4l_linesize; |
diff --git a/drivers/usb/media/usbvideo.h b/drivers/media/video/usbvideo/usbvideo.h index 135433c2680a..3cbf4fc499a3 100644 --- a/drivers/usb/media/usbvideo.h +++ b/drivers/media/video/usbvideo/usbvideo.h | |||
@@ -189,11 +189,11 @@ struct usbvideo_frame { | |||
189 | 189 | ||
190 | /* Statistics that can be overlaid on screen */ | 190 | /* Statistics that can be overlaid on screen */ |
191 | struct usbvideo_statistics { | 191 | struct usbvideo_statistics { |
192 | unsigned long frame_num; /* Sequential number of the frame */ | 192 | unsigned long frame_num; /* Sequential number of the frame */ |
193 | unsigned long urb_count; /* How many URBs we received so far */ | 193 | unsigned long urb_count; /* How many URBs we received so far */ |
194 | unsigned long urb_length; /* Length of last URB */ | 194 | unsigned long urb_length; /* Length of last URB */ |
195 | unsigned long data_count; /* How many bytes we received */ | 195 | unsigned long data_count; /* How many bytes we received */ |
196 | unsigned long header_count; /* How many frame headers we found */ | 196 | unsigned long header_count; /* How many frame headers we found */ |
197 | unsigned long iso_skip_count; /* How many empty ISO packets received */ | 197 | unsigned long iso_skip_count; /* How many empty ISO packets received */ |
198 | unsigned long iso_err_count; /* How many bad ISO packets received */ | 198 | unsigned long iso_err_count; /* How many bad ISO packets received */ |
199 | }; | 199 | }; |
diff --git a/drivers/usb/media/vicam.c b/drivers/media/video/usbvideo/vicam.c index 1d06e53ec7c5..90d48e8510ba 100644 --- a/drivers/usb/media/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -69,10 +69,10 @@ | |||
69 | #define VICAM_HEADER_SIZE 64 | 69 | #define VICAM_HEADER_SIZE 64 |
70 | 70 | ||
71 | #define clamp( x, l, h ) max_t( __typeof__( x ), \ | 71 | #define clamp( x, l, h ) max_t( __typeof__( x ), \ |
72 | ( l ), \ | 72 | ( l ), \ |
73 | min_t( __typeof__( x ), \ | 73 | min_t( __typeof__( x ), \ |
74 | ( h ), \ | 74 | ( h ), \ |
75 | ( x ) ) ) | 75 | ( x ) ) ) |
76 | 76 | ||
77 | /* Not sure what all the bytes in these char | 77 | /* Not sure what all the bytes in these char |
78 | * arrays do, but they're necessary to make | 78 | * arrays do, but they're necessary to make |
@@ -357,7 +357,7 @@ static unsigned char setup5[] = { | |||
357 | * Not sure why these are not yet non-statics which I can reference through | 357 | * Not sure why these are not yet non-statics which I can reference through |
358 | * usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime | 358 | * usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime |
359 | * in the future. | 359 | * in the future. |
360 | * | 360 | * |
361 | */ | 361 | */ |
362 | static void *rvmalloc(unsigned long size) | 362 | static void *rvmalloc(unsigned long size) |
363 | { | 363 | { |
@@ -603,12 +603,12 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign | |||
603 | case VIDIOCSPICT: | 603 | case VIDIOCSPICT: |
604 | { | 604 | { |
605 | struct video_picture vp; | 605 | struct video_picture vp; |
606 | 606 | ||
607 | if (copy_from_user(&vp, user_arg, sizeof(vp))) { | 607 | if (copy_from_user(&vp, user_arg, sizeof(vp))) { |
608 | retval = -EFAULT; | 608 | retval = -EFAULT; |
609 | break; | 609 | break; |
610 | } | 610 | } |
611 | 611 | ||
612 | DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth, | 612 | DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth, |
613 | vp.palette); | 613 | vp.palette); |
614 | 614 | ||
@@ -655,7 +655,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign | |||
655 | } | 655 | } |
656 | 656 | ||
657 | DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height); | 657 | DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height); |
658 | 658 | ||
659 | if ( vw.width != 320 || vw.height != 240 ) | 659 | if ( vw.width != 320 || vw.height != 240 ) |
660 | retval = -EFAULT; | 660 | retval = -EFAULT; |
661 | 661 | ||
@@ -809,12 +809,12 @@ vicam_open(struct inode *inode, struct file *file) | |||
809 | cam->needsDummyRead = 1; | 809 | cam->needsDummyRead = 1; |
810 | cam->open_count++; | 810 | cam->open_count++; |
811 | 811 | ||
812 | file->private_data = cam; | 812 | file->private_data = cam; |
813 | 813 | ||
814 | return 0; | 814 | return 0; |
815 | } | 815 | } |
816 | 816 | ||
817 | static int | 817 | static int |
818 | vicam_close(struct inode *inode, struct file *file) | 818 | vicam_close(struct inode *inode, struct file *file) |
819 | { | 819 | { |
820 | struct vicam_camera *cam = file->private_data; | 820 | struct vicam_camera *cam = file->private_data; |
@@ -1187,7 +1187,7 @@ vicam_create_proc_entry(struct vicam_camera *cam) | |||
1187 | 1187 | ||
1188 | if ( !cam->proc_dir ) | 1188 | if ( !cam->proc_dir ) |
1189 | return; // FIXME: We should probably return an error here | 1189 | return; // FIXME: We should probably return an error here |
1190 | 1190 | ||
1191 | ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR, | 1191 | ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR, |
1192 | cam->proc_dir); | 1192 | cam->proc_dir); |
1193 | if (ent) { | 1193 | if (ent) { |
@@ -1282,7 +1282,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) | |||
1282 | const struct usb_host_interface *interface; | 1282 | const struct usb_host_interface *interface; |
1283 | const struct usb_endpoint_descriptor *endpoint; | 1283 | const struct usb_endpoint_descriptor *endpoint; |
1284 | struct vicam_camera *cam; | 1284 | struct vicam_camera *cam; |
1285 | 1285 | ||
1286 | printk(KERN_INFO "ViCam based webcam connected\n"); | 1286 | printk(KERN_INFO "ViCam based webcam connected\n"); |
1287 | 1287 | ||
1288 | interface = intf->cur_altsetting; | 1288 | interface = intf->cur_altsetting; |
@@ -1331,7 +1331,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) | |||
1331 | printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); | 1331 | printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); |
1332 | 1332 | ||
1333 | usb_set_intfdata (intf, cam); | 1333 | usb_set_intfdata (intf, cam); |
1334 | 1334 | ||
1335 | return 0; | 1335 | return 0; |
1336 | } | 1336 | } |
1337 | 1337 | ||
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 95a6e47c99f1..11a97f30b876 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -312,8 +312,6 @@ static const char *v4l2_int_ioctls[] = { | |||
312 | [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP", | 312 | [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP", |
313 | #endif | 313 | #endif |
314 | [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", | 314 | [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", |
315 | [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT", | ||
316 | [_IOC_NR(MSP_SET_MATRIX)] = "MSP_SET_MATRIX", | ||
317 | 315 | ||
318 | [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", | 316 | [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", |
319 | [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", | 317 | [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", |
@@ -419,7 +417,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
419 | case TUNER_SET_TYPE_ADDR: | 417 | case TUNER_SET_TYPE_ADDR: |
420 | case TUNER_SET_STANDBY: | 418 | case TUNER_SET_STANDBY: |
421 | case TDA9887_SET_CONFIG: | 419 | case TDA9887_SET_CONFIG: |
422 | case AUDC_SET_INPUT: | ||
423 | case VIDIOC_OVERLAY_OLD: | 420 | case VIDIOC_OVERLAY_OLD: |
424 | case VIDIOC_STREAMOFF: | 421 | case VIDIOC_STREAMOFF: |
425 | case VIDIOC_G_OUTPUT: | 422 | case VIDIOC_G_OUTPUT: |
@@ -433,12 +430,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
433 | printk ("%s: value=%d\n", s, *p); | 430 | printk ("%s: value=%d\n", s, *p); |
434 | break; | 431 | break; |
435 | } | 432 | } |
436 | case MSP_SET_MATRIX: | ||
437 | { | ||
438 | struct msp_matrix *p=arg; | ||
439 | printk ("%s: input=%d, output=%d\n", s, p->input, p->output); | ||
440 | break; | ||
441 | } | ||
442 | case VIDIOC_G_AUDIO: | 433 | case VIDIOC_G_AUDIO: |
443 | case VIDIOC_S_AUDIO: | 434 | case VIDIOC_S_AUDIO: |
444 | case VIDIOC_ENUMAUDIO: | 435 | case VIDIOC_ENUMAUDIO: |
@@ -467,7 +458,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
467 | struct v4l2_buffer *p=arg; | 458 | struct v4l2_buffer *p=arg; |
468 | struct v4l2_timecode *tc=&p->timecode; | 459 | struct v4l2_timecode *tc=&p->timecode; |
469 | printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%s, " | 460 | printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%s, " |
470 | "bytesused=%d, flags=0x%08d, " | 461 | "bytesused=%d, flags=0x%08x, " |
471 | "field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx\n", | 462 | "field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx\n", |
472 | s, | 463 | s, |
473 | (p->timestamp.tv_sec/3600), | 464 | (p->timestamp.tv_sec/3600), |
@@ -481,16 +472,16 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
481 | prt_names(p->memory,v4l2_memory_names), | 472 | prt_names(p->memory,v4l2_memory_names), |
482 | p->m.userptr); | 473 | p->m.userptr); |
483 | printk ("%s: timecode= %02d:%02d:%02d type=%d, " | 474 | printk ("%s: timecode= %02d:%02d:%02d type=%d, " |
484 | "flags=0x%08d, frames=%d, userbits=0x%08x", | 475 | "flags=0x%08x, frames=%d, userbits=0x%p\n", |
485 | s,tc->hours,tc->minutes,tc->seconds, | 476 | s,tc->hours,tc->minutes,tc->seconds, |
486 | tc->type, tc->flags, tc->frames, (__u32) tc->userbits); | 477 | tc->type, tc->flags, tc->frames, tc->userbits); |
487 | break; | 478 | break; |
488 | } | 479 | } |
489 | case VIDIOC_QUERYCAP: | 480 | case VIDIOC_QUERYCAP: |
490 | { | 481 | { |
491 | struct v4l2_capability *p=arg; | 482 | struct v4l2_capability *p=arg; |
492 | printk ("%s: driver=%s, card=%s, bus=%s, version=%d, " | 483 | printk ("%s: driver=%s, card=%s, bus=%s, version=0x%08x, " |
493 | "capabilities=%d\n", s, | 484 | "capabilities=0x%08x\n", s, |
494 | p->driver,p->card,p->bus_info, | 485 | p->driver,p->card,p->bus_info, |
495 | p->version, | 486 | p->version, |
496 | p->capabilities); | 487 | p->capabilities); |
@@ -574,9 +565,10 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
574 | { | 565 | { |
575 | struct v4l2_input *p=arg; | 566 | struct v4l2_input *p=arg; |
576 | printk ("%s: index=%d, name=%s, type=%d, audioset=%d, " | 567 | printk ("%s: index=%d, name=%s, type=%d, audioset=%d, " |
577 | "tuner=%d, std=%lld, status=%d\n", s, | 568 | "tuner=%d, std=%Ld, status=%d\n", s, |
578 | p->index,p->name,p->type,p->audioset, | 569 | p->index,p->name,p->type,p->audioset, |
579 | p->tuner,p->std, | 570 | p->tuner, |
571 | (unsigned long long)p->std, | ||
580 | p->status); | 572 | p->status); |
581 | break; | 573 | break; |
582 | } | 574 | } |
@@ -620,9 +612,10 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
620 | { | 612 | { |
621 | struct v4l2_output *p=arg; | 613 | struct v4l2_output *p=arg; |
622 | printk ("%s: index=%d, name=%s,type=%d, audioset=%d, " | 614 | printk ("%s: index=%d, name=%s,type=%d, audioset=%d, " |
623 | "modulator=%d, std=%lld\n", | 615 | "modulator=%d, std=%Ld\n", |
624 | s,p->index,p->name,p->type,p->audioset, | 616 | s,p->index,p->name,p->type,p->audioset, |
625 | p->modulator,p->std); | 617 | p->modulator, |
618 | (unsigned long long)p->std); | ||
626 | break; | 619 | break; |
627 | } | 620 | } |
628 | case VIDIOC_QUERYCTRL: | 621 | case VIDIOC_QUERYCTRL: |
@@ -665,7 +658,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
665 | case VIDIOC_INT_G_VIDEO_ROUTING: | 658 | case VIDIOC_INT_G_VIDEO_ROUTING: |
666 | { | 659 | { |
667 | struct v4l2_routing *p=arg; | 660 | struct v4l2_routing *p=arg; |
668 | printk ("%s: input=%d, output=%d\n", s, p->input, p->output); | 661 | printk ("%s: input=0x%x, output=0x%x\n", s, p->input, p->output); |
669 | break; | 662 | break; |
670 | } | 663 | } |
671 | case VIDIOC_G_SLICED_VBI_CAP: | 664 | case VIDIOC_G_SLICED_VBI_CAP: |
@@ -686,8 +679,9 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
686 | case VIDIOC_ENUMSTD: | 679 | case VIDIOC_ENUMSTD: |
687 | { | 680 | { |
688 | struct v4l2_standard *p=arg; | 681 | struct v4l2_standard *p=arg; |
689 | printk ("%s: index=%d, id=%lld, name=%s, fps=%d/%d, framelines=%d\n", s, | 682 | printk ("%s: index=%d, id=%Ld, name=%s, fps=%d/%d, " |
690 | p->index, p->id, p->name, | 683 | "framelines=%d\n", s, p->index, |
684 | (unsigned long long)p->id, p->name, | ||
691 | p->frameperiod.numerator, | 685 | p->frameperiod.numerator, |
692 | p->frameperiod.denominator, | 686 | p->frameperiod.denominator, |
693 | p->framelines); | 687 | p->framelines); |
@@ -907,7 +901,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
907 | { | 901 | { |
908 | v4l2_std_id *p=arg; | 902 | v4l2_std_id *p=arg; |
909 | 903 | ||
910 | printk ("%s: value=%llu\n", s, *p); | 904 | printk ("%s: value=%Lu\n", s, (unsigned long long)*p); |
911 | break; | 905 | break; |
912 | } | 906 | } |
913 | } | 907 | } |
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index 87e937581d5a..d2ca0f08d0df 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c | |||
@@ -1,15 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * generic helper functions for video4linux capture buffers, to handle | 3 | * generic helper functions for video4linux capture buffers, to handle |
4 | * memory management and PCI DMA. Right now bttv + saa7134 use it. | 4 | * memory management and PCI DMA. |
5 | * Right now, bttv, saa7134, saa7146 and cx88 use it. | ||
5 | * | 6 | * |
6 | * The functions expect the hardware being able to scatter gatter | 7 | * The functions expect the hardware being able to scatter gatter |
7 | * (i.e. the buffers are not linear in physical memory, but fragmented | 8 | * (i.e. the buffers are not linear in physical memory, but fragmented |
8 | * into PAGE_SIZE chunks). They also assume the driver does not need | 9 | * into PAGE_SIZE chunks). They also assume the driver does not need |
9 | * to touch the video data (thus it is probably not useful for USB 1.1 | 10 | * to touch the video data. |
10 | * as data often must be uncompressed by the drivers). | 11 | * |
12 | * device specific map/unmap/sync stuff now are mapped as operations | ||
13 | * to allow its usage by USB and virtual devices. | ||
11 | * | 14 | * |
12 | * (c) 2001-2004 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs] | 15 | * (c) 2001-2004 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs] |
16 | * (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> | ||
17 | * (c) 2006 Ted Walther and John Sokol | ||
13 | * | 18 | * |
14 | * This program is free software; you can redistribute it and/or modify | 19 | * This program is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by | 20 | * it under the terms of the GNU General Public License as published by |
@@ -167,6 +172,9 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, | |||
167 | dprintk(1,"vmalloc_32(%d pages) failed\n",nr_pages); | 172 | dprintk(1,"vmalloc_32(%d pages) failed\n",nr_pages); |
168 | return -ENOMEM; | 173 | return -ENOMEM; |
169 | } | 174 | } |
175 | dprintk(1,"vmalloc is at addr 0x%08lx, size=%d\n", | ||
176 | (unsigned long)dma->vmalloc, | ||
177 | nr_pages << PAGE_SHIFT); | ||
170 | memset(dma->vmalloc,0,nr_pages << PAGE_SHIFT); | 178 | memset(dma->vmalloc,0,nr_pages << PAGE_SHIFT); |
171 | dma->nr_pages = nr_pages; | 179 | dma->nr_pages = nr_pages; |
172 | return 0; | 180 | return 0; |
@@ -186,8 +194,10 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | |||
186 | return 0; | 194 | return 0; |
187 | } | 195 | } |
188 | 196 | ||
189 | int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) | 197 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) |
190 | { | 198 | { |
199 | void *dev=q->dev; | ||
200 | |||
191 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 201 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
192 | BUG_ON(0 == dma->nr_pages); | 202 | BUG_ON(0 == dma->nr_pages); |
193 | 203 | ||
@@ -197,7 +207,7 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) | |||
197 | } | 207 | } |
198 | if (dma->vmalloc) { | 208 | if (dma->vmalloc) { |
199 | dma->sglist = videobuf_vmalloc_to_sg | 209 | dma->sglist = videobuf_vmalloc_to_sg |
200 | (dma->vmalloc,dma->nr_pages); | 210 | (dma->vmalloc,dma->nr_pages); |
201 | } | 211 | } |
202 | if (dma->bus_addr) { | 212 | if (dma->bus_addr) { |
203 | dma->sglist = kmalloc(sizeof(struct scatterlist), GFP_KERNEL); | 213 | dma->sglist = kmalloc(sizeof(struct scatterlist), GFP_KERNEL); |
@@ -212,13 +222,14 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) | |||
212 | dprintk(1,"scatterlist is NULL\n"); | 222 | dprintk(1,"scatterlist is NULL\n"); |
213 | return -ENOMEM; | 223 | return -ENOMEM; |
214 | } | 224 | } |
215 | |||
216 | if (!dma->bus_addr) { | 225 | if (!dma->bus_addr) { |
217 | dma->sglen = pci_map_sg(dev,dma->sglist,dma->nr_pages, | 226 | if (q->ops->vb_map_sg) { |
218 | dma->direction); | 227 | dma->sglen = q->ops->vb_map_sg(dev,dma->sglist, |
228 | dma->nr_pages, dma->direction); | ||
229 | } | ||
219 | if (0 == dma->sglen) { | 230 | if (0 == dma->sglen) { |
220 | printk(KERN_WARNING | 231 | printk(KERN_WARNING |
221 | "%s: pci_map_sg failed\n",__FUNCTION__); | 232 | "%s: videobuf_map_sg failed\n",__FUNCTION__); |
222 | kfree(dma->sglist); | 233 | kfree(dma->sglist); |
223 | dma->sglist = NULL; | 234 | dma->sglist = NULL; |
224 | dma->sglen = 0; | 235 | dma->sglen = 0; |
@@ -228,24 +239,31 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) | |||
228 | return 0; | 239 | return 0; |
229 | } | 240 | } |
230 | 241 | ||
231 | int videobuf_dma_pci_sync(struct pci_dev *dev, struct videobuf_dmabuf *dma) | 242 | int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma) |
232 | { | 243 | { |
244 | void *dev=q->dev; | ||
245 | |||
233 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 246 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
234 | BUG_ON(!dma->sglen); | 247 | BUG_ON(!dma->sglen); |
235 | 248 | ||
236 | if (!dma->bus_addr) | 249 | if (!dma->bus_addr && q->ops->vb_dma_sync_sg) |
237 | pci_dma_sync_sg_for_cpu(dev,dma->sglist,dma->nr_pages,dma->direction); | 250 | q->ops->vb_dma_sync_sg(dev,dma->sglist,dma->nr_pages, |
251 | dma->direction); | ||
252 | |||
238 | return 0; | 253 | return 0; |
239 | } | 254 | } |
240 | 255 | ||
241 | int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma) | 256 | int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma) |
242 | { | 257 | { |
258 | void *dev=q->dev; | ||
259 | |||
243 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 260 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
244 | if (!dma->sglen) | 261 | if (!dma->sglen) |
245 | return 0; | 262 | return 0; |
246 | 263 | ||
247 | if (!dma->bus_addr) | 264 | if (!dma->bus_addr && q->ops->vb_unmap_sg) |
248 | pci_unmap_sg(dev,dma->sglist,dma->nr_pages,dma->direction); | 265 | q->ops->vb_unmap_sg(dev,dma->sglist,dma->nr_pages, |
266 | dma->direction); | ||
249 | kfree(dma->sglist); | 267 | kfree(dma->sglist); |
250 | dma->sglist = NULL; | 268 | dma->sglist = NULL; |
251 | dma->sglen = 0; | 269 | dma->sglen = 0; |
@@ -318,7 +336,7 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr) | |||
318 | } | 336 | } |
319 | 337 | ||
320 | int | 338 | int |
321 | videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, | 339 | videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, |
322 | struct v4l2_framebuffer *fbuf) | 340 | struct v4l2_framebuffer *fbuf) |
323 | { | 341 | { |
324 | int err,pages; | 342 | int err,pages; |
@@ -357,7 +375,7 @@ videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, | |||
357 | default: | 375 | default: |
358 | BUG(); | 376 | BUG(); |
359 | } | 377 | } |
360 | err = videobuf_dma_pci_map(pci,&vb->dma); | 378 | err = videobuf_dma_map(q,&vb->dma); |
361 | if (0 != err) | 379 | if (0 != err) |
362 | return err; | 380 | return err; |
363 | 381 | ||
@@ -366,9 +384,41 @@ videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, | |||
366 | 384 | ||
367 | /* --------------------------------------------------------------------- */ | 385 | /* --------------------------------------------------------------------- */ |
368 | 386 | ||
387 | void videobuf_queue_pci(struct videobuf_queue* q) | ||
388 | { | ||
389 | /* If not specified, defaults to PCI map sg */ | ||
390 | if (!q->ops->vb_map_sg) | ||
391 | q->ops->vb_map_sg=(vb_map_sg_t *)pci_map_sg; | ||
392 | |||
393 | if (!q->ops->vb_dma_sync_sg) | ||
394 | q->ops->vb_dma_sync_sg=(vb_map_sg_t *)pci_dma_sync_sg_for_cpu; | ||
395 | if (!q->ops->vb_unmap_sg) | ||
396 | q->ops->vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
397 | } | ||
398 | |||
399 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma) | ||
400 | { | ||
401 | struct videobuf_queue q; | ||
402 | |||
403 | q.dev=pci; | ||
404 | q.ops->vb_map_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
405 | |||
406 | return (videobuf_dma_unmap(&q,dma)); | ||
407 | } | ||
408 | |||
409 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma) | ||
410 | { | ||
411 | struct videobuf_queue q; | ||
412 | |||
413 | q.dev=pci; | ||
414 | q.ops->vb_map_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
415 | |||
416 | return (videobuf_dma_unmap(&q,dma)); | ||
417 | } | ||
418 | |||
369 | void videobuf_queue_init(struct videobuf_queue* q, | 419 | void videobuf_queue_init(struct videobuf_queue* q, |
370 | struct videobuf_queue_ops *ops, | 420 | struct videobuf_queue_ops *ops, |
371 | struct pci_dev *pci, | 421 | void *dev, |
372 | spinlock_t *irqlock, | 422 | spinlock_t *irqlock, |
373 | enum v4l2_buf_type type, | 423 | enum v4l2_buf_type type, |
374 | enum v4l2_field field, | 424 | enum v4l2_field field, |
@@ -377,13 +427,15 @@ void videobuf_queue_init(struct videobuf_queue* q, | |||
377 | { | 427 | { |
378 | memset(q,0,sizeof(*q)); | 428 | memset(q,0,sizeof(*q)); |
379 | q->irqlock = irqlock; | 429 | q->irqlock = irqlock; |
380 | q->pci = pci; | 430 | q->dev = dev; |
381 | q->type = type; | 431 | q->type = type; |
382 | q->field = field; | 432 | q->field = field; |
383 | q->msize = msize; | 433 | q->msize = msize; |
384 | q->ops = ops; | 434 | q->ops = ops; |
385 | q->priv_data = priv; | 435 | q->priv_data = priv; |
386 | 436 | ||
437 | videobuf_queue_pci(q); | ||
438 | |||
387 | mutex_init(&q->lock); | 439 | mutex_init(&q->lock); |
388 | INIT_LIST_HEAD(&q->stream); | 440 | INIT_LIST_HEAD(&q->stream); |
389 | } | 441 | } |
@@ -431,7 +483,8 @@ videobuf_queue_cancel(struct videobuf_queue *q) | |||
431 | int i; | 483 | int i; |
432 | 484 | ||
433 | /* remove queued buffers from list */ | 485 | /* remove queued buffers from list */ |
434 | spin_lock_irqsave(q->irqlock,flags); | 486 | if (q->irqlock) |
487 | spin_lock_irqsave(q->irqlock,flags); | ||
435 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 488 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
436 | if (NULL == q->bufs[i]) | 489 | if (NULL == q->bufs[i]) |
437 | continue; | 490 | continue; |
@@ -440,7 +493,8 @@ videobuf_queue_cancel(struct videobuf_queue *q) | |||
440 | q->bufs[i]->state = STATE_ERROR; | 493 | q->bufs[i]->state = STATE_ERROR; |
441 | } | 494 | } |
442 | } | 495 | } |
443 | spin_unlock_irqrestore(q->irqlock,flags); | 496 | if (q->irqlock) |
497 | spin_unlock_irqrestore(q->irqlock,flags); | ||
444 | 498 | ||
445 | /* free all buffers + clear queue */ | 499 | /* free all buffers + clear queue */ |
446 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 500 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
@@ -534,19 +588,29 @@ videobuf_reqbufs(struct videobuf_queue *q, | |||
534 | unsigned int size,count; | 588 | unsigned int size,count; |
535 | int retval; | 589 | int retval; |
536 | 590 | ||
537 | if (req->type != q->type) | 591 | if (req->type != q->type) { |
592 | dprintk(1,"reqbufs: queue type invalid\n"); | ||
538 | return -EINVAL; | 593 | return -EINVAL; |
539 | if (req->count < 1) | 594 | } |
595 | if (req->count < 1) { | ||
596 | dprintk(1,"reqbufs: count invalid (%d)\n",req->count); | ||
540 | return -EINVAL; | 597 | return -EINVAL; |
598 | } | ||
541 | if (req->memory != V4L2_MEMORY_MMAP && | 599 | if (req->memory != V4L2_MEMORY_MMAP && |
542 | req->memory != V4L2_MEMORY_USERPTR && | 600 | req->memory != V4L2_MEMORY_USERPTR && |
543 | req->memory != V4L2_MEMORY_OVERLAY) | 601 | req->memory != V4L2_MEMORY_OVERLAY) { |
602 | dprintk(1,"reqbufs: memory type invalid\n"); | ||
544 | return -EINVAL; | 603 | return -EINVAL; |
604 | } | ||
545 | 605 | ||
546 | if (q->streaming) | 606 | if (q->streaming) { |
607 | dprintk(1,"reqbufs: streaming already exists\n"); | ||
547 | return -EBUSY; | 608 | return -EBUSY; |
548 | if (!list_empty(&q->stream)) | 609 | } |
610 | if (!list_empty(&q->stream)) { | ||
611 | dprintk(1,"reqbufs: stream running\n"); | ||
549 | return -EBUSY; | 612 | return -EBUSY; |
613 | } | ||
550 | 614 | ||
551 | mutex_lock(&q->lock); | 615 | mutex_lock(&q->lock); |
552 | count = req->count; | 616 | count = req->count; |
@@ -559,8 +623,10 @@ videobuf_reqbufs(struct videobuf_queue *q, | |||
559 | count, size, (count*size)>>PAGE_SHIFT); | 623 | count, size, (count*size)>>PAGE_SHIFT); |
560 | 624 | ||
561 | retval = videobuf_mmap_setup(q,count,size,req->memory); | 625 | retval = videobuf_mmap_setup(q,count,size,req->memory); |
562 | if (retval < 0) | 626 | if (retval < 0) { |
627 | dprintk(1,"reqbufs: mmap setup returned %d\n",retval); | ||
563 | goto done; | 628 | goto done; |
629 | } | ||
564 | 630 | ||
565 | req->count = count; | 631 | req->count = count; |
566 | 632 | ||
@@ -572,12 +638,18 @@ videobuf_reqbufs(struct videobuf_queue *q, | |||
572 | int | 638 | int |
573 | videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) | 639 | videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) |
574 | { | 640 | { |
575 | if (unlikely(b->type != q->type)) | 641 | if (unlikely(b->type != q->type)) { |
642 | dprintk(1,"querybuf: Wrong type.\n"); | ||
576 | return -EINVAL; | 643 | return -EINVAL; |
577 | if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) | 644 | } |
645 | if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) { | ||
646 | dprintk(1,"querybuf: index out of range.\n"); | ||
578 | return -EINVAL; | 647 | return -EINVAL; |
579 | if (unlikely(NULL == q->bufs[b->index])) | 648 | } |
649 | if (unlikely(NULL == q->bufs[b->index])) { | ||
650 | dprintk(1,"querybuf: buffer is null.\n"); | ||
580 | return -EINVAL; | 651 | return -EINVAL; |
652 | } | ||
581 | videobuf_status(b,q->bufs[b->index],q->type); | 653 | videobuf_status(b,q->bufs[b->index],q->type); |
582 | return 0; | 654 | return 0; |
583 | } | 655 | } |
@@ -593,26 +665,40 @@ videobuf_qbuf(struct videobuf_queue *q, | |||
593 | 665 | ||
594 | mutex_lock(&q->lock); | 666 | mutex_lock(&q->lock); |
595 | retval = -EBUSY; | 667 | retval = -EBUSY; |
596 | if (q->reading) | 668 | if (q->reading) { |
669 | dprintk(1,"qbuf: Reading running...\n"); | ||
597 | goto done; | 670 | goto done; |
671 | } | ||
598 | retval = -EINVAL; | 672 | retval = -EINVAL; |
599 | if (b->type != q->type) | 673 | if (b->type != q->type) { |
674 | dprintk(1,"qbuf: Wrong type.\n"); | ||
600 | goto done; | 675 | goto done; |
601 | if (b->index < 0 || b->index >= VIDEO_MAX_FRAME) | 676 | } |
677 | if (b->index < 0 || b->index >= VIDEO_MAX_FRAME) { | ||
678 | dprintk(1,"qbuf: index out of range.\n"); | ||
602 | goto done; | 679 | goto done; |
680 | } | ||
603 | buf = q->bufs[b->index]; | 681 | buf = q->bufs[b->index]; |
604 | if (NULL == buf) | 682 | if (NULL == buf) { |
683 | dprintk(1,"qbuf: buffer is null.\n"); | ||
605 | goto done; | 684 | goto done; |
685 | } | ||
606 | MAGIC_CHECK(buf->magic,MAGIC_BUFFER); | 686 | MAGIC_CHECK(buf->magic,MAGIC_BUFFER); |
607 | if (buf->memory != b->memory) | 687 | if (buf->memory != b->memory) { |
688 | dprintk(1,"qbuf: memory type is wrong.\n"); | ||
608 | goto done; | 689 | goto done; |
690 | } | ||
609 | if (buf->state == STATE_QUEUED || | 691 | if (buf->state == STATE_QUEUED || |
610 | buf->state == STATE_ACTIVE) | 692 | buf->state == STATE_ACTIVE) { |
693 | dprintk(1,"qbuf: buffer is already queued or active.\n"); | ||
611 | goto done; | 694 | goto done; |
695 | } | ||
612 | 696 | ||
613 | if (b->flags & V4L2_BUF_FLAG_INPUT) { | 697 | if (b->flags & V4L2_BUF_FLAG_INPUT) { |
614 | if (b->input >= q->inputs) | 698 | if (b->input >= q->inputs) { |
699 | dprintk(1,"qbuf: wrong input.\n"); | ||
615 | goto done; | 700 | goto done; |
701 | } | ||
616 | buf->input = b->input; | 702 | buf->input = b->input; |
617 | } else { | 703 | } else { |
618 | buf->input = UNSET; | 704 | buf->input = UNSET; |
@@ -620,12 +706,16 @@ videobuf_qbuf(struct videobuf_queue *q, | |||
620 | 706 | ||
621 | switch (b->memory) { | 707 | switch (b->memory) { |
622 | case V4L2_MEMORY_MMAP: | 708 | case V4L2_MEMORY_MMAP: |
623 | if (0 == buf->baddr) | 709 | if (0 == buf->baddr) { |
710 | dprintk(1,"qbuf: mmap requested but buffer addr is zero!\n"); | ||
624 | goto done; | 711 | goto done; |
712 | } | ||
625 | break; | 713 | break; |
626 | case V4L2_MEMORY_USERPTR: | 714 | case V4L2_MEMORY_USERPTR: |
627 | if (b->length < buf->bsize) | 715 | if (b->length < buf->bsize) { |
716 | dprintk(1,"qbuf: buffer length is not enough\n"); | ||
628 | goto done; | 717 | goto done; |
718 | } | ||
629 | if (STATE_NEEDS_INIT != buf->state && buf->baddr != b->m.userptr) | 719 | if (STATE_NEEDS_INIT != buf->state && buf->baddr != b->m.userptr) |
630 | q->ops->buf_release(q,buf); | 720 | q->ops->buf_release(q,buf); |
631 | buf->baddr = b->m.userptr; | 721 | buf->baddr = b->m.userptr; |
@@ -634,20 +724,27 @@ videobuf_qbuf(struct videobuf_queue *q, | |||
634 | buf->boff = b->m.offset; | 724 | buf->boff = b->m.offset; |
635 | break; | 725 | break; |
636 | default: | 726 | default: |
727 | dprintk(1,"qbuf: wrong memory type\n"); | ||
637 | goto done; | 728 | goto done; |
638 | } | 729 | } |
639 | 730 | ||
731 | dprintk(1,"qbuf: requesting next field\n"); | ||
640 | field = videobuf_next_field(q); | 732 | field = videobuf_next_field(q); |
641 | retval = q->ops->buf_prepare(q,buf,field); | 733 | retval = q->ops->buf_prepare(q,buf,field); |
642 | if (0 != retval) | 734 | if (0 != retval) { |
735 | dprintk(1,"qbuf: buffer_prepare returned %d\n",retval); | ||
643 | goto done; | 736 | goto done; |
737 | } | ||
644 | 738 | ||
645 | list_add_tail(&buf->stream,&q->stream); | 739 | list_add_tail(&buf->stream,&q->stream); |
646 | if (q->streaming) { | 740 | if (q->streaming) { |
647 | spin_lock_irqsave(q->irqlock,flags); | 741 | if (q->irqlock) |
742 | spin_lock_irqsave(q->irqlock,flags); | ||
648 | q->ops->buf_queue(q,buf); | 743 | q->ops->buf_queue(q,buf); |
649 | spin_unlock_irqrestore(q->irqlock,flags); | 744 | if (q->irqlock) |
745 | spin_unlock_irqrestore(q->irqlock,flags); | ||
650 | } | 746 | } |
747 | dprintk(1,"qbuf: succeded\n"); | ||
651 | retval = 0; | 748 | retval = 0; |
652 | 749 | ||
653 | done: | 750 | done: |
@@ -664,26 +761,39 @@ videobuf_dqbuf(struct videobuf_queue *q, | |||
664 | 761 | ||
665 | mutex_lock(&q->lock); | 762 | mutex_lock(&q->lock); |
666 | retval = -EBUSY; | 763 | retval = -EBUSY; |
667 | if (q->reading) | 764 | if (q->reading) { |
765 | dprintk(1,"dqbuf: Reading running...\n"); | ||
668 | goto done; | 766 | goto done; |
767 | } | ||
669 | retval = -EINVAL; | 768 | retval = -EINVAL; |
670 | if (b->type != q->type) | 769 | if (b->type != q->type) { |
770 | dprintk(1,"dqbuf: Wrong type.\n"); | ||
671 | goto done; | 771 | goto done; |
672 | if (list_empty(&q->stream)) | 772 | } |
773 | if (list_empty(&q->stream)) { | ||
774 | dprintk(1,"dqbuf: stream running\n"); | ||
673 | goto done; | 775 | goto done; |
776 | } | ||
674 | buf = list_entry(q->stream.next, struct videobuf_buffer, stream); | 777 | buf = list_entry(q->stream.next, struct videobuf_buffer, stream); |
675 | retval = videobuf_waiton(buf, nonblocking, 1); | 778 | retval = videobuf_waiton(buf, nonblocking, 1); |
676 | if (retval < 0) | 779 | if (retval < 0) { |
780 | dprintk(1,"dqbuf: waiton returned %d\n",retval); | ||
677 | goto done; | 781 | goto done; |
782 | } | ||
678 | switch (buf->state) { | 783 | switch (buf->state) { |
679 | case STATE_ERROR: | 784 | case STATE_ERROR: |
785 | dprintk(1,"dqbuf: state is error\n"); | ||
680 | retval = -EIO; | 786 | retval = -EIO; |
681 | /* fall through */ | 787 | videobuf_dma_sync(q,&buf->dma); |
788 | buf->state = STATE_IDLE; | ||
789 | break; | ||
682 | case STATE_DONE: | 790 | case STATE_DONE: |
683 | videobuf_dma_pci_sync(q->pci,&buf->dma); | 791 | dprintk(1,"dqbuf: state is done\n"); |
792 | videobuf_dma_sync(q,&buf->dma); | ||
684 | buf->state = STATE_IDLE; | 793 | buf->state = STATE_IDLE; |
685 | break; | 794 | break; |
686 | default: | 795 | default: |
796 | dprintk(1,"dqbuf: state invalid\n"); | ||
687 | retval = -EINVAL; | 797 | retval = -EINVAL; |
688 | goto done; | 798 | goto done; |
689 | } | 799 | } |
@@ -711,13 +821,15 @@ int videobuf_streamon(struct videobuf_queue *q) | |||
711 | if (q->streaming) | 821 | if (q->streaming) |
712 | goto done; | 822 | goto done; |
713 | q->streaming = 1; | 823 | q->streaming = 1; |
714 | spin_lock_irqsave(q->irqlock,flags); | 824 | if (q->irqlock) |
825 | spin_lock_irqsave(q->irqlock,flags); | ||
715 | list_for_each(list,&q->stream) { | 826 | list_for_each(list,&q->stream) { |
716 | buf = list_entry(list, struct videobuf_buffer, stream); | 827 | buf = list_entry(list, struct videobuf_buffer, stream); |
717 | if (buf->state == STATE_PREPARED) | 828 | if (buf->state == STATE_PREPARED) |
718 | q->ops->buf_queue(q,buf); | 829 | q->ops->buf_queue(q,buf); |
719 | } | 830 | } |
720 | spin_unlock_irqrestore(q->irqlock,flags); | 831 | if (q->irqlock) |
832 | spin_unlock_irqrestore(q->irqlock,flags); | ||
721 | 833 | ||
722 | done: | 834 | done: |
723 | mutex_unlock(&q->lock); | 835 | mutex_unlock(&q->lock); |
@@ -762,12 +874,14 @@ videobuf_read_zerocopy(struct videobuf_queue *q, char __user *data, | |||
762 | goto done; | 874 | goto done; |
763 | 875 | ||
764 | /* start capture & wait */ | 876 | /* start capture & wait */ |
765 | spin_lock_irqsave(q->irqlock,flags); | 877 | if (q->irqlock) |
878 | spin_lock_irqsave(q->irqlock,flags); | ||
766 | q->ops->buf_queue(q,q->read_buf); | 879 | q->ops->buf_queue(q,q->read_buf); |
767 | spin_unlock_irqrestore(q->irqlock,flags); | 880 | if (q->irqlock) |
881 | spin_unlock_irqrestore(q->irqlock,flags); | ||
768 | retval = videobuf_waiton(q->read_buf,0,0); | 882 | retval = videobuf_waiton(q->read_buf,0,0); |
769 | if (0 == retval) { | 883 | if (0 == retval) { |
770 | videobuf_dma_pci_sync(q->pci,&q->read_buf->dma); | 884 | videobuf_dma_sync(q,&q->read_buf->dma); |
771 | if (STATE_ERROR == q->read_buf->state) | 885 | if (STATE_ERROR == q->read_buf->state) |
772 | retval = -EIO; | 886 | retval = -EIO; |
773 | else | 887 | else |
@@ -809,6 +923,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
809 | /* need to capture a new frame */ | 923 | /* need to capture a new frame */ |
810 | retval = -ENOMEM; | 924 | retval = -ENOMEM; |
811 | q->read_buf = videobuf_alloc(q->msize); | 925 | q->read_buf = videobuf_alloc(q->msize); |
926 | dprintk(1,"video alloc=0x%08x\n",(unsigned int) q->read_buf); | ||
812 | if (NULL == q->read_buf) | 927 | if (NULL == q->read_buf) |
813 | goto done; | 928 | goto done; |
814 | q->read_buf->memory = V4L2_MEMORY_USERPTR; | 929 | q->read_buf->memory = V4L2_MEMORY_USERPTR; |
@@ -820,9 +935,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
820 | q->read_buf = NULL; | 935 | q->read_buf = NULL; |
821 | goto done; | 936 | goto done; |
822 | } | 937 | } |
823 | spin_lock_irqsave(q->irqlock,flags); | 938 | if (q->irqlock) |
939 | spin_lock_irqsave(q->irqlock,flags); | ||
824 | q->ops->buf_queue(q,q->read_buf); | 940 | q->ops->buf_queue(q,q->read_buf); |
825 | spin_unlock_irqrestore(q->irqlock,flags); | 941 | if (q->irqlock) |
942 | spin_unlock_irqrestore(q->irqlock,flags); | ||
826 | q->read_off = 0; | 943 | q->read_off = 0; |
827 | } | 944 | } |
828 | 945 | ||
@@ -830,7 +947,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
830 | retval = videobuf_waiton(q->read_buf, nonblocking, 1); | 947 | retval = videobuf_waiton(q->read_buf, nonblocking, 1); |
831 | if (0 != retval) | 948 | if (0 != retval) |
832 | goto done; | 949 | goto done; |
833 | videobuf_dma_pci_sync(q->pci,&q->read_buf->dma); | 950 | videobuf_dma_sync(q,&q->read_buf->dma); |
834 | 951 | ||
835 | if (STATE_ERROR == q->read_buf->state) { | 952 | if (STATE_ERROR == q->read_buf->state) { |
836 | /* catch I/O errors */ | 953 | /* catch I/O errors */ |
@@ -887,10 +1004,12 @@ int videobuf_read_start(struct videobuf_queue *q) | |||
887 | return err; | 1004 | return err; |
888 | list_add_tail(&q->bufs[i]->stream, &q->stream); | 1005 | list_add_tail(&q->bufs[i]->stream, &q->stream); |
889 | } | 1006 | } |
890 | spin_lock_irqsave(q->irqlock,flags); | 1007 | if (q->irqlock) |
1008 | spin_lock_irqsave(q->irqlock,flags); | ||
891 | for (i = 0; i < count; i++) | 1009 | for (i = 0; i < count; i++) |
892 | q->ops->buf_queue(q,q->bufs[i]); | 1010 | q->ops->buf_queue(q,q->bufs[i]); |
893 | spin_unlock_irqrestore(q->irqlock,flags); | 1011 | if (q->irqlock) |
1012 | spin_unlock_irqrestore(q->irqlock,flags); | ||
894 | q->reading = 1; | 1013 | q->reading = 1; |
895 | return 0; | 1014 | return 0; |
896 | } | 1015 | } |
@@ -985,9 +1104,11 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, | |||
985 | if (q->read_off == q->read_buf->size) { | 1104 | if (q->read_off == q->read_buf->size) { |
986 | list_add_tail(&q->read_buf->stream, | 1105 | list_add_tail(&q->read_buf->stream, |
987 | &q->stream); | 1106 | &q->stream); |
988 | spin_lock_irqsave(q->irqlock,flags); | 1107 | if (q->irqlock) |
1108 | spin_lock_irqsave(q->irqlock,flags); | ||
989 | q->ops->buf_queue(q,q->read_buf); | 1109 | q->ops->buf_queue(q,q->read_buf); |
990 | spin_unlock_irqrestore(q->irqlock,flags); | 1110 | if (q->irqlock) |
1111 | spin_unlock_irqrestore(q->irqlock,flags); | ||
991 | q->read_buf = NULL; | 1112 | q->read_buf = NULL; |
992 | } | 1113 | } |
993 | if (retval < 0) | 1114 | if (retval < 0) |
@@ -1249,11 +1370,14 @@ EXPORT_SYMBOL_GPL(videobuf_dma_init); | |||
1249 | EXPORT_SYMBOL_GPL(videobuf_dma_init_user); | 1370 | EXPORT_SYMBOL_GPL(videobuf_dma_init_user); |
1250 | EXPORT_SYMBOL_GPL(videobuf_dma_init_kernel); | 1371 | EXPORT_SYMBOL_GPL(videobuf_dma_init_kernel); |
1251 | EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay); | 1372 | EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay); |
1252 | EXPORT_SYMBOL_GPL(videobuf_dma_pci_map); | 1373 | EXPORT_SYMBOL_GPL(videobuf_dma_map); |
1253 | EXPORT_SYMBOL_GPL(videobuf_dma_pci_sync); | 1374 | EXPORT_SYMBOL_GPL(videobuf_dma_sync); |
1254 | EXPORT_SYMBOL_GPL(videobuf_dma_pci_unmap); | 1375 | EXPORT_SYMBOL_GPL(videobuf_dma_unmap); |
1255 | EXPORT_SYMBOL_GPL(videobuf_dma_free); | 1376 | EXPORT_SYMBOL_GPL(videobuf_dma_free); |
1256 | 1377 | ||
1378 | EXPORT_SYMBOL_GPL(videobuf_pci_dma_map); | ||
1379 | EXPORT_SYMBOL_GPL(videobuf_pci_dma_unmap); | ||
1380 | |||
1257 | EXPORT_SYMBOL_GPL(videobuf_alloc); | 1381 | EXPORT_SYMBOL_GPL(videobuf_alloc); |
1258 | EXPORT_SYMBOL_GPL(videobuf_waiton); | 1382 | EXPORT_SYMBOL_GPL(videobuf_waiton); |
1259 | EXPORT_SYMBOL_GPL(videobuf_iolock); | 1383 | EXPORT_SYMBOL_GPL(videobuf_iolock); |
diff --git a/drivers/media/video/videocodec.h b/drivers/media/video/videocodec.h index b1239ac7f371..8c233720b6a5 100644 --- a/drivers/media/video/videocodec.h +++ b/drivers/media/video/videocodec.h | |||
@@ -57,7 +57,7 @@ | |||
57 | therfor they may not be initialized. | 57 | therfor they may not be initialized. |
58 | 58 | ||
59 | The other fuctions are just for convenience, as they are for sure used by | 59 | The other fuctions are just for convenience, as they are for sure used by |
60 | most/all of the codecs. The last ones may be ommited, too. | 60 | most/all of the codecs. The last ones may be ommited, too. |
61 | 61 | ||
62 | See the structure declaration below for more information and which data has | 62 | See the structure declaration below for more information and which data has |
63 | to be set up for the master and the slave. | 63 | to be set up for the master and the slave. |
@@ -75,52 +75,52 @@ | |||
75 | /* ========================================== */ | 75 | /* ========================================== */ |
76 | 76 | ||
77 | /* | 77 | /* |
78 | ==== master setup ==== | 78 | ==== master setup ==== |
79 | name -> name of the device structure for reference and debugging | 79 | name -> name of the device structure for reference and debugging |
80 | master_data -> data ref. for the master (e.g. the zr36055,57,67) | 80 | master_data -> data ref. for the master (e.g. the zr36055,57,67) |
81 | readreg -> ref. to read-fn from register (setup by master, used by slave) | 81 | readreg -> ref. to read-fn from register (setup by master, used by slave) |
82 | writereg -> ref. to write-fn to register (setup by master, used by slave) | 82 | writereg -> ref. to write-fn to register (setup by master, used by slave) |
83 | this two functions do the lowlevel I/O job | 83 | this two functions do the lowlevel I/O job |
84 | 84 | ||
85 | ==== slave functionality setup ==== | 85 | ==== slave functionality setup ==== |
86 | slave_data -> data ref. for the slave (e.g. the zr36050,60) | 86 | slave_data -> data ref. for the slave (e.g. the zr36050,60) |
87 | check -> fn-ref. checks availability of an device, returns -EIO on failure or | 87 | check -> fn-ref. checks availability of an device, returns -EIO on failure or |
88 | the type on success | 88 | the type on success |
89 | this makes espcecially sense if a driver module supports more than | 89 | this makes espcecially sense if a driver module supports more than |
90 | one codec which may be quite similar to access, nevertheless it | 90 | one codec which may be quite similar to access, nevertheless it |
91 | is good for a first functionality check | 91 | is good for a first functionality check |
92 | 92 | ||
93 | -- main functions you always need for compression/decompression -- | 93 | -- main functions you always need for compression/decompression -- |
94 | 94 | ||
95 | set_mode -> this fn-ref. resets the entire codec, and sets up the mode | 95 | set_mode -> this fn-ref. resets the entire codec, and sets up the mode |
96 | with the last defined norm/size (or device default if not | 96 | with the last defined norm/size (or device default if not |
97 | available) - it returns 0 if the mode is possible | 97 | available) - it returns 0 if the mode is possible |
98 | set_size -> this fn-ref. sets the norm and image size for | 98 | set_size -> this fn-ref. sets the norm and image size for |
99 | compression/decompression (returns 0 on success) | 99 | compression/decompression (returns 0 on success) |
100 | the norm param is defined in videodev.h (VIDEO_MODE_*) | 100 | the norm param is defined in videodev.h (VIDEO_MODE_*) |
101 | 101 | ||
102 | additional setup may be available, too - but the codec should work with | 102 | additional setup may be available, too - but the codec should work with |
103 | some default values even without this | 103 | some default values even without this |
104 | 104 | ||
105 | set_data -> sets device-specific data (tables, quality etc.) | 105 | set_data -> sets device-specific data (tables, quality etc.) |
106 | get_data -> query device-specific data (tables, quality etc.) | 106 | get_data -> query device-specific data (tables, quality etc.) |
107 | 107 | ||
108 | if the device delivers interrupts, they may be setup/handled here | 108 | if the device delivers interrupts, they may be setup/handled here |
109 | setup_interrupt -> codec irq setup (not needed for 36050/60) | 109 | setup_interrupt -> codec irq setup (not needed for 36050/60) |
110 | handle_interrupt -> codec irq handling (not needed for 36050/60) | 110 | handle_interrupt -> codec irq handling (not needed for 36050/60) |
111 | 111 | ||
112 | if the device delivers pictures, they may be handled here | 112 | if the device delivers pictures, they may be handled here |
113 | put_image -> puts image data to the codec (not needed for 36050/60) | 113 | put_image -> puts image data to the codec (not needed for 36050/60) |
114 | get_image -> gets image data from the codec (not needed for 36050/60) | 114 | get_image -> gets image data from the codec (not needed for 36050/60) |
115 | the calls include frame numbers and flags (even/odd/...) | 115 | the calls include frame numbers and flags (even/odd/...) |
116 | if needed and a flag which allows blocking until its ready | 116 | if needed and a flag which allows blocking until its ready |
117 | */ | 117 | */ |
118 | 118 | ||
119 | /* ============== */ | 119 | /* ============== */ |
120 | /* user interface */ | 120 | /* user interface */ |
121 | /* ============== */ | 121 | /* ============== */ |
122 | 122 | ||
123 | /* | 123 | /* |
124 | Currently there is only a information display planned, as the layer | 124 | Currently there is only a information display planned, as the layer |
125 | is not visible for the user space at all. | 125 | is not visible for the user space at all. |
126 | 126 | ||
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 0229819d0aac..a8c101494cf5 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -1555,12 +1555,12 @@ static void vino_update_line_size(struct vino_channel_settings *vcs) | |||
1555 | unsigned int w = vcs->clipping.right - vcs->clipping.left; | 1555 | unsigned int w = vcs->clipping.right - vcs->clipping.left; |
1556 | unsigned int d = vcs->decimation; | 1556 | unsigned int d = vcs->decimation; |
1557 | unsigned int bpp = vino_data_formats[vcs->data_format].bpp; | 1557 | unsigned int bpp = vino_data_formats[vcs->data_format].bpp; |
1558 | unsigned int lsize; | 1558 | unsigned int lsize; |
1559 | 1559 | ||
1560 | dprintk("update_line_size(): before: w = %d, d = %d, " | 1560 | dprintk("update_line_size(): before: w = %d, d = %d, " |
1561 | "line_size = %d\n", w, d, vcs->line_size); | 1561 | "line_size = %d\n", w, d, vcs->line_size); |
1562 | 1562 | ||
1563 | /* line size must be multiple of 8 bytes */ | 1563 | /* line size must be multiple of 8 bytes */ |
1564 | lsize = (bpp * (w / d)) & ~7; | 1564 | lsize = (bpp * (w / d)) & ~7; |
1565 | w = (lsize / bpp) * d; | 1565 | w = (lsize / bpp) * d; |
1566 | 1566 | ||
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c new file mode 100644 index 000000000000..5e813404d068 --- /dev/null +++ b/drivers/media/video/vivi.c | |||
@@ -0,0 +1,1454 @@ | |||
1 | /* | ||
2 | * Virtual Video driver - This code emulates a real video device with v4l2 api | ||
3 | * | ||
4 | * Copyright (c) 2006 by: | ||
5 | * Mauro Carvalho Chehab <mchehab--a.t--infradead.org> | ||
6 | * Ted Walther <ted--a.t--enumera.com> | ||
7 | * John Sokol <sokol--a.t--videotechnology.com> | ||
8 | * http://v4l.videotechnology.com/ | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the BSD Licence, GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version 2 of the | ||
13 | * License, or (at your option) any later version | ||
14 | */ | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/errno.h> | ||
18 | #include <linux/fs.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/mm.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/sched.h> | ||
25 | #include <linux/pci.h> | ||
26 | #include <linux/random.h> | ||
27 | #include <linux/version.h> | ||
28 | #include <linux/videodev2.h> | ||
29 | #include <linux/interrupt.h> | ||
30 | #include <media/video-buf.h> | ||
31 | #include <media/v4l2-common.h> | ||
32 | #include <linux/kthread.h> | ||
33 | #include <linux/highmem.h> | ||
34 | |||
35 | /* Wake up at about 30 fps */ | ||
36 | #define WAKE_NUMERATOR 30 | ||
37 | #define WAKE_DENOMINATOR 1001 | ||
38 | #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ | ||
39 | |||
40 | /* These timers are for 1 fps - used only for testing */ | ||
41 | //#define WAKE_DENOMINATOR 30 /* hack for testing purposes */ | ||
42 | //#define BUFFER_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */ | ||
43 | |||
44 | #include "font.h" | ||
45 | |||
46 | #ifndef kzalloc | ||
47 | #define kzalloc(size, flags) \ | ||
48 | ({ \ | ||
49 | void *__ret = kmalloc(size, flags); \ | ||
50 | if (__ret) \ | ||
51 | memset(__ret, 0, size); \ | ||
52 | __ret; \ | ||
53 | }) | ||
54 | #endif | ||
55 | |||
56 | MODULE_DESCRIPTION("Video Technology Magazine Virtual Video Capture Board"); | ||
57 | MODULE_AUTHOR("Mauro Carvalho Chehab, Ted Walther and John Sokol"); | ||
58 | MODULE_LICENSE("Dual BSD/GPL"); | ||
59 | |||
60 | #define VIVI_MAJOR_VERSION 0 | ||
61 | #define VIVI_MINOR_VERSION 4 | ||
62 | #define VIVI_RELEASE 0 | ||
63 | #define VIVI_VERSION KERNEL_VERSION(VIVI_MAJOR_VERSION, VIVI_MINOR_VERSION, VIVI_RELEASE) | ||
64 | |||
65 | static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ | ||
66 | module_param(video_nr, int, 0); | ||
67 | |||
68 | static int debug = 0; | ||
69 | module_param(debug, int, 0); | ||
70 | |||
71 | static unsigned int vid_limit = 16; | ||
72 | module_param(vid_limit,int,0644); | ||
73 | MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes"); | ||
74 | |||
75 | /* supported controls */ | ||
76 | static struct v4l2_queryctrl vivi_qctrl[] = { | ||
77 | { | ||
78 | .id = V4L2_CID_AUDIO_VOLUME, | ||
79 | .name = "Volume", | ||
80 | .minimum = 0, | ||
81 | .maximum = 65535, | ||
82 | .step = 65535/100, | ||
83 | .default_value = 65535, | ||
84 | .flags = 0, | ||
85 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
86 | },{ | ||
87 | .id = V4L2_CID_BRIGHTNESS, | ||
88 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
89 | .name = "Brightness", | ||
90 | .minimum = 0, | ||
91 | .maximum = 255, | ||
92 | .step = 1, | ||
93 | .default_value = 127, | ||
94 | .flags = 0, | ||
95 | }, { | ||
96 | .id = V4L2_CID_CONTRAST, | ||
97 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
98 | .name = "Contrast", | ||
99 | .minimum = 0, | ||
100 | .maximum = 255, | ||
101 | .step = 0x1, | ||
102 | .default_value = 0x10, | ||
103 | .flags = 0, | ||
104 | }, { | ||
105 | .id = V4L2_CID_SATURATION, | ||
106 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
107 | .name = "Saturation", | ||
108 | .minimum = 0, | ||
109 | .maximum = 255, | ||
110 | .step = 0x1, | ||
111 | .default_value = 127, | ||
112 | .flags = 0, | ||
113 | }, { | ||
114 | .id = V4L2_CID_HUE, | ||
115 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
116 | .name = "Hue", | ||
117 | .minimum = -128, | ||
118 | .maximum = 127, | ||
119 | .step = 0x1, | ||
120 | .default_value = 0, | ||
121 | .flags = 0, | ||
122 | } | ||
123 | }; | ||
124 | |||
125 | static int qctl_regs[ARRAY_SIZE(vivi_qctrl)]; | ||
126 | |||
127 | #define dprintk(level,fmt, arg...) \ | ||
128 | do { \ | ||
129 | if (debug >= (level)) \ | ||
130 | printk(KERN_DEBUG "vivi: " fmt , ## arg); \ | ||
131 | } while (0) | ||
132 | |||
133 | /* ------------------------------------------------------------------ | ||
134 | Basic structures | ||
135 | ------------------------------------------------------------------*/ | ||
136 | |||
137 | struct vivi_fmt { | ||
138 | char *name; | ||
139 | u32 fourcc; /* v4l2 format id */ | ||
140 | int depth; | ||
141 | }; | ||
142 | |||
143 | static struct vivi_fmt format = { | ||
144 | .name = "4:2:2, packed, YUYV", | ||
145 | .fourcc = V4L2_PIX_FMT_YUYV, | ||
146 | .depth = 16, | ||
147 | }; | ||
148 | |||
149 | struct sg_to_addr { | ||
150 | int pos; | ||
151 | struct scatterlist *sg; | ||
152 | }; | ||
153 | |||
154 | /* buffer for one video frame */ | ||
155 | struct vivi_buffer { | ||
156 | /* common v4l buffer stuff -- must be first */ | ||
157 | struct videobuf_buffer vb; | ||
158 | |||
159 | struct vivi_fmt *fmt; | ||
160 | |||
161 | struct sg_to_addr *to_addr; | ||
162 | }; | ||
163 | |||
164 | struct vivi_dmaqueue { | ||
165 | struct list_head active; | ||
166 | struct list_head queued; | ||
167 | struct timer_list timeout; | ||
168 | |||
169 | /* thread for generating video stream*/ | ||
170 | struct task_struct *kthread; | ||
171 | wait_queue_head_t wq; | ||
172 | /* Counters to control fps rate */ | ||
173 | int frame; | ||
174 | int ini_jiffies; | ||
175 | }; | ||
176 | |||
177 | static LIST_HEAD(vivi_devlist); | ||
178 | |||
179 | struct vivi_dev { | ||
180 | struct list_head vivi_devlist; | ||
181 | |||
182 | struct semaphore lock; | ||
183 | |||
184 | int users; | ||
185 | |||
186 | /* various device info */ | ||
187 | unsigned int resources; | ||
188 | struct video_device video_dev; | ||
189 | |||
190 | struct vivi_dmaqueue vidq; | ||
191 | |||
192 | /* Several counters */ | ||
193 | int h,m,s,us,jiffies; | ||
194 | char timestr[13]; | ||
195 | }; | ||
196 | |||
197 | struct vivi_fh { | ||
198 | struct vivi_dev *dev; | ||
199 | |||
200 | /* video capture */ | ||
201 | struct vivi_fmt *fmt; | ||
202 | unsigned int width,height; | ||
203 | struct videobuf_queue vb_vidq; | ||
204 | |||
205 | enum v4l2_buf_type type; | ||
206 | }; | ||
207 | |||
208 | /* ------------------------------------------------------------------ | ||
209 | DMA and thread functions | ||
210 | ------------------------------------------------------------------*/ | ||
211 | |||
212 | /* Bars and Colors should match positions */ | ||
213 | |||
214 | enum colors { | ||
215 | WHITE, | ||
216 | AMBAR, | ||
217 | CYAN, | ||
218 | GREEN, | ||
219 | MAGENTA, | ||
220 | RED, | ||
221 | BLUE | ||
222 | }; | ||
223 | |||
224 | static u8 bars[8][3] = { | ||
225 | /* R G B */ | ||
226 | {204,204,204}, /* white */ | ||
227 | {208,208, 0}, /* ambar */ | ||
228 | { 0,206,206}, /* cyan */ | ||
229 | { 0,239, 0}, /* green */ | ||
230 | {239, 0,239}, /* magenta */ | ||
231 | {205, 0, 0}, /* red */ | ||
232 | { 0, 0,255}, /* blue */ | ||
233 | { 0, 0, 0} | ||
234 | }; | ||
235 | |||
236 | #define TO_Y(r,g,b) (((16829*r +33039*g +6416*b + 32768)>>16)+16) | ||
237 | /* RGB to V(Cr) Color transform */ | ||
238 | #define TO_V(r,g,b) (((28784*r -24103*g -4681*b + 32768)>>16)+128) | ||
239 | /* RGB to U(Cb) Color transform */ | ||
240 | #define TO_U(r,g,b) (((-9714*r -19070*g +28784*b + 32768)>>16)+128) | ||
241 | |||
242 | #define TSTAMP_MIN_Y 24 | ||
243 | #define TSTAMP_MAX_Y TSTAMP_MIN_Y+15 | ||
244 | #define TSTAMP_MIN_X 64 | ||
245 | |||
246 | void prep_to_addr(struct sg_to_addr to_addr[],struct videobuf_buffer *vb) | ||
247 | { | ||
248 | int i, pos=0; | ||
249 | |||
250 | for (i=0;i<vb->dma.nr_pages;i++) { | ||
251 | to_addr[i].sg=&vb->dma.sglist[i]; | ||
252 | to_addr[i].pos=pos; | ||
253 | pos += vb->dma.sglist[i].length; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | inline int get_addr_pos(int pos, int pages, struct sg_to_addr to_addr[]) | ||
258 | { | ||
259 | int p1=0,p2=pages-1,p3=pages/2; | ||
260 | |||
261 | /* Sanity test */ | ||
262 | BUG_ON (pos>=to_addr[p2].pos+to_addr[p2].sg->length); | ||
263 | |||
264 | while (p1+1<p2) { | ||
265 | if (pos < to_addr[p3].pos) { | ||
266 | p2=p3; | ||
267 | } else { | ||
268 | p1=p3; | ||
269 | } | ||
270 | p3=(p1+p2)/2; | ||
271 | } | ||
272 | if (pos >= to_addr[p2].pos) | ||
273 | p1=p2; | ||
274 | |||
275 | return (p1); | ||
276 | } | ||
277 | |||
278 | void gen_line(struct sg_to_addr to_addr[],int inipos,int pages,int wmax, | ||
279 | int hmax, int line, char *timestr) | ||
280 | { | ||
281 | int w,i,j,pos=inipos,pgpos,oldpg,y; | ||
282 | char *p,*s,*basep; | ||
283 | struct page *pg; | ||
284 | u8 chr,r,g,b,color; | ||
285 | |||
286 | /* Get first addr pointed to pixel position */ | ||
287 | oldpg=get_addr_pos(pos,pages,to_addr); | ||
288 | pg=pfn_to_page(to_addr[oldpg].sg->dma_address >> PAGE_SHIFT); | ||
289 | basep = kmap_atomic(pg, KM_BOUNCE_READ)+to_addr[oldpg].sg->offset; | ||
290 | |||
291 | /* We will just duplicate the second pixel at the packet */ | ||
292 | wmax/=2; | ||
293 | |||
294 | /* Generate a standard color bar pattern */ | ||
295 | for (w=0;w<wmax;w++) { | ||
296 | r=bars[w*7/wmax][0]; | ||
297 | g=bars[w*7/wmax][1]; | ||
298 | b=bars[w*7/wmax][2]; | ||
299 | |||
300 | for (color=0;color<4;color++) { | ||
301 | pgpos=get_addr_pos(pos,pages,to_addr); | ||
302 | if (pgpos!=oldpg) { | ||
303 | pg=pfn_to_page(to_addr[pgpos].sg->dma_address >> PAGE_SHIFT); | ||
304 | kunmap_atomic(basep, KM_BOUNCE_READ); | ||
305 | basep= kmap_atomic(pg, KM_BOUNCE_READ)+to_addr[pgpos].sg->offset; | ||
306 | oldpg=pgpos; | ||
307 | } | ||
308 | p=basep+pos-to_addr[pgpos].pos; | ||
309 | |||
310 | switch (color) { | ||
311 | case 0: | ||
312 | case 2: | ||
313 | *p=TO_Y(r,g,b); /* Luminance */ | ||
314 | break; | ||
315 | case 1: | ||
316 | *p=TO_U(r,g,b); /* Cb */ | ||
317 | break; | ||
318 | case 3: | ||
319 | *p=TO_V(r,g,b); /* Cr */ | ||
320 | break; | ||
321 | } | ||
322 | pos++; | ||
323 | } | ||
324 | } | ||
325 | |||
326 | /* Checks if it is possible to show timestamp */ | ||
327 | if (TSTAMP_MAX_Y>=hmax) | ||
328 | goto end; | ||
329 | if (TSTAMP_MIN_X+strlen(timestr)>=wmax) | ||
330 | goto end; | ||
331 | |||
332 | /* Print stream time */ | ||
333 | if (line>=TSTAMP_MIN_Y && line<=TSTAMP_MAX_Y) { | ||
334 | j=TSTAMP_MIN_X; | ||
335 | for (s=timestr;*s;s++) { | ||
336 | chr=rom8x16_bits[(*s-0x30)*16+line-TSTAMP_MIN_Y]; | ||
337 | for (i=0;i<7;i++) { | ||
338 | if (chr&1<<(7-i)) { /* Font color*/ | ||
339 | r=bars[BLUE][0]; | ||
340 | g=bars[BLUE][1]; | ||
341 | b=bars[BLUE][2]; | ||
342 | r=g=b=0; | ||
343 | g=198; | ||
344 | } else { /* Background color */ | ||
345 | r=bars[WHITE][0]; | ||
346 | g=bars[WHITE][1]; | ||
347 | b=bars[WHITE][2]; | ||
348 | r=g=b=0; | ||
349 | } | ||
350 | |||
351 | pos=inipos+j*2; | ||
352 | for (color=0;color<4;color++) { | ||
353 | pgpos=get_addr_pos(pos,pages,to_addr); | ||
354 | if (pgpos!=oldpg) { | ||
355 | pg=pfn_to_page(to_addr[pgpos]. | ||
356 | sg->dma_address | ||
357 | >> PAGE_SHIFT); | ||
358 | kunmap_atomic(basep, | ||
359 | KM_BOUNCE_READ); | ||
360 | basep= kmap_atomic(pg, | ||
361 | KM_BOUNCE_READ)+ | ||
362 | to_addr[pgpos].sg->offset; | ||
363 | oldpg=pgpos; | ||
364 | } | ||
365 | p=basep+pos-to_addr[pgpos].pos; | ||
366 | |||
367 | y=TO_Y(r,g,b); | ||
368 | |||
369 | switch (color) { | ||
370 | case 0: | ||
371 | case 2: | ||
372 | *p=TO_Y(r,g,b); /* Luminance */ | ||
373 | break; | ||
374 | case 1: | ||
375 | *p=TO_U(r,g,b); /* Cb */ | ||
376 | break; | ||
377 | case 3: | ||
378 | *p=TO_V(r,g,b); /* Cr */ | ||
379 | break; | ||
380 | } | ||
381 | pos++; | ||
382 | } | ||
383 | j++; | ||
384 | } | ||
385 | } | ||
386 | } | ||
387 | |||
388 | |||
389 | end: | ||
390 | kunmap_atomic(basep, KM_BOUNCE_READ); | ||
391 | } | ||
392 | static void vivi_fillbuff(struct vivi_dev *dev,struct vivi_buffer *buf) | ||
393 | { | ||
394 | int h,pos=0; | ||
395 | int hmax = buf->vb.height; | ||
396 | int wmax = buf->vb.width; | ||
397 | struct videobuf_buffer *vb=&buf->vb; | ||
398 | struct sg_to_addr *to_addr=buf->to_addr; | ||
399 | struct timeval ts; | ||
400 | |||
401 | /* Test if DMA mapping is ready */ | ||
402 | if (!vb->dma.sglist[0].dma_address) | ||
403 | return; | ||
404 | |||
405 | prep_to_addr(to_addr,vb); | ||
406 | |||
407 | /* Check if there is enough memory */ | ||
408 | BUG_ON(buf->vb.dma.nr_pages << PAGE_SHIFT < (buf->vb.width*buf->vb.height)*2); | ||
409 | |||
410 | for (h=0;h<hmax;h++) { | ||
411 | gen_line(to_addr,pos,vb->dma.nr_pages,wmax,hmax,h,dev->timestr); | ||
412 | pos += wmax*2; | ||
413 | } | ||
414 | |||
415 | /* Updates stream time */ | ||
416 | |||
417 | dev->us+=jiffies_to_usecs(jiffies-dev->jiffies); | ||
418 | dev->jiffies=jiffies; | ||
419 | if (dev->us>=1000000) { | ||
420 | dev->us-=1000000; | ||
421 | dev->s++; | ||
422 | if (dev->s>=60) { | ||
423 | dev->s-=60; | ||
424 | dev->m++; | ||
425 | if (dev->m>60) { | ||
426 | dev->m-=60; | ||
427 | dev->h++; | ||
428 | if (dev->h>24) | ||
429 | dev->h-=24; | ||
430 | } | ||
431 | } | ||
432 | } | ||
433 | sprintf(dev->timestr,"%02d:%02d:%02d:%03d", | ||
434 | dev->h,dev->m,dev->s,(dev->us+500)/1000); | ||
435 | |||
436 | dprintk(2,"vivifill at %s: Buffer 0x%08lx size= %d\n",dev->timestr, | ||
437 | (unsigned long)buf->vb.dma.vmalloc,pos); | ||
438 | |||
439 | /* Advice that buffer was filled */ | ||
440 | buf->vb.state = STATE_DONE; | ||
441 | buf->vb.field_count++; | ||
442 | do_gettimeofday(&ts); | ||
443 | buf->vb.ts = ts; | ||
444 | |||
445 | list_del(&buf->vb.queue); | ||
446 | wake_up(&buf->vb.done); | ||
447 | } | ||
448 | |||
449 | static int restart_video_queue(struct vivi_dmaqueue *dma_q); | ||
450 | |||
451 | static void vivi_thread_tick(struct vivi_dmaqueue *dma_q) | ||
452 | { | ||
453 | struct vivi_buffer *buf; | ||
454 | struct vivi_dev *dev= container_of(dma_q,struct vivi_dev,vidq); | ||
455 | |||
456 | int bc; | ||
457 | |||
458 | /* Announces videobuf that all went ok */ | ||
459 | for (bc = 0;; bc++) { | ||
460 | if (list_empty(&dma_q->active)) { | ||
461 | dprintk(1,"No active queue to serve\n"); | ||
462 | break; | ||
463 | } | ||
464 | |||
465 | buf = list_entry(dma_q->active.next, | ||
466 | struct vivi_buffer, vb.queue); | ||
467 | |||
468 | /* Nobody is waiting something to be done, just return */ | ||
469 | if (!waitqueue_active(&buf->vb.done)) { | ||
470 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); | ||
471 | return; | ||
472 | } | ||
473 | |||
474 | do_gettimeofday(&buf->vb.ts); | ||
475 | dprintk(2,"[%p/%d] wakeup\n",buf,buf->vb.i); | ||
476 | |||
477 | /* Fill buffer */ | ||
478 | vivi_fillbuff(dev,buf); | ||
479 | } | ||
480 | if (list_empty(&dma_q->active)) { | ||
481 | del_timer(&dma_q->timeout); | ||
482 | } else { | ||
483 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); | ||
484 | } | ||
485 | if (bc != 1) | ||
486 | dprintk(1,"%s: %d buffers handled (should be 1)\n",__FUNCTION__,bc); | ||
487 | } | ||
488 | |||
489 | void vivi_sleep(struct vivi_dmaqueue *dma_q) | ||
490 | { | ||
491 | int timeout; | ||
492 | DECLARE_WAITQUEUE(wait, current); | ||
493 | |||
494 | dprintk(1,"%s dma_q=0x%08lx\n",__FUNCTION__,(unsigned long)dma_q); | ||
495 | |||
496 | add_wait_queue(&dma_q->wq, &wait); | ||
497 | if (!kthread_should_stop()) { | ||
498 | dma_q->frame++; | ||
499 | |||
500 | /* Calculate time to wake up */ | ||
501 | timeout=dma_q->ini_jiffies+msecs_to_jiffies((dma_q->frame*WAKE_NUMERATOR*1000)/WAKE_DENOMINATOR)-jiffies; | ||
502 | |||
503 | if (timeout <= 0) { | ||
504 | int old=dma_q->frame; | ||
505 | dma_q->frame=(jiffies_to_msecs(jiffies-dma_q->ini_jiffies)*WAKE_DENOMINATOR)/(WAKE_NUMERATOR*1000)+1; | ||
506 | |||
507 | timeout=dma_q->ini_jiffies+msecs_to_jiffies((dma_q->frame*WAKE_NUMERATOR*1000)/WAKE_DENOMINATOR)-jiffies; | ||
508 | |||
509 | dprintk(1,"underrun, losed %d frames. " | ||
510 | "Now, frame is %d. Waking on %d jiffies\n", | ||
511 | dma_q->frame-old,dma_q->frame,timeout); | ||
512 | } else | ||
513 | dprintk(1,"will sleep for %i jiffies\n",timeout); | ||
514 | |||
515 | vivi_thread_tick(dma_q); | ||
516 | |||
517 | schedule_timeout_interruptible (timeout); | ||
518 | } | ||
519 | |||
520 | remove_wait_queue(&dma_q->wq, &wait); | ||
521 | try_to_freeze(); | ||
522 | } | ||
523 | |||
524 | int vivi_thread(void *data) | ||
525 | { | ||
526 | struct vivi_dmaqueue *dma_q=data; | ||
527 | |||
528 | dprintk(1,"thread started\n"); | ||
529 | |||
530 | for (;;) { | ||
531 | vivi_sleep(dma_q); | ||
532 | |||
533 | if (kthread_should_stop()) | ||
534 | break; | ||
535 | } | ||
536 | dprintk(1, "thread: exit\n"); | ||
537 | return 0; | ||
538 | } | ||
539 | |||
540 | int vivi_start_thread(struct vivi_dmaqueue *dma_q) | ||
541 | { | ||
542 | dma_q->frame=0; | ||
543 | dma_q->ini_jiffies=jiffies; | ||
544 | |||
545 | dprintk(1,"%s\n",__FUNCTION__); | ||
546 | init_waitqueue_head(&dma_q->wq); | ||
547 | |||
548 | dma_q->kthread = kthread_run(vivi_thread, dma_q, "vivi"); | ||
549 | |||
550 | if (dma_q->kthread == NULL) { | ||
551 | printk(KERN_ERR "vivi: kernel_thread() failed\n"); | ||
552 | return -EINVAL; | ||
553 | } | ||
554 | dprintk(1,"returning from %s\n",__FUNCTION__); | ||
555 | return 0; | ||
556 | } | ||
557 | |||
558 | void vivi_stop_thread(struct vivi_dmaqueue *dma_q) | ||
559 | { | ||
560 | dprintk(1,"%s\n",__FUNCTION__); | ||
561 | /* shutdown control thread */ | ||
562 | if (dma_q->kthread) { | ||
563 | kthread_stop(dma_q->kthread); | ||
564 | dma_q->kthread=NULL; | ||
565 | } | ||
566 | } | ||
567 | |||
568 | static int restart_video_queue(struct vivi_dmaqueue *dma_q) | ||
569 | { | ||
570 | struct vivi_buffer *buf, *prev; | ||
571 | struct list_head *item; | ||
572 | |||
573 | dprintk(1,"%s dma_q=0x%08lx\n",__FUNCTION__,(unsigned long)dma_q); | ||
574 | |||
575 | if (!list_empty(&dma_q->active)) { | ||
576 | buf = list_entry(dma_q->active.next, struct vivi_buffer, vb.queue); | ||
577 | dprintk(2,"restart_queue [%p/%d]: restart dma\n", | ||
578 | buf, buf->vb.i); | ||
579 | |||
580 | dprintk(1,"Restarting video dma\n"); | ||
581 | vivi_stop_thread(dma_q); | ||
582 | // vivi_start_thread(dma_q); | ||
583 | |||
584 | /* cancel all outstanding capture / vbi requests */ | ||
585 | list_for_each(item,&dma_q->active) { | ||
586 | buf = list_entry(item, struct vivi_buffer, vb.queue); | ||
587 | |||
588 | list_del(&buf->vb.queue); | ||
589 | buf->vb.state = STATE_ERROR; | ||
590 | wake_up(&buf->vb.done); | ||
591 | } | ||
592 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); | ||
593 | |||
594 | return 0; | ||
595 | } | ||
596 | |||
597 | prev = NULL; | ||
598 | for (;;) { | ||
599 | if (list_empty(&dma_q->queued)) | ||
600 | return 0; | ||
601 | buf = list_entry(dma_q->queued.next, struct vivi_buffer, vb.queue); | ||
602 | if (NULL == prev) { | ||
603 | list_del(&buf->vb.queue); | ||
604 | list_add_tail(&buf->vb.queue,&dma_q->active); | ||
605 | |||
606 | dprintk(1,"Restarting video dma\n"); | ||
607 | vivi_stop_thread(dma_q); | ||
608 | vivi_start_thread(dma_q); | ||
609 | |||
610 | buf->vb.state = STATE_ACTIVE; | ||
611 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); | ||
612 | dprintk(2,"[%p/%d] restart_queue - first active\n", | ||
613 | buf,buf->vb.i); | ||
614 | |||
615 | } else if (prev->vb.width == buf->vb.width && | ||
616 | prev->vb.height == buf->vb.height && | ||
617 | prev->fmt == buf->fmt) { | ||
618 | list_del(&buf->vb.queue); | ||
619 | list_add_tail(&buf->vb.queue,&dma_q->active); | ||
620 | buf->vb.state = STATE_ACTIVE; | ||
621 | dprintk(2,"[%p/%d] restart_queue - move to active\n", | ||
622 | buf,buf->vb.i); | ||
623 | } else { | ||
624 | return 0; | ||
625 | } | ||
626 | prev = buf; | ||
627 | } | ||
628 | } | ||
629 | |||
630 | static void vivi_vid_timeout(unsigned long data) | ||
631 | { | ||
632 | struct vivi_dev *dev = (struct vivi_dev*)data; | ||
633 | struct vivi_dmaqueue *vidq = &dev->vidq; | ||
634 | struct vivi_buffer *buf; | ||
635 | |||
636 | while (!list_empty(&vidq->active)) { | ||
637 | buf = list_entry(vidq->active.next, struct vivi_buffer, vb.queue); | ||
638 | list_del(&buf->vb.queue); | ||
639 | buf->vb.state = STATE_ERROR; | ||
640 | wake_up(&buf->vb.done); | ||
641 | printk("vivi/0: [%p/%d] timeout\n", buf, buf->vb.i); | ||
642 | } | ||
643 | |||
644 | restart_video_queue(vidq); | ||
645 | } | ||
646 | |||
647 | /* ------------------------------------------------------------------ | ||
648 | Videobuf operations | ||
649 | ------------------------------------------------------------------*/ | ||
650 | static int | ||
651 | buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) | ||
652 | { | ||
653 | struct vivi_fh *fh = vq->priv_data; | ||
654 | |||
655 | *size = fh->width*fh->height*2; | ||
656 | |||
657 | if (0 == *count) | ||
658 | *count = 32; | ||
659 | while (*size * *count > vid_limit * 1024 * 1024) | ||
660 | (*count)--; | ||
661 | return 0; | ||
662 | } | ||
663 | |||
664 | void | ||
665 | free_buffer(struct videobuf_queue *vq, struct vivi_buffer *buf) | ||
666 | { | ||
667 | dprintk(1,"%s\n",__FUNCTION__); | ||
668 | |||
669 | if (in_interrupt()) | ||
670 | BUG(); | ||
671 | |||
672 | /*FIXME: Maybe a spinlock is required here */ | ||
673 | kfree(buf->to_addr); | ||
674 | buf->to_addr=NULL; | ||
675 | |||
676 | videobuf_waiton(&buf->vb,0,0); | ||
677 | videobuf_dma_unmap(vq, &buf->vb.dma); | ||
678 | videobuf_dma_free(&buf->vb.dma); | ||
679 | buf->vb.state = STATE_NEEDS_INIT; | ||
680 | } | ||
681 | |||
682 | #define norm_maxw() 1024 | ||
683 | #define norm_maxh() 768 | ||
684 | static int | ||
685 | buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | ||
686 | enum v4l2_field field) | ||
687 | { | ||
688 | struct vivi_fh *fh = vq->priv_data; | ||
689 | struct vivi_buffer *buf = container_of(vb,struct vivi_buffer,vb); | ||
690 | int rc, init_buffer = 0; | ||
691 | |||
692 | // dprintk(1,"%s, field=%d\n",__FUNCTION__,field); | ||
693 | |||
694 | BUG_ON(NULL == fh->fmt); | ||
695 | if (fh->width < 48 || fh->width > norm_maxw() || | ||
696 | fh->height < 32 || fh->height > norm_maxh()) | ||
697 | return -EINVAL; | ||
698 | buf->vb.size = fh->width*fh->height*2; | ||
699 | if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) | ||
700 | return -EINVAL; | ||
701 | |||
702 | if (buf->fmt != fh->fmt || | ||
703 | buf->vb.width != fh->width || | ||
704 | buf->vb.height != fh->height || | ||
705 | buf->vb.field != field) { | ||
706 | buf->fmt = fh->fmt; | ||
707 | buf->vb.width = fh->width; | ||
708 | buf->vb.height = fh->height; | ||
709 | buf->vb.field = field; | ||
710 | init_buffer = 1; | ||
711 | } | ||
712 | |||
713 | if (STATE_NEEDS_INIT == buf->vb.state) { | ||
714 | if (0 != (rc = videobuf_iolock(vq,&buf->vb,NULL))) | ||
715 | goto fail; | ||
716 | } | ||
717 | |||
718 | buf->vb.state = STATE_PREPARED; | ||
719 | |||
720 | if (NULL == (buf->to_addr = kmalloc(sizeof(*buf->to_addr) * vb->dma.nr_pages,GFP_KERNEL))) { | ||
721 | rc=-ENOMEM; | ||
722 | goto fail; | ||
723 | } | ||
724 | |||
725 | return 0; | ||
726 | |||
727 | fail: | ||
728 | free_buffer(vq,buf); | ||
729 | return rc; | ||
730 | } | ||
731 | |||
732 | static void | ||
733 | buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | ||
734 | { | ||
735 | struct vivi_buffer *buf = container_of(vb,struct vivi_buffer,vb); | ||
736 | struct vivi_fh *fh = vq->priv_data; | ||
737 | struct vivi_dev *dev = fh->dev; | ||
738 | struct vivi_dmaqueue *vidq = &dev->vidq; | ||
739 | struct vivi_buffer *prev; | ||
740 | |||
741 | if (!list_empty(&vidq->queued)) { | ||
742 | dprintk(1,"adding vb queue=0x%08lx\n",(unsigned long)&buf->vb.queue); | ||
743 | list_add_tail(&buf->vb.queue,&vidq->queued); | ||
744 | buf->vb.state = STATE_QUEUED; | ||
745 | dprintk(2,"[%p/%d] buffer_queue - append to queued\n", | ||
746 | buf, buf->vb.i); | ||
747 | } else if (list_empty(&vidq->active)) { | ||
748 | list_add_tail(&buf->vb.queue,&vidq->active); | ||
749 | |||
750 | buf->vb.state = STATE_ACTIVE; | ||
751 | mod_timer(&vidq->timeout, jiffies+BUFFER_TIMEOUT); | ||
752 | dprintk(2,"[%p/%d] buffer_queue - first active\n", | ||
753 | buf, buf->vb.i); | ||
754 | |||
755 | vivi_start_thread(vidq); | ||
756 | } else { | ||
757 | prev = list_entry(vidq->active.prev, struct vivi_buffer, vb.queue); | ||
758 | if (prev->vb.width == buf->vb.width && | ||
759 | prev->vb.height == buf->vb.height && | ||
760 | prev->fmt == buf->fmt) { | ||
761 | list_add_tail(&buf->vb.queue,&vidq->active); | ||
762 | buf->vb.state = STATE_ACTIVE; | ||
763 | dprintk(2,"[%p/%d] buffer_queue - append to active\n", | ||
764 | buf, buf->vb.i); | ||
765 | |||
766 | } else { | ||
767 | list_add_tail(&buf->vb.queue,&vidq->queued); | ||
768 | buf->vb.state = STATE_QUEUED; | ||
769 | dprintk(2,"[%p/%d] buffer_queue - first queued\n", | ||
770 | buf, buf->vb.i); | ||
771 | } | ||
772 | } | ||
773 | } | ||
774 | |||
775 | static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb) | ||
776 | { | ||
777 | struct vivi_buffer *buf = container_of(vb,struct vivi_buffer,vb); | ||
778 | struct vivi_fh *fh = vq->priv_data; | ||
779 | struct vivi_dev *dev = (struct vivi_dev*)fh->dev; | ||
780 | struct vivi_dmaqueue *vidq = &dev->vidq; | ||
781 | |||
782 | dprintk(1,"%s\n",__FUNCTION__); | ||
783 | |||
784 | vivi_stop_thread(vidq); | ||
785 | |||
786 | free_buffer(vq,buf); | ||
787 | } | ||
788 | |||
789 | int vivi_map_sg (void *dev, struct scatterlist *sg, int nents, | ||
790 | int direction) | ||
791 | { | ||
792 | int i; | ||
793 | |||
794 | dprintk(1,"%s, number of pages=%d\n",__FUNCTION__,nents); | ||
795 | BUG_ON(direction == DMA_NONE); | ||
796 | |||
797 | for (i = 0; i < nents; i++ ) { | ||
798 | BUG_ON(!sg[i].page); | ||
799 | |||
800 | sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; | ||
801 | } | ||
802 | |||
803 | return nents; | ||
804 | } | ||
805 | |||
806 | int vivi_unmap_sg(void *dev,struct scatterlist *sglist,int nr_pages, | ||
807 | int direction) | ||
808 | { | ||
809 | dprintk(1,"%s\n",__FUNCTION__); | ||
810 | return 0; | ||
811 | } | ||
812 | |||
813 | int vivi_dma_sync_sg(void *dev,struct scatterlist *sglist,int nr_pages, | ||
814 | int direction) | ||
815 | { | ||
816 | // dprintk(1,"%s\n",__FUNCTION__); | ||
817 | |||
818 | // flush_write_buffers(); | ||
819 | return 0; | ||
820 | } | ||
821 | |||
822 | static struct videobuf_queue_ops vivi_video_qops = { | ||
823 | .buf_setup = buffer_setup, | ||
824 | .buf_prepare = buffer_prepare, | ||
825 | .buf_queue = buffer_queue, | ||
826 | .buf_release = buffer_release, | ||
827 | |||
828 | /* Non-pci handling routines */ | ||
829 | .vb_map_sg = vivi_map_sg, | ||
830 | .vb_dma_sync_sg = vivi_dma_sync_sg, | ||
831 | .vb_unmap_sg = vivi_unmap_sg, | ||
832 | }; | ||
833 | |||
834 | /* ------------------------------------------------------------------ | ||
835 | IOCTL handling | ||
836 | ------------------------------------------------------------------*/ | ||
837 | |||
838 | static int vivi_try_fmt(struct vivi_dev *dev, struct vivi_fh *fh, | ||
839 | struct v4l2_format *f) | ||
840 | { | ||
841 | struct vivi_fmt *fmt; | ||
842 | enum v4l2_field field; | ||
843 | unsigned int maxw, maxh; | ||
844 | |||
845 | if (format.fourcc != f->fmt.pix.pixelformat) { | ||
846 | dprintk(1,"Fourcc format invalid.\n"); | ||
847 | return -EINVAL; | ||
848 | } | ||
849 | fmt=&format; | ||
850 | |||
851 | field = f->fmt.pix.field; | ||
852 | |||
853 | if (field == V4L2_FIELD_ANY) { | ||
854 | // field=V4L2_FIELD_INTERLACED; | ||
855 | field=V4L2_FIELD_SEQ_TB; | ||
856 | } else if (V4L2_FIELD_INTERLACED != field) { | ||
857 | dprintk(1,"Field type invalid.\n"); | ||
858 | return -EINVAL; | ||
859 | } | ||
860 | |||
861 | maxw = norm_maxw(); | ||
862 | maxh = norm_maxh(); | ||
863 | |||
864 | f->fmt.pix.field = field; | ||
865 | if (f->fmt.pix.height < 32) | ||
866 | f->fmt.pix.height = 32; | ||
867 | if (f->fmt.pix.height > maxh) | ||
868 | f->fmt.pix.height = maxh; | ||
869 | if (f->fmt.pix.width < 48) | ||
870 | f->fmt.pix.width = 48; | ||
871 | if (f->fmt.pix.width > maxw) | ||
872 | f->fmt.pix.width = maxw; | ||
873 | f->fmt.pix.width &= ~0x03; | ||
874 | f->fmt.pix.bytesperline = | ||
875 | (f->fmt.pix.width * fmt->depth) >> 3; | ||
876 | f->fmt.pix.sizeimage = | ||
877 | f->fmt.pix.height * f->fmt.pix.bytesperline; | ||
878 | |||
879 | return 0; | ||
880 | } | ||
881 | |||
882 | static int res_get(struct vivi_dev *dev, struct vivi_fh *fh) | ||
883 | { | ||
884 | /* is it free? */ | ||
885 | down(&dev->lock); | ||
886 | if (dev->resources) { | ||
887 | /* no, someone else uses it */ | ||
888 | up(&dev->lock); | ||
889 | return 0; | ||
890 | } | ||
891 | /* it's free, grab it */ | ||
892 | dev->resources =1; | ||
893 | dprintk(1,"res: get\n"); | ||
894 | up(&dev->lock); | ||
895 | return 1; | ||
896 | } | ||
897 | |||
898 | static inline int res_locked(struct vivi_dev *dev) | ||
899 | { | ||
900 | return (dev->resources); | ||
901 | } | ||
902 | |||
903 | static void res_free(struct vivi_dev *dev, struct vivi_fh *fh) | ||
904 | { | ||
905 | down(&dev->lock); | ||
906 | dev->resources = 0; | ||
907 | dprintk(1,"res: put\n"); | ||
908 | up(&dev->lock); | ||
909 | } | ||
910 | |||
911 | static int vivi_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) | ||
912 | { | ||
913 | struct vivi_fh *fh = file->private_data; | ||
914 | struct vivi_dev *dev = fh->dev; | ||
915 | int ret=0; | ||
916 | |||
917 | if (debug) { | ||
918 | if (_IOC_DIR(cmd) & _IOC_WRITE) | ||
919 | v4l_printk_ioctl_arg("vivi(w)",cmd, arg); | ||
920 | else if (!_IOC_DIR(cmd) & _IOC_READ) { | ||
921 | v4l_print_ioctl("vivi", cmd); | ||
922 | } | ||
923 | } | ||
924 | |||
925 | switch(cmd) { | ||
926 | /* --- capabilities ------------------------------------------ */ | ||
927 | case VIDIOC_QUERYCAP: | ||
928 | { | ||
929 | struct v4l2_capability *cap = (struct v4l2_capability*)arg; | ||
930 | |||
931 | memset(cap, 0, sizeof(*cap)); | ||
932 | |||
933 | strcpy(cap->driver, "vivi"); | ||
934 | strcpy(cap->card, "vivi"); | ||
935 | cap->version = VIVI_VERSION; | ||
936 | cap->capabilities = | ||
937 | V4L2_CAP_VIDEO_CAPTURE | | ||
938 | V4L2_CAP_STREAMING | | ||
939 | V4L2_CAP_READWRITE; | ||
940 | break; | ||
941 | } | ||
942 | /* --- capture ioctls ---------------------------------------- */ | ||
943 | case VIDIOC_ENUM_FMT: | ||
944 | { | ||
945 | struct v4l2_fmtdesc *f = arg; | ||
946 | enum v4l2_buf_type type; | ||
947 | unsigned int index; | ||
948 | |||
949 | index = f->index; | ||
950 | type = f->type; | ||
951 | |||
952 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
953 | ret=-EINVAL; | ||
954 | break; | ||
955 | } | ||
956 | |||
957 | switch (type) { | ||
958 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | ||
959 | if (index > 0){ | ||
960 | ret=-EINVAL; | ||
961 | break; | ||
962 | } | ||
963 | memset(f,0,sizeof(*f)); | ||
964 | |||
965 | f->index = index; | ||
966 | f->type = type; | ||
967 | strlcpy(f->description,format.name,sizeof(f->description)); | ||
968 | f->pixelformat = format.fourcc; | ||
969 | break; | ||
970 | default: | ||
971 | ret=-EINVAL; | ||
972 | } | ||
973 | break; | ||
974 | } | ||
975 | case VIDIOC_G_FMT: | ||
976 | { | ||
977 | struct v4l2_format *f = (struct v4l2_format *)arg; | ||
978 | |||
979 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
980 | ret=-EINVAL; | ||
981 | break; | ||
982 | } | ||
983 | |||
984 | memset(&f->fmt.pix,0,sizeof(f->fmt.pix)); | ||
985 | f->fmt.pix.width = fh->width; | ||
986 | f->fmt.pix.height = fh->height; | ||
987 | f->fmt.pix.field = fh->vb_vidq.field; | ||
988 | f->fmt.pix.pixelformat = fh->fmt->fourcc; | ||
989 | f->fmt.pix.bytesperline = | ||
990 | (f->fmt.pix.width * fh->fmt->depth) >> 3; | ||
991 | f->fmt.pix.sizeimage = | ||
992 | f->fmt.pix.height * f->fmt.pix.bytesperline; | ||
993 | break; | ||
994 | } | ||
995 | case VIDIOC_S_FMT: | ||
996 | { | ||
997 | struct v4l2_format *f = arg; | ||
998 | |||
999 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1000 | dprintk(1,"Only capture supported.\n"); | ||
1001 | ret=-EINVAL; | ||
1002 | break; | ||
1003 | } | ||
1004 | |||
1005 | ret = vivi_try_fmt(dev,fh,f); | ||
1006 | if (ret < 0) | ||
1007 | break; | ||
1008 | |||
1009 | fh->fmt = &format; | ||
1010 | fh->width = f->fmt.pix.width; | ||
1011 | fh->height = f->fmt.pix.height; | ||
1012 | fh->vb_vidq.field = f->fmt.pix.field; | ||
1013 | fh->type = f->type; | ||
1014 | |||
1015 | break; | ||
1016 | } | ||
1017 | case VIDIOC_TRY_FMT: | ||
1018 | { | ||
1019 | struct v4l2_format *f = arg; | ||
1020 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1021 | ret=-EINVAL; | ||
1022 | break; | ||
1023 | } | ||
1024 | |||
1025 | ret=vivi_try_fmt(dev,fh,f); | ||
1026 | break; | ||
1027 | } | ||
1028 | case VIDIOC_REQBUFS: | ||
1029 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1030 | ret=-EINVAL; | ||
1031 | break; | ||
1032 | } | ||
1033 | ret=videobuf_reqbufs(&fh->vb_vidq, arg); | ||
1034 | break; | ||
1035 | case VIDIOC_QUERYBUF: | ||
1036 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1037 | ret=-EINVAL; | ||
1038 | break; | ||
1039 | } | ||
1040 | ret=videobuf_querybuf(&fh->vb_vidq, arg); | ||
1041 | break; | ||
1042 | case VIDIOC_QBUF: | ||
1043 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1044 | ret=-EINVAL; | ||
1045 | break; | ||
1046 | } | ||
1047 | ret=videobuf_qbuf(&fh->vb_vidq, arg); | ||
1048 | break; | ||
1049 | case VIDIOC_DQBUF: | ||
1050 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1051 | ret=-EINVAL; | ||
1052 | break; | ||
1053 | } | ||
1054 | ret=videobuf_dqbuf(&fh->vb_vidq, arg, | ||
1055 | file->f_flags & O_NONBLOCK); | ||
1056 | break; | ||
1057 | #ifdef HAVE_V4L1 | ||
1058 | /* --- streaming capture ------------------------------------- */ | ||
1059 | case VIDIOCGMBUF: | ||
1060 | { | ||
1061 | struct video_mbuf *mbuf = arg; | ||
1062 | struct videobuf_queue *q=&fh->vb_vidq; | ||
1063 | struct v4l2_requestbuffers req; | ||
1064 | unsigned int i; | ||
1065 | |||
1066 | memset(&req,0,sizeof(req)); | ||
1067 | req.type = q->type; | ||
1068 | req.count = 8; | ||
1069 | req.memory = V4L2_MEMORY_MMAP; | ||
1070 | ret = videobuf_reqbufs(q,&req); | ||
1071 | if (ret < 0) | ||
1072 | break; | ||
1073 | memset(mbuf,0,sizeof(*mbuf)); | ||
1074 | mbuf->frames = req.count; | ||
1075 | mbuf->size = 0; | ||
1076 | for (i = 0; i < mbuf->frames; i++) { | ||
1077 | mbuf->offsets[i] = q->bufs[i]->boff; | ||
1078 | mbuf->size += q->bufs[i]->bsize; | ||
1079 | } | ||
1080 | break; | ||
1081 | } | ||
1082 | #endif | ||
1083 | case VIDIOC_STREAMON: | ||
1084 | { | ||
1085 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1086 | return -EINVAL; | ||
1087 | if (!res_get(dev,fh)) | ||
1088 | return -EBUSY; | ||
1089 | ret=videobuf_streamon(&fh->vb_vidq); | ||
1090 | break; | ||
1091 | } | ||
1092 | case VIDIOC_STREAMOFF: | ||
1093 | { | ||
1094 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1095 | ret=-EINVAL; | ||
1096 | break; | ||
1097 | } | ||
1098 | ret = videobuf_streamoff(&fh->vb_vidq); | ||
1099 | if (ret < 0) | ||
1100 | break; | ||
1101 | res_free(dev,fh); | ||
1102 | break; | ||
1103 | } | ||
1104 | /* ---------- tv norms ---------- */ | ||
1105 | case VIDIOC_ENUMSTD: | ||
1106 | { | ||
1107 | struct v4l2_standard *e = arg; | ||
1108 | |||
1109 | if (e->index>0) { | ||
1110 | ret=-EINVAL; | ||
1111 | break; | ||
1112 | } | ||
1113 | ret = v4l2_video_std_construct(e, V4L2_STD_NTSC_M, "NTSC-M"); | ||
1114 | |||
1115 | /* Allows vivi to use different fps from video std */ | ||
1116 | e->frameperiod.numerator = WAKE_NUMERATOR; | ||
1117 | e->frameperiod.denominator = WAKE_DENOMINATOR; | ||
1118 | |||
1119 | break; | ||
1120 | } | ||
1121 | case VIDIOC_G_STD: | ||
1122 | { | ||
1123 | v4l2_std_id *id = arg; | ||
1124 | |||
1125 | *id = V4L2_STD_NTSC_M; | ||
1126 | break; | ||
1127 | } | ||
1128 | case VIDIOC_S_STD: | ||
1129 | { | ||
1130 | break; | ||
1131 | } | ||
1132 | /* ------ input switching ---------- */ | ||
1133 | case VIDIOC_ENUMINPUT: | ||
1134 | { /* only one input in this sample driver */ | ||
1135 | struct v4l2_input *inp = arg; | ||
1136 | |||
1137 | if (inp->index != 0) { | ||
1138 | ret=-EINVAL; | ||
1139 | break; | ||
1140 | } | ||
1141 | memset(inp, 0, sizeof(*inp)); | ||
1142 | |||
1143 | inp->index = 0; | ||
1144 | inp->type = V4L2_INPUT_TYPE_CAMERA; | ||
1145 | inp->std = V4L2_STD_NTSC_M; | ||
1146 | strcpy(inp->name,"Camera"); | ||
1147 | break; | ||
1148 | } | ||
1149 | case VIDIOC_G_INPUT: | ||
1150 | { | ||
1151 | unsigned int *i = arg; | ||
1152 | |||
1153 | *i = 0; | ||
1154 | break; | ||
1155 | } | ||
1156 | case VIDIOC_S_INPUT: | ||
1157 | { | ||
1158 | unsigned int *i = arg; | ||
1159 | |||
1160 | if (*i > 0) | ||
1161 | ret=-EINVAL; | ||
1162 | break; | ||
1163 | } | ||
1164 | |||
1165 | /* --- controls ---------------------------------------------- */ | ||
1166 | case VIDIOC_QUERYCTRL: | ||
1167 | { | ||
1168 | struct v4l2_queryctrl *qc = arg; | ||
1169 | int i; | ||
1170 | |||
1171 | for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) | ||
1172 | if (qc->id && qc->id == vivi_qctrl[i].id) { | ||
1173 | memcpy(qc, &(vivi_qctrl[i]), | ||
1174 | sizeof(*qc)); | ||
1175 | break; | ||
1176 | } | ||
1177 | |||
1178 | ret=-EINVAL; | ||
1179 | break; | ||
1180 | } | ||
1181 | case VIDIOC_G_CTRL: | ||
1182 | { | ||
1183 | struct v4l2_control *ctrl = arg; | ||
1184 | int i; | ||
1185 | |||
1186 | for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) | ||
1187 | if (ctrl->id == vivi_qctrl[i].id) { | ||
1188 | ctrl->value=qctl_regs[i]; | ||
1189 | break; | ||
1190 | } | ||
1191 | |||
1192 | ret=-EINVAL; | ||
1193 | break; | ||
1194 | } | ||
1195 | case VIDIOC_S_CTRL: | ||
1196 | { | ||
1197 | struct v4l2_control *ctrl = arg; | ||
1198 | int i; | ||
1199 | for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) | ||
1200 | if (ctrl->id == vivi_qctrl[i].id) { | ||
1201 | if (ctrl->value < | ||
1202 | vivi_qctrl[i].minimum | ||
1203 | || ctrl->value > | ||
1204 | vivi_qctrl[i].maximum) { | ||
1205 | ret=-ERANGE; | ||
1206 | break; | ||
1207 | } | ||
1208 | qctl_regs[i]=ctrl->value; | ||
1209 | break; | ||
1210 | } | ||
1211 | ret=-EINVAL; | ||
1212 | break; | ||
1213 | } | ||
1214 | default: | ||
1215 | ret=v4l_compat_translate_ioctl(inode,file,cmd,arg,vivi_do_ioctl); | ||
1216 | } | ||
1217 | |||
1218 | if (debug) { | ||
1219 | if (ret<0) { | ||
1220 | v4l_print_ioctl("vivi(err)", cmd); | ||
1221 | dprintk(1,"errcode=%d\n",ret); | ||
1222 | } else if (_IOC_DIR(cmd) & _IOC_READ) | ||
1223 | v4l_printk_ioctl_arg("vivi(r)",cmd, arg); | ||
1224 | } | ||
1225 | |||
1226 | return ret; | ||
1227 | } | ||
1228 | |||
1229 | static int vivi_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | ||
1230 | { | ||
1231 | return video_usercopy(inode, file, cmd, arg, vivi_do_ioctl); | ||
1232 | } | ||
1233 | |||
1234 | /* ------------------------------------------------------------------ | ||
1235 | File operations for the device | ||
1236 | ------------------------------------------------------------------*/ | ||
1237 | |||
1238 | #define line_buf_size(norm) (norm_maxw(norm)*(format.depth+7)/8) | ||
1239 | |||
1240 | static int vivi_open(struct inode *inode, struct file *file) | ||
1241 | { | ||
1242 | int minor = iminor(inode); | ||
1243 | struct vivi_dev *h,*dev = NULL; | ||
1244 | struct vivi_fh *fh; | ||
1245 | struct list_head *list; | ||
1246 | enum v4l2_buf_type type = 0; | ||
1247 | int i; | ||
1248 | |||
1249 | printk(KERN_DEBUG "vivi: open called (minor=%d)\n",minor); | ||
1250 | |||
1251 | list_for_each(list,&vivi_devlist) { | ||
1252 | h = list_entry(list, struct vivi_dev, vivi_devlist); | ||
1253 | if (h->video_dev.minor == minor) { | ||
1254 | dev = h; | ||
1255 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1256 | } | ||
1257 | } | ||
1258 | if (NULL == dev) | ||
1259 | return -ENODEV; | ||
1260 | |||
1261 | |||
1262 | /* If more than one user, mutex should be added */ | ||
1263 | dev->users++; | ||
1264 | |||
1265 | dprintk(1,"open minor=%d type=%s users=%d\n", | ||
1266 | minor,v4l2_type_names[type],dev->users); | ||
1267 | |||
1268 | /* allocate + initialize per filehandle data */ | ||
1269 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); | ||
1270 | if (NULL == fh) { | ||
1271 | dev->users--; | ||
1272 | return -ENOMEM; | ||
1273 | } | ||
1274 | |||
1275 | file->private_data = fh; | ||
1276 | fh->dev = dev; | ||
1277 | fh->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1278 | fh->fmt = &format; | ||
1279 | fh->width = 640; | ||
1280 | fh->height = 480; | ||
1281 | |||
1282 | /* Put all controls at a sane state */ | ||
1283 | for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) | ||
1284 | qctl_regs[i] =vivi_qctrl[i].default_value; | ||
1285 | |||
1286 | dprintk(1,"Open: fh=0x%08lx, dev=0x%08lx, dev->vidq=0x%08lx\n", | ||
1287 | (unsigned long)fh,(unsigned long)dev,(unsigned long)&dev->vidq); | ||
1288 | dprintk(1,"Open: list_empty queued=%d\n",list_empty(&dev->vidq.queued)); | ||
1289 | dprintk(1,"Open: list_empty active=%d\n",list_empty(&dev->vidq.active)); | ||
1290 | |||
1291 | /* Resets frame counters */ | ||
1292 | dev->h=0; | ||
1293 | dev->m=0; | ||
1294 | dev->s=0; | ||
1295 | dev->us=0; | ||
1296 | dev->jiffies=jiffies; | ||
1297 | sprintf(dev->timestr,"%02d:%02d:%02d:%03d", | ||
1298 | dev->h,dev->m,dev->s,(dev->us+500)/1000); | ||
1299 | |||
1300 | videobuf_queue_init(&fh->vb_vidq, &vivi_video_qops, | ||
1301 | NULL, NULL, | ||
1302 | fh->type, | ||
1303 | V4L2_FIELD_INTERLACED, | ||
1304 | sizeof(struct vivi_buffer),fh); | ||
1305 | |||
1306 | return 0; | ||
1307 | } | ||
1308 | |||
1309 | static ssize_t | ||
1310 | vivi_read(struct file *file, char __user *data, size_t count, loff_t *ppos) | ||
1311 | { | ||
1312 | struct vivi_fh *fh = file->private_data; | ||
1313 | |||
1314 | if (fh->type==V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1315 | if (res_locked(fh->dev)) | ||
1316 | return -EBUSY; | ||
1317 | return videobuf_read_one(&fh->vb_vidq, data, count, ppos, | ||
1318 | file->f_flags & O_NONBLOCK); | ||
1319 | } | ||
1320 | return 0; | ||
1321 | } | ||
1322 | |||
1323 | static unsigned int | ||
1324 | vivi_poll(struct file *file, struct poll_table_struct *wait) | ||
1325 | { | ||
1326 | struct vivi_fh *fh = file->private_data; | ||
1327 | struct vivi_buffer *buf; | ||
1328 | |||
1329 | dprintk(1,"%s\n",__FUNCTION__); | ||
1330 | |||
1331 | if (V4L2_BUF_TYPE_VIDEO_CAPTURE != fh->type) | ||
1332 | return POLLERR; | ||
1333 | |||
1334 | if (res_get(fh->dev,fh)) { | ||
1335 | dprintk(1,"poll: mmap interface\n"); | ||
1336 | /* streaming capture */ | ||
1337 | if (list_empty(&fh->vb_vidq.stream)) | ||
1338 | return POLLERR; | ||
1339 | buf = list_entry(fh->vb_vidq.stream.next,struct vivi_buffer,vb.stream); | ||
1340 | } else { | ||
1341 | dprintk(1,"poll: read() interface\n"); | ||
1342 | /* read() capture */ | ||
1343 | buf = (struct vivi_buffer*)fh->vb_vidq.read_buf; | ||
1344 | if (NULL == buf) | ||
1345 | return POLLERR; | ||
1346 | } | ||
1347 | poll_wait(file, &buf->vb.done, wait); | ||
1348 | if (buf->vb.state == STATE_DONE || | ||
1349 | buf->vb.state == STATE_ERROR) | ||
1350 | return POLLIN|POLLRDNORM; | ||
1351 | return 0; | ||
1352 | } | ||
1353 | |||
1354 | static int vivi_release(struct inode *inode, struct file *file) | ||
1355 | { | ||
1356 | struct vivi_fh *fh = file->private_data; | ||
1357 | struct vivi_dev *dev = fh->dev; | ||
1358 | struct vivi_dmaqueue *vidq = &dev->vidq; | ||
1359 | |||
1360 | int minor = iminor(inode); | ||
1361 | |||
1362 | vivi_stop_thread(vidq); | ||
1363 | videobuf_mmap_free(&fh->vb_vidq); | ||
1364 | |||
1365 | kfree (fh); | ||
1366 | |||
1367 | dev->users--; | ||
1368 | |||
1369 | printk(KERN_DEBUG "vivi: close called (minor=%d, users=%d)\n",minor,dev->users); | ||
1370 | |||
1371 | return 0; | ||
1372 | } | ||
1373 | |||
1374 | static int | ||
1375 | vivi_mmap(struct file *file, struct vm_area_struct * vma) | ||
1376 | { | ||
1377 | struct vivi_fh *fh = file->private_data; | ||
1378 | int ret; | ||
1379 | |||
1380 | dprintk (1,"mmap called, vma=0x%08lx\n",(unsigned long)vma); | ||
1381 | |||
1382 | ret=videobuf_mmap_mapper(&fh->vb_vidq, vma); | ||
1383 | |||
1384 | dprintk (1,"vma start=0x%08lx, size=%ld, ret=%d\n", | ||
1385 | (unsigned long)vma->vm_start, | ||
1386 | (unsigned long)vma->vm_end-(unsigned long)vma->vm_start, | ||
1387 | ret); | ||
1388 | |||
1389 | return ret; | ||
1390 | } | ||
1391 | |||
1392 | static struct file_operations vivi_fops = { | ||
1393 | .owner = THIS_MODULE, | ||
1394 | .open = vivi_open, | ||
1395 | .release = vivi_release, | ||
1396 | .read = vivi_read, | ||
1397 | .poll = vivi_poll, | ||
1398 | .ioctl = vivi_ioctl, | ||
1399 | .mmap = vivi_mmap, | ||
1400 | .llseek = no_llseek, | ||
1401 | }; | ||
1402 | |||
1403 | static struct video_device vivi = { | ||
1404 | .name = "VTM Virtual Video Capture Board", | ||
1405 | .type = VID_TYPE_CAPTURE, | ||
1406 | .hardware = 0, | ||
1407 | .fops = &vivi_fops, | ||
1408 | .minor = -1, | ||
1409 | // .release = video_device_release, | ||
1410 | }; | ||
1411 | /* ------------------------------------------------------------------ | ||
1412 | Initialization and module stuff | ||
1413 | ------------------------------------------------------------------*/ | ||
1414 | |||
1415 | static int __init vivi_init(void) | ||
1416 | { | ||
1417 | int ret; | ||
1418 | struct vivi_dev *dev; | ||
1419 | |||
1420 | dev = kzalloc(sizeof(*dev),GFP_KERNEL); | ||
1421 | if (NULL == dev) | ||
1422 | return -ENOMEM; | ||
1423 | list_add_tail(&dev->vivi_devlist,&vivi_devlist); | ||
1424 | |||
1425 | /* init video dma queues */ | ||
1426 | INIT_LIST_HEAD(&dev->vidq.active); | ||
1427 | INIT_LIST_HEAD(&dev->vidq.queued); | ||
1428 | |||
1429 | /* initialize locks */ | ||
1430 | init_MUTEX(&dev->lock); | ||
1431 | |||
1432 | dev->vidq.timeout.function = vivi_vid_timeout; | ||
1433 | dev->vidq.timeout.data = (unsigned long)dev; | ||
1434 | init_timer(&dev->vidq.timeout); | ||
1435 | |||
1436 | ret = video_register_device(&vivi, VFL_TYPE_GRABBER, video_nr); | ||
1437 | printk(KERN_INFO "Video Technology Magazine Virtual Video Capture Board (Load status: %d)\n", ret); | ||
1438 | return ret; | ||
1439 | } | ||
1440 | |||
1441 | static void __exit vivi_exit(void) | ||
1442 | { | ||
1443 | struct vivi_dev *h; | ||
1444 | struct list_head *list; | ||
1445 | |||
1446 | list_for_each(list,&vivi_devlist) { | ||
1447 | h = list_entry(list, struct vivi_dev, vivi_devlist); | ||
1448 | kfree (h); | ||
1449 | } | ||
1450 | video_unregister_device(&vivi); | ||
1451 | } | ||
1452 | |||
1453 | module_init(vivi_init); | ||
1454 | module_exit(vivi_exit); | ||
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 4cd579967487..40b205b91481 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * vpx3220a, vpx3216b & vpx3214c video decoder driver version 0.0.1 | 2 | * vpx3220a, vpx3216b & vpx3214c video decoder driver version 0.0.1 |
3 | * | 3 | * |
4 | * Copyright (C) 2001 Laurent Pinchart <lpinchart@freegates.be> | 4 | * Copyright (C) 2001 Laurent Pinchart <lpinchart@freegates.be> |
@@ -176,8 +176,8 @@ vpx3220_write_block (struct i2c_client *client, | |||
176 | 176 | ||
177 | static int | 177 | static int |
178 | vpx3220_write_fp_block (struct i2c_client *client, | 178 | vpx3220_write_fp_block (struct i2c_client *client, |
179 | const u16 *data, | 179 | const u16 *data, |
180 | unsigned int len) | 180 | unsigned int len) |
181 | { | 181 | { |
182 | u8 reg; | 182 | u8 reg; |
183 | int ret = 0; | 183 | int ret = 0; |
@@ -316,7 +316,7 @@ vpx3220_command (struct i2c_client *client, | |||
316 | vpx3220_write_fp_block(client, init_fp, | 316 | vpx3220_write_fp_block(client, init_fp, |
317 | sizeof(init_fp) >> 1); | 317 | sizeof(init_fp) >> 1); |
318 | switch (decoder->norm) { | 318 | switch (decoder->norm) { |
319 | 319 | ||
320 | case VIDEO_MODE_NTSC: | 320 | case VIDEO_MODE_NTSC: |
321 | vpx3220_write_fp_block(client, init_ntsc, | 321 | vpx3220_write_fp_block(client, init_ntsc, |
322 | sizeof(init_ntsc) >> 1); | 322 | sizeof(init_ntsc) >> 1); |
@@ -324,7 +324,7 @@ vpx3220_command (struct i2c_client *client, | |||
324 | 324 | ||
325 | case VIDEO_MODE_PAL: | 325 | case VIDEO_MODE_PAL: |
326 | vpx3220_write_fp_block(client, init_pal, | 326 | vpx3220_write_fp_block(client, init_pal, |
327 | sizeof(init_pal) >> 1); | 327 | sizeof(init_pal) >> 1); |
328 | break; | 328 | break; |
329 | case VIDEO_MODE_SECAM: | 329 | case VIDEO_MODE_SECAM: |
330 | vpx3220_write_fp_block(client, init_secam, | 330 | vpx3220_write_fp_block(client, init_secam, |
@@ -332,10 +332,10 @@ vpx3220_command (struct i2c_client *client, | |||
332 | break; | 332 | break; |
333 | default: | 333 | default: |
334 | vpx3220_write_fp_block(client, init_pal, | 334 | vpx3220_write_fp_block(client, init_pal, |
335 | sizeof(init_pal) >> 1); | 335 | sizeof(init_pal) >> 1); |
336 | break; | 336 | break; |
337 | } | 337 | } |
338 | } | 338 | } |
339 | break; | 339 | break; |
340 | 340 | ||
341 | case DECODER_DUMP: | 341 | case DECODER_DUMP: |
@@ -411,7 +411,7 @@ vpx3220_command (struct i2c_client *client, | |||
411 | 411 | ||
412 | /* Here we back up the input selection because it gets | 412 | /* Here we back up the input selection because it gets |
413 | overwritten when we fill the registers with the | 413 | overwritten when we fill the registers with the |
414 | choosen video norm */ | 414 | choosen video norm */ |
415 | temp_input = vpx3220_fp_read(client, 0xf2); | 415 | temp_input = vpx3220_fp_read(client, 0xf2); |
416 | 416 | ||
417 | dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n", | 417 | dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n", |
@@ -578,7 +578,7 @@ static unsigned short normal_i2c[] = | |||
578 | }; | 578 | }; |
579 | 579 | ||
580 | static unsigned short ignore = I2C_CLIENT_END; | 580 | static unsigned short ignore = I2C_CLIENT_END; |
581 | 581 | ||
582 | static struct i2c_client_address_data addr_data = { | 582 | static struct i2c_client_address_data addr_data = { |
583 | .normal_i2c = normal_i2c, | 583 | .normal_i2c = normal_i2c, |
584 | .probe = &ignore, | 584 | .probe = &ignore, |
@@ -661,7 +661,7 @@ vpx3220_detect_client (struct i2c_adapter *adapter, | |||
661 | break; | 661 | break; |
662 | default: | 662 | default: |
663 | dprintk(1, | 663 | dprintk(1, |
664 | KERN_INFO | 664 | KERN_INFO |
665 | "%s: Wrong part number (0x%04x)\n", | 665 | "%s: Wrong part number (0x%04x)\n", |
666 | __func__, pn); | 666 | __func__, pn); |
667 | kfree(client); | 667 | kfree(client); |
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index b7b0afffd214..80ef8a1b8f63 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c | |||
@@ -26,7 +26,7 @@ | |||
26 | Does any other model using the w9966 interface chip exist ? | 26 | Does any other model using the w9966 interface chip exist ? |
27 | 27 | ||
28 | Todo: | 28 | Todo: |
29 | 29 | ||
30 | *Add a working EPP mode, since DMA ECP read isn't implemented | 30 | *Add a working EPP mode, since DMA ECP read isn't implemented |
31 | in the parport drivers. (That's why it's so sloow) | 31 | in the parport drivers. (That's why it's so sloow) |
32 | 32 | ||
@@ -47,9 +47,9 @@ | |||
47 | *Probably some bugs that I don't know of | 47 | *Probably some bugs that I don't know of |
48 | 48 | ||
49 | Please support me by sending feedback! | 49 | Please support me by sending feedback! |
50 | 50 | ||
51 | Changes: | 51 | Changes: |
52 | 52 | ||
53 | Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE | 53 | Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE |
54 | and owner support for newer module locks | 54 | and owner support for newer module locks |
55 | */ | 55 | */ |
@@ -204,7 +204,7 @@ static struct video_device w9966_template = { | |||
204 | */ | 204 | */ |
205 | 205 | ||
206 | 206 | ||
207 | // Set camera phase flags, so we know what to uninit when terminating | 207 | // Set camera phase flags, so we know what to uninit when terminating |
208 | static inline void w9966_setState(struct w9966_dev* cam, int mask, int val) | 208 | static inline void w9966_setState(struct w9966_dev* cam, int mask, int val) |
209 | { | 209 | { |
210 | cam->dev_state = (cam->dev_state & ~mask) ^ val; | 210 | cam->dev_state = (cam->dev_state & ~mask) ^ val; |
@@ -233,7 +233,7 @@ static inline void w9966_pdev_release(struct w9966_dev* cam) | |||
233 | parport_release(cam->pdev); | 233 | parport_release(cam->pdev); |
234 | w9966_setState(cam, W9966_STATE_CLAIMED, 0); | 234 | w9966_setState(cam, W9966_STATE_CLAIMED, 0); |
235 | } | 235 | } |
236 | 236 | ||
237 | // Read register from W9966 interface-chip | 237 | // Read register from W9966 interface-chip |
238 | // Expects a claimed pdev | 238 | // Expects a claimed pdev |
239 | // -1 on error, else register data (byte) | 239 | // -1 on error, else register data (byte) |
@@ -242,7 +242,7 @@ static int w9966_rReg(struct w9966_dev* cam, int reg) | |||
242 | // ECP, read, regtransfer, REG, REG, REG, REG, REG | 242 | // ECP, read, regtransfer, REG, REG, REG, REG, REG |
243 | const unsigned char addr = 0x80 | (reg & 0x1f); | 243 | const unsigned char addr = 0x80 | (reg & 0x1f); |
244 | unsigned char val; | 244 | unsigned char val; |
245 | 245 | ||
246 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) | 246 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) |
247 | return -1; | 247 | return -1; |
248 | if (parport_write(cam->pport, &addr, 1) != 1) | 248 | if (parport_write(cam->pport, &addr, 1) != 1) |
@@ -263,7 +263,7 @@ static int w9966_wReg(struct w9966_dev* cam, int reg, int data) | |||
263 | // ECP, write, regtransfer, REG, REG, REG, REG, REG | 263 | // ECP, write, regtransfer, REG, REG, REG, REG, REG |
264 | const unsigned char addr = 0xc0 | (reg & 0x1f); | 264 | const unsigned char addr = 0xc0 | (reg & 0x1f); |
265 | const unsigned char val = data; | 265 | const unsigned char val = data; |
266 | 266 | ||
267 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) | 267 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) |
268 | return -1; | 268 | return -1; |
269 | if (parport_write(cam->pport, &addr, 1) != 1) | 269 | if (parport_write(cam->pport, &addr, 1) != 1) |
@@ -284,7 +284,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
284 | { | 284 | { |
285 | if (cam->dev_state != 0) | 285 | if (cam->dev_state != 0) |
286 | return -1; | 286 | return -1; |
287 | 287 | ||
288 | cam->pport = port; | 288 | cam->pport = port; |
289 | cam->brightness = 128; | 289 | cam->brightness = 128; |
290 | cam->contrast = 64; | 290 | cam->contrast = 64; |
@@ -302,7 +302,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
302 | cam->ppmode = IEEE1284_MODE_EPP; | 302 | cam->ppmode = IEEE1284_MODE_EPP; |
303 | else | 303 | else |
304 | cam->ppmode = IEEE1284_MODE_ECP; | 304 | cam->ppmode = IEEE1284_MODE_ECP; |
305 | break; | 305 | break; |
306 | case 1: // hw- or sw-ecp | 306 | case 1: // hw- or sw-ecp |
307 | cam->ppmode = IEEE1284_MODE_ECP; | 307 | cam->ppmode = IEEE1284_MODE_ECP; |
308 | break; | 308 | break; |
@@ -310,7 +310,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
310 | cam->ppmode = IEEE1284_MODE_EPP; | 310 | cam->ppmode = IEEE1284_MODE_EPP; |
311 | break; | 311 | break; |
312 | } | 312 | } |
313 | 313 | ||
314 | // Tell the parport driver that we exists | 314 | // Tell the parport driver that we exists |
315 | cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); | 315 | cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); |
316 | if (cam->pdev == NULL) { | 316 | if (cam->pdev == NULL) { |
@@ -320,7 +320,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
320 | w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); | 320 | w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); |
321 | 321 | ||
322 | w9966_pdev_claim(cam); | 322 | w9966_pdev_claim(cam); |
323 | 323 | ||
324 | // Setup a default capture mode | 324 | // Setup a default capture mode |
325 | if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { | 325 | if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { |
326 | DPRINTF("w9966_setup() failed.\n"); | 326 | DPRINTF("w9966_setup() failed.\n"); |
@@ -333,11 +333,11 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
333 | memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); | 333 | memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); |
334 | cam->vdev.priv = cam; | 334 | cam->vdev.priv = cam; |
335 | 335 | ||
336 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) | 336 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) |
337 | return -1; | 337 | return -1; |
338 | 338 | ||
339 | w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); | 339 | w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); |
340 | 340 | ||
341 | // All ok | 341 | // All ok |
342 | printk( | 342 | printk( |
343 | "w9966cf: Found and initialized a webcam on %s.\n", | 343 | "w9966cf: Found and initialized a webcam on %s.\n", |
@@ -391,7 +391,7 @@ static int w9966_findlen(int near, int size, int maxlen) | |||
391 | // Only continue as long as we keep getting better values | 391 | // Only continue as long as we keep getting better values |
392 | if (err > besterr) | 392 | if (err > besterr) |
393 | break; | 393 | break; |
394 | 394 | ||
395 | besterr = err; | 395 | besterr = err; |
396 | bestlen = len; | 396 | bestlen = len; |
397 | } | 397 | } |
@@ -399,7 +399,7 @@ static int w9966_findlen(int near, int size, int maxlen) | |||
399 | return bestlen; | 399 | return bestlen; |
400 | } | 400 | } |
401 | 401 | ||
402 | // Modify capture window (if necessary) | 402 | // Modify capture window (if necessary) |
403 | // and calculate downscaling | 403 | // and calculate downscaling |
404 | // Return -1 on error | 404 | // Return -1 on error |
405 | static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor) | 405 | static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor) |
@@ -407,7 +407,7 @@ static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsig | |||
407 | int maxlen = max - min; | 407 | int maxlen = max - min; |
408 | int len = *end - *beg + 1; | 408 | int len = *end - *beg + 1; |
409 | int newlen = w9966_findlen(len, size, maxlen); | 409 | int newlen = w9966_findlen(len, size, maxlen); |
410 | int err = newlen - len; | 410 | int err = newlen - len; |
411 | 411 | ||
412 | // Check for bad format | 412 | // Check for bad format |
413 | if (newlen > maxlen || newlen < size) | 413 | if (newlen > maxlen || newlen < size) |
@@ -452,8 +452,8 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
452 | 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 452 | 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
453 | 0x00, 0x00, 0x00, 0x71, 0xe7, 0x00, 0x00, 0xc0 | 453 | 0x00, 0x00, 0x00, 0x71, 0xe7, 0x00, 0x00, 0xc0 |
454 | }; | 454 | }; |
455 | 455 | ||
456 | 456 | ||
457 | if (w*h*2 > W9966_SRAMSIZE) | 457 | if (w*h*2 > W9966_SRAMSIZE) |
458 | { | 458 | { |
459 | DPRINTF("capture window exceeds SRAM size!.\n"); | 459 | DPRINTF("capture window exceeds SRAM size!.\n"); |
@@ -469,9 +469,9 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
469 | cam->width = w; | 469 | cam->width = w; |
470 | cam->height = h; | 470 | cam->height = h; |
471 | 471 | ||
472 | enh_s = 0; | 472 | enh_s = 0; |
473 | enh_e = w*h*2; | 473 | enh_e = w*h*2; |
474 | 474 | ||
475 | // Modify capture window if necessary and calculate downscaling | 475 | // Modify capture window if necessary and calculate downscaling |
476 | if ( | 476 | if ( |
477 | w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || | 477 | w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || |
@@ -482,14 +482,14 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
482 | "%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", | 482 | "%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", |
483 | w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80 | 483 | w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80 |
484 | ); | 484 | ); |
485 | 485 | ||
486 | // Setup registers | 486 | // Setup registers |
487 | regs[0x00] = 0x00; // Set normal operation | 487 | regs[0x00] = 0x00; // Set normal operation |
488 | regs[0x01] = 0x18; // Capture mode | 488 | regs[0x01] = 0x18; // Capture mode |
489 | regs[0x02] = scale_y; // V-scaling | 489 | regs[0x02] = scale_y; // V-scaling |
490 | regs[0x03] = scale_x; // H-scaling | 490 | regs[0x03] = scale_x; // H-scaling |
491 | 491 | ||
492 | // Capture window | 492 | // Capture window |
493 | regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits) | 493 | regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits) |
494 | regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits) | 494 | regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits) |
495 | regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits) | 495 | regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits) |
@@ -499,7 +499,7 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
499 | regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits) | 499 | regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits) |
500 | 500 | ||
501 | regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb) | 501 | regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb) |
502 | 502 | ||
503 | // Enhancement layer | 503 | // Enhancement layer |
504 | regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7) | 504 | regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7) |
505 | regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15) | 505 | regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15) |
@@ -515,7 +515,7 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
515 | regs[0x19] = 0xff; // I/O port direction control | 515 | regs[0x19] = 0xff; // I/O port direction control |
516 | regs[0x1a] = 0xff; // I/O port data register | 516 | regs[0x1a] = 0xff; // I/O port data register |
517 | regs[0x1b] = 0x10; // ??? | 517 | regs[0x1b] = 0x10; // ??? |
518 | 518 | ||
519 | // SAA7111 chip settings | 519 | // SAA7111 chip settings |
520 | saa7111_regs[0x0a] = cam->brightness; | 520 | saa7111_regs[0x0a] = cam->brightness; |
521 | saa7111_regs[0x0b] = cam->contrast; | 521 | saa7111_regs[0x0b] = cam->contrast; |
@@ -551,7 +551,7 @@ static inline void w9966_i2c_setsda(struct w9966_dev* cam, int state) | |||
551 | cam->i2c_state |= W9966_I2C_W_DATA; | 551 | cam->i2c_state |= W9966_I2C_W_DATA; |
552 | else | 552 | else |
553 | cam->i2c_state &= ~W9966_I2C_W_DATA; | 553 | cam->i2c_state &= ~W9966_I2C_W_DATA; |
554 | 554 | ||
555 | w9966_wReg(cam, 0x18, cam->i2c_state); | 555 | w9966_wReg(cam, 0x18, cam->i2c_state); |
556 | udelay(5); | 556 | udelay(5); |
557 | } | 557 | } |
@@ -577,7 +577,7 @@ static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state) | |||
577 | 577 | ||
578 | w9966_wReg(cam, 0x18, cam->i2c_state); | 578 | w9966_wReg(cam, 0x18, cam->i2c_state); |
579 | udelay(5); | 579 | udelay(5); |
580 | 580 | ||
581 | // we go to high, we also expect the peripheral to ack. | 581 | // we go to high, we also expect the peripheral to ack. |
582 | if (state) { | 582 | if (state) { |
583 | timeout = jiffies + 100; | 583 | timeout = jiffies + 100; |
@@ -607,16 +607,16 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data) | |||
607 | w9966_i2c_setsda(cam, (data >> i) & 0x01); | 607 | w9966_i2c_setsda(cam, (data >> i) & 0x01); |
608 | 608 | ||
609 | if (w9966_i2c_setscl(cam, 1) == -1) | 609 | if (w9966_i2c_setscl(cam, 1) == -1) |
610 | return -1; | 610 | return -1; |
611 | w9966_i2c_setscl(cam, 0); | 611 | w9966_i2c_setscl(cam, 0); |
612 | } | 612 | } |
613 | 613 | ||
614 | w9966_i2c_setsda(cam, 1); | 614 | w9966_i2c_setsda(cam, 1); |
615 | 615 | ||
616 | if (w9966_i2c_setscl(cam, 1) == -1) | 616 | if (w9966_i2c_setscl(cam, 1) == -1) |
617 | return -1; | 617 | return -1; |
618 | w9966_i2c_setscl(cam, 0); | 618 | w9966_i2c_setscl(cam, 0); |
619 | 619 | ||
620 | return 0; | 620 | return 0; |
621 | } | 621 | } |
622 | 622 | ||
@@ -626,8 +626,8 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data) | |||
626 | static int w9966_i2c_rbyte(struct w9966_dev* cam) | 626 | static int w9966_i2c_rbyte(struct w9966_dev* cam) |
627 | { | 627 | { |
628 | unsigned char data = 0x00; | 628 | unsigned char data = 0x00; |
629 | int i; | 629 | int i; |
630 | 630 | ||
631 | w9966_i2c_setsda(cam, 1); | 631 | w9966_i2c_setsda(cam, 1); |
632 | 632 | ||
633 | for (i = 0; i < 8; i++) | 633 | for (i = 0; i < 8; i++) |
@@ -637,7 +637,7 @@ static int w9966_i2c_rbyte(struct w9966_dev* cam) | |||
637 | data = data << 1; | 637 | data = data << 1; |
638 | if (w9966_i2c_getsda(cam)) | 638 | if (w9966_i2c_getsda(cam)) |
639 | data |= 0x01; | 639 | data |= 0x01; |
640 | 640 | ||
641 | w9966_i2c_setscl(cam, 0); | 641 | w9966_i2c_setscl(cam, 0); |
642 | } | 642 | } |
643 | return data; | 643 | return data; |
@@ -673,11 +673,11 @@ static int w9966_rReg_i2c(struct w9966_dev* cam, int reg) | |||
673 | return -1; | 673 | return -1; |
674 | 674 | ||
675 | w9966_i2c_setsda(cam, 0); | 675 | w9966_i2c_setsda(cam, 0); |
676 | 676 | ||
677 | if (w9966_i2c_setscl(cam, 1) == -1) | 677 | if (w9966_i2c_setscl(cam, 1) == -1) |
678 | return -1; | 678 | return -1; |
679 | w9966_i2c_setsda(cam, 1); | 679 | w9966_i2c_setsda(cam, 1); |
680 | 680 | ||
681 | return data; | 681 | return data; |
682 | } | 682 | } |
683 | #endif | 683 | #endif |
@@ -699,7 +699,7 @@ static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data) | |||
699 | w9966_i2c_setsda(cam, 0); | 699 | w9966_i2c_setsda(cam, 0); |
700 | if (w9966_i2c_setscl(cam, 1) == -1) | 700 | if (w9966_i2c_setscl(cam, 1) == -1) |
701 | return -1; | 701 | return -1; |
702 | 702 | ||
703 | w9966_i2c_setsda(cam, 1); | 703 | w9966_i2c_setsda(cam, 1); |
704 | 704 | ||
705 | return 0; | 705 | return 0; |
@@ -714,7 +714,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
714 | { | 714 | { |
715 | struct video_device *vdev = video_devdata(file); | 715 | struct video_device *vdev = video_devdata(file); |
716 | struct w9966_dev *cam = vdev->priv; | 716 | struct w9966_dev *cam = vdev->priv; |
717 | 717 | ||
718 | switch(cmd) | 718 | switch(cmd) |
719 | { | 719 | { |
720 | case VIDIOCGCAP: | 720 | case VIDIOCGCAP: |
@@ -790,14 +790,14 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
790 | struct video_picture *vpic = arg; | 790 | struct video_picture *vpic = arg; |
791 | if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422) | 791 | if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422) |
792 | return -EINVAL; | 792 | return -EINVAL; |
793 | 793 | ||
794 | cam->brightness = vpic->brightness >> 8; | 794 | cam->brightness = vpic->brightness >> 8; |
795 | cam->hue = (vpic->hue >> 8) - 128; | 795 | cam->hue = (vpic->hue >> 8) - 128; |
796 | cam->color = vpic->colour >> 9; | 796 | cam->color = vpic->colour >> 9; |
797 | cam->contrast = vpic->contrast >> 9; | 797 | cam->contrast = vpic->contrast >> 9; |
798 | 798 | ||
799 | w9966_pdev_claim(cam); | 799 | w9966_pdev_claim(cam); |
800 | 800 | ||
801 | if ( | 801 | if ( |
802 | w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 || | 802 | w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 || |
803 | w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 || | 803 | w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 || |
@@ -807,7 +807,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
807 | w9966_pdev_release(cam); | 807 | w9966_pdev_release(cam); |
808 | return -EIO; | 808 | return -EIO; |
809 | } | 809 | } |
810 | 810 | ||
811 | w9966_pdev_release(cam); | 811 | w9966_pdev_release(cam); |
812 | return 0; | 812 | return 0; |
813 | } | 813 | } |
@@ -815,13 +815,13 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
815 | { | 815 | { |
816 | int ret; | 816 | int ret; |
817 | struct video_window *vwin = arg; | 817 | struct video_window *vwin = arg; |
818 | 818 | ||
819 | if (vwin->flags != 0) | 819 | if (vwin->flags != 0) |
820 | return -EINVAL; | 820 | return -EINVAL; |
821 | if (vwin->clipcount != 0) | 821 | if (vwin->clipcount != 0) |
822 | return -EINVAL; | 822 | return -EINVAL; |
823 | if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W) | 823 | if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W) |
824 | return -EINVAL; | 824 | return -EINVAL; |
825 | if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) | 825 | if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) |
826 | return -EINVAL; | 826 | return -EINVAL; |
827 | 827 | ||
@@ -829,12 +829,12 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
829 | w9966_pdev_claim(cam); | 829 | w9966_pdev_claim(cam); |
830 | ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); | 830 | ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); |
831 | w9966_pdev_release(cam); | 831 | w9966_pdev_release(cam); |
832 | 832 | ||
833 | if (ret != 0) { | 833 | if (ret != 0) { |
834 | DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n"); | 834 | DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n"); |
835 | return -EIO; | 835 | return -EIO; |
836 | } | 836 | } |
837 | 837 | ||
838 | return 0; | 838 | return 0; |
839 | } | 839 | } |
840 | case VIDIOCGWIN: | 840 | case VIDIOCGWIN: |
@@ -846,7 +846,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
846 | return 0; | 846 | return 0; |
847 | } | 847 | } |
848 | // Unimplemented | 848 | // Unimplemented |
849 | case VIDIOCCAPTURE: | 849 | case VIDIOCCAPTURE: |
850 | case VIDIOCGFBUF: | 850 | case VIDIOCGFBUF: |
851 | case VIDIOCSFBUF: | 851 | case VIDIOCSFBUF: |
852 | case VIDIOCKEY: | 852 | case VIDIOCKEY: |
@@ -877,17 +877,17 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, | |||
877 | unsigned char __user *dest = (unsigned char __user *)buf; | 877 | unsigned char __user *dest = (unsigned char __user *)buf; |
878 | unsigned long dleft = count; | 878 | unsigned long dleft = count; |
879 | unsigned char *tbuf; | 879 | unsigned char *tbuf; |
880 | 880 | ||
881 | // Why would anyone want more than this?? | 881 | // Why would anyone want more than this?? |
882 | if (count > cam->width * cam->height * 2) | 882 | if (count > cam->width * cam->height * 2) |
883 | return -EINVAL; | 883 | return -EINVAL; |
884 | 884 | ||
885 | w9966_pdev_claim(cam); | 885 | w9966_pdev_claim(cam); |
886 | w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer | 886 | w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer |
887 | w9966_wReg(cam, 0x00, 0x00); // Return to normal operation | 887 | w9966_wReg(cam, 0x00, 0x00); // Return to normal operation |
888 | w9966_wReg(cam, 0x01, 0x98); // Enable capture | 888 | w9966_wReg(cam, 0x01, 0x98); // Enable capture |
889 | 889 | ||
890 | // write special capture-addr and negotiate into data transfer | 890 | // write special capture-addr and negotiate into data transfer |
891 | if ( | 891 | if ( |
892 | (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )|| | 892 | (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )|| |
893 | (parport_write(cam->pport, &addr, 1) != 1 )|| | 893 | (parport_write(cam->pport, &addr, 1) != 1 )|| |
@@ -906,7 +906,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, | |||
906 | while(dleft > 0) | 906 | while(dleft > 0) |
907 | { | 907 | { |
908 | unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft; | 908 | unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft; |
909 | 909 | ||
910 | if (parport_read(cam->pport, tbuf, tsize) < tsize) { | 910 | if (parport_read(cam->pport, tbuf, tsize) < tsize) { |
911 | count = -EFAULT; | 911 | count = -EFAULT; |
912 | goto out; | 912 | goto out; |
@@ -933,7 +933,7 @@ out: | |||
933 | static void w9966_attach(struct parport *port) | 933 | static void w9966_attach(struct parport *port) |
934 | { | 934 | { |
935 | int i; | 935 | int i; |
936 | 936 | ||
937 | for (i = 0; i < W9966_MAXCAMS; i++) | 937 | for (i = 0; i < W9966_MAXCAMS; i++) |
938 | { | 938 | { |
939 | if (w9966_cams[i].dev_state != 0) // Cam is already assigned | 939 | if (w9966_cams[i].dev_state != 0) // Cam is already assigned |
diff --git a/drivers/usb/media/w9968cf.c b/drivers/media/video/w9968cf.c index b57dec3782e0..20f211b55ad4 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/media/video/w9968cf.c | |||
@@ -71,39 +71,39 @@ MODULE_SUPPORTED_DEVICE("Video"); | |||
71 | static int ovmod_load = W9968CF_OVMOD_LOAD; | 71 | static int ovmod_load = W9968CF_OVMOD_LOAD; |
72 | static unsigned short simcams = W9968CF_SIMCAMS; | 72 | static unsigned short simcams = W9968CF_SIMCAMS; |
73 | static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ | 73 | static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ |
74 | static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 74 | static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
75 | W9968CF_PACKET_SIZE}; | 75 | W9968CF_PACKET_SIZE}; |
76 | static unsigned short max_buffers[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 76 | static unsigned short max_buffers[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
77 | W9968CF_BUFFERS}; | 77 | W9968CF_BUFFERS}; |
78 | static int double_buffer[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 78 | static int double_buffer[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
79 | W9968CF_DOUBLE_BUFFER}; | 79 | W9968CF_DOUBLE_BUFFER}; |
80 | static int clamping[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLAMPING}; | 80 | static int clamping[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLAMPING}; |
81 | static unsigned short filter_type[]= {[0 ... W9968CF_MAX_DEVICES-1] = | 81 | static unsigned short filter_type[]= {[0 ... W9968CF_MAX_DEVICES-1] = |
82 | W9968CF_FILTER_TYPE}; | 82 | W9968CF_FILTER_TYPE}; |
83 | static int largeview[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_LARGEVIEW}; | 83 | static int largeview[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_LARGEVIEW}; |
84 | static unsigned short decompression[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 84 | static unsigned short decompression[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
85 | W9968CF_DECOMPRESSION}; | 85 | W9968CF_DECOMPRESSION}; |
86 | static int upscaling[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_UPSCALING}; | 86 | static int upscaling[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_UPSCALING}; |
87 | static unsigned short force_palette[] = {[0 ... W9968CF_MAX_DEVICES-1] = 0}; | 87 | static unsigned short force_palette[] = {[0 ... W9968CF_MAX_DEVICES-1] = 0}; |
88 | static int force_rgb[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_FORCE_RGB}; | 88 | static int force_rgb[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_FORCE_RGB}; |
89 | static int autobright[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOBRIGHT}; | 89 | static int autobright[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOBRIGHT}; |
90 | static int autoexp[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOEXP}; | 90 | static int autoexp[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOEXP}; |
91 | static unsigned short lightfreq[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 91 | static unsigned short lightfreq[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
92 | W9968CF_LIGHTFREQ}; | 92 | W9968CF_LIGHTFREQ}; |
93 | static int bandingfilter[] = {[0 ... W9968CF_MAX_DEVICES-1]= | 93 | static int bandingfilter[] = {[0 ... W9968CF_MAX_DEVICES-1]= |
94 | W9968CF_BANDINGFILTER}; | 94 | W9968CF_BANDINGFILTER}; |
95 | static short clockdiv[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLOCKDIV}; | 95 | static short clockdiv[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLOCKDIV}; |
96 | static int backlight[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_BACKLIGHT}; | 96 | static int backlight[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_BACKLIGHT}; |
97 | static int mirror[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_MIRROR}; | 97 | static int mirror[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_MIRROR}; |
98 | static int monochrome[] = {[0 ... W9968CF_MAX_DEVICES-1]=W9968CF_MONOCHROME}; | 98 | static int monochrome[] = {[0 ... W9968CF_MAX_DEVICES-1]=W9968CF_MONOCHROME}; |
99 | static unsigned int brightness[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 99 | static unsigned int brightness[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
100 | W9968CF_BRIGHTNESS}; | 100 | W9968CF_BRIGHTNESS}; |
101 | static unsigned int hue[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_HUE}; | 101 | static unsigned int hue[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_HUE}; |
102 | static unsigned int colour[]={[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_COLOUR}; | 102 | static unsigned int colour[]={[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_COLOUR}; |
103 | static unsigned int contrast[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 103 | static unsigned int contrast[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
104 | W9968CF_CONTRAST}; | 104 | W9968CF_CONTRAST}; |
105 | static unsigned int whiteness[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 105 | static unsigned int whiteness[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
106 | W9968CF_WHITENESS}; | 106 | W9968CF_WHITENESS}; |
107 | #ifdef W9968CF_DEBUG | 107 | #ifdef W9968CF_DEBUG |
108 | static unsigned short debug = W9968CF_DEBUG_LEVEL; | 108 | static unsigned short debug = W9968CF_DEBUG_LEVEL; |
109 | static int specific_debug = W9968CF_SPECIFIC_DEBUG; | 109 | static int specific_debug = W9968CF_SPECIFIC_DEBUG; |
@@ -145,251 +145,251 @@ module_param(specific_debug, bool, 0644); | |||
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | #ifdef CONFIG_KMOD | 147 | #ifdef CONFIG_KMOD |
148 | MODULE_PARM_DESC(ovmod_load, | 148 | MODULE_PARM_DESC(ovmod_load, |
149 | "\n<0|1> Automatic 'ovcamchip' module loading." | 149 | "\n<0|1> Automatic 'ovcamchip' module loading." |
150 | "\n0 disabled, 1 enabled." | 150 | "\n0 disabled, 1 enabled." |
151 | "\nIf enabled,'insmod' searches for the required 'ovcamchip'" | 151 | "\nIf enabled,'insmod' searches for the required 'ovcamchip'" |
152 | "\nmodule in the system, according to its configuration, and" | 152 | "\nmodule in the system, according to its configuration, and" |
153 | "\nattempts to load that module automatically. This action is" | 153 | "\nattempts to load that module automatically. This action is" |
154 | "\nperformed once as soon as the 'w9968cf' module is loaded" | 154 | "\nperformed once as soon as the 'w9968cf' module is loaded" |
155 | "\ninto memory." | 155 | "\ninto memory." |
156 | "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." | 156 | "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." |
157 | "\n"); | 157 | "\n"); |
158 | #endif | 158 | #endif |
159 | MODULE_PARM_DESC(simcams, | 159 | MODULE_PARM_DESC(simcams, |
160 | "\n<n> Number of cameras allowed to stream simultaneously." | 160 | "\n<n> Number of cameras allowed to stream simultaneously." |
161 | "\nn may vary from 0 to " | 161 | "\nn may vary from 0 to " |
162 | __MODULE_STRING(W9968CF_MAX_DEVICES)"." | 162 | __MODULE_STRING(W9968CF_MAX_DEVICES)"." |
163 | "\nDefault value is "__MODULE_STRING(W9968CF_SIMCAMS)"." | 163 | "\nDefault value is "__MODULE_STRING(W9968CF_SIMCAMS)"." |
164 | "\n"); | 164 | "\n"); |
165 | MODULE_PARM_DESC(video_nr, | 165 | MODULE_PARM_DESC(video_nr, |
166 | "\n<-1|n[,...]> Specify V4L minor mode number." | 166 | "\n<-1|n[,...]> Specify V4L minor mode number." |
167 | "\n -1 = use next available (default)" | 167 | "\n -1 = use next available (default)" |
168 | "\n n = use minor number n (integer >= 0)" | 168 | "\n n = use minor number n (integer >= 0)" |
169 | "\nYou can specify up to "__MODULE_STRING(W9968CF_MAX_DEVICES) | 169 | "\nYou can specify up to "__MODULE_STRING(W9968CF_MAX_DEVICES) |
170 | " cameras this way." | 170 | " cameras this way." |
171 | "\nFor example:" | 171 | "\nFor example:" |
172 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" | 172 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" |
173 | "\nthe second camera and use auto for the first" | 173 | "\nthe second camera and use auto for the first" |
174 | "\none and for every other camera." | 174 | "\none and for every other camera." |
175 | "\n"); | 175 | "\n"); |
176 | MODULE_PARM_DESC(packet_size, | 176 | MODULE_PARM_DESC(packet_size, |
177 | "\n<n[,...]> Specify the maximum data payload" | 177 | "\n<n[,...]> Specify the maximum data payload" |
178 | "\nsize in bytes for alternate settings, for each device." | 178 | "\nsize in bytes for alternate settings, for each device." |
179 | "\nn is scaled between 63 and 1023 " | 179 | "\nn is scaled between 63 and 1023 " |
180 | "(default is "__MODULE_STRING(W9968CF_PACKET_SIZE)")." | 180 | "(default is "__MODULE_STRING(W9968CF_PACKET_SIZE)")." |
181 | "\n"); | 181 | "\n"); |
182 | MODULE_PARM_DESC(max_buffers, | 182 | MODULE_PARM_DESC(max_buffers, |
183 | "\n<n[,...]> For advanced users." | 183 | "\n<n[,...]> For advanced users." |
184 | "\nSpecify the maximum number of video frame buffers" | 184 | "\nSpecify the maximum number of video frame buffers" |
185 | "\nto allocate for each device, from 2 to " | 185 | "\nto allocate for each device, from 2 to " |
186 | __MODULE_STRING(W9968CF_MAX_BUFFERS) | 186 | __MODULE_STRING(W9968CF_MAX_BUFFERS) |
187 | ". (default is "__MODULE_STRING(W9968CF_BUFFERS)")." | 187 | ". (default is "__MODULE_STRING(W9968CF_BUFFERS)")." |
188 | "\n"); | 188 | "\n"); |
189 | MODULE_PARM_DESC(double_buffer, | 189 | MODULE_PARM_DESC(double_buffer, |
190 | "\n<0|1[,...]> " | 190 | "\n<0|1[,...]> " |
191 | "Hardware double buffering: 0 disabled, 1 enabled." | 191 | "Hardware double buffering: 0 disabled, 1 enabled." |
192 | "\nIt should be enabled if you want smooth video output: if" | 192 | "\nIt should be enabled if you want smooth video output: if" |
193 | "\nyou obtain out of sync. video, disable it, or try to" | 193 | "\nyou obtain out of sync. video, disable it, or try to" |
194 | "\ndecrease the 'clockdiv' module parameter value." | 194 | "\ndecrease the 'clockdiv' module parameter value." |
195 | "\nDefault value is "__MODULE_STRING(W9968CF_DOUBLE_BUFFER) | 195 | "\nDefault value is "__MODULE_STRING(W9968CF_DOUBLE_BUFFER) |
196 | " for every device." | 196 | " for every device." |
197 | "\n"); | 197 | "\n"); |
198 | MODULE_PARM_DESC(clamping, | 198 | MODULE_PARM_DESC(clamping, |
199 | "\n<0|1[,...]> Video data clamping: 0 disabled, 1 enabled." | 199 | "\n<0|1[,...]> Video data clamping: 0 disabled, 1 enabled." |
200 | "\nDefault value is "__MODULE_STRING(W9968CF_CLAMPING) | 200 | "\nDefault value is "__MODULE_STRING(W9968CF_CLAMPING) |
201 | " for every device." | 201 | " for every device." |
202 | "\n"); | 202 | "\n"); |
203 | MODULE_PARM_DESC(filter_type, | 203 | MODULE_PARM_DESC(filter_type, |
204 | "\n<0|1|2[,...]> Video filter type." | 204 | "\n<0|1|2[,...]> Video filter type." |
205 | "\n0 none, 1 (1-2-1) 3-tap filter, " | 205 | "\n0 none, 1 (1-2-1) 3-tap filter, " |
206 | "2 (2-3-6-3-2) 5-tap filter." | 206 | "2 (2-3-6-3-2) 5-tap filter." |
207 | "\nDefault value is "__MODULE_STRING(W9968CF_FILTER_TYPE) | 207 | "\nDefault value is "__MODULE_STRING(W9968CF_FILTER_TYPE) |
208 | " for every device." | 208 | " for every device." |
209 | "\nThe filter is used to reduce noise and aliasing artifacts" | 209 | "\nThe filter is used to reduce noise and aliasing artifacts" |
210 | "\nproduced by the CCD or CMOS image sensor, and the scaling" | 210 | "\nproduced by the CCD or CMOS image sensor, and the scaling" |
211 | " process." | 211 | " process." |
212 | "\n"); | 212 | "\n"); |
213 | MODULE_PARM_DESC(largeview, | 213 | MODULE_PARM_DESC(largeview, |
214 | "\n<0|1[,...]> Large view: 0 disabled, 1 enabled." | 214 | "\n<0|1[,...]> Large view: 0 disabled, 1 enabled." |
215 | "\nDefault value is "__MODULE_STRING(W9968CF_LARGEVIEW) | 215 | "\nDefault value is "__MODULE_STRING(W9968CF_LARGEVIEW) |
216 | " for every device." | 216 | " for every device." |
217 | "\n"); | 217 | "\n"); |
218 | MODULE_PARM_DESC(upscaling, | 218 | MODULE_PARM_DESC(upscaling, |
219 | "\n<0|1[,...]> Software scaling (for non-compressed video):" | 219 | "\n<0|1[,...]> Software scaling (for non-compressed video):" |
220 | "\n0 disabled, 1 enabled." | 220 | "\n0 disabled, 1 enabled." |
221 | "\nDisable it if you have a slow CPU or you don't have" | 221 | "\nDisable it if you have a slow CPU or you don't have" |
222 | " enough memory." | 222 | " enough memory." |
223 | "\nDefault value is "__MODULE_STRING(W9968CF_UPSCALING) | 223 | "\nDefault value is "__MODULE_STRING(W9968CF_UPSCALING) |
224 | " for every device." | 224 | " for every device." |
225 | "\nIf 'w9968cf-vpp' is not present, this parameter is" | 225 | "\nIf 'w9968cf-vpp' is not present, this parameter is" |
226 | " set to 0." | 226 | " set to 0." |
227 | "\n"); | 227 | "\n"); |
228 | MODULE_PARM_DESC(decompression, | 228 | MODULE_PARM_DESC(decompression, |
229 | "\n<0|1|2[,...]> Software video decompression:" | 229 | "\n<0|1|2[,...]> Software video decompression:" |
230 | "\n- 0 disables decompression (doesn't allow formats needing" | 230 | "\n- 0 disables decompression (doesn't allow formats needing" |
231 | " decompression)" | 231 | " decompression)" |
232 | "\n- 1 forces decompression (allows formats needing" | 232 | "\n- 1 forces decompression (allows formats needing" |
233 | " decompression only);" | 233 | " decompression only);" |
234 | "\n- 2 allows any permitted formats." | 234 | "\n- 2 allows any permitted formats." |
235 | "\nFormats supporting compressed video are YUV422P and" | 235 | "\nFormats supporting compressed video are YUV422P and" |
236 | " YUV420P/YUV420 " | 236 | " YUV420P/YUV420 " |
237 | "\nin any resolutions where both width and height are " | 237 | "\nin any resolutions where both width and height are " |
238 | "a multiple of 16." | 238 | "a multiple of 16." |
239 | "\nDefault value is "__MODULE_STRING(W9968CF_DECOMPRESSION) | 239 | "\nDefault value is "__MODULE_STRING(W9968CF_DECOMPRESSION) |
240 | " for every device." | 240 | " for every device." |
241 | "\nIf 'w9968cf-vpp' is not present, forcing decompression is " | 241 | "\nIf 'w9968cf-vpp' is not present, forcing decompression is " |
242 | "\nnot allowed; in this case this parameter is set to 2." | 242 | "\nnot allowed; in this case this parameter is set to 2." |
243 | "\n"); | 243 | "\n"); |
244 | MODULE_PARM_DESC(force_palette, | 244 | MODULE_PARM_DESC(force_palette, |
245 | "\n<0" | 245 | "\n<0" |
246 | "|" __MODULE_STRING(VIDEO_PALETTE_UYVY) | 246 | "|" __MODULE_STRING(VIDEO_PALETTE_UYVY) |
247 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV420) | 247 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV420) |
248 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV422P) | 248 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV422P) |
249 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV420P) | 249 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV420P) |
250 | "|" __MODULE_STRING(VIDEO_PALETTE_YUYV) | 250 | "|" __MODULE_STRING(VIDEO_PALETTE_YUYV) |
251 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV422) | 251 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV422) |
252 | "|" __MODULE_STRING(VIDEO_PALETTE_GREY) | 252 | "|" __MODULE_STRING(VIDEO_PALETTE_GREY) |
253 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB555) | 253 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB555) |
254 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB565) | 254 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB565) |
255 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB24) | 255 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB24) |
256 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB32) | 256 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB32) |
257 | "[,...]>" | 257 | "[,...]>" |
258 | " Force picture palette." | 258 | " Force picture palette." |
259 | "\nIn order:" | 259 | "\nIn order:" |
260 | "\n- 0 allows any of the following formats:" | 260 | "\n- 0 allows any of the following formats:" |
261 | "\n- UYVY 16 bpp - Original video, compression disabled" | 261 | "\n- UYVY 16 bpp - Original video, compression disabled" |
262 | "\n- YUV420 12 bpp - Original video, compression enabled" | 262 | "\n- YUV420 12 bpp - Original video, compression enabled" |
263 | "\n- YUV422P 16 bpp - Original video, compression enabled" | 263 | "\n- YUV422P 16 bpp - Original video, compression enabled" |
264 | "\n- YUV420P 12 bpp - Original video, compression enabled" | 264 | "\n- YUV420P 12 bpp - Original video, compression enabled" |
265 | "\n- YUVY 16 bpp - Software conversion from UYVY" | 265 | "\n- YUVY 16 bpp - Software conversion from UYVY" |
266 | "\n- YUV422 16 bpp - Software conversion from UYVY" | 266 | "\n- YUV422 16 bpp - Software conversion from UYVY" |
267 | "\n- GREY 8 bpp - Software conversion from UYVY" | 267 | "\n- GREY 8 bpp - Software conversion from UYVY" |
268 | "\n- RGB555 16 bpp - Software conversion from UYVY" | 268 | "\n- RGB555 16 bpp - Software conversion from UYVY" |
269 | "\n- RGB565 16 bpp - Software conversion from UYVY" | 269 | "\n- RGB565 16 bpp - Software conversion from UYVY" |
270 | "\n- RGB24 24 bpp - Software conversion from UYVY" | 270 | "\n- RGB24 24 bpp - Software conversion from UYVY" |
271 | "\n- RGB32 32 bpp - Software conversion from UYVY" | 271 | "\n- RGB32 32 bpp - Software conversion from UYVY" |
272 | "\nWhen not 0, this parameter will override 'decompression'." | 272 | "\nWhen not 0, this parameter will override 'decompression'." |
273 | "\nDefault value is 0 for every device." | 273 | "\nDefault value is 0 for every device." |
274 | "\nInitial palette is " | 274 | "\nInitial palette is " |
275 | __MODULE_STRING(W9968CF_PALETTE_DECOMP_ON)"." | 275 | __MODULE_STRING(W9968CF_PALETTE_DECOMP_ON)"." |
276 | "\nIf 'w9968cf-vpp' is not present, this parameter is" | 276 | "\nIf 'w9968cf-vpp' is not present, this parameter is" |
277 | " set to 9 (UYVY)." | 277 | " set to 9 (UYVY)." |
278 | "\n"); | 278 | "\n"); |
279 | MODULE_PARM_DESC(force_rgb, | 279 | MODULE_PARM_DESC(force_rgb, |
280 | "\n<0|1[,...]> Read RGB video data instead of BGR:" | 280 | "\n<0|1[,...]> Read RGB video data instead of BGR:" |
281 | "\n 1 = use RGB component ordering." | 281 | "\n 1 = use RGB component ordering." |
282 | "\n 0 = use BGR component ordering." | 282 | "\n 0 = use BGR component ordering." |
283 | "\nThis parameter has effect when using RGBX palettes only." | 283 | "\nThis parameter has effect when using RGBX palettes only." |
284 | "\nDefault value is "__MODULE_STRING(W9968CF_FORCE_RGB) | 284 | "\nDefault value is "__MODULE_STRING(W9968CF_FORCE_RGB) |
285 | " for every device." | 285 | " for every device." |
286 | "\n"); | 286 | "\n"); |
287 | MODULE_PARM_DESC(autobright, | 287 | MODULE_PARM_DESC(autobright, |
288 | "\n<0|1[,...]> Image sensor automatically changes brightness:" | 288 | "\n<0|1[,...]> Image sensor automatically changes brightness:" |
289 | "\n 0 = no, 1 = yes" | 289 | "\n 0 = no, 1 = yes" |
290 | "\nDefault value is "__MODULE_STRING(W9968CF_AUTOBRIGHT) | 290 | "\nDefault value is "__MODULE_STRING(W9968CF_AUTOBRIGHT) |
291 | " for every device." | 291 | " for every device." |
292 | "\n"); | 292 | "\n"); |
293 | MODULE_PARM_DESC(autoexp, | 293 | MODULE_PARM_DESC(autoexp, |
294 | "\n<0|1[,...]> Image sensor automatically changes exposure:" | 294 | "\n<0|1[,...]> Image sensor automatically changes exposure:" |
295 | "\n 0 = no, 1 = yes" | 295 | "\n 0 = no, 1 = yes" |
296 | "\nDefault value is "__MODULE_STRING(W9968CF_AUTOEXP) | 296 | "\nDefault value is "__MODULE_STRING(W9968CF_AUTOEXP) |
297 | " for every device." | 297 | " for every device." |
298 | "\n"); | 298 | "\n"); |
299 | MODULE_PARM_DESC(lightfreq, | 299 | MODULE_PARM_DESC(lightfreq, |
300 | "\n<50|60[,...]> Light frequency in Hz:" | 300 | "\n<50|60[,...]> Light frequency in Hz:" |
301 | "\n 50 for European and Asian lighting," | 301 | "\n 50 for European and Asian lighting," |
302 | " 60 for American lighting." | 302 | " 60 for American lighting." |
303 | "\nDefault value is "__MODULE_STRING(W9968CF_LIGHTFREQ) | 303 | "\nDefault value is "__MODULE_STRING(W9968CF_LIGHTFREQ) |
304 | " for every device." | 304 | " for every device." |
305 | "\n"); | 305 | "\n"); |
306 | MODULE_PARM_DESC(bandingfilter, | 306 | MODULE_PARM_DESC(bandingfilter, |
307 | "\n<0|1[,...]> Banding filter to reduce effects of" | 307 | "\n<0|1[,...]> Banding filter to reduce effects of" |
308 | " fluorescent lighting:" | 308 | " fluorescent lighting:" |
309 | "\n 0 disabled, 1 enabled." | 309 | "\n 0 disabled, 1 enabled." |
310 | "\nThis filter tries to reduce the pattern of horizontal" | 310 | "\nThis filter tries to reduce the pattern of horizontal" |
311 | "\nlight/dark bands caused by some (usually fluorescent)" | 311 | "\nlight/dark bands caused by some (usually fluorescent)" |
312 | " lighting." | 312 | " lighting." |
313 | "\nDefault value is "__MODULE_STRING(W9968CF_BANDINGFILTER) | 313 | "\nDefault value is "__MODULE_STRING(W9968CF_BANDINGFILTER) |
314 | " for every device." | 314 | " for every device." |
315 | "\n"); | 315 | "\n"); |
316 | MODULE_PARM_DESC(clockdiv, | 316 | MODULE_PARM_DESC(clockdiv, |
317 | "\n<-1|n[,...]> " | 317 | "\n<-1|n[,...]> " |
318 | "Force pixel clock divisor to a specific value (for experts):" | 318 | "Force pixel clock divisor to a specific value (for experts):" |
319 | "\n n may vary from 0 to 127." | 319 | "\n n may vary from 0 to 127." |
320 | "\n -1 for automatic value." | 320 | "\n -1 for automatic value." |
321 | "\nSee also the 'double_buffer' module parameter." | 321 | "\nSee also the 'double_buffer' module parameter." |
322 | "\nDefault value is "__MODULE_STRING(W9968CF_CLOCKDIV) | 322 | "\nDefault value is "__MODULE_STRING(W9968CF_CLOCKDIV) |
323 | " for every device." | 323 | " for every device." |
324 | "\n"); | 324 | "\n"); |
325 | MODULE_PARM_DESC(backlight, | 325 | MODULE_PARM_DESC(backlight, |
326 | "\n<0|1[,...]> Objects are lit from behind:" | 326 | "\n<0|1[,...]> Objects are lit from behind:" |
327 | "\n 0 = no, 1 = yes" | 327 | "\n 0 = no, 1 = yes" |
328 | "\nDefault value is "__MODULE_STRING(W9968CF_BACKLIGHT) | 328 | "\nDefault value is "__MODULE_STRING(W9968CF_BACKLIGHT) |
329 | " for every device." | 329 | " for every device." |
330 | "\n"); | 330 | "\n"); |
331 | MODULE_PARM_DESC(mirror, | 331 | MODULE_PARM_DESC(mirror, |
332 | "\n<0|1[,...]> Reverse image horizontally:" | 332 | "\n<0|1[,...]> Reverse image horizontally:" |
333 | "\n 0 = no, 1 = yes" | 333 | "\n 0 = no, 1 = yes" |
334 | "\nDefault value is "__MODULE_STRING(W9968CF_MIRROR) | 334 | "\nDefault value is "__MODULE_STRING(W9968CF_MIRROR) |
335 | " for every device." | 335 | " for every device." |
336 | "\n"); | 336 | "\n"); |
337 | MODULE_PARM_DESC(monochrome, | 337 | MODULE_PARM_DESC(monochrome, |
338 | "\n<0|1[,...]> Use image sensor as monochrome sensor:" | 338 | "\n<0|1[,...]> Use image sensor as monochrome sensor:" |
339 | "\n 0 = no, 1 = yes" | 339 | "\n 0 = no, 1 = yes" |
340 | "\nNot all the sensors support monochrome color." | 340 | "\nNot all the sensors support monochrome color." |
341 | "\nDefault value is "__MODULE_STRING(W9968CF_MONOCHROME) | 341 | "\nDefault value is "__MODULE_STRING(W9968CF_MONOCHROME) |
342 | " for every device." | 342 | " for every device." |
343 | "\n"); | 343 | "\n"); |
344 | MODULE_PARM_DESC(brightness, | 344 | MODULE_PARM_DESC(brightness, |
345 | "\n<n[,...]> Set picture brightness (0-65535)." | 345 | "\n<n[,...]> Set picture brightness (0-65535)." |
346 | "\nDefault value is "__MODULE_STRING(W9968CF_BRIGHTNESS) | 346 | "\nDefault value is "__MODULE_STRING(W9968CF_BRIGHTNESS) |
347 | " for every device." | 347 | " for every device." |
348 | "\nThis parameter has no effect if 'autobright' is enabled." | 348 | "\nThis parameter has no effect if 'autobright' is enabled." |
349 | "\n"); | 349 | "\n"); |
350 | MODULE_PARM_DESC(hue, | 350 | MODULE_PARM_DESC(hue, |
351 | "\n<n[,...]> Set picture hue (0-65535)." | 351 | "\n<n[,...]> Set picture hue (0-65535)." |
352 | "\nDefault value is "__MODULE_STRING(W9968CF_HUE) | 352 | "\nDefault value is "__MODULE_STRING(W9968CF_HUE) |
353 | " for every device." | 353 | " for every device." |
354 | "\n"); | 354 | "\n"); |
355 | MODULE_PARM_DESC(colour, | 355 | MODULE_PARM_DESC(colour, |
356 | "\n<n[,...]> Set picture saturation (0-65535)." | 356 | "\n<n[,...]> Set picture saturation (0-65535)." |
357 | "\nDefault value is "__MODULE_STRING(W9968CF_COLOUR) | 357 | "\nDefault value is "__MODULE_STRING(W9968CF_COLOUR) |
358 | " for every device." | 358 | " for every device." |
359 | "\n"); | 359 | "\n"); |
360 | MODULE_PARM_DESC(contrast, | 360 | MODULE_PARM_DESC(contrast, |
361 | "\n<n[,...]> Set picture contrast (0-65535)." | 361 | "\n<n[,...]> Set picture contrast (0-65535)." |
362 | "\nDefault value is "__MODULE_STRING(W9968CF_CONTRAST) | 362 | "\nDefault value is "__MODULE_STRING(W9968CF_CONTRAST) |
363 | " for every device." | 363 | " for every device." |
364 | "\n"); | 364 | "\n"); |
365 | MODULE_PARM_DESC(whiteness, | 365 | MODULE_PARM_DESC(whiteness, |
366 | "\n<n[,...]> Set picture whiteness (0-65535)." | 366 | "\n<n[,...]> Set picture whiteness (0-65535)." |
367 | "\nDefault value is "__MODULE_STRING(W9968CF_WHITENESS) | 367 | "\nDefault value is "__MODULE_STRING(W9968CF_WHITENESS) |
368 | " for every device." | 368 | " for every device." |
369 | "\n"); | 369 | "\n"); |
370 | #ifdef W9968CF_DEBUG | 370 | #ifdef W9968CF_DEBUG |
371 | MODULE_PARM_DESC(debug, | 371 | MODULE_PARM_DESC(debug, |
372 | "\n<n> Debugging information level, from 0 to 6:" | 372 | "\n<n> Debugging information level, from 0 to 6:" |
373 | "\n0 = none (use carefully)" | 373 | "\n0 = none (use carefully)" |
374 | "\n1 = critical errors" | 374 | "\n1 = critical errors" |
375 | "\n2 = significant informations" | 375 | "\n2 = significant informations" |
376 | "\n3 = configuration or general messages" | 376 | "\n3 = configuration or general messages" |
377 | "\n4 = warnings" | 377 | "\n4 = warnings" |
378 | "\n5 = called functions" | 378 | "\n5 = called functions" |
379 | "\n6 = function internals" | 379 | "\n6 = function internals" |
380 | "\nLevel 5 and 6 are useful for testing only, when only " | 380 | "\nLevel 5 and 6 are useful for testing only, when only " |
381 | "one device is used." | 381 | "one device is used." |
382 | "\nDefault value is "__MODULE_STRING(W9968CF_DEBUG_LEVEL)"." | 382 | "\nDefault value is "__MODULE_STRING(W9968CF_DEBUG_LEVEL)"." |
383 | "\n"); | 383 | "\n"); |
384 | MODULE_PARM_DESC(specific_debug, | 384 | MODULE_PARM_DESC(specific_debug, |
385 | "\n<0|1> Enable or disable specific debugging messages:" | 385 | "\n<0|1> Enable or disable specific debugging messages:" |
386 | "\n0 = print messages concerning every level" | 386 | "\n0 = print messages concerning every level" |
387 | " <= 'debug' level." | 387 | " <= 'debug' level." |
388 | "\n1 = print messages concerning the level" | 388 | "\n1 = print messages concerning the level" |
389 | " indicated by 'debug'." | 389 | " indicated by 'debug'." |
390 | "\nDefault value is " | 390 | "\nDefault value is " |
391 | __MODULE_STRING(W9968CF_SPECIFIC_DEBUG)"." | 391 | __MODULE_STRING(W9968CF_SPECIFIC_DEBUG)"." |
392 | "\n"); | 392 | "\n"); |
393 | #endif /* W9968CF_DEBUG */ | 393 | #endif /* W9968CF_DEBUG */ |
394 | 394 | ||
395 | 395 | ||
@@ -406,7 +406,7 @@ static int w9968cf_mmap(struct file*, struct vm_area_struct*); | |||
406 | static int w9968cf_ioctl(struct inode*, struct file*, unsigned, unsigned long); | 406 | static int w9968cf_ioctl(struct inode*, struct file*, unsigned, unsigned long); |
407 | static ssize_t w9968cf_read(struct file*, char __user *, size_t, loff_t*); | 407 | static ssize_t w9968cf_read(struct file*, char __user *, size_t, loff_t*); |
408 | static int w9968cf_v4l_ioctl(struct inode*, struct file*, unsigned int, | 408 | static int w9968cf_v4l_ioctl(struct inode*, struct file*, unsigned int, |
409 | void __user *); | 409 | void __user *); |
410 | 410 | ||
411 | /* USB-specific */ | 411 | /* USB-specific */ |
412 | static int w9968cf_start_transfer(struct w9968cf_device*); | 412 | static int w9968cf_start_transfer(struct w9968cf_device*); |
@@ -428,25 +428,25 @@ static int w9968cf_smbus_write_ack(struct w9968cf_device*); | |||
428 | static int w9968cf_smbus_read_ack(struct w9968cf_device*); | 428 | static int w9968cf_smbus_read_ack(struct w9968cf_device*); |
429 | static int w9968cf_smbus_refresh_bus(struct w9968cf_device*); | 429 | static int w9968cf_smbus_refresh_bus(struct w9968cf_device*); |
430 | static int w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, | 430 | static int w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, |
431 | u16 address, u8* value); | 431 | u16 address, u8* value); |
432 | static int w9968cf_i2c_adap_read_byte_data(struct w9968cf_device*, u16 address, | 432 | static int w9968cf_i2c_adap_read_byte_data(struct w9968cf_device*, u16 address, |
433 | u8 subaddress, u8* value); | 433 | u8 subaddress, u8* value); |
434 | static int w9968cf_i2c_adap_write_byte(struct w9968cf_device*, | 434 | static int w9968cf_i2c_adap_write_byte(struct w9968cf_device*, |
435 | u16 address, u8 subaddress); | 435 | u16 address, u8 subaddress); |
436 | static int w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device*, | 436 | static int w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device*, |
437 | u16 address, u8 subaddress, | 437 | u16 address, u8 subaddress, |
438 | u8 value); | 438 | u8 value); |
439 | 439 | ||
440 | /* I2C interface to kernel */ | 440 | /* I2C interface to kernel */ |
441 | static int w9968cf_i2c_init(struct w9968cf_device*); | 441 | static int w9968cf_i2c_init(struct w9968cf_device*); |
442 | static int w9968cf_i2c_smbus_xfer(struct i2c_adapter*, u16 addr, | 442 | static int w9968cf_i2c_smbus_xfer(struct i2c_adapter*, u16 addr, |
443 | unsigned short flags, char read_write, | 443 | unsigned short flags, char read_write, |
444 | u8 command, int size, union i2c_smbus_data*); | 444 | u8 command, int size, union i2c_smbus_data*); |
445 | static u32 w9968cf_i2c_func(struct i2c_adapter*); | 445 | static u32 w9968cf_i2c_func(struct i2c_adapter*); |
446 | static int w9968cf_i2c_attach_inform(struct i2c_client*); | 446 | static int w9968cf_i2c_attach_inform(struct i2c_client*); |
447 | static int w9968cf_i2c_detach_inform(struct i2c_client*); | 447 | static int w9968cf_i2c_detach_inform(struct i2c_client*); |
448 | static int w9968cf_i2c_control(struct i2c_adapter*, unsigned int cmd, | 448 | static int w9968cf_i2c_control(struct i2c_adapter*, unsigned int cmd, |
449 | unsigned long arg); | 449 | unsigned long arg); |
450 | 450 | ||
451 | /* Memory management */ | 451 | /* Memory management */ |
452 | static void* rvmalloc(unsigned long size); | 452 | static void* rvmalloc(unsigned long size); |
@@ -458,17 +458,17 @@ static int w9968cf_allocate_memory(struct w9968cf_device*); | |||
458 | static int w9968cf_sensor_set_control(struct w9968cf_device*,int cid,int val); | 458 | static int w9968cf_sensor_set_control(struct w9968cf_device*,int cid,int val); |
459 | static int w9968cf_sensor_get_control(struct w9968cf_device*,int cid,int *val); | 459 | static int w9968cf_sensor_get_control(struct w9968cf_device*,int cid,int *val); |
460 | static int w9968cf_sensor_cmd(struct w9968cf_device*, | 460 | static int w9968cf_sensor_cmd(struct w9968cf_device*, |
461 | unsigned int cmd, void *arg); | 461 | unsigned int cmd, void *arg); |
462 | static int w9968cf_sensor_init(struct w9968cf_device*); | 462 | static int w9968cf_sensor_init(struct w9968cf_device*); |
463 | static int w9968cf_sensor_update_settings(struct w9968cf_device*); | 463 | static int w9968cf_sensor_update_settings(struct w9968cf_device*); |
464 | static int w9968cf_sensor_get_picture(struct w9968cf_device*); | 464 | static int w9968cf_sensor_get_picture(struct w9968cf_device*); |
465 | static int w9968cf_sensor_update_picture(struct w9968cf_device*, | 465 | static int w9968cf_sensor_update_picture(struct w9968cf_device*, |
466 | struct video_picture pict); | 466 | struct video_picture pict); |
467 | 467 | ||
468 | /* Other helper functions */ | 468 | /* Other helper functions */ |
469 | static void w9968cf_configure_camera(struct w9968cf_device*,struct usb_device*, | 469 | static void w9968cf_configure_camera(struct w9968cf_device*,struct usb_device*, |
470 | enum w9968cf_model_id, | 470 | enum w9968cf_model_id, |
471 | const unsigned short dev_nr); | 471 | const unsigned short dev_nr); |
472 | static void w9968cf_adjust_configuration(struct w9968cf_device*); | 472 | static void w9968cf_adjust_configuration(struct w9968cf_device*); |
473 | static int w9968cf_turn_on_led(struct w9968cf_device*); | 473 | static int w9968cf_turn_on_led(struct w9968cf_device*); |
474 | static int w9968cf_init_chip(struct w9968cf_device*); | 474 | static int w9968cf_init_chip(struct w9968cf_device*); |
@@ -477,8 +477,8 @@ static inline u16 w9968cf_valid_depth(u16 palette); | |||
477 | static inline u8 w9968cf_need_decompression(u16 palette); | 477 | static inline u8 w9968cf_need_decompression(u16 palette); |
478 | static int w9968cf_set_picture(struct w9968cf_device*, struct video_picture); | 478 | static int w9968cf_set_picture(struct w9968cf_device*, struct video_picture); |
479 | static int w9968cf_set_window(struct w9968cf_device*, struct video_window); | 479 | static int w9968cf_set_window(struct w9968cf_device*, struct video_window); |
480 | static int w9968cf_postprocess_frame(struct w9968cf_device*, | 480 | static int w9968cf_postprocess_frame(struct w9968cf_device*, |
481 | struct w9968cf_frame_t*); | 481 | struct w9968cf_frame_t*); |
482 | static int w9968cf_adjust_window_size(struct w9968cf_device*, u16* w, u16* h); | 482 | static int w9968cf_adjust_window_size(struct w9968cf_device*, u16* w, u16* h); |
483 | static void w9968cf_init_framelist(struct w9968cf_device*); | 483 | static void w9968cf_init_framelist(struct w9968cf_device*); |
484 | static void w9968cf_push_frame(struct w9968cf_device*, u8 f_num); | 484 | static void w9968cf_push_frame(struct w9968cf_device*, u8 f_num); |
@@ -497,11 +497,11 @@ struct w9968cf_symbolic_list { | |||
497 | const char *name; | 497 | const char *name; |
498 | }; | 498 | }; |
499 | 499 | ||
500 | /*-------------------------------------------------------------------------- | 500 | /*-------------------------------------------------------------------------- |
501 | Returns the name of the matching element in the symbolic_list array. The | 501 | Returns the name of the matching element in the symbolic_list array. The |
502 | end of the list must be marked with an element that has a NULL name. | 502 | end of the list must be marked with an element that has a NULL name. |
503 | --------------------------------------------------------------------------*/ | 503 | --------------------------------------------------------------------------*/ |
504 | static inline const char * | 504 | static inline const char * |
505 | symbolic(struct w9968cf_symbolic_list list[], const int num) | 505 | symbolic(struct w9968cf_symbolic_list list[], const int num) |
506 | { | 506 | { |
507 | int i; | 507 | int i; |
@@ -568,7 +568,7 @@ static struct w9968cf_symbolic_list v4l1_plist[] = { | |||
568 | static struct w9968cf_symbolic_list decoder_errlist[] = { | 568 | static struct w9968cf_symbolic_list decoder_errlist[] = { |
569 | { W9968CF_DEC_ERR_CORRUPTED_DATA, "Corrupted data" }, | 569 | { W9968CF_DEC_ERR_CORRUPTED_DATA, "Corrupted data" }, |
570 | { W9968CF_DEC_ERR_BUF_OVERFLOW, "Buffer overflow" }, | 570 | { W9968CF_DEC_ERR_BUF_OVERFLOW, "Buffer overflow" }, |
571 | { W9968CF_DEC_ERR_NO_SOI, "SOI marker not found" }, | 571 | { W9968CF_DEC_ERR_NO_SOI, "SOI marker not found" }, |
572 | { W9968CF_DEC_ERR_NO_SOF0, "SOF0 marker not found" }, | 572 | { W9968CF_DEC_ERR_NO_SOF0, "SOF0 marker not found" }, |
573 | { W9968CF_DEC_ERR_NO_SOS, "SOS marker not found" }, | 573 | { W9968CF_DEC_ERR_NO_SOS, "SOS marker not found" }, |
574 | { W9968CF_DEC_ERR_NO_EOI, "EOI marker not found" }, | 574 | { W9968CF_DEC_ERR_NO_EOI, "EOI marker not found" }, |
@@ -695,7 +695,7 @@ static int w9968cf_allocate_memory(struct w9968cf_device* cam) | |||
695 | bpp = (w9968cf_vpp) ? 4 : 2; | 695 | bpp = (w9968cf_vpp) ? 4 : 2; |
696 | if (cam->upscaling) | 696 | if (cam->upscaling) |
697 | vpp_bufsize = max(W9968CF_MAX_WIDTH*W9968CF_MAX_HEIGHT*bpp, | 697 | vpp_bufsize = max(W9968CF_MAX_WIDTH*W9968CF_MAX_HEIGHT*bpp, |
698 | cam->maxwidth*cam->maxheight*bpp); | 698 | cam->maxwidth*cam->maxheight*bpp); |
699 | else | 699 | else |
700 | vpp_bufsize = cam->maxwidth*cam->maxheight*bpp; | 700 | vpp_bufsize = cam->maxwidth*cam->maxheight*bpp; |
701 | 701 | ||
@@ -704,7 +704,7 @@ static int w9968cf_allocate_memory(struct w9968cf_device* cam) | |||
704 | if (!(cam->transfer_buffer[i] = | 704 | if (!(cam->transfer_buffer[i] = |
705 | kzalloc(W9968CF_ISO_PACKETS*p_size, GFP_KERNEL))) { | 705 | kzalloc(W9968CF_ISO_PACKETS*p_size, GFP_KERNEL))) { |
706 | DBG(1, "Couldn't allocate memory for the isochronous " | 706 | DBG(1, "Couldn't allocate memory for the isochronous " |
707 | "transfer buffers (%u bytes)", | 707 | "transfer buffers (%u bytes)", |
708 | p_size * W9968CF_ISO_PACKETS) | 708 | p_size * W9968CF_ISO_PACKETS) |
709 | return -ENOMEM; | 709 | return -ENOMEM; |
710 | } | 710 | } |
@@ -780,7 +780,7 @@ static int w9968cf_allocate_memory(struct w9968cf_device* cam) | |||
780 | of the next video frame; if an error is encountered in a packet, the entire | 780 | of the next video frame; if an error is encountered in a packet, the entire |
781 | video frame is discarded and grabbed again. | 781 | video frame is discarded and grabbed again. |
782 | If there are no requested frames in the FIFO list, packets are collected into | 782 | If there are no requested frames in the FIFO list, packets are collected into |
783 | a temporary buffer. | 783 | a temporary buffer. |
784 | --------------------------------------------------------------------------*/ | 784 | --------------------------------------------------------------------------*/ |
785 | static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) | 785 | static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) |
786 | { | 786 | { |
@@ -799,7 +799,7 @@ static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) | |||
799 | /* "(*f)" will be used instead of "cam->frame_current" */ | 799 | /* "(*f)" will be used instead of "cam->frame_current" */ |
800 | f = &cam->frame_current; | 800 | f = &cam->frame_current; |
801 | 801 | ||
802 | /* If a frame has been requested and we are grabbing into | 802 | /* If a frame has been requested and we are grabbing into |
803 | the temporary frame, we'll switch to that requested frame */ | 803 | the temporary frame, we'll switch to that requested frame */ |
804 | if ((*f) == &cam->frame_tmp && *cam->requested_frame) { | 804 | if ((*f) == &cam->frame_tmp && *cam->requested_frame) { |
805 | if (cam->frame_tmp.status == F_GRABBING) { | 805 | if (cam->frame_tmp.status == F_GRABBING) { |
@@ -808,7 +808,7 @@ static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) | |||
808 | (*f)->length = cam->frame_tmp.length; | 808 | (*f)->length = cam->frame_tmp.length; |
809 | memcpy((*f)->buffer, cam->frame_tmp.buffer, | 809 | memcpy((*f)->buffer, cam->frame_tmp.buffer, |
810 | (*f)->length); | 810 | (*f)->length); |
811 | DBG(6, "Switched from temp. frame to frame #%d", | 811 | DBG(6, "Switched from temp. frame to frame #%d", |
812 | (*f)->number) | 812 | (*f)->number) |
813 | } | 813 | } |
814 | } | 814 | } |
@@ -850,7 +850,7 @@ static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) | |||
850 | 850 | ||
851 | if (cam->vpp_flag & VPP_DECOMPRESSION) { | 851 | if (cam->vpp_flag & VPP_DECOMPRESSION) { |
852 | err = w9968cf_vpp->check_headers((*f)->buffer, | 852 | err = w9968cf_vpp->check_headers((*f)->buffer, |
853 | (*f)->length); | 853 | (*f)->length); |
854 | if (err) { | 854 | if (err) { |
855 | DBG(4, "Skip corrupted frame: %s", | 855 | DBG(4, "Skip corrupted frame: %s", |
856 | symbolic(decoder_errlist, err)) | 856 | symbolic(decoder_errlist, err)) |
@@ -975,7 +975,7 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam) | |||
975 | cam->frame_current = &cam->frame_tmp; | 975 | cam->frame_current = &cam->frame_tmp; |
976 | 976 | ||
977 | if (!(cam->vpp_flag & VPP_DECOMPRESSION)) | 977 | if (!(cam->vpp_flag & VPP_DECOMPRESSION)) |
978 | DBG(5, "Isochronous transfer size: %lu bytes/frame", | 978 | DBG(5, "Isochronous transfer size: %lu bytes/frame", |
979 | (unsigned long)t_size*2) | 979 | (unsigned long)t_size*2) |
980 | 980 | ||
981 | DBG(5, "Starting the isochronous transfer...") | 981 | DBG(5, "Starting the isochronous transfer...") |
@@ -992,7 +992,7 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam) | |||
992 | usb_free_urb(cam->urb[j]); | 992 | usb_free_urb(cam->urb[j]); |
993 | } | 993 | } |
994 | DBG(1, "Couldn't send a transfer request to the " | 994 | DBG(1, "Couldn't send a transfer request to the " |
995 | "USB core (error #%d, %s)", err, | 995 | "USB core (error #%d, %s)", err, |
996 | symbolic(urb_errlist, err)) | 996 | symbolic(urb_errlist, err)) |
997 | return err; | 997 | return err; |
998 | } | 998 | } |
@@ -1016,7 +1016,7 @@ static int w9968cf_stop_transfer(struct w9968cf_device* cam) | |||
1016 | if (!cam->streaming) | 1016 | if (!cam->streaming) |
1017 | return 0; | 1017 | return 0; |
1018 | 1018 | ||
1019 | /* This avoids race conditions with usb_submit_urb() | 1019 | /* This avoids race conditions with usb_submit_urb() |
1020 | in the URB completition handler */ | 1020 | in the URB completition handler */ |
1021 | spin_lock_irqsave(&cam->urb_lock, lock_flags); | 1021 | spin_lock_irqsave(&cam->urb_lock, lock_flags); |
1022 | cam->streaming = 0; | 1022 | cam->streaming = 0; |
@@ -1050,7 +1050,7 @@ exit: | |||
1050 | 1050 | ||
1051 | 1051 | ||
1052 | /*-------------------------------------------------------------------------- | 1052 | /*-------------------------------------------------------------------------- |
1053 | Write a W9968CF register. | 1053 | Write a W9968CF register. |
1054 | Return 0 on success, -1 otherwise. | 1054 | Return 0 on success, -1 otherwise. |
1055 | --------------------------------------------------------------------------*/ | 1055 | --------------------------------------------------------------------------*/ |
1056 | static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) | 1056 | static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) |
@@ -1059,8 +1059,8 @@ static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) | |||
1059 | int res; | 1059 | int res; |
1060 | 1060 | ||
1061 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, | 1061 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, |
1062 | USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, | 1062 | USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, |
1063 | value, index, NULL, 0, W9968CF_USB_CTRL_TIMEOUT); | 1063 | value, index, NULL, 0, W9968CF_USB_CTRL_TIMEOUT); |
1064 | 1064 | ||
1065 | if (res < 0) | 1065 | if (res < 0) |
1066 | DBG(4, "Failed to write a register " | 1066 | DBG(4, "Failed to write a register " |
@@ -1072,7 +1072,7 @@ static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) | |||
1072 | 1072 | ||
1073 | 1073 | ||
1074 | /*-------------------------------------------------------------------------- | 1074 | /*-------------------------------------------------------------------------- |
1075 | Read a W9968CF register. | 1075 | Read a W9968CF register. |
1076 | Return the register value on success, -1 otherwise. | 1076 | Return the register value on success, -1 otherwise. |
1077 | --------------------------------------------------------------------------*/ | 1077 | --------------------------------------------------------------------------*/ |
1078 | static int w9968cf_read_reg(struct w9968cf_device* cam, u16 index) | 1078 | static int w9968cf_read_reg(struct w9968cf_device* cam, u16 index) |
@@ -1082,8 +1082,8 @@ static int w9968cf_read_reg(struct w9968cf_device* cam, u16 index) | |||
1082 | int res; | 1082 | int res; |
1083 | 1083 | ||
1084 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 1, | 1084 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 1, |
1085 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 1085 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
1086 | 0, index, buff, 2, W9968CF_USB_CTRL_TIMEOUT); | 1086 | 0, index, buff, 2, W9968CF_USB_CTRL_TIMEOUT); |
1087 | 1087 | ||
1088 | if (res < 0) | 1088 | if (res < 0) |
1089 | DBG(4, "Failed to read a register " | 1089 | DBG(4, "Failed to read a register " |
@@ -1107,8 +1107,8 @@ static int w9968cf_write_fsb(struct w9968cf_device* cam, u16* data) | |||
1107 | value = *data++; | 1107 | value = *data++; |
1108 | 1108 | ||
1109 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, | 1109 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, |
1110 | USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, | 1110 | USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, |
1111 | value, 0x06, data, 6, W9968CF_USB_CTRL_TIMEOUT); | 1111 | value, 0x06, data, 6, W9968CF_USB_CTRL_TIMEOUT); |
1112 | 1112 | ||
1113 | if (res < 0) | 1113 | if (res < 0) |
1114 | DBG(4, "Failed to write the FSB registers " | 1114 | DBG(4, "Failed to write the FSB registers " |
@@ -1287,9 +1287,9 @@ static int w9968cf_smbus_refresh_bus(struct w9968cf_device* cam) | |||
1287 | 1287 | ||
1288 | 1288 | ||
1289 | /* SMBus protocol: S Addr Wr [A] Subaddr [A] Value [A] P */ | 1289 | /* SMBus protocol: S Addr Wr [A] Subaddr [A] Value [A] P */ |
1290 | static int | 1290 | static int |
1291 | w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, | 1291 | w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, |
1292 | u16 address, u8 subaddress,u8 value) | 1292 | u16 address, u8 subaddress,u8 value) |
1293 | { | 1293 | { |
1294 | u16* data = cam->data_buffer; | 1294 | u16* data = cam->data_buffer; |
1295 | int err = 0; | 1295 | int err = 0; |
@@ -1348,7 +1348,7 @@ w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, | |||
1348 | "value 0x%02X", address, subaddress, value) | 1348 | "value 0x%02X", address, subaddress, value) |
1349 | else | 1349 | else |
1350 | DBG(5, "I2C write byte data failed, addr.0x%04X, " | 1350 | DBG(5, "I2C write byte data failed, addr.0x%04X, " |
1351 | "subaddr.0x%02X, value 0x%02X", | 1351 | "subaddr.0x%02X, value 0x%02X", |
1352 | address, subaddress, value) | 1352 | address, subaddress, value) |
1353 | 1353 | ||
1354 | return err; | 1354 | return err; |
@@ -1356,10 +1356,10 @@ w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, | |||
1356 | 1356 | ||
1357 | 1357 | ||
1358 | /* SMBus protocol: S Addr Wr [A] Subaddr [A] P S Addr+1 Rd [A] [Value] NA P */ | 1358 | /* SMBus protocol: S Addr Wr [A] Subaddr [A] P S Addr+1 Rd [A] [Value] NA P */ |
1359 | static int | 1359 | static int |
1360 | w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, | 1360 | w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, |
1361 | u16 address, u8 subaddress, | 1361 | u16 address, u8 subaddress, |
1362 | u8* value) | 1362 | u8* value) |
1363 | { | 1363 | { |
1364 | int err = 0; | 1364 | int err = 0; |
1365 | 1365 | ||
@@ -1384,7 +1384,7 @@ w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, | |||
1384 | 1384 | ||
1385 | if (!err) | 1385 | if (!err) |
1386 | DBG(5, "I2C read byte data done, addr.0x%04X, " | 1386 | DBG(5, "I2C read byte data done, addr.0x%04X, " |
1387 | "subaddr.0x%02X, value 0x%02X", | 1387 | "subaddr.0x%02X, value 0x%02X", |
1388 | address, subaddress, *value) | 1388 | address, subaddress, *value) |
1389 | else | 1389 | else |
1390 | DBG(5, "I2C read byte data failed, addr.0x%04X, " | 1390 | DBG(5, "I2C read byte data failed, addr.0x%04X, " |
@@ -1396,9 +1396,9 @@ w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, | |||
1396 | 1396 | ||
1397 | 1397 | ||
1398 | /* SMBus protocol: S Addr+1 Rd [A] [Value] NA P */ | 1398 | /* SMBus protocol: S Addr+1 Rd [A] [Value] NA P */ |
1399 | static int | 1399 | static int |
1400 | w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, | 1400 | w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, |
1401 | u16 address, u8* value) | 1401 | u16 address, u8* value) |
1402 | { | 1402 | { |
1403 | int err = 0; | 1403 | int err = 0; |
1404 | 1404 | ||
@@ -1411,7 +1411,7 @@ w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, | |||
1411 | err += w9968cf_smbus_read_byte(cam, value); | 1411 | err += w9968cf_smbus_read_byte(cam, value); |
1412 | err += w9968cf_smbus_write_ack(cam); | 1412 | err += w9968cf_smbus_write_ack(cam); |
1413 | err += w9968cf_smbus_stop(cam); | 1413 | err += w9968cf_smbus_stop(cam); |
1414 | 1414 | ||
1415 | /* Serial data disable */ | 1415 | /* Serial data disable */ |
1416 | err += w9968cf_write_sb(cam, 0x0000); | 1416 | err += w9968cf_write_sb(cam, 0x0000); |
1417 | 1417 | ||
@@ -1427,9 +1427,9 @@ w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, | |||
1427 | 1427 | ||
1428 | 1428 | ||
1429 | /* SMBus protocol: S Addr Wr [A] Value [A] P */ | 1429 | /* SMBus protocol: S Addr Wr [A] Value [A] P */ |
1430 | static int | 1430 | static int |
1431 | w9968cf_i2c_adap_write_byte(struct w9968cf_device* cam, | 1431 | w9968cf_i2c_adap_write_byte(struct w9968cf_device* cam, |
1432 | u16 address, u8 value) | 1432 | u16 address, u8 value) |
1433 | { | 1433 | { |
1434 | DBG(4, "i2c_write_byte() is an unsupported transfer mode") | 1434 | DBG(4, "i2c_write_byte() is an unsupported transfer mode") |
1435 | return -EINVAL; | 1435 | return -EINVAL; |
@@ -1442,13 +1442,13 @@ w9968cf_i2c_adap_write_byte(struct w9968cf_device* cam, | |||
1442 | ****************************************************************************/ | 1442 | ****************************************************************************/ |
1443 | 1443 | ||
1444 | static int | 1444 | static int |
1445 | w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, | 1445 | w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, |
1446 | unsigned short flags, char read_write, u8 command, | 1446 | unsigned short flags, char read_write, u8 command, |
1447 | int size, union i2c_smbus_data *data) | 1447 | int size, union i2c_smbus_data *data) |
1448 | { | 1448 | { |
1449 | struct w9968cf_device* cam = i2c_get_adapdata(adapter); | 1449 | struct w9968cf_device* cam = i2c_get_adapdata(adapter); |
1450 | u8 i; | 1450 | u8 i; |
1451 | int err = 0; | 1451 | int err = 0; |
1452 | 1452 | ||
1453 | switch (addr) { | 1453 | switch (addr) { |
1454 | case OV6xx0_SID: | 1454 | case OV6xx0_SID: |
@@ -1464,20 +1464,20 @@ w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, | |||
1464 | addr <<= 1; | 1464 | addr <<= 1; |
1465 | 1465 | ||
1466 | if (read_write == I2C_SMBUS_WRITE) | 1466 | if (read_write == I2C_SMBUS_WRITE) |
1467 | err = w9968cf_i2c_adap_write_byte(cam, addr, command); | 1467 | err = w9968cf_i2c_adap_write_byte(cam, addr, command); |
1468 | else if (read_write == I2C_SMBUS_READ) | 1468 | else if (read_write == I2C_SMBUS_READ) |
1469 | err = w9968cf_i2c_adap_read_byte(cam,addr,&data->byte); | 1469 | err = w9968cf_i2c_adap_read_byte(cam,addr,&data->byte); |
1470 | 1470 | ||
1471 | } else if (size == I2C_SMBUS_BYTE_DATA) { | 1471 | } else if (size == I2C_SMBUS_BYTE_DATA) { |
1472 | addr <<= 1; | 1472 | addr <<= 1; |
1473 | 1473 | ||
1474 | if (read_write == I2C_SMBUS_WRITE) | 1474 | if (read_write == I2C_SMBUS_WRITE) |
1475 | err = w9968cf_i2c_adap_fastwrite_byte_data(cam, addr, | 1475 | err = w9968cf_i2c_adap_fastwrite_byte_data(cam, addr, |
1476 | command, data->byte); | 1476 | command, data->byte); |
1477 | else if (read_write == I2C_SMBUS_READ) { | 1477 | else if (read_write == I2C_SMBUS_READ) { |
1478 | for (i = 1; i <= W9968CF_I2C_RW_RETRIES; i++) { | 1478 | for (i = 1; i <= W9968CF_I2C_RW_RETRIES; i++) { |
1479 | err = w9968cf_i2c_adap_read_byte_data(cam,addr, | 1479 | err = w9968cf_i2c_adap_read_byte_data(cam,addr, |
1480 | command, &data->byte); | 1480 | command, &data->byte); |
1481 | if (err) { | 1481 | if (err) { |
1482 | if (w9968cf_smbus_refresh_bus(cam)) { | 1482 | if (w9968cf_smbus_refresh_bus(cam)) { |
1483 | err = -EIO; | 1483 | err = -EIO; |
@@ -1520,7 +1520,7 @@ static int w9968cf_i2c_attach_inform(struct i2c_client* client) | |||
1520 | return err; | 1520 | return err; |
1521 | } | 1521 | } |
1522 | } else { | 1522 | } else { |
1523 | DBG(4, "Rejected client [%s] with driver [%s]", | 1523 | DBG(4, "Rejected client [%s] with driver [%s]", |
1524 | client->name, client->driver->driver.name) | 1524 | client->name, client->driver->driver.name) |
1525 | return -EINVAL; | 1525 | return -EINVAL; |
1526 | } | 1526 | } |
@@ -1545,9 +1545,9 @@ static int w9968cf_i2c_detach_inform(struct i2c_client* client) | |||
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | 1547 | ||
1548 | static int | 1548 | static int |
1549 | w9968cf_i2c_control(struct i2c_adapter* adapter, unsigned int cmd, | 1549 | w9968cf_i2c_control(struct i2c_adapter* adapter, unsigned int cmd, |
1550 | unsigned long arg) | 1550 | unsigned long arg) |
1551 | { | 1551 | { |
1552 | return 0; | 1552 | return 0; |
1553 | } | 1553 | } |
@@ -1625,12 +1625,12 @@ static int w9968cf_turn_on_led(struct w9968cf_device* cam) | |||
1625 | static int w9968cf_init_chip(struct w9968cf_device* cam) | 1625 | static int w9968cf_init_chip(struct w9968cf_device* cam) |
1626 | { | 1626 | { |
1627 | unsigned long hw_bufsize = cam->maxwidth*cam->maxheight*2, | 1627 | unsigned long hw_bufsize = cam->maxwidth*cam->maxheight*2, |
1628 | y0 = 0x0000, | 1628 | y0 = 0x0000, |
1629 | u0 = y0 + hw_bufsize/2, | 1629 | u0 = y0 + hw_bufsize/2, |
1630 | v0 = u0 + hw_bufsize/4, | 1630 | v0 = u0 + hw_bufsize/4, |
1631 | y1 = v0 + hw_bufsize/4, | 1631 | y1 = v0 + hw_bufsize/4, |
1632 | u1 = y1 + hw_bufsize/2, | 1632 | u1 = y1 + hw_bufsize/2, |
1633 | v1 = u1 + hw_bufsize/4; | 1633 | v1 = u1 + hw_bufsize/4; |
1634 | int err = 0; | 1634 | int err = 0; |
1635 | 1635 | ||
1636 | err += w9968cf_write_reg(cam, 0xff00, 0x00); /* power off */ | 1636 | err += w9968cf_write_reg(cam, 0xff00, 0x00); /* power off */ |
@@ -1762,7 +1762,7 @@ w9968cf_set_picture(struct w9968cf_device* cam, struct video_picture pict) | |||
1762 | cam->vpp_flag = VPP_SWAP_YUV_BYTES; | 1762 | cam->vpp_flag = VPP_SWAP_YUV_BYTES; |
1763 | hw_palette = VIDEO_PALETTE_UYVY; | 1763 | hw_palette = VIDEO_PALETTE_UYVY; |
1764 | break; | 1764 | break; |
1765 | /* Original video is used instead of RGBX palettes. | 1765 | /* Original video is used instead of RGBX palettes. |
1766 | Software conversion later. */ | 1766 | Software conversion later. */ |
1767 | case VIDEO_PALETTE_GREY: | 1767 | case VIDEO_PALETTE_GREY: |
1768 | case VIDEO_PALETTE_RGB555: | 1768 | case VIDEO_PALETTE_RGB555: |
@@ -1777,7 +1777,7 @@ w9968cf_set_picture(struct w9968cf_device* cam, struct video_picture pict) | |||
1777 | } | 1777 | } |
1778 | 1778 | ||
1779 | /* NOTE: due to memory issues, it is better to disable the hardware | 1779 | /* NOTE: due to memory issues, it is better to disable the hardware |
1780 | double buffering during compression */ | 1780 | double buffering during compression */ |
1781 | if (cam->double_buffer && !(cam->vpp_flag & VPP_DECOMPRESSION)) | 1781 | if (cam->double_buffer && !(cam->vpp_flag & VPP_DECOMPRESSION)) |
1782 | reg_v |= 0x0080; | 1782 | reg_v |= 0x0080; |
1783 | 1783 | ||
@@ -1832,8 +1832,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) | |||
1832 | #define __UNSC(x) ((x) >> 10) | 1832 | #define __UNSC(x) ((x) >> 10) |
1833 | 1833 | ||
1834 | /* Make sure we are using a supported resolution */ | 1834 | /* Make sure we are using a supported resolution */ |
1835 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, | 1835 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, |
1836 | (u16*)&win.height))) | 1836 | (u16*)&win.height))) |
1837 | goto error; | 1837 | goto error; |
1838 | 1838 | ||
1839 | /* Scaling factors */ | 1839 | /* Scaling factors */ |
@@ -1962,7 +1962,7 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) | |||
1962 | /* Settings changed, so we clear the frame buffers */ | 1962 | /* Settings changed, so we clear the frame buffers */ |
1963 | memset(cam->frame[0].buffer, 0, cam->nbuffers*cam->frame[0].size); | 1963 | memset(cam->frame[0].buffer, 0, cam->nbuffers*cam->frame[0].size); |
1964 | 1964 | ||
1965 | DBG(4, "The capture area is %dx%d, Offset (x,y)=(%u,%u)", | 1965 | DBG(4, "The capture area is %dx%d, Offset (x,y)=(%u,%u)", |
1966 | win.width, win.height, win.x, win.y) | 1966 | win.width, win.height, win.x, win.y) |
1967 | 1967 | ||
1968 | PDBGG("x=%u ,y=%u, w=%u, h=%u, ax=%u, ay=%u, s_win.x=%u, s_win.y=%u, " | 1968 | PDBGG("x=%u ,y=%u, w=%u, h=%u, ax=%u, ay=%u, s_win.x=%u, s_win.y=%u, " |
@@ -1978,11 +1978,11 @@ error: | |||
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | 1980 | ||
1981 | /*-------------------------------------------------------------------------- | 1981 | /*-------------------------------------------------------------------------- |
1982 | Adjust the asked values for window width and height. | 1982 | Adjust the asked values for window width and height. |
1983 | Return 0 on success, -1 otherwise. | 1983 | Return 0 on success, -1 otherwise. |
1984 | --------------------------------------------------------------------------*/ | 1984 | --------------------------------------------------------------------------*/ |
1985 | static int | 1985 | static int |
1986 | w9968cf_adjust_window_size(struct w9968cf_device* cam, u16* width, u16* height) | 1986 | w9968cf_adjust_window_size(struct w9968cf_device* cam, u16* width, u16* height) |
1987 | { | 1987 | { |
1988 | u16 maxw, maxh; | 1988 | u16 maxw, maxh; |
@@ -1992,10 +1992,10 @@ w9968cf_adjust_window_size(struct w9968cf_device* cam, u16* width, u16* height) | |||
1992 | 1992 | ||
1993 | maxw = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) && | 1993 | maxw = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) && |
1994 | w9968cf_vpp ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) | 1994 | w9968cf_vpp ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) |
1995 | : cam->maxwidth; | 1995 | : cam->maxwidth; |
1996 | maxh = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) && | 1996 | maxh = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) && |
1997 | w9968cf_vpp ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) | 1997 | w9968cf_vpp ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) |
1998 | : cam->maxheight; | 1998 | : cam->maxheight; |
1999 | 1999 | ||
2000 | if (*width > maxw) | 2000 | if (*width > maxw) |
2001 | *width = maxw; | 2001 | *width = maxw; |
@@ -2054,7 +2054,7 @@ static void w9968cf_push_frame(struct w9968cf_device* cam, u8 f_num) | |||
2054 | Read, store and remove the first pointer in the FIFO list of requested | 2054 | Read, store and remove the first pointer in the FIFO list of requested |
2055 | frames. This function is called in interrupt context. | 2055 | frames. This function is called in interrupt context. |
2056 | --------------------------------------------------------------------------*/ | 2056 | --------------------------------------------------------------------------*/ |
2057 | static void | 2057 | static void |
2058 | w9968cf_pop_frame(struct w9968cf_device* cam, struct w9968cf_frame_t** framep) | 2058 | w9968cf_pop_frame(struct w9968cf_device* cam, struct w9968cf_frame_t** framep) |
2059 | { | 2059 | { |
2060 | u8 i; | 2060 | u8 i; |
@@ -2078,9 +2078,9 @@ w9968cf_pop_frame(struct w9968cf_device* cam, struct w9968cf_frame_t** framep) | |||
2078 | High-level video post-processing routine on grabbed frames. | 2078 | High-level video post-processing routine on grabbed frames. |
2079 | Return 0 on success, a negative number otherwise. | 2079 | Return 0 on success, a negative number otherwise. |
2080 | --------------------------------------------------------------------------*/ | 2080 | --------------------------------------------------------------------------*/ |
2081 | static int | 2081 | static int |
2082 | w9968cf_postprocess_frame(struct w9968cf_device* cam, | 2082 | w9968cf_postprocess_frame(struct w9968cf_device* cam, |
2083 | struct w9968cf_frame_t* fr) | 2083 | struct w9968cf_frame_t* fr) |
2084 | { | 2084 | { |
2085 | void *pIn = fr->buffer, *pOut = cam->frame_vpp.buffer, *tmp; | 2085 | void *pIn = fr->buffer, *pOut = cam->frame_vpp.buffer, *tmp; |
2086 | u16 w = cam->window.width, | 2086 | u16 w = cam->window.width, |
@@ -2127,7 +2127,7 @@ w9968cf_postprocess_frame(struct w9968cf_device* cam, | |||
2127 | w9968cf_vpp->uyvy_to_rgbx(pIn, fr->length, pOut, fmt, rgb); | 2127 | w9968cf_vpp->uyvy_to_rgbx(pIn, fr->length, pOut, fmt, rgb); |
2128 | fr->length = (w*h*d)/8; | 2128 | fr->length = (w*h*d)/8; |
2129 | _PSWAP(pIn, pOut) | 2129 | _PSWAP(pIn, pOut) |
2130 | DBG(6, "UYVY-16bit to %s conversion done", | 2130 | DBG(6, "UYVY-16bit to %s conversion done", |
2131 | symbolic(v4l1_plist, fmt)) | 2131 | symbolic(v4l1_plist, fmt)) |
2132 | } | 2132 | } |
2133 | 2133 | ||
@@ -2143,7 +2143,7 @@ w9968cf_postprocess_frame(struct w9968cf_device* cam, | |||
2143 | * Image sensor control routines * | 2143 | * Image sensor control routines * |
2144 | ****************************************************************************/ | 2144 | ****************************************************************************/ |
2145 | 2145 | ||
2146 | static int | 2146 | static int |
2147 | w9968cf_sensor_set_control(struct w9968cf_device* cam, int cid, int val) | 2147 | w9968cf_sensor_set_control(struct w9968cf_device* cam, int cid, int val) |
2148 | { | 2148 | { |
2149 | struct ovcamchip_control ctl; | 2149 | struct ovcamchip_control ctl; |
@@ -2158,7 +2158,7 @@ w9968cf_sensor_set_control(struct w9968cf_device* cam, int cid, int val) | |||
2158 | } | 2158 | } |
2159 | 2159 | ||
2160 | 2160 | ||
2161 | static int | 2161 | static int |
2162 | w9968cf_sensor_get_control(struct w9968cf_device* cam, int cid, int* val) | 2162 | w9968cf_sensor_get_control(struct w9968cf_device* cam, int cid, int* val) |
2163 | { | 2163 | { |
2164 | struct ovcamchip_control ctl; | 2164 | struct ovcamchip_control ctl; |
@@ -2198,38 +2198,38 @@ static int w9968cf_sensor_update_settings(struct w9968cf_device* cam) | |||
2198 | int err = 0; | 2198 | int err = 0; |
2199 | 2199 | ||
2200 | /* Auto brightness */ | 2200 | /* Auto brightness */ |
2201 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOBRIGHT, | 2201 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOBRIGHT, |
2202 | cam->auto_brt); | 2202 | cam->auto_brt); |
2203 | if (err) | 2203 | if (err) |
2204 | return err; | 2204 | return err; |
2205 | 2205 | ||
2206 | /* Auto exposure */ | 2206 | /* Auto exposure */ |
2207 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOEXP, | 2207 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOEXP, |
2208 | cam->auto_exp); | 2208 | cam->auto_exp); |
2209 | if (err) | 2209 | if (err) |
2210 | return err; | 2210 | return err; |
2211 | 2211 | ||
2212 | /* Banding filter */ | 2212 | /* Banding filter */ |
2213 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BANDFILT, | 2213 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BANDFILT, |
2214 | cam->bandfilt); | 2214 | cam->bandfilt); |
2215 | if (err) | 2215 | if (err) |
2216 | return err; | 2216 | return err; |
2217 | 2217 | ||
2218 | /* Light frequency */ | 2218 | /* Light frequency */ |
2219 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_FREQ, | 2219 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_FREQ, |
2220 | cam->lightfreq); | 2220 | cam->lightfreq); |
2221 | if (err) | 2221 | if (err) |
2222 | return err; | 2222 | return err; |
2223 | 2223 | ||
2224 | /* Back light */ | 2224 | /* Back light */ |
2225 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BACKLIGHT, | 2225 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BACKLIGHT, |
2226 | cam->backlight); | 2226 | cam->backlight); |
2227 | if (err) | 2227 | if (err) |
2228 | return err; | 2228 | return err; |
2229 | 2229 | ||
2230 | /* Mirror */ | 2230 | /* Mirror */ |
2231 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_MIRROR, | 2231 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_MIRROR, |
2232 | cam->mirror); | 2232 | cam->mirror); |
2233 | if (err) | 2233 | if (err) |
2234 | return err; | 2234 | return err; |
2235 | 2235 | ||
@@ -2281,15 +2281,15 @@ static int w9968cf_sensor_get_picture(struct w9968cf_device* cam) | |||
2281 | Returns: 0 on success, a negative number otherwise. | 2281 | Returns: 0 on success, a negative number otherwise. |
2282 | --------------------------------------------------------------------------*/ | 2282 | --------------------------------------------------------------------------*/ |
2283 | static int | 2283 | static int |
2284 | w9968cf_sensor_update_picture(struct w9968cf_device* cam, | 2284 | w9968cf_sensor_update_picture(struct w9968cf_device* cam, |
2285 | struct video_picture pict) | 2285 | struct video_picture pict) |
2286 | { | 2286 | { |
2287 | int err = 0; | 2287 | int err = 0; |
2288 | 2288 | ||
2289 | if ((!cam->sensor_initialized) | 2289 | if ((!cam->sensor_initialized) |
2290 | || pict.contrast != cam->picture.contrast) { | 2290 | || pict.contrast != cam->picture.contrast) { |
2291 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_CONT, | 2291 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_CONT, |
2292 | pict.contrast); | 2292 | pict.contrast); |
2293 | if (err) | 2293 | if (err) |
2294 | goto fail; | 2294 | goto fail; |
2295 | DBG(4, "Contrast changed from %u to %u", | 2295 | DBG(4, "Contrast changed from %u to %u", |
@@ -2297,10 +2297,10 @@ w9968cf_sensor_update_picture(struct w9968cf_device* cam, | |||
2297 | cam->picture.contrast = pict.contrast; | 2297 | cam->picture.contrast = pict.contrast; |
2298 | } | 2298 | } |
2299 | 2299 | ||
2300 | if (((!cam->sensor_initialized) || | 2300 | if (((!cam->sensor_initialized) || |
2301 | pict.brightness != cam->picture.brightness) && (!cam->auto_brt)) { | 2301 | pict.brightness != cam->picture.brightness) && (!cam->auto_brt)) { |
2302 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BRIGHT, | 2302 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BRIGHT, |
2303 | pict.brightness); | 2303 | pict.brightness); |
2304 | if (err) | 2304 | if (err) |
2305 | goto fail; | 2305 | goto fail; |
2306 | DBG(4, "Brightness changed from %u to %u", | 2306 | DBG(4, "Brightness changed from %u to %u", |
@@ -2309,8 +2309,8 @@ w9968cf_sensor_update_picture(struct w9968cf_device* cam, | |||
2309 | } | 2309 | } |
2310 | 2310 | ||
2311 | if ((!cam->sensor_initialized) || pict.colour != cam->picture.colour) { | 2311 | if ((!cam->sensor_initialized) || pict.colour != cam->picture.colour) { |
2312 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_SAT, | 2312 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_SAT, |
2313 | pict.colour); | 2313 | pict.colour); |
2314 | if (err) | 2314 | if (err) |
2315 | goto fail; | 2315 | goto fail; |
2316 | DBG(4, "Colour changed from %u to %u", | 2316 | DBG(4, "Colour changed from %u to %u", |
@@ -2319,8 +2319,8 @@ w9968cf_sensor_update_picture(struct w9968cf_device* cam, | |||
2319 | } | 2319 | } |
2320 | 2320 | ||
2321 | if ((!cam->sensor_initialized) || pict.hue != cam->picture.hue) { | 2321 | if ((!cam->sensor_initialized) || pict.hue != cam->picture.hue) { |
2322 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_HUE, | 2322 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_HUE, |
2323 | pict.hue); | 2323 | pict.hue); |
2324 | if (err) | 2324 | if (err) |
2325 | goto fail; | 2325 | goto fail; |
2326 | DBG(4, "Hue changed from %u to %u", | 2326 | DBG(4, "Hue changed from %u to %u", |
@@ -2349,12 +2349,12 @@ static int w9968cf_sensor_init(struct w9968cf_device* cam) | |||
2349 | { | 2349 | { |
2350 | int err = 0; | 2350 | int err = 0; |
2351 | 2351 | ||
2352 | if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_INITIALIZE, | 2352 | if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_INITIALIZE, |
2353 | &cam->monochrome))) | 2353 | &cam->monochrome))) |
2354 | goto error; | 2354 | goto error; |
2355 | 2355 | ||
2356 | if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_Q_SUBTYPE, | 2356 | if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_Q_SUBTYPE, |
2357 | &cam->sensor))) | 2357 | &cam->sensor))) |
2358 | goto error; | 2358 | goto error; |
2359 | 2359 | ||
2360 | /* NOTE: Make sure width and height are a multiple of 16 */ | 2360 | /* NOTE: Make sure width and height are a multiple of 16 */ |
@@ -2416,14 +2416,14 @@ error: | |||
2416 | 2416 | ||
2417 | /*-------------------------------------------------------------------------- | 2417 | /*-------------------------------------------------------------------------- |
2418 | Fill some basic fields in the main device data structure. | 2418 | Fill some basic fields in the main device data structure. |
2419 | This function is called once on w9968cf_usb_probe() for each recognized | 2419 | This function is called once on w9968cf_usb_probe() for each recognized |
2420 | camera. | 2420 | camera. |
2421 | --------------------------------------------------------------------------*/ | 2421 | --------------------------------------------------------------------------*/ |
2422 | static void | 2422 | static void |
2423 | w9968cf_configure_camera(struct w9968cf_device* cam, | 2423 | w9968cf_configure_camera(struct w9968cf_device* cam, |
2424 | struct usb_device* udev, | 2424 | struct usb_device* udev, |
2425 | enum w9968cf_model_id mod_id, | 2425 | enum w9968cf_model_id mod_id, |
2426 | const unsigned short dev_nr) | 2426 | const unsigned short dev_nr) |
2427 | { | 2427 | { |
2428 | mutex_init(&cam->fileop_mutex); | 2428 | mutex_init(&cam->fileop_mutex); |
2429 | init_waitqueue_head(&cam->open); | 2429 | init_waitqueue_head(&cam->open); |
@@ -2444,60 +2444,60 @@ w9968cf_configure_camera(struct w9968cf_device* cam, | |||
2444 | packet_size[dev_nr] < wMaxPacketSize[cam->altsetting-1]; | 2444 | packet_size[dev_nr] < wMaxPacketSize[cam->altsetting-1]; |
2445 | cam->altsetting++); | 2445 | cam->altsetting++); |
2446 | 2446 | ||
2447 | cam->max_buffers = (max_buffers[dev_nr] < 2 || | 2447 | cam->max_buffers = (max_buffers[dev_nr] < 2 || |
2448 | max_buffers[dev_nr] > W9968CF_MAX_BUFFERS) | 2448 | max_buffers[dev_nr] > W9968CF_MAX_BUFFERS) |
2449 | ? W9968CF_BUFFERS : (u8)max_buffers[dev_nr]; | 2449 | ? W9968CF_BUFFERS : (u8)max_buffers[dev_nr]; |
2450 | 2450 | ||
2451 | cam->double_buffer = (double_buffer[dev_nr] == 0 || | 2451 | cam->double_buffer = (double_buffer[dev_nr] == 0 || |
2452 | double_buffer[dev_nr] == 1) | 2452 | double_buffer[dev_nr] == 1) |
2453 | ? (u8)double_buffer[dev_nr]:W9968CF_DOUBLE_BUFFER; | 2453 | ? (u8)double_buffer[dev_nr]:W9968CF_DOUBLE_BUFFER; |
2454 | 2454 | ||
2455 | cam->clamping = (clamping[dev_nr] == 0 || clamping[dev_nr] == 1) | 2455 | cam->clamping = (clamping[dev_nr] == 0 || clamping[dev_nr] == 1) |
2456 | ? (u8)clamping[dev_nr] : W9968CF_CLAMPING; | 2456 | ? (u8)clamping[dev_nr] : W9968CF_CLAMPING; |
2457 | 2457 | ||
2458 | cam->filter_type = (filter_type[dev_nr] == 0 || | 2458 | cam->filter_type = (filter_type[dev_nr] == 0 || |
2459 | filter_type[dev_nr] == 1 || | 2459 | filter_type[dev_nr] == 1 || |
2460 | filter_type[dev_nr] == 2) | 2460 | filter_type[dev_nr] == 2) |
2461 | ? (u8)filter_type[dev_nr] : W9968CF_FILTER_TYPE; | 2461 | ? (u8)filter_type[dev_nr] : W9968CF_FILTER_TYPE; |
2462 | 2462 | ||
2463 | cam->capture = 1; | 2463 | cam->capture = 1; |
2464 | 2464 | ||
2465 | cam->largeview = (largeview[dev_nr] == 0 || largeview[dev_nr] == 1) | 2465 | cam->largeview = (largeview[dev_nr] == 0 || largeview[dev_nr] == 1) |
2466 | ? (u8)largeview[dev_nr] : W9968CF_LARGEVIEW; | 2466 | ? (u8)largeview[dev_nr] : W9968CF_LARGEVIEW; |
2467 | 2467 | ||
2468 | cam->decompression = (decompression[dev_nr] == 0 || | 2468 | cam->decompression = (decompression[dev_nr] == 0 || |
2469 | decompression[dev_nr] == 1 || | 2469 | decompression[dev_nr] == 1 || |
2470 | decompression[dev_nr] == 2) | 2470 | decompression[dev_nr] == 2) |
2471 | ? (u8)decompression[dev_nr]:W9968CF_DECOMPRESSION; | 2471 | ? (u8)decompression[dev_nr]:W9968CF_DECOMPRESSION; |
2472 | 2472 | ||
2473 | cam->upscaling = (upscaling[dev_nr] == 0 || | 2473 | cam->upscaling = (upscaling[dev_nr] == 0 || |
2474 | upscaling[dev_nr] == 1) | 2474 | upscaling[dev_nr] == 1) |
2475 | ? (u8)upscaling[dev_nr] : W9968CF_UPSCALING; | 2475 | ? (u8)upscaling[dev_nr] : W9968CF_UPSCALING; |
2476 | 2476 | ||
2477 | cam->auto_brt = (autobright[dev_nr] == 0 || autobright[dev_nr] == 1) | 2477 | cam->auto_brt = (autobright[dev_nr] == 0 || autobright[dev_nr] == 1) |
2478 | ? (u8)autobright[dev_nr] : W9968CF_AUTOBRIGHT; | 2478 | ? (u8)autobright[dev_nr] : W9968CF_AUTOBRIGHT; |
2479 | 2479 | ||
2480 | cam->auto_exp = (autoexp[dev_nr] == 0 || autoexp[dev_nr] == 1) | 2480 | cam->auto_exp = (autoexp[dev_nr] == 0 || autoexp[dev_nr] == 1) |
2481 | ? (u8)autoexp[dev_nr] : W9968CF_AUTOEXP; | 2481 | ? (u8)autoexp[dev_nr] : W9968CF_AUTOEXP; |
2482 | 2482 | ||
2483 | cam->lightfreq = (lightfreq[dev_nr] == 50 || lightfreq[dev_nr] == 60) | 2483 | cam->lightfreq = (lightfreq[dev_nr] == 50 || lightfreq[dev_nr] == 60) |
2484 | ? (u8)lightfreq[dev_nr] : W9968CF_LIGHTFREQ; | 2484 | ? (u8)lightfreq[dev_nr] : W9968CF_LIGHTFREQ; |
2485 | 2485 | ||
2486 | cam->bandfilt = (bandingfilter[dev_nr] == 0 || | 2486 | cam->bandfilt = (bandingfilter[dev_nr] == 0 || |
2487 | bandingfilter[dev_nr] == 1) | 2487 | bandingfilter[dev_nr] == 1) |
2488 | ? (u8)bandingfilter[dev_nr] : W9968CF_BANDINGFILTER; | 2488 | ? (u8)bandingfilter[dev_nr] : W9968CF_BANDINGFILTER; |
2489 | 2489 | ||
2490 | cam->backlight = (backlight[dev_nr] == 0 || backlight[dev_nr] == 1) | 2490 | cam->backlight = (backlight[dev_nr] == 0 || backlight[dev_nr] == 1) |
2491 | ? (u8)backlight[dev_nr] : W9968CF_BACKLIGHT; | 2491 | ? (u8)backlight[dev_nr] : W9968CF_BACKLIGHT; |
2492 | 2492 | ||
2493 | cam->clockdiv = (clockdiv[dev_nr] == -1 || clockdiv[dev_nr] >= 0) | 2493 | cam->clockdiv = (clockdiv[dev_nr] == -1 || clockdiv[dev_nr] >= 0) |
2494 | ? (s8)clockdiv[dev_nr] : W9968CF_CLOCKDIV; | 2494 | ? (s8)clockdiv[dev_nr] : W9968CF_CLOCKDIV; |
2495 | 2495 | ||
2496 | cam->mirror = (mirror[dev_nr] == 0 || mirror[dev_nr] == 1) | 2496 | cam->mirror = (mirror[dev_nr] == 0 || mirror[dev_nr] == 1) |
2497 | ? (u8)mirror[dev_nr] : W9968CF_MIRROR; | 2497 | ? (u8)mirror[dev_nr] : W9968CF_MIRROR; |
2498 | 2498 | ||
2499 | cam->monochrome = (monochrome[dev_nr] == 0 || monochrome[dev_nr] == 1) | 2499 | cam->monochrome = (monochrome[dev_nr] == 0 || monochrome[dev_nr] == 1) |
2500 | ? monochrome[dev_nr] : W9968CF_MONOCHROME; | 2500 | ? monochrome[dev_nr] : W9968CF_MONOCHROME; |
2501 | 2501 | ||
2502 | cam->picture.brightness = (u16)brightness[dev_nr]; | 2502 | cam->picture.brightness = (u16)brightness[dev_nr]; |
2503 | cam->picture.hue = (u16)hue[dev_nr]; | 2503 | cam->picture.hue = (u16)hue[dev_nr]; |
@@ -2519,7 +2519,7 @@ w9968cf_configure_camera(struct w9968cf_device* cam, | |||
2519 | cam->picture.depth = w9968cf_valid_depth(cam->picture.palette); | 2519 | cam->picture.depth = w9968cf_valid_depth(cam->picture.palette); |
2520 | 2520 | ||
2521 | cam->force_rgb = (force_rgb[dev_nr] == 0 || force_rgb[dev_nr] == 1) | 2521 | cam->force_rgb = (force_rgb[dev_nr] == 0 || force_rgb[dev_nr] == 1) |
2522 | ? (u8)force_rgb[dev_nr] : W9968CF_FORCE_RGB; | 2522 | ? (u8)force_rgb[dev_nr] : W9968CF_FORCE_RGB; |
2523 | 2523 | ||
2524 | cam->window.x = 0; | 2524 | cam->window.x = 0; |
2525 | cam->window.y = 0; | 2525 | cam->window.y = 0; |
@@ -2531,16 +2531,16 @@ w9968cf_configure_camera(struct w9968cf_device* cam, | |||
2531 | 2531 | ||
2532 | DBG(3, "%s configured with settings #%u:", | 2532 | DBG(3, "%s configured with settings #%u:", |
2533 | symbolic(camlist, cam->id), dev_nr) | 2533 | symbolic(camlist, cam->id), dev_nr) |
2534 | 2534 | ||
2535 | DBG(3, "- Data packet size for USB isochrnous transfer: %u bytes", | 2535 | DBG(3, "- Data packet size for USB isochrnous transfer: %u bytes", |
2536 | wMaxPacketSize[cam->altsetting-1]) | 2536 | wMaxPacketSize[cam->altsetting-1]) |
2537 | 2537 | ||
2538 | DBG(3, "- Number of requested video frame buffers: %u", | 2538 | DBG(3, "- Number of requested video frame buffers: %u", |
2539 | cam->max_buffers) | 2539 | cam->max_buffers) |
2540 | 2540 | ||
2541 | if (cam->double_buffer) | 2541 | if (cam->double_buffer) |
2542 | DBG(3, "- Hardware double buffering enabled") | 2542 | DBG(3, "- Hardware double buffering enabled") |
2543 | else | 2543 | else |
2544 | DBG(3, "- Hardware double buffering disabled") | 2544 | DBG(3, "- Hardware double buffering disabled") |
2545 | 2545 | ||
2546 | if (cam->filter_type == 0) | 2546 | if (cam->filter_type == 0) |
@@ -2648,7 +2648,7 @@ static void w9968cf_adjust_configuration(struct w9968cf_device* cam) | |||
2648 | 2648 | ||
2649 | /*-------------------------------------------------------------------------- | 2649 | /*-------------------------------------------------------------------------- |
2650 | Release the resources used by the driver. | 2650 | Release the resources used by the driver. |
2651 | This function is called on disconnect | 2651 | This function is called on disconnect |
2652 | (or on close if deallocation has been deferred) | 2652 | (or on close if deallocation has been deferred) |
2653 | --------------------------------------------------------------------------*/ | 2653 | --------------------------------------------------------------------------*/ |
2654 | static void w9968cf_release_resources(struct w9968cf_device* cam) | 2654 | static void w9968cf_release_resources(struct w9968cf_device* cam) |
@@ -2706,8 +2706,8 @@ static int w9968cf_open(struct inode* inode, struct file* filp) | |||
2706 | } | 2706 | } |
2707 | mutex_unlock(&cam->dev_mutex); | 2707 | mutex_unlock(&cam->dev_mutex); |
2708 | err = wait_event_interruptible_exclusive(cam->open, | 2708 | err = wait_event_interruptible_exclusive(cam->open, |
2709 | cam->disconnected || | 2709 | cam->disconnected || |
2710 | !cam->users); | 2710 | !cam->users); |
2711 | if (err) { | 2711 | if (err) { |
2712 | up_read(&w9968cf_disconnect); | 2712 | up_read(&w9968cf_disconnect); |
2713 | return err; | 2713 | return err; |
@@ -2820,9 +2820,9 @@ w9968cf_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
2820 | w9968cf_push_frame(cam, 1); | 2820 | w9968cf_push_frame(cam, 1); |
2821 | 2821 | ||
2822 | err = wait_event_interruptible(cam->wait_queue, | 2822 | err = wait_event_interruptible(cam->wait_queue, |
2823 | cam->frame[0].status == F_READY || | 2823 | cam->frame[0].status == F_READY || |
2824 | cam->frame[1].status == F_READY || | 2824 | cam->frame[1].status == F_READY || |
2825 | cam->disconnected); | 2825 | cam->disconnected); |
2826 | if (err) { | 2826 | if (err) { |
2827 | mutex_unlock(&cam->fileop_mutex); | 2827 | mutex_unlock(&cam->fileop_mutex); |
2828 | return err; | 2828 | return err; |
@@ -2859,12 +2859,12 @@ w9968cf_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
2859 | static int w9968cf_mmap(struct file* filp, struct vm_area_struct *vma) | 2859 | static int w9968cf_mmap(struct file* filp, struct vm_area_struct *vma) |
2860 | { | 2860 | { |
2861 | struct w9968cf_device* cam = (struct w9968cf_device*) | 2861 | struct w9968cf_device* cam = (struct w9968cf_device*) |
2862 | video_get_drvdata(video_devdata(filp)); | 2862 | video_get_drvdata(video_devdata(filp)); |
2863 | unsigned long vsize = vma->vm_end - vma->vm_start, | 2863 | unsigned long vsize = vma->vm_end - vma->vm_start, |
2864 | psize = cam->nbuffers * cam->frame[0].size, | 2864 | psize = cam->nbuffers * cam->frame[0].size, |
2865 | start = vma->vm_start, | 2865 | start = vma->vm_start, |
2866 | pos = (unsigned long)cam->frame[0].buffer, | 2866 | pos = (unsigned long)cam->frame[0].buffer, |
2867 | page; | 2867 | page; |
2868 | 2868 | ||
2869 | if (cam->disconnected) { | 2869 | if (cam->disconnected) { |
2870 | DBG(2, "Device not present") | 2870 | DBG(2, "Device not present") |
@@ -2898,7 +2898,7 @@ static int w9968cf_mmap(struct file* filp, struct vm_area_struct *vma) | |||
2898 | 2898 | ||
2899 | static int | 2899 | static int |
2900 | w9968cf_ioctl(struct inode* inode, struct file* filp, | 2900 | w9968cf_ioctl(struct inode* inode, struct file* filp, |
2901 | unsigned int cmd, unsigned long arg) | 2901 | unsigned int cmd, unsigned long arg) |
2902 | { | 2902 | { |
2903 | struct w9968cf_device* cam; | 2903 | struct w9968cf_device* cam; |
2904 | int err; | 2904 | int err; |
@@ -2928,21 +2928,21 @@ w9968cf_ioctl(struct inode* inode, struct file* filp, | |||
2928 | 2928 | ||
2929 | 2929 | ||
2930 | static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | 2930 | static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, |
2931 | unsigned int cmd, void __user * arg) | 2931 | unsigned int cmd, void __user * arg) |
2932 | { | 2932 | { |
2933 | struct w9968cf_device* cam; | 2933 | struct w9968cf_device* cam; |
2934 | const char* v4l1_ioctls[] = { | 2934 | const char* v4l1_ioctls[] = { |
2935 | "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", | 2935 | "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", |
2936 | "GPICT", "SPICT", "CCAPTURE", "GWIN", "SWIN", "GFBUF", | 2936 | "GPICT", "SPICT", "CCAPTURE", "GWIN", "SWIN", "GFBUF", |
2937 | "SFBUF", "KEY", "GFREQ", "SFREQ", "GAUDIO", "SAUDIO", | 2937 | "SFBUF", "KEY", "GFREQ", "SFREQ", "GAUDIO", "SAUDIO", |
2938 | "SYNC", "MCAPTURE", "GMBUF", "GUNIT", "GCAPTURE", "SCAPTURE", | 2938 | "SYNC", "MCAPTURE", "GMBUF", "GUNIT", "GCAPTURE", "SCAPTURE", |
2939 | "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", "SMICROCODE", | 2939 | "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", "SMICROCODE", |
2940 | "GVBIFMT", "SVBIFMT" | 2940 | "GVBIFMT", "SVBIFMT" |
2941 | }; | 2941 | }; |
2942 | 2942 | ||
2943 | #define V4L1_IOCTL(cmd) \ | 2943 | #define V4L1_IOCTL(cmd) \ |
2944 | ((_IOC_NR((cmd)) < ARRAY_SIZE(v4l1_ioctls)) ? \ | 2944 | ((_IOC_NR((cmd)) < ARRAY_SIZE(v4l1_ioctls)) ? \ |
2945 | v4l1_ioctls[_IOC_NR((cmd))] : "?") | 2945 | v4l1_ioctls[_IOC_NR((cmd))] : "?") |
2946 | 2946 | ||
2947 | cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp)); | 2947 | cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp)); |
2948 | 2948 | ||
@@ -2957,14 +2957,14 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
2957 | .minwidth = cam->minwidth, | 2957 | .minwidth = cam->minwidth, |
2958 | .minheight = cam->minheight, | 2958 | .minheight = cam->minheight, |
2959 | }; | 2959 | }; |
2960 | sprintf(cap.name, "W996[87]CF USB Camera #%d", | 2960 | sprintf(cap.name, "W996[87]CF USB Camera #%d", |
2961 | cam->v4ldev->minor); | 2961 | cam->v4ldev->minor); |
2962 | cap.maxwidth = (cam->upscaling && w9968cf_vpp) | 2962 | cap.maxwidth = (cam->upscaling && w9968cf_vpp) |
2963 | ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) | 2963 | ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) |
2964 | : cam->maxwidth; | 2964 | : cam->maxwidth; |
2965 | cap.maxheight = (cam->upscaling && w9968cf_vpp) | 2965 | cap.maxheight = (cam->upscaling && w9968cf_vpp) |
2966 | ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) | 2966 | ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) |
2967 | : cam->maxheight; | 2967 | : cam->maxheight; |
2968 | 2968 | ||
2969 | if (copy_to_user(arg, &cap, sizeof(cap))) | 2969 | if (copy_to_user(arg, &cap, sizeof(cap))) |
2970 | return -EFAULT; | 2970 | return -EFAULT; |
@@ -3029,7 +3029,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3029 | if (copy_from_user(&pict, arg, sizeof(pict))) | 3029 | if (copy_from_user(&pict, arg, sizeof(pict))) |
3030 | return -EFAULT; | 3030 | return -EFAULT; |
3031 | 3031 | ||
3032 | if ( (cam->force_palette || !w9968cf_vpp) | 3032 | if ( (cam->force_palette || !w9968cf_vpp) |
3033 | && pict.palette != cam->picture.palette ) { | 3033 | && pict.palette != cam->picture.palette ) { |
3034 | DBG(4, "Palette %s rejected: only %s is allowed", | 3034 | DBG(4, "Palette %s rejected: only %s is allowed", |
3035 | symbolic(v4l1_plist, pict.palette), | 3035 | symbolic(v4l1_plist, pict.palette), |
@@ -3046,24 +3046,24 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3046 | if (!cam->force_palette) { | 3046 | if (!cam->force_palette) { |
3047 | if (cam->decompression == 0) { | 3047 | if (cam->decompression == 0) { |
3048 | if (w9968cf_need_decompression(pict.palette)) { | 3048 | if (w9968cf_need_decompression(pict.palette)) { |
3049 | DBG(4, "Decompression disabled: palette %s is not " | 3049 | DBG(4, "Decompression disabled: palette %s is not " |
3050 | "allowed. VIDIOCSPICT failed", | 3050 | "allowed. VIDIOCSPICT failed", |
3051 | symbolic(v4l1_plist, pict.palette)) | 3051 | symbolic(v4l1_plist, pict.palette)) |
3052 | return -EINVAL; | 3052 | return -EINVAL; |
3053 | } | 3053 | } |
3054 | } else if (cam->decompression == 1) { | 3054 | } else if (cam->decompression == 1) { |
3055 | if (!w9968cf_need_decompression(pict.palette)) { | 3055 | if (!w9968cf_need_decompression(pict.palette)) { |
3056 | DBG(4, "Decompression forced: palette %s is not " | 3056 | DBG(4, "Decompression forced: palette %s is not " |
3057 | "allowed. VIDIOCSPICT failed", | 3057 | "allowed. VIDIOCSPICT failed", |
3058 | symbolic(v4l1_plist, pict.palette)) | 3058 | symbolic(v4l1_plist, pict.palette)) |
3059 | return -EINVAL; | 3059 | return -EINVAL; |
3060 | } | 3060 | } |
3061 | } | 3061 | } |
3062 | } | 3062 | } |
3063 | 3063 | ||
3064 | if (pict.depth != w9968cf_valid_depth(pict.palette)) { | 3064 | if (pict.depth != w9968cf_valid_depth(pict.palette)) { |
3065 | DBG(4, "Requested depth %u bpp is not valid for %s " | 3065 | DBG(4, "Requested depth %u bpp is not valid for %s " |
3066 | "palette: ignored and changed to %u bpp", | 3066 | "palette: ignored and changed to %u bpp", |
3067 | pict.depth, symbolic(v4l1_plist, pict.palette), | 3067 | pict.depth, symbolic(v4l1_plist, pict.palette), |
3068 | w9968cf_valid_depth(pict.palette)) | 3068 | w9968cf_valid_depth(pict.palette)) |
3069 | pict.depth = w9968cf_valid_depth(pict.palette); | 3069 | pict.depth = w9968cf_valid_depth(pict.palette); |
@@ -3074,9 +3074,9 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3074 | || cam->frame_current->queued) { | 3074 | || cam->frame_current->queued) { |
3075 | err = wait_event_interruptible | 3075 | err = wait_event_interruptible |
3076 | ( cam->wait_queue, | 3076 | ( cam->wait_queue, |
3077 | cam->disconnected || | 3077 | cam->disconnected || |
3078 | (!*cam->requested_frame && | 3078 | (!*cam->requested_frame && |
3079 | !cam->frame_current->queued) ); | 3079 | !cam->frame_current->queued) ); |
3080 | if (err) | 3080 | if (err) |
3081 | return err; | 3081 | return err; |
3082 | if (cam->disconnected) | 3082 | if (cam->disconnected) |
@@ -3116,7 +3116,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3116 | return -EINVAL; | 3116 | return -EINVAL; |
3117 | 3117 | ||
3118 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, | 3118 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, |
3119 | (u16*)&win.height))) { | 3119 | (u16*)&win.height))) { |
3120 | DBG(4, "Resolution not supported (%ux%u). " | 3120 | DBG(4, "Resolution not supported (%ux%u). " |
3121 | "VIDIOCSWIN failed", win.width, win.height) | 3121 | "VIDIOCSWIN failed", win.width, win.height) |
3122 | return err; | 3122 | return err; |
@@ -3130,9 +3130,9 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3130 | || cam->frame_current->queued) { | 3130 | || cam->frame_current->queued) { |
3131 | err = wait_event_interruptible | 3131 | err = wait_event_interruptible |
3132 | ( cam->wait_queue, | 3132 | ( cam->wait_queue, |
3133 | cam->disconnected || | 3133 | cam->disconnected || |
3134 | (!*cam->requested_frame && | 3134 | (!*cam->requested_frame && |
3135 | !cam->frame_current->queued) ); | 3135 | !cam->frame_current->queued) ); |
3136 | if (err) | 3136 | if (err) |
3137 | return err; | 3137 | return err; |
3138 | if (cam->disconnected) | 3138 | if (cam->disconnected) |
@@ -3175,7 +3175,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3175 | mbuf.frames = cam->nbuffers; | 3175 | mbuf.frames = cam->nbuffers; |
3176 | for (i = 0; i < cam->nbuffers; i++) | 3176 | for (i = 0; i < cam->nbuffers; i++) |
3177 | mbuf.offsets[i] = (unsigned long)cam->frame[i].buffer - | 3177 | mbuf.offsets[i] = (unsigned long)cam->frame[i].buffer - |
3178 | (unsigned long)cam->frame[0].buffer; | 3178 | (unsigned long)cam->frame[0].buffer; |
3179 | 3179 | ||
3180 | if (copy_to_user(arg, &mbuf, sizeof(mbuf))) | 3180 | if (copy_to_user(arg, &mbuf, sizeof(mbuf))) |
3181 | return -EFAULT; | 3181 | return -EFAULT; |
@@ -3194,7 +3194,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3194 | return -EFAULT; | 3194 | return -EFAULT; |
3195 | 3195 | ||
3196 | DBG(6, "VIDIOCMCAPTURE called: frame #%u, format=%s, %dx%d", | 3196 | DBG(6, "VIDIOCMCAPTURE called: frame #%u, format=%s, %dx%d", |
3197 | mmap.frame, symbolic(v4l1_plist, mmap.format), | 3197 | mmap.frame, symbolic(v4l1_plist, mmap.format), |
3198 | mmap.width, mmap.height) | 3198 | mmap.width, mmap.height) |
3199 | 3199 | ||
3200 | if (mmap.frame >= cam->nbuffers) { | 3200 | if (mmap.frame >= cam->nbuffers) { |
@@ -3203,7 +3203,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3203 | return -EINVAL; | 3203 | return -EINVAL; |
3204 | } | 3204 | } |
3205 | 3205 | ||
3206 | if (mmap.format!=cam->picture.palette && | 3206 | if (mmap.format!=cam->picture.palette && |
3207 | (cam->force_palette || !w9968cf_vpp)) { | 3207 | (cam->force_palette || !w9968cf_vpp)) { |
3208 | DBG(4, "Palette %s rejected: only %s is allowed", | 3208 | DBG(4, "Palette %s rejected: only %s is allowed", |
3209 | symbolic(v4l1_plist, mmap.format), | 3209 | symbolic(v4l1_plist, mmap.format), |
@@ -3213,7 +3213,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3213 | 3213 | ||
3214 | if (!w9968cf_valid_palette(mmap.format)) { | 3214 | if (!w9968cf_valid_palette(mmap.format)) { |
3215 | DBG(4, "Palette %s not supported. " | 3215 | DBG(4, "Palette %s not supported. " |
3216 | "VIDIOCMCAPTURE failed", | 3216 | "VIDIOCMCAPTURE failed", |
3217 | symbolic(v4l1_plist, mmap.format)) | 3217 | symbolic(v4l1_plist, mmap.format)) |
3218 | return -EINVAL; | 3218 | return -EINVAL; |
3219 | } | 3219 | } |
@@ -3221,23 +3221,23 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3221 | if (!cam->force_palette) { | 3221 | if (!cam->force_palette) { |
3222 | if (cam->decompression == 0) { | 3222 | if (cam->decompression == 0) { |
3223 | if (w9968cf_need_decompression(mmap.format)) { | 3223 | if (w9968cf_need_decompression(mmap.format)) { |
3224 | DBG(4, "Decompression disabled: palette %s is not " | 3224 | DBG(4, "Decompression disabled: palette %s is not " |
3225 | "allowed. VIDIOCSPICT failed", | 3225 | "allowed. VIDIOCSPICT failed", |
3226 | symbolic(v4l1_plist, mmap.format)) | 3226 | symbolic(v4l1_plist, mmap.format)) |
3227 | return -EINVAL; | 3227 | return -EINVAL; |
3228 | } | 3228 | } |
3229 | } else if (cam->decompression == 1) { | 3229 | } else if (cam->decompression == 1) { |
3230 | if (!w9968cf_need_decompression(mmap.format)) { | 3230 | if (!w9968cf_need_decompression(mmap.format)) { |
3231 | DBG(4, "Decompression forced: palette %s is not " | 3231 | DBG(4, "Decompression forced: palette %s is not " |
3232 | "allowed. VIDIOCSPICT failed", | 3232 | "allowed. VIDIOCSPICT failed", |
3233 | symbolic(v4l1_plist, mmap.format)) | 3233 | symbolic(v4l1_plist, mmap.format)) |
3234 | return -EINVAL; | 3234 | return -EINVAL; |
3235 | } | 3235 | } |
3236 | } | 3236 | } |
3237 | } | 3237 | } |
3238 | 3238 | ||
3239 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&mmap.width, | 3239 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&mmap.width, |
3240 | (u16*)&mmap.height))) { | 3240 | (u16*)&mmap.height))) { |
3241 | DBG(4, "Resolution not supported (%dx%d). " | 3241 | DBG(4, "Resolution not supported (%dx%d). " |
3242 | "VIDIOCMCAPTURE failed", | 3242 | "VIDIOCMCAPTURE failed", |
3243 | mmap.width, mmap.height) | 3243 | mmap.width, mmap.height) |
@@ -3258,12 +3258,12 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3258 | DBG(6, "VIDIOCMCAPTURE. Change settings for " | 3258 | DBG(6, "VIDIOCMCAPTURE. Change settings for " |
3259 | "frame #%u: %dx%d, format %s. Wait...", | 3259 | "frame #%u: %dx%d, format %s. Wait...", |
3260 | mmap.frame, mmap.width, mmap.height, | 3260 | mmap.frame, mmap.width, mmap.height, |
3261 | symbolic(v4l1_plist, mmap.format)) | 3261 | symbolic(v4l1_plist, mmap.format)) |
3262 | err = wait_event_interruptible | 3262 | err = wait_event_interruptible |
3263 | ( cam->wait_queue, | 3263 | ( cam->wait_queue, |
3264 | cam->disconnected || | 3264 | cam->disconnected || |
3265 | (!*cam->requested_frame && | 3265 | (!*cam->requested_frame && |
3266 | !cam->frame_current->queued) ); | 3266 | !cam->frame_current->queued) ); |
3267 | if (err) | 3267 | if (err) |
3268 | return err; | 3268 | return err; |
3269 | if (cam->disconnected) | 3269 | if (cam->disconnected) |
@@ -3280,7 +3280,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3280 | goto ioctl_fail; | 3280 | goto ioctl_fail; |
3281 | 3281 | ||
3282 | /* This before set_window */ | 3282 | /* This before set_window */ |
3283 | if (w9968cf_set_picture(cam, pict)) | 3283 | if (w9968cf_set_picture(cam, pict)) |
3284 | goto ioctl_fail; | 3284 | goto ioctl_fail; |
3285 | 3285 | ||
3286 | if (w9968cf_set_window(cam, win)) | 3286 | if (w9968cf_set_window(cam, win)) |
@@ -3292,10 +3292,10 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3292 | } else if (fr->queued) { | 3292 | } else if (fr->queued) { |
3293 | 3293 | ||
3294 | DBG(6, "Wait until frame #%u is free", mmap.frame) | 3294 | DBG(6, "Wait until frame #%u is free", mmap.frame) |
3295 | 3295 | ||
3296 | err = wait_event_interruptible(cam->wait_queue, | 3296 | err = wait_event_interruptible(cam->wait_queue, |
3297 | cam->disconnected || | 3297 | cam->disconnected || |
3298 | (!fr->queued)); | 3298 | (!fr->queued)); |
3299 | if (err) | 3299 | if (err) |
3300 | return err; | 3300 | return err; |
3301 | if (cam->disconnected) | 3301 | if (cam->disconnected) |
@@ -3335,9 +3335,9 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3335 | } | 3335 | } |
3336 | case F_ERROR: | 3336 | case F_ERROR: |
3337 | case F_GRABBING: | 3337 | case F_GRABBING: |
3338 | err = wait_event_interruptible(cam->wait_queue, | 3338 | err = wait_event_interruptible(cam->wait_queue, |
3339 | (fr->status == F_READY) | 3339 | (fr->status == F_READY) |
3340 | || cam->disconnected); | 3340 | || cam->disconnected); |
3341 | if (err) | 3341 | if (err) |
3342 | return err; | 3342 | return err; |
3343 | if (cam->disconnected) | 3343 | if (cam->disconnected) |
@@ -3439,7 +3439,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3439 | DBG(4, "Unsupported V4L1 IOCtl: VIDIOC%s " | 3439 | DBG(4, "Unsupported V4L1 IOCtl: VIDIOC%s " |
3440 | "(type 0x%01X, " | 3440 | "(type 0x%01X, " |
3441 | "n. 0x%01X, " | 3441 | "n. 0x%01X, " |
3442 | "dir. 0x%01X, " | 3442 | "dir. 0x%01X, " |
3443 | "size 0x%02X)", | 3443 | "size 0x%02X)", |
3444 | V4L1_IOCTL(cmd), | 3444 | V4L1_IOCTL(cmd), |
3445 | _IOC_TYPE(cmd),_IOC_NR(cmd),_IOC_DIR(cmd),_IOC_SIZE(cmd)) | 3445 | _IOC_TYPE(cmd),_IOC_NR(cmd),_IOC_DIR(cmd),_IOC_SIZE(cmd)) |
@@ -3499,13 +3499,13 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3499 | le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[0].idProduct) | 3499 | le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[0].idProduct) |
3500 | mod_id = W9968CF_MOD_CLVBWGP; /* see camlist[] table */ | 3500 | mod_id = W9968CF_MOD_CLVBWGP; /* see camlist[] table */ |
3501 | else if (le16_to_cpu(udev->descriptor.idVendor) == winbond_id_table[1].idVendor && | 3501 | else if (le16_to_cpu(udev->descriptor.idVendor) == winbond_id_table[1].idVendor && |
3502 | le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[1].idProduct) | 3502 | le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[1].idProduct) |
3503 | mod_id = W9968CF_MOD_GENERIC; /* see camlist[] table */ | 3503 | mod_id = W9968CF_MOD_GENERIC; /* see camlist[] table */ |
3504 | else | 3504 | else |
3505 | return -ENODEV; | 3505 | return -ENODEV; |
3506 | 3506 | ||
3507 | cam = (struct w9968cf_device*) | 3507 | cam = (struct w9968cf_device*) |
3508 | kzalloc(sizeof(struct w9968cf_device), GFP_KERNEL); | 3508 | kzalloc(sizeof(struct w9968cf_device), GFP_KERNEL); |
3509 | if (!cam) | 3509 | if (!cam) |
3510 | return -ENOMEM; | 3510 | return -ENOMEM; |
3511 | 3511 | ||
@@ -3569,7 +3569,7 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3569 | cam->v4ldev->dev = &cam->dev; | 3569 | cam->v4ldev->dev = &cam->dev; |
3570 | 3570 | ||
3571 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 3571 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
3572 | video_nr[dev_nr]); | 3572 | video_nr[dev_nr]); |
3573 | if (err) { | 3573 | if (err) { |
3574 | DBG(1, "V4L device registration failed") | 3574 | DBG(1, "V4L device registration failed") |
3575 | if (err == -ENFILE && video_nr[dev_nr] == -1) | 3575 | if (err == -ENFILE && video_nr[dev_nr] == -1) |
@@ -3611,7 +3611,7 @@ fail: /* Free unused memory */ | |||
3611 | 3611 | ||
3612 | static void w9968cf_usb_disconnect(struct usb_interface* intf) | 3612 | static void w9968cf_usb_disconnect(struct usb_interface* intf) |
3613 | { | 3613 | { |
3614 | struct w9968cf_device* cam = | 3614 | struct w9968cf_device* cam = |
3615 | (struct w9968cf_device*)usb_get_intfdata(intf); | 3615 | (struct w9968cf_device*)usb_get_intfdata(intf); |
3616 | 3616 | ||
3617 | down_write(&w9968cf_disconnect); | 3617 | down_write(&w9968cf_disconnect); |
diff --git a/drivers/usb/media/w9968cf.h b/drivers/media/video/w9968cf.h index a87be719a281..2836b45ec206 100644 --- a/drivers/usb/media/w9968cf.h +++ b/drivers/media/video/w9968cf.h | |||
@@ -61,7 +61,7 @@ | |||
61 | 61 | ||
62 | /* Maximum data payload sizes in bytes for alternate settings */ | 62 | /* Maximum data payload sizes in bytes for alternate settings */ |
63 | static const u16 wMaxPacketSize[] = {1023, 959, 895, 831, 767, 703, 639, 575, | 63 | static const u16 wMaxPacketSize[] = {1023, 959, 895, 831, 767, 703, 639, 575, |
64 | 511, 447, 383, 319, 255, 191, 127, 63}; | 64 | 511, 447, 383, 319, 255, 191, 127, 63}; |
65 | #define W9968CF_PACKET_SIZE 1023 /* according to wMaxPacketSizes[] */ | 65 | #define W9968CF_PACKET_SIZE 1023 /* according to wMaxPacketSizes[] */ |
66 | #define W9968CF_MIN_PACKET_SIZE 63 /* minimum value */ | 66 | #define W9968CF_MIN_PACKET_SIZE 63 /* minimum value */ |
67 | #define W9968CF_ISO_PACKETS 5 /* n.of packets for isochronous transfers */ | 67 | #define W9968CF_ISO_PACKETS 5 /* n.of packets for isochronous transfers */ |
@@ -134,7 +134,7 @@ static const struct w9968cf_format w9968cf_formatlist[] = { | |||
134 | ****************************************************************************/ | 134 | ****************************************************************************/ |
135 | 135 | ||
136 | #define W9968CF_MODULE_NAME "V4L driver for W996[87]CF JPEG USB " \ | 136 | #define W9968CF_MODULE_NAME "V4L driver for W996[87]CF JPEG USB " \ |
137 | "Dual Mode Camera Chip" | 137 | "Dual Mode Camera Chip" |
138 | #define W9968CF_MODULE_VERSION "1:1.33-basic" | 138 | #define W9968CF_MODULE_VERSION "1:1.33-basic" |
139 | #define W9968CF_MODULE_AUTHOR "(C) 2002-2004 Luca Risolia" | 139 | #define W9968CF_MODULE_AUTHOR "(C) 2002-2004 Luca Risolia" |
140 | #define W9968CF_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | 140 | #define W9968CF_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" |
@@ -270,9 +270,9 @@ struct w9968cf_device { | |||
270 | 270 | ||
271 | /* Locks */ | 271 | /* Locks */ |
272 | struct mutex dev_mutex, /* for probe, disconnect,open and close */ | 272 | struct mutex dev_mutex, /* for probe, disconnect,open and close */ |
273 | fileop_mutex; /* for read and ioctl */ | 273 | fileop_mutex; /* for read and ioctl */ |
274 | spinlock_t urb_lock, /* for submit_urb() and unlink_urb() */ | 274 | spinlock_t urb_lock, /* for submit_urb() and unlink_urb() */ |
275 | flist_lock; /* for requested frame list accesses */ | 275 | flist_lock; /* for requested frame list accesses */ |
276 | wait_queue_head_t open, wait_queue; | 276 | wait_queue_head_t open, wait_queue; |
277 | 277 | ||
278 | char command[16]; /* name of the program holding the device */ | 278 | char command[16]; /* name of the program holding the device */ |
@@ -299,7 +299,7 @@ struct w9968cf_device { | |||
299 | dev_warn(&cam->dev, fmt "\n", ## args); \ | 299 | dev_warn(&cam->dev, fmt "\n", ## args); \ |
300 | else if ((level) >= 5) \ | 300 | else if ((level) >= 5) \ |
301 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", \ | 301 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", \ |
302 | __FUNCTION__, __LINE__ , ## args); \ | 302 | __FUNCTION__, __LINE__ , ## args); \ |
303 | } \ | 303 | } \ |
304 | } | 304 | } |
305 | /* For generic kernel (not device specific) messages */ | 305 | /* For generic kernel (not device specific) messages */ |
@@ -311,7 +311,7 @@ struct w9968cf_device { | |||
311 | pr_info("w9968cf: " fmt "\n", ## args); \ | 311 | pr_info("w9968cf: " fmt "\n", ## args); \ |
312 | else if ((level) >= 5) \ | 312 | else if ((level) >= 5) \ |
313 | pr_debug("w9968cf: [%s:%d] " fmt "\n", __FUNCTION__, \ | 313 | pr_debug("w9968cf: [%s:%d] " fmt "\n", __FUNCTION__, \ |
314 | __LINE__ , ## args); \ | 314 | __LINE__ , ## args); \ |
315 | } \ | 315 | } \ |
316 | } | 316 | } |
317 | #else | 317 | #else |
diff --git a/drivers/usb/media/w9968cf_decoder.h b/drivers/media/video/w9968cf_decoder.h index 31faccbe8f03..59decbfc540a 100644 --- a/drivers/usb/media/w9968cf_decoder.h +++ b/drivers/media/video/w9968cf_decoder.h | |||
@@ -78,9 +78,9 @@ static const unsigned char UV_QUANTABLE[64] = { | |||
78 | #define W9968CF_DEC_ERR_NO_EOI -6 | 78 | #define W9968CF_DEC_ERR_NO_EOI -6 |
79 | 79 | ||
80 | extern void w9968cf_init_decoder(void); | 80 | extern void w9968cf_init_decoder(void); |
81 | extern int w9968cf_check_headers(const unsigned char* Pin, | 81 | extern int w9968cf_check_headers(const unsigned char* Pin, |
82 | const unsigned long BUF_SIZE); | 82 | const unsigned long BUF_SIZE); |
83 | extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE, | 83 | extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE, |
84 | const unsigned W, const unsigned H, char* Pout); | 84 | const unsigned W, const unsigned H, char* Pout); |
85 | 85 | ||
86 | #endif /* _W9968CF_DECODER_H_ */ | 86 | #endif /* _W9968CF_DECODER_H_ */ |
diff --git a/drivers/usb/media/w9968cf_vpp.h b/drivers/media/video/w9968cf_vpp.h index f3b91b782671..88c9b6c0cc36 100644 --- a/drivers/usb/media/w9968cf_vpp.h +++ b/drivers/media/video/w9968cf_vpp.h | |||
@@ -29,7 +29,7 @@ struct w9968cf_vpp_t { | |||
29 | struct module* owner; | 29 | struct module* owner; |
30 | int (*check_headers)(const unsigned char*, const unsigned long); | 30 | int (*check_headers)(const unsigned char*, const unsigned long); |
31 | int (*decode)(const char*, const unsigned long, const unsigned, | 31 | int (*decode)(const char*, const unsigned long, const unsigned, |
32 | const unsigned, char*); | 32 | const unsigned, char*); |
33 | void (*swap_yuvbytes)(void*, unsigned long); | 33 | void (*swap_yuvbytes)(void*, unsigned long); |
34 | void (*uyvy_to_rgbx)(u8*, unsigned long, u8*, u16, u8); | 34 | void (*uyvy_to_rgbx)(u8*, unsigned long, u8*, u16, u8); |
35 | void (*scale_up)(u8*, u8*, u16, u16, u16, u16, u16); | 35 | void (*scale_up)(u8*, u8*, u16, u16, u16, u16, u16); |
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 8cb64f8a8a91..d81a88bbe43d 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c | |||
@@ -79,21 +79,26 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd, | |||
79 | void *arg) | 79 | void *arg) |
80 | { | 80 | { |
81 | struct wm8775_state *state = i2c_get_clientdata(client); | 81 | struct wm8775_state *state = i2c_get_clientdata(client); |
82 | struct v4l2_audio *input = arg; | 82 | struct v4l2_routing *route = arg; |
83 | struct v4l2_control *ctrl = arg; | 83 | struct v4l2_control *ctrl = arg; |
84 | 84 | ||
85 | switch (cmd) { | 85 | switch (cmd) { |
86 | case VIDIOC_S_AUDIO: | 86 | case VIDIOC_INT_G_AUDIO_ROUTING: |
87 | route->input = state->input; | ||
88 | route->output = 0; | ||
89 | break; | ||
90 | |||
91 | case VIDIOC_INT_S_AUDIO_ROUTING: | ||
87 | /* There are 4 inputs and one output. Zero or more inputs | 92 | /* There are 4 inputs and one output. Zero or more inputs |
88 | are multiplexed together to the output. Hence there are | 93 | are multiplexed together to the output. Hence there are |
89 | 16 combinations. | 94 | 16 combinations. |
90 | If only one input is active (the normal case) then the | 95 | If only one input is active (the normal case) then the |
91 | input values 1, 2, 4 or 8 should be used. */ | 96 | input values 1, 2, 4 or 8 should be used. */ |
92 | if (input->index > 15) { | 97 | if (route->input > 15) { |
93 | v4l_err(client, "Invalid input %d.\n", input->index); | 98 | v4l_err(client, "Invalid input %d.\n", route->input); |
94 | return -EINVAL; | 99 | return -EINVAL; |
95 | } | 100 | } |
96 | state->input = input->index; | 101 | state->input = route->input; |
97 | if (state->muted) | 102 | if (state->muted) |
98 | break; | 103 | break; |
99 | wm8775_write(client, R21, 0x0c0); | 104 | wm8775_write(client, R21, 0x0c0); |
@@ -102,11 +107,6 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd, | |||
102 | wm8775_write(client, R21, 0x100 + state->input); | 107 | wm8775_write(client, R21, 0x100 + state->input); |
103 | break; | 108 | break; |
104 | 109 | ||
105 | case VIDIOC_G_AUDIO: | ||
106 | memset(input, 0, sizeof(*input)); | ||
107 | input->index = state->input; | ||
108 | break; | ||
109 | |||
110 | case VIDIOC_G_CTRL: | 110 | case VIDIOC_G_CTRL: |
111 | if (ctrl->id != V4L2_CID_AUDIO_MUTE) | 111 | if (ctrl->id != V4L2_CID_AUDIO_MUTE) |
112 | return -EINVAL; | 112 | return -EINVAL; |
diff --git a/drivers/media/video/zc0301/Makefile b/drivers/media/video/zc0301/Makefile new file mode 100644 index 000000000000..d749199d8f06 --- /dev/null +++ b/drivers/media/video/zc0301/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | zc0301-objs := zc0301_core.o zc0301_pas202bcb.o | ||
2 | |||
3 | obj-$(CONFIG_USB_ZC0301) += zc0301.o | ||
diff --git a/drivers/usb/media/zc0301.h b/drivers/media/video/zc0301/zc0301.h index 8e0655140e60..b9c93b8c16f7 100644 --- a/drivers/usb/media/zc0301.h +++ b/drivers/media/video/zc0301/zc0301.h | |||
@@ -157,7 +157,7 @@ do { \ | |||
157 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ | 157 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
158 | else if ((level) >= 3) \ | 158 | else if ((level) >= 3) \ |
159 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 159 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
160 | __FUNCTION__, __LINE__ , ## args); \ | 160 | __FUNCTION__, __LINE__ , ## args); \ |
161 | } \ | 161 | } \ |
162 | } while (0) | 162 | } while (0) |
163 | # define KDBG(level, fmt, args...) \ | 163 | # define KDBG(level, fmt, args...) \ |
@@ -167,7 +167,7 @@ do { \ | |||
167 | pr_info("zc0301: " fmt "\n", ## args); \ | 167 | pr_info("zc0301: " fmt "\n", ## args); \ |
168 | else if ((level) == 3) \ | 168 | else if ((level) == 3) \ |
169 | pr_debug("zc0301: [%s:%d] " fmt "\n", __FUNCTION__, \ | 169 | pr_debug("zc0301: [%s:%d] " fmt "\n", __FUNCTION__, \ |
170 | __LINE__ , ## args); \ | 170 | __LINE__ , ## args); \ |
171 | } \ | 171 | } \ |
172 | } while (0) | 172 | } while (0) |
173 | # define V4LDBG(level, name, cmd) \ | 173 | # define V4LDBG(level, name, cmd) \ |
@@ -184,7 +184,7 @@ do { \ | |||
184 | #undef PDBG | 184 | #undef PDBG |
185 | #define PDBG(fmt, args...) \ | 185 | #define PDBG(fmt, args...) \ |
186 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 186 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
187 | __FUNCTION__, __LINE__ , ## args) | 187 | __FUNCTION__, __LINE__ , ## args) |
188 | 188 | ||
189 | #undef PDBGG | 189 | #undef PDBGG |
190 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | 190 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |
diff --git a/drivers/usb/media/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c index 4036c6268bff..0fad39754f7a 100644 --- a/drivers/usb/media/zc0301_core.c +++ b/drivers/media/video/zc0301/zc0301_core.c | |||
@@ -48,7 +48,7 @@ | |||
48 | /*****************************************************************************/ | 48 | /*****************************************************************************/ |
49 | 49 | ||
50 | #define ZC0301_MODULE_NAME "V4L2 driver for ZC0301 " \ | 50 | #define ZC0301_MODULE_NAME "V4L2 driver for ZC0301 " \ |
51 | "Image Processor and Control Chip" | 51 | "Image Processor and Control Chip" |
52 | #define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia" | 52 | #define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia" |
53 | #define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | 53 | #define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" |
54 | #define ZC0301_MODULE_LICENSE "GPL" | 54 | #define ZC0301_MODULE_LICENSE "GPL" |
@@ -67,67 +67,67 @@ MODULE_LICENSE(ZC0301_MODULE_LICENSE); | |||
67 | static short video_nr[] = {[0 ... ZC0301_MAX_DEVICES-1] = -1}; | 67 | static short video_nr[] = {[0 ... ZC0301_MAX_DEVICES-1] = -1}; |
68 | module_param_array(video_nr, short, NULL, 0444); | 68 | module_param_array(video_nr, short, NULL, 0444); |
69 | MODULE_PARM_DESC(video_nr, | 69 | MODULE_PARM_DESC(video_nr, |
70 | "\n<-1|n[,...]> Specify V4L2 minor mode number." | 70 | "\n<-1|n[,...]> Specify V4L2 minor mode number." |
71 | "\n -1 = use next available (default)" | 71 | "\n -1 = use next available (default)" |
72 | "\n n = use minor number n (integer >= 0)" | 72 | "\n n = use minor number n (integer >= 0)" |
73 | "\nYou can specify up to " | 73 | "\nYou can specify up to " |
74 | __MODULE_STRING(ZC0301_MAX_DEVICES) " cameras this way." | 74 | __MODULE_STRING(ZC0301_MAX_DEVICES) " cameras this way." |
75 | "\nFor example:" | 75 | "\nFor example:" |
76 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" | 76 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" |
77 | "\nthe second registered camera and use auto for the first" | 77 | "\nthe second registered camera and use auto for the first" |
78 | "\none and for every other camera." | 78 | "\none and for every other camera." |
79 | "\n"); | 79 | "\n"); |
80 | 80 | ||
81 | static short force_munmap[] = {[0 ... ZC0301_MAX_DEVICES-1] = | 81 | static short force_munmap[] = {[0 ... ZC0301_MAX_DEVICES-1] = |
82 | ZC0301_FORCE_MUNMAP}; | 82 | ZC0301_FORCE_MUNMAP}; |
83 | module_param_array(force_munmap, bool, NULL, 0444); | 83 | module_param_array(force_munmap, bool, NULL, 0444); |
84 | MODULE_PARM_DESC(force_munmap, | 84 | MODULE_PARM_DESC(force_munmap, |
85 | "\n<0|1[,...]> Force the application to unmap previously" | 85 | "\n<0|1[,...]> Force the application to unmap previously" |
86 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" | 86 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" |
87 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" | 87 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" |
88 | "\nthis feature. This parameter is specific for each" | 88 | "\nthis feature. This parameter is specific for each" |
89 | "\ndetected camera." | 89 | "\ndetected camera." |
90 | "\n 0 = do not force memory unmapping" | 90 | "\n 0 = do not force memory unmapping" |
91 | "\n 1 = force memory unmapping (save memory)" | 91 | "\n 1 = force memory unmapping (save memory)" |
92 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." | 92 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." |
93 | "\n"); | 93 | "\n"); |
94 | 94 | ||
95 | static unsigned int frame_timeout[] = {[0 ... ZC0301_MAX_DEVICES-1] = | 95 | static unsigned int frame_timeout[] = {[0 ... ZC0301_MAX_DEVICES-1] = |
96 | ZC0301_FRAME_TIMEOUT}; | 96 | ZC0301_FRAME_TIMEOUT}; |
97 | module_param_array(frame_timeout, uint, NULL, 0644); | 97 | module_param_array(frame_timeout, uint, NULL, 0644); |
98 | MODULE_PARM_DESC(frame_timeout, | 98 | MODULE_PARM_DESC(frame_timeout, |
99 | "\n<n[,...]> Timeout for a video frame in seconds." | 99 | "\n<n[,...]> Timeout for a video frame in seconds." |
100 | "\nThis parameter is specific for each detected camera." | 100 | "\nThis parameter is specific for each detected camera." |
101 | "\nDefault value is "__MODULE_STRING(ZC0301_FRAME_TIMEOUT)"." | 101 | "\nDefault value is "__MODULE_STRING(ZC0301_FRAME_TIMEOUT)"." |
102 | "\n"); | 102 | "\n"); |
103 | 103 | ||
104 | #ifdef ZC0301_DEBUG | 104 | #ifdef ZC0301_DEBUG |
105 | static unsigned short debug = ZC0301_DEBUG_LEVEL; | 105 | static unsigned short debug = ZC0301_DEBUG_LEVEL; |
106 | module_param(debug, ushort, 0644); | 106 | module_param(debug, ushort, 0644); |
107 | MODULE_PARM_DESC(debug, | 107 | MODULE_PARM_DESC(debug, |
108 | "\n<n> Debugging information level, from 0 to 3:" | 108 | "\n<n> Debugging information level, from 0 to 3:" |
109 | "\n0 = none (use carefully)" | 109 | "\n0 = none (use carefully)" |
110 | "\n1 = critical errors" | 110 | "\n1 = critical errors" |
111 | "\n2 = significant informations" | 111 | "\n2 = significant informations" |
112 | "\n3 = more verbose messages" | 112 | "\n3 = more verbose messages" |
113 | "\nLevel 3 is useful for testing only, when only " | 113 | "\nLevel 3 is useful for testing only, when only " |
114 | "one device is used." | 114 | "one device is used." |
115 | "\nDefault value is "__MODULE_STRING(ZC0301_DEBUG_LEVEL)"." | 115 | "\nDefault value is "__MODULE_STRING(ZC0301_DEBUG_LEVEL)"." |
116 | "\n"); | 116 | "\n"); |
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | /*****************************************************************************/ | 119 | /*****************************************************************************/ |
120 | 120 | ||
121 | static u32 | 121 | static u32 |
122 | zc0301_request_buffers(struct zc0301_device* cam, u32 count, | 122 | zc0301_request_buffers(struct zc0301_device* cam, u32 count, |
123 | enum zc0301_io_method io) | 123 | enum zc0301_io_method io) |
124 | { | 124 | { |
125 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); | 125 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); |
126 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); | 126 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); |
127 | const size_t imagesize = cam->module_param.force_munmap || | 127 | const size_t imagesize = cam->module_param.force_munmap || |
128 | io == IO_READ ? | 128 | io == IO_READ ? |
129 | (p->width * p->height * p->priv) / 8 : | 129 | (p->width * p->height * p->priv) / 8 : |
130 | (r->width * r->height * p->priv) / 8; | 130 | (r->width * r->height * p->priv) / 8; |
131 | void* buff = NULL; | 131 | void* buff = NULL; |
132 | u32 i; | 132 | u32 i; |
133 | 133 | ||
@@ -216,7 +216,7 @@ int zc0301_write_reg(struct zc0301_device* cam, u16 index, u16 value) | |||
216 | int res; | 216 | int res; |
217 | 217 | ||
218 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0xa0, 0x40, | 218 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0xa0, 0x40, |
219 | value, index, NULL, 0, ZC0301_CTRL_TIMEOUT); | 219 | value, index, NULL, 0, ZC0301_CTRL_TIMEOUT); |
220 | if (res < 0) { | 220 | if (res < 0) { |
221 | DBG(3, "Failed to write a register (index 0x%04X, " | 221 | DBG(3, "Failed to write a register (index 0x%04X, " |
222 | "value 0x%02X, error %d)",index, value, res); | 222 | "value 0x%02X, error %d)",index, value, res); |
@@ -234,7 +234,7 @@ int zc0301_read_reg(struct zc0301_device* cam, u16 index) | |||
234 | int res; | 234 | int res; |
235 | 235 | ||
236 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0xa1, 0xc0, | 236 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0xa1, 0xc0, |
237 | 0x0001, index, buff, 1, ZC0301_CTRL_TIMEOUT); | 237 | 0x0001, index, buff, 1, ZC0301_CTRL_TIMEOUT); |
238 | if (res < 0) | 238 | if (res < 0) |
239 | DBG(3, "Failed to read a register (index 0x%04X, error %d)", | 239 | DBG(3, "Failed to read a register (index 0x%04X, error %d)", |
240 | index, res); | 240 | index, res); |
@@ -337,11 +337,11 @@ static void zc0301_urb_complete(struct urb *urb, struct pt_regs* regs) | |||
337 | 337 | ||
338 | if (!(*f)) | 338 | if (!(*f)) |
339 | (*f) = list_entry(cam->inqueue.next, struct zc0301_frame_t, | 339 | (*f) = list_entry(cam->inqueue.next, struct zc0301_frame_t, |
340 | frame); | 340 | frame); |
341 | 341 | ||
342 | imagesize = (cam->sensor.pix_format.width * | 342 | imagesize = (cam->sensor.pix_format.width * |
343 | cam->sensor.pix_format.height * | 343 | cam->sensor.pix_format.height * |
344 | cam->sensor.pix_format.priv) / 8; | 344 | cam->sensor.pix_format.priv) / 8; |
345 | 345 | ||
346 | for (i = 0; i < urb->number_of_packets; i++) { | 346 | for (i = 0; i < urb->number_of_packets; i++) { |
347 | unsigned int len, status; | 347 | unsigned int len, status; |
@@ -395,8 +395,8 @@ end_of_frame: | |||
395 | list_move_tail(&(*f)->frame, &cam->outqueue); | 395 | list_move_tail(&(*f)->frame, &cam->outqueue); |
396 | if (!list_empty(&cam->inqueue)) | 396 | if (!list_empty(&cam->inqueue)) |
397 | (*f) = list_entry(cam->inqueue.next, | 397 | (*f) = list_entry(cam->inqueue.next, |
398 | struct zc0301_frame_t, | 398 | struct zc0301_frame_t, |
399 | frame); | 399 | frame); |
400 | else | 400 | else |
401 | (*f) = NULL; | 401 | (*f) = NULL; |
402 | spin_unlock(&cam->queue_lock); | 402 | spin_unlock(&cam->queue_lock); |
@@ -429,14 +429,14 @@ static int zc0301_start_transfer(struct zc0301_device* cam) | |||
429 | struct usb_device *udev = cam->usbdev; | 429 | struct usb_device *udev = cam->usbdev; |
430 | struct urb* urb; | 430 | struct urb* urb; |
431 | const unsigned int wMaxPacketSize[] = {0, 128, 192, 256, 384, | 431 | const unsigned int wMaxPacketSize[] = {0, 128, 192, 256, 384, |
432 | 512, 768, 1023}; | 432 | 512, 768, 1023}; |
433 | const unsigned int psz = wMaxPacketSize[ZC0301_ALTERNATE_SETTING]; | 433 | const unsigned int psz = wMaxPacketSize[ZC0301_ALTERNATE_SETTING]; |
434 | s8 i, j; | 434 | s8 i, j; |
435 | int err = 0; | 435 | int err = 0; |
436 | 436 | ||
437 | for (i = 0; i < ZC0301_URBS; i++) { | 437 | for (i = 0; i < ZC0301_URBS; i++) { |
438 | cam->transfer_buffer[i] = kzalloc(ZC0301_ISO_PACKETS * psz, | 438 | cam->transfer_buffer[i] = kzalloc(ZC0301_ISO_PACKETS * psz, |
439 | GFP_KERNEL); | 439 | GFP_KERNEL); |
440 | if (!cam->transfer_buffer[i]) { | 440 | if (!cam->transfer_buffer[i]) { |
441 | err = -ENOMEM; | 441 | err = -ENOMEM; |
442 | DBG(1, "Not enough memory"); | 442 | DBG(1, "Not enough memory"); |
@@ -528,9 +528,9 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam) | |||
528 | 528 | ||
529 | cam->stream = STREAM_INTERRUPT; | 529 | cam->stream = STREAM_INTERRUPT; |
530 | timeout = wait_event_timeout(cam->wait_stream, | 530 | timeout = wait_event_timeout(cam->wait_stream, |
531 | (cam->stream == STREAM_OFF) || | 531 | (cam->stream == STREAM_OFF) || |
532 | (cam->state & DEV_DISCONNECTED), | 532 | (cam->state & DEV_DISCONNECTED), |
533 | ZC0301_URB_TIMEOUT); | 533 | ZC0301_URB_TIMEOUT); |
534 | if (cam->state & DEV_DISCONNECTED) | 534 | if (cam->state & DEV_DISCONNECTED) |
535 | return -ENODEV; | 535 | return -ENODEV; |
536 | else if (cam->stream != STREAM_OFF) { | 536 | else if (cam->stream != STREAM_OFF) { |
@@ -548,7 +548,7 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam) | |||
548 | 548 | ||
549 | static int | 549 | static int |
550 | zc0301_set_compression(struct zc0301_device* cam, | 550 | zc0301_set_compression(struct zc0301_device* cam, |
551 | struct v4l2_jpegcompression* compression) | 551 | struct v4l2_jpegcompression* compression) |
552 | { | 552 | { |
553 | int r, err = 0; | 553 | int r, err = 0; |
554 | 554 | ||
@@ -670,8 +670,8 @@ static int zc0301_open(struct inode* inode, struct file* filp) | |||
670 | } | 670 | } |
671 | mutex_unlock(&cam->dev_mutex); | 671 | mutex_unlock(&cam->dev_mutex); |
672 | err = wait_event_interruptible_exclusive(cam->open, | 672 | err = wait_event_interruptible_exclusive(cam->open, |
673 | cam->state & DEV_DISCONNECTED | 673 | cam->state & DEV_DISCONNECTED |
674 | || !cam->users); | 674 | || !cam->users); |
675 | if (err) { | 675 | if (err) { |
676 | up_read(&zc0301_disconnect); | 676 | up_read(&zc0301_disconnect); |
677 | return err; | 677 | return err; |
@@ -802,12 +802,12 @@ zc0301_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
802 | return -EAGAIN; | 802 | return -EAGAIN; |
803 | } | 803 | } |
804 | timeout = wait_event_interruptible_timeout | 804 | timeout = wait_event_interruptible_timeout |
805 | ( cam->wait_frame, | 805 | ( cam->wait_frame, |
806 | (!list_empty(&cam->outqueue)) || | 806 | (!list_empty(&cam->outqueue)) || |
807 | (cam->state & DEV_DISCONNECTED) || | 807 | (cam->state & DEV_DISCONNECTED) || |
808 | (cam->state & DEV_MISCONFIGURED), | 808 | (cam->state & DEV_MISCONFIGURED), |
809 | cam->module_param.frame_timeout * | 809 | cam->module_param.frame_timeout * |
810 | 1000 * msecs_to_jiffies(1) ); | 810 | 1000 * msecs_to_jiffies(1) ); |
811 | if (timeout < 0) { | 811 | if (timeout < 0) { |
812 | mutex_unlock(&cam->fileop_mutex); | 812 | mutex_unlock(&cam->fileop_mutex); |
813 | return timeout; | 813 | return timeout; |
@@ -930,7 +930,7 @@ static int zc0301_mmap(struct file* filp, struct vm_area_struct *vma) | |||
930 | { | 930 | { |
931 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); | 931 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); |
932 | unsigned long size = vma->vm_end - vma->vm_start, | 932 | unsigned long size = vma->vm_end - vma->vm_start, |
933 | start = vma->vm_start; | 933 | start = vma->vm_start; |
934 | void *pos; | 934 | void *pos; |
935 | u32 i; | 935 | u32 i; |
936 | 936 | ||
@@ -998,13 +998,13 @@ zc0301_vidioc_querycap(struct zc0301_device* cam, void __user * arg) | |||
998 | .driver = "zc0301", | 998 | .driver = "zc0301", |
999 | .version = ZC0301_MODULE_VERSION_CODE, | 999 | .version = ZC0301_MODULE_VERSION_CODE, |
1000 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | | 1000 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
1001 | V4L2_CAP_STREAMING, | 1001 | V4L2_CAP_STREAMING, |
1002 | }; | 1002 | }; |
1003 | 1003 | ||
1004 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); | 1004 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); |
1005 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) | 1005 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) |
1006 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, | 1006 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, |
1007 | sizeof(cap.bus_info)); | 1007 | sizeof(cap.bus_info)); |
1008 | 1008 | ||
1009 | if (copy_to_user(arg, &cap, sizeof(cap))) | 1009 | if (copy_to_user(arg, &cap, sizeof(cap))) |
1010 | return -EFAULT; | 1010 | return -EFAULT; |
@@ -1337,7 +1337,7 @@ zc0301_vidioc_g_fmt(struct zc0301_device* cam, void __user * arg) | |||
1337 | 1337 | ||
1338 | static int | 1338 | static int |
1339 | zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd, | 1339 | zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd, |
1340 | void __user * arg) | 1340 | void __user * arg) |
1341 | { | 1341 | { |
1342 | struct zc0301_sensor* s = &cam->sensor; | 1342 | struct zc0301_sensor* s = &cam->sensor; |
1343 | struct v4l2_format format; | 1343 | struct v4l2_format format; |
@@ -1600,7 +1600,7 @@ zc0301_vidioc_qbuf(struct zc0301_device* cam, void __user * arg) | |||
1600 | 1600 | ||
1601 | static int | 1601 | static int |
1602 | zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp, | 1602 | zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp, |
1603 | void __user * arg) | 1603 | void __user * arg) |
1604 | { | 1604 | { |
1605 | struct v4l2_buffer b; | 1605 | struct v4l2_buffer b; |
1606 | struct zc0301_frame_t *f; | 1606 | struct zc0301_frame_t *f; |
@@ -1619,12 +1619,12 @@ zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp, | |||
1619 | if (filp->f_flags & O_NONBLOCK) | 1619 | if (filp->f_flags & O_NONBLOCK) |
1620 | return -EAGAIN; | 1620 | return -EAGAIN; |
1621 | timeout = wait_event_interruptible_timeout | 1621 | timeout = wait_event_interruptible_timeout |
1622 | ( cam->wait_frame, | 1622 | ( cam->wait_frame, |
1623 | (!list_empty(&cam->outqueue)) || | 1623 | (!list_empty(&cam->outqueue)) || |
1624 | (cam->state & DEV_DISCONNECTED) || | 1624 | (cam->state & DEV_DISCONNECTED) || |
1625 | (cam->state & DEV_MISCONFIGURED), | 1625 | (cam->state & DEV_MISCONFIGURED), |
1626 | cam->module_param.frame_timeout * | 1626 | cam->module_param.frame_timeout * |
1627 | 1000 * msecs_to_jiffies(1) ); | 1627 | 1000 * msecs_to_jiffies(1) ); |
1628 | if (timeout < 0) | 1628 | if (timeout < 0) |
1629 | return timeout; | 1629 | return timeout; |
1630 | if (cam->state & DEV_DISCONNECTED) | 1630 | if (cam->state & DEV_DISCONNECTED) |
@@ -1748,7 +1748,7 @@ zc0301_vidioc_s_parm(struct zc0301_device* cam, void __user * arg) | |||
1748 | 1748 | ||
1749 | 1749 | ||
1750 | static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp, | 1750 | static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp, |
1751 | unsigned int cmd, void __user * arg) | 1751 | unsigned int cmd, void __user * arg) |
1752 | { | 1752 | { |
1753 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); | 1753 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); |
1754 | 1754 | ||
@@ -1842,7 +1842,7 @@ static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp, | |||
1842 | 1842 | ||
1843 | 1843 | ||
1844 | static int zc0301_ioctl(struct inode* inode, struct file* filp, | 1844 | static int zc0301_ioctl(struct inode* inode, struct file* filp, |
1845 | unsigned int cmd, unsigned long arg) | 1845 | unsigned int cmd, unsigned long arg) |
1846 | { | 1846 | { |
1847 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); | 1847 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); |
1848 | int err = 0; | 1848 | int err = 0; |
@@ -1948,7 +1948,7 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
1948 | mutex_lock(&cam->dev_mutex); | 1948 | mutex_lock(&cam->dev_mutex); |
1949 | 1949 | ||
1950 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 1950 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
1951 | video_nr[dev_nr]); | 1951 | video_nr[dev_nr]); |
1952 | if (err) { | 1952 | if (err) { |
1953 | DBG(1, "V4L2 device registration failed"); | 1953 | DBG(1, "V4L2 device registration failed"); |
1954 | if (err == -ENFILE && video_nr[dev_nr] == -1) | 1954 | if (err == -ENFILE && video_nr[dev_nr] == -1) |
diff --git a/drivers/usb/media/zc0301_pas202bcb.c b/drivers/media/video/zc0301/zc0301_pas202bcb.c index 9d282a22c15f..eaadf0252049 100644 --- a/drivers/usb/media/zc0301_pas202bcb.c +++ b/drivers/media/video/zc0301/zc0301_pas202bcb.c | |||
@@ -24,10 +24,10 @@ | |||
24 | 24 | ||
25 | /* | 25 | /* |
26 | NOTE: Sensor controls are disabled for now, becouse changing them while | 26 | NOTE: Sensor controls are disabled for now, becouse changing them while |
27 | streaming sometimes results in out-of-sync video frames. We'll use | 27 | streaming sometimes results in out-of-sync video frames. We'll use |
28 | the default initialization, until we know how to stop and start video | 28 | the default initialization, until we know how to stop and start video |
29 | in the chip. However, the image quality still looks good under various | 29 | in the chip. However, the image quality still looks good under various |
30 | light conditions. | 30 | light conditions. |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
@@ -165,7 +165,7 @@ static int pas202bcb_init(struct zc0301_device* cam) | |||
165 | 165 | ||
166 | 166 | ||
167 | static int pas202bcb_get_ctrl(struct zc0301_device* cam, | 167 | static int pas202bcb_get_ctrl(struct zc0301_device* cam, |
168 | struct v4l2_control* ctrl) | 168 | struct v4l2_control* ctrl) |
169 | { | 169 | { |
170 | switch (ctrl->id) { | 170 | switch (ctrl->id) { |
171 | case V4L2_CID_EXPOSURE: | 171 | case V4L2_CID_EXPOSURE: |
@@ -208,7 +208,7 @@ static int pas202bcb_get_ctrl(struct zc0301_device* cam, | |||
208 | 208 | ||
209 | 209 | ||
210 | static int pas202bcb_set_ctrl(struct zc0301_device* cam, | 210 | static int pas202bcb_set_ctrl(struct zc0301_device* cam, |
211 | const struct v4l2_control* ctrl) | 211 | const struct v4l2_control* ctrl) |
212 | { | 212 | { |
213 | int err = 0; | 213 | int err = 0; |
214 | 214 | ||
diff --git a/drivers/usb/media/zc0301_sensor.h b/drivers/media/video/zc0301/zc0301_sensor.h index cf0965a81d01..1f95c28b1015 100644 --- a/drivers/usb/media/zc0301_sensor.h +++ b/drivers/media/video/zc0301/zc0301_sensor.h | |||
@@ -51,7 +51,7 @@ zc0301_attach_sensor(struct zc0301_device* cam, struct zc0301_sensor* sensor); | |||
51 | 51 | ||
52 | #define ZC0301_USB_DEVICE(vend, prod, intclass) \ | 52 | #define ZC0301_USB_DEVICE(vend, prod, intclass) \ |
53 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | 53 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ |
54 | USB_DEVICE_ID_MATCH_INT_CLASS, \ | 54 | USB_DEVICE_ID_MATCH_INT_CLASS, \ |
55 | .idVendor = (vend), \ | 55 | .idVendor = (vend), \ |
56 | .idProduct = (prod), \ | 56 | .idProduct = (prod), \ |
57 | .bInterfaceClass = (intclass) | 57 | .bInterfaceClass = (intclass) |
@@ -92,7 +92,7 @@ struct zc0301_sensor { | |||
92 | int (*init)(struct zc0301_device*); | 92 | int (*init)(struct zc0301_device*); |
93 | int (*get_ctrl)(struct zc0301_device*, struct v4l2_control* ctrl); | 93 | int (*get_ctrl)(struct zc0301_device*, struct v4l2_control* ctrl); |
94 | int (*set_ctrl)(struct zc0301_device*, | 94 | int (*set_ctrl)(struct zc0301_device*, |
95 | const struct v4l2_control* ctrl); | 95 | const struct v4l2_control* ctrl); |
96 | int (*set_crop)(struct zc0301_device*, const struct v4l2_rect* rect); | 96 | int (*set_crop)(struct zc0301_device*, const struct v4l2_rect* rect); |
97 | 97 | ||
98 | /* Private */ | 98 | /* Private */ |
diff --git a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h index ad04a129499d..0166f555a5ca 100644 --- a/drivers/media/video/zoran.h +++ b/drivers/media/video/zoran.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * zoran - Iomega Buz driver | 2 | * zoran - Iomega Buz driver |
3 | * | 3 | * |
4 | * Copyright (C) 1999 Rainer Johanni <Rainer@Johanni.de> | 4 | * Copyright (C) 1999 Rainer Johanni <Rainer@Johanni.de> |
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index b22dbb6d18f6..0a85c9e7fb48 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles card-specific data and detection | 6 | * This part handles card-specific data and detection |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
diff --git a/drivers/media/video/zoran_card.h b/drivers/media/video/zoran_card.h index e5b6acd3eedc..ad997c30bee5 100644 --- a/drivers/media/video/zoran_card.h +++ b/drivers/media/video/zoran_card.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles card-specific data and detection | 6 | * This part handles card-specific data and detection |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c index 4e15afdec4c9..c690b2ee880a 100644 --- a/drivers/media/video/zoran_device.c +++ b/drivers/media/video/zoran_device.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles device access (PCI/I2C/codec/...) | 6 | * This part handles device access (PCI/I2C/codec/...) |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
@@ -492,7 +492,7 @@ zr36057_set_vfe (struct zoran *zr, | |||
492 | /* (Ronald) don't write this if overlay_mask = NULL */ | 492 | /* (Ronald) don't write this if overlay_mask = NULL */ |
493 | if (zr->overlay_mask) { | 493 | if (zr->overlay_mask) { |
494 | /* Write overlay clipping mask data, but don't enable overlay clipping */ | 494 | /* Write overlay clipping mask data, but don't enable overlay clipping */ |
495 | /* RJ: since this makes only sense on the screen, we use | 495 | /* RJ: since this makes only sense on the screen, we use |
496 | * zr->overlay_settings.width instead of video_width */ | 496 | * zr->overlay_settings.width instead of video_width */ |
497 | 497 | ||
498 | mask_line_size = (BUZ_MAX_WIDTH + 31) / 32; | 498 | mask_line_size = (BUZ_MAX_WIDTH + 31) / 32; |
@@ -819,12 +819,12 @@ zr36057_set_jpg (struct zoran *zr, | |||
819 | if (zr->card.vfe_pol.hsync_pol) | 819 | if (zr->card.vfe_pol.hsync_pol) |
820 | btor(ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); | 820 | btor(ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); |
821 | else | 821 | else |
822 | btand(~ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); | 822 | btand(~ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); |
823 | reg = ((tvn->HSyncStart) << ZR36057_HSP_HsyncStart) | | 823 | reg = ((tvn->HSyncStart) << ZR36057_HSP_HsyncStart) | |
824 | (tvn->Wt << ZR36057_HSP_LineTot); | 824 | (tvn->Wt << ZR36057_HSP_LineTot); |
825 | btwrite(reg, ZR36057_HSP); | 825 | btwrite(reg, ZR36057_HSP); |
826 | reg = ((zr->jpg_settings.img_x + | 826 | reg = ((zr->jpg_settings.img_x + |
827 | tvn->HStart + 4) << ZR36057_FHAP_NAX) | | 827 | tvn->HStart + 4) << ZR36057_FHAP_NAX) | |
828 | (zr->jpg_settings.img_width << ZR36057_FHAP_PAX); | 828 | (zr->jpg_settings.img_width << ZR36057_FHAP_PAX); |
829 | btwrite(reg, ZR36057_FHAP); | 829 | btwrite(reg, ZR36057_FHAP); |
830 | 830 | ||
@@ -1272,15 +1272,15 @@ error_handler (struct zoran *zr, | |||
1272 | if (zr->JPEG_error != 1) { | 1272 | if (zr->JPEG_error != 1) { |
1273 | /* | 1273 | /* |
1274 | * First entry: error just happened during normal operation | 1274 | * First entry: error just happened during normal operation |
1275 | * | 1275 | * |
1276 | * In BUZ_MODE_MOTION_COMPRESS: | 1276 | * In BUZ_MODE_MOTION_COMPRESS: |
1277 | * | 1277 | * |
1278 | * Possible glitch in TV signal. In this case we should | 1278 | * Possible glitch in TV signal. In this case we should |
1279 | * stop the codec and wait for good quality signal before | 1279 | * stop the codec and wait for good quality signal before |
1280 | * restarting it to avoid further problems | 1280 | * restarting it to avoid further problems |
1281 | * | 1281 | * |
1282 | * In BUZ_MODE_MOTION_DECOMPRESS: | 1282 | * In BUZ_MODE_MOTION_DECOMPRESS: |
1283 | * | 1283 | * |
1284 | * Bad JPEG frame: we have to mark it as processed (codec crashed | 1284 | * Bad JPEG frame: we have to mark it as processed (codec crashed |
1285 | * and was not able to do it itself), and to remove it from queue. | 1285 | * and was not able to do it itself), and to remove it from queue. |
1286 | */ | 1286 | */ |
diff --git a/drivers/media/video/zoran_device.h b/drivers/media/video/zoran_device.h index f315203d7105..f19705cbdb39 100644 --- a/drivers/media/video/zoran_device.h +++ b/drivers/media/video/zoran_device.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles card-specific data and detection | 6 | * This part handles card-specific data and detection |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index b2c6e01e3923..b5a576a37fd2 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -94,7 +94,7 @@ | |||
94 | V4L2_CAP_VIDEO_CAPTURE |\ | 94 | V4L2_CAP_VIDEO_CAPTURE |\ |
95 | V4L2_CAP_VIDEO_OUTPUT |\ | 95 | V4L2_CAP_VIDEO_OUTPUT |\ |
96 | V4L2_CAP_VIDEO_OVERLAY \ | 96 | V4L2_CAP_VIDEO_OVERLAY \ |
97 | ) | 97 | ) |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | #include <asm/byteorder.h> | 100 | #include <asm/byteorder.h> |
@@ -165,7 +165,7 @@ const struct zoran_format zoran_formats[] = { | |||
165 | #endif | 165 | #endif |
166 | .depth = 16, | 166 | .depth = 16, |
167 | .flags = ZORAN_FORMAT_CAPTURE | | 167 | .flags = ZORAN_FORMAT_CAPTURE | |
168 | ZORAN_FORMAT_OVERLAY, | 168 | ZORAN_FORMAT_OVERLAY, |
169 | }, { | 169 | }, { |
170 | .name = "Hardware-encoded Motion-JPEG", | 170 | .name = "Hardware-encoded Motion-JPEG", |
171 | .palette = -1, | 171 | .palette = -1, |
@@ -670,7 +670,7 @@ jpg_fbuffer_free (struct file *file) | |||
670 | j])))); | 670 | j])))); |
671 | free_page((unsigned long) | 671 | free_page((unsigned long) |
672 | bus_to_virt | 672 | bus_to_virt |
673 | (le32_to_cpu | 673 | (le32_to_cpu |
674 | (fh->jpg_buffers. | 674 | (fh->jpg_buffers. |
675 | buffer[i]. | 675 | buffer[i]. |
676 | frag_tab[2 * j]))); | 676 | frag_tab[2 * j]))); |
@@ -1871,7 +1871,7 @@ zoran_v4l2_buffer_status (struct file *file, | |||
1871 | 1871 | ||
1872 | static int | 1872 | static int |
1873 | zoran_set_norm (struct zoran *zr, | 1873 | zoran_set_norm (struct zoran *zr, |
1874 | int norm) /* VIDEO_MODE_* */ | 1874 | int norm) /* VIDEO_MODE_* */ |
1875 | { | 1875 | { |
1876 | int norm_encoder, on; | 1876 | int norm_encoder, on; |
1877 | 1877 | ||
@@ -2006,9 +2006,9 @@ zoran_set_input (struct zoran *zr, | |||
2006 | 2006 | ||
2007 | static int | 2007 | static int |
2008 | zoran_do_ioctl (struct inode *inode, | 2008 | zoran_do_ioctl (struct inode *inode, |
2009 | struct file *file, | 2009 | struct file *file, |
2010 | unsigned int cmd, | 2010 | unsigned int cmd, |
2011 | void *arg) | 2011 | void *arg) |
2012 | { | 2012 | { |
2013 | struct zoran_fh *fh = file->private_data; | 2013 | struct zoran_fh *fh = file->private_data; |
2014 | struct zoran *zr = fh->zr; | 2014 | struct zoran *zr = fh->zr; |
@@ -2095,7 +2095,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2095 | break; | 2095 | break; |
2096 | 2096 | ||
2097 | /* RJ: the documentation at http://roadrunner.swansea.linux.org.uk/v4lapi.shtml says: | 2097 | /* RJ: the documentation at http://roadrunner.swansea.linux.org.uk/v4lapi.shtml says: |
2098 | * | 2098 | * |
2099 | * * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input." | 2099 | * * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input." |
2100 | * * ^^^^^^^ | 2100 | * * ^^^^^^^ |
2101 | * * The famos BTTV driver has it implemented with a struct video_channel argument | 2101 | * * The famos BTTV driver has it implemented with a struct video_channel argument |
diff --git a/drivers/media/video/zoran_procfs.c b/drivers/media/video/zoran_procfs.c index f0d9b13c3c6c..a00fae90229a 100644 --- a/drivers/media/video/zoran_procfs.c +++ b/drivers/media/video/zoran_procfs.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles the procFS entries (/proc/ZORAN[%d]) | 6 | * This part handles the procFS entries (/proc/ZORAN[%d]) |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
diff --git a/drivers/media/video/zoran_procfs.h b/drivers/media/video/zoran_procfs.h index 8904fc959555..f2d5b1ba448f 100644 --- a/drivers/media/video/zoran_procfs.h +++ b/drivers/media/video/zoran_procfs.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles card-specific data and detection | 6 | * This part handles card-specific data and detection |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
diff --git a/drivers/media/video/zr36016.c b/drivers/media/video/zr36016.c index 10130ef67ea7..62f77584fb85 100644 --- a/drivers/media/video/zr36016.c +++ b/drivers/media/video/zr36016.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/wait.h> | 35 | #include <linux/wait.h> |
36 | 36 | ||
37 | /* includes for structures and defines regarding video | 37 | /* includes for structures and defines regarding video |
38 | #include<linux/videodev.h> */ | 38 | #include<linux/videodev.h> */ |
39 | 39 | ||
40 | /* I/O commands, error codes */ | 40 | /* I/O commands, error codes */ |
@@ -143,8 +143,8 @@ zr36016_readi (struct zr36016 *ptr, | |||
143 | 143 | ||
144 | static void | 144 | static void |
145 | zr36016_writei (struct zr36016 *ptr, | 145 | zr36016_writei (struct zr36016 *ptr, |
146 | u16 reg, | 146 | u16 reg, |
147 | u8 value) | 147 | u8 value) |
148 | { | 148 | { |
149 | dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, | 149 | dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, |
150 | value, reg); | 150 | value, reg); |
@@ -192,7 +192,7 @@ zr36016_basic_test (struct zr36016 *ptr) | |||
192 | dprintk(1, "\n"); | 192 | dprintk(1, "\n"); |
193 | } | 193 | } |
194 | // for testing just write 0, then the default value to a register and read | 194 | // for testing just write 0, then the default value to a register and read |
195 | // it back in both cases | 195 | // it back in both cases |
196 | zr36016_writei(ptr, ZR016I_PAX_LO, 0x00); | 196 | zr36016_writei(ptr, ZR016I_PAX_LO, 0x00); |
197 | if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) { | 197 | if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) { |
198 | dprintk(1, | 198 | dprintk(1, |
@@ -232,17 +232,17 @@ zr36016_basic_test (struct zr36016 *ptr) | |||
232 | static int zr36016_pushit (struct zr36016 *ptr, | 232 | static int zr36016_pushit (struct zr36016 *ptr, |
233 | u16 startreg, | 233 | u16 startreg, |
234 | u16 len, | 234 | u16 len, |
235 | const char *data) | 235 | const char *data) |
236 | { | 236 | { |
237 | int i=0; | 237 | int i=0; |
238 | 238 | ||
239 | dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", | 239 | dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", |
240 | ptr->name, startreg,len); | 240 | ptr->name, startreg,len); |
241 | while (i<len) { | 241 | while (i<len) { |
242 | zr36016_writei(ptr, startreg++, data[i++]); | 242 | zr36016_writei(ptr, startreg++, data[i++]); |
243 | } | 243 | } |
244 | 244 | ||
245 | return i; | 245 | return i; |
246 | } | 246 | } |
247 | #endif | 247 | #endif |
248 | 248 | ||
diff --git a/drivers/media/video/zr36050.c b/drivers/media/video/zr36050.c index 6699725be605..a6bbd125631c 100644 --- a/drivers/media/video/zr36050.c +++ b/drivers/media/video/zr36050.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/wait.h> | 35 | #include <linux/wait.h> |
36 | 36 | ||
37 | /* includes for structures and defines regarding video | 37 | /* includes for structures and defines regarding video |
38 | #include<linux/videodev.h> */ | 38 | #include<linux/videodev.h> */ |
39 | 39 | ||
40 | /* I/O commands, error codes */ | 40 | /* I/O commands, error codes */ |
@@ -171,7 +171,7 @@ zr36050_wait_end (struct zr36050 *ptr) | |||
171 | /* ========================================================================= | 171 | /* ========================================================================= |
172 | Local helper function: | 172 | Local helper function: |
173 | 173 | ||
174 | basic test of "connectivity", writes/reads to/from memory the SOF marker | 174 | basic test of "connectivity", writes/reads to/from memory the SOF marker |
175 | ========================================================================= */ | 175 | ========================================================================= */ |
176 | 176 | ||
177 | static int | 177 | static int |
@@ -218,9 +218,9 @@ zr36050_basic_test (struct zr36050 *ptr) | |||
218 | 218 | ||
219 | static int | 219 | static int |
220 | zr36050_pushit (struct zr36050 *ptr, | 220 | zr36050_pushit (struct zr36050 *ptr, |
221 | u16 startreg, | 221 | u16 startreg, |
222 | u16 len, | 222 | u16 len, |
223 | const char *data) | 223 | const char *data) |
224 | { | 224 | { |
225 | int i = 0; | 225 | int i = 0; |
226 | 226 | ||
@@ -345,7 +345,7 @@ static const char zr36050_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; | |||
345 | /* ------------------------------------------------------------------------- */ | 345 | /* ------------------------------------------------------------------------- */ |
346 | 346 | ||
347 | /* SOF (start of frame) segment depends on width, height and sampling ratio | 347 | /* SOF (start of frame) segment depends on width, height and sampling ratio |
348 | of each color component */ | 348 | of each color component */ |
349 | 349 | ||
350 | static int | 350 | static int |
351 | zr36050_set_sof (struct zr36050 *ptr) | 351 | zr36050_set_sof (struct zr36050 *ptr) |
@@ -376,8 +376,8 @@ zr36050_set_sof (struct zr36050 *ptr) | |||
376 | 376 | ||
377 | /* ------------------------------------------------------------------------- */ | 377 | /* ------------------------------------------------------------------------- */ |
378 | 378 | ||
379 | /* SOS (start of scan) segment depends on the used scan components | 379 | /* SOS (start of scan) segment depends on the used scan components |
380 | of each color component */ | 380 | of each color component */ |
381 | 381 | ||
382 | static int | 382 | static int |
383 | zr36050_set_sos (struct zr36050 *ptr) | 383 | zr36050_set_sos (struct zr36050 *ptr) |
diff --git a/drivers/media/video/zr36057.h b/drivers/media/video/zr36057.h index 159abfa034d9..54c9362aa980 100644 --- a/drivers/media/video/zr36057.h +++ b/drivers/media/video/zr36057.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * zr36057.h - zr36057 register offsets | 2 | * zr36057.h - zr36057 register offsets |
3 | * | 3 | * |
4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> | 4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
@@ -27,14 +27,14 @@ | |||
27 | #define ZR36057_VFEHCR 0x000 /* Video Front End, Horizontal Configuration Register */ | 27 | #define ZR36057_VFEHCR 0x000 /* Video Front End, Horizontal Configuration Register */ |
28 | #define ZR36057_VFEHCR_HSPol (1<<30) | 28 | #define ZR36057_VFEHCR_HSPol (1<<30) |
29 | #define ZR36057_VFEHCR_HStart 10 | 29 | #define ZR36057_VFEHCR_HStart 10 |
30 | #define ZR36057_VFEHCR_HEnd 0 | 30 | #define ZR36057_VFEHCR_HEnd 0 |
31 | #define ZR36057_VFEHCR_Hmask 0x3ff | 31 | #define ZR36057_VFEHCR_Hmask 0x3ff |
32 | 32 | ||
33 | #define ZR36057_VFEVCR 0x004 /* Video Front End, Vertical Configuration Register */ | 33 | #define ZR36057_VFEVCR 0x004 /* Video Front End, Vertical Configuration Register */ |
34 | #define ZR36057_VFEVCR_VSPol (1<<30) | 34 | #define ZR36057_VFEVCR_VSPol (1<<30) |
35 | #define ZR36057_VFEVCR_VStart 10 | 35 | #define ZR36057_VFEVCR_VStart 10 |
36 | #define ZR36057_VFEVCR_VEnd 0 | 36 | #define ZR36057_VFEVCR_VEnd 0 |
37 | #define ZR36057_VFEVCR_Vmask 0x3ff | 37 | #define ZR36057_VFEVCR_Vmask 0x3ff |
38 | 38 | ||
39 | #define ZR36057_VFESPFR 0x008 /* Video Front End, Scaler and Pixel Format Register */ | 39 | #define ZR36057_VFESPFR 0x008 /* Video Front End, Scaler and Pixel Format Register */ |
40 | #define ZR36057_VFESPFR_ExtFl (1<<26) | 40 | #define ZR36057_VFESPFR_ExtFl (1<<26) |
diff --git a/drivers/media/video/zr36060.c b/drivers/media/video/zr36060.c index d8dd003a7aad..97c8f9b9dc12 100644 --- a/drivers/media/video/zr36060.c +++ b/drivers/media/video/zr36060.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/wait.h> | 35 | #include <linux/wait.h> |
36 | 36 | ||
37 | /* includes for structures and defines regarding video | 37 | /* includes for structures and defines regarding video |
38 | #include<linux/videodev.h> */ | 38 | #include<linux/videodev.h> */ |
39 | 39 | ||
40 | /* I/O commands, error codes */ | 40 | /* I/O commands, error codes */ |
@@ -173,7 +173,7 @@ zr36060_wait_end (struct zr36060 *ptr) | |||
173 | /* ========================================================================= | 173 | /* ========================================================================= |
174 | Local helper function: | 174 | Local helper function: |
175 | 175 | ||
176 | basic test of "connectivity", writes/reads to/from memory the SOF marker | 176 | basic test of "connectivity", writes/reads to/from memory the SOF marker |
177 | ========================================================================= */ | 177 | ========================================================================= */ |
178 | 178 | ||
179 | static int | 179 | static int |
@@ -208,9 +208,9 @@ zr36060_basic_test (struct zr36060 *ptr) | |||
208 | 208 | ||
209 | static int | 209 | static int |
210 | zr36060_pushit (struct zr36060 *ptr, | 210 | zr36060_pushit (struct zr36060 *ptr, |
211 | u16 startreg, | 211 | u16 startreg, |
212 | u16 len, | 212 | u16 len, |
213 | const char *data) | 213 | const char *data) |
214 | { | 214 | { |
215 | int i = 0; | 215 | int i = 0; |
216 | 216 | ||
@@ -335,7 +335,7 @@ static const char zr36060_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; | |||
335 | /* ------------------------------------------------------------------------- */ | 335 | /* ------------------------------------------------------------------------- */ |
336 | 336 | ||
337 | /* SOF (start of frame) segment depends on width, height and sampling ratio | 337 | /* SOF (start of frame) segment depends on width, height and sampling ratio |
338 | of each color component */ | 338 | of each color component */ |
339 | 339 | ||
340 | static int | 340 | static int |
341 | zr36060_set_sof (struct zr36060 *ptr) | 341 | zr36060_set_sof (struct zr36060 *ptr) |
@@ -367,8 +367,8 @@ zr36060_set_sof (struct zr36060 *ptr) | |||
367 | 367 | ||
368 | /* ------------------------------------------------------------------------- */ | 368 | /* ------------------------------------------------------------------------- */ |
369 | 369 | ||
370 | /* SOS (start of scan) segment depends on the used scan components | 370 | /* SOS (start of scan) segment depends on the used scan components |
371 | of each color component */ | 371 | of each color component */ |
372 | 372 | ||
373 | static int | 373 | static int |
374 | zr36060_set_sos (struct zr36060 *ptr) | 374 | zr36060_set_sos (struct zr36060 *ptr) |
@@ -385,7 +385,7 @@ zr36060_set_sos (struct zr36060 *ptr) | |||
385 | for (i = 0; i < NO_OF_COMPONENTS; i++) { | 385 | for (i = 0; i < NO_OF_COMPONENTS; i++) { |
386 | sos_data[5 + (i * 2)] = i; // index | 386 | sos_data[5 + (i * 2)] = i; // index |
387 | sos_data[6 + (i * 2)] = (zr36060_td[i] << 4) | | 387 | sos_data[6 + (i * 2)] = (zr36060_td[i] << 4) | |
388 | zr36060_ta[i]; // AC/DC tbl.sel. | 388 | zr36060_ta[i]; // AC/DC tbl.sel. |
389 | } | 389 | } |
390 | sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 2] = 00; // scan start | 390 | sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 2] = 00; // scan start |
391 | sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 3] = 0x3f; | 391 | sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 3] = 0x3f; |
@@ -999,7 +999,7 @@ zr36060_cleanup_module (void) | |||
999 | dprintk(1, | 999 | dprintk(1, |
1000 | "zr36060: something's wrong - %d codecs left somehow.\n", | 1000 | "zr36060: something's wrong - %d codecs left somehow.\n", |
1001 | zr36060_codecs); | 1001 | zr36060_codecs); |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /* however, we can't just stay alive */ | 1004 | /* however, we can't just stay alive */ |
1005 | videocodec_unregister(&zr36060_codec); | 1005 | videocodec_unregister(&zr36060_codec); |
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c index 417a999afee3..6ac3b6740089 100644 --- a/drivers/media/video/zr36120.c +++ b/drivers/media/video/zr36120.c | |||
@@ -316,7 +316,7 @@ DEBUG(printk(CARD_DEBUG "%p added to queue\n",CARD,item)); | |||
316 | item->status = FBUFFER_BUSY; | 316 | item->status = FBUFFER_BUSY; |
317 | if (!lastitem) | 317 | if (!lastitem) |
318 | ztv->workqueue = item; | 318 | ztv->workqueue = item; |
319 | else | 319 | else |
320 | lastitem->next = item; | 320 | lastitem->next = item; |
321 | lastitem = item; | 321 | lastitem = item; |
322 | } | 322 | } |
@@ -516,7 +516,7 @@ DEBUG(printk(KERN_DEBUG " %d: clip(%d,%d,%d,%d)\n", i,vp->x,vp->y,vp->widt | |||
516 | zraor((ztv->vidInterlace*ystep)<<0,~ZORAN_OCR_MASKSTRIDE,ZORAN_OCR); | 516 | zraor((ztv->vidInterlace*ystep)<<0,~ZORAN_OCR_MASKSTRIDE,ZORAN_OCR); |
517 | } | 517 | } |
518 | 518 | ||
519 | struct tvnorm | 519 | struct tvnorm |
520 | { | 520 | { |
521 | u16 Wt, Wa, Ht, Ha, HStart, VStart; | 521 | u16 Wt, Wa, Ht, Ha, HStart, VStart; |
522 | }; | 522 | }; |
@@ -660,7 +660,7 @@ DEBUG(printk(KERN_DEBUG " Y: scale=0, start=%d, end=%d\n", Hstart, Hend)); | |||
660 | int HorDcm = 64-X; | 660 | int HorDcm = 64-X; |
661 | int hcrop1 = 2*(Wa-We)/4; | 661 | int hcrop1 = 2*(Wa-We)/4; |
662 | /* | 662 | /* |
663 | * BUGFIX: Juha Nurmela <junki@qn-lpr2-165.quicknet.inet.fi> | 663 | * BUGFIX: Juha Nurmela <junki@qn-lpr2-165.quicknet.inet.fi> |
664 | * found the solution to the color phase shift. | 664 | * found the solution to the color phase shift. |
665 | * See ChangeLog for the full explanation) | 665 | * See ChangeLog for the full explanation) |
666 | */ | 666 | */ |
@@ -812,12 +812,12 @@ void zoran_close(struct video_device* dev) | |||
812 | 812 | ||
813 | zoran_common_close(ztv); | 813 | zoran_common_close(ztv); |
814 | 814 | ||
815 | /* | 815 | /* |
816 | * This is sucky but right now I can't find a good way to | 816 | * This is sucky but right now I can't find a good way to |
817 | * be sure its safe to free the buffer. We wait 5-6 fields | 817 | * be sure its safe to free the buffer. We wait 5-6 fields |
818 | * which is more than sufficient to be sure. | 818 | * which is more than sufficient to be sure. |
819 | */ | 819 | */ |
820 | msleep(100); /* Wait 1/10th of a second */ | 820 | msleep(100); /* Wait 1/10th of a second */ |
821 | 821 | ||
822 | /* free the allocated framebuffer */ | 822 | /* free the allocated framebuffer */ |
823 | bfree(ztv->fbuffer, ZORAN_MAX_FBUFSIZE); | 823 | bfree(ztv->fbuffer, ZORAN_MAX_FBUFSIZE); |
@@ -1436,7 +1436,7 @@ int zoran_ioctl(struct video_device* dev, unsigned int cmd, void *arg) | |||
1436 | 1436 | ||
1437 | /* Why isn't this in the API? | 1437 | /* Why isn't this in the API? |
1438 | * And why doesn't it take a buffer number? | 1438 | * And why doesn't it take a buffer number? |
1439 | case BTTV_FIELDNR: | 1439 | case BTTV_FIELDNR: |
1440 | { | 1440 | { |
1441 | unsigned long v = ztv->lastfieldnr; | 1441 | unsigned long v = ztv->lastfieldnr; |
1442 | if (copy_to_user(arg,&v,sizeof(v))) | 1442 | if (copy_to_user(arg,&v,sizeof(v))) |
@@ -1557,12 +1557,12 @@ void vbi_close(struct video_device *dev) | |||
1557 | 1557 | ||
1558 | zoran_common_close(ztv); | 1558 | zoran_common_close(ztv); |
1559 | 1559 | ||
1560 | /* | 1560 | /* |
1561 | * This is sucky but right now I can't find a good way to | 1561 | * This is sucky but right now I can't find a good way to |
1562 | * be sure its safe to free the buffer. We wait 5-6 fields | 1562 | * be sure its safe to free the buffer. We wait 5-6 fields |
1563 | * which is more than sufficient to be sure. | 1563 | * which is more than sufficient to be sure. |
1564 | */ | 1564 | */ |
1565 | msleep(100); /* Wait 1/10th of a second */ | 1565 | msleep(100); /* Wait 1/10th of a second */ |
1566 | 1566 | ||
1567 | for (item=ztv->readinfo; item!=ztv->readinfo+ZORAN_VBI_BUFFERS; item++) | 1567 | for (item=ztv->readinfo; item!=ztv->readinfo+ZORAN_VBI_BUFFERS; item++) |
1568 | { | 1568 | { |
@@ -1620,7 +1620,7 @@ long vbi_read(struct video_device* dev, char* buf, unsigned long count, int nonb | |||
1620 | write_unlock_irq(&ztv->lock); | 1620 | write_unlock_irq(&ztv->lock); |
1621 | return -EWOULDBLOCK; | 1621 | return -EWOULDBLOCK; |
1622 | } | 1622 | } |
1623 | 1623 | ||
1624 | /* mark the unused buffer as wanted */ | 1624 | /* mark the unused buffer as wanted */ |
1625 | unused->status = FBUFFER_BUSY; | 1625 | unused->status = FBUFFER_BUSY; |
1626 | unused->next = 0; | 1626 | unused->next = 0; |
@@ -1671,7 +1671,7 @@ long vbi_read(struct video_device* dev, char* buf, unsigned long count, int nonb | |||
1671 | if (count == 2*19*2048) { | 1671 | if (count == 2*19*2048) { |
1672 | /* | 1672 | /* |
1673 | * Extreme HACK, old VBI programs expect 2048 points | 1673 | * Extreme HACK, old VBI programs expect 2048 points |
1674 | * of data, and we only got 864 orso. Double each | 1674 | * of data, and we only got 864 orso. Double each |
1675 | * datapoint and clear the rest of the line. | 1675 | * datapoint and clear the rest of the line. |
1676 | * This way we have appear to have a | 1676 | * This way we have appear to have a |
1677 | * sample_frequency of 29.5 Mc. | 1677 | * sample_frequency of 29.5 Mc. |
@@ -1956,7 +1956,7 @@ int __init init_zoran(int card) | |||
1956 | zrand(~ZORAN_VDC_TRICOM, ZORAN_VDC); | 1956 | zrand(~ZORAN_VDC_TRICOM, ZORAN_VDC); |
1957 | 1957 | ||
1958 | /* external FL determines TOP frame */ | 1958 | /* external FL determines TOP frame */ |
1959 | zror(ZORAN_VFEC_EXTFL, ZORAN_VFEC); | 1959 | zror(ZORAN_VFEC_EXTFL, ZORAN_VFEC); |
1960 | 1960 | ||
1961 | /* set HSpol */ | 1961 | /* set HSpol */ |
1962 | if (ztv->card->hsync_pos) | 1962 | if (ztv->card->hsync_pos) |
@@ -2012,7 +2012,7 @@ void release_zoran(int max) | |||
2012 | struct zoran *ztv; | 2012 | struct zoran *ztv; |
2013 | int i; | 2013 | int i; |
2014 | 2014 | ||
2015 | for (i=0;i<max; i++) | 2015 | for (i=0;i<max; i++) |
2016 | { | 2016 | { |
2017 | ztv = &zorans[i]; | 2017 | ztv = &zorans[i]; |
2018 | 2018 | ||
@@ -2029,7 +2029,7 @@ void release_zoran(int max) | |||
2029 | 2029 | ||
2030 | /* free it */ | 2030 | /* free it */ |
2031 | free_irq(ztv->dev->irq,ztv); | 2031 | free_irq(ztv->dev->irq,ztv); |
2032 | 2032 | ||
2033 | /* unregister i2c_bus */ | 2033 | /* unregister i2c_bus */ |
2034 | i2c_unregister_bus((&ztv->i2c)); | 2034 | i2c_unregister_bus((&ztv->i2c)); |
2035 | 2035 | ||
@@ -2050,7 +2050,7 @@ void __exit zr36120_exit(void) | |||
2050 | int __init zr36120_init(void) | 2050 | int __init zr36120_init(void) |
2051 | { | 2051 | { |
2052 | int card; | 2052 | int card; |
2053 | 2053 | ||
2054 | handle_chipset(); | 2054 | handle_chipset(); |
2055 | zoran_cards = find_zoran(); | 2055 | zoran_cards = find_zoran(); |
2056 | if (zoran_cards<0) | 2056 | if (zoran_cards<0) |
@@ -2063,7 +2063,7 @@ int __init zr36120_init(void) | |||
2063 | /* only release the zorans we have registered */ | 2063 | /* only release the zorans we have registered */ |
2064 | release_zoran(card); | 2064 | release_zoran(card); |
2065 | return -EIO; | 2065 | return -EIO; |
2066 | } | 2066 | } |
2067 | } | 2067 | } |
2068 | return 0; | 2068 | return 0; |
2069 | } | 2069 | } |
diff --git a/drivers/media/video/zr36120.h b/drivers/media/video/zr36120.h index 571f8e84b58a..a71e485b0f98 100644 --- a/drivers/media/video/zr36120.h +++ b/drivers/media/video/zr36120.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | zr36120.h - Zoran 36120/36125 based framegrabbers | 2 | zr36120.h - Zoran 36120/36125 based framegrabbers |
3 | 3 | ||
4 | Copyright (C) 1998-1999 Pauline Middelink (middelin@polyware.nl) | 4 | Copyright (C) 1998-1999 Pauline Middelink (middelin@polyware.nl) |
@@ -89,7 +89,7 @@ struct vidinfo { | |||
89 | ulong* overlay; /* kernel addr of overlay mask */ | 89 | ulong* overlay; /* kernel addr of overlay mask */ |
90 | }; | 90 | }; |
91 | 91 | ||
92 | struct zoran | 92 | struct zoran |
93 | { | 93 | { |
94 | struct video_device video_dev; | 94 | struct video_device video_dev; |
95 | #define CARD_DEBUG KERN_DEBUG "%s(%lu): " | 95 | #define CARD_DEBUG KERN_DEBUG "%s(%lu): " |
@@ -106,7 +106,7 @@ struct zoran | |||
106 | uint norm; /* 0=PAL, 1=NTSC, 2=SECAM */ | 106 | uint norm; /* 0=PAL, 1=NTSC, 2=SECAM */ |
107 | uint tuner_freq; /* Current freq in kHz */ | 107 | uint tuner_freq; /* Current freq in kHz */ |
108 | struct video_picture picture; /* Current picture params */ | 108 | struct video_picture picture; /* Current picture params */ |
109 | 109 | ||
110 | /* videocard details */ | 110 | /* videocard details */ |
111 | uint swidth; /* screen width */ | 111 | uint swidth; /* screen width */ |
112 | uint sheight; /* screen height */ | 112 | uint sheight; /* screen height */ |
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index b1222cd4aa46..7fdbc5dad5fd 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -87,8 +87,6 @@ source "drivers/usb/input/Kconfig" | |||
87 | 87 | ||
88 | source "drivers/usb/image/Kconfig" | 88 | source "drivers/usb/image/Kconfig" |
89 | 89 | ||
90 | source "drivers/usb/media/Kconfig" | ||
91 | |||
92 | source "drivers/usb/net/Kconfig" | 90 | source "drivers/usb/net/Kconfig" |
93 | 91 | ||
94 | source "drivers/usb/mon/Kconfig" | 92 | source "drivers/usb/mon/Kconfig" |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index bb36a1c1dbb3..9b7d9769fdcc 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -35,20 +35,6 @@ obj-$(CONFIG_USB_WACOM) += input/ | |||
35 | obj-$(CONFIG_USB_ACECAD) += input/ | 35 | obj-$(CONFIG_USB_ACECAD) += input/ |
36 | obj-$(CONFIG_USB_XPAD) += input/ | 36 | obj-$(CONFIG_USB_XPAD) += input/ |
37 | 37 | ||
38 | obj-$(CONFIG_USB_DABUSB) += media/ | ||
39 | obj-$(CONFIG_USB_DSBR) += media/ | ||
40 | obj-$(CONFIG_USB_ET61X251) += media/ | ||
41 | obj-$(CONFIG_USB_IBMCAM) += media/ | ||
42 | obj-$(CONFIG_USB_KONICAWC) += media/ | ||
43 | obj-$(CONFIG_USB_OV511) += media/ | ||
44 | obj-$(CONFIG_USB_PWC) += media/ | ||
45 | obj-$(CONFIG_USB_SE401) += media/ | ||
46 | obj-$(CONFIG_USB_SN9C102) += media/ | ||
47 | obj-$(CONFIG_USB_STV680) += media/ | ||
48 | obj-$(CONFIG_USB_VICAM) += media/ | ||
49 | obj-$(CONFIG_USB_W9968CF) += media/ | ||
50 | obj-$(CONFIG_USB_ZC0301) += media/ | ||
51 | |||
52 | obj-$(CONFIG_USB_CATC) += net/ | 38 | obj-$(CONFIG_USB_CATC) += net/ |
53 | obj-$(CONFIG_USB_KAWETH) += net/ | 39 | obj-$(CONFIG_USB_KAWETH) += net/ |
54 | obj-$(CONFIG_USB_PEGASUS) += net/ | 40 | obj-$(CONFIG_USB_PEGASUS) += net/ |
diff --git a/drivers/usb/media/Kconfig b/drivers/usb/media/Kconfig deleted file mode 100644 index 189d40f96be5..000000000000 --- a/drivers/usb/media/Kconfig +++ /dev/null | |||
@@ -1,241 +0,0 @@ | |||
1 | # | ||
2 | # USB Multimedia device configuration | ||
3 | # | ||
4 | comment "USB Multimedia devices" | ||
5 | depends on USB | ||
6 | |||
7 | config USB_DABUSB | ||
8 | tristate "DABUSB driver" | ||
9 | depends on USB | ||
10 | ---help--- | ||
11 | A Digital Audio Broadcasting (DAB) Receiver for USB and Linux | ||
12 | brought to you by the DAB-Team | ||
13 | <http://wwwbode.cs.tum.edu/Par/arch/dab/>. This driver can be taken | ||
14 | as an example for URB-based bulk, control, and isochronous | ||
15 | transactions. URB's are explained in | ||
16 | <file:Documentation/usb/URB.txt>. | ||
17 | |||
18 | To compile this driver as a module, choose M here: the | ||
19 | module will be called dabusb. | ||
20 | |||
21 | comment "Video4Linux support is needed for USB Multimedia device support" | ||
22 | depends on USB && VIDEO_DEV=n | ||
23 | |||
24 | config USB_VICAM | ||
25 | tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" | ||
26 | depends on USB && VIDEO_DEV && EXPERIMENTAL | ||
27 | ---help--- | ||
28 | Say Y here if you have 3com homeconnect camera (vicam). | ||
29 | |||
30 | This driver uses the Video For Linux API. You must say Y or M to | ||
31 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
32 | Information on this API and pointers to "v4l" programs may be found | ||
33 | at <file:Documentation/video4linux/API.html>. | ||
34 | |||
35 | To compile this driver as a module, choose M here: the | ||
36 | module will be called vicam. | ||
37 | |||
38 | config USB_DSBR | ||
39 | tristate "D-Link USB FM radio support (EXPERIMENTAL)" | ||
40 | depends on USB && VIDEO_DEV && EXPERIMENTAL | ||
41 | ---help--- | ||
42 | Say Y here if you want to connect this type of radio to your | ||
43 | computer's USB port. Note that the audio is not digital, and | ||
44 | you must connect the line out connector to a sound card or a | ||
45 | set of speakers. | ||
46 | |||
47 | This driver uses the Video For Linux API. You must enable | ||
48 | (Y or M in config) Video For Linux (under Character Devices) | ||
49 | to use this driver. Information on this API and pointers to | ||
50 | "v4l" programs may be found at | ||
51 | <file:Documentation/video4linux/API.html>. | ||
52 | |||
53 | To compile this driver as a module, choose M here: the | ||
54 | module will be called dsbr100. | ||
55 | |||
56 | config USB_ET61X251 | ||
57 | tristate "USB ET61X[12]51 PC Camera Controller support" | ||
58 | depends on USB && VIDEO_DEV | ||
59 | ---help--- | ||
60 | Say Y here if you want support for cameras based on Etoms ET61X151 | ||
61 | or ET61X251 PC Camera Controllers. | ||
62 | |||
63 | See <file:Documentation/usb/et61x251.txt> for more informations. | ||
64 | |||
65 | This driver uses the Video For Linux API. You must say Y or M to | ||
66 | "Video For Linux" to use this driver. | ||
67 | |||
68 | To compile this driver as a module, choose M here: the | ||
69 | module will be called et61x251. | ||
70 | |||
71 | config USB_IBMCAM | ||
72 | tristate "USB IBM (Xirlink) C-it Camera support" | ||
73 | depends on USB && VIDEO_DEV | ||
74 | ---help--- | ||
75 | Say Y here if you want to connect a IBM "C-It" camera, also known as | ||
76 | "Xirlink PC Camera" to your computer's USB port. For more | ||
77 | information, read <file:Documentation/usb/ibmcam.txt>. | ||
78 | |||
79 | This driver uses the Video For Linux API. You must enable | ||
80 | (Y or M in config) Video For Linux (under Character Devices) | ||
81 | to use this driver. Information on this API and pointers to | ||
82 | "v4l" programs may be found at | ||
83 | <file:Documentation/video4linux/API.html>. | ||
84 | |||
85 | To compile this driver as a module, choose M here: the | ||
86 | module will be called ibmcam. | ||
87 | |||
88 | This camera has several configuration options which | ||
89 | can be specified when you load the module. Read | ||
90 | <file:Documentation/usb/ibmcam.txt> to learn more. | ||
91 | |||
92 | config USB_KONICAWC | ||
93 | tristate "USB Konica Webcam support" | ||
94 | depends on USB && VIDEO_DEV | ||
95 | ---help--- | ||
96 | Say Y here if you want support for webcams based on a Konica | ||
97 | chipset. This is known to work with the Intel YC76 webcam. | ||
98 | |||
99 | This driver uses the Video For Linux API. You must enable | ||
100 | (Y or M in config) Video For Linux (under Character Devices) | ||
101 | to use this driver. Information on this API and pointers to | ||
102 | "v4l" programs may be found at | ||
103 | <file:Documentation/video4linux/API.html>. | ||
104 | |||
105 | To compile this driver as a module, choose M here: the | ||
106 | module will be called konicawc. | ||
107 | |||
108 | config USB_OV511 | ||
109 | tristate "USB OV511 Camera support" | ||
110 | depends on USB && VIDEO_DEV | ||
111 | ---help--- | ||
112 | Say Y here if you want to connect this type of camera to your | ||
113 | computer's USB port. See <file:Documentation/usb/ov511.txt> for more | ||
114 | information and for a list of supported cameras. | ||
115 | |||
116 | This driver uses the Video For Linux API. You must say Y or M to | ||
117 | "Video For Linux" (under Character Devices) to use this driver. | ||
118 | Information on this API and pointers to "v4l" programs may be found | ||
119 | at <file:Documentation/video4linux/API.html>. | ||
120 | |||
121 | To compile this driver as a module, choose M here: the | ||
122 | module will be called ov511. | ||
123 | |||
124 | config USB_SE401 | ||
125 | tristate "USB SE401 Camera support" | ||
126 | depends on USB && VIDEO_DEV | ||
127 | ---help--- | ||
128 | Say Y here if you want to connect this type of camera to your | ||
129 | computer's USB port. See <file:Documentation/usb/se401.txt> for more | ||
130 | information and for a list of supported cameras. | ||
131 | |||
132 | This driver uses the Video For Linux API. You must say Y or M to | ||
133 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
134 | Information on this API and pointers to "v4l" programs may be found | ||
135 | at <file:Documentation/video4linux/API.html>. | ||
136 | |||
137 | To compile this driver as a module, choose M here: the | ||
138 | module will be called se401. | ||
139 | |||
140 | config USB_SN9C102 | ||
141 | tristate "USB SN9C10x PC Camera Controller support" | ||
142 | depends on USB && VIDEO_DEV | ||
143 | ---help--- | ||
144 | Say Y here if you want support for cameras based on SONiX SN9C101, | ||
145 | SN9C102 or SN9C103 PC Camera Controllers. | ||
146 | |||
147 | See <file:Documentation/usb/sn9c102.txt> for more informations. | ||
148 | |||
149 | This driver uses the Video For Linux API. You must say Y or M to | ||
150 | "Video For Linux" to use this driver. | ||
151 | |||
152 | To compile this driver as a module, choose M here: the | ||
153 | module will be called sn9c102. | ||
154 | |||
155 | config USB_STV680 | ||
156 | tristate "USB STV680 (Pencam) Camera support" | ||
157 | depends on USB && VIDEO_DEV | ||
158 | ---help--- | ||
159 | Say Y here if you want to connect this type of camera to your | ||
160 | computer's USB port. This includes the Pencam line of cameras. | ||
161 | See <file:Documentation/usb/stv680.txt> for more information and for | ||
162 | a list of supported cameras. | ||
163 | |||
164 | This driver uses the Video For Linux API. You must say Y or M to | ||
165 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
166 | Information on this API and pointers to "v4l" programs may be found | ||
167 | at <file:Documentation/video4linux/API.html>. | ||
168 | |||
169 | To compile this driver as a module, choose M here: the | ||
170 | module will be called stv680. | ||
171 | |||
172 | config USB_W9968CF | ||
173 | tristate "USB W996[87]CF JPEG Dual Mode Camera support" | ||
174 | depends on USB && VIDEO_DEV && I2C && VIDEO_OVCAMCHIP | ||
175 | ---help--- | ||
176 | Say Y here if you want support for cameras based on OV681 or | ||
177 | Winbond W9967CF/W9968CF JPEG USB Dual Mode Camera Chips. | ||
178 | |||
179 | This driver has an optional plugin, which is distributed as a | ||
180 | separate module only (released under GPL). It allows to use higher | ||
181 | resolutions and framerates, but cannot be included in the official | ||
182 | Linux kernel for performance purposes. | ||
183 | |||
184 | See <file:Documentation/usb/w9968cf.txt> for more informations. | ||
185 | |||
186 | This driver uses the Video For Linux and the I2C APIs. It needs the | ||
187 | OmniVision Camera Chip support as well. You must say Y or M to | ||
188 | "Video For Linux", "I2C Support" and "OmniVision Camera Chip | ||
189 | support" to use this driver. | ||
190 | |||
191 | To compile this driver as a module, choose M here: the | ||
192 | module will be called w9968cf. | ||
193 | |||
194 | config USB_ZC0301 | ||
195 | tristate "USB ZC0301 Image Processor and Control Chip support" | ||
196 | depends on USB && VIDEO_DEV | ||
197 | ---help--- | ||
198 | Say Y here if you want support for cameras based on the ZC0301 | ||
199 | Image Processor and Control Chip. | ||
200 | |||
201 | See <file:Documentation/usb/zc0301.txt> for more informations. | ||
202 | |||
203 | This driver uses the Video For Linux API. You must say Y or M to | ||
204 | "Video For Linux" to use this driver. | ||
205 | |||
206 | To compile this driver as a module, choose M here: the | ||
207 | module will be called zc0301. | ||
208 | |||
209 | config USB_PWC | ||
210 | tristate "USB Philips Cameras" | ||
211 | depends on USB && VIDEO_DEV | ||
212 | ---help--- | ||
213 | Say Y or M here if you want to use one of these Philips & OEM | ||
214 | webcams: | ||
215 | * Philips PCA645, PCA646 | ||
216 | * Philips PCVC675, PCVC680, PCVC690 | ||
217 | * Philips PCVC720/40, PCVC730, PCVC740, PCVC750 | ||
218 | * Askey VC010 | ||
219 | * Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro' | ||
220 | and 'Orbit'/'Sphere' | ||
221 | * Samsung MPC-C10, MPC-C30 | ||
222 | * Creative Webcam 5, Pro Ex | ||
223 | * SOTEC Afina Eye | ||
224 | * Visionite VCS-UC300, VCS-UM100 | ||
225 | |||
226 | The PCA635, PCVC665 and PCVC720/20 are not supported by this driver | ||
227 | and never will be, but the 665 and 720/20 are supported by other | ||
228 | drivers. | ||
229 | |||
230 | See <file:Documentation/usb/philips.txt> for more information and | ||
231 | installation instructions. | ||
232 | |||
233 | The built-in microphone is enabled by selecting USB Audio support. | ||
234 | |||
235 | This driver uses the Video For Linux API. You must say Y or M to | ||
236 | "Video For Linux" (under Character Devices) to use this driver. | ||
237 | Information on this API and pointers to "v4l" programs may be found | ||
238 | at <file:Documentation/video4linux/API.html>. | ||
239 | |||
240 | To compile this driver as a module, choose M here: the | ||
241 | module will be called pwc. | ||
diff --git a/drivers/usb/media/Makefile b/drivers/usb/media/Makefile deleted file mode 100644 index 50e89a33b85e..000000000000 --- a/drivers/usb/media/Makefile +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for USB Media drivers | ||
3 | # | ||
4 | |||
5 | sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o \ | ||
6 | sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bca.o \ | ||
7 | sn9c102_pas202bcb.o sn9c102_tas5110c1b.o \ | ||
8 | sn9c102_tas5130d1b.o | ||
9 | et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o | ||
10 | zc0301-objs := zc0301_core.o zc0301_pas202bcb.o | ||
11 | |||
12 | obj-$(CONFIG_USB_DABUSB) += dabusb.o | ||
13 | obj-$(CONFIG_USB_DSBR) += dsbr100.o | ||
14 | obj-$(CONFIG_USB_ET61X251) += et61x251.o | ||
15 | obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o | ||
16 | obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o | ||
17 | obj-$(CONFIG_USB_OV511) += ov511.o | ||
18 | obj-$(CONFIG_USB_SE401) += se401.o | ||
19 | obj-$(CONFIG_USB_SN9C102) += sn9c102.o | ||
20 | obj-$(CONFIG_USB_STV680) += stv680.o | ||
21 | obj-$(CONFIG_USB_VICAM) += vicam.o usbvideo.o | ||
22 | obj-$(CONFIG_USB_W9968CF) += w9968cf.o | ||
23 | obj-$(CONFIG_USB_ZC0301) += zc0301.o | ||
24 | obj-$(CONFIG_USB_PWC) += pwc/ | ||
diff --git a/drivers/usb/media/pwc/pwc-kiara.c b/drivers/usb/media/pwc/pwc-kiara.c deleted file mode 100644 index c498c68bace1..000000000000 --- a/drivers/usb/media/pwc/pwc-kiara.c +++ /dev/null | |||
@@ -1,318 +0,0 @@ | |||
1 | /* Linux driver for Philips webcam | ||
2 | (C) 2004 Luc Saillard (luc@saillard.org) | ||
3 | |||
4 | NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx | ||
5 | driver and thus may have bugs that are not present in the original version. | ||
6 | Please send bug reports and support requests to <luc@saillard.org>. | ||
7 | The decompression routines have been implemented by reverse-engineering the | ||
8 | Nemosoft binary pwcx module. Caveat emptor. | ||
9 | |||
10 | This program is free software; you can redistribute it and/or modify | ||
11 | it under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation; either version 2 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License | ||
21 | along with this program; if not, write to the Free Software | ||
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | |||
26 | /* This tables contains entries for the 730/740/750 (Kiara) camera, with | ||
27 | 4 different qualities (no compression, low, medium, high). | ||
28 | It lists the bandwidth requirements for said mode by its alternate interface | ||
29 | number. An alternate of 0 means that the mode is unavailable. | ||
30 | |||
31 | There are 6 * 4 * 4 entries: | ||
32 | 6 different resolutions subqcif, qsif, qcif, sif, cif, vga | ||
33 | 6 framerates: 5, 10, 15, 20, 25, 30 | ||
34 | 4 compression modi: none, low, medium, high | ||
35 | |||
36 | When an uncompressed mode is not available, the next available compressed mode | ||
37 | will be chosen (unless the decompressor is absent). Sometimes there are only | ||
38 | 1 or 2 compressed modes available; in that case entries are duplicated. | ||
39 | */ | ||
40 | |||
41 | |||
42 | #include "pwc-kiara.h" | ||
43 | #include "pwc-uncompress.h" | ||
44 | |||
45 | const struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] = | ||
46 | { | ||
47 | /* SQCIF */ | ||
48 | { | ||
49 | /* 5 fps */ | ||
50 | { | ||
51 | {0, }, | ||
52 | {0, }, | ||
53 | {0, }, | ||
54 | {0, }, | ||
55 | }, | ||
56 | /* 10 fps */ | ||
57 | { | ||
58 | {0, }, | ||
59 | {0, }, | ||
60 | {0, }, | ||
61 | {0, }, | ||
62 | }, | ||
63 | /* 15 fps */ | ||
64 | { | ||
65 | {0, }, | ||
66 | {0, }, | ||
67 | {0, }, | ||
68 | {0, }, | ||
69 | }, | ||
70 | /* 20 fps */ | ||
71 | { | ||
72 | {0, }, | ||
73 | {0, }, | ||
74 | {0, }, | ||
75 | {0, }, | ||
76 | }, | ||
77 | /* 25 fps */ | ||
78 | { | ||
79 | {0, }, | ||
80 | {0, }, | ||
81 | {0, }, | ||
82 | {0, }, | ||
83 | }, | ||
84 | /* 30 fps */ | ||
85 | { | ||
86 | {0, }, | ||
87 | {0, }, | ||
88 | {0, }, | ||
89 | {0, }, | ||
90 | }, | ||
91 | }, | ||
92 | /* QSIF */ | ||
93 | { | ||
94 | /* 5 fps */ | ||
95 | { | ||
96 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
97 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
98 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
99 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
100 | }, | ||
101 | /* 10 fps */ | ||
102 | { | ||
103 | {2, 291, 0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}}, | ||
104 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
105 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
106 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
107 | }, | ||
108 | /* 15 fps */ | ||
109 | { | ||
110 | {3, 437, 0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}}, | ||
111 | {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, | ||
112 | {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, | ||
113 | {1, 192, 420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, | ||
114 | }, | ||
115 | /* 20 fps */ | ||
116 | { | ||
117 | {4, 589, 0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}}, | ||
118 | {3, 448, 730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}}, | ||
119 | {2, 292, 476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}}, | ||
120 | {1, 192, 312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, | ||
121 | }, | ||
122 | /* 25 fps */ | ||
123 | { | ||
124 | {5, 703, 0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}}, | ||
125 | {3, 447, 610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}}, | ||
126 | {2, 292, 398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}}, | ||
127 | {1, 193, 262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}}, | ||
128 | }, | ||
129 | /* 30 fps */ | ||
130 | { | ||
131 | {8, 874, 0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}}, | ||
132 | {5, 704, 730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}}, | ||
133 | {3, 448, 492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}}, | ||
134 | {2, 292, 320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}}, | ||
135 | }, | ||
136 | }, | ||
137 | /* QCIF */ | ||
138 | { | ||
139 | /* 5 fps */ | ||
140 | { | ||
141 | {0, }, | ||
142 | {0, }, | ||
143 | {0, }, | ||
144 | {0, }, | ||
145 | }, | ||
146 | /* 10 fps */ | ||
147 | { | ||
148 | {0, }, | ||
149 | {0, }, | ||
150 | {0, }, | ||
151 | {0, }, | ||
152 | }, | ||
153 | /* 15 fps */ | ||
154 | { | ||
155 | {0, }, | ||
156 | {0, }, | ||
157 | {0, }, | ||
158 | {0, }, | ||
159 | }, | ||
160 | /* 20 fps */ | ||
161 | { | ||
162 | {0, }, | ||
163 | {0, }, | ||
164 | {0, }, | ||
165 | {0, }, | ||
166 | }, | ||
167 | /* 25 fps */ | ||
168 | { | ||
169 | {0, }, | ||
170 | {0, }, | ||
171 | {0, }, | ||
172 | {0, }, | ||
173 | }, | ||
174 | /* 30 fps */ | ||
175 | { | ||
176 | {0, }, | ||
177 | {0, }, | ||
178 | {0, }, | ||
179 | {0, }, | ||
180 | }, | ||
181 | }, | ||
182 | /* SIF */ | ||
183 | { | ||
184 | /* 5 fps */ | ||
185 | { | ||
186 | {4, 582, 0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}}, | ||
187 | {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}}, | ||
188 | {2, 291, 960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}}, | ||
189 | {1, 191, 630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}}, | ||
190 | }, | ||
191 | /* 10 fps */ | ||
192 | { | ||
193 | {0, }, | ||
194 | {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}}, | ||
195 | {3, 447, 736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}}, | ||
196 | {2, 292, 480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}}, | ||
197 | }, | ||
198 | /* 15 fps */ | ||
199 | { | ||
200 | {0, }, | ||
201 | {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}}, | ||
202 | {4, 592, 650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}}, | ||
203 | {3, 448, 492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}}, | ||
204 | }, | ||
205 | /* 20 fps */ | ||
206 | { | ||
207 | {0, }, | ||
208 | {9, 958, 782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}}, | ||
209 | {5, 703, 574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}}, | ||
210 | {3, 446, 364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}}, | ||
211 | }, | ||
212 | /* 25 fps */ | ||
213 | { | ||
214 | {0, }, | ||
215 | {9, 958, 654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}}, | ||
216 | {6, 776, 530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}}, | ||
217 | {4, 592, 404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}}, | ||
218 | }, | ||
219 | /* 30 fps */ | ||
220 | { | ||
221 | {0, }, | ||
222 | {9, 957, 526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}}, | ||
223 | {6, 775, 426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}}, | ||
224 | {4, 590, 324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}}, | ||
225 | }, | ||
226 | }, | ||
227 | /* CIF */ | ||
228 | { | ||
229 | /* 5 fps */ | ||
230 | { | ||
231 | {0, }, | ||
232 | {0, }, | ||
233 | {0, }, | ||
234 | {0, }, | ||
235 | }, | ||
236 | /* 10 fps */ | ||
237 | { | ||
238 | {0, }, | ||
239 | {0, }, | ||
240 | {0, }, | ||
241 | {0, }, | ||
242 | }, | ||
243 | /* 15 fps */ | ||
244 | { | ||
245 | {0, }, | ||
246 | {0, }, | ||
247 | {0, }, | ||
248 | {0, }, | ||
249 | }, | ||
250 | /* 20 fps */ | ||
251 | { | ||
252 | {0, }, | ||
253 | {0, }, | ||
254 | {0, }, | ||
255 | {0, }, | ||
256 | }, | ||
257 | /* 25 fps */ | ||
258 | { | ||
259 | {0, }, | ||
260 | {0, }, | ||
261 | {0, }, | ||
262 | {0, }, | ||
263 | }, | ||
264 | /* 30 fps */ | ||
265 | { | ||
266 | {0, }, | ||
267 | {0, }, | ||
268 | {0, }, | ||
269 | {0, }, | ||
270 | }, | ||
271 | }, | ||
272 | /* VGA */ | ||
273 | { | ||
274 | /* 5 fps */ | ||
275 | { | ||
276 | {0, }, | ||
277 | {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}}, | ||
278 | {4, 592, 976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}}, | ||
279 | {3, 448, 738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}}, | ||
280 | }, | ||
281 | /* 10 fps */ | ||
282 | { | ||
283 | {0, }, | ||
284 | {9, 956, 788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}}, | ||
285 | {6, 776, 640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}}, | ||
286 | {4, 592, 488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}}, | ||
287 | }, | ||
288 | /* 15 fps */ | ||
289 | { | ||
290 | {0, }, | ||
291 | {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, | ||
292 | {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, | ||
293 | {8, 895, 492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}}, | ||
294 | }, | ||
295 | /* 20 fps */ | ||
296 | { | ||
297 | {0, }, | ||
298 | {0, }, | ||
299 | {0, }, | ||
300 | {0, }, | ||
301 | }, | ||
302 | /* 25 fps */ | ||
303 | { | ||
304 | {0, }, | ||
305 | {0, }, | ||
306 | {0, }, | ||
307 | {0, }, | ||
308 | }, | ||
309 | /* 30 fps */ | ||
310 | { | ||
311 | {0, }, | ||
312 | {0, }, | ||
313 | {0, }, | ||
314 | {0, }, | ||
315 | }, | ||
316 | }, | ||
317 | }; | ||
318 | |||
diff --git a/drivers/usb/media/pwc/pwc-timon.c b/drivers/usb/media/pwc/pwc-timon.c deleted file mode 100644 index dee967173d6c..000000000000 --- a/drivers/usb/media/pwc/pwc-timon.c +++ /dev/null | |||
@@ -1,316 +0,0 @@ | |||
1 | /* Linux driver for Philips webcam | ||
2 | (C) 2004 Luc Saillard (luc@saillard.org) | ||
3 | |||
4 | NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx | ||
5 | driver and thus may have bugs that are not present in the original version. | ||
6 | Please send bug reports and support requests to <luc@saillard.org>. | ||
7 | The decompression routines have been implemented by reverse-engineering the | ||
8 | Nemosoft binary pwcx module. Caveat emptor. | ||
9 | |||
10 | This program is free software; you can redistribute it and/or modify | ||
11 | it under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation; either version 2 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License | ||
21 | along with this program; if not, write to the Free Software | ||
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | |||
26 | /* This tables contains entries for the 675/680/690 (Timon) camera, with | ||
27 | 4 different qualities (no compression, low, medium, high). | ||
28 | It lists the bandwidth requirements for said mode by its alternate interface | ||
29 | number. An alternate of 0 means that the mode is unavailable. | ||
30 | |||
31 | There are 6 * 4 * 4 entries: | ||
32 | 6 different resolutions subqcif, qsif, qcif, sif, cif, vga | ||
33 | 6 framerates: 5, 10, 15, 20, 25, 30 | ||
34 | 4 compression modi: none, low, medium, high | ||
35 | |||
36 | When an uncompressed mode is not available, the next available compressed mode | ||
37 | will be chosen (unless the decompressor is absent). Sometimes there are only | ||
38 | 1 or 2 compressed modes available; in that case entries are duplicated. | ||
39 | */ | ||
40 | |||
41 | #include "pwc-timon.h" | ||
42 | |||
43 | const struct Timon_table_entry Timon_table[PSZ_MAX][6][4] = | ||
44 | { | ||
45 | /* SQCIF */ | ||
46 | { | ||
47 | /* 5 fps */ | ||
48 | { | ||
49 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
50 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
51 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
52 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
53 | }, | ||
54 | /* 10 fps */ | ||
55 | { | ||
56 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
57 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
58 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
59 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
60 | }, | ||
61 | /* 15 fps */ | ||
62 | { | ||
63 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
64 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
65 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
66 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
67 | }, | ||
68 | /* 20 fps */ | ||
69 | { | ||
70 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
71 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
72 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
73 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
74 | }, | ||
75 | /* 25 fps */ | ||
76 | { | ||
77 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
78 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
79 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
80 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
81 | }, | ||
82 | /* 30 fps */ | ||
83 | { | ||
84 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
85 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
86 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
87 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
88 | }, | ||
89 | }, | ||
90 | /* QSIF */ | ||
91 | { | ||
92 | /* 5 fps */ | ||
93 | { | ||
94 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
95 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
96 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
97 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
98 | }, | ||
99 | /* 10 fps */ | ||
100 | { | ||
101 | {2, 291, 0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}}, | ||
102 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
103 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
104 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
105 | }, | ||
106 | /* 15 fps */ | ||
107 | { | ||
108 | {3, 437, 0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}}, | ||
109 | {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
110 | {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
111 | {1, 191, 420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
112 | }, | ||
113 | /* 20 fps */ | ||
114 | { | ||
115 | {4, 588, 0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}}, | ||
116 | {3, 447, 730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
117 | {2, 292, 476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
118 | {1, 192, 312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, | ||
119 | }, | ||
120 | /* 25 fps */ | ||
121 | { | ||
122 | {5, 703, 0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}}, | ||
123 | {3, 447, 610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
124 | {2, 292, 398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
125 | {1, 192, 262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, | ||
126 | }, | ||
127 | /* 30 fps */ | ||
128 | { | ||
129 | {8, 873, 0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}}, | ||
130 | {5, 704, 774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}}, | ||
131 | {3, 448, 492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}}, | ||
132 | {2, 291, 320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, | ||
133 | }, | ||
134 | }, | ||
135 | /* QCIF */ | ||
136 | { | ||
137 | /* 5 fps */ | ||
138 | { | ||
139 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
140 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
141 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
142 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
143 | }, | ||
144 | /* 10 fps */ | ||
145 | { | ||
146 | {3, 385, 0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}}, | ||
147 | {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
148 | {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
149 | {1, 194, 532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}}, | ||
150 | }, | ||
151 | /* 15 fps */ | ||
152 | { | ||
153 | {4, 577, 0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}}, | ||
154 | {3, 447, 818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}}, | ||
155 | {2, 292, 534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}}, | ||
156 | {1, 195, 356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}}, | ||
157 | }, | ||
158 | /* 20 fps */ | ||
159 | { | ||
160 | {6, 776, 0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}}, | ||
161 | {4, 591, 804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}}, | ||
162 | {3, 447, 608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
163 | {2, 291, 396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, | ||
164 | }, | ||
165 | /* 25 fps */ | ||
166 | { | ||
167 | {9, 928, 0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}}, | ||
168 | {5, 703, 800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}}, | ||
169 | {3, 447, 508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
170 | {2, 292, 332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
171 | }, | ||
172 | /* 30 fps */ | ||
173 | { | ||
174 | {0, }, | ||
175 | {9, 956, 876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}}, | ||
176 | {4, 592, 542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}}, | ||
177 | {2, 291, 266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}}, | ||
178 | }, | ||
179 | }, | ||
180 | /* SIF */ | ||
181 | { | ||
182 | /* 5 fps */ | ||
183 | { | ||
184 | {4, 582, 0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}}, | ||
185 | {3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}}, | ||
186 | {2, 291, 960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}}, | ||
187 | {1, 191, 630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}}, | ||
188 | }, | ||
189 | /* 10 fps */ | ||
190 | { | ||
191 | {0, }, | ||
192 | {6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}}, | ||
193 | {3, 447, 736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}}, | ||
194 | {2, 291, 480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}}, | ||
195 | }, | ||
196 | /* 15 fps */ | ||
197 | { | ||
198 | {0, }, | ||
199 | {9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}}, | ||
200 | {4, 591, 650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}}, | ||
201 | {3, 448, 492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}}, | ||
202 | }, | ||
203 | /* 20 fps */ | ||
204 | { | ||
205 | {0, }, | ||
206 | {9, 958, 782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}}, | ||
207 | {5, 703, 574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}}, | ||
208 | {3, 446, 364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}}, | ||
209 | }, | ||
210 | /* 25 fps */ | ||
211 | { | ||
212 | {0, }, | ||
213 | {9, 958, 654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}}, | ||
214 | {6, 776, 530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}}, | ||
215 | {4, 592, 404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}}, | ||
216 | }, | ||
217 | /* 30 fps */ | ||
218 | { | ||
219 | {0, }, | ||
220 | {9, 957, 526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}}, | ||
221 | {6, 775, 426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}}, | ||
222 | {4, 590, 324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}}, | ||
223 | }, | ||
224 | }, | ||
225 | /* CIF */ | ||
226 | { | ||
227 | /* 5 fps */ | ||
228 | { | ||
229 | {6, 771, 0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}}, | ||
230 | {4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}}, | ||
231 | {2, 291, 800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}}, | ||
232 | {1, 193, 528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}}, | ||
233 | }, | ||
234 | /* 10 fps */ | ||
235 | { | ||
236 | {0, }, | ||
237 | {9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}}, | ||
238 | {4, 591, 812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}}, | ||
239 | {2, 291, 400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}}, | ||
240 | }, | ||
241 | /* 15 fps */ | ||
242 | { | ||
243 | {0, }, | ||
244 | {9, 956, 876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}}, | ||
245 | {5, 703, 644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}}, | ||
246 | {3, 448, 410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}}, | ||
247 | }, | ||
248 | /* 20 fps */ | ||
249 | { | ||
250 | {0, }, | ||
251 | {9, 956, 650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}}, | ||
252 | {6, 776, 528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}}, | ||
253 | {4, 591, 402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}}, | ||
254 | }, | ||
255 | /* 25 fps */ | ||
256 | { | ||
257 | {0, }, | ||
258 | {9, 956, 544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}}, | ||
259 | {7, 840, 478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}}, | ||
260 | {5, 703, 400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}}, | ||
261 | }, | ||
262 | /* 30 fps */ | ||
263 | { | ||
264 | {0, }, | ||
265 | {9, 956, 438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}}, | ||
266 | {7, 838, 384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}}, | ||
267 | {6, 773, 354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}}, | ||
268 | }, | ||
269 | }, | ||
270 | /* VGA */ | ||
271 | { | ||
272 | /* 5 fps */ | ||
273 | { | ||
274 | {0, }, | ||
275 | {6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}}, | ||
276 | {4, 592, 976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}}, | ||
277 | {3, 448, 738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}}, | ||
278 | }, | ||
279 | /* 10 fps */ | ||
280 | { | ||
281 | {0, }, | ||
282 | {9, 956, 788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}}, | ||
283 | {6, 776, 640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}}, | ||
284 | {4, 592, 488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}}, | ||
285 | }, | ||
286 | /* 15 fps */ | ||
287 | { | ||
288 | {0, }, | ||
289 | {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, | ||
290 | {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, | ||
291 | {8, 895, 492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}}, | ||
292 | }, | ||
293 | /* 20 fps */ | ||
294 | { | ||
295 | {0, }, | ||
296 | {0, }, | ||
297 | {0, }, | ||
298 | {0, }, | ||
299 | }, | ||
300 | /* 25 fps */ | ||
301 | { | ||
302 | {0, }, | ||
303 | {0, }, | ||
304 | {0, }, | ||
305 | {0, }, | ||
306 | }, | ||
307 | /* 30 fps */ | ||
308 | { | ||
309 | {0, }, | ||
310 | {0, }, | ||
311 | {0, }, | ||
312 | {0, }, | ||
313 | }, | ||
314 | }, | ||
315 | }; | ||
316 | |||
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index ec311bc89439..679b46a6a565 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -184,6 +184,7 @@ | |||
184 | #define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ | 184 | #define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ |
185 | #define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ | 185 | #define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ |
186 | #define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ | 186 | #define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ |
187 | #define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ | ||
187 | 188 | ||
188 | /* --- PCF 8584 based algorithms */ | 189 | /* --- PCF 8584 based algorithms */ |
189 | #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ | 190 | #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 724cfbf54b8a..2275bfec5b68 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -883,6 +883,7 @@ struct v4l2_modulator | |||
883 | #define V4L2_TUNER_MODE_LANG2 0x0002 | 883 | #define V4L2_TUNER_MODE_LANG2 0x0002 |
884 | #define V4L2_TUNER_MODE_SAP 0x0002 | 884 | #define V4L2_TUNER_MODE_SAP 0x0002 |
885 | #define V4L2_TUNER_MODE_LANG1 0x0003 | 885 | #define V4L2_TUNER_MODE_LANG1 0x0003 |
886 | #define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 | ||
886 | 887 | ||
887 | struct v4l2_frequency | 888 | struct v4l2_frequency |
888 | { | 889 | { |
diff --git a/include/media/audiochip.h b/include/media/audiochip.h index 295d256ee811..1fd4a2207574 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h | |||
@@ -21,18 +21,4 @@ enum audiochip { | |||
21 | AUDIO_CHIP_MSP34XX | 21 | AUDIO_CHIP_MSP34XX |
22 | }; | 22 | }; |
23 | 23 | ||
24 | /* ---------------------------------------------------------------------- */ | ||
25 | |||
26 | /* audio inputs */ | ||
27 | #define AUDIO_TUNER 0x00 | ||
28 | #define AUDIO_RADIO 0x01 | ||
29 | #define AUDIO_EXTERN 0x02 | ||
30 | #define AUDIO_INTERN 0x03 | ||
31 | #define AUDIO_OFF 0x04 | ||
32 | #define AUDIO_ON 0x05 | ||
33 | #define AUDIO_EXTERN_1 AUDIO_EXTERN | ||
34 | #define AUDIO_EXTERN_2 0x06 | ||
35 | #define AUDIO_MUTE 0x80 | ||
36 | #define AUDIO_UNMUTE 0x81 | ||
37 | |||
38 | #endif /* AUDIOCHIP_H */ | 24 | #endif /* AUDIOCHIP_H */ |
diff --git a/include/media/cs53l32a.h b/include/media/cs53l32a.h new file mode 100644 index 000000000000..bf76197d3790 --- /dev/null +++ b/include/media/cs53l32a.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | cs53l32a.h - definition for cs53l32a inputs and outputs | ||
3 | |||
4 | Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _CS53L32A_H_ | ||
22 | #define _CS53L32A_H_ | ||
23 | |||
24 | /* There are 2 physical inputs, but the second input can be | ||
25 | placed in two modes, the first mode bypasses the PGA (gain), | ||
26 | the second goes through the PGA. Hence there are three | ||
27 | possible inputs to choose from. */ | ||
28 | |||
29 | /* CS53L32A HW inputs */ | ||
30 | #define CS53L32A_IN0 0 | ||
31 | #define CS53L32A_IN1 1 | ||
32 | #define CS53L32A_IN2 2 | ||
33 | |||
34 | #endif | ||
diff --git a/include/media/i2c-addr.h b/include/media/i2c-addr.h new file mode 100644 index 000000000000..e7ff44a35ca0 --- /dev/null +++ b/include/media/i2c-addr.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * V4L I2C address list | ||
3 | * | ||
4 | * | ||
5 | * Copyright (C) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> | ||
6 | * Based on a previous mapping by | ||
7 | * Ralph Metzler (rjkm@thp.uni-koeln.de) | ||
8 | * Gerd Knorr <kraxel@goldbach.in-berlin.de> | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | /* bttv address list */ | ||
13 | #define I2C_ADDR_TSA5522 0xc2 | ||
14 | #define I2C_ADDR_TDA7432 0x8a | ||
15 | #define I2C_ADDR_BT832_ALT1 0x88 | ||
16 | #define I2C_ADDR_BT832_ALT2 0x8a // alternate setting | ||
17 | #define I2C_ADDR_TDA8425 0x82 | ||
18 | #define I2C_ADDR_TDA9840 0x84 | ||
19 | #define I2C_ADDR_TDA9850 0xb6 /* also used by 9855,9873 */ | ||
20 | #define I2C_ADDR_TDA9874 0xb0 /* also used by 9875 */ | ||
21 | #define I2C_ADDR_TDA9875 0xb0 | ||
22 | #define I2C_ADDR_HAUPEE 0xa0 | ||
23 | #define I2C_ADDR_STBEE 0xae | ||
24 | #define I2C_ADDR_VHX 0xc0 | ||
25 | #define I2C_ADDR_MSP3400 0x80 | ||
26 | #define I2C_ADDR_MSP3400_ALT 0x88 | ||
27 | #define I2C_ADDR_TEA6300 0x80 /* also used by 6320 */ | ||
28 | #define I2C_ADDR_DPL3518 0x84 | ||
29 | #define I2C_ADDR_TDA9887 0x86 | ||
30 | |||
31 | /* | ||
32 | * i2c bus addresses for the chips supported by tvaudio.c | ||
33 | */ | ||
34 | |||
35 | #define I2C_ADDR_TDA8425 0x82 | ||
36 | #define I2C_ADDR_TDA9840 0x84 /* also used by TA8874Z */ | ||
37 | #define I2C_ADDR_TDA985x_L 0xb4 /* also used by 9873 */ | ||
38 | #define I2C_ADDR_TDA985x_H 0xb6 | ||
39 | #define I2C_ADDR_TDA9874 0xb0 /* also used by 9875 */ | ||
40 | |||
41 | #define I2C_ADDR_TEA6300 0x80 /* also used by 6320 */ | ||
42 | #define I2C_ADDR_TEA6420 0x98 | ||
43 | |||
44 | #define I2C_ADDR_PIC16C54 0x96 /* PV951 */ | ||
diff --git a/include/media/msp3400.h b/include/media/msp3400.h new file mode 100644 index 000000000000..0be61a021d45 --- /dev/null +++ b/include/media/msp3400.h | |||
@@ -0,0 +1,226 @@ | |||
1 | /* | ||
2 | msp3400.h - definition for msp3400 inputs and outputs | ||
3 | |||
4 | Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _MSP3400_H_ | ||
22 | #define _MSP3400_H_ | ||
23 | |||
24 | /* msp3400 routing | ||
25 | =============== | ||
26 | |||
27 | The msp3400 has a complicated routing scheme with many possible | ||
28 | combinations. The details are all in the datasheets but I will try | ||
29 | to give a short description here. | ||
30 | |||
31 | Inputs | ||
32 | ====== | ||
33 | |||
34 | There are 1) tuner inputs, 2) I2S inputs, 3) SCART inputs. You will have | ||
35 | to select which tuner input to use and which SCART input to use. The | ||
36 | selected tuner input, the selected SCART input and all I2S inputs go to | ||
37 | the DSP (the tuner input first goes through the demodulator). | ||
38 | |||
39 | The DSP handles things like volume, bass/treble, balance, and some chips | ||
40 | have support for surround sound. It has several outputs: MAIN, AUX, I2S | ||
41 | and SCART1/2. Each output can select which DSP input to use. So the MAIN | ||
42 | output can select the tuner input while at the same time the SCART1 output | ||
43 | uses the I2S input. | ||
44 | |||
45 | Outputs | ||
46 | ======= | ||
47 | |||
48 | Most DSP outputs are also the outputs of the msp3400. However, the SCART | ||
49 | outputs of the msp3400 can select which input to use: either the SCART1 or | ||
50 | SCART2 output from the DSP, or the msp3400 SCART inputs, thus completely | ||
51 | bypassing the DSP. | ||
52 | |||
53 | Summary | ||
54 | ======= | ||
55 | |||
56 | So to specify a complete routing scheme for the msp3400 you will have to | ||
57 | specify in the 'input' field of the v4l2_routing struct: | ||
58 | |||
59 | 1) which tuner input to use | ||
60 | 2) which SCART input to use | ||
61 | 3) which DSP input to use for each DSP output | ||
62 | |||
63 | And in the 'output' field of the v4l2_routing struct you specify: | ||
64 | |||
65 | 1) which SCART input to use for each SCART output | ||
66 | |||
67 | Depending on how the msp is wired to the other components you can | ||
68 | ignore or mute certain inputs or outputs. | ||
69 | |||
70 | Also, depending on the msp version only a subset of the inputs or | ||
71 | outputs may be present. At the end of this header some tables are | ||
72 | added containing a list of what is available for each msp version. | ||
73 | */ | ||
74 | |||
75 | /* Inputs to the DSP unit: two independent selections have to be made: | ||
76 | 1) the tuner (SIF) input | ||
77 | 2) the SCART input | ||
78 | Bits 0-2 are used for the SCART input select, bit 3 is used for the tuner | ||
79 | input, bits 4-7 are reserved. | ||
80 | */ | ||
81 | |||
82 | /* SCART input to DSP selection */ | ||
83 | #define MSP_IN_SCART_1 0 /* Pin SC1_IN */ | ||
84 | #define MSP_IN_SCART_2 1 /* Pin SC2_IN */ | ||
85 | #define MSP_IN_SCART_3 2 /* Pin SC3_IN */ | ||
86 | #define MSP_IN_SCART_4 3 /* Pin SC4_IN */ | ||
87 | #define MSP_IN_MONO 6 /* Pin MONO_IN */ | ||
88 | #define MSP_IN_MUTE 7 /* Mute DSP input */ | ||
89 | #define MSP_SCART_TO_DSP(in) (in) | ||
90 | /* Tuner input to demodulator and DSP selection */ | ||
91 | #define MSP_IN_TUNER_1 0 /* Analog Sound IF input pin ANA_IN1 */ | ||
92 | #define MSP_IN_TUNER_2 1 /* Analog Sound IF input pin ANA_IN2 */ | ||
93 | #define MSP_TUNER_TO_DSP(in) ((in) << 3) | ||
94 | |||
95 | /* The msp has up to 5 DSP outputs, each output can independently select | ||
96 | a DSP input. | ||
97 | |||
98 | The DSP outputs are: loudspeaker output (aka MAIN), headphones output | ||
99 | (aka AUX), SCART1 DA output, SCART2 DA output and an I2S output. | ||
100 | There also is a quasi-peak detector output, but that is not used by | ||
101 | this driver and is set to the same input as the loudspeaker output. | ||
102 | Not all outputs are supported by all msp models. Setting the input | ||
103 | of an unsupported output will be ignored by the driver. | ||
104 | |||
105 | There are up to 16 DSP inputs to choose from, so each output is | ||
106 | assigned 4 bits. | ||
107 | |||
108 | Note: the 44x8G can mix two inputs and feed the result back to the | ||
109 | DSP. This is currently not implemented. Also not implemented is the | ||
110 | multi-channel capable I2S3 input of the 44x0G. If someone can demonstrate | ||
111 | a need for one of those features then additional support can be added. */ | ||
112 | #define MSP_DSP_OUT_TUNER 0 /* Tuner output */ | ||
113 | #define MSP_DSP_OUT_SCART 2 /* SCART output */ | ||
114 | #define MSP_DSP_OUT_I2S1 5 /* I2S1 output */ | ||
115 | #define MSP_DSP_OUT_I2S2 6 /* I2S2 output */ | ||
116 | #define MSP_DSP_OUT_I2S3 7 /* I2S3 output */ | ||
117 | #define MSP_DSP_OUT_MAIN_AVC 11 /* MAIN AVC processed output */ | ||
118 | #define MSP_DSP_OUT_MAIN 12 /* MAIN output */ | ||
119 | #define MSP_DSP_OUT_AUX 13 /* AUX output */ | ||
120 | #define MSP_DSP_TO_MAIN(in) ((in) << 4) | ||
121 | #define MSP_DSP_TO_AUX(in) ((in) << 8) | ||
122 | #define MSP_DSP_TO_SCART1(in) ((in) << 12) | ||
123 | #define MSP_DSP_TO_SCART2(in) ((in) << 16) | ||
124 | #define MSP_DSP_TO_I2S(in) ((in) << 20) | ||
125 | |||
126 | /* Output SCART select: the SCART outputs can select which input | ||
127 | to use. */ | ||
128 | #define MSP_OUT_SCART1 0 /* SCART1 input, bypassing the DSP */ | ||
129 | #define MSP_OUT_SCART2 1 /* SCART2 input, bypassing the DSP */ | ||
130 | #define MSP_OUT_SCART3 2 /* SCART3 input, bypassing the DSP */ | ||
131 | #define MSP_OUT_SCART4 3 /* SCART4 input, bypassing the DSP */ | ||
132 | #define MSP_OUT_SCART1_DA 4 /* DSP SCART1 output */ | ||
133 | #define MSP_OUT_SCART2_DA 5 /* DSP SCART2 output */ | ||
134 | #define MSP_OUT_MONO 6 /* MONO input, bypassing the DSP */ | ||
135 | #define MSP_OUT_MUTE 7 /* MUTE output */ | ||
136 | #define MSP_OUT_TO_SCART1(in) (in) | ||
137 | #define MSP_OUT_TO_SCART2(in) ((in) << 4) | ||
138 | |||
139 | /* Shortcut macros */ | ||
140 | #define MSP_INPUT(sc, t, main_aux_src, sc_i2s_src) \ | ||
141 | (MSP_SCART_TO_DSP(sc) | \ | ||
142 | MSP_TUNER_TO_DSP(t) | \ | ||
143 | MSP_DSP_TO_MAIN(main_aux_src) | \ | ||
144 | MSP_DSP_TO_AUX(main_aux_src) | \ | ||
145 | MSP_DSP_TO_SCART1(sc_i2s_src) | \ | ||
146 | MSP_DSP_TO_SCART2(sc_i2s_src) | \ | ||
147 | MSP_DSP_TO_I2S(sc_i2s_src)) | ||
148 | #define MSP_INPUT_DEFAULT MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, \ | ||
149 | MSP_DSP_OUT_TUNER, MSP_DSP_OUT_TUNER) | ||
150 | #define MSP_OUTPUT(sc) \ | ||
151 | (MSP_OUT_TO_SCART1(sc) | \ | ||
152 | MSP_OUT_TO_SCART2(sc)) | ||
153 | /* This equals the RESET position of the msp3400 ACB register */ | ||
154 | #define MSP_OUTPUT_DEFAULT (MSP_OUT_TO_SCART1(MSP_OUT_SCART3) | \ | ||
155 | MSP_OUT_TO_SCART2(MSP_OUT_SCART1_DA)) | ||
156 | |||
157 | /* Tuner inputs vs. msp version */ | ||
158 | /* Chip TUNER_1 TUNER_2 | ||
159 | ------------------------- | ||
160 | msp34x0b y y | ||
161 | msp34x0c y y | ||
162 | msp34x0d y y | ||
163 | msp34x5d y n | ||
164 | msp34x7d y n | ||
165 | msp34x0g y y | ||
166 | msp34x1g y y | ||
167 | msp34x2g y y | ||
168 | msp34x5g y n | ||
169 | msp34x7g y n | ||
170 | msp44x0g y y | ||
171 | msp44x8g y y | ||
172 | */ | ||
173 | |||
174 | /* SCART inputs vs. msp version */ | ||
175 | /* Chip SC1 SC2 SC3 SC4 | ||
176 | ------------------------- | ||
177 | msp34x0b y y y n | ||
178 | msp34x0c y y y n | ||
179 | msp34x0d y y y y | ||
180 | msp34x5d y y n n | ||
181 | msp34x7d y n n n | ||
182 | msp34x0g y y y y | ||
183 | msp34x1g y y y y | ||
184 | msp34x2g y y y y | ||
185 | msp34x5g y y n n | ||
186 | msp34x7g y n n n | ||
187 | msp44x0g y y y y | ||
188 | msp44x8g y y y y | ||
189 | */ | ||
190 | |||
191 | /* DSP inputs vs. msp version (tuner and SCART inputs are always available) */ | ||
192 | /* Chip I2S1 I2S2 I2S3 MAIN_AVC MAIN AUX | ||
193 | ------------------------------------------ | ||
194 | msp34x0b y n n n n n | ||
195 | msp34x0c y y n n n n | ||
196 | msp34x0d y y n n n n | ||
197 | msp34x5d y y n n n n | ||
198 | msp34x7d n n n n n n | ||
199 | msp34x0g y y n n n n | ||
200 | msp34x1g y y n n n n | ||
201 | msp34x2g y y n y y y | ||
202 | msp34x5g y y n n n n | ||
203 | msp34x7g n n n n n n | ||
204 | msp44x0g y y y y y y | ||
205 | msp44x8g y y y n n n | ||
206 | */ | ||
207 | |||
208 | /* DSP outputs vs. msp version */ | ||
209 | /* Chip MAIN AUX SCART1 SCART2 I2S | ||
210 | ------------------------------------ | ||
211 | msp34x0b y y y n y | ||
212 | msp34x0c y y y n y | ||
213 | msp34x0d y y y y y | ||
214 | msp34x5d y n y n y | ||
215 | msp34x7d y n y n n | ||
216 | msp34x0g y y y y y | ||
217 | msp34x1g y y y y y | ||
218 | msp34x2g y y y y y | ||
219 | msp34x5g y n y n y | ||
220 | msp34x7g y n y n n | ||
221 | msp44x0g y y y y y | ||
222 | msp44x8g y y y y y | ||
223 | */ | ||
224 | |||
225 | #endif /* MSP3400_H */ | ||
226 | |||
diff --git a/drivers/media/video/rds.h b/include/media/rds.h index 0d30eb744e61..951c1ae0be74 100644 --- a/drivers/media/video/rds.h +++ b/include/media/rds.h | |||
@@ -42,7 +42,3 @@ struct rds_command { | |||
42 | #define RDS_CMD_POLL _IOR('R',4,int) | 42 | #define RDS_CMD_POLL _IOR('R',4,int) |
43 | 43 | ||
44 | #endif | 44 | #endif |
45 | |||
46 | |||
47 | |||
48 | |||
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index e5e749e984ee..4507cb61ae93 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h | |||
@@ -197,7 +197,8 @@ void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, | |||
197 | void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); | 197 | void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); |
198 | int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); | 198 | int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); |
199 | void saa7146_buffer_timeout(unsigned long data); | 199 | void saa7146_buffer_timeout(unsigned long data); |
200 | void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf); | 200 | void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q, |
201 | struct saa7146_buf *buf); | ||
201 | 202 | ||
202 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); | 203 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); |
203 | int saa7146_vv_release(struct saa7146_dev* dev); | 204 | int saa7146_vv_release(struct saa7146_dev* dev); |
diff --git a/include/media/tvaudio.h b/include/media/tvaudio.h new file mode 100644 index 000000000000..6915aafc875a --- /dev/null +++ b/include/media/tvaudio.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | tvaudio.h - definition for tvaudio inputs | ||
3 | |||
4 | Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _TVAUDIO_H | ||
22 | #define _TVAUDIO_H | ||
23 | |||
24 | /* The tvaudio module accepts the following inputs: */ | ||
25 | #define TVAUDIO_INPUT_TUNER 0 | ||
26 | #define TVAUDIO_INPUT_RADIO 1 | ||
27 | #define TVAUDIO_INPUT_EXTERN 2 | ||
28 | #define TVAUDIO_INPUT_INTERN 3 | ||
29 | |||
30 | #endif | ||
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 2360453e7496..642520acdfa7 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -123,17 +123,6 @@ enum v4l2_chip_ident { | |||
123 | /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ | 123 | /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ |
124 | #define AUDC_SET_RADIO _IO('d',88) | 124 | #define AUDC_SET_RADIO _IO('d',88) |
125 | 125 | ||
126 | /* select from TV,radio,extern,MUTE, to be replaced with VIDIOC_INT_S_AUDIO_ROUTING */ | ||
127 | #define AUDC_SET_INPUT _IOW('d',89,int) | ||
128 | |||
129 | /* msp3400 ioctl: will be removed in the near future, to be replaced by | ||
130 | VIDIOC_INT_S_AUDIO_ROUTING. */ | ||
131 | struct msp_matrix { | ||
132 | int input; | ||
133 | int output; | ||
134 | }; | ||
135 | #define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) | ||
136 | |||
137 | /* tuner ioctls */ | 126 | /* tuner ioctls */ |
138 | 127 | ||
139 | /* Sets tuner type and its I2C addr */ | 128 | /* Sets tuner type and its I2C addr */ |
@@ -209,10 +198,10 @@ struct v4l2_routing { | |||
209 | }; | 198 | }; |
210 | 199 | ||
211 | /* These internal commands should be used to define the inputs and outputs | 200 | /* These internal commands should be used to define the inputs and outputs |
212 | of an audio/video chip. They will replace AUDC_SET_INPUT. | 201 | of an audio/video chip. They will replace the v4l2 API commands |
213 | The v4l2 API commands VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, | 202 | VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT |
214 | VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT are meant to be used by the | 203 | that are meant to be used by the user. |
215 | user. Internally these commands should be used to switch inputs/outputs | 204 | The internal commands should be used to switch inputs/outputs |
216 | because only the driver knows how to map a 'Television' input to the precise | 205 | because only the driver knows how to map a 'Television' input to the precise |
217 | input/output routing of an A/D converter, or a DSP, or a video digitizer. | 206 | input/output routing of an A/D converter, or a DSP, or a video digitizer. |
218 | These four commands should only be sent directly to an i2c device, they | 207 | These four commands should only be sent directly to an i2c device, they |
diff --git a/include/media/video-buf.h b/include/media/video-buf.h index d90dec5484ee..fff3fd0fbf94 100644 --- a/include/media/video-buf.h +++ b/include/media/video-buf.h | |||
@@ -1,15 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * generic helper functions for video4linux capture buffers, to handle | 3 | * generic helper functions for video4linux capture buffers, to handle |
4 | * memory management and PCI DMA. Right now bttv + saa7134 use it. | 4 | * memory management and PCI DMA. |
5 | * Right now, bttv, saa7134, saa7146 and cx88 use it. | ||
5 | * | 6 | * |
6 | * The functions expect the hardware being able to scatter gatter | 7 | * The functions expect the hardware being able to scatter gatter |
7 | * (i.e. the buffers are not linear in physical memory, but fragmented | 8 | * (i.e. the buffers are not linear in physical memory, but fragmented |
8 | * into PAGE_SIZE chunks). They also assume the driver does not need | 9 | * into PAGE_SIZE chunks). They also assume the driver does not need |
9 | * to touch the video data (thus it is probably not useful for USB as | 10 | * to touch the video data. |
10 | * data often must be uncompressed by the drivers). | 11 | * |
12 | * device specific map/unmap/sync stuff now are mapped as file operations | ||
13 | * to allow its usage by USB and virtual devices. | ||
11 | * | 14 | * |
12 | * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> | 15 | * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> |
16 | * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org> | ||
17 | * (c) 2006 Ted Walther and John Sokol | ||
13 | * | 18 | * |
14 | * This program is free software; you can redistribute it and/or modify | 19 | * This program is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by | 20 | * it under the terms of the GNU General Public License as published by |
@@ -38,6 +43,9 @@ struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); | |||
38 | struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, | 43 | struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, |
39 | int offset); | 44 | int offset); |
40 | 45 | ||
46 | struct videobuf_buffer; | ||
47 | struct videobuf_queue; | ||
48 | |||
41 | /* --------------------------------------------------------------------- */ | 49 | /* --------------------------------------------------------------------- */ |
42 | 50 | ||
43 | /* | 51 | /* |
@@ -49,7 +57,7 @@ struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, | |||
49 | * pointer + length. The kernel version just wants the size and | 57 | * pointer + length. The kernel version just wants the size and |
50 | * does memory allocation too using vmalloc_32(). | 58 | * does memory allocation too using vmalloc_32(). |
51 | * | 59 | * |
52 | * videobuf_dma_pci_*() | 60 | * videobuf_dma_*() |
53 | * see Documentation/DMA-mapping.txt, these functions to | 61 | * see Documentation/DMA-mapping.txt, these functions to |
54 | * basically the same. The map function does also build a | 62 | * basically the same. The map function does also build a |
55 | * scatterlist for the buffer (and unmap frees it ...) | 63 | * scatterlist for the buffer (and unmap frees it ...) |
@@ -86,12 +94,18 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, | |||
86 | int nr_pages); | 94 | int nr_pages); |
87 | int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | 95 | int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, |
88 | dma_addr_t addr, int nr_pages); | 96 | dma_addr_t addr, int nr_pages); |
89 | int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma); | ||
90 | int videobuf_dma_pci_sync(struct pci_dev *dev, | ||
91 | struct videobuf_dmabuf *dma); | ||
92 | int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma); | ||
93 | int videobuf_dma_free(struct videobuf_dmabuf *dma); | 97 | int videobuf_dma_free(struct videobuf_dmabuf *dma); |
94 | 98 | ||
99 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
100 | int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
101 | int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
102 | |||
103 | /*FIXME: these variants are used only on *-alsa code, where videobuf is | ||
104 | * used without queue | ||
105 | */ | ||
106 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma); | ||
107 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma); | ||
108 | |||
95 | /* --------------------------------------------------------------------- */ | 109 | /* --------------------------------------------------------------------- */ |
96 | 110 | ||
97 | /* | 111 | /* |
@@ -115,9 +129,6 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma); | |||
115 | * | 129 | * |
116 | */ | 130 | */ |
117 | 131 | ||
118 | struct videobuf_buffer; | ||
119 | struct videobuf_queue; | ||
120 | |||
121 | struct videobuf_mapping { | 132 | struct videobuf_mapping { |
122 | unsigned int count; | 133 | unsigned int count; |
123 | unsigned long start; | 134 | unsigned long start; |
@@ -164,6 +175,10 @@ struct videobuf_buffer { | |||
164 | struct timeval ts; | 175 | struct timeval ts; |
165 | }; | 176 | }; |
166 | 177 | ||
178 | typedef int (vb_map_sg_t)(void *dev,struct scatterlist *sglist,int nr_pages, | ||
179 | int direction); | ||
180 | |||
181 | |||
167 | struct videobuf_queue_ops { | 182 | struct videobuf_queue_ops { |
168 | int (*buf_setup)(struct videobuf_queue *q, | 183 | int (*buf_setup)(struct videobuf_queue *q, |
169 | unsigned int *count, unsigned int *size); | 184 | unsigned int *count, unsigned int *size); |
@@ -174,12 +189,20 @@ struct videobuf_queue_ops { | |||
174 | struct videobuf_buffer *vb); | 189 | struct videobuf_buffer *vb); |
175 | void (*buf_release)(struct videobuf_queue *q, | 190 | void (*buf_release)(struct videobuf_queue *q, |
176 | struct videobuf_buffer *vb); | 191 | struct videobuf_buffer *vb); |
192 | |||
193 | /* Helper operations - device dependent. | ||
194 | * If null, videobuf_init defaults all to PCI handling | ||
195 | */ | ||
196 | |||
197 | vb_map_sg_t *vb_map_sg; | ||
198 | vb_map_sg_t *vb_dma_sync_sg; | ||
199 | vb_map_sg_t *vb_unmap_sg; | ||
177 | }; | 200 | }; |
178 | 201 | ||
179 | struct videobuf_queue { | 202 | struct videobuf_queue { |
180 | struct mutex lock; | 203 | struct mutex lock; |
181 | spinlock_t *irqlock; | 204 | spinlock_t *irqlock; |
182 | struct pci_dev *pci; | 205 | void *dev; /* on pci, points to struct pci_dev */ |
183 | 206 | ||
184 | enum v4l2_buf_type type; | 207 | enum v4l2_buf_type type; |
185 | unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */ | 208 | unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */ |
@@ -204,12 +227,15 @@ struct videobuf_queue { | |||
204 | 227 | ||
205 | void* videobuf_alloc(unsigned int size); | 228 | void* videobuf_alloc(unsigned int size); |
206 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); | 229 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); |
207 | int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, | 230 | int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, |
208 | struct v4l2_framebuffer *fbuf); | 231 | struct v4l2_framebuffer *fbuf); |
232 | |||
233 | /* Maps fops to PCI stuff */ | ||
234 | void videobuf_queue_pci(struct videobuf_queue* q); | ||
209 | 235 | ||
210 | void videobuf_queue_init(struct videobuf_queue *q, | 236 | void videobuf_queue_init(struct videobuf_queue *q, |
211 | struct videobuf_queue_ops *ops, | 237 | struct videobuf_queue_ops *ops, |
212 | struct pci_dev *pci, | 238 | void *dev, |
213 | spinlock_t *irqlock, | 239 | spinlock_t *irqlock, |
214 | enum v4l2_buf_type type, | 240 | enum v4l2_buf_type type, |
215 | enum v4l2_field field, | 241 | enum v4l2_field field, |
diff --git a/include/media/wm8775.h b/include/media/wm8775.h new file mode 100644 index 000000000000..60739c5a23ae --- /dev/null +++ b/include/media/wm8775.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | wm8775.h - definition for wm8775 inputs and outputs | ||
3 | |||
4 | Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _WM8775_H_ | ||
22 | #define _WM8775_H_ | ||
23 | |||
24 | /* The WM8775 has 4 inputs and one output. Zero or more inputs | ||
25 | are multiplexed together to the output. Hence there are | ||
26 | 16 combinations. | ||
27 | If only one input is active (the normal case) then the | ||
28 | input values 1, 2, 4 or 8 should be used. */ | ||
29 | |||
30 | #define WM8775_AIN1 1 | ||
31 | #define WM8775_AIN2 2 | ||
32 | #define WM8775_AIN3 4 | ||
33 | #define WM8775_AIN4 8 | ||
34 | |||
35 | #endif | ||