media: add V4L2_SUBDEV_CAP_STREAMS
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Mon, 22 Nov 2021 15:18:23 +0000 (16:18 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sun, 22 Jan 2023 08:30:13 +0000 (09:30 +0100)
Add a subdev capability flag to expose to userspace if a subdev supports
multiplexed streams.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/v4l2-core/v4l2-subdev.c
include/uapi/linux/v4l2-subdev.h

index 24acb4aa0895876e3b595edc54cfb380078e4d1b..3adb186bb742c0deed19788cc0f09becb2d45c1a 100644 (file)
@@ -446,6 +446,7 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
        struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
        struct v4l2_fh *vfh = file->private_data;
        bool ro_subdev = test_bit(V4L2_FL_SUBDEV_RO_DEVNODE, &vdev->flags);
+       bool streams_subdev = sd->flags & V4L2_SUBDEV_FL_STREAMS;
        int rval;
 
        switch (cmd) {
@@ -454,7 +455,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
 
                memset(cap->reserved, 0, sizeof(cap->reserved));
                cap->version = LINUX_VERSION_CODE;
-               cap->capabilities = ro_subdev ? V4L2_SUBDEV_CAP_RO_SUBDEV : 0;
+               cap->capabilities =
+                       (ro_subdev ? V4L2_SUBDEV_CAP_RO_SUBDEV : 0) |
+                       (streams_subdev ? V4L2_SUBDEV_CAP_STREAMS : 0);
 
                return 0;
        }
index ecce4c79f5c54a9ea833d75711b289b6304cdbb2..ffed9047e0befe001be18f82dba83b5280334e36 100644 (file)
@@ -175,6 +175,9 @@ struct v4l2_subdev_capability {
 /* The v4l2 sub-device video device node is registered in read-only mode. */
 #define V4L2_SUBDEV_CAP_RO_SUBDEV              0x00000001
 
+/* The v4l2 sub-device supports routing and multiplexed streams. */
+#define V4L2_SUBDEV_CAP_STREAMS                        0x00000002
+
 /* Backwards compatibility define --- to be removed */
 #define v4l2_subdev_edid v4l2_edid