[media] v4l: subdev: Control ioctls support
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 9 Dec 2009 11:39:54 +0000 (08:39 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Mon, 21 Mar 2011 23:32:42 +0000 (20:32 -0300)
Pass the control-related ioctls to the subdev driver through the control
framework.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Acked-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Documentation/video4linux/v4l2-framework.txt
drivers/media/video/v4l2-subdev.c

index 8b358710b2f732cf5f24f86d913f3283f700a20c..1feecfc59c3ded639de511a977afc5066254949f 100644 (file)
@@ -334,6 +334,22 @@ for all registered sub-devices marked with V4L2_SUBDEV_FL_HAS_DEVNODE by calling
 v4l2_device_register_subdev_nodes(). Those device nodes will be automatically
 removed when sub-devices are unregistered.
 
+The device node handles a subset of the V4L2 API.
+
+VIDIOC_QUERYCTRL
+VIDIOC_QUERYMENU
+VIDIOC_G_CTRL
+VIDIOC_S_CTRL
+VIDIOC_G_EXT_CTRLS
+VIDIOC_S_EXT_CTRLS
+VIDIOC_TRY_EXT_CTRLS
+
+       The controls ioctls are identical to the ones defined in V4L2. They
+       behave identically, with the only exception that they deal only with
+       controls implemented in the sub-device. Depending on the driver, those
+       controls can be also be accessed through one (or several) V4L2 device
+       nodes.
+
 
 I2C sub-device drivers
 ----------------------
index 460b33697c9bbaf112e0a18119c57e390b699bc9..da10430051c08af7f7d560c687a6a5ae12c4d7b8 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/ioctl.h>
 #include <linux/videodev2.h>
 
+#include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ioctl.h>
 
@@ -39,7 +40,31 @@ static int subdev_close(struct file *file)
 
 static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
 {
+       struct video_device *vdev = video_devdata(file);
+       struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
+
        switch (cmd) {
+       case VIDIOC_QUERYCTRL:
+               return v4l2_subdev_queryctrl(sd, arg);
+
+       case VIDIOC_QUERYMENU:
+               return v4l2_subdev_querymenu(sd, arg);
+
+       case VIDIOC_G_CTRL:
+               return v4l2_subdev_g_ctrl(sd, arg);
+
+       case VIDIOC_S_CTRL:
+               return v4l2_subdev_s_ctrl(sd, arg);
+
+       case VIDIOC_G_EXT_CTRLS:
+               return v4l2_subdev_g_ext_ctrls(sd, arg);
+
+       case VIDIOC_S_EXT_CTRLS:
+               return v4l2_subdev_s_ext_ctrls(sd, arg);
+
+       case VIDIOC_TRY_EXT_CTRLS:
+               return v4l2_subdev_try_ext_ctrls(sd, arg);
+
        default:
                return -ENOIOCTLCMD;
        }