media: subdev: Require code change to enable [GS]_ROUTING
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Sun, 15 Jan 2023 12:40:08 +0000 (13:40 +0100)
committerMauro Carvalho Chehab <mchehab@kernel.org>
Sun, 22 Jan 2023 08:34:13 +0000 (09:34 +0100)
The Streams API is an experimental feature. To use the Streams API, the
user needs to change a variable in v4l2-subdev.c and recompile the kernel.

This commit should be reverted when the Streams API is deemed ready for
production use.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
drivers/media/v4l2-core/v4l2-subdev.c

index f047ac1..6cdb7a8 100644 (file)
 #include <media/v4l2-fh.h>
 #include <media/v4l2-ioctl.h>
 
+#if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
+/*
+ * The Streams API is an experimental feature. To use the Streams API, set
+ * 'v4l2_subdev_enable_streams_api' to 1 below.
+ */
+
+static bool v4l2_subdev_enable_streams_api;
+#endif
+
 /*
  * Maximum stream ID is 63 for now, as we use u64 bitmask to represent a set
  * of streams.
@@ -766,6 +775,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                struct v4l2_subdev_routing *routing = arg;
                struct v4l2_subdev_krouting *krouting;
 
+               if (!v4l2_subdev_enable_streams_api)
+                       return -ENOIOCTLCMD;
+
                if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS))
                        return -ENOIOCTLCMD;
 
@@ -793,6 +805,9 @@ static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg,
                struct v4l2_subdev_krouting krouting = {};
                unsigned int i;
 
+               if (!v4l2_subdev_enable_streams_api)
+                       return -ENOIOCTLCMD;
+
                if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS))
                        return -ENOIOCTLCMD;