aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2012-06-10 03:34:10 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-06 16:36:29 -0400
commit387c71b262a7a62d271dc9deb00c173264e33357 (patch)
tree0691032fba9c807ee39baea4b95a69fe796b3b93 /drivers
parent2e43dec0eeb6bca13212b583e750b0aed1c51cd1 (diff)
[media] pwc: v4l2-compliance fixes
- add device_caps - set colorspace - s_parm should support a fps of 0 (== reset to nominal fps) Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/media/video/pwc/pwc-v4l.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c
index 114ae41bc4af..545e9bbdeede 100644
--- a/drivers/media/video/pwc/pwc-v4l.c
+++ b/drivers/media/video/pwc/pwc-v4l.c
@@ -405,6 +405,7 @@ static void pwc_vidioc_fill_fmt(struct v4l2_format *f,
405 f->fmt.pix.pixelformat = pixfmt; 405 f->fmt.pix.pixelformat = pixfmt;
406 f->fmt.pix.bytesperline = f->fmt.pix.width; 406 f->fmt.pix.bytesperline = f->fmt.pix.width;
407 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.width * 3 / 2; 407 f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.width * 3 / 2;
408 f->fmt.pix.colorspace = V4L2_COLORSPACE_SRGB;
408 PWC_DEBUG_IOCTL("pwc_vidioc_fill_fmt() " 409 PWC_DEBUG_IOCTL("pwc_vidioc_fill_fmt() "
409 "width=%d, height=%d, bytesperline=%d, sizeimage=%d, pixelformat=%c%c%c%c\n", 410 "width=%d, height=%d, bytesperline=%d, sizeimage=%d, pixelformat=%c%c%c%c\n",
410 f->fmt.pix.width, 411 f->fmt.pix.width,
@@ -497,10 +498,9 @@ static int pwc_querycap(struct file *file, void *fh, struct v4l2_capability *cap
497 strcpy(cap->driver, PWC_NAME); 498 strcpy(cap->driver, PWC_NAME);
498 strlcpy(cap->card, pdev->vdev.name, sizeof(cap->card)); 499 strlcpy(cap->card, pdev->vdev.name, sizeof(cap->card));
499 usb_make_path(pdev->udev, cap->bus_info, sizeof(cap->bus_info)); 500 usb_make_path(pdev->udev, cap->bus_info, sizeof(cap->bus_info));
500 cap->capabilities = 501 cap->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
501 V4L2_CAP_VIDEO_CAPTURE | 502 V4L2_CAP_READWRITE;
502 V4L2_CAP_STREAMING | 503 cap->capabilities = cap->device_caps | V4L2_CAP_DEVICE_CAPS;
503 V4L2_CAP_READWRITE;
504 return 0; 504 return 0;
505} 505}
506 506
@@ -509,7 +509,8 @@ static int pwc_enum_input(struct file *file, void *fh, struct v4l2_input *i)
509 if (i->index) /* Only one INPUT is supported */ 509 if (i->index) /* Only one INPUT is supported */
510 return -EINVAL; 510 return -EINVAL;
511 511
512 strcpy(i->name, "usb"); 512 strlcpy(i->name, "Camera", sizeof(i->name));
513 i->type = V4L2_INPUT_TYPE_CAMERA;
513 return 0; 514 return 0;
514} 515}
515 516
@@ -1003,12 +1004,18 @@ static int pwc_s_parm(struct file *file, void *fh,
1003 int compression = 0; 1004 int compression = 0;
1004 int ret, fps; 1005 int ret, fps;
1005 1006
1006 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || 1007 if (parm->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1007 parm->parm.capture.timeperframe.numerator == 0)
1008 return -EINVAL; 1008 return -EINVAL;
1009 1009
1010 fps = parm->parm.capture.timeperframe.denominator / 1010 /* If timeperframe == 0, then reset the framerate to the nominal value.
1011 parm->parm.capture.timeperframe.numerator; 1011 We pick a high framerate here, and let pwc_set_video_mode() figure
1012 out the best match. */
1013 if (parm->parm.capture.timeperframe.numerator == 0 ||
1014 parm->parm.capture.timeperframe.denominator == 0)
1015 fps = 30;
1016 else
1017 fps = parm->parm.capture.timeperframe.denominator /
1018 parm->parm.capture.timeperframe.numerator;
1012 1019
1013 if (vb2_is_busy(&pdev->vb_queue)) 1020 if (vb2_is_busy(&pdev->vb_queue))
1014 return -EBUSY; 1021 return -EBUSY;