diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2013-12-14 06:28:28 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-01-07 04:37:39 -0500 |
commit | a2004502919cce151ee6774378294000b587e4e3 (patch) | |
tree | 6d596527b2f1283a1441aa287f829219a0fabf4d /drivers/media/pci | |
parent | ce791139ec7f0e5878221dba8d5773e27bf057d3 (diff) |
[media] saa7134: add support for control events
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/pci')
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-empress.c | 19 | ||||
-rw-r--r-- | drivers/media/pci/saa7134/saa7134-video.c | 32 |
2 files changed, 38 insertions, 13 deletions
diff --git a/drivers/media/pci/saa7134/saa7134-empress.c b/drivers/media/pci/saa7134/saa7134-empress.c index 2ef670d05bda..a0af5c74eab5 100644 --- a/drivers/media/pci/saa7134/saa7134-empress.c +++ b/drivers/media/pci/saa7134/saa7134-empress.c | |||
@@ -23,11 +23,12 @@ | |||
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
25 | 25 | ||
26 | #include "saa7134-reg.h" | ||
27 | #include "saa7134.h" | ||
28 | |||
29 | #include <media/saa6752hs.h> | 26 | #include <media/saa6752hs.h> |
30 | #include <media/v4l2-common.h> | 27 | #include <media/v4l2-common.h> |
28 | #include <media/v4l2-event.h> | ||
29 | |||
30 | #include "saa7134-reg.h" | ||
31 | #include "saa7134.h" | ||
31 | 32 | ||
32 | /* ------------------------------------------------------------------ */ | 33 | /* ------------------------------------------------------------------ */ |
33 | 34 | ||
@@ -144,9 +145,16 @@ ts_read(struct file *file, char __user *data, size_t count, loff_t *ppos) | |||
144 | static unsigned int | 145 | static unsigned int |
145 | ts_poll(struct file *file, struct poll_table_struct *wait) | 146 | ts_poll(struct file *file, struct poll_table_struct *wait) |
146 | { | 147 | { |
148 | unsigned long req_events = poll_requested_events(wait); | ||
147 | struct saa7134_dev *dev = video_drvdata(file); | 149 | struct saa7134_dev *dev = video_drvdata(file); |
150 | struct saa7134_fh *fh = file->private_data; | ||
151 | unsigned int rc = 0; | ||
148 | 152 | ||
149 | return videobuf_poll_stream(file, &dev->empress_tsq, wait); | 153 | if (v4l2_event_pending(&fh->fh)) |
154 | rc = POLLPRI; | ||
155 | else if (req_events & POLLPRI) | ||
156 | poll_wait(file, &fh->fh.wait, wait); | ||
157 | return rc | videobuf_poll_stream(file, &dev->empress_tsq, wait); | ||
150 | } | 158 | } |
151 | 159 | ||
152 | 160 | ||
@@ -255,6 +263,9 @@ static const struct v4l2_ioctl_ops ts_ioctl_ops = { | |||
255 | .vidioc_s_input = saa7134_s_input, | 263 | .vidioc_s_input = saa7134_s_input, |
256 | .vidioc_s_std = saa7134_s_std, | 264 | .vidioc_s_std = saa7134_s_std, |
257 | .vidioc_g_std = saa7134_g_std, | 265 | .vidioc_g_std = saa7134_g_std, |
266 | .vidioc_log_status = v4l2_ctrl_log_status, | ||
267 | .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, | ||
268 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, | ||
258 | }; | 269 | }; |
259 | 270 | ||
260 | /* ----------------------------------------------------------- */ | 271 | /* ----------------------------------------------------------- */ |
diff --git a/drivers/media/pci/saa7134/saa7134-video.c b/drivers/media/pci/saa7134/saa7134-video.c index 5e2d61c1cf3d..5cf9cc6c0e6e 100644 --- a/drivers/media/pci/saa7134/saa7134-video.c +++ b/drivers/media/pci/saa7134/saa7134-video.c | |||
@@ -27,11 +27,13 @@ | |||
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/sort.h> | 28 | #include <linux/sort.h> |
29 | 29 | ||
30 | #include "saa7134-reg.h" | ||
31 | #include "saa7134.h" | ||
32 | #include <media/v4l2-common.h> | 30 | #include <media/v4l2-common.h> |
31 | #include <media/v4l2-event.h> | ||
33 | #include <media/saa6588.h> | 32 | #include <media/saa6588.h> |
34 | 33 | ||
34 | #include "saa7134-reg.h" | ||
35 | #include "saa7134.h" | ||
36 | |||
35 | /* ------------------------------------------------------------------ */ | 37 | /* ------------------------------------------------------------------ */ |
36 | 38 | ||
37 | unsigned int video_debug; | 39 | unsigned int video_debug; |
@@ -1169,14 +1171,20 @@ video_read(struct file *file, char __user *data, size_t count, loff_t *ppos) | |||
1169 | static unsigned int | 1171 | static unsigned int |
1170 | video_poll(struct file *file, struct poll_table_struct *wait) | 1172 | video_poll(struct file *file, struct poll_table_struct *wait) |
1171 | { | 1173 | { |
1174 | unsigned long req_events = poll_requested_events(wait); | ||
1172 | struct video_device *vdev = video_devdata(file); | 1175 | struct video_device *vdev = video_devdata(file); |
1173 | struct saa7134_dev *dev = video_drvdata(file); | 1176 | struct saa7134_dev *dev = video_drvdata(file); |
1174 | struct saa7134_fh *fh = file->private_data; | 1177 | struct saa7134_fh *fh = file->private_data; |
1175 | struct videobuf_buffer *buf = NULL; | 1178 | struct videobuf_buffer *buf = NULL; |
1176 | unsigned int rc = 0; | 1179 | unsigned int rc = 0; |
1177 | 1180 | ||
1181 | if (v4l2_event_pending(&fh->fh)) | ||
1182 | rc = POLLPRI; | ||
1183 | else if (req_events & POLLPRI) | ||
1184 | poll_wait(file, &fh->fh.wait, wait); | ||
1185 | |||
1178 | if (vdev->vfl_type == VFL_TYPE_VBI) | 1186 | if (vdev->vfl_type == VFL_TYPE_VBI) |
1179 | return videobuf_poll_stream(file, &dev->vbi, wait); | 1187 | return rc | videobuf_poll_stream(file, &dev->vbi, wait); |
1180 | 1188 | ||
1181 | if (res_check(fh, RESOURCE_VIDEO)) { | 1189 | if (res_check(fh, RESOURCE_VIDEO)) { |
1182 | mutex_lock(&dev->cap.vb_lock); | 1190 | mutex_lock(&dev->cap.vb_lock); |
@@ -1201,15 +1209,14 @@ video_poll(struct file *file, struct poll_table_struct *wait) | |||
1201 | goto err; | 1209 | goto err; |
1202 | 1210 | ||
1203 | poll_wait(file, &buf->done, wait); | 1211 | poll_wait(file, &buf->done, wait); |
1204 | if (buf->state == VIDEOBUF_DONE || | 1212 | if (buf->state == VIDEOBUF_DONE || buf->state == VIDEOBUF_ERROR) |
1205 | buf->state == VIDEOBUF_ERROR) | 1213 | rc |= POLLIN | POLLRDNORM; |
1206 | rc = POLLIN|POLLRDNORM; | ||
1207 | mutex_unlock(&dev->cap.vb_lock); | 1214 | mutex_unlock(&dev->cap.vb_lock); |
1208 | return rc; | 1215 | return rc; |
1209 | 1216 | ||
1210 | err: | 1217 | err: |
1211 | mutex_unlock(&dev->cap.vb_lock); | 1218 | mutex_unlock(&dev->cap.vb_lock); |
1212 | return POLLERR; | 1219 | return rc | POLLERR; |
1213 | } | 1220 | } |
1214 | 1221 | ||
1215 | static int video_release(struct file *file) | 1222 | static int video_release(struct file *file) |
@@ -1291,13 +1298,14 @@ static unsigned int radio_poll(struct file *file, poll_table *wait) | |||
1291 | { | 1298 | { |
1292 | struct saa7134_dev *dev = video_drvdata(file); | 1299 | struct saa7134_dev *dev = video_drvdata(file); |
1293 | struct saa6588_command cmd; | 1300 | struct saa6588_command cmd; |
1301 | unsigned int rc = v4l2_ctrl_poll(file, wait); | ||
1294 | 1302 | ||
1295 | cmd.instance = file; | 1303 | cmd.instance = file; |
1296 | cmd.event_list = wait; | 1304 | cmd.event_list = wait; |
1297 | cmd.result = -ENODEV; | 1305 | cmd.result = 0; |
1298 | saa_call_all(dev, core, ioctl, SAA6588_CMD_POLL, &cmd); | 1306 | saa_call_all(dev, core, ioctl, SAA6588_CMD_POLL, &cmd); |
1299 | 1307 | ||
1300 | return cmd.result; | 1308 | return rc | cmd.result; |
1301 | } | 1309 | } |
1302 | 1310 | ||
1303 | /* ------------------------------------------------------------------ */ | 1311 | /* ------------------------------------------------------------------ */ |
@@ -2097,6 +2105,9 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
2097 | .vidioc_g_register = vidioc_g_register, | 2105 | .vidioc_g_register = vidioc_g_register, |
2098 | .vidioc_s_register = vidioc_s_register, | 2106 | .vidioc_s_register = vidioc_s_register, |
2099 | #endif | 2107 | #endif |
2108 | .vidioc_log_status = v4l2_ctrl_log_status, | ||
2109 | .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, | ||
2110 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, | ||
2100 | }; | 2111 | }; |
2101 | 2112 | ||
2102 | static const struct v4l2_file_operations radio_fops = { | 2113 | static const struct v4l2_file_operations radio_fops = { |
@@ -2114,6 +2125,9 @@ static const struct v4l2_ioctl_ops radio_ioctl_ops = { | |||
2114 | .vidioc_s_tuner = radio_s_tuner, | 2125 | .vidioc_s_tuner = radio_s_tuner, |
2115 | .vidioc_g_frequency = saa7134_g_frequency, | 2126 | .vidioc_g_frequency = saa7134_g_frequency, |
2116 | .vidioc_s_frequency = saa7134_s_frequency, | 2127 | .vidioc_s_frequency = saa7134_s_frequency, |
2128 | .vidioc_log_status = v4l2_ctrl_log_status, | ||
2129 | .vidioc_subscribe_event = v4l2_ctrl_subscribe_event, | ||
2130 | .vidioc_unsubscribe_event = v4l2_event_unsubscribe, | ||
2117 | }; | 2131 | }; |
2118 | 2132 | ||
2119 | /* ----------------------------------------------------------- */ | 2133 | /* ----------------------------------------------------------- */ |