media: uvcvideo: Set capability in s_param
authorRicardo Ribalda <ribalda@chromium.org>
Fri, 18 Jun 2021 12:29:08 +0000 (14:29 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 18 Nov 2021 18:16:12 +0000 (19:16 +0100)
[ Upstream commit 97a2777a96070afb7da5d587834086c0b586c8cc ]

Fixes v4l2-compliance:

Format ioctls (Input 0):
                warn: v4l2-test-formats.cpp(1339): S_PARM is supported but doesn't report V4L2_CAP_TIMEPERFRAME
                fail: v4l2-test-formats.cpp(1241): node->has_frmintervals && !cap->capability

Reviewed-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/media/usb/uvc/uvc_v4l2.c

index 6acb8013de08bbd0866fa3825914e6733303b814..c9d208677bcd8535ee3afdc59609299da93e6061 100644 (file)
@@ -472,10 +472,13 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream,
        uvc_simplify_fraction(&timeperframe.numerator,
                &timeperframe.denominator, 8, 333);
 
-       if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE)
+       if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
                parm->parm.capture.timeperframe = timeperframe;
-       else
+               parm->parm.capture.capability = V4L2_CAP_TIMEPERFRAME;
+       } else {
                parm->parm.output.timeperframe = timeperframe;
+               parm->parm.output.capability = V4L2_CAP_TIMEPERFRAME;
+       }
 
        return 0;
 }