]> git.karo-electronics.de Git - linux-beck.git/commitdiff
[media] v4l2: add device_caps to struct video_device
authorHans Verkuil <hans.verkuil@cisco.com>
Tue, 1 Mar 2016 14:57:23 +0000 (11:57 -0300)
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>
Wed, 13 Apr 2016 19:40:29 +0000 (16:40 -0300)
Instead of letting drivers fill in device_caps at querycap time,
let them fill it in when the video device is registered.

This has the advantage that in the future the v4l2 core can access
the video device's capabilities and take decisions based on that.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
drivers/media/v4l2-core/v4l2-ioctl.c
include/media/v4l2-dev.h

index 170dd68d27f40176758950f4a999b811e231d914..6bf5a3ecd12652540fa90efc0fd1362533ad0ce1 100644 (file)
@@ -1020,9 +1020,12 @@ static int v4l_querycap(const struct v4l2_ioctl_ops *ops,
                                struct file *file, void *fh, void *arg)
 {
        struct v4l2_capability *cap = (struct v4l2_capability *)arg;
+       struct video_device *vfd = video_devdata(file);
        int ret;
 
        cap->version = LINUX_VERSION_CODE;
+       cap->device_caps = vfd->device_caps;
+       cap->capabilities = vfd->device_caps | V4L2_CAP_DEVICE_CAPS;
 
        ret = ops->vidioc_querycap(file, fh, cap);
 
index 76056ab5c5bde3da22b13f371e77a0ab57eef197..25a3190308fb53f66f159bac4258740e9c1ba660 100644 (file)
@@ -92,6 +92,9 @@ struct video_device
        /* device ops */
        const struct v4l2_file_operations *fops;
 
+       /* device capabilities as used in v4l2_capabilities */
+       u32 device_caps;
+
        /* sysfs */
        struct device dev;              /* v4l device */
        struct cdev *cdev;              /* character device */