diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-12-24 08:33:19 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-29 05:17:07 -0500 |
commit | 08af245de0cf6ab5f4ed008ee2bb99273774fce0 (patch) | |
tree | d07a9b38eb4b9442ef0e935063a5f7f40248e19e /drivers/media | |
parent | b69a219e0e97441dbeb0262cf85468b61a161399 (diff) |
[media] V4L: remove V4L1 compatibility mode
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
23 files changed, 4 insertions, 2017 deletions
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index c21dfc28482e..9ea1a6d70f0a 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -53,21 +53,6 @@ config VIDEO_ALLOW_V4L1 | |||
53 | 53 | ||
54 | If you are unsure as to whether this is required, answer Y. | 54 | If you are unsure as to whether this is required, answer Y. |
55 | 55 | ||
56 | config VIDEO_V4L1_COMPAT | ||
57 | bool "Enable Video For Linux API 1 compatible Layer" if !VIDEO_ALLOW_V4L1 | ||
58 | depends on VIDEO_DEV | ||
59 | default y | ||
60 | ---help--- | ||
61 | Enables a compatibility API used by most V4L2 devices to allow | ||
62 | its usage with legacy applications that supports only V4L1 api. | ||
63 | |||
64 | Documentation for the original API is included in the file | ||
65 | <Documentation/video4linux/API.html>. | ||
66 | |||
67 | User tools for this are available from | ||
68 | <ftp://ftp.uk.linux.org/pub/linux/video4linux/>. | ||
69 | |||
70 | If you are unsure as to whether this is required, answer Y. | ||
71 | 56 | ||
72 | # | 57 | # |
73 | # DVB Core | 58 | # DVB Core |
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index d246910129e8..0ac5c619aecf 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -1129,35 +1129,6 @@ static int vidioc_g_chip_ident(struct file *file, void *__fh, | |||
1129 | core, g_chip_ident, chip); | 1129 | core, g_chip_ident, chip); |
1130 | } | 1130 | } |
1131 | 1131 | ||
1132 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1133 | static int vidiocgmbuf(struct file *file, void *__fh, struct video_mbuf *mbuf) | ||
1134 | { | ||
1135 | struct saa7146_fh *fh = __fh; | ||
1136 | struct videobuf_queue *q = &fh->video_q; | ||
1137 | int err, i; | ||
1138 | |||
1139 | /* fixme: number of capture buffers and sizes for v4l apps */ | ||
1140 | int gbuffers = 2; | ||
1141 | int gbufsize = 768 * 576 * 4; | ||
1142 | |||
1143 | DEB_D(("VIDIOCGMBUF \n")); | ||
1144 | |||
1145 | q = &fh->video_q; | ||
1146 | err = videobuf_mmap_setup(q, gbuffers, gbufsize, | ||
1147 | V4L2_MEMORY_MMAP); | ||
1148 | if (err < 0) | ||
1149 | return err; | ||
1150 | |||
1151 | gbuffers = err; | ||
1152 | memset(mbuf, 0, sizeof(*mbuf)); | ||
1153 | mbuf->frames = gbuffers; | ||
1154 | mbuf->size = gbuffers * gbufsize; | ||
1155 | for (i = 0; i < gbuffers; i++) | ||
1156 | mbuf->offsets[i] = i * gbufsize; | ||
1157 | return 0; | ||
1158 | } | ||
1159 | #endif | ||
1160 | |||
1161 | const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = { | 1132 | const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = { |
1162 | .vidioc_querycap = vidioc_querycap, | 1133 | .vidioc_querycap = vidioc_querycap, |
1163 | .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, | 1134 | .vidioc_enum_fmt_vid_cap = vidioc_enum_fmt_vid_cap, |
@@ -1186,9 +1157,6 @@ const struct v4l2_ioctl_ops saa7146_video_ioctl_ops = { | |||
1186 | .vidioc_streamon = vidioc_streamon, | 1157 | .vidioc_streamon = vidioc_streamon, |
1187 | .vidioc_streamoff = vidioc_streamoff, | 1158 | .vidioc_streamoff = vidioc_streamoff, |
1188 | .vidioc_g_parm = vidioc_g_parm, | 1159 | .vidioc_g_parm = vidioc_g_parm, |
1189 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1190 | .vidiocgmbuf = vidiocgmbuf, | ||
1191 | #endif | ||
1192 | }; | 1160 | }; |
1193 | 1161 | ||
1194 | /*********************************************************************************/ | 1162 | /*********************************************************************************/ |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index 482f14b3ff84..ace7b6eaf5b8 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -22,10 +22,6 @@ endif | |||
22 | 22 | ||
23 | obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o | 23 | obj-$(CONFIG_VIDEO_V4L2_COMMON) += v4l2-common.o |
24 | 24 | ||
25 | ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) | ||
26 | obj-$(CONFIG_VIDEO_DEV) += v4l1-compat.o | ||
27 | endif | ||
28 | |||
29 | # All i2c modules must come first: | 25 | # All i2c modules must come first: |
30 | 26 | ||
31 | obj-$(CONFIG_VIDEO_TUNER) += tuner.o | 27 | obj-$(CONFIG_VIDEO_TUNER) += tuner.o |
diff --git a/drivers/media/video/au0828/au0828-video.c b/drivers/media/video/au0828/au0828-video.c index 48682af911fa..e41e4ad5cc40 100644 --- a/drivers/media/video/au0828/au0828-video.c +++ b/drivers/media/video/au0828/au0828-video.c | |||
@@ -1809,15 +1809,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) | |||
1809 | return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); | 1809 | return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); |
1810 | } | 1810 | } |
1811 | 1811 | ||
1812 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1813 | static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | ||
1814 | { | ||
1815 | struct au0828_fh *fh = priv; | ||
1816 | |||
1817 | return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); | ||
1818 | } | ||
1819 | #endif | ||
1820 | |||
1821 | static struct v4l2_file_operations au0828_v4l_fops = { | 1812 | static struct v4l2_file_operations au0828_v4l_fops = { |
1822 | .owner = THIS_MODULE, | 1813 | .owner = THIS_MODULE, |
1823 | .open = au0828_v4l2_open, | 1814 | .open = au0828_v4l2_open, |
@@ -1861,9 +1852,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
1861 | .vidioc_s_register = vidioc_s_register, | 1852 | .vidioc_s_register = vidioc_s_register, |
1862 | #endif | 1853 | #endif |
1863 | .vidioc_g_chip_ident = vidioc_g_chip_ident, | 1854 | .vidioc_g_chip_ident = vidioc_g_chip_ident, |
1864 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1865 | .vidiocgmbuf = vidiocgmbuf, | ||
1866 | #endif | ||
1867 | }; | 1855 | }; |
1868 | 1856 | ||
1869 | static const struct video_device au0828_video_template = { | 1857 | static const struct video_device au0828_video_template = { |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 54fbab95b88c..961d0805d877 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -2597,31 +2597,6 @@ static int bttv_s_fmt_vid_overlay(struct file *file, void *priv, | |||
2597 | return setup_window_lock(fh, btv, &f->fmt.win, 1); | 2597 | return setup_window_lock(fh, btv, &f->fmt.win, 1); |
2598 | } | 2598 | } |
2599 | 2599 | ||
2600 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
2601 | static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | ||
2602 | { | ||
2603 | int retval; | ||
2604 | unsigned int i; | ||
2605 | struct bttv_fh *fh = priv; | ||
2606 | |||
2607 | retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, | ||
2608 | V4L2_MEMORY_MMAP); | ||
2609 | if (retval < 0) { | ||
2610 | return retval; | ||
2611 | } | ||
2612 | |||
2613 | gbuffers = retval; | ||
2614 | memset(mbuf, 0, sizeof(*mbuf)); | ||
2615 | mbuf->frames = gbuffers; | ||
2616 | mbuf->size = gbuffers * gbufsize; | ||
2617 | |||
2618 | for (i = 0; i < gbuffers; i++) | ||
2619 | mbuf->offsets[i] = i * gbufsize; | ||
2620 | |||
2621 | return 0; | ||
2622 | } | ||
2623 | #endif | ||
2624 | |||
2625 | static int bttv_querycap(struct file *file, void *priv, | 2600 | static int bttv_querycap(struct file *file, void *priv, |
2626 | struct v4l2_capability *cap) | 2601 | struct v4l2_capability *cap) |
2627 | { | 2602 | { |
@@ -3354,9 +3329,6 @@ static const struct v4l2_ioctl_ops bttv_ioctl_ops = { | |||
3354 | .vidioc_streamoff = bttv_streamoff, | 3329 | .vidioc_streamoff = bttv_streamoff, |
3355 | .vidioc_g_tuner = bttv_g_tuner, | 3330 | .vidioc_g_tuner = bttv_g_tuner, |
3356 | .vidioc_s_tuner = bttv_s_tuner, | 3331 | .vidioc_s_tuner = bttv_s_tuner, |
3357 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
3358 | .vidiocgmbuf = vidiocgmbuf, | ||
3359 | #endif | ||
3360 | .vidioc_g_crop = bttv_g_crop, | 3332 | .vidioc_g_crop = bttv_g_crop, |
3361 | .vidioc_s_crop = bttv_s_crop, | 3333 | .vidioc_s_crop = bttv_s_crop, |
3362 | .vidioc_g_fbuf = bttv_g_fbuf, | 3334 | .vidioc_g_fbuf = bttv_g_fbuf, |
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 46b433bbf2c1..7edf80b0d01a 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c | |||
@@ -419,28 +419,6 @@ static int sync(struct camera_data *cam, int frame_nr) | |||
419 | 419 | ||
420 | /****************************************************************************** | 420 | /****************************************************************************** |
421 | * | 421 | * |
422 | * ioctl_get_mbuf | ||
423 | * | ||
424 | *****************************************************************************/ | ||
425 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
426 | static int ioctl_get_mbuf(void *arg, struct camera_data *cam) | ||
427 | { | ||
428 | struct video_mbuf *vm; | ||
429 | int i; | ||
430 | vm = arg; | ||
431 | |||
432 | memset(vm, 0, sizeof(*vm)); | ||
433 | vm->size = cam->frame_size*cam->num_frames; | ||
434 | vm->frames = cam->num_frames; | ||
435 | for (i = 0; i < cam->num_frames; i++) | ||
436 | vm->offsets[i] = cam->frame_size * i; | ||
437 | |||
438 | return 0; | ||
439 | } | ||
440 | #endif | ||
441 | |||
442 | /****************************************************************************** | ||
443 | * | ||
444 | * ioctl_set_gpio | 422 | * ioctl_set_gpio |
445 | * | 423 | * |
446 | *****************************************************************************/ | 424 | *****************************************************************************/ |
@@ -1380,17 +1358,6 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
1380 | } | 1358 | } |
1381 | break; | 1359 | break; |
1382 | } | 1360 | } |
1383 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1384 | case VIDIOCGMBUF: | ||
1385 | { | ||
1386 | struct cpia2_fh *fh = file->private_data; | ||
1387 | if(fh->prio != V4L2_PRIORITY_RECORD) { | ||
1388 | mutex_unlock(&cam->busy_lock); | ||
1389 | return -EBUSY; | ||
1390 | } | ||
1391 | break; | ||
1392 | } | ||
1393 | #endif | ||
1394 | default: | 1361 | default: |
1395 | break; | 1362 | break; |
1396 | } | 1363 | } |
@@ -1400,11 +1367,6 @@ static long cpia2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
1400 | case CPIA2_IOC_SET_GPIO: | 1367 | case CPIA2_IOC_SET_GPIO: |
1401 | retval = ioctl_set_gpio(arg, cam); | 1368 | retval = ioctl_set_gpio(arg, cam); |
1402 | break; | 1369 | break; |
1403 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1404 | case VIDIOCGMBUF: /* mmap interface */ | ||
1405 | retval = ioctl_get_mbuf(arg, cam); | ||
1406 | break; | ||
1407 | #endif | ||
1408 | case VIDIOC_QUERYCAP: | 1370 | case VIDIOC_QUERYCAP: |
1409 | retval = ioctl_querycap(arg,cam); | 1371 | retval = ioctl_querycap(arg,cam); |
1410 | break; | 1372 | break; |
diff --git a/drivers/media/video/cx231xx/cx231xx-video.c b/drivers/media/video/cx231xx/cx231xx-video.c index b13b69fb2af6..7e3e8c4f19b7 100644 --- a/drivers/media/video/cx231xx/cx231xx-video.c +++ b/drivers/media/video/cx231xx/cx231xx-video.c | |||
@@ -2044,15 +2044,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) | |||
2044 | return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); | 2044 | return videobuf_dqbuf(&fh->vb_vidq, b, file->f_flags & O_NONBLOCK); |
2045 | } | 2045 | } |
2046 | 2046 | ||
2047 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
2048 | static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | ||
2049 | { | ||
2050 | struct cx231xx_fh *fh = priv; | ||
2051 | |||
2052 | return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); | ||
2053 | } | ||
2054 | #endif | ||
2055 | |||
2056 | /* ----------------------------------------------------------- */ | 2047 | /* ----------------------------------------------------------- */ |
2057 | /* RADIO ESPECIFIC IOCTLS */ | 2048 | /* RADIO ESPECIFIC IOCTLS */ |
2058 | /* ----------------------------------------------------------- */ | 2049 | /* ----------------------------------------------------------- */ |
@@ -2507,9 +2498,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
2507 | .vidioc_g_register = vidioc_g_register, | 2498 | .vidioc_g_register = vidioc_g_register, |
2508 | .vidioc_s_register = vidioc_s_register, | 2499 | .vidioc_s_register = vidioc_s_register, |
2509 | #endif | 2500 | #endif |
2510 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
2511 | .vidiocgmbuf = vidiocgmbuf, | ||
2512 | #endif | ||
2513 | }; | 2501 | }; |
2514 | 2502 | ||
2515 | static struct video_device cx231xx_vbi_template; | 2503 | static struct video_device cx231xx_vbi_template; |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 8b2fb8a4375c..796a797b5205 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -1024,35 +1024,6 @@ static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, | |||
1024 | return 0; | 1024 | return 0; |
1025 | } | 1025 | } |
1026 | 1026 | ||
1027 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1028 | static int vidiocgmbuf(struct file *file, void *priv, | ||
1029 | struct video_mbuf *mbuf) | ||
1030 | { | ||
1031 | struct cx23885_fh *fh = priv; | ||
1032 | struct videobuf_queue *q; | ||
1033 | struct v4l2_requestbuffers req; | ||
1034 | unsigned int i; | ||
1035 | int err; | ||
1036 | |||
1037 | q = get_queue(fh); | ||
1038 | memset(&req, 0, sizeof(req)); | ||
1039 | req.type = q->type; | ||
1040 | req.count = 8; | ||
1041 | req.memory = V4L2_MEMORY_MMAP; | ||
1042 | err = videobuf_reqbufs(q, &req); | ||
1043 | if (err < 0) | ||
1044 | return err; | ||
1045 | |||
1046 | mbuf->frames = req.count; | ||
1047 | mbuf->size = 0; | ||
1048 | for (i = 0; i < mbuf->frames; i++) { | ||
1049 | mbuf->offsets[i] = q->bufs[i]->boff; | ||
1050 | mbuf->size += q->bufs[i]->bsize; | ||
1051 | } | ||
1052 | return 0; | ||
1053 | } | ||
1054 | #endif | ||
1055 | |||
1056 | static int vidioc_reqbufs(struct file *file, void *priv, | 1027 | static int vidioc_reqbufs(struct file *file, void *priv, |
1057 | struct v4l2_requestbuffers *p) | 1028 | struct v4l2_requestbuffers *p) |
1058 | { | 1029 | { |
@@ -1427,9 +1398,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
1427 | .vidioc_s_ctrl = vidioc_s_ctrl, | 1398 | .vidioc_s_ctrl = vidioc_s_ctrl, |
1428 | .vidioc_streamon = vidioc_streamon, | 1399 | .vidioc_streamon = vidioc_streamon, |
1429 | .vidioc_streamoff = vidioc_streamoff, | 1400 | .vidioc_streamoff = vidioc_streamoff, |
1430 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1431 | .vidiocgmbuf = vidiocgmbuf, | ||
1432 | #endif | ||
1433 | .vidioc_g_tuner = vidioc_g_tuner, | 1401 | .vidioc_g_tuner = vidioc_g_tuner, |
1434 | .vidioc_s_tuner = vidioc_s_tuner, | 1402 | .vidioc_s_tuner = vidioc_s_tuner, |
1435 | .vidioc_g_frequency = vidioc_g_frequency, | 1403 | .vidioc_g_frequency = vidioc_g_frequency, |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 62cea9549404..9a37b839c67c 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1179,15 +1179,6 @@ static int vidioc_enum_fmt_vid_cap (struct file *file, void *priv, | |||
1179 | return 0; | 1179 | return 0; |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1183 | static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) | ||
1184 | { | ||
1185 | struct cx8800_fh *fh = priv; | ||
1186 | |||
1187 | return videobuf_cgmbuf (get_queue(fh), mbuf, 8); | ||
1188 | } | ||
1189 | #endif | ||
1190 | |||
1191 | static int vidioc_reqbufs (struct file *file, void *priv, struct v4l2_requestbuffers *p) | 1182 | static int vidioc_reqbufs (struct file *file, void *priv, struct v4l2_requestbuffers *p) |
1192 | { | 1183 | { |
1193 | struct cx8800_fh *fh = priv; | 1184 | struct cx8800_fh *fh = priv; |
@@ -1731,9 +1722,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
1731 | .vidioc_s_ctrl = vidioc_s_ctrl, | 1722 | .vidioc_s_ctrl = vidioc_s_ctrl, |
1732 | .vidioc_streamon = vidioc_streamon, | 1723 | .vidioc_streamon = vidioc_streamon, |
1733 | .vidioc_streamoff = vidioc_streamoff, | 1724 | .vidioc_streamoff = vidioc_streamoff, |
1734 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1735 | .vidiocgmbuf = vidiocgmbuf, | ||
1736 | #endif | ||
1737 | .vidioc_g_tuner = vidioc_g_tuner, | 1725 | .vidioc_g_tuner = vidioc_g_tuner, |
1738 | .vidioc_s_tuner = vidioc_s_tuner, | 1726 | .vidioc_s_tuner = vidioc_s_tuner, |
1739 | .vidioc_g_frequency = vidioc_g_frequency, | 1727 | .vidioc_g_frequency = vidioc_g_frequency, |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 908e3bc88303..7be9bbad79ba 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -1934,19 +1934,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b) | |||
1934 | O_NONBLOCK); | 1934 | O_NONBLOCK); |
1935 | } | 1935 | } |
1936 | 1936 | ||
1937 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1938 | static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | ||
1939 | { | ||
1940 | struct em28xx_fh *fh = priv; | ||
1941 | |||
1942 | if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1943 | return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); | ||
1944 | else | ||
1945 | return videobuf_cgmbuf(&fh->vb_vbiq, mbuf, 8); | ||
1946 | } | ||
1947 | #endif | ||
1948 | |||
1949 | |||
1950 | /* ----------------------------------------------------------- */ | 1937 | /* ----------------------------------------------------------- */ |
1951 | /* RADIO ESPECIFIC IOCTLS */ | 1938 | /* RADIO ESPECIFIC IOCTLS */ |
1952 | /* ----------------------------------------------------------- */ | 1939 | /* ----------------------------------------------------------- */ |
@@ -2359,9 +2346,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
2359 | .vidioc_s_register = vidioc_s_register, | 2346 | .vidioc_s_register = vidioc_s_register, |
2360 | .vidioc_g_chip_ident = vidioc_g_chip_ident, | 2347 | .vidioc_g_chip_ident = vidioc_g_chip_ident, |
2361 | #endif | 2348 | #endif |
2362 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
2363 | .vidiocgmbuf = vidiocgmbuf, | ||
2364 | #endif | ||
2365 | }; | 2349 | }; |
2366 | 2350 | ||
2367 | static const struct video_device em28xx_video_template = { | 2351 | static const struct video_device em28xx_video_template = { |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c index aaafa0398fd5..58617fc656c2 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c | |||
@@ -852,8 +852,8 @@ static long pvr2_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
852 | #endif | 852 | #endif |
853 | 853 | ||
854 | default : | 854 | default : |
855 | ret = v4l_compat_translate_ioctl(file, cmd, | 855 | ret = -EINVAL; |
856 | arg, pvr2_v4l2_do_ioctl); | 856 | break; |
857 | } | 857 | } |
858 | 858 | ||
859 | pvr2_hdw_commit_ctl(hdw); | 859 | pvr2_hdw_commit_ctl(hdw); |
diff --git a/drivers/media/video/pwc/pwc-v4l.c b/drivers/media/video/pwc/pwc-v4l.c index 2ef1668638f9..8ca4d22b4384 100644 --- a/drivers/media/video/pwc/pwc-v4l.c +++ b/drivers/media/video/pwc/pwc-v4l.c | |||
@@ -362,23 +362,6 @@ long pwc_video_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
362 | 362 | ||
363 | 363 | ||
364 | switch (cmd) { | 364 | switch (cmd) { |
365 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
366 | /* mmap() functions */ | ||
367 | case VIDIOCGMBUF: | ||
368 | { | ||
369 | /* Tell the user program how much memory is needed for a mmap() */ | ||
370 | struct video_mbuf *vm = arg; | ||
371 | int i; | ||
372 | |||
373 | memset(vm, 0, sizeof(*vm)); | ||
374 | vm->size = pwc_mbufs * pdev->len_per_image; | ||
375 | vm->frames = pwc_mbufs; /* double buffering should be enough for most applications */ | ||
376 | for (i = 0; i < pwc_mbufs; i++) | ||
377 | vm->offsets[i] = i * pdev->len_per_image; | ||
378 | break; | ||
379 | } | ||
380 | #endif | ||
381 | |||
382 | /* V4L2 Layer */ | 365 | /* V4L2 Layer */ |
383 | case VIDIOC_QUERYCAP: | 366 | case VIDIOC_QUERYCAP: |
384 | { | 367 | { |
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index cf03372d1d17..b63f8cafa671 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -1097,15 +1097,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) | |||
1097 | return rc; | 1097 | return rc; |
1098 | } | 1098 | } |
1099 | 1099 | ||
1100 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1101 | static int vidioc_cgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | ||
1102 | { | ||
1103 | struct s2255_fh *fh = priv; | ||
1104 | |||
1105 | return videobuf_cgmbuf(&fh->vb_vidq, mbuf, 8); | ||
1106 | } | ||
1107 | #endif | ||
1108 | |||
1109 | /* write to the configuration pipe, synchronously */ | 1100 | /* write to the configuration pipe, synchronously */ |
1110 | static int s2255_write_config(struct usb_device *udev, unsigned char *pbuf, | 1101 | static int s2255_write_config(struct usb_device *udev, unsigned char *pbuf, |
1111 | int size) | 1102 | int size) |
@@ -1909,9 +1900,6 @@ static const struct v4l2_ioctl_ops s2255_ioctl_ops = { | |||
1909 | .vidioc_s_ctrl = vidioc_s_ctrl, | 1900 | .vidioc_s_ctrl = vidioc_s_ctrl, |
1910 | .vidioc_streamon = vidioc_streamon, | 1901 | .vidioc_streamon = vidioc_streamon, |
1911 | .vidioc_streamoff = vidioc_streamoff, | 1902 | .vidioc_streamoff = vidioc_streamoff, |
1912 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1913 | .vidiocgmbuf = vidioc_cgmbuf, | ||
1914 | #endif | ||
1915 | .vidioc_s_jpegcomp = vidioc_s_jpegcomp, | 1903 | .vidioc_s_jpegcomp = vidioc_s_jpegcomp, |
1916 | .vidioc_g_jpegcomp = vidioc_g_jpegcomp, | 1904 | .vidioc_g_jpegcomp = vidioc_g_jpegcomp, |
1917 | .vidioc_s_parm = vidioc_s_parm, | 1905 | .vidioc_s_parm = vidioc_s_parm, |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index f0b1573137f4..ad22be27bd38 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -2211,14 +2211,6 @@ static int saa7134_overlay(struct file *file, void *f, unsigned int on) | |||
2211 | return 0; | 2211 | return 0; |
2212 | } | 2212 | } |
2213 | 2213 | ||
2214 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
2215 | static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | ||
2216 | { | ||
2217 | struct saa7134_fh *fh = file->private_data; | ||
2218 | return videobuf_cgmbuf(saa7134_queue(fh), mbuf, 8); | ||
2219 | } | ||
2220 | #endif | ||
2221 | |||
2222 | static int saa7134_reqbufs(struct file *file, void *priv, | 2214 | static int saa7134_reqbufs(struct file *file, void *priv, |
2223 | struct v4l2_requestbuffers *p) | 2215 | struct v4l2_requestbuffers *p) |
2224 | { | 2216 | { |
@@ -2456,9 +2448,6 @@ static const struct v4l2_ioctl_ops video_ioctl_ops = { | |||
2456 | .vidioc_streamoff = saa7134_streamoff, | 2448 | .vidioc_streamoff = saa7134_streamoff, |
2457 | .vidioc_g_tuner = saa7134_g_tuner, | 2449 | .vidioc_g_tuner = saa7134_g_tuner, |
2458 | .vidioc_s_tuner = saa7134_s_tuner, | 2450 | .vidioc_s_tuner = saa7134_s_tuner, |
2459 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
2460 | .vidiocgmbuf = vidiocgmbuf, | ||
2461 | #endif | ||
2462 | .vidioc_g_crop = saa7134_g_crop, | 2451 | .vidioc_g_crop = saa7134_g_crop, |
2463 | .vidioc_s_crop = saa7134_s_crop, | 2452 | .vidioc_s_crop = saa7134_s_crop, |
2464 | .vidioc_g_fbuf = saa7134_g_fbuf, | 2453 | .vidioc_g_fbuf = saa7134_g_fbuf, |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 011c0c386995..20da6ea2cdf0 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -1273,9 +1273,6 @@ static const struct v4l2_ioctl_ops usbvision_ioctl_ops = { | |||
1273 | .vidioc_s_ctrl = vidioc_s_ctrl, | 1273 | .vidioc_s_ctrl = vidioc_s_ctrl, |
1274 | .vidioc_streamon = vidioc_streamon, | 1274 | .vidioc_streamon = vidioc_streamon, |
1275 | .vidioc_streamoff = vidioc_streamoff, | 1275 | .vidioc_streamoff = vidioc_streamoff, |
1276 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1277 | /* .vidiocgmbuf = vidiocgmbuf, */ | ||
1278 | #endif | ||
1279 | .vidioc_g_tuner = vidioc_g_tuner, | 1276 | .vidioc_g_tuner = vidioc_g_tuner, |
1280 | .vidioc_s_tuner = vidioc_s_tuner, | 1277 | .vidioc_s_tuner = vidioc_s_tuner, |
1281 | .vidioc_g_frequency = vidioc_g_frequency, | 1278 | .vidioc_g_frequency = vidioc_g_frequency, |
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c index 8cf61e8a634f..9005a8d9d5f8 100644 --- a/drivers/media/video/uvc/uvc_v4l2.c +++ b/drivers/media/video/uvc/uvc_v4l2.c | |||
@@ -1035,11 +1035,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
1035 | return uvc_xu_ctrl_query(chain, arg, 1); | 1035 | return uvc_xu_ctrl_query(chain, arg, 1); |
1036 | 1036 | ||
1037 | default: | 1037 | default: |
1038 | if ((ret = v4l_compat_translate_ioctl(file, cmd, arg, | 1038 | uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd); |
1039 | uvc_v4l2_do_ioctl)) == -ENOIOCTLCMD) | 1039 | return -EINVAL; |
1040 | uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", | ||
1041 | cmd); | ||
1042 | return ret; | ||
1043 | } | 1040 | } |
1044 | 1041 | ||
1045 | return ret; | 1042 | return ret; |
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c deleted file mode 100644 index d4ac751036a2..000000000000 --- a/drivers/media/video/v4l1-compat.c +++ /dev/null | |||
@@ -1,1277 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * Video for Linux Two | ||
4 | * Backward Compatibility Layer | ||
5 | * | ||
6 | * Support subroutines for providing V4L2 drivers with backward | ||
7 | * compatibility with applications using the old API. | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License | ||
11 | * as published by the Free Software Foundation; either version | ||
12 | * 2 of the License, or (at your option) any later version. | ||
13 | * | ||
14 | * Author: Bill Dirks <bill@thedirks.org> | ||
15 | * et al. | ||
16 | * | ||
17 | */ | ||
18 | |||
19 | |||
20 | #include <linux/init.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/types.h> | ||
23 | #include <linux/kernel.h> | ||
24 | #include <linux/sched.h> | ||
25 | #include <linux/mm.h> | ||
26 | #include <linux/fs.h> | ||
27 | #include <linux/file.h> | ||
28 | #include <linux/string.h> | ||
29 | #include <linux/errno.h> | ||
30 | #include <linux/slab.h> | ||
31 | #include <linux/videodev.h> | ||
32 | #include <media/v4l2-common.h> | ||
33 | #include <media/v4l2-ioctl.h> | ||
34 | |||
35 | #include <asm/uaccess.h> | ||
36 | #include <asm/system.h> | ||
37 | #include <asm/pgtable.h> | ||
38 | |||
39 | static unsigned int debug; | ||
40 | module_param(debug, int, 0644); | ||
41 | MODULE_PARM_DESC(debug, "enable debug messages"); | ||
42 | MODULE_AUTHOR("Bill Dirks"); | ||
43 | MODULE_DESCRIPTION("v4l(1) compatibility layer for v4l2 drivers."); | ||
44 | MODULE_LICENSE("GPL"); | ||
45 | |||
46 | #define dprintk(fmt, arg...) \ | ||
47 | do { \ | ||
48 | if (debug) \ | ||
49 | printk(KERN_DEBUG "v4l1-compat: " fmt , ## arg);\ | ||
50 | } while (0) | ||
51 | |||
52 | /* | ||
53 | * I O C T L T R A N S L A T I O N | ||
54 | * | ||
55 | * From here on down is the code for translating the numerous | ||
56 | * ioctl commands from the old API to the new API. | ||
57 | */ | ||
58 | |||
59 | static int | ||
60 | get_v4l_control(struct file *file, | ||
61 | int cid, | ||
62 | v4l2_kioctl drv) | ||
63 | { | ||
64 | struct v4l2_queryctrl qctrl2; | ||
65 | struct v4l2_control ctrl2; | ||
66 | int err; | ||
67 | |||
68 | qctrl2.id = cid; | ||
69 | err = drv(file, VIDIOC_QUERYCTRL, &qctrl2); | ||
70 | if (err < 0) | ||
71 | dprintk("VIDIOC_QUERYCTRL: %d\n", err); | ||
72 | if (err == 0 && !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) { | ||
73 | ctrl2.id = qctrl2.id; | ||
74 | err = drv(file, VIDIOC_G_CTRL, &ctrl2); | ||
75 | if (err < 0) { | ||
76 | dprintk("VIDIOC_G_CTRL: %d\n", err); | ||
77 | return 0; | ||
78 | } | ||
79 | return DIV_ROUND_CLOSEST((ctrl2.value-qctrl2.minimum) * 65535, | ||
80 | qctrl2.maximum - qctrl2.minimum); | ||
81 | } | ||
82 | return 0; | ||
83 | } | ||
84 | |||
85 | static int | ||
86 | set_v4l_control(struct file *file, | ||
87 | int cid, | ||
88 | int value, | ||
89 | v4l2_kioctl drv) | ||
90 | { | ||
91 | struct v4l2_queryctrl qctrl2; | ||
92 | struct v4l2_control ctrl2; | ||
93 | int err; | ||
94 | |||
95 | qctrl2.id = cid; | ||
96 | err = drv(file, VIDIOC_QUERYCTRL, &qctrl2); | ||
97 | if (err < 0) | ||
98 | dprintk("VIDIOC_QUERYCTRL: %d\n", err); | ||
99 | if (err == 0 && | ||
100 | !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED) && | ||
101 | !(qctrl2.flags & V4L2_CTRL_FLAG_GRABBED)) { | ||
102 | if (value < 0) | ||
103 | value = 0; | ||
104 | if (value > 65535) | ||
105 | value = 65535; | ||
106 | if (value && qctrl2.type == V4L2_CTRL_TYPE_BOOLEAN) | ||
107 | value = 65535; | ||
108 | ctrl2.id = qctrl2.id; | ||
109 | ctrl2.value = | ||
110 | (value * (qctrl2.maximum - qctrl2.minimum) | ||
111 | + 32767) | ||
112 | / 65535; | ||
113 | ctrl2.value += qctrl2.minimum; | ||
114 | err = drv(file, VIDIOC_S_CTRL, &ctrl2); | ||
115 | if (err < 0) | ||
116 | dprintk("VIDIOC_S_CTRL: %d\n", err); | ||
117 | } | ||
118 | return 0; | ||
119 | } | ||
120 | |||
121 | /* ----------------------------------------------------------------- */ | ||
122 | |||
123 | static const unsigned int palette2pixelformat[] = { | ||
124 | [VIDEO_PALETTE_GREY] = V4L2_PIX_FMT_GREY, | ||
125 | [VIDEO_PALETTE_RGB555] = V4L2_PIX_FMT_RGB555, | ||
126 | [VIDEO_PALETTE_RGB565] = V4L2_PIX_FMT_RGB565, | ||
127 | [VIDEO_PALETTE_RGB24] = V4L2_PIX_FMT_BGR24, | ||
128 | [VIDEO_PALETTE_RGB32] = V4L2_PIX_FMT_BGR32, | ||
129 | /* yuv packed pixel */ | ||
130 | [VIDEO_PALETTE_YUYV] = V4L2_PIX_FMT_YUYV, | ||
131 | [VIDEO_PALETTE_YUV422] = V4L2_PIX_FMT_YUYV, | ||
132 | [VIDEO_PALETTE_UYVY] = V4L2_PIX_FMT_UYVY, | ||
133 | /* yuv planar */ | ||
134 | [VIDEO_PALETTE_YUV410P] = V4L2_PIX_FMT_YUV410, | ||
135 | [VIDEO_PALETTE_YUV420] = V4L2_PIX_FMT_YUV420, | ||
136 | [VIDEO_PALETTE_YUV420P] = V4L2_PIX_FMT_YUV420, | ||
137 | [VIDEO_PALETTE_YUV411P] = V4L2_PIX_FMT_YUV411P, | ||
138 | [VIDEO_PALETTE_YUV422P] = V4L2_PIX_FMT_YUV422P, | ||
139 | }; | ||
140 | |||
141 | static unsigned int __pure | ||
142 | palette_to_pixelformat(unsigned int palette) | ||
143 | { | ||
144 | if (palette < ARRAY_SIZE(palette2pixelformat)) | ||
145 | return palette2pixelformat[palette]; | ||
146 | else | ||
147 | return 0; | ||
148 | } | ||
149 | |||
150 | static unsigned int __attribute_const__ | ||
151 | pixelformat_to_palette(unsigned int pixelformat) | ||
152 | { | ||
153 | int palette = 0; | ||
154 | switch (pixelformat) { | ||
155 | case V4L2_PIX_FMT_GREY: | ||
156 | palette = VIDEO_PALETTE_GREY; | ||
157 | break; | ||
158 | case V4L2_PIX_FMT_RGB555: | ||
159 | palette = VIDEO_PALETTE_RGB555; | ||
160 | break; | ||
161 | case V4L2_PIX_FMT_RGB565: | ||
162 | palette = VIDEO_PALETTE_RGB565; | ||
163 | break; | ||
164 | case V4L2_PIX_FMT_BGR24: | ||
165 | palette = VIDEO_PALETTE_RGB24; | ||
166 | break; | ||
167 | case V4L2_PIX_FMT_BGR32: | ||
168 | palette = VIDEO_PALETTE_RGB32; | ||
169 | break; | ||
170 | /* yuv packed pixel */ | ||
171 | case V4L2_PIX_FMT_YUYV: | ||
172 | palette = VIDEO_PALETTE_YUYV; | ||
173 | break; | ||
174 | case V4L2_PIX_FMT_UYVY: | ||
175 | palette = VIDEO_PALETTE_UYVY; | ||
176 | break; | ||
177 | /* yuv planar */ | ||
178 | case V4L2_PIX_FMT_YUV410: | ||
179 | palette = VIDEO_PALETTE_YUV420; | ||
180 | break; | ||
181 | case V4L2_PIX_FMT_YUV420: | ||
182 | palette = VIDEO_PALETTE_YUV420; | ||
183 | break; | ||
184 | case V4L2_PIX_FMT_YUV411P: | ||
185 | palette = VIDEO_PALETTE_YUV411P; | ||
186 | break; | ||
187 | case V4L2_PIX_FMT_YUV422P: | ||
188 | palette = VIDEO_PALETTE_YUV422P; | ||
189 | break; | ||
190 | } | ||
191 | return palette; | ||
192 | } | ||
193 | |||
194 | /* ----------------------------------------------------------------- */ | ||
195 | |||
196 | static int poll_one(struct file *file, struct poll_wqueues *pwq) | ||
197 | { | ||
198 | int retval = 1; | ||
199 | poll_table *table; | ||
200 | |||
201 | poll_initwait(pwq); | ||
202 | table = &pwq->pt; | ||
203 | for (;;) { | ||
204 | int mask; | ||
205 | mask = file->f_op->poll(file, table); | ||
206 | if (mask & POLLIN) | ||
207 | break; | ||
208 | table = NULL; | ||
209 | if (signal_pending(current)) { | ||
210 | retval = -ERESTARTSYS; | ||
211 | break; | ||
212 | } | ||
213 | poll_schedule(pwq, TASK_INTERRUPTIBLE); | ||
214 | } | ||
215 | poll_freewait(pwq); | ||
216 | return retval; | ||
217 | } | ||
218 | |||
219 | static int count_inputs( | ||
220 | struct file *file, | ||
221 | v4l2_kioctl drv) | ||
222 | { | ||
223 | struct v4l2_input input2; | ||
224 | int i; | ||
225 | |||
226 | for (i = 0;; i++) { | ||
227 | memset(&input2, 0, sizeof(input2)); | ||
228 | input2.index = i; | ||
229 | if (0 != drv(file, VIDIOC_ENUMINPUT, &input2)) | ||
230 | break; | ||
231 | } | ||
232 | return i; | ||
233 | } | ||
234 | |||
235 | static int check_size( | ||
236 | struct file *file, | ||
237 | v4l2_kioctl drv, | ||
238 | int *maxw, | ||
239 | int *maxh) | ||
240 | { | ||
241 | struct v4l2_fmtdesc desc2; | ||
242 | struct v4l2_format fmt2; | ||
243 | |||
244 | memset(&desc2, 0, sizeof(desc2)); | ||
245 | memset(&fmt2, 0, sizeof(fmt2)); | ||
246 | |||
247 | desc2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
248 | if (0 != drv(file, VIDIOC_ENUM_FMT, &desc2)) | ||
249 | goto done; | ||
250 | |||
251 | fmt2.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
252 | fmt2.fmt.pix.width = 10000; | ||
253 | fmt2.fmt.pix.height = 10000; | ||
254 | fmt2.fmt.pix.pixelformat = desc2.pixelformat; | ||
255 | if (0 != drv(file, VIDIOC_TRY_FMT, &fmt2)) | ||
256 | goto done; | ||
257 | |||
258 | *maxw = fmt2.fmt.pix.width; | ||
259 | *maxh = fmt2.fmt.pix.height; | ||
260 | |||
261 | done: | ||
262 | return 0; | ||
263 | } | ||
264 | |||
265 | /* ----------------------------------------------------------------- */ | ||
266 | |||
267 | static noinline long v4l1_compat_get_capabilities( | ||
268 | struct video_capability *cap, | ||
269 | struct file *file, | ||
270 | v4l2_kioctl drv) | ||
271 | { | ||
272 | long err; | ||
273 | struct v4l2_framebuffer fbuf; | ||
274 | struct v4l2_capability *cap2; | ||
275 | |||
276 | cap2 = kzalloc(sizeof(*cap2), GFP_KERNEL); | ||
277 | if (!cap2) { | ||
278 | err = -ENOMEM; | ||
279 | return err; | ||
280 | } | ||
281 | memset(cap, 0, sizeof(*cap)); | ||
282 | memset(&fbuf, 0, sizeof(fbuf)); | ||
283 | |||
284 | err = drv(file, VIDIOC_QUERYCAP, cap2); | ||
285 | if (err < 0) { | ||
286 | dprintk("VIDIOCGCAP / VIDIOC_QUERYCAP: %ld\n", err); | ||
287 | goto done; | ||
288 | } | ||
289 | if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) { | ||
290 | err = drv(file, VIDIOC_G_FBUF, &fbuf); | ||
291 | if (err < 0) { | ||
292 | dprintk("VIDIOCGCAP / VIDIOC_G_FBUF: %ld\n", err); | ||
293 | memset(&fbuf, 0, sizeof(fbuf)); | ||
294 | } | ||
295 | err = 0; | ||
296 | } | ||
297 | |||
298 | memcpy(cap->name, cap2->card, | ||
299 | min(sizeof(cap->name), sizeof(cap2->card))); | ||
300 | cap->name[sizeof(cap->name) - 1] = 0; | ||
301 | if (cap2->capabilities & V4L2_CAP_VIDEO_CAPTURE) | ||
302 | cap->type |= VID_TYPE_CAPTURE; | ||
303 | if (cap2->capabilities & V4L2_CAP_TUNER) | ||
304 | cap->type |= VID_TYPE_TUNER; | ||
305 | if (cap2->capabilities & V4L2_CAP_VBI_CAPTURE) | ||
306 | cap->type |= VID_TYPE_TELETEXT; | ||
307 | if (cap2->capabilities & V4L2_CAP_VIDEO_OVERLAY) | ||
308 | cap->type |= VID_TYPE_OVERLAY; | ||
309 | if (fbuf.capability & V4L2_FBUF_CAP_LIST_CLIPPING) | ||
310 | cap->type |= VID_TYPE_CLIPPING; | ||
311 | |||
312 | cap->channels = count_inputs(file, drv); | ||
313 | check_size(file, drv, | ||
314 | &cap->maxwidth, &cap->maxheight); | ||
315 | cap->audios = 0; /* FIXME */ | ||
316 | cap->minwidth = 48; /* FIXME */ | ||
317 | cap->minheight = 32; /* FIXME */ | ||
318 | |||
319 | done: | ||
320 | kfree(cap2); | ||
321 | return err; | ||
322 | } | ||
323 | |||
324 | static noinline long v4l1_compat_get_frame_buffer( | ||
325 | struct video_buffer *buffer, | ||
326 | struct file *file, | ||
327 | v4l2_kioctl drv) | ||
328 | { | ||
329 | long err; | ||
330 | struct v4l2_framebuffer fbuf; | ||
331 | |||
332 | memset(buffer, 0, sizeof(*buffer)); | ||
333 | memset(&fbuf, 0, sizeof(fbuf)); | ||
334 | |||
335 | err = drv(file, VIDIOC_G_FBUF, &fbuf); | ||
336 | if (err < 0) { | ||
337 | dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %ld\n", err); | ||
338 | goto done; | ||
339 | } | ||
340 | buffer->base = fbuf.base; | ||
341 | buffer->height = fbuf.fmt.height; | ||
342 | buffer->width = fbuf.fmt.width; | ||
343 | |||
344 | switch (fbuf.fmt.pixelformat) { | ||
345 | case V4L2_PIX_FMT_RGB332: | ||
346 | buffer->depth = 8; | ||
347 | break; | ||
348 | case V4L2_PIX_FMT_RGB555: | ||
349 | buffer->depth = 15; | ||
350 | break; | ||
351 | case V4L2_PIX_FMT_RGB565: | ||
352 | buffer->depth = 16; | ||
353 | break; | ||
354 | case V4L2_PIX_FMT_BGR24: | ||
355 | buffer->depth = 24; | ||
356 | break; | ||
357 | case V4L2_PIX_FMT_BGR32: | ||
358 | buffer->depth = 32; | ||
359 | break; | ||
360 | default: | ||
361 | buffer->depth = 0; | ||
362 | } | ||
363 | if (fbuf.fmt.bytesperline) { | ||
364 | buffer->bytesperline = fbuf.fmt.bytesperline; | ||
365 | if (!buffer->depth && buffer->width) | ||
366 | buffer->depth = ((fbuf.fmt.bytesperline<<3) | ||
367 | + (buffer->width-1)) | ||
368 | / buffer->width; | ||
369 | } else { | ||
370 | buffer->bytesperline = | ||
371 | (buffer->width * buffer->depth + 7) & 7; | ||
372 | buffer->bytesperline >>= 3; | ||
373 | } | ||
374 | done: | ||
375 | return err; | ||
376 | } | ||
377 | |||
378 | static noinline long v4l1_compat_set_frame_buffer( | ||
379 | struct video_buffer *buffer, | ||
380 | struct file *file, | ||
381 | v4l2_kioctl drv) | ||
382 | { | ||
383 | long err; | ||
384 | struct v4l2_framebuffer fbuf; | ||
385 | |||
386 | memset(&fbuf, 0, sizeof(fbuf)); | ||
387 | fbuf.base = buffer->base; | ||
388 | fbuf.fmt.height = buffer->height; | ||
389 | fbuf.fmt.width = buffer->width; | ||
390 | switch (buffer->depth) { | ||
391 | case 8: | ||
392 | fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB332; | ||
393 | break; | ||
394 | case 15: | ||
395 | fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB555; | ||
396 | break; | ||
397 | case 16: | ||
398 | fbuf.fmt.pixelformat = V4L2_PIX_FMT_RGB565; | ||
399 | break; | ||
400 | case 24: | ||
401 | fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR24; | ||
402 | break; | ||
403 | case 32: | ||
404 | fbuf.fmt.pixelformat = V4L2_PIX_FMT_BGR32; | ||
405 | break; | ||
406 | } | ||
407 | fbuf.fmt.bytesperline = buffer->bytesperline; | ||
408 | err = drv(file, VIDIOC_S_FBUF, &fbuf); | ||
409 | if (err < 0) | ||
410 | dprintk("VIDIOCSFBUF / VIDIOC_S_FBUF: %ld\n", err); | ||
411 | return err; | ||
412 | } | ||
413 | |||
414 | static noinline long v4l1_compat_get_win_cap_dimensions( | ||
415 | struct video_window *win, | ||
416 | struct file *file, | ||
417 | v4l2_kioctl drv) | ||
418 | { | ||
419 | long err; | ||
420 | struct v4l2_format *fmt; | ||
421 | |||
422 | fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); | ||
423 | if (!fmt) { | ||
424 | err = -ENOMEM; | ||
425 | return err; | ||
426 | } | ||
427 | memset(win, 0, sizeof(*win)); | ||
428 | |||
429 | fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; | ||
430 | err = drv(file, VIDIOC_G_FMT, fmt); | ||
431 | if (err < 0) | ||
432 | dprintk("VIDIOCGWIN / VIDIOC_G_WIN: %ld\n", err); | ||
433 | if (err == 0) { | ||
434 | win->x = fmt->fmt.win.w.left; | ||
435 | win->y = fmt->fmt.win.w.top; | ||
436 | win->width = fmt->fmt.win.w.width; | ||
437 | win->height = fmt->fmt.win.w.height; | ||
438 | win->chromakey = fmt->fmt.win.chromakey; | ||
439 | win->clips = NULL; | ||
440 | win->clipcount = 0; | ||
441 | goto done; | ||
442 | } | ||
443 | |||
444 | fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
445 | err = drv(file, VIDIOC_G_FMT, fmt); | ||
446 | if (err < 0) { | ||
447 | dprintk("VIDIOCGWIN / VIDIOC_G_FMT: %ld\n", err); | ||
448 | goto done; | ||
449 | } | ||
450 | win->x = 0; | ||
451 | win->y = 0; | ||
452 | win->width = fmt->fmt.pix.width; | ||
453 | win->height = fmt->fmt.pix.height; | ||
454 | win->chromakey = 0; | ||
455 | win->clips = NULL; | ||
456 | win->clipcount = 0; | ||
457 | done: | ||
458 | kfree(fmt); | ||
459 | return err; | ||
460 | } | ||
461 | |||
462 | static noinline long v4l1_compat_set_win_cap_dimensions( | ||
463 | struct video_window *win, | ||
464 | struct file *file, | ||
465 | v4l2_kioctl drv) | ||
466 | { | ||
467 | long err, err1, err2; | ||
468 | struct v4l2_format *fmt; | ||
469 | |||
470 | fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); | ||
471 | if (!fmt) { | ||
472 | err = -ENOMEM; | ||
473 | return err; | ||
474 | } | ||
475 | fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
476 | drv(file, VIDIOC_STREAMOFF, &fmt->type); | ||
477 | err1 = drv(file, VIDIOC_G_FMT, fmt); | ||
478 | if (err1 < 0) | ||
479 | dprintk("VIDIOCSWIN / VIDIOC_G_FMT: %ld\n", err1); | ||
480 | if (err1 == 0) { | ||
481 | fmt->fmt.pix.width = win->width; | ||
482 | fmt->fmt.pix.height = win->height; | ||
483 | fmt->fmt.pix.field = V4L2_FIELD_ANY; | ||
484 | fmt->fmt.pix.bytesperline = 0; | ||
485 | err = drv(file, VIDIOC_S_FMT, fmt); | ||
486 | if (err < 0) | ||
487 | dprintk("VIDIOCSWIN / VIDIOC_S_FMT #1: %ld\n", | ||
488 | err); | ||
489 | win->width = fmt->fmt.pix.width; | ||
490 | win->height = fmt->fmt.pix.height; | ||
491 | } | ||
492 | |||
493 | memset(fmt, 0, sizeof(*fmt)); | ||
494 | fmt->type = V4L2_BUF_TYPE_VIDEO_OVERLAY; | ||
495 | fmt->fmt.win.w.left = win->x; | ||
496 | fmt->fmt.win.w.top = win->y; | ||
497 | fmt->fmt.win.w.width = win->width; | ||
498 | fmt->fmt.win.w.height = win->height; | ||
499 | fmt->fmt.win.chromakey = win->chromakey; | ||
500 | fmt->fmt.win.clips = (void __user *)win->clips; | ||
501 | fmt->fmt.win.clipcount = win->clipcount; | ||
502 | err2 = drv(file, VIDIOC_S_FMT, fmt); | ||
503 | if (err2 < 0) | ||
504 | dprintk("VIDIOCSWIN / VIDIOC_S_FMT #2: %ld\n", err2); | ||
505 | |||
506 | if (err1 != 0 && err2 != 0) | ||
507 | err = err1; | ||
508 | else | ||
509 | err = 0; | ||
510 | kfree(fmt); | ||
511 | return err; | ||
512 | } | ||
513 | |||
514 | static noinline long v4l1_compat_turn_preview_on_off( | ||
515 | int *on, | ||
516 | struct file *file, | ||
517 | v4l2_kioctl drv) | ||
518 | { | ||
519 | long err; | ||
520 | enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
521 | |||
522 | if (0 == *on) { | ||
523 | /* dirty hack time. But v4l1 has no STREAMOFF | ||
524 | * equivalent in the API, and this one at | ||
525 | * least comes close ... */ | ||
526 | drv(file, VIDIOC_STREAMOFF, &captype); | ||
527 | } | ||
528 | err = drv(file, VIDIOC_OVERLAY, on); | ||
529 | if (err < 0) | ||
530 | dprintk("VIDIOCCAPTURE / VIDIOC_PREVIEW: %ld\n", err); | ||
531 | return err; | ||
532 | } | ||
533 | |||
534 | static noinline long v4l1_compat_get_input_info( | ||
535 | struct video_channel *chan, | ||
536 | struct file *file, | ||
537 | v4l2_kioctl drv) | ||
538 | { | ||
539 | long err; | ||
540 | struct v4l2_input input2; | ||
541 | v4l2_std_id sid; | ||
542 | |||
543 | memset(&input2, 0, sizeof(input2)); | ||
544 | input2.index = chan->channel; | ||
545 | err = drv(file, VIDIOC_ENUMINPUT, &input2); | ||
546 | if (err < 0) { | ||
547 | dprintk("VIDIOCGCHAN / VIDIOC_ENUMINPUT: " | ||
548 | "channel=%d err=%ld\n", chan->channel, err); | ||
549 | goto done; | ||
550 | } | ||
551 | chan->channel = input2.index; | ||
552 | memcpy(chan->name, input2.name, | ||
553 | min(sizeof(chan->name), sizeof(input2.name))); | ||
554 | chan->name[sizeof(chan->name) - 1] = 0; | ||
555 | chan->tuners = (input2.type == V4L2_INPUT_TYPE_TUNER) ? 1 : 0; | ||
556 | chan->flags = (chan->tuners) ? VIDEO_VC_TUNER : 0; | ||
557 | switch (input2.type) { | ||
558 | case V4L2_INPUT_TYPE_TUNER: | ||
559 | chan->type = VIDEO_TYPE_TV; | ||
560 | break; | ||
561 | default: | ||
562 | case V4L2_INPUT_TYPE_CAMERA: | ||
563 | chan->type = VIDEO_TYPE_CAMERA; | ||
564 | break; | ||
565 | } | ||
566 | chan->norm = 0; | ||
567 | /* Note: G_STD might not be present for radio receivers, | ||
568 | * so we should ignore any errors. */ | ||
569 | if (drv(file, VIDIOC_G_STD, &sid) == 0) { | ||
570 | if (sid & V4L2_STD_PAL) | ||
571 | chan->norm = VIDEO_MODE_PAL; | ||
572 | if (sid & V4L2_STD_NTSC) | ||
573 | chan->norm = VIDEO_MODE_NTSC; | ||
574 | if (sid & V4L2_STD_SECAM) | ||
575 | chan->norm = VIDEO_MODE_SECAM; | ||
576 | if (sid == V4L2_STD_ALL) | ||
577 | chan->norm = VIDEO_MODE_AUTO; | ||
578 | } | ||
579 | done: | ||
580 | return err; | ||
581 | } | ||
582 | |||
583 | static noinline long v4l1_compat_set_input( | ||
584 | struct video_channel *chan, | ||
585 | struct file *file, | ||
586 | v4l2_kioctl drv) | ||
587 | { | ||
588 | long err; | ||
589 | v4l2_std_id sid = 0; | ||
590 | |||
591 | err = drv(file, VIDIOC_S_INPUT, &chan->channel); | ||
592 | if (err < 0) | ||
593 | dprintk("VIDIOCSCHAN / VIDIOC_S_INPUT: %ld\n", err); | ||
594 | switch (chan->norm) { | ||
595 | case VIDEO_MODE_PAL: | ||
596 | sid = V4L2_STD_PAL; | ||
597 | break; | ||
598 | case VIDEO_MODE_NTSC: | ||
599 | sid = V4L2_STD_NTSC; | ||
600 | break; | ||
601 | case VIDEO_MODE_SECAM: | ||
602 | sid = V4L2_STD_SECAM; | ||
603 | break; | ||
604 | case VIDEO_MODE_AUTO: | ||
605 | sid = V4L2_STD_ALL; | ||
606 | break; | ||
607 | } | ||
608 | if (0 != sid) { | ||
609 | err = drv(file, VIDIOC_S_STD, &sid); | ||
610 | if (err < 0) | ||
611 | dprintk("VIDIOCSCHAN / VIDIOC_S_STD: %ld\n", err); | ||
612 | } | ||
613 | return err; | ||
614 | } | ||
615 | |||
616 | static noinline long v4l1_compat_get_picture( | ||
617 | struct video_picture *pict, | ||
618 | struct file *file, | ||
619 | v4l2_kioctl drv) | ||
620 | { | ||
621 | long err; | ||
622 | struct v4l2_format *fmt; | ||
623 | |||
624 | fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); | ||
625 | if (!fmt) { | ||
626 | err = -ENOMEM; | ||
627 | return err; | ||
628 | } | ||
629 | |||
630 | pict->brightness = get_v4l_control(file, | ||
631 | V4L2_CID_BRIGHTNESS, drv); | ||
632 | pict->hue = get_v4l_control(file, | ||
633 | V4L2_CID_HUE, drv); | ||
634 | pict->contrast = get_v4l_control(file, | ||
635 | V4L2_CID_CONTRAST, drv); | ||
636 | pict->colour = get_v4l_control(file, | ||
637 | V4L2_CID_SATURATION, drv); | ||
638 | pict->whiteness = get_v4l_control(file, | ||
639 | V4L2_CID_WHITENESS, drv); | ||
640 | |||
641 | fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
642 | err = drv(file, VIDIOC_G_FMT, fmt); | ||
643 | if (err < 0) { | ||
644 | dprintk("VIDIOCGPICT / VIDIOC_G_FMT: %ld\n", err); | ||
645 | goto done; | ||
646 | } | ||
647 | |||
648 | if (fmt->fmt.pix.width) | ||
649 | { | ||
650 | pict->depth = ((fmt->fmt.pix.bytesperline << 3) | ||
651 | + (fmt->fmt.pix.width - 1)) | ||
652 | / fmt->fmt.pix.width; | ||
653 | } else { | ||
654 | err = -EINVAL; | ||
655 | goto done; | ||
656 | } | ||
657 | |||
658 | pict->palette = pixelformat_to_palette( | ||
659 | fmt->fmt.pix.pixelformat); | ||
660 | done: | ||
661 | kfree(fmt); | ||
662 | return err; | ||
663 | } | ||
664 | |||
665 | static noinline long v4l1_compat_set_picture( | ||
666 | struct video_picture *pict, | ||
667 | struct file *file, | ||
668 | v4l2_kioctl drv) | ||
669 | { | ||
670 | long err; | ||
671 | struct v4l2_framebuffer fbuf; | ||
672 | int mem_err = 0, ovl_err = 0; | ||
673 | struct v4l2_format *fmt; | ||
674 | |||
675 | fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); | ||
676 | if (!fmt) { | ||
677 | err = -ENOMEM; | ||
678 | return err; | ||
679 | } | ||
680 | memset(&fbuf, 0, sizeof(fbuf)); | ||
681 | |||
682 | set_v4l_control(file, | ||
683 | V4L2_CID_BRIGHTNESS, pict->brightness, drv); | ||
684 | set_v4l_control(file, | ||
685 | V4L2_CID_HUE, pict->hue, drv); | ||
686 | set_v4l_control(file, | ||
687 | V4L2_CID_CONTRAST, pict->contrast, drv); | ||
688 | set_v4l_control(file, | ||
689 | V4L2_CID_SATURATION, pict->colour, drv); | ||
690 | set_v4l_control(file, | ||
691 | V4L2_CID_WHITENESS, pict->whiteness, drv); | ||
692 | /* | ||
693 | * V4L1 uses this ioctl to set both memory capture and overlay | ||
694 | * pixel format, while V4L2 has two different ioctls for this. | ||
695 | * Some cards may not support one or the other, and may support | ||
696 | * different pixel formats for memory vs overlay. | ||
697 | */ | ||
698 | |||
699 | fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
700 | err = drv(file, VIDIOC_G_FMT, fmt); | ||
701 | /* If VIDIOC_G_FMT failed, then the driver likely doesn't | ||
702 | support memory capture. Trying to set the memory capture | ||
703 | parameters would be pointless. */ | ||
704 | if (err < 0) { | ||
705 | dprintk("VIDIOCSPICT / VIDIOC_G_FMT: %ld\n", err); | ||
706 | mem_err = -1000; /* didn't even try */ | ||
707 | } else if (fmt->fmt.pix.pixelformat != | ||
708 | palette_to_pixelformat(pict->palette)) { | ||
709 | fmt->fmt.pix.pixelformat = palette_to_pixelformat( | ||
710 | pict->palette); | ||
711 | mem_err = drv(file, VIDIOC_S_FMT, fmt); | ||
712 | if (mem_err < 0) | ||
713 | dprintk("VIDIOCSPICT / VIDIOC_S_FMT: %d\n", | ||
714 | mem_err); | ||
715 | } | ||
716 | |||
717 | err = drv(file, VIDIOC_G_FBUF, &fbuf); | ||
718 | /* If VIDIOC_G_FBUF failed, then the driver likely doesn't | ||
719 | support overlay. Trying to set the overlay parameters | ||
720 | would be quite pointless. */ | ||
721 | if (err < 0) { | ||
722 | dprintk("VIDIOCSPICT / VIDIOC_G_FBUF: %ld\n", err); | ||
723 | ovl_err = -1000; /* didn't even try */ | ||
724 | } else if (fbuf.fmt.pixelformat != | ||
725 | palette_to_pixelformat(pict->palette)) { | ||
726 | fbuf.fmt.pixelformat = palette_to_pixelformat( | ||
727 | pict->palette); | ||
728 | ovl_err = drv(file, VIDIOC_S_FBUF, &fbuf); | ||
729 | if (ovl_err < 0) | ||
730 | dprintk("VIDIOCSPICT / VIDIOC_S_FBUF: %d\n", | ||
731 | ovl_err); | ||
732 | } | ||
733 | if (ovl_err < 0 && mem_err < 0) { | ||
734 | /* ioctl failed, couldn't set either parameter */ | ||
735 | if (mem_err != -1000) | ||
736 | err = mem_err; | ||
737 | else if (ovl_err == -EPERM) | ||
738 | err = 0; | ||
739 | else | ||
740 | err = ovl_err; | ||
741 | } else | ||
742 | err = 0; | ||
743 | kfree(fmt); | ||
744 | return err; | ||
745 | } | ||
746 | |||
747 | static noinline long v4l1_compat_get_tuner( | ||
748 | struct video_tuner *tun, | ||
749 | struct file *file, | ||
750 | v4l2_kioctl drv) | ||
751 | { | ||
752 | long err; | ||
753 | int i; | ||
754 | struct v4l2_tuner tun2; | ||
755 | struct v4l2_standard std2; | ||
756 | v4l2_std_id sid; | ||
757 | |||
758 | memset(&tun2, 0, sizeof(tun2)); | ||
759 | err = drv(file, VIDIOC_G_TUNER, &tun2); | ||
760 | if (err < 0) { | ||
761 | dprintk("VIDIOCGTUNER / VIDIOC_G_TUNER: %ld\n", err); | ||
762 | goto done; | ||
763 | } | ||
764 | memcpy(tun->name, tun2.name, | ||
765 | min(sizeof(tun->name), sizeof(tun2.name))); | ||
766 | tun->name[sizeof(tun->name) - 1] = 0; | ||
767 | tun->rangelow = tun2.rangelow; | ||
768 | tun->rangehigh = tun2.rangehigh; | ||
769 | tun->flags = 0; | ||
770 | tun->mode = VIDEO_MODE_AUTO; | ||
771 | |||
772 | for (i = 0; i < 64; i++) { | ||
773 | memset(&std2, 0, sizeof(std2)); | ||
774 | std2.index = i; | ||
775 | if (0 != drv(file, VIDIOC_ENUMSTD, &std2)) | ||
776 | break; | ||
777 | if (std2.id & V4L2_STD_PAL) | ||
778 | tun->flags |= VIDEO_TUNER_PAL; | ||
779 | if (std2.id & V4L2_STD_NTSC) | ||
780 | tun->flags |= VIDEO_TUNER_NTSC; | ||
781 | if (std2.id & V4L2_STD_SECAM) | ||
782 | tun->flags |= VIDEO_TUNER_SECAM; | ||
783 | } | ||
784 | |||
785 | /* Note: G_STD might not be present for radio receivers, | ||
786 | * so we should ignore any errors. */ | ||
787 | if (drv(file, VIDIOC_G_STD, &sid) == 0) { | ||
788 | if (sid & V4L2_STD_PAL) | ||
789 | tun->mode = VIDEO_MODE_PAL; | ||
790 | if (sid & V4L2_STD_NTSC) | ||
791 | tun->mode = VIDEO_MODE_NTSC; | ||
792 | if (sid & V4L2_STD_SECAM) | ||
793 | tun->mode = VIDEO_MODE_SECAM; | ||
794 | } | ||
795 | |||
796 | if (tun2.capability & V4L2_TUNER_CAP_LOW) | ||
797 | tun->flags |= VIDEO_TUNER_LOW; | ||
798 | if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) | ||
799 | tun->flags |= VIDEO_TUNER_STEREO_ON; | ||
800 | tun->signal = tun2.signal; | ||
801 | done: | ||
802 | return err; | ||
803 | } | ||
804 | |||
805 | static noinline long v4l1_compat_select_tuner( | ||
806 | struct video_tuner *tun, | ||
807 | struct file *file, | ||
808 | v4l2_kioctl drv) | ||
809 | { | ||
810 | long err; | ||
811 | struct v4l2_tuner t;/*84 bytes on x86_64*/ | ||
812 | memset(&t, 0, sizeof(t)); | ||
813 | |||
814 | t.index = tun->tuner; | ||
815 | |||
816 | err = drv(file, VIDIOC_S_TUNER, &t); | ||
817 | if (err < 0) | ||
818 | dprintk("VIDIOCSTUNER / VIDIOC_S_TUNER: %ld\n", err); | ||
819 | return err; | ||
820 | } | ||
821 | |||
822 | static noinline long v4l1_compat_get_frequency( | ||
823 | unsigned long *freq, | ||
824 | struct file *file, | ||
825 | v4l2_kioctl drv) | ||
826 | { | ||
827 | long err; | ||
828 | struct v4l2_frequency freq2; | ||
829 | memset(&freq2, 0, sizeof(freq2)); | ||
830 | |||
831 | freq2.tuner = 0; | ||
832 | err = drv(file, VIDIOC_G_FREQUENCY, &freq2); | ||
833 | if (err < 0) | ||
834 | dprintk("VIDIOCGFREQ / VIDIOC_G_FREQUENCY: %ld\n", err); | ||
835 | if (0 == err) | ||
836 | *freq = freq2.frequency; | ||
837 | return err; | ||
838 | } | ||
839 | |||
840 | static noinline long v4l1_compat_set_frequency( | ||
841 | unsigned long *freq, | ||
842 | struct file *file, | ||
843 | v4l2_kioctl drv) | ||
844 | { | ||
845 | long err; | ||
846 | struct v4l2_frequency freq2; | ||
847 | memset(&freq2, 0, sizeof(freq2)); | ||
848 | |||
849 | drv(file, VIDIOC_G_FREQUENCY, &freq2); | ||
850 | freq2.frequency = *freq; | ||
851 | err = drv(file, VIDIOC_S_FREQUENCY, &freq2); | ||
852 | if (err < 0) | ||
853 | dprintk("VIDIOCSFREQ / VIDIOC_S_FREQUENCY: %ld\n", err); | ||
854 | return err; | ||
855 | } | ||
856 | |||
857 | static noinline long v4l1_compat_get_audio( | ||
858 | struct video_audio *aud, | ||
859 | struct file *file, | ||
860 | v4l2_kioctl drv) | ||
861 | { | ||
862 | long err; | ||
863 | int i; | ||
864 | struct v4l2_queryctrl qctrl2; | ||
865 | struct v4l2_audio aud2; | ||
866 | struct v4l2_tuner tun2; | ||
867 | memset(&aud2, 0, sizeof(aud2)); | ||
868 | |||
869 | err = drv(file, VIDIOC_G_AUDIO, &aud2); | ||
870 | if (err < 0) { | ||
871 | dprintk("VIDIOCGAUDIO / VIDIOC_G_AUDIO: %ld\n", err); | ||
872 | goto done; | ||
873 | } | ||
874 | memcpy(aud->name, aud2.name, | ||
875 | min(sizeof(aud->name), sizeof(aud2.name))); | ||
876 | aud->name[sizeof(aud->name) - 1] = 0; | ||
877 | aud->audio = aud2.index; | ||
878 | aud->flags = 0; | ||
879 | i = get_v4l_control(file, V4L2_CID_AUDIO_VOLUME, drv); | ||
880 | if (i >= 0) { | ||
881 | aud->volume = i; | ||
882 | aud->flags |= VIDEO_AUDIO_VOLUME; | ||
883 | } | ||
884 | i = get_v4l_control(file, V4L2_CID_AUDIO_BASS, drv); | ||
885 | if (i >= 0) { | ||
886 | aud->bass = i; | ||
887 | aud->flags |= VIDEO_AUDIO_BASS; | ||
888 | } | ||
889 | i = get_v4l_control(file, V4L2_CID_AUDIO_TREBLE, drv); | ||
890 | if (i >= 0) { | ||
891 | aud->treble = i; | ||
892 | aud->flags |= VIDEO_AUDIO_TREBLE; | ||
893 | } | ||
894 | i = get_v4l_control(file, V4L2_CID_AUDIO_BALANCE, drv); | ||
895 | if (i >= 0) { | ||
896 | aud->balance = i; | ||
897 | aud->flags |= VIDEO_AUDIO_BALANCE; | ||
898 | } | ||
899 | i = get_v4l_control(file, V4L2_CID_AUDIO_MUTE, drv); | ||
900 | if (i >= 0) { | ||
901 | if (i) | ||
902 | aud->flags |= VIDEO_AUDIO_MUTE; | ||
903 | aud->flags |= VIDEO_AUDIO_MUTABLE; | ||
904 | } | ||
905 | aud->step = 1; | ||
906 | qctrl2.id = V4L2_CID_AUDIO_VOLUME; | ||
907 | if (drv(file, VIDIOC_QUERYCTRL, &qctrl2) == 0 && | ||
908 | !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) | ||
909 | aud->step = qctrl2.step; | ||
910 | aud->mode = 0; | ||
911 | |||
912 | memset(&tun2, 0, sizeof(tun2)); | ||
913 | err = drv(file, VIDIOC_G_TUNER, &tun2); | ||
914 | if (err < 0) { | ||
915 | dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %ld\n", err); | ||
916 | err = 0; | ||
917 | goto done; | ||
918 | } | ||
919 | |||
920 | if (tun2.rxsubchans & V4L2_TUNER_SUB_LANG2) | ||
921 | aud->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; | ||
922 | else if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) | ||
923 | aud->mode = VIDEO_SOUND_STEREO; | ||
924 | else if (tun2.rxsubchans & V4L2_TUNER_SUB_MONO) | ||
925 | aud->mode = VIDEO_SOUND_MONO; | ||
926 | done: | ||
927 | return err; | ||
928 | } | ||
929 | |||
930 | static noinline long v4l1_compat_set_audio( | ||
931 | struct video_audio *aud, | ||
932 | struct file *file, | ||
933 | v4l2_kioctl drv) | ||
934 | { | ||
935 | long err; | ||
936 | struct v4l2_audio aud2; | ||
937 | struct v4l2_tuner tun2; | ||
938 | |||
939 | memset(&aud2, 0, sizeof(aud2)); | ||
940 | memset(&tun2, 0, sizeof(tun2)); | ||
941 | |||
942 | aud2.index = aud->audio; | ||
943 | err = drv(file, VIDIOC_S_AUDIO, &aud2); | ||
944 | if (err < 0) { | ||
945 | dprintk("VIDIOCSAUDIO / VIDIOC_S_AUDIO: %ld\n", err); | ||
946 | goto done; | ||
947 | } | ||
948 | |||
949 | set_v4l_control(file, V4L2_CID_AUDIO_VOLUME, | ||
950 | aud->volume, drv); | ||
951 | set_v4l_control(file, V4L2_CID_AUDIO_BASS, | ||
952 | aud->bass, drv); | ||
953 | set_v4l_control(file, V4L2_CID_AUDIO_TREBLE, | ||
954 | aud->treble, drv); | ||
955 | set_v4l_control(file, V4L2_CID_AUDIO_BALANCE, | ||
956 | aud->balance, drv); | ||
957 | set_v4l_control(file, V4L2_CID_AUDIO_MUTE, | ||
958 | !!(aud->flags & VIDEO_AUDIO_MUTE), drv); | ||
959 | |||
960 | err = drv(file, VIDIOC_G_TUNER, &tun2); | ||
961 | if (err < 0) | ||
962 | dprintk("VIDIOCSAUDIO / VIDIOC_G_TUNER: %ld\n", err); | ||
963 | if (err == 0) { | ||
964 | switch (aud->mode) { | ||
965 | default: | ||
966 | case VIDEO_SOUND_MONO: | ||
967 | case VIDEO_SOUND_LANG1: | ||
968 | tun2.audmode = V4L2_TUNER_MODE_MONO; | ||
969 | break; | ||
970 | case VIDEO_SOUND_STEREO: | ||
971 | tun2.audmode = V4L2_TUNER_MODE_STEREO; | ||
972 | break; | ||
973 | case VIDEO_SOUND_LANG2: | ||
974 | tun2.audmode = V4L2_TUNER_MODE_LANG2; | ||
975 | break; | ||
976 | } | ||
977 | err = drv(file, VIDIOC_S_TUNER, &tun2); | ||
978 | if (err < 0) | ||
979 | dprintk("VIDIOCSAUDIO / VIDIOC_S_TUNER: %ld\n", err); | ||
980 | } | ||
981 | err = 0; | ||
982 | done: | ||
983 | return err; | ||
984 | } | ||
985 | |||
986 | static noinline long v4l1_compat_capture_frame( | ||
987 | struct video_mmap *mm, | ||
988 | struct file *file, | ||
989 | v4l2_kioctl drv) | ||
990 | { | ||
991 | long err; | ||
992 | enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
993 | struct v4l2_buffer buf; | ||
994 | struct v4l2_format *fmt; | ||
995 | |||
996 | fmt = kzalloc(sizeof(*fmt), GFP_KERNEL); | ||
997 | if (!fmt) { | ||
998 | err = -ENOMEM; | ||
999 | return err; | ||
1000 | } | ||
1001 | memset(&buf, 0, sizeof(buf)); | ||
1002 | |||
1003 | fmt->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1004 | err = drv(file, VIDIOC_G_FMT, fmt); | ||
1005 | if (err < 0) { | ||
1006 | dprintk("VIDIOCMCAPTURE / VIDIOC_G_FMT: %ld\n", err); | ||
1007 | goto done; | ||
1008 | } | ||
1009 | if (mm->width != fmt->fmt.pix.width || | ||
1010 | mm->height != fmt->fmt.pix.height || | ||
1011 | palette_to_pixelformat(mm->format) != | ||
1012 | fmt->fmt.pix.pixelformat) { | ||
1013 | /* New capture format... */ | ||
1014 | fmt->fmt.pix.width = mm->width; | ||
1015 | fmt->fmt.pix.height = mm->height; | ||
1016 | fmt->fmt.pix.pixelformat = | ||
1017 | palette_to_pixelformat(mm->format); | ||
1018 | fmt->fmt.pix.field = V4L2_FIELD_ANY; | ||
1019 | fmt->fmt.pix.bytesperline = 0; | ||
1020 | err = drv(file, VIDIOC_S_FMT, fmt); | ||
1021 | if (err < 0) { | ||
1022 | dprintk("VIDIOCMCAPTURE / VIDIOC_S_FMT: %ld\n", err); | ||
1023 | goto done; | ||
1024 | } | ||
1025 | } | ||
1026 | buf.index = mm->frame; | ||
1027 | buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1028 | err = drv(file, VIDIOC_QUERYBUF, &buf); | ||
1029 | if (err < 0) { | ||
1030 | dprintk("VIDIOCMCAPTURE / VIDIOC_QUERYBUF: %ld\n", err); | ||
1031 | goto done; | ||
1032 | } | ||
1033 | err = drv(file, VIDIOC_QBUF, &buf); | ||
1034 | if (err < 0) { | ||
1035 | dprintk("VIDIOCMCAPTURE / VIDIOC_QBUF: %ld\n", err); | ||
1036 | goto done; | ||
1037 | } | ||
1038 | err = drv(file, VIDIOC_STREAMON, &captype); | ||
1039 | if (err < 0) | ||
1040 | dprintk("VIDIOCMCAPTURE / VIDIOC_STREAMON: %ld\n", err); | ||
1041 | done: | ||
1042 | kfree(fmt); | ||
1043 | return err; | ||
1044 | } | ||
1045 | |||
1046 | static noinline long v4l1_compat_sync( | ||
1047 | int *i, | ||
1048 | struct file *file, | ||
1049 | v4l2_kioctl drv) | ||
1050 | { | ||
1051 | long err; | ||
1052 | enum v4l2_buf_type captype = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1053 | struct v4l2_buffer buf; | ||
1054 | struct poll_wqueues *pwq; | ||
1055 | |||
1056 | memset(&buf, 0, sizeof(buf)); | ||
1057 | buf.index = *i; | ||
1058 | buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1059 | err = drv(file, VIDIOC_QUERYBUF, &buf); | ||
1060 | if (err < 0) { | ||
1061 | /* No such buffer */ | ||
1062 | dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %ld\n", err); | ||
1063 | goto done; | ||
1064 | } | ||
1065 | if (!(buf.flags & V4L2_BUF_FLAG_MAPPED)) { | ||
1066 | /* Buffer is not mapped */ | ||
1067 | err = -EINVAL; | ||
1068 | goto done; | ||
1069 | } | ||
1070 | |||
1071 | /* make sure capture actually runs so we don't block forever */ | ||
1072 | err = drv(file, VIDIOC_STREAMON, &captype); | ||
1073 | if (err < 0) { | ||
1074 | dprintk("VIDIOCSYNC / VIDIOC_STREAMON: %ld\n", err); | ||
1075 | goto done; | ||
1076 | } | ||
1077 | |||
1078 | pwq = kmalloc(sizeof(*pwq), GFP_KERNEL); | ||
1079 | /* Loop as long as the buffer is queued, but not done */ | ||
1080 | while ((buf.flags & (V4L2_BUF_FLAG_QUEUED | V4L2_BUF_FLAG_DONE)) | ||
1081 | == V4L2_BUF_FLAG_QUEUED) { | ||
1082 | err = poll_one(file, pwq); | ||
1083 | if (err < 0 || /* error or sleep was interrupted */ | ||
1084 | err == 0) /* timeout? Shouldn't occur. */ | ||
1085 | break; | ||
1086 | err = drv(file, VIDIOC_QUERYBUF, &buf); | ||
1087 | if (err < 0) | ||
1088 | dprintk("VIDIOCSYNC / VIDIOC_QUERYBUF: %ld\n", err); | ||
1089 | } | ||
1090 | kfree(pwq); | ||
1091 | if (!(buf.flags & V4L2_BUF_FLAG_DONE)) /* not done */ | ||
1092 | goto done; | ||
1093 | do { | ||
1094 | err = drv(file, VIDIOC_DQBUF, &buf); | ||
1095 | if (err < 0) | ||
1096 | dprintk("VIDIOCSYNC / VIDIOC_DQBUF: %ld\n", err); | ||
1097 | } while (err == 0 && buf.index != *i); | ||
1098 | done: | ||
1099 | return err; | ||
1100 | } | ||
1101 | |||
1102 | static noinline long v4l1_compat_get_vbi_format( | ||
1103 | struct vbi_format *fmt, | ||
1104 | struct file *file, | ||
1105 | v4l2_kioctl drv) | ||
1106 | { | ||
1107 | long err; | ||
1108 | struct v4l2_format *fmt2; | ||
1109 | |||
1110 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); | ||
1111 | if (!fmt2) { | ||
1112 | err = -ENOMEM; | ||
1113 | return err; | ||
1114 | } | ||
1115 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; | ||
1116 | |||
1117 | err = drv(file, VIDIOC_G_FMT, fmt2); | ||
1118 | if (err < 0) { | ||
1119 | dprintk("VIDIOCGVBIFMT / VIDIOC_G_FMT: %ld\n", err); | ||
1120 | goto done; | ||
1121 | } | ||
1122 | if (fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY) { | ||
1123 | err = -EINVAL; | ||
1124 | goto done; | ||
1125 | } | ||
1126 | memset(fmt, 0, sizeof(*fmt)); | ||
1127 | fmt->samples_per_line = fmt2->fmt.vbi.samples_per_line; | ||
1128 | fmt->sampling_rate = fmt2->fmt.vbi.sampling_rate; | ||
1129 | fmt->sample_format = VIDEO_PALETTE_RAW; | ||
1130 | fmt->start[0] = fmt2->fmt.vbi.start[0]; | ||
1131 | fmt->count[0] = fmt2->fmt.vbi.count[0]; | ||
1132 | fmt->start[1] = fmt2->fmt.vbi.start[1]; | ||
1133 | fmt->count[1] = fmt2->fmt.vbi.count[1]; | ||
1134 | fmt->flags = fmt2->fmt.vbi.flags & 0x03; | ||
1135 | done: | ||
1136 | kfree(fmt2); | ||
1137 | return err; | ||
1138 | } | ||
1139 | |||
1140 | static noinline long v4l1_compat_set_vbi_format( | ||
1141 | struct vbi_format *fmt, | ||
1142 | struct file *file, | ||
1143 | v4l2_kioctl drv) | ||
1144 | { | ||
1145 | long err; | ||
1146 | struct v4l2_format *fmt2 = NULL; | ||
1147 | |||
1148 | if (VIDEO_PALETTE_RAW != fmt->sample_format) { | ||
1149 | err = -EINVAL; | ||
1150 | return err; | ||
1151 | } | ||
1152 | |||
1153 | fmt2 = kzalloc(sizeof(*fmt2), GFP_KERNEL); | ||
1154 | if (!fmt2) { | ||
1155 | err = -ENOMEM; | ||
1156 | return err; | ||
1157 | } | ||
1158 | fmt2->type = V4L2_BUF_TYPE_VBI_CAPTURE; | ||
1159 | fmt2->fmt.vbi.samples_per_line = fmt->samples_per_line; | ||
1160 | fmt2->fmt.vbi.sampling_rate = fmt->sampling_rate; | ||
1161 | fmt2->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; | ||
1162 | fmt2->fmt.vbi.start[0] = fmt->start[0]; | ||
1163 | fmt2->fmt.vbi.count[0] = fmt->count[0]; | ||
1164 | fmt2->fmt.vbi.start[1] = fmt->start[1]; | ||
1165 | fmt2->fmt.vbi.count[1] = fmt->count[1]; | ||
1166 | fmt2->fmt.vbi.flags = fmt->flags; | ||
1167 | err = drv(file, VIDIOC_TRY_FMT, fmt2); | ||
1168 | if (err < 0) { | ||
1169 | dprintk("VIDIOCSVBIFMT / VIDIOC_TRY_FMT: %ld\n", err); | ||
1170 | goto done; | ||
1171 | } | ||
1172 | |||
1173 | if (fmt2->fmt.vbi.samples_per_line != fmt->samples_per_line || | ||
1174 | fmt2->fmt.vbi.sampling_rate != fmt->sampling_rate || | ||
1175 | fmt2->fmt.vbi.sample_format != V4L2_PIX_FMT_GREY || | ||
1176 | fmt2->fmt.vbi.start[0] != fmt->start[0] || | ||
1177 | fmt2->fmt.vbi.count[0] != fmt->count[0] || | ||
1178 | fmt2->fmt.vbi.start[1] != fmt->start[1] || | ||
1179 | fmt2->fmt.vbi.count[1] != fmt->count[1] || | ||
1180 | fmt2->fmt.vbi.flags != fmt->flags) { | ||
1181 | err = -EINVAL; | ||
1182 | goto done; | ||
1183 | } | ||
1184 | err = drv(file, VIDIOC_S_FMT, fmt2); | ||
1185 | if (err < 0) | ||
1186 | dprintk("VIDIOCSVBIFMT / VIDIOC_S_FMT: %ld\n", err); | ||
1187 | done: | ||
1188 | kfree(fmt2); | ||
1189 | return err; | ||
1190 | } | ||
1191 | |||
1192 | /* | ||
1193 | * This function is exported. | ||
1194 | */ | ||
1195 | long | ||
1196 | v4l_compat_translate_ioctl(struct file *file, | ||
1197 | int cmd, | ||
1198 | void *arg, | ||
1199 | v4l2_kioctl drv) | ||
1200 | { | ||
1201 | long err; | ||
1202 | |||
1203 | switch (cmd) { | ||
1204 | case VIDIOCGCAP: /* capability */ | ||
1205 | err = v4l1_compat_get_capabilities(arg, file, drv); | ||
1206 | break; | ||
1207 | case VIDIOCGFBUF: /* get frame buffer */ | ||
1208 | err = v4l1_compat_get_frame_buffer(arg, file, drv); | ||
1209 | break; | ||
1210 | case VIDIOCSFBUF: /* set frame buffer */ | ||
1211 | err = v4l1_compat_set_frame_buffer(arg, file, drv); | ||
1212 | break; | ||
1213 | case VIDIOCGWIN: /* get window or capture dimensions */ | ||
1214 | err = v4l1_compat_get_win_cap_dimensions(arg, file, drv); | ||
1215 | break; | ||
1216 | case VIDIOCSWIN: /* set window and/or capture dimensions */ | ||
1217 | err = v4l1_compat_set_win_cap_dimensions(arg, file, drv); | ||
1218 | break; | ||
1219 | case VIDIOCCAPTURE: /* turn on/off preview */ | ||
1220 | err = v4l1_compat_turn_preview_on_off(arg, file, drv); | ||
1221 | break; | ||
1222 | case VIDIOCGCHAN: /* get input information */ | ||
1223 | err = v4l1_compat_get_input_info(arg, file, drv); | ||
1224 | break; | ||
1225 | case VIDIOCSCHAN: /* set input */ | ||
1226 | err = v4l1_compat_set_input(arg, file, drv); | ||
1227 | break; | ||
1228 | case VIDIOCGPICT: /* get tone controls & partial capture format */ | ||
1229 | err = v4l1_compat_get_picture(arg, file, drv); | ||
1230 | break; | ||
1231 | case VIDIOCSPICT: /* set tone controls & partial capture format */ | ||
1232 | err = v4l1_compat_set_picture(arg, file, drv); | ||
1233 | break; | ||
1234 | case VIDIOCGTUNER: /* get tuner information */ | ||
1235 | err = v4l1_compat_get_tuner(arg, file, drv); | ||
1236 | break; | ||
1237 | case VIDIOCSTUNER: /* select a tuner input */ | ||
1238 | err = v4l1_compat_select_tuner(arg, file, drv); | ||
1239 | break; | ||
1240 | case VIDIOCGFREQ: /* get frequency */ | ||
1241 | err = v4l1_compat_get_frequency(arg, file, drv); | ||
1242 | break; | ||
1243 | case VIDIOCSFREQ: /* set frequency */ | ||
1244 | err = v4l1_compat_set_frequency(arg, file, drv); | ||
1245 | break; | ||
1246 | case VIDIOCGAUDIO: /* get audio properties/controls */ | ||
1247 | err = v4l1_compat_get_audio(arg, file, drv); | ||
1248 | break; | ||
1249 | case VIDIOCSAUDIO: /* set audio controls */ | ||
1250 | err = v4l1_compat_set_audio(arg, file, drv); | ||
1251 | break; | ||
1252 | case VIDIOCMCAPTURE: /* capture a frame */ | ||
1253 | err = v4l1_compat_capture_frame(arg, file, drv); | ||
1254 | break; | ||
1255 | case VIDIOCSYNC: /* wait for a frame */ | ||
1256 | err = v4l1_compat_sync(arg, file, drv); | ||
1257 | break; | ||
1258 | case VIDIOCGVBIFMT: /* query VBI data capture format */ | ||
1259 | err = v4l1_compat_get_vbi_format(arg, file, drv); | ||
1260 | break; | ||
1261 | case VIDIOCSVBIFMT: | ||
1262 | err = v4l1_compat_set_vbi_format(arg, file, drv); | ||
1263 | break; | ||
1264 | default: | ||
1265 | err = -ENOIOCTLCMD; | ||
1266 | break; | ||
1267 | } | ||
1268 | |||
1269 | return err; | ||
1270 | } | ||
1271 | EXPORT_SYMBOL(v4l_compat_translate_ioctl); | ||
1272 | |||
1273 | /* | ||
1274 | * Local variables: | ||
1275 | * c-basic-offset: 8 | ||
1276 | * End: | ||
1277 | */ | ||
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index e30e8dfb6205..425ac1e4a00e 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c | |||
@@ -22,212 +22,6 @@ | |||
22 | 22 | ||
23 | #ifdef CONFIG_COMPAT | 23 | #ifdef CONFIG_COMPAT |
24 | 24 | ||
25 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
26 | struct video_tuner32 { | ||
27 | compat_int_t tuner; | ||
28 | char name[32]; | ||
29 | compat_ulong_t rangelow, rangehigh; | ||
30 | u32 flags; /* It is really u32 in videodev.h */ | ||
31 | u16 mode, signal; | ||
32 | }; | ||
33 | |||
34 | static int get_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) | ||
35 | { | ||
36 | if (!access_ok(VERIFY_READ, up, sizeof(struct video_tuner32)) || | ||
37 | get_user(kp->tuner, &up->tuner) || | ||
38 | copy_from_user(kp->name, up->name, 32) || | ||
39 | get_user(kp->rangelow, &up->rangelow) || | ||
40 | get_user(kp->rangehigh, &up->rangehigh) || | ||
41 | get_user(kp->flags, &up->flags) || | ||
42 | get_user(kp->mode, &up->mode) || | ||
43 | get_user(kp->signal, &up->signal)) | ||
44 | return -EFAULT; | ||
45 | return 0; | ||
46 | } | ||
47 | |||
48 | static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user *up) | ||
49 | { | ||
50 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_tuner32)) || | ||
51 | put_user(kp->tuner, &up->tuner) || | ||
52 | copy_to_user(up->name, kp->name, 32) || | ||
53 | put_user(kp->rangelow, &up->rangelow) || | ||
54 | put_user(kp->rangehigh, &up->rangehigh) || | ||
55 | put_user(kp->flags, &up->flags) || | ||
56 | put_user(kp->mode, &up->mode) || | ||
57 | put_user(kp->signal, &up->signal)) | ||
58 | return -EFAULT; | ||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | struct video_buffer32 { | ||
63 | compat_caddr_t base; | ||
64 | compat_int_t height, width, depth, bytesperline; | ||
65 | }; | ||
66 | |||
67 | static int get_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up) | ||
68 | { | ||
69 | u32 tmp; | ||
70 | |||
71 | if (!access_ok(VERIFY_READ, up, sizeof(struct video_buffer32)) || | ||
72 | get_user(tmp, &up->base) || | ||
73 | get_user(kp->height, &up->height) || | ||
74 | get_user(kp->width, &up->width) || | ||
75 | get_user(kp->depth, &up->depth) || | ||
76 | get_user(kp->bytesperline, &up->bytesperline)) | ||
77 | return -EFAULT; | ||
78 | |||
79 | /* This is actually a physical address stored | ||
80 | * as a void pointer. | ||
81 | */ | ||
82 | kp->base = (void *)(unsigned long) tmp; | ||
83 | |||
84 | return 0; | ||
85 | } | ||
86 | |||
87 | static int put_video_buffer32(struct video_buffer *kp, struct video_buffer32 __user *up) | ||
88 | { | ||
89 | u32 tmp = (u32)((unsigned long)kp->base); | ||
90 | |||
91 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_buffer32)) || | ||
92 | put_user(tmp, &up->base) || | ||
93 | put_user(kp->height, &up->height) || | ||
94 | put_user(kp->width, &up->width) || | ||
95 | put_user(kp->depth, &up->depth) || | ||
96 | put_user(kp->bytesperline, &up->bytesperline)) | ||
97 | return -EFAULT; | ||
98 | return 0; | ||
99 | } | ||
100 | |||
101 | struct video_clip32 { | ||
102 | s32 x, y, width, height; /* It's really s32 in videodev.h */ | ||
103 | compat_caddr_t next; | ||
104 | }; | ||
105 | |||
106 | struct video_window32 { | ||
107 | u32 x, y, width, height, chromakey, flags; | ||
108 | compat_caddr_t clips; | ||
109 | compat_int_t clipcount; | ||
110 | }; | ||
111 | |||
112 | static int get_video_window32(struct video_window *kp, struct video_window32 __user *up) | ||
113 | { | ||
114 | struct video_clip __user *uclips; | ||
115 | struct video_clip __user *kclips; | ||
116 | compat_caddr_t p; | ||
117 | int nclips; | ||
118 | |||
119 | if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32))) | ||
120 | return -EFAULT; | ||
121 | |||
122 | if (get_user(nclips, &up->clipcount)) | ||
123 | return -EFAULT; | ||
124 | |||
125 | if (!access_ok(VERIFY_READ, up, sizeof(struct video_window32)) || | ||
126 | get_user(kp->x, &up->x) || | ||
127 | get_user(kp->y, &up->y) || | ||
128 | get_user(kp->width, &up->width) || | ||
129 | get_user(kp->height, &up->height) || | ||
130 | get_user(kp->chromakey, &up->chromakey) || | ||
131 | get_user(kp->flags, &up->flags) || | ||
132 | get_user(kp->clipcount, &up->clipcount)) | ||
133 | return -EFAULT; | ||
134 | |||
135 | nclips = kp->clipcount; | ||
136 | kp->clips = NULL; | ||
137 | |||
138 | if (nclips == 0) | ||
139 | return 0; | ||
140 | if (get_user(p, &up->clips)) | ||
141 | return -EFAULT; | ||
142 | uclips = compat_ptr(p); | ||
143 | |||
144 | /* If nclips < 0, then it is a clipping bitmap of size | ||
145 | VIDEO_CLIPMAP_SIZE */ | ||
146 | if (nclips < 0) { | ||
147 | if (!access_ok(VERIFY_READ, uclips, VIDEO_CLIPMAP_SIZE)) | ||
148 | return -EFAULT; | ||
149 | kp->clips = compat_alloc_user_space(VIDEO_CLIPMAP_SIZE); | ||
150 | if (copy_in_user(kp->clips, uclips, VIDEO_CLIPMAP_SIZE)) | ||
151 | return -EFAULT; | ||
152 | return 0; | ||
153 | } | ||
154 | |||
155 | /* Otherwise it is an array of video_clip structs. */ | ||
156 | if (!access_ok(VERIFY_READ, uclips, nclips * sizeof(struct video_clip))) | ||
157 | return -EFAULT; | ||
158 | |||
159 | kp->clips = compat_alloc_user_space(nclips * sizeof(struct video_clip)); | ||
160 | kclips = kp->clips; | ||
161 | while (nclips--) { | ||
162 | int err; | ||
163 | |||
164 | err = copy_in_user(&kclips->x, &uclips->x, sizeof(kclips->x)); | ||
165 | err |= copy_in_user(&kclips->y, &uclips->y, sizeof(kclips->y)); | ||
166 | err |= copy_in_user(&kclips->width, &uclips->width, sizeof(kclips->width)); | ||
167 | err |= copy_in_user(&kclips->height, &uclips->height, sizeof(kclips->height)); | ||
168 | kclips->next = NULL; | ||
169 | if (err) | ||
170 | return -EFAULT; | ||
171 | kclips++; | ||
172 | uclips++; | ||
173 | } | ||
174 | return 0; | ||
175 | } | ||
176 | |||
177 | /* You get back everything except the clips... */ | ||
178 | static int put_video_window32(struct video_window *kp, struct video_window32 __user *up) | ||
179 | { | ||
180 | if (!access_ok(VERIFY_WRITE, up, sizeof(struct video_window32)) || | ||
181 | put_user(kp->x, &up->x) || | ||
182 | put_user(kp->y, &up->y) || | ||
183 | put_user(kp->width, &up->width) || | ||
184 | put_user(kp->height, &up->height) || | ||
185 | put_user(kp->chromakey, &up->chromakey) || | ||
186 | put_user(kp->flags, &up->flags) || | ||
187 | put_user(kp->clipcount, &up->clipcount)) | ||
188 | return -EFAULT; | ||
189 | return 0; | ||
190 | } | ||
191 | |||
192 | struct video_code32 { | ||
193 | char loadwhat[16]; /* name or tag of file being passed */ | ||
194 | compat_int_t datasize; | ||
195 | compat_uptr_t data; | ||
196 | }; | ||
197 | |||
198 | static struct video_code __user *get_microcode32(struct video_code32 *kp) | ||
199 | { | ||
200 | struct video_code __user *up; | ||
201 | |||
202 | up = compat_alloc_user_space(sizeof(*up)); | ||
203 | |||
204 | /* | ||
205 | * NOTE! We don't actually care if these fail. If the | ||
206 | * user address is invalid, the native ioctl will do | ||
207 | * the error handling for us | ||
208 | */ | ||
209 | (void) copy_to_user(up->loadwhat, kp->loadwhat, sizeof(up->loadwhat)); | ||
210 | (void) put_user(kp->datasize, &up->datasize); | ||
211 | (void) put_user(compat_ptr(kp->data), &up->data); | ||
212 | return up; | ||
213 | } | ||
214 | |||
215 | #define VIDIOCGTUNER32 _IOWR('v', 4, struct video_tuner32) | ||
216 | #define VIDIOCSTUNER32 _IOW('v', 5, struct video_tuner32) | ||
217 | #define VIDIOCGWIN32 _IOR('v', 9, struct video_window32) | ||
218 | #define VIDIOCSWIN32 _IOW('v', 10, struct video_window32) | ||
219 | #define VIDIOCGFBUF32 _IOR('v', 11, struct video_buffer32) | ||
220 | #define VIDIOCSFBUF32 _IOW('v', 12, struct video_buffer32) | ||
221 | #define VIDIOCGFREQ32 _IOR('v', 14, u32) | ||
222 | #define VIDIOCSFREQ32 _IOW('v', 15, u32) | ||
223 | #define VIDIOCSMICROCODE32 _IOW('v', 27, struct video_code32) | ||
224 | |||
225 | #define VIDIOCCAPTURE32 _IOW('v', 8, s32) | ||
226 | #define VIDIOCSYNC32 _IOW('v', 18, s32) | ||
227 | #define VIDIOCSWRITEMODE32 _IOW('v', 25, s32) | ||
228 | |||
229 | #endif | ||
230 | |||
231 | static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 25 | static long native_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
232 | { | 26 | { |
233 | long ret = -ENOIOCTLCMD; | 27 | long ret = -ENOIOCTLCMD; |
@@ -741,13 +535,6 @@ static int put_v4l2_ext_controls32(struct v4l2_ext_controls *kp, struct v4l2_ext | |||
741 | static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | 535 | static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg) |
742 | { | 536 | { |
743 | union { | 537 | union { |
744 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
745 | struct video_tuner vt; | ||
746 | struct video_buffer vb; | ||
747 | struct video_window vw; | ||
748 | struct video_code32 vc; | ||
749 | struct video_audio va; | ||
750 | #endif | ||
751 | struct v4l2_format v2f; | 538 | struct v4l2_format v2f; |
752 | struct v4l2_buffer v2b; | 539 | struct v4l2_buffer v2b; |
753 | struct v4l2_framebuffer v2fb; | 540 | struct v4l2_framebuffer v2fb; |
@@ -763,17 +550,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar | |||
763 | 550 | ||
764 | /* First, convert the command. */ | 551 | /* First, convert the command. */ |
765 | switch (cmd) { | 552 | switch (cmd) { |
766 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
767 | case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break; | ||
768 | case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break; | ||
769 | case VIDIOCGWIN32: cmd = VIDIOCGWIN; break; | ||
770 | case VIDIOCSWIN32: cmd = VIDIOCSWIN; break; | ||
771 | case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break; | ||
772 | case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break; | ||
773 | case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break; | ||
774 | case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break; | ||
775 | case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; | ||
776 | #endif | ||
777 | case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; | 553 | case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; |
778 | case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; | 554 | case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; |
779 | case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; | 555 | case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; |
@@ -800,46 +576,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar | |||
800 | } | 576 | } |
801 | 577 | ||
802 | switch (cmd) { | 578 | switch (cmd) { |
803 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
804 | case VIDIOCSTUNER: | ||
805 | case VIDIOCGTUNER: | ||
806 | err = get_video_tuner32(&karg.vt, up); | ||
807 | compatible_arg = 0; | ||
808 | break; | ||
809 | |||
810 | case VIDIOCSFBUF: | ||
811 | err = get_video_buffer32(&karg.vb, up); | ||
812 | compatible_arg = 0; | ||
813 | break; | ||
814 | |||
815 | case VIDIOCSWIN: | ||
816 | err = get_video_window32(&karg.vw, up); | ||
817 | compatible_arg = 0; | ||
818 | break; | ||
819 | |||
820 | case VIDIOCGWIN: | ||
821 | case VIDIOCGFBUF: | ||
822 | case VIDIOCGFREQ: | ||
823 | compatible_arg = 0; | ||
824 | break; | ||
825 | |||
826 | case VIDIOCSMICROCODE: | ||
827 | /* Copy the 32-bit "video_code32" to kernel space */ | ||
828 | if (copy_from_user(&karg.vc, up, sizeof(karg.vc))) | ||
829 | return -EFAULT; | ||
830 | /* Convert the 32-bit version to a 64-bit version in user space */ | ||
831 | up = get_microcode32(&karg.vc); | ||
832 | break; | ||
833 | |||
834 | case VIDIOCSFREQ: | ||
835 | err = get_user(karg.vx, (u32 __user *)up); | ||
836 | compatible_arg = 0; | ||
837 | break; | ||
838 | |||
839 | case VIDIOCCAPTURE: | ||
840 | case VIDIOCSYNC: | ||
841 | case VIDIOCSWRITEMODE: | ||
842 | #endif | ||
843 | case VIDIOC_OVERLAY: | 579 | case VIDIOC_OVERLAY: |
844 | case VIDIOC_STREAMON: | 580 | case VIDIOC_STREAMON: |
845 | case VIDIOC_STREAMOFF: | 581 | case VIDIOC_STREAMOFF: |
@@ -922,23 +658,6 @@ static long do_video_ioctl(struct file *file, unsigned int cmd, unsigned long ar | |||
922 | return err; | 658 | return err; |
923 | 659 | ||
924 | switch (cmd) { | 660 | switch (cmd) { |
925 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
926 | case VIDIOCGTUNER: | ||
927 | err = put_video_tuner32(&karg.vt, up); | ||
928 | break; | ||
929 | |||
930 | case VIDIOCGWIN: | ||
931 | err = put_video_window32(&karg.vw, up); | ||
932 | break; | ||
933 | |||
934 | case VIDIOCGFBUF: | ||
935 | err = put_video_buffer32(&karg.vb, up); | ||
936 | break; | ||
937 | |||
938 | case VIDIOCGFREQ: | ||
939 | err = put_user(((u32)karg.vx), (u32 __user *)up); | ||
940 | break; | ||
941 | #endif | ||
942 | case VIDIOC_S_INPUT: | 661 | case VIDIOC_S_INPUT: |
943 | case VIDIOC_S_OUTPUT: | 662 | case VIDIOC_S_OUTPUT: |
944 | case VIDIOC_G_INPUT: | 663 | case VIDIOC_G_INPUT: |
@@ -981,37 +700,6 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
981 | return ret; | 700 | return ret; |
982 | 701 | ||
983 | switch (cmd) { | 702 | switch (cmd) { |
984 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
985 | case VIDIOCGCAP: | ||
986 | case VIDIOCGCHAN: | ||
987 | case VIDIOCSCHAN: | ||
988 | case VIDIOCGTUNER32: | ||
989 | case VIDIOCSTUNER32: | ||
990 | case VIDIOCGPICT: | ||
991 | case VIDIOCSPICT: | ||
992 | case VIDIOCCAPTURE32: | ||
993 | case VIDIOCGWIN32: | ||
994 | case VIDIOCSWIN32: | ||
995 | case VIDIOCGFBUF32: | ||
996 | case VIDIOCSFBUF32: | ||
997 | case VIDIOCKEY: | ||
998 | case VIDIOCGFREQ32: | ||
999 | case VIDIOCSFREQ32: | ||
1000 | case VIDIOCGAUDIO: | ||
1001 | case VIDIOCSAUDIO: | ||
1002 | case VIDIOCSYNC32: | ||
1003 | case VIDIOCMCAPTURE: | ||
1004 | case VIDIOCGMBUF: | ||
1005 | case VIDIOCGUNIT: | ||
1006 | case VIDIOCGCAPTURE: | ||
1007 | case VIDIOCSCAPTURE: | ||
1008 | case VIDIOCSPLAYMODE: | ||
1009 | case VIDIOCSWRITEMODE32: | ||
1010 | case VIDIOCGPLAYINFO: | ||
1011 | case VIDIOCSMICROCODE32: | ||
1012 | case VIDIOCGVBIFMT: | ||
1013 | case VIDIOCSVBIFMT: | ||
1014 | #endif | ||
1015 | #ifdef __OLD_VIDIOC_ | 703 | #ifdef __OLD_VIDIOC_ |
1016 | case VIDIOC_OVERLAY32_OLD: | 704 | case VIDIOC_OVERLAY32_OLD: |
1017 | case VIDIOC_S_PARM_OLD: | 705 | case VIDIOC_S_PARM_OLD: |
@@ -1096,19 +784,6 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) | |||
1096 | ret = do_video_ioctl(file, cmd, arg); | 784 | ret = do_video_ioctl(file, cmd, arg); |
1097 | break; | 785 | break; |
1098 | 786 | ||
1099 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1100 | /* BTTV specific... */ | ||
1101 | case _IOW('v', BASE_VIDIOCPRIVATE+0, char [256]): | ||
1102 | case _IOR('v', BASE_VIDIOCPRIVATE+1, char [256]): | ||
1103 | case _IOR('v' , BASE_VIDIOCPRIVATE+2, unsigned int): | ||
1104 | case _IOW('v' , BASE_VIDIOCPRIVATE+3, char [16]): /* struct bttv_pll_info */ | ||
1105 | case _IOR('v' , BASE_VIDIOCPRIVATE+4, int): | ||
1106 | case _IOR('v' , BASE_VIDIOCPRIVATE+5, int): | ||
1107 | case _IOR('v' , BASE_VIDIOCPRIVATE+6, int): | ||
1108 | case _IOR('v' , BASE_VIDIOCPRIVATE+7, int): | ||
1109 | ret = native_ioctl(file, cmd, (unsigned long)compat_ptr(arg)); | ||
1110 | break; | ||
1111 | #endif | ||
1112 | default: | 787 | default: |
1113 | printk(KERN_WARNING "compat_ioctl32: " | 788 | printk(KERN_WARNING "compat_ioctl32: " |
1114 | "unknown ioctl '%c', dir=%d, #%d (0x%08x)\n", | 789 | "unknown ioctl '%c', dir=%d, #%d (0x%08x)\n", |
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c index dd9283fcb564..7e47f15f350d 100644 --- a/drivers/media/video/v4l2-ioctl.c +++ b/drivers/media/video/v4l2-ioctl.c | |||
@@ -18,12 +18,8 @@ | |||
18 | #include <linux/kernel.h> | 18 | #include <linux/kernel.h> |
19 | 19 | ||
20 | #define __OLD_VIDIOC_ /* To allow fixing old calls */ | 20 | #define __OLD_VIDIOC_ /* To allow fixing old calls */ |
21 | #include <linux/videodev.h> | ||
22 | #include <linux/videodev2.h> | 21 | #include <linux/videodev2.h> |
23 | 22 | ||
24 | #ifdef CONFIG_VIDEO_V4L1 | ||
25 | #include <linux/videodev.h> | ||
26 | #endif | ||
27 | #include <media/v4l2-common.h> | 23 | #include <media/v4l2-common.h> |
28 | #include <media/v4l2-ioctl.h> | 24 | #include <media/v4l2-ioctl.h> |
29 | #include <media/v4l2-ctrls.h> | 25 | #include <media/v4l2-ctrls.h> |
@@ -183,42 +179,6 @@ static const char *v4l2_memory_names[] = { | |||
183 | 179 | ||
184 | /* ------------------------------------------------------------------ */ | 180 | /* ------------------------------------------------------------------ */ |
185 | /* debug help functions */ | 181 | /* debug help functions */ |
186 | |||
187 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
188 | static const char *v4l1_ioctls[] = { | ||
189 | [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", | ||
190 | [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", | ||
191 | [_IOC_NR(VIDIOCSCHAN)] = "VIDIOCSCHAN", | ||
192 | [_IOC_NR(VIDIOCGTUNER)] = "VIDIOCGTUNER", | ||
193 | [_IOC_NR(VIDIOCSTUNER)] = "VIDIOCSTUNER", | ||
194 | [_IOC_NR(VIDIOCGPICT)] = "VIDIOCGPICT", | ||
195 | [_IOC_NR(VIDIOCSPICT)] = "VIDIOCSPICT", | ||
196 | [_IOC_NR(VIDIOCCAPTURE)] = "VIDIOCCAPTURE", | ||
197 | [_IOC_NR(VIDIOCGWIN)] = "VIDIOCGWIN", | ||
198 | [_IOC_NR(VIDIOCSWIN)] = "VIDIOCSWIN", | ||
199 | [_IOC_NR(VIDIOCGFBUF)] = "VIDIOCGFBUF", | ||
200 | [_IOC_NR(VIDIOCSFBUF)] = "VIDIOCSFBUF", | ||
201 | [_IOC_NR(VIDIOCKEY)] = "VIDIOCKEY", | ||
202 | [_IOC_NR(VIDIOCGFREQ)] = "VIDIOCGFREQ", | ||
203 | [_IOC_NR(VIDIOCSFREQ)] = "VIDIOCSFREQ", | ||
204 | [_IOC_NR(VIDIOCGAUDIO)] = "VIDIOCGAUDIO", | ||
205 | [_IOC_NR(VIDIOCSAUDIO)] = "VIDIOCSAUDIO", | ||
206 | [_IOC_NR(VIDIOCSYNC)] = "VIDIOCSYNC", | ||
207 | [_IOC_NR(VIDIOCMCAPTURE)] = "VIDIOCMCAPTURE", | ||
208 | [_IOC_NR(VIDIOCGMBUF)] = "VIDIOCGMBUF", | ||
209 | [_IOC_NR(VIDIOCGUNIT)] = "VIDIOCGUNIT", | ||
210 | [_IOC_NR(VIDIOCGCAPTURE)] = "VIDIOCGCAPTURE", | ||
211 | [_IOC_NR(VIDIOCSCAPTURE)] = "VIDIOCSCAPTURE", | ||
212 | [_IOC_NR(VIDIOCSPLAYMODE)] = "VIDIOCSPLAYMODE", | ||
213 | [_IOC_NR(VIDIOCSWRITEMODE)] = "VIDIOCSWRITEMODE", | ||
214 | [_IOC_NR(VIDIOCGPLAYINFO)] = "VIDIOCGPLAYINFO", | ||
215 | [_IOC_NR(VIDIOCSMICROCODE)] = "VIDIOCSMICROCODE", | ||
216 | [_IOC_NR(VIDIOCGVBIFMT)] = "VIDIOCGVBIFMT", | ||
217 | [_IOC_NR(VIDIOCSVBIFMT)] = "VIDIOCSVBIFMT" | ||
218 | }; | ||
219 | #define V4L1_IOCTLS ARRAY_SIZE(v4l1_ioctls) | ||
220 | #endif | ||
221 | |||
222 | static const char *v4l2_ioctls[] = { | 182 | static const char *v4l2_ioctls[] = { |
223 | [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP", | 183 | [_IOC_NR(VIDIOC_QUERYCAP)] = "VIDIOC_QUERYCAP", |
224 | [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED", | 184 | [_IOC_NR(VIDIOC_RESERVED)] = "VIDIOC_RESERVED", |
@@ -310,15 +270,6 @@ void v4l_printk_ioctl(unsigned int cmd) | |||
310 | case 'd': | 270 | case 'd': |
311 | type = "v4l2_int"; | 271 | type = "v4l2_int"; |
312 | break; | 272 | break; |
313 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
314 | case 'v': | ||
315 | if (_IOC_NR(cmd) >= V4L1_IOCTLS) { | ||
316 | type = "v4l1"; | ||
317 | break; | ||
318 | } | ||
319 | printk("%s", v4l1_ioctls[_IOC_NR(cmd)]); | ||
320 | return; | ||
321 | #endif | ||
322 | case 'V': | 273 | case 'V': |
323 | if (_IOC_NR(cmd) >= V4L2_IOCTLS) { | 274 | if (_IOC_NR(cmd) >= V4L2_IOCTLS) { |
324 | type = "v4l2"; | 275 | type = "v4l2"; |
@@ -622,20 +573,6 @@ static long __video_do_ioctl(struct file *file, | |||
622 | return -EINVAL; | 573 | return -EINVAL; |
623 | } | 574 | } |
624 | 575 | ||
625 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
626 | /******************************************************** | ||
627 | All other V4L1 calls are handled by v4l1_compat module. | ||
628 | Those calls will be translated into V4L2 calls, and | ||
629 | __video_do_ioctl will be called again, with one or more | ||
630 | V4L2 ioctls. | ||
631 | ********************************************************/ | ||
632 | if (_IOC_TYPE(cmd) == 'v' && cmd != VIDIOCGMBUF && | ||
633 | _IOC_NR(cmd) < BASE_VIDIOCPRIVATE) { | ||
634 | return v4l_compat_translate_ioctl(file, cmd, arg, | ||
635 | __video_do_ioctl); | ||
636 | } | ||
637 | #endif | ||
638 | |||
639 | if ((vfd->debug & V4L2_DEBUG_IOCTL) && | 576 | if ((vfd->debug & V4L2_DEBUG_IOCTL) && |
640 | !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { | 577 | !(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) { |
641 | v4l_print_ioctl(vfd->name, cmd); | 578 | v4l_print_ioctl(vfd->name, cmd); |
@@ -644,29 +581,6 @@ static long __video_do_ioctl(struct file *file, | |||
644 | 581 | ||
645 | switch (cmd) { | 582 | switch (cmd) { |
646 | 583 | ||
647 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
648 | /*********************************************************** | ||
649 | Handles calls to the obsoleted V4L1 API | ||
650 | Due to the nature of VIDIOCGMBUF, each driver that supports | ||
651 | V4L1 should implement its own handler for this ioctl. | ||
652 | ***********************************************************/ | ||
653 | |||
654 | /* --- streaming capture ------------------------------------- */ | ||
655 | case VIDIOCGMBUF: | ||
656 | { | ||
657 | struct video_mbuf *p = arg; | ||
658 | |||
659 | if (!ops->vidiocgmbuf) | ||
660 | break; | ||
661 | ret = ops->vidiocgmbuf(file, fh, p); | ||
662 | if (!ret) | ||
663 | dbgarg(cmd, "size=%d, frames=%d, offsets=0x%08lx\n", | ||
664 | p->size, p->frames, | ||
665 | (unsigned long)p->offsets); | ||
666 | break; | ||
667 | } | ||
668 | #endif | ||
669 | |||
670 | /* --- capabilities ------------------------------------------ */ | 584 | /* --- capabilities ------------------------------------------ */ |
671 | case VIDIOC_QUERYCAP: | 585 | case VIDIOC_QUERYCAP: |
672 | { | 586 | { |
diff --git a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c index 9eda7cc03121..e25aca5759fb 100644 --- a/drivers/media/video/via-camera.c +++ b/drivers/media/video/via-camera.c | |||
@@ -1161,16 +1161,6 @@ out: | |||
1161 | return ret; | 1161 | return ret; |
1162 | } | 1162 | } |
1163 | 1163 | ||
1164 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1165 | static int viacam_vidiocgmbuf(struct file *filp, void *priv, | ||
1166 | struct video_mbuf *mbuf) | ||
1167 | { | ||
1168 | struct via_camera *cam = priv; | ||
1169 | |||
1170 | return videobuf_cgmbuf(&cam->vb_queue, mbuf, 6); | ||
1171 | } | ||
1172 | #endif | ||
1173 | |||
1174 | /* G/S_PARM */ | 1164 | /* G/S_PARM */ |
1175 | 1165 | ||
1176 | static int viacam_g_parm(struct file *filp, void *priv, | 1166 | static int viacam_g_parm(struct file *filp, void *priv, |
@@ -1251,9 +1241,6 @@ static const struct v4l2_ioctl_ops viacam_ioctl_ops = { | |||
1251 | .vidioc_s_parm = viacam_s_parm, | 1241 | .vidioc_s_parm = viacam_s_parm, |
1252 | .vidioc_enum_framesizes = viacam_enum_framesizes, | 1242 | .vidioc_enum_framesizes = viacam_enum_framesizes, |
1253 | .vidioc_enum_frameintervals = viacam_enum_frameintervals, | 1243 | .vidioc_enum_frameintervals = viacam_enum_frameintervals, |
1254 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1255 | .vidiocgmbuf = viacam_vidiocgmbuf, | ||
1256 | #endif | ||
1257 | }; | 1244 | }; |
1258 | 1245 | ||
1259 | /*----------------------------------------------------------------------------*/ | 1246 | /*----------------------------------------------------------------------------*/ |
diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 8979f91fa8e5..de4fa4eb8844 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c | |||
@@ -1202,33 +1202,3 @@ int videobuf_mmap_mapper(struct videobuf_queue *q, struct vm_area_struct *vma) | |||
1202 | return rc; | 1202 | return rc; |
1203 | } | 1203 | } |
1204 | EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); | 1204 | EXPORT_SYMBOL_GPL(videobuf_mmap_mapper); |
1205 | |||
1206 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1207 | int videobuf_cgmbuf(struct videobuf_queue *q, | ||
1208 | struct video_mbuf *mbuf, int count) | ||
1209 | { | ||
1210 | struct v4l2_requestbuffers req; | ||
1211 | int rc, i; | ||
1212 | |||
1213 | MAGIC_CHECK(q->int_ops->magic, MAGIC_QTYPE_OPS); | ||
1214 | |||
1215 | memset(&req, 0, sizeof(req)); | ||
1216 | req.type = q->type; | ||
1217 | req.count = count; | ||
1218 | req.memory = V4L2_MEMORY_MMAP; | ||
1219 | rc = videobuf_reqbufs(q, &req); | ||
1220 | if (rc < 0) | ||
1221 | return rc; | ||
1222 | |||
1223 | mbuf->frames = req.count; | ||
1224 | mbuf->size = 0; | ||
1225 | for (i = 0; i < mbuf->frames; i++) { | ||
1226 | mbuf->offsets[i] = q->bufs[i]->boff; | ||
1227 | mbuf->size += PAGE_ALIGN(q->bufs[i]->bsize); | ||
1228 | } | ||
1229 | |||
1230 | return 0; | ||
1231 | } | ||
1232 | EXPORT_SYMBOL_GPL(videobuf_cgmbuf); | ||
1233 | #endif | ||
1234 | |||
diff --git a/drivers/media/video/videobuf-dma-sg.c b/drivers/media/video/videobuf-dma-sg.c index ab684e807034..9d520601c70f 100644 --- a/drivers/media/video/videobuf-dma-sg.c +++ b/drivers/media/video/videobuf-dma-sg.c | |||
@@ -570,29 +570,6 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, | |||
570 | } | 570 | } |
571 | 571 | ||
572 | last = first; | 572 | last = first; |
573 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
574 | if (size != (vma->vm_end - vma->vm_start)) { | ||
575 | /* look for last buffer to map */ | ||
576 | for (last = first + 1; last < VIDEO_MAX_FRAME; last++) { | ||
577 | if (NULL == q->bufs[last]) | ||
578 | continue; | ||
579 | if (V4L2_MEMORY_MMAP != q->bufs[last]->memory) | ||
580 | continue; | ||
581 | if (q->bufs[last]->map) { | ||
582 | retval = -EBUSY; | ||
583 | goto done; | ||
584 | } | ||
585 | size += PAGE_ALIGN(q->bufs[last]->bsize); | ||
586 | if (size == (vma->vm_end - vma->vm_start)) | ||
587 | break; | ||
588 | } | ||
589 | if (VIDEO_MAX_FRAME == last) { | ||
590 | dprintk(1, "mmap app bug: size invalid [size=0x%lx]\n", | ||
591 | (vma->vm_end - vma->vm_start)); | ||
592 | goto done; | ||
593 | } | ||
594 | } | ||
595 | #endif | ||
596 | 573 | ||
597 | /* create mapping + update buffer list */ | 574 | /* create mapping + update buffer list */ |
598 | retval = -ENOMEM; | 575 | retval = -ENOMEM; |
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 9797e5a69265..c49c39386bd0 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c | |||
@@ -870,15 +870,6 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *p) | |||
870 | file->f_flags & O_NONBLOCK); | 870 | file->f_flags & O_NONBLOCK); |
871 | } | 871 | } |
872 | 872 | ||
873 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
874 | static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | ||
875 | { | ||
876 | struct vivi_dev *dev = video_drvdata(file); | ||
877 | |||
878 | return videobuf_cgmbuf(&dev->vb_vidq, mbuf, 8); | ||
879 | } | ||
880 | #endif | ||
881 | |||
882 | static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) | 873 | static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i) |
883 | { | 874 | { |
884 | struct vivi_dev *dev = video_drvdata(file); | 875 | struct vivi_dev *dev = video_drvdata(file); |
@@ -1105,9 +1096,6 @@ static const struct v4l2_ioctl_ops vivi_ioctl_ops = { | |||
1105 | .vidioc_queryctrl = vidioc_queryctrl, | 1096 | .vidioc_queryctrl = vidioc_queryctrl, |
1106 | .vidioc_g_ctrl = vidioc_g_ctrl, | 1097 | .vidioc_g_ctrl = vidioc_g_ctrl, |
1107 | .vidioc_s_ctrl = vidioc_s_ctrl, | 1098 | .vidioc_s_ctrl = vidioc_s_ctrl, |
1108 | #ifdef CONFIG_VIDEO_V4L1_COMPAT | ||
1109 | .vidiocgmbuf = vidiocgmbuf, | ||
1110 | #endif | ||
1111 | }; | 1099 | }; |
1112 | 1100 | ||
1113 | static struct video_device vivi_template = { | 1101 | static struct video_device vivi_template = { |