diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-03-27 13:10:13 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-05-19 11:58:08 -0400 |
commit | 092501936fc128992456a086193746cf34642815 (patch) | |
tree | 6a6910b3fd4f9a1304adfb5af1a4e7a96085960d /drivers/media/video/ivtv/ivtv-ioctl.c | |
parent | 1bcaf4bd53872e70c4fceec6bbb76044325f337f (diff) |
V4L/DVB: ivtv: support the new events API
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-ioctl.c')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 6422cf8f189d..e95ebdeaa72f 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <media/saa7127.h> | 35 | #include <media/saa7127.h> |
36 | #include <media/tveeprom.h> | 36 | #include <media/tveeprom.h> |
37 | #include <media/v4l2-chip-ident.h> | 37 | #include <media/v4l2-chip-ident.h> |
38 | #include <media/v4l2-event.h> | ||
38 | #include <linux/dvb/audio.h> | 39 | #include <linux/dvb/audio.h> |
39 | #include <linux/i2c-id.h> | 40 | #include <linux/i2c-id.h> |
40 | 41 | ||
@@ -1452,6 +1453,18 @@ static int ivtv_overlay(struct file *file, void *fh, unsigned int on) | |||
1452 | return 0; | 1453 | return 0; |
1453 | } | 1454 | } |
1454 | 1455 | ||
1456 | static int ivtv_subscribe_event(struct v4l2_fh *fh, struct v4l2_event_subscription *sub) | ||
1457 | { | ||
1458 | switch (sub->type) { | ||
1459 | case V4L2_EVENT_VSYNC: | ||
1460 | case V4L2_EVENT_EOS: | ||
1461 | break; | ||
1462 | default: | ||
1463 | return -EINVAL; | ||
1464 | } | ||
1465 | return v4l2_event_subscribe(fh, sub); | ||
1466 | } | ||
1467 | |||
1455 | static int ivtv_log_status(struct file *file, void *fh) | 1468 | static int ivtv_log_status(struct file *file, void *fh) |
1456 | { | 1469 | { |
1457 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 1470 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; |
@@ -1560,7 +1573,7 @@ static int ivtv_log_status(struct file *file, void *fh) | |||
1560 | 1573 | ||
1561 | static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) | 1574 | static int ivtv_decoder_ioctls(struct file *filp, unsigned int cmd, void *arg) |
1562 | { | 1575 | { |
1563 | struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; | 1576 | struct ivtv_open_id *id = fh2id(filp->private_data); |
1564 | struct ivtv *itv = id->itv; | 1577 | struct ivtv *itv = id->itv; |
1565 | int nonblocking = filp->f_flags & O_NONBLOCK; | 1578 | int nonblocking = filp->f_flags & O_NONBLOCK; |
1566 | struct ivtv_stream *s = &itv->streams[id->type]; | 1579 | struct ivtv_stream *s = &itv->streams[id->type]; |
@@ -1820,7 +1833,7 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, | |||
1820 | unsigned int cmd, unsigned long arg) | 1833 | unsigned int cmd, unsigned long arg) |
1821 | { | 1834 | { |
1822 | struct video_device *vfd = video_devdata(filp); | 1835 | struct video_device *vfd = video_devdata(filp); |
1823 | struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; | 1836 | struct ivtv_open_id *id = fh2id(filp->private_data); |
1824 | long ret; | 1837 | long ret; |
1825 | 1838 | ||
1826 | /* check priority */ | 1839 | /* check priority */ |
@@ -1852,10 +1865,13 @@ static long ivtv_serialized_ioctl(struct ivtv *itv, struct file *filp, | |||
1852 | 1865 | ||
1853 | long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | 1866 | long ivtv_v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
1854 | { | 1867 | { |
1855 | struct ivtv_open_id *id = (struct ivtv_open_id *)filp->private_data; | 1868 | struct ivtv_open_id *id = fh2id(filp->private_data); |
1856 | struct ivtv *itv = id->itv; | 1869 | struct ivtv *itv = id->itv; |
1857 | long res; | 1870 | long res; |
1858 | 1871 | ||
1872 | /* DQEVENT can block, so this should not run with the serialize lock */ | ||
1873 | if (cmd == VIDIOC_DQEVENT) | ||
1874 | return ivtv_serialized_ioctl(itv, filp, cmd, arg); | ||
1859 | mutex_lock(&itv->serialize_lock); | 1875 | mutex_lock(&itv->serialize_lock); |
1860 | res = ivtv_serialized_ioctl(itv, filp, cmd, arg); | 1876 | res = ivtv_serialized_ioctl(itv, filp, cmd, arg); |
1861 | mutex_unlock(&itv->serialize_lock); | 1877 | mutex_unlock(&itv->serialize_lock); |
@@ -1926,6 +1942,8 @@ static const struct v4l2_ioctl_ops ivtv_ioctl_ops = { | |||
1926 | .vidioc_g_ext_ctrls = ivtv_g_ext_ctrls, | 1942 | .vidioc_g_ext_ctrls = ivtv_g_ext_ctrls, |
1927 | .vidioc_s_ext_ctrls = ivtv_s_ext_ctrls, | 1943 | .vidioc_s_ext_ctrls = ivtv_s_ext_ctrls, |
1928 | .vidioc_try_ext_ctrls = ivtv_try_ext_ctrls, | 1944 | .vidioc_try_ext_ctrls = ivtv_try_ext_ctrls, |
1945 | .vidioc_subscribe_event = ivtv_subscribe_event, | ||
1946 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, | ||
1929 | }; | 1947 | }; |
1930 | 1948 | ||
1931 | void ivtv_set_funcs(struct video_device *vdev) | 1949 | void ivtv_set_funcs(struct video_device *vdev) |