diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-08-01 13:32:42 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-08 22:43:03 -0400 |
commit | 0996517cf8eaded69b8502c8f5abeb8cec62b6d4 (patch) | |
tree | 672be97933e8028200eb6718bb49f0ef5c1f4013 /include/media/v4l2-subdev.h | |
parent | 03e30ca5f08e0f9c629204e537ff96b789e6e703 (diff) |
V4L/DVB: v4l2: Add new control handling framework
Add a new framework to handle controls which makes life for driver
developers much easier.
Note that this patch moves some of the control support that used to be in
v4l2-common.c to v4l2-ctrls.c. The tables were copied unchanged. The body
of v4l2_ctrl_query_fill() was copied to a new v4l2_ctrl_fill() function
in v4l2-ctrls.c. This new function doesn't use the v4l2_queryctrl
struct anymore, which makes it more general.
The remainder of v4l2-ctrls.c is all new. Highlights include:
- No need to implement VIDIOC_QUERYCTRL, QUERYMENU, S_CTRL, G_CTRL,
S_EXT_CTRLS, G_EXT_CTRLS or TRY_EXT_CTRLS in either bridge drivers
or subdevs. New wrapper functions are provided that can just be plugged in.
Once everything has been converted these wrapper functions can be removed as well.
- When subdevices are added their controls can be automatically merged
with the bridge driver's controls.
- Most drivers just need to implement s_ctrl to set the controls.
The framework handles the locking and tries to be as 'atomic' as possible.
- Ready for the subdev device nodes: the same mechanism applies to subdevs
and their device nodes as well. Sub-device drivers can make controls
local, preventing them from being merged with bridge drivers.
- Takes care of backwards compatibility handling of VIDIOC_S_CTRL and
VIDIOC_G_CTRL. Handling of V4L2_CID_PRIVATE_BASE is fully transparent.
CTRL_CLASS controls are automatically added.
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'include/media/v4l2-subdev.h')
-rw-r--r-- | include/media/v4l2-subdev.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h index 08880dd15d2f..4a97d7341a94 100644 --- a/include/media/v4l2-subdev.h +++ b/include/media/v4l2-subdev.h | |||
@@ -35,6 +35,7 @@ | |||
35 | #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 | 35 | #define V4L2_SUBDEV_IR_TX_FIFO_SERVICE_REQ 0x00000001 |
36 | 36 | ||
37 | struct v4l2_device; | 37 | struct v4l2_device; |
38 | struct v4l2_ctrl_handler; | ||
38 | struct v4l2_subdev; | 39 | struct v4l2_subdev; |
39 | struct tuner_setup; | 40 | struct tuner_setup; |
40 | 41 | ||
@@ -434,6 +435,8 @@ struct v4l2_subdev { | |||
434 | u32 flags; | 435 | u32 flags; |
435 | struct v4l2_device *v4l2_dev; | 436 | struct v4l2_device *v4l2_dev; |
436 | const struct v4l2_subdev_ops *ops; | 437 | const struct v4l2_subdev_ops *ops; |
438 | /* The control handler of this subdev. May be NULL. */ | ||
439 | struct v4l2_ctrl_handler *ctrl_handler; | ||
437 | /* name must be unique */ | 440 | /* name must be unique */ |
438 | char name[V4L2_SUBDEV_NAME_SIZE]; | 441 | char name[V4L2_SUBDEV_NAME_SIZE]; |
439 | /* can be used to group similar subdevs, value is driver-specific */ | 442 | /* can be used to group similar subdevs, value is driver-specific */ |