diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2009-12-09 06:39:54 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-03-21 19:32:42 -0400 |
commit | ea8aa4349e11c62242a8908fc172de27d7a151d7 (patch) | |
tree | b079fb17ea30defa24b394daac41679074a5a690 | |
parent | 3dd5ee0801ee10e5632b40fd8d0495417b32910a (diff) |
[media] v4l: subdev: Control ioctls support
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>
-rw-r--r-- | Documentation/video4linux/v4l2-framework.txt | 16 | ||||
-rw-r--r-- | drivers/media/video/v4l2-subdev.c | 25 |
2 files changed, 41 insertions, 0 deletions
diff --git a/Documentation/video4linux/v4l2-framework.txt b/Documentation/video4linux/v4l2-framework.txt index 8b358710b2f7..1feecfc59c3d 100644 --- a/Documentation/video4linux/v4l2-framework.txt +++ b/Documentation/video4linux/v4l2-framework.txt | |||
@@ -334,6 +334,22 @@ for all registered sub-devices marked with V4L2_SUBDEV_FL_HAS_DEVNODE by calling | |||
334 | v4l2_device_register_subdev_nodes(). Those device nodes will be automatically | 334 | v4l2_device_register_subdev_nodes(). Those device nodes will be automatically |
335 | removed when sub-devices are unregistered. | 335 | removed when sub-devices are unregistered. |
336 | 336 | ||
337 | The device node handles a subset of the V4L2 API. | ||
338 | |||
339 | VIDIOC_QUERYCTRL | ||
340 | VIDIOC_QUERYMENU | ||
341 | VIDIOC_G_CTRL | ||
342 | VIDIOC_S_CTRL | ||
343 | VIDIOC_G_EXT_CTRLS | ||
344 | VIDIOC_S_EXT_CTRLS | ||
345 | VIDIOC_TRY_EXT_CTRLS | ||
346 | |||
347 | The controls ioctls are identical to the ones defined in V4L2. They | ||
348 | behave identically, with the only exception that they deal only with | ||
349 | controls implemented in the sub-device. Depending on the driver, those | ||
350 | controls can be also be accessed through one (or several) V4L2 device | ||
351 | nodes. | ||
352 | |||
337 | 353 | ||
338 | I2C sub-device drivers | 354 | I2C sub-device drivers |
339 | ---------------------- | 355 | ---------------------- |
diff --git a/drivers/media/video/v4l2-subdev.c b/drivers/media/video/v4l2-subdev.c index 460b33697c9b..da10430051c0 100644 --- a/drivers/media/video/v4l2-subdev.c +++ b/drivers/media/video/v4l2-subdev.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/ioctl.h> | 24 | #include <linux/ioctl.h> |
25 | #include <linux/videodev2.h> | 25 | #include <linux/videodev2.h> |
26 | 26 | ||
27 | #include <media/v4l2-ctrls.h> | ||
27 | #include <media/v4l2-device.h> | 28 | #include <media/v4l2-device.h> |
28 | #include <media/v4l2-ioctl.h> | 29 | #include <media/v4l2-ioctl.h> |
29 | 30 | ||
@@ -39,7 +40,31 @@ static int subdev_close(struct file *file) | |||
39 | 40 | ||
40 | static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) | 41 | static long subdev_do_ioctl(struct file *file, unsigned int cmd, void *arg) |
41 | { | 42 | { |
43 | struct video_device *vdev = video_devdata(file); | ||
44 | struct v4l2_subdev *sd = vdev_to_v4l2_subdev(vdev); | ||
45 | |||
42 | switch (cmd) { | 46 | switch (cmd) { |
47 | case VIDIOC_QUERYCTRL: | ||
48 | return v4l2_subdev_queryctrl(sd, arg); | ||
49 | |||
50 | case VIDIOC_QUERYMENU: | ||
51 | return v4l2_subdev_querymenu(sd, arg); | ||
52 | |||
53 | case VIDIOC_G_CTRL: | ||
54 | return v4l2_subdev_g_ctrl(sd, arg); | ||
55 | |||
56 | case VIDIOC_S_CTRL: | ||
57 | return v4l2_subdev_s_ctrl(sd, arg); | ||
58 | |||
59 | case VIDIOC_G_EXT_CTRLS: | ||
60 | return v4l2_subdev_g_ext_ctrls(sd, arg); | ||
61 | |||
62 | case VIDIOC_S_EXT_CTRLS: | ||
63 | return v4l2_subdev_s_ext_ctrls(sd, arg); | ||
64 | |||
65 | case VIDIOC_TRY_EXT_CTRLS: | ||
66 | return v4l2_subdev_try_ext_ctrls(sd, arg); | ||
67 | |||
43 | default: | 68 | default: |
44 | return -ENOIOCTLCMD; | 69 | return -ENOIOCTLCMD; |
45 | } | 70 | } |