aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-01-31 11:57:45 +0100
committerHans Verkuil <hans.verkuil@cisco.com>2014-01-31 11:57:45 +0100
commita92ece8c6e3a080489c849e0246f803db52b0c13 (patch)
tree184fd22864b7f210b90453c474a45105748d6cdb
parent6c5c89ceca18c97a3004015d8fee8d7a7203a0ce (diff)
v4l2-device: add inherit_private_ctrls fieldctrl-priv
Some drivers that implement a simple video pipeline may want to inherit private controls from their subdevs and expose them through the video node. That way there is no need to create v4l-subdev nodes to access the private controls of the sub-devices. Without this drivers are force to either hack the subdev driver to remove the is_private setting, or manually add those controls to the bridge driver. It's the bridge driver that determines whether or not the v4l-subdev nodes are created, so the bridge driver should also be able to control this. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--drivers/media/v4l2-core/v4l2-device.c2
-rw-r--r--include/media/v4l2-device.h10
2 files changed, 10 insertions, 2 deletions
diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c
index 7045cb203f9a..bf1b047ba4b4 100644
--- a/drivers/media/v4l2-core/v4l2-device.c
+++ b/drivers/media/v4l2-core/v4l2-device.c
@@ -170,7 +170,7 @@ int v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
/* This just returns 0 if either of the two args is NULL */
err = v4l2_ctrl_add_handler(v4l2_dev->ctrl_handler, sd->ctrl_handler,
- false, NULL);
+ v4l2_dev->inherit_private_ctrls, NULL);
if (err)
goto error_unregister;
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index c9b1593923f6..8350ce54cf5e 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -56,6 +56,11 @@ struct v4l2_device {
unsigned int notification, void *arg);
/* The control handler. May be NULL. */
struct v4l2_ctrl_handler *ctrl_handler;
+ /*
+ * If true, then when adding controls from a sub-device also
+ * add the private controls. Used in v4l2_device_register_subdev().
+ */
+ bool inherit_private_ctrls;
/* Device's priority state */
struct v4l2_prio_state prio;
/* BKL replacement mutex. Temporary solution only. */
@@ -107,7 +112,10 @@ void v4l2_device_unregister(struct v4l2_device *v4l2_dev);
/* Register a subdev with a v4l2 device. While registered the subdev module
is marked as in-use. An error is returned if the module is no longer
- loaded when you attempt to register it. */
+ loaded when you attempt to register it. The controls of the subdev are
+ automatically added to the control handler defined in v4l2_dev. Depending
+ on the inherit_private_ctrls field of v4l2_dev the private controls of
+ the subdev may also be added. */
int __must_check v4l2_device_register_subdev(struct v4l2_device *v4l2_dev,
struct v4l2_subdev *sd);
/* Unregister a subdev with a v4l2 device. Can also be called if the subdev

Privacy Policy