aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/uvc/uvc_v4l2.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/uvc/uvc_v4l2.c')
-rw-r--r--drivers/media/video/uvc/uvc_v4l2.c68
1 files changed, 59 insertions, 9 deletions
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
index 9005a8d9d5f8..543a80395b7f 100644
--- a/drivers/media/video/uvc/uvc_v4l2.c
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -538,6 +538,20 @@ static int uvc_v4l2_release(struct file *file)
538 return 0; 538 return 0;
539} 539}
540 540
541static void uvc_v4l2_ioctl_warn(void)
542{
543 static int warned;
544
545 if (warned)
546 return;
547
548 uvc_printk(KERN_INFO, "Deprecated UVCIOC_CTRL_{ADD,MAP_OLD,GET,SET} "
549 "ioctls will be removed in 2.6.42.\n");
550 uvc_printk(KERN_INFO, "See http://www.ideasonboard.org/uvc/upgrade/ "
551 "for upgrade instructions.\n");
552 warned = 1;
553}
554
541static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) 555static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
542{ 556{
543 struct video_device *vdev = video_devdata(file); 557 struct video_device *vdev = video_devdata(file);
@@ -1018,21 +1032,40 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1018 uvc_trace(UVC_TRACE_IOCTL, "Unsupported ioctl 0x%08x\n", cmd); 1032 uvc_trace(UVC_TRACE_IOCTL, "Unsupported ioctl 0x%08x\n", cmd);
1019 return -EINVAL; 1033 return -EINVAL;
1020 1034
1021 /* Dynamic controls. */ 1035 /* Dynamic controls. UVCIOC_CTRL_ADD, UVCIOC_CTRL_MAP_OLD,
1022 case UVCIOC_CTRL_ADD: 1036 * UVCIOC_CTRL_GET and UVCIOC_CTRL_SET are deprecated and scheduled for
1023 /* Legacy ioctl, kept for API compatibility reasons */ 1037 * removal in 2.6.42.
1038 */
1039 case __UVCIOC_CTRL_ADD:
1040 uvc_v4l2_ioctl_warn();
1024 return -EEXIST; 1041 return -EEXIST;
1025 1042
1026 case UVCIOC_CTRL_MAP_OLD: 1043 case __UVCIOC_CTRL_MAP_OLD:
1044 uvc_v4l2_ioctl_warn();
1045 case __UVCIOC_CTRL_MAP:
1027 case UVCIOC_CTRL_MAP: 1046 case UVCIOC_CTRL_MAP:
1028 return uvc_ioctl_ctrl_map(chain, arg, 1047 return uvc_ioctl_ctrl_map(chain, arg,
1029 cmd == UVCIOC_CTRL_MAP_OLD); 1048 cmd == __UVCIOC_CTRL_MAP_OLD);
1030 1049
1031 case UVCIOC_CTRL_GET: 1050 case __UVCIOC_CTRL_GET:
1032 return uvc_xu_ctrl_query(chain, arg, 0); 1051 case __UVCIOC_CTRL_SET:
1052 {
1053 struct uvc_xu_control *xctrl = arg;
1054 struct uvc_xu_control_query xqry = {
1055 .unit = xctrl->unit,
1056 .selector = xctrl->selector,
1057 .query = cmd == __UVCIOC_CTRL_GET
1058 ? UVC_GET_CUR : UVC_SET_CUR,
1059 .size = xctrl->size,
1060 .data = xctrl->data,
1061 };
1062
1063 uvc_v4l2_ioctl_warn();
1064 return uvc_xu_ctrl_query(chain, &xqry);
1065 }
1033 1066
1034 case UVCIOC_CTRL_SET: 1067 case UVCIOC_CTRL_QUERY:
1035 return uvc_xu_ctrl_query(chain, arg, 1); 1068 return uvc_xu_ctrl_query(chain, arg);
1036 1069
1037 default: 1070 default:
1038 uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd); 1071 uvc_trace(UVC_TRACE_IOCTL, "Unknown ioctl 0x%08x\n", cmd);
@@ -1081,6 +1114,20 @@ static unsigned int uvc_v4l2_poll(struct file *file, poll_table *wait)
1081 return uvc_queue_poll(&stream->queue, file, wait); 1114 return uvc_queue_poll(&stream->queue, file, wait);
1082} 1115}
1083 1116
1117#ifndef CONFIG_MMU
1118static unsigned long uvc_v4l2_get_unmapped_area(struct file *file,
1119 unsigned long addr, unsigned long len, unsigned long pgoff,
1120 unsigned long flags)
1121{
1122 struct uvc_fh *handle = file->private_data;
1123 struct uvc_streaming *stream = handle->stream;
1124
1125 uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_get_unmapped_area\n");
1126
1127 return uvc_queue_get_unmapped_area(&stream->queue, pgoff);
1128}
1129#endif
1130
1084const struct v4l2_file_operations uvc_fops = { 1131const struct v4l2_file_operations uvc_fops = {
1085 .owner = THIS_MODULE, 1132 .owner = THIS_MODULE,
1086 .open = uvc_v4l2_open, 1133 .open = uvc_v4l2_open,
@@ -1089,5 +1136,8 @@ const struct v4l2_file_operations uvc_fops = {
1089 .read = uvc_v4l2_read, 1136 .read = uvc_v4l2_read,
1090 .mmap = uvc_v4l2_mmap, 1137 .mmap = uvc_v4l2_mmap,
1091 .poll = uvc_v4l2_poll, 1138 .poll = uvc_v4l2_poll,
1139#ifndef CONFIG_MMU
1140 .get_unmapped_area = uvc_v4l2_get_unmapped_area,
1141#endif
1092}; 1142};
1093 1143