1 /* Linux driver for Philips webcam
2 USB and Video4Linux interface part.
3 (C) 1999-2004 Nemosoft Unv.
4 (C) 2004-2006 Luc Saillard (luc@saillard.org)
6 NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx
7 driver and thus may have bugs that are not present in the original version.
8 Please send bug reports and support requests to <luc@saillard.org>.
9 The decompression routines have been implemented by reverse-engineering the
10 Nemosoft binary pwcx module. Caveat emptor.
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include <linux/errno.h>
29 #include <linux/init.h>
31 #include <linux/module.h>
32 #include <linux/poll.h>
33 #include <linux/vmalloc.h>
38 static struct v4l2_queryctrl pwc_controls[] = {
40 .id = V4L2_CID_BRIGHTNESS,
41 .type = V4L2_CTRL_TYPE_INTEGER,
49 .id = V4L2_CID_CONTRAST,
50 .type = V4L2_CTRL_TYPE_INTEGER,
58 .id = V4L2_CID_SATURATION,
59 .type = V4L2_CTRL_TYPE_INTEGER,
68 .type = V4L2_CTRL_TYPE_INTEGER,
76 .id = V4L2_CID_RED_BALANCE,
77 .type = V4L2_CTRL_TYPE_INTEGER,
85 .id = V4L2_CID_BLUE_BALANCE,
86 .type = V4L2_CTRL_TYPE_INTEGER,
94 .id = V4L2_CID_AUTO_WHITE_BALANCE,
95 .type = V4L2_CTRL_TYPE_BOOLEAN,
96 .name = "Auto White Balance",
103 .id = V4L2_CID_EXPOSURE,
104 .type = V4L2_CTRL_TYPE_INTEGER,
105 .name = "Shutter Speed (Exposure)",
109 .default_value = 200,
112 .id = V4L2_CID_AUTOGAIN,
113 .type = V4L2_CTRL_TYPE_BOOLEAN,
114 .name = "Auto Gain Enabled",
122 .type = V4L2_CTRL_TYPE_INTEGER,
123 .name = "Gain Level",
130 .id = V4L2_CID_PRIVATE_SAVE_USER,
131 .type = V4L2_CTRL_TYPE_BUTTON,
132 .name = "Save User Settings",
139 .id = V4L2_CID_PRIVATE_RESTORE_USER,
140 .type = V4L2_CTRL_TYPE_BUTTON,
141 .name = "Restore User Settings",
148 .id = V4L2_CID_PRIVATE_RESTORE_FACTORY,
149 .type = V4L2_CTRL_TYPE_BUTTON,
150 .name = "Restore Factory Settings",
157 .id = V4L2_CID_PRIVATE_COLOUR_MODE,
158 .type = V4L2_CTRL_TYPE_BOOLEAN,
159 .name = "Colour mode",
166 .id = V4L2_CID_PRIVATE_AUTOCONTOUR,
167 .type = V4L2_CTRL_TYPE_BOOLEAN,
168 .name = "Auto contour",
175 .id = V4L2_CID_PRIVATE_CONTOUR,
176 .type = V4L2_CTRL_TYPE_INTEGER,
184 .id = V4L2_CID_PRIVATE_BACKLIGHT,
185 .type = V4L2_CTRL_TYPE_BOOLEAN,
186 .name = "Backlight compensation",
193 .id = V4L2_CID_PRIVATE_FLICKERLESS,
194 .type = V4L2_CTRL_TYPE_BOOLEAN,
195 .name = "Flickerless",
202 .id = V4L2_CID_PRIVATE_NOISE_REDUCTION,
203 .type = V4L2_CTRL_TYPE_INTEGER,
204 .name = "Noise reduction",
213 static void pwc_vidioc_fill_fmt(const struct pwc_device *pdev, struct v4l2_format *f)
215 memset(&f->fmt.pix, 0, sizeof(struct v4l2_pix_format));
216 f->fmt.pix.width = pdev->view.x;
217 f->fmt.pix.height = pdev->view.y;
218 f->fmt.pix.field = V4L2_FIELD_NONE;
219 if (pdev->pixfmt == V4L2_PIX_FMT_YUV420) {
220 f->fmt.pix.pixelformat = V4L2_PIX_FMT_YUV420;
221 f->fmt.pix.bytesperline = (f->fmt.pix.width * 3)/2;
222 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
224 /* vbandlength contains 4 lines ... */
225 f->fmt.pix.bytesperline = pdev->vbandlength/4;
226 f->fmt.pix.sizeimage = pdev->frame_size + sizeof(struct pwc_raw_frame);
227 if (DEVICE_USE_CODEC1(pdev->type))
228 f->fmt.pix.pixelformat = V4L2_PIX_FMT_PWC1;
230 f->fmt.pix.pixelformat = V4L2_PIX_FMT_PWC2;
232 PWC_DEBUG_IOCTL("pwc_vidioc_fill_fmt() "
233 "width=%d, height=%d, bytesperline=%d, sizeimage=%d, pixelformat=%c%c%c%c\n",
236 f->fmt.pix.bytesperline,
237 f->fmt.pix.sizeimage,
238 (f->fmt.pix.pixelformat)&255,
239 (f->fmt.pix.pixelformat>>8)&255,
240 (f->fmt.pix.pixelformat>>16)&255,
241 (f->fmt.pix.pixelformat>>24)&255);
244 /* ioctl(VIDIOC_TRY_FMT) */
245 static int pwc_vidioc_try_fmt(struct pwc_device *pdev, struct v4l2_format *f)
247 if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
248 PWC_DEBUG_IOCTL("Bad video type must be V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
252 switch (f->fmt.pix.pixelformat) {
253 case V4L2_PIX_FMT_YUV420:
255 case V4L2_PIX_FMT_PWC1:
256 if (DEVICE_USE_CODEC23(pdev->type)) {
257 PWC_DEBUG_IOCTL("codec1 is only supported for old pwc webcam\n");
261 case V4L2_PIX_FMT_PWC2:
262 if (DEVICE_USE_CODEC1(pdev->type)) {
263 PWC_DEBUG_IOCTL("codec23 is only supported for new pwc webcam\n");
268 PWC_DEBUG_IOCTL("Unsupported pixel format\n");
273 if (f->fmt.pix.width > pdev->view_max.x)
274 f->fmt.pix.width = pdev->view_max.x;
275 else if (f->fmt.pix.width < pdev->view_min.x)
276 f->fmt.pix.width = pdev->view_min.x;
278 if (f->fmt.pix.height > pdev->view_max.y)
279 f->fmt.pix.height = pdev->view_max.y;
280 else if (f->fmt.pix.height < pdev->view_min.y)
281 f->fmt.pix.height = pdev->view_min.y;
286 /* ioctl(VIDIOC_SET_FMT) */
287 static int pwc_vidioc_set_fmt(struct pwc_device *pdev, struct v4l2_format *f)
289 int ret, fps, snapshot, compression, pixelformat;
291 ret = pwc_vidioc_try_fmt(pdev, f);
295 pixelformat = f->fmt.pix.pixelformat;
296 compression = pdev->vcompression;
299 if (f->fmt.pix.priv) {
300 compression = (f->fmt.pix.priv & PWC_QLT_MASK) >> PWC_QLT_SHIFT;
301 snapshot = !!(f->fmt.pix.priv & PWC_FPS_SNAPSHOT);
302 fps = (f->fmt.pix.priv & PWC_FPS_FRMASK) >> PWC_FPS_SHIFT;
307 if (pixelformat != V4L2_PIX_FMT_YUV420 &&
308 pixelformat != V4L2_PIX_FMT_PWC1 &&
309 pixelformat != V4L2_PIX_FMT_PWC2)
312 PWC_DEBUG_IOCTL("Try to change format to: width=%d height=%d fps=%d "
313 "compression=%d snapshot=%d format=%c%c%c%c\n",
314 f->fmt.pix.width, f->fmt.pix.height, fps,
315 compression, snapshot,
317 (pixelformat>>8)&255,
318 (pixelformat>>16)&255,
319 (pixelformat>>24)&255);
321 ret = pwc_try_video_mode(pdev,
328 PWC_DEBUG_IOCTL("pwc_try_video_mode(), return=%d\n", ret);
333 pdev->pixfmt = pixelformat;
335 pwc_vidioc_fill_fmt(pdev, f);
341 long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg)
343 struct video_device *vdev = video_devdata(file);
344 struct pwc_device *pdev;
345 DECLARE_WAITQUEUE(wait, current);
349 pdev = video_get_drvdata(vdev);
353 #ifdef CONFIG_USB_PWC_DEBUG
354 if (PWC_DEBUG_LEVEL_IOCTL & pwc_trace) {
355 v4l_printk_ioctl(cmd);
362 #ifdef CONFIG_VIDEO_V4L1_COMPAT
363 /* mmap() functions */
366 /* Tell the user program how much memory is needed for a mmap() */
367 struct video_mbuf *vm = arg;
370 memset(vm, 0, sizeof(*vm));
371 vm->size = pwc_mbufs * pdev->len_per_image;
372 vm->frames = pwc_mbufs; /* double buffering should be enough for most applications */
373 for (i = 0; i < pwc_mbufs; i++)
374 vm->offsets[i] = i * pdev->len_per_image;
380 case VIDIOC_QUERYCAP:
382 struct v4l2_capability *cap = arg;
384 PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCAP) This application "\
385 "try to use the v4l2 layer\n");
386 strcpy(cap->driver,PWC_NAME);
387 strlcpy(cap->card, vdev->name, sizeof(cap->card));
388 usb_make_path(pdev->udev,cap->bus_info,sizeof(cap->bus_info));
389 cap->version = PWC_VERSION_CODE;
391 V4L2_CAP_VIDEO_CAPTURE |
397 case VIDIOC_ENUMINPUT:
399 struct v4l2_input *i = arg;
401 if ( i->index ) /* Only one INPUT is supported */
404 memset(i, 0, sizeof(struct v4l2_input));
405 strcpy(i->name, "usb");
412 *i = 0; /* Only one INPUT is supported */
419 if ( *i ) { /* Only one INPUT is supported */
420 PWC_DEBUG_IOCTL("Only one input source is"\
421 " supported with this webcam.\n");
428 case VIDIOC_QUERYCTRL:
430 struct v4l2_queryctrl *c = arg;
433 PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCTRL) query id=%d\n", c->id);
434 for (i=0; i<sizeof(pwc_controls)/sizeof(struct v4l2_queryctrl); i++) {
435 if (pwc_controls[i].id == c->id) {
436 PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCTRL) found\n");
437 memcpy(c,&pwc_controls[i],sizeof(struct v4l2_queryctrl));
441 PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYCTRL) not found\n");
447 struct v4l2_control *c = arg;
452 case V4L2_CID_BRIGHTNESS:
453 c->value = pwc_get_brightness(pdev);
457 case V4L2_CID_CONTRAST:
458 c->value = pwc_get_contrast(pdev);
462 case V4L2_CID_SATURATION:
463 ret = pwc_get_saturation(pdev, &c->value);
468 c->value = pwc_get_gamma(pdev);
472 case V4L2_CID_RED_BALANCE:
473 ret = pwc_get_red_gain(pdev, &c->value);
478 case V4L2_CID_BLUE_BALANCE:
479 ret = pwc_get_blue_gain(pdev, &c->value);
484 case V4L2_CID_AUTO_WHITE_BALANCE:
485 ret = pwc_get_awb(pdev);
488 c->value = (ret == PWC_WB_MANUAL)?0:1;
491 ret = pwc_get_agc(pdev, &c->value);
496 case V4L2_CID_AUTOGAIN:
497 ret = pwc_get_agc(pdev, &c->value);
500 c->value = (c->value < 0)?1:0;
502 case V4L2_CID_EXPOSURE:
503 ret = pwc_get_shutter_speed(pdev, &c->value);
507 case V4L2_CID_PRIVATE_COLOUR_MODE:
508 ret = pwc_get_colour_mode(pdev, &c->value);
512 case V4L2_CID_PRIVATE_AUTOCONTOUR:
513 ret = pwc_get_contour(pdev, &c->value);
516 c->value=(c->value == -1?1:0);
518 case V4L2_CID_PRIVATE_CONTOUR:
519 ret = pwc_get_contour(pdev, &c->value);
524 case V4L2_CID_PRIVATE_BACKLIGHT:
525 ret = pwc_get_backlight(pdev, &c->value);
529 case V4L2_CID_PRIVATE_FLICKERLESS:
530 ret = pwc_get_flicker(pdev, &c->value);
533 c->value=(c->value?1:0);
535 case V4L2_CID_PRIVATE_NOISE_REDUCTION:
536 ret = pwc_get_dynamic_noise(pdev, &c->value);
541 case V4L2_CID_PRIVATE_SAVE_USER:
542 case V4L2_CID_PRIVATE_RESTORE_USER:
543 case V4L2_CID_PRIVATE_RESTORE_FACTORY:
550 struct v4l2_control *c = arg;
555 case V4L2_CID_BRIGHTNESS:
557 ret = pwc_set_brightness(pdev, c->value);
561 case V4L2_CID_CONTRAST:
563 ret = pwc_set_contrast(pdev, c->value);
567 case V4L2_CID_SATURATION:
568 ret = pwc_set_saturation(pdev, c->value);
574 ret = pwc_set_gamma(pdev, c->value);
578 case V4L2_CID_RED_BALANCE:
580 ret = pwc_set_red_gain(pdev, c->value);
584 case V4L2_CID_BLUE_BALANCE:
586 ret = pwc_set_blue_gain(pdev, c->value);
590 case V4L2_CID_AUTO_WHITE_BALANCE:
591 c->value = (c->value == 0)?PWC_WB_MANUAL:PWC_WB_AUTO;
592 ret = pwc_set_awb(pdev, c->value);
596 case V4L2_CID_EXPOSURE:
598 ret = pwc_set_shutter_speed(pdev, c->value?0:1, c->value);
602 case V4L2_CID_AUTOGAIN:
603 /* autogain off means nothing without a gain */
606 ret = pwc_set_agc(pdev, c->value, 0);
612 ret = pwc_set_agc(pdev, 0, c->value);
616 case V4L2_CID_PRIVATE_SAVE_USER:
617 if (pwc_save_user(pdev))
620 case V4L2_CID_PRIVATE_RESTORE_USER:
621 if (pwc_restore_user(pdev))
624 case V4L2_CID_PRIVATE_RESTORE_FACTORY:
625 if (pwc_restore_factory(pdev))
628 case V4L2_CID_PRIVATE_COLOUR_MODE:
629 ret = pwc_set_colour_mode(pdev, c->value);
633 case V4L2_CID_PRIVATE_AUTOCONTOUR:
634 c->value=(c->value == 1)?-1:0;
635 ret = pwc_set_contour(pdev, c->value);
639 case V4L2_CID_PRIVATE_CONTOUR:
641 ret = pwc_set_contour(pdev, c->value);
645 case V4L2_CID_PRIVATE_BACKLIGHT:
646 ret = pwc_set_backlight(pdev, c->value);
650 case V4L2_CID_PRIVATE_FLICKERLESS:
651 ret = pwc_set_flicker(pdev, c->value);
654 case V4L2_CID_PRIVATE_NOISE_REDUCTION:
655 ret = pwc_set_dynamic_noise(pdev, c->value);
664 case VIDIOC_ENUM_FMT:
666 struct v4l2_fmtdesc *f = arg;
669 if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
672 /* We only support two format: the raw format, and YUV */
674 memset(f,0,sizeof(struct v4l2_fmtdesc));
675 f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
681 f->pixelformat = pdev->type<=646?V4L2_PIX_FMT_PWC1:V4L2_PIX_FMT_PWC2;
682 f->flags = V4L2_FMT_FLAG_COMPRESSED;
683 strlcpy(f->description,"Raw Philips Webcam",sizeof(f->description));
686 f->pixelformat = V4L2_PIX_FMT_YUV420;
687 strlcpy(f->description,"4:2:0, planar, Y-Cb-Cr",sizeof(f->description));
697 struct v4l2_format *f = arg;
699 PWC_DEBUG_IOCTL("ioctl(VIDIOC_G_FMT) return size %dx%d\n",pdev->image.x,pdev->image.y);
700 if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
703 pwc_vidioc_fill_fmt(pdev, f);
709 return pwc_vidioc_try_fmt(pdev, arg);
712 return pwc_vidioc_set_fmt(pdev, arg);
716 v4l2_std_id *std = arg;
717 *std = V4L2_STD_UNKNOWN;
723 v4l2_std_id *std = arg;
724 if (*std != V4L2_STD_UNKNOWN)
731 struct v4l2_standard *std = arg;
734 std->id = V4L2_STD_UNKNOWN;
735 strlcpy(std->name, "webcam", sizeof(std->name));
741 struct v4l2_requestbuffers *rb = arg;
744 PWC_DEBUG_IOCTL("ioctl(VIDIOC_REQBUFS) count=%d\n",rb->count);
745 if (rb->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
747 if (rb->memory != V4L2_MEMORY_MMAP)
750 nbuffers = rb->count;
753 else if (nbuffers > pwc_mbufs)
754 nbuffers = pwc_mbufs;
755 /* Force to use our # of buffers */
756 rb->count = pwc_mbufs;
760 case VIDIOC_QUERYBUF:
762 struct v4l2_buffer *buf = arg;
765 PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) index=%d\n",buf->index);
766 if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) {
767 PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) Bad type\n");
770 if (buf->memory != V4L2_MEMORY_MMAP) {
771 PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) Bad memory type\n");
775 if (index < 0 || index >= pwc_mbufs) {
776 PWC_DEBUG_IOCTL("ioctl(VIDIOC_QUERYBUF) Bad index %d\n", buf->index);
780 memset(buf, 0, sizeof(struct v4l2_buffer));
781 buf->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
783 buf->m.offset = index * pdev->len_per_image;
784 if (pdev->pixfmt != V4L2_PIX_FMT_YUV420)
785 buf->bytesused = pdev->frame_size + sizeof(struct pwc_raw_frame);
787 buf->bytesused = pdev->view.size;
788 buf->field = V4L2_FIELD_NONE;
789 buf->memory = V4L2_MEMORY_MMAP;
790 //buf->flags = V4L2_BUF_FLAG_MAPPED;
791 buf->length = pdev->len_per_image;
793 PWC_DEBUG_READ("VIDIOC_QUERYBUF: index=%d\n",buf->index);
794 PWC_DEBUG_READ("VIDIOC_QUERYBUF: m.offset=%d\n",buf->m.offset);
795 PWC_DEBUG_READ("VIDIOC_QUERYBUF: bytesused=%d\n",buf->bytesused);
802 struct v4l2_buffer *buf = arg;
804 PWC_DEBUG_IOCTL("ioctl(VIDIOC_QBUF) index=%d\n",buf->index);
805 if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
807 if (buf->memory != V4L2_MEMORY_MMAP)
809 if (buf->index >= pwc_mbufs)
812 buf->flags |= V4L2_BUF_FLAG_QUEUED;
813 buf->flags &= ~V4L2_BUF_FLAG_DONE;
820 struct v4l2_buffer *buf = arg;
823 PWC_DEBUG_IOCTL("ioctl(VIDIOC_DQBUF)\n");
825 if (buf->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
828 /* Add ourselves to the frame wait-queue.
830 FIXME: needs auditing for safety.
831 QUESTION: In what respect? I think that using the
834 add_wait_queue(&pdev->frameq, &wait);
835 while (pdev->full_frames == NULL) {
836 if (pdev->error_status) {
837 remove_wait_queue(&pdev->frameq, &wait);
838 set_current_state(TASK_RUNNING);
839 return -pdev->error_status;
842 if (signal_pending(current)) {
843 remove_wait_queue(&pdev->frameq, &wait);
844 set_current_state(TASK_RUNNING);
848 set_current_state(TASK_INTERRUPTIBLE);
850 remove_wait_queue(&pdev->frameq, &wait);
851 set_current_state(TASK_RUNNING);
853 PWC_DEBUG_IOCTL("VIDIOC_DQBUF: frame ready.\n");
854 /* Decompress data in pdev->images[pdev->fill_image] */
855 ret = pwc_handle_frame(pdev);
858 PWC_DEBUG_IOCTL("VIDIOC_DQBUF: after pwc_handle_frame\n");
860 buf->index = pdev->fill_image;
861 if (pdev->pixfmt != V4L2_PIX_FMT_YUV420)
862 buf->bytesused = pdev->frame_size + sizeof(struct pwc_raw_frame);
864 buf->bytesused = pdev->view.size;
865 buf->flags = V4L2_BUF_FLAG_MAPPED;
866 buf->field = V4L2_FIELD_NONE;
867 do_gettimeofday(&buf->timestamp);
869 buf->memory = V4L2_MEMORY_MMAP;
870 buf->m.offset = pdev->fill_image * pdev->len_per_image;
871 buf->length = pdev->len_per_image;
872 pwc_next_image(pdev);
874 PWC_DEBUG_IOCTL("VIDIOC_DQBUF: buf->index=%d\n",buf->index);
875 PWC_DEBUG_IOCTL("VIDIOC_DQBUF: buf->length=%d\n",buf->length);
876 PWC_DEBUG_IOCTL("VIDIOC_DQBUF: m.offset=%d\n",buf->m.offset);
877 PWC_DEBUG_IOCTL("VIDIOC_DQBUF: bytesused=%d\n",buf->bytesused);
878 PWC_DEBUG_IOCTL("VIDIOC_DQBUF: leaving\n");
883 case VIDIOC_STREAMON:
885 /* WARNING: pwc_try_video_mode() called pwc_isoc_init */
890 case VIDIOC_STREAMOFF:
892 pwc_isoc_cleanup(pdev);
896 case VIDIOC_ENUM_FRAMESIZES:
898 struct v4l2_frmsizeenum *fsize = arg;
899 unsigned int i = 0, index = fsize->index;
901 if (fsize->pixel_format == V4L2_PIX_FMT_YUV420) {
902 for (i = 0; i < PSZ_MAX; i++) {
903 if (pdev->image_mask & (1UL << i)) {
905 fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
906 fsize->discrete.width = pwc_image_sizes[i].x;
907 fsize->discrete.height = pwc_image_sizes[i].y;
912 } else if (fsize->index == 0 &&
913 ((fsize->pixel_format == V4L2_PIX_FMT_PWC1 && DEVICE_USE_CODEC1(pdev->type)) ||
914 (fsize->pixel_format == V4L2_PIX_FMT_PWC2 && DEVICE_USE_CODEC23(pdev->type)))) {
916 fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
917 fsize->discrete.width = pdev->abs_max.x;
918 fsize->discrete.height = pdev->abs_max.y;
924 case VIDIOC_ENUM_FRAMEINTERVALS:
926 struct v4l2_frmivalenum *fival = arg;
930 for (i = 0; i < PSZ_MAX; i++) {
931 if (pwc_image_sizes[i].x == fival->width &&
932 pwc_image_sizes[i].y == fival->height) {
938 /* TODO: Support raw format */
939 if (size < 0 || fival->pixel_format != V4L2_PIX_FMT_YUV420) {
943 i = pwc_get_fps(pdev, fival->index, size);
947 fival->type = V4L2_FRMIVAL_TYPE_DISCRETE;
948 fival->discrete.numerator = 1;
949 fival->discrete.denominator = i;
955 return pwc_ioctl(pdev, cmd, arg);
960 /* vim: set cino= formatoptions=croql cindent shiftwidth=8 tabstop=8: */