diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2012-09-07 05:10:12 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-01-04 21:51:52 -0500 |
commit | 50fdf40f696106e0e3c9fa0ee2f6f1457209e81e (patch) | |
tree | 5083a051818326bd01ead0e5bbbf44f1af766608 | |
parent | 69a61642ac60e84647394b4cf0f322579701d218 (diff) |
[media] em28xx: add support for control events
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/usb/em28xx/em28xx-video.c | 38 |
1 files changed, 26 insertions, 12 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index c67ff8d96d22..acdb4340399f 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include "em28xx.h" | 40 | #include "em28xx.h" |
41 | #include <media/v4l2-common.h> | 41 | #include <media/v4l2-common.h> |
42 | #include <media/v4l2-ioctl.h> | 42 | #include <media/v4l2-ioctl.h> |
43 | #include <media/v4l2-event.h> | ||
43 | #include <media/v4l2-chip-ident.h> | 44 | #include <media/v4l2-chip-ident.h> |
44 | #include <media/msp3400.h> | 45 | #include <media/msp3400.h> |
45 | #include <media/tuner.h> | 46 | #include <media/tuner.h> |
@@ -1927,24 +1928,33 @@ em28xx_v4l2_read(struct file *filp, char __user *buf, size_t count, | |||
1927 | static unsigned int em28xx_poll(struct file *filp, poll_table *wait) | 1928 | static unsigned int em28xx_poll(struct file *filp, poll_table *wait) |
1928 | { | 1929 | { |
1929 | struct em28xx_fh *fh = filp->private_data; | 1930 | struct em28xx_fh *fh = filp->private_data; |
1931 | unsigned long req_events = poll_requested_events(wait); | ||
1930 | struct em28xx *dev = fh->dev; | 1932 | struct em28xx *dev = fh->dev; |
1933 | unsigned int res = 0; | ||
1931 | int rc; | 1934 | int rc; |
1932 | 1935 | ||
1933 | rc = check_dev(dev); | 1936 | rc = check_dev(dev); |
1934 | if (rc < 0) | 1937 | if (rc < 0) |
1935 | return rc; | 1938 | return DEFAULT_POLLMASK; |
1936 | 1939 | ||
1937 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { | 1940 | if (v4l2_event_pending(&fh->fh)) |
1938 | if (!res_get(fh, EM28XX_RESOURCE_VIDEO)) | 1941 | res = POLLPRI; |
1939 | return POLLERR; | 1942 | else if (req_events & POLLPRI) |
1940 | return videobuf_poll_stream(filp, &fh->vb_vidq, wait); | 1943 | poll_wait(filp, &fh->fh.wait, wait); |
1941 | } else if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | 1944 | |
1942 | if (!res_get(fh, EM28XX_RESOURCE_VBI)) | 1945 | if (req_events & (POLLIN | POLLRDNORM)) { |
1943 | return POLLERR; | 1946 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) { |
1944 | return videobuf_poll_stream(filp, &fh->vb_vbiq, wait); | 1947 | if (!res_get(fh, EM28XX_RESOURCE_VIDEO)) |
1945 | } else { | 1948 | return res | POLLERR; |
1946 | return POLLERR; | 1949 | return videobuf_poll_stream(filp, &fh->vb_vidq, wait); |
1950 | } | ||
1951 | if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) { | ||
1952 | if (!res_get(fh, EM28XX_RESOURCE_VBI)) | ||
1953 | return res | POLLERR; | ||
1954 | return res | videobuf_poll_stream(filp, &fh->vb_vbiq, wait); | ||
1955 | } | ||
1947 | } | 1956 | } |
1957 | return res; | ||
1948 | } | 1958 | } |
1949 | 1959 | ||
1950 | static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table *wait) | 1960 | static unsigned int em28xx_v4l2_poll(struct file *filp, poll_table *wait) |
@@ -2032,6 +2042,8 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
2032 | .vidioc_s_tuner = vidioc_s_tuner, | 2042 | .vidioc_s_tuner = vidioc_s_tuner, |
2033 | .vidioc_g_frequency = vidioc_g_frequency, | 2043 | .vidioc_g_frequency = vidioc_g_frequency, |
2034 | .vidioc_s_frequency = vidioc_s_frequency, | 2044 | .vidioc_s_frequency = vidioc_s_frequency, |
2045 | .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, | ||
2046 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, | ||
2035 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 2047 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
2036 | .vidioc_g_register = vidioc_g_register, | 2048 | .vidioc_g_register = vidioc_g_register, |
2037 | .vidioc_s_register = vidioc_s_register, | 2049 | .vidioc_s_register = vidioc_s_register, |
@@ -2061,6 +2073,8 @@ static const struct v4l2_ioctl_ops radio_ioctl_ops = { | |||
2061 | .vidioc_s_tuner = radio_s_tuner, | 2073 | .vidioc_s_tuner = radio_s_tuner, |
2062 | .vidioc_g_frequency = vidioc_g_frequency, | 2074 | .vidioc_g_frequency = vidioc_g_frequency, |
2063 | .vidioc_s_frequency = vidioc_s_frequency, | 2075 | .vidioc_s_frequency = vidioc_s_frequency, |
2076 | .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, | ||
2077 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, | ||
2064 | #ifdef CONFIG_VIDEO_ADV_DEBUG | 2078 | #ifdef CONFIG_VIDEO_ADV_DEBUG |
2065 | .vidioc_g_register = vidioc_g_register, | 2079 | .vidioc_g_register = vidioc_g_register, |
2066 | .vidioc_s_register = vidioc_s_register, | 2080 | .vidioc_s_register = vidioc_s_register, |