linux-omap 2.6.37: sync with OE .dev
[glsdk/meta-ti-glsdk.git] / recipes-bsp / linux / linux-omap / media / 0006-v4l-subdev-Control-ioctls-support.patch
1 From dd0b366441249eb10daa2275e968431507f8d0d5 Mon Sep 17 00:00:00 2001
2 From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
3 Date: Wed, 9 Dec 2009 12:39:54 +0100
4 Subject: [PATCH 06/43] v4l: subdev: Control ioctls support
6 Pass the control-related ioctls to the subdev driver through the control
7 framework.
9 Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
10 ---
11  Documentation/video4linux/v4l2-framework.txt |   16 ++++++++++++++++
12  drivers/media/video/v4l2-subdev.c            |   25 +++++++++++++++++++++++++
13  2 files changed, 41 insertions(+), 0 deletions(-)
15 diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt
16 index 4c9185a..f683f63 100644
17 --- a/Documentation/video4linux/v4l2-framework.txt
18 +++ b/Documentation/video4linux/v4l2-framework.txt
19 @@ -336,6 +336,22 @@ argument to 0. Setting the argument to 1 will only enable device node
20  registration if the sub-device driver has set the V4L2_SUBDEV_FL_HAS_DEVNODE
21  flag.
22  
23 +The device node handles a subset of the V4L2 API.
24 +
25 +VIDIOC_QUERYCTRL
26 +VIDIOC_QUERYMENU
27 +VIDIOC_G_CTRL
28 +VIDIOC_S_CTRL
29 +VIDIOC_G_EXT_CTRLS
30 +VIDIOC_S_EXT_CTRLS
31 +VIDIOC_TRY_EXT_CTRLS
32 +
33 +       The controls ioctls are identical to the ones defined in V4L2. They
34 +       behave identically, with the only exception that they deal only with
35 +       controls implemented in the sub-device. Depending on the driver, those
36 +       controls can be also be accessed through one (or several) V4L2 device
37 +       nodes.
38 +
39  
40  I2C sub-device drivers
41  ----------------------
42 diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c
43 index 0deff78..fc57ce7 100644
44 --- a/drivers/media/video/v4l2-subdev.c
45 +++ b/drivers/media/video/v4l2-subdev.c
46 @@ -24,6 +24,7 @@
47  #include <linux/ioctl.h>
48  #include <linux/videodev2.h>
49  
50 +#include <media/v4l2-ctrls.h>
51  #include <media/v4l2-device.h>
52  #include <media/v4l2-ioctl.h>
53  
54 @@ -45,7 +46,31 @@ static int subdev_close(struct file *file)
55  
56  static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg)
57  {
58 +       struct video_device *vdev = video_devdata(file);
59 +       struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev);
60 +
61         switch (cmd) {
62 +       case VIDIOC_QUERYCTRL:
63 +               return v4l2_subdev_queryctrl(sd, arg);
64 +
65 +       case VIDIOC_QUERYMENU:
66 +               return v4l2_subdev_querymenu(sd, arg);
67 +
68 +       case VIDIOC_G_CTRL:
69 +               return v4l2_subdev_g_ctrl(sd, arg);
70 +
71 +       case VIDIOC_S_CTRL:
72 +               return v4l2_subdev_s_ctrl(sd, arg);
73 +
74 +       case VIDIOC_G_EXT_CTRLS:
75 +               return v4l2_subdev_g_ext_ctrls(sd, arg);
76 +
77 +       case VIDIOC_S_EXT_CTRLS:
78 +               return v4l2_subdev_s_ext_ctrls(sd, arg);
79 +
80 +       case VIDIOC_TRY_EXT_CTRLS:
81 +               return v4l2_subdev_try_ext_ctrls(sd, arg);
82 +
83         default:
84                 return -ENOIOCTLCMD;
85         }
86 -- 
87 1.6.6.1