diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-01-27 19:18:42 (GMT) |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-02-14 18:38:43 (GMT) |
commit | a26243b0e3726d2b39dc23dd2c8717c52a286af4 (patch) | |
tree | 478ea3c96e683a29a937746c853f5dcf4d323f03 /drivers | |
parent | 42194e728f067cde09a95ce522c108756d44c0be (diff) | |
download | linux-fsl-qoriq-a26243b0e3726d2b39dc23dd2c8717c52a286af4.tar.xz |
[media] v4l2-ctrls: add helper functions for control events
Many drivers just support control events, and most radio drivers just need
to poll for control events. Add some functions to simplify those jobs.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/media/video/v4l2-ctrls.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/drivers/media/video/v4l2-ctrls.c b/drivers/media/video/v4l2-ctrls.c index 7d58e4d..9091172 100644 --- a/drivers/media/video/v4l2-ctrls.c +++ b/drivers/media/video/v4l2-ctrls.c @@ -2394,3 +2394,23 @@ int v4l2_ctrl_log_status(struct file *file, void *fh) return 0; } EXPORT_SYMBOL(v4l2_ctrl_log_status); + +int v4l2_ctrl_subscribe_event(struct v4l2_fh *fh, + struct v4l2_event_subscription *sub) +{ + if (sub->type == V4L2_EVENT_CTRL) + return v4l2_event_subscribe(fh, sub, 0); + return -EINVAL; +} +EXPORT_SYMBOL(v4l2_ctrl_subscribe_event); + +unsigned int v4l2_ctrl_poll(struct file *file, struct poll_table_struct *wait) +{ + struct v4l2_fh *fh = file->private_data; + + if (v4l2_event_pending(fh)) + return POLLPRI; + poll_wait(file, &fh->wait, wait); + return 0; +} +EXPORT_SYMBOL(v4l2_ctrl_poll); |