aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2010-11-21 15:15:44 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-05-20 08:30:46 -0400
commit5f7088127e800df2cd5ff08140bdca087ab0fbac (patch)
tree1ab1b7e3d3581d7b794b5576ff25bc3d47e66739 /drivers/media
parentf411f103822379bab356345430f097bdae3440e5 (diff)
[media] uvcvideo: Make the API public
Move the public API definitions to include/linux/uvcvideo.h and bump the version number to 1.1.0. Compatibility with the old API is kept, application can still be compiled against the private header and will not break. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/uvc/uvc_v4l2.c13
-rw-r--r--drivers/media/video/uvc/uvcvideo.h68
2 files changed, 37 insertions, 44 deletions
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
index 2e2a556d1666..6e8aad44c4bd 100644
--- a/drivers/media/video/uvc/uvc_v4l2.c
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -1036,24 +1036,25 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
1036 * UVCIOC_CTRL_GET and UVCIOC_CTRL_SET are deprecated and scheduled for 1036 * UVCIOC_CTRL_GET and UVCIOC_CTRL_SET are deprecated and scheduled for
1037 * removal in 2.6.42. 1037 * removal in 2.6.42.
1038 */ 1038 */
1039 case UVCIOC_CTRL_ADD: 1039 case __UVCIOC_CTRL_ADD:
1040 uvc_v4l2_ioctl_warn(); 1040 uvc_v4l2_ioctl_warn();
1041 return -EEXIST; 1041 return -EEXIST;
1042 1042
1043 case UVCIOC_CTRL_MAP_OLD: 1043 case __UVCIOC_CTRL_MAP_OLD:
1044 uvc_v4l2_ioctl_warn(); 1044 uvc_v4l2_ioctl_warn();
1045 case __UVCIOC_CTRL_MAP:
1045 case UVCIOC_CTRL_MAP: 1046 case UVCIOC_CTRL_MAP:
1046 return uvc_ioctl_ctrl_map(chain, arg, 1047 return uvc_ioctl_ctrl_map(chain, arg,
1047 cmd == UVCIOC_CTRL_MAP_OLD); 1048 cmd == __UVCIOC_CTRL_MAP_OLD);
1048 1049
1049 case UVCIOC_CTRL_GET: 1050 case __UVCIOC_CTRL_GET:
1050 case UVCIOC_CTRL_SET: 1051 case __UVCIOC_CTRL_SET:
1051 { 1052 {
1052 struct uvc_xu_control *xctrl = arg; 1053 struct uvc_xu_control *xctrl = arg;
1053 struct uvc_xu_control_query xqry = { 1054 struct uvc_xu_control_query xqry = {
1054 .unit = xctrl->unit, 1055 .unit = xctrl->unit,
1055 .selector = xctrl->selector, 1056 .selector = xctrl->selector,
1056 .query = cmd == UVCIOC_CTRL_GET 1057 .query = cmd == __UVCIOC_CTRL_GET
1057 ? UVC_GET_CUR : UVC_SET_CUR, 1058 ? UVC_GET_CUR : UVC_SET_CUR,
1058 .size = xctrl->size, 1059 .size = xctrl->size,
1059 .data = xctrl->data, 1060 .data = xctrl->data,
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h
index cd58ea81320b..38dd4e18a2ca 100644
--- a/drivers/media/video/uvc/uvcvideo.h
+++ b/drivers/media/video/uvc/uvcvideo.h
@@ -4,6 +4,14 @@
4#include <linux/kernel.h> 4#include <linux/kernel.h>
5#include <linux/videodev2.h> 5#include <linux/videodev2.h>
6 6
7#ifndef __KERNEL__
8/*
9 * This header provides binary compatibility with applications using the private
10 * uvcvideo API. This API is deprecated and will be removed in 2.6.42.
11 * Applications should be recompiled against the public linux/uvcvideo.h header.
12 */
13#warn "The uvcvideo.h header is deprecated, use linux/uvcvideo.h instead."
14
7/* 15/*
8 * Dynamic controls 16 * Dynamic controls
9 */ 17 */
@@ -17,23 +25,6 @@
17#define UVC_CTRL_DATA_TYPE_BITMASK 5 25#define UVC_CTRL_DATA_TYPE_BITMASK 5
18 26
19/* Control flags */ 27/* Control flags */
20#define UVC_CTRL_FLAG_SET_CUR (1 << 0)
21#define UVC_CTRL_FLAG_GET_CUR (1 << 1)
22#define UVC_CTRL_FLAG_GET_MIN (1 << 2)
23#define UVC_CTRL_FLAG_GET_MAX (1 << 3)
24#define UVC_CTRL_FLAG_GET_RES (1 << 4)
25#define UVC_CTRL_FLAG_GET_DEF (1 << 5)
26/* Control should be saved at suspend and restored at resume. */
27#define UVC_CTRL_FLAG_RESTORE (1 << 6)
28/* Control can be updated by the camera. */
29#define UVC_CTRL_FLAG_AUTO_UPDATE (1 << 7)
30
31#define UVC_CTRL_FLAG_GET_RANGE \
32 (UVC_CTRL_FLAG_GET_CUR | UVC_CTRL_FLAG_GET_MIN | \
33 UVC_CTRL_FLAG_GET_MAX | UVC_CTRL_FLAG_GET_RES | \
34 UVC_CTRL_FLAG_GET_DEF)
35
36/* Old control flags, don't use */
37#define UVC_CONTROL_SET_CUR (1 << 0) 28#define UVC_CONTROL_SET_CUR (1 << 0)
38#define UVC_CONTROL_GET_CUR (1 << 1) 29#define UVC_CONTROL_GET_CUR (1 << 1)
39#define UVC_CONTROL_GET_MIN (1 << 2) 30#define UVC_CONTROL_GET_MIN (1 << 2)
@@ -47,23 +38,11 @@
47 UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | \ 38 UVC_CONTROL_GET_MAX | UVC_CONTROL_GET_RES | \
48 UVC_CONTROL_GET_DEF) 39 UVC_CONTROL_GET_DEF)
49 40
50struct uvc_xu_control_info {
51 __u8 entity[16];
52 __u8 index;
53 __u8 selector;
54 __u16 size;
55 __u32 flags;
56};
57
58struct uvc_menu_info { 41struct uvc_menu_info {
59 __u32 value; 42 __u32 value;
60 __u8 name[32]; 43 __u8 name[32];
61}; 44};
62 45
63struct uvc_xu_control_mapping_old {
64 __u8 reserved[64];
65};
66
67struct uvc_xu_control_mapping { 46struct uvc_xu_control_mapping {
68 __u32 id; 47 __u32 id;
69 __u8 name[32]; 48 __u8 name[32];
@@ -81,32 +60,46 @@ struct uvc_xu_control_mapping {
81 __u32 reserved[4]; 60 __u32 reserved[4];
82}; 61};
83 62
84struct uvc_xu_control { 63#endif
85 __u8 unit; 64
65struct uvc_xu_control_info {
66 __u8 entity[16];
67 __u8 index;
86 __u8 selector; 68 __u8 selector;
87 __u16 size; 69 __u16 size;
88 __u8 __user *data; 70 __u32 flags;
89}; 71};
90 72
91struct uvc_xu_control_query { 73struct uvc_xu_control_mapping_old {
74 __u8 reserved[64];
75};
76
77struct uvc_xu_control {
92 __u8 unit; 78 __u8 unit;
93 __u8 selector; 79 __u8 selector;
94 __u8 query;
95 __u16 size; 80 __u16 size;
96 __u8 __user *data; 81 __u8 __user *data;
97}; 82};
98 83
84#ifndef __KERNEL__
99#define UVCIOC_CTRL_ADD _IOW('U', 1, struct uvc_xu_control_info) 85#define UVCIOC_CTRL_ADD _IOW('U', 1, struct uvc_xu_control_info)
100#define UVCIOC_CTRL_MAP_OLD _IOWR('U', 2, struct uvc_xu_control_mapping_old) 86#define UVCIOC_CTRL_MAP_OLD _IOWR('U', 2, struct uvc_xu_control_mapping_old)
101#define UVCIOC_CTRL_MAP _IOWR('U', 2, struct uvc_xu_control_mapping) 87#define UVCIOC_CTRL_MAP _IOWR('U', 2, struct uvc_xu_control_mapping)
102#define UVCIOC_CTRL_GET _IOWR('U', 3, struct uvc_xu_control) 88#define UVCIOC_CTRL_GET _IOWR('U', 3, struct uvc_xu_control)
103#define UVCIOC_CTRL_SET _IOW('U', 4, struct uvc_xu_control) 89#define UVCIOC_CTRL_SET _IOW('U', 4, struct uvc_xu_control)
104#define UVCIOC_CTRL_QUERY _IOWR('U', 5, struct uvc_xu_control_query) 90#else
91#define __UVCIOC_CTRL_ADD _IOW('U', 1, struct uvc_xu_control_info)
92#define __UVCIOC_CTRL_MAP_OLD _IOWR('U', 2, struct uvc_xu_control_mapping_old)
93#define __UVCIOC_CTRL_MAP _IOWR('U', 2, struct uvc_xu_control_mapping)
94#define __UVCIOC_CTRL_GET _IOWR('U', 3, struct uvc_xu_control)
95#define __UVCIOC_CTRL_SET _IOW('U', 4, struct uvc_xu_control)
96#endif
105 97
106#ifdef __KERNEL__ 98#ifdef __KERNEL__
107 99
108#include <linux/poll.h> 100#include <linux/poll.h>
109#include <linux/usb/video.h> 101#include <linux/usb/video.h>
102#include <linux/uvcvideo.h>
110 103
111/* -------------------------------------------------------------------------- 104/* --------------------------------------------------------------------------
112 * UVC constants 105 * UVC constants
@@ -184,8 +177,8 @@ struct uvc_xu_control_query {
184 * Driver specific constants. 177 * Driver specific constants.
185 */ 178 */
186 179
187#define DRIVER_VERSION_NUMBER KERNEL_VERSION(1, 0, 0) 180#define DRIVER_VERSION_NUMBER KERNEL_VERSION(1, 1, 0)
188#define DRIVER_VERSION "v1.0.0" 181#define DRIVER_VERSION "v1.1.0"
189 182
190/* Number of isochronous URBs. */ 183/* Number of isochronous URBs. */
191#define UVC_URBS 5 184#define UVC_URBS 5
@@ -682,4 +675,3 @@ void uvc_video_decode_isight(struct urb *urb, struct uvc_streaming *stream,
682#endif /* __KERNEL__ */ 675#endif /* __KERNEL__ */
683 676
684#endif 677#endif
685