diff options
Diffstat (limited to 'include/media')
-rw-r--r-- | include/media/v4l2-ctrls.h | 23 | ||||
-rw-r--r-- | include/media/v4l2-event.h | 2 |
2 files changed, 20 insertions, 5 deletions
diff --git a/include/media/v4l2-ctrls.h b/include/media/v4l2-ctrls.h index e720f11a56fd..c45bf40e080d 100644 --- a/include/media/v4l2-ctrls.h +++ b/include/media/v4l2-ctrls.h @@ -28,9 +28,10 @@ /* forward references */ struct v4l2_ctrl_handler; struct v4l2_ctrl; -struct v4l2_fh; struct video_device; struct v4l2_subdev; +struct v4l2_event_subscription; +struct v4l2_fh; /** struct v4l2_ctrl_ops - The control operations that the driver has to provide. * @g_volatile_ctrl: Get a new value for this control. Generally only relevant @@ -107,6 +108,7 @@ struct v4l2_ctrl_ops { struct v4l2_ctrl { /* Administrative fields */ struct list_head node; + struct list_head fhs; struct v4l2_ctrl_handler *handler; struct v4l2_ctrl **cluster; unsigned ncontrols; @@ -180,6 +182,11 @@ struct v4l2_ctrl_handler { int error; }; +struct v4l2_ctrl_fh { + struct list_head node; + struct v4l2_fh *fh; +}; + /** struct v4l2_ctrl_config - Control configuration structure. * @ops: The control ops. * @id: The control ID. @@ -425,9 +432,9 @@ struct v4l2_ctrl *v4l2_ctrl_find(struct v4l2_ctrl_handler *hdl, u32 id); * This sets or clears the V4L2_CTRL_FLAG_INACTIVE flag atomically. * Does nothing if @ctrl == NULL. * This will usually be called from within the s_ctrl op. + * The V4L2_EVENT_CTRL event will be generated afterwards. * - * This function can be called regardless of whether the control handler - * is locked or not. + * This function assumes that the control handler is locked. */ void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); @@ -437,11 +444,12 @@ void v4l2_ctrl_activate(struct v4l2_ctrl *ctrl, bool active); * * This sets or clears the V4L2_CTRL_FLAG_GRABBED flag atomically. * Does nothing if @ctrl == NULL. + * The V4L2_EVENT_CTRL event will be generated afterwards. * This will usually be called when starting or stopping streaming in the * driver. * - * This function can be called regardless of whether the control handler - * is locked or not. + * This function assumes that the control handler is not locked and will + * take the lock itself. */ void v4l2_ctrl_grab(struct v4l2_ctrl *ctrl, bool grabbed); @@ -486,6 +494,11 @@ s32 v4l2_ctrl_g_ctrl(struct v4l2_ctrl *ctrl); */ int v4l2_ctrl_s_ctrl(struct v4l2_ctrl *ctrl, s32 val); +void v4l2_ctrl_add_fh(struct v4l2_ctrl_handler *hdl, + struct v4l2_ctrl_fh *ctrl_fh, + struct v4l2_event_subscription *sub); +void v4l2_ctrl_del_fh(struct v4l2_ctrl *ctrl, struct v4l2_fh *fh); + /* Helpers for ioctl_ops. If hdl == NULL then they will all return -EINVAL. */ int v4l2_queryctrl(struct v4l2_ctrl_handler *hdl, struct v4l2_queryctrl *qc); int v4l2_querymenu(struct v4l2_ctrl_handler *hdl, struct v4l2_querymenu *qm); diff --git a/include/media/v4l2-event.h b/include/media/v4l2-event.h index 3b86177c8cd2..45e9c1e05513 100644 --- a/include/media/v4l2-event.h +++ b/include/media/v4l2-event.h @@ -40,6 +40,7 @@ struct v4l2_kevent { struct v4l2_subscribed_event { struct list_head list; u32 type; + u32 id; }; struct v4l2_events { @@ -58,6 +59,7 @@ void v4l2_event_free(struct v4l2_fh *fh); int v4l2_event_dequeue(struct v4l2_fh *fh, struct v4l2_event *event, int nonblocking); void v4l2_event_queue(struct video_device *vdev, const struct v4l2_event *ev); +void v4l2_event_queue_fh(struct v4l2_fh *fh, const struct v4l2_event *ev); int v4l2_event_pending(struct v4l2_fh *fh); int v4l2_event_subscribe(struct v4l2_fh *fh, struct v4l2_event_subscription *sub); |