aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/uvc
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/uvc')
-rw-r--r--drivers/media/video/uvc/uvc_ctrl.c205
-rw-r--r--drivers/media/video/uvc/uvc_driver.c132
-rw-r--r--drivers/media/video/uvc/uvc_v4l2.c14
-rw-r--r--drivers/media/video/uvc/uvc_video.c30
-rw-r--r--drivers/media/video/uvc/uvcvideo.h218
5 files changed, 307 insertions, 292 deletions
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c
index 36a6ba92df27..70043b1704fb 100644
--- a/drivers/media/video/uvc/uvc_ctrl.c
+++ b/drivers/media/video/uvc/uvc_ctrl.c
@@ -34,7 +34,7 @@
34static struct uvc_control_info uvc_ctrls[] = { 34static struct uvc_control_info uvc_ctrls[] = {
35 { 35 {
36 .entity = UVC_GUID_UVC_PROCESSING, 36 .entity = UVC_GUID_UVC_PROCESSING,
37 .selector = PU_BRIGHTNESS_CONTROL, 37 .selector = UVC_PU_BRIGHTNESS_CONTROL,
38 .index = 0, 38 .index = 0,
39 .size = 2, 39 .size = 2,
40 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 40 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -42,7 +42,7 @@ static struct uvc_control_info uvc_ctrls[] = {
42 }, 42 },
43 { 43 {
44 .entity = UVC_GUID_UVC_PROCESSING, 44 .entity = UVC_GUID_UVC_PROCESSING,
45 .selector = PU_CONTRAST_CONTROL, 45 .selector = UVC_PU_CONTRAST_CONTROL,
46 .index = 1, 46 .index = 1,
47 .size = 2, 47 .size = 2,
48 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 48 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -50,7 +50,7 @@ static struct uvc_control_info uvc_ctrls[] = {
50 }, 50 },
51 { 51 {
52 .entity = UVC_GUID_UVC_PROCESSING, 52 .entity = UVC_GUID_UVC_PROCESSING,
53 .selector = PU_HUE_CONTROL, 53 .selector = UVC_PU_HUE_CONTROL,
54 .index = 2, 54 .index = 2,
55 .size = 2, 55 .size = 2,
56 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 56 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -58,7 +58,7 @@ static struct uvc_control_info uvc_ctrls[] = {
58 }, 58 },
59 { 59 {
60 .entity = UVC_GUID_UVC_PROCESSING, 60 .entity = UVC_GUID_UVC_PROCESSING,
61 .selector = PU_SATURATION_CONTROL, 61 .selector = UVC_PU_SATURATION_CONTROL,
62 .index = 3, 62 .index = 3,
63 .size = 2, 63 .size = 2,
64 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 64 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -66,7 +66,7 @@ static struct uvc_control_info uvc_ctrls[] = {
66 }, 66 },
67 { 67 {
68 .entity = UVC_GUID_UVC_PROCESSING, 68 .entity = UVC_GUID_UVC_PROCESSING,
69 .selector = PU_SHARPNESS_CONTROL, 69 .selector = UVC_PU_SHARPNESS_CONTROL,
70 .index = 4, 70 .index = 4,
71 .size = 2, 71 .size = 2,
72 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 72 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -74,7 +74,7 @@ static struct uvc_control_info uvc_ctrls[] = {
74 }, 74 },
75 { 75 {
76 .entity = UVC_GUID_UVC_PROCESSING, 76 .entity = UVC_GUID_UVC_PROCESSING,
77 .selector = PU_GAMMA_CONTROL, 77 .selector = UVC_PU_GAMMA_CONTROL,
78 .index = 5, 78 .index = 5,
79 .size = 2, 79 .size = 2,
80 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 80 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -82,7 +82,7 @@ static struct uvc_control_info uvc_ctrls[] = {
82 }, 82 },
83 { 83 {
84 .entity = UVC_GUID_UVC_PROCESSING, 84 .entity = UVC_GUID_UVC_PROCESSING,
85 .selector = PU_WHITE_BALANCE_TEMPERATURE_CONTROL, 85 .selector = UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL,
86 .index = 6, 86 .index = 6,
87 .size = 2, 87 .size = 2,
88 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 88 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -90,7 +90,7 @@ static struct uvc_control_info uvc_ctrls[] = {
90 }, 90 },
91 { 91 {
92 .entity = UVC_GUID_UVC_PROCESSING, 92 .entity = UVC_GUID_UVC_PROCESSING,
93 .selector = PU_WHITE_BALANCE_COMPONENT_CONTROL, 93 .selector = UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL,
94 .index = 7, 94 .index = 7,
95 .size = 4, 95 .size = 4,
96 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 96 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -98,7 +98,7 @@ static struct uvc_control_info uvc_ctrls[] = {
98 }, 98 },
99 { 99 {
100 .entity = UVC_GUID_UVC_PROCESSING, 100 .entity = UVC_GUID_UVC_PROCESSING,
101 .selector = PU_BACKLIGHT_COMPENSATION_CONTROL, 101 .selector = UVC_PU_BACKLIGHT_COMPENSATION_CONTROL,
102 .index = 8, 102 .index = 8,
103 .size = 2, 103 .size = 2,
104 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 104 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -106,7 +106,7 @@ static struct uvc_control_info uvc_ctrls[] = {
106 }, 106 },
107 { 107 {
108 .entity = UVC_GUID_UVC_PROCESSING, 108 .entity = UVC_GUID_UVC_PROCESSING,
109 .selector = PU_GAIN_CONTROL, 109 .selector = UVC_PU_GAIN_CONTROL,
110 .index = 9, 110 .index = 9,
111 .size = 2, 111 .size = 2,
112 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 112 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -114,7 +114,7 @@ static struct uvc_control_info uvc_ctrls[] = {
114 }, 114 },
115 { 115 {
116 .entity = UVC_GUID_UVC_PROCESSING, 116 .entity = UVC_GUID_UVC_PROCESSING,
117 .selector = PU_POWER_LINE_FREQUENCY_CONTROL, 117 .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
118 .index = 10, 118 .index = 10,
119 .size = 1, 119 .size = 1,
120 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 120 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -122,7 +122,7 @@ static struct uvc_control_info uvc_ctrls[] = {
122 }, 122 },
123 { 123 {
124 .entity = UVC_GUID_UVC_PROCESSING, 124 .entity = UVC_GUID_UVC_PROCESSING,
125 .selector = PU_HUE_AUTO_CONTROL, 125 .selector = UVC_PU_HUE_AUTO_CONTROL,
126 .index = 11, 126 .index = 11,
127 .size = 1, 127 .size = 1,
128 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR 128 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
@@ -130,7 +130,7 @@ static struct uvc_control_info uvc_ctrls[] = {
130 }, 130 },
131 { 131 {
132 .entity = UVC_GUID_UVC_PROCESSING, 132 .entity = UVC_GUID_UVC_PROCESSING,
133 .selector = PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL, 133 .selector = UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL,
134 .index = 12, 134 .index = 12,
135 .size = 1, 135 .size = 1,
136 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR 136 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
@@ -138,7 +138,7 @@ static struct uvc_control_info uvc_ctrls[] = {
138 }, 138 },
139 { 139 {
140 .entity = UVC_GUID_UVC_PROCESSING, 140 .entity = UVC_GUID_UVC_PROCESSING,
141 .selector = PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL, 141 .selector = UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL,
142 .index = 13, 142 .index = 13,
143 .size = 1, 143 .size = 1,
144 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR 144 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
@@ -146,7 +146,7 @@ static struct uvc_control_info uvc_ctrls[] = {
146 }, 146 },
147 { 147 {
148 .entity = UVC_GUID_UVC_PROCESSING, 148 .entity = UVC_GUID_UVC_PROCESSING,
149 .selector = PU_DIGITAL_MULTIPLIER_CONTROL, 149 .selector = UVC_PU_DIGITAL_MULTIPLIER_CONTROL,
150 .index = 14, 150 .index = 14,
151 .size = 2, 151 .size = 2,
152 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 152 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -154,7 +154,7 @@ static struct uvc_control_info uvc_ctrls[] = {
154 }, 154 },
155 { 155 {
156 .entity = UVC_GUID_UVC_PROCESSING, 156 .entity = UVC_GUID_UVC_PROCESSING,
157 .selector = PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL, 157 .selector = UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL,
158 .index = 15, 158 .index = 15,
159 .size = 2, 159 .size = 2,
160 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 160 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -162,21 +162,21 @@ static struct uvc_control_info uvc_ctrls[] = {
162 }, 162 },
163 { 163 {
164 .entity = UVC_GUID_UVC_PROCESSING, 164 .entity = UVC_GUID_UVC_PROCESSING,
165 .selector = PU_ANALOG_VIDEO_STANDARD_CONTROL, 165 .selector = UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL,
166 .index = 16, 166 .index = 16,
167 .size = 1, 167 .size = 1,
168 .flags = UVC_CONTROL_GET_CUR, 168 .flags = UVC_CONTROL_GET_CUR,
169 }, 169 },
170 { 170 {
171 .entity = UVC_GUID_UVC_PROCESSING, 171 .entity = UVC_GUID_UVC_PROCESSING,
172 .selector = PU_ANALOG_LOCK_STATUS_CONTROL, 172 .selector = UVC_PU_ANALOG_LOCK_STATUS_CONTROL,
173 .index = 17, 173 .index = 17,
174 .size = 1, 174 .size = 1,
175 .flags = UVC_CONTROL_GET_CUR, 175 .flags = UVC_CONTROL_GET_CUR,
176 }, 176 },
177 { 177 {
178 .entity = UVC_GUID_UVC_CAMERA, 178 .entity = UVC_GUID_UVC_CAMERA,
179 .selector = CT_SCANNING_MODE_CONTROL, 179 .selector = UVC_CT_SCANNING_MODE_CONTROL,
180 .index = 0, 180 .index = 0,
181 .size = 1, 181 .size = 1,
182 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR 182 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
@@ -184,7 +184,7 @@ static struct uvc_control_info uvc_ctrls[] = {
184 }, 184 },
185 { 185 {
186 .entity = UVC_GUID_UVC_CAMERA, 186 .entity = UVC_GUID_UVC_CAMERA,
187 .selector = CT_AE_MODE_CONTROL, 187 .selector = UVC_CT_AE_MODE_CONTROL,
188 .index = 1, 188 .index = 1,
189 .size = 1, 189 .size = 1,
190 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR 190 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
@@ -193,7 +193,7 @@ static struct uvc_control_info uvc_ctrls[] = {
193 }, 193 },
194 { 194 {
195 .entity = UVC_GUID_UVC_CAMERA, 195 .entity = UVC_GUID_UVC_CAMERA,
196 .selector = CT_AE_PRIORITY_CONTROL, 196 .selector = UVC_CT_AE_PRIORITY_CONTROL,
197 .index = 2, 197 .index = 2,
198 .size = 1, 198 .size = 1,
199 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR 199 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
@@ -201,7 +201,7 @@ static struct uvc_control_info uvc_ctrls[] = {
201 }, 201 },
202 { 202 {
203 .entity = UVC_GUID_UVC_CAMERA, 203 .entity = UVC_GUID_UVC_CAMERA,
204 .selector = CT_EXPOSURE_TIME_ABSOLUTE_CONTROL, 204 .selector = UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL,
205 .index = 3, 205 .index = 3,
206 .size = 4, 206 .size = 4,
207 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 207 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -209,7 +209,7 @@ static struct uvc_control_info uvc_ctrls[] = {
209 }, 209 },
210 { 210 {
211 .entity = UVC_GUID_UVC_CAMERA, 211 .entity = UVC_GUID_UVC_CAMERA,
212 .selector = CT_EXPOSURE_TIME_RELATIVE_CONTROL, 212 .selector = UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL,
213 .index = 4, 213 .index = 4,
214 .size = 1, 214 .size = 1,
215 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR 215 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
@@ -217,7 +217,7 @@ static struct uvc_control_info uvc_ctrls[] = {
217 }, 217 },
218 { 218 {
219 .entity = UVC_GUID_UVC_CAMERA, 219 .entity = UVC_GUID_UVC_CAMERA,
220 .selector = CT_FOCUS_ABSOLUTE_CONTROL, 220 .selector = UVC_CT_FOCUS_ABSOLUTE_CONTROL,
221 .index = 5, 221 .index = 5,
222 .size = 2, 222 .size = 2,
223 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 223 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -225,7 +225,7 @@ static struct uvc_control_info uvc_ctrls[] = {
225 }, 225 },
226 { 226 {
227 .entity = UVC_GUID_UVC_CAMERA, 227 .entity = UVC_GUID_UVC_CAMERA,
228 .selector = CT_FOCUS_RELATIVE_CONTROL, 228 .selector = UVC_CT_FOCUS_RELATIVE_CONTROL,
229 .index = 6, 229 .index = 6,
230 .size = 2, 230 .size = 2,
231 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 231 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -233,7 +233,7 @@ static struct uvc_control_info uvc_ctrls[] = {
233 }, 233 },
234 { 234 {
235 .entity = UVC_GUID_UVC_CAMERA, 235 .entity = UVC_GUID_UVC_CAMERA,
236 .selector = CT_IRIS_ABSOLUTE_CONTROL, 236 .selector = UVC_CT_IRIS_ABSOLUTE_CONTROL,
237 .index = 7, 237 .index = 7,
238 .size = 2, 238 .size = 2,
239 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 239 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -241,7 +241,7 @@ static struct uvc_control_info uvc_ctrls[] = {
241 }, 241 },
242 { 242 {
243 .entity = UVC_GUID_UVC_CAMERA, 243 .entity = UVC_GUID_UVC_CAMERA,
244 .selector = CT_IRIS_RELATIVE_CONTROL, 244 .selector = UVC_CT_IRIS_RELATIVE_CONTROL,
245 .index = 8, 245 .index = 8,
246 .size = 1, 246 .size = 1,
247 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR 247 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
@@ -249,7 +249,7 @@ static struct uvc_control_info uvc_ctrls[] = {
249 }, 249 },
250 { 250 {
251 .entity = UVC_GUID_UVC_CAMERA, 251 .entity = UVC_GUID_UVC_CAMERA,
252 .selector = CT_ZOOM_ABSOLUTE_CONTROL, 252 .selector = UVC_CT_ZOOM_ABSOLUTE_CONTROL,
253 .index = 9, 253 .index = 9,
254 .size = 2, 254 .size = 2,
255 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 255 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -257,7 +257,7 @@ static struct uvc_control_info uvc_ctrls[] = {
257 }, 257 },
258 { 258 {
259 .entity = UVC_GUID_UVC_CAMERA, 259 .entity = UVC_GUID_UVC_CAMERA,
260 .selector = CT_ZOOM_RELATIVE_CONTROL, 260 .selector = UVC_CT_ZOOM_RELATIVE_CONTROL,
261 .index = 10, 261 .index = 10,
262 .size = 3, 262 .size = 3,
263 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 263 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -265,7 +265,7 @@ static struct uvc_control_info uvc_ctrls[] = {
265 }, 265 },
266 { 266 {
267 .entity = UVC_GUID_UVC_CAMERA, 267 .entity = UVC_GUID_UVC_CAMERA,
268 .selector = CT_PANTILT_ABSOLUTE_CONTROL, 268 .selector = UVC_CT_PANTILT_ABSOLUTE_CONTROL,
269 .index = 11, 269 .index = 11,
270 .size = 8, 270 .size = 8,
271 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 271 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -273,7 +273,7 @@ static struct uvc_control_info uvc_ctrls[] = {
273 }, 273 },
274 { 274 {
275 .entity = UVC_GUID_UVC_CAMERA, 275 .entity = UVC_GUID_UVC_CAMERA,
276 .selector = CT_PANTILT_RELATIVE_CONTROL, 276 .selector = UVC_CT_PANTILT_RELATIVE_CONTROL,
277 .index = 12, 277 .index = 12,
278 .size = 4, 278 .size = 4,
279 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 279 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -281,7 +281,7 @@ static struct uvc_control_info uvc_ctrls[] = {
281 }, 281 },
282 { 282 {
283 .entity = UVC_GUID_UVC_CAMERA, 283 .entity = UVC_GUID_UVC_CAMERA,
284 .selector = CT_ROLL_ABSOLUTE_CONTROL, 284 .selector = UVC_CT_ROLL_ABSOLUTE_CONTROL,
285 .index = 13, 285 .index = 13,
286 .size = 2, 286 .size = 2,
287 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 287 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -289,7 +289,7 @@ static struct uvc_control_info uvc_ctrls[] = {
289 }, 289 },
290 { 290 {
291 .entity = UVC_GUID_UVC_CAMERA, 291 .entity = UVC_GUID_UVC_CAMERA,
292 .selector = CT_ROLL_RELATIVE_CONTROL, 292 .selector = UVC_CT_ROLL_RELATIVE_CONTROL,
293 .index = 14, 293 .index = 14,
294 .size = 2, 294 .size = 2,
295 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE 295 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_RANGE
@@ -297,7 +297,7 @@ static struct uvc_control_info uvc_ctrls[] = {
297 }, 297 },
298 { 298 {
299 .entity = UVC_GUID_UVC_CAMERA, 299 .entity = UVC_GUID_UVC_CAMERA,
300 .selector = CT_FOCUS_AUTO_CONTROL, 300 .selector = UVC_CT_FOCUS_AUTO_CONTROL,
301 .index = 17, 301 .index = 17,
302 .size = 1, 302 .size = 1,
303 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR 303 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
@@ -305,7 +305,7 @@ static struct uvc_control_info uvc_ctrls[] = {
305 }, 305 },
306 { 306 {
307 .entity = UVC_GUID_UVC_CAMERA, 307 .entity = UVC_GUID_UVC_CAMERA,
308 .selector = CT_PRIVACY_CONTROL, 308 .selector = UVC_CT_PRIVACY_CONTROL,
309 .index = 18, 309 .index = 18,
310 .size = 1, 310 .size = 1,
311 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR 311 .flags = UVC_CONTROL_SET_CUR | UVC_CONTROL_GET_CUR
@@ -332,13 +332,13 @@ static __s32 uvc_ctrl_get_zoom(struct uvc_control_mapping *mapping,
332 __s8 zoom = (__s8)data[0]; 332 __s8 zoom = (__s8)data[0];
333 333
334 switch (query) { 334 switch (query) {
335 case GET_CUR: 335 case UVC_GET_CUR:
336 return (zoom == 0) ? 0 : (zoom > 0 ? data[2] : -data[2]); 336 return (zoom == 0) ? 0 : (zoom > 0 ? data[2] : -data[2]);
337 337
338 case GET_MIN: 338 case UVC_GET_MIN:
339 case GET_MAX: 339 case UVC_GET_MAX:
340 case GET_RES: 340 case UVC_GET_RES:
341 case GET_DEF: 341 case UVC_GET_DEF:
342 default: 342 default:
343 return data[2]; 343 return data[2];
344 } 344 }
@@ -356,7 +356,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
356 .id = V4L2_CID_BRIGHTNESS, 356 .id = V4L2_CID_BRIGHTNESS,
357 .name = "Brightness", 357 .name = "Brightness",
358 .entity = UVC_GUID_UVC_PROCESSING, 358 .entity = UVC_GUID_UVC_PROCESSING,
359 .selector = PU_BRIGHTNESS_CONTROL, 359 .selector = UVC_PU_BRIGHTNESS_CONTROL,
360 .size = 16, 360 .size = 16,
361 .offset = 0, 361 .offset = 0,
362 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 362 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -366,7 +366,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
366 .id = V4L2_CID_CONTRAST, 366 .id = V4L2_CID_CONTRAST,
367 .name = "Contrast", 367 .name = "Contrast",
368 .entity = UVC_GUID_UVC_PROCESSING, 368 .entity = UVC_GUID_UVC_PROCESSING,
369 .selector = PU_CONTRAST_CONTROL, 369 .selector = UVC_PU_CONTRAST_CONTROL,
370 .size = 16, 370 .size = 16,
371 .offset = 0, 371 .offset = 0,
372 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 372 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -376,7 +376,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
376 .id = V4L2_CID_HUE, 376 .id = V4L2_CID_HUE,
377 .name = "Hue", 377 .name = "Hue",
378 .entity = UVC_GUID_UVC_PROCESSING, 378 .entity = UVC_GUID_UVC_PROCESSING,
379 .selector = PU_HUE_CONTROL, 379 .selector = UVC_PU_HUE_CONTROL,
380 .size = 16, 380 .size = 16,
381 .offset = 0, 381 .offset = 0,
382 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 382 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -386,7 +386,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
386 .id = V4L2_CID_SATURATION, 386 .id = V4L2_CID_SATURATION,
387 .name = "Saturation", 387 .name = "Saturation",
388 .entity = UVC_GUID_UVC_PROCESSING, 388 .entity = UVC_GUID_UVC_PROCESSING,
389 .selector = PU_SATURATION_CONTROL, 389 .selector = UVC_PU_SATURATION_CONTROL,
390 .size = 16, 390 .size = 16,
391 .offset = 0, 391 .offset = 0,
392 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 392 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -396,7 +396,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
396 .id = V4L2_CID_SHARPNESS, 396 .id = V4L2_CID_SHARPNESS,
397 .name = "Sharpness", 397 .name = "Sharpness",
398 .entity = UVC_GUID_UVC_PROCESSING, 398 .entity = UVC_GUID_UVC_PROCESSING,
399 .selector = PU_SHARPNESS_CONTROL, 399 .selector = UVC_PU_SHARPNESS_CONTROL,
400 .size = 16, 400 .size = 16,
401 .offset = 0, 401 .offset = 0,
402 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 402 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -406,7 +406,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
406 .id = V4L2_CID_GAMMA, 406 .id = V4L2_CID_GAMMA,
407 .name = "Gamma", 407 .name = "Gamma",
408 .entity = UVC_GUID_UVC_PROCESSING, 408 .entity = UVC_GUID_UVC_PROCESSING,
409 .selector = PU_GAMMA_CONTROL, 409 .selector = UVC_PU_GAMMA_CONTROL,
410 .size = 16, 410 .size = 16,
411 .offset = 0, 411 .offset = 0,
412 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 412 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -416,7 +416,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
416 .id = V4L2_CID_BACKLIGHT_COMPENSATION, 416 .id = V4L2_CID_BACKLIGHT_COMPENSATION,
417 .name = "Backlight Compensation", 417 .name = "Backlight Compensation",
418 .entity = UVC_GUID_UVC_PROCESSING, 418 .entity = UVC_GUID_UVC_PROCESSING,
419 .selector = PU_BACKLIGHT_COMPENSATION_CONTROL, 419 .selector = UVC_PU_BACKLIGHT_COMPENSATION_CONTROL,
420 .size = 16, 420 .size = 16,
421 .offset = 0, 421 .offset = 0,
422 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 422 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -426,7 +426,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
426 .id = V4L2_CID_GAIN, 426 .id = V4L2_CID_GAIN,
427 .name = "Gain", 427 .name = "Gain",
428 .entity = UVC_GUID_UVC_PROCESSING, 428 .entity = UVC_GUID_UVC_PROCESSING,
429 .selector = PU_GAIN_CONTROL, 429 .selector = UVC_PU_GAIN_CONTROL,
430 .size = 16, 430 .size = 16,
431 .offset = 0, 431 .offset = 0,
432 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 432 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -436,7 +436,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
436 .id = V4L2_CID_POWER_LINE_FREQUENCY, 436 .id = V4L2_CID_POWER_LINE_FREQUENCY,
437 .name = "Power Line Frequency", 437 .name = "Power Line Frequency",
438 .entity = UVC_GUID_UVC_PROCESSING, 438 .entity = UVC_GUID_UVC_PROCESSING,
439 .selector = PU_POWER_LINE_FREQUENCY_CONTROL, 439 .selector = UVC_PU_POWER_LINE_FREQUENCY_CONTROL,
440 .size = 2, 440 .size = 2,
441 .offset = 0, 441 .offset = 0,
442 .v4l2_type = V4L2_CTRL_TYPE_MENU, 442 .v4l2_type = V4L2_CTRL_TYPE_MENU,
@@ -448,7 +448,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
448 .id = V4L2_CID_HUE_AUTO, 448 .id = V4L2_CID_HUE_AUTO,
449 .name = "Hue, Auto", 449 .name = "Hue, Auto",
450 .entity = UVC_GUID_UVC_PROCESSING, 450 .entity = UVC_GUID_UVC_PROCESSING,
451 .selector = PU_HUE_AUTO_CONTROL, 451 .selector = UVC_PU_HUE_AUTO_CONTROL,
452 .size = 1, 452 .size = 1,
453 .offset = 0, 453 .offset = 0,
454 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, 454 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -458,7 +458,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
458 .id = V4L2_CID_EXPOSURE_AUTO, 458 .id = V4L2_CID_EXPOSURE_AUTO,
459 .name = "Exposure, Auto", 459 .name = "Exposure, Auto",
460 .entity = UVC_GUID_UVC_CAMERA, 460 .entity = UVC_GUID_UVC_CAMERA,
461 .selector = CT_AE_MODE_CONTROL, 461 .selector = UVC_CT_AE_MODE_CONTROL,
462 .size = 4, 462 .size = 4,
463 .offset = 0, 463 .offset = 0,
464 .v4l2_type = V4L2_CTRL_TYPE_MENU, 464 .v4l2_type = V4L2_CTRL_TYPE_MENU,
@@ -470,7 +470,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
470 .id = V4L2_CID_EXPOSURE_AUTO_PRIORITY, 470 .id = V4L2_CID_EXPOSURE_AUTO_PRIORITY,
471 .name = "Exposure, Auto Priority", 471 .name = "Exposure, Auto Priority",
472 .entity = UVC_GUID_UVC_CAMERA, 472 .entity = UVC_GUID_UVC_CAMERA,
473 .selector = CT_AE_PRIORITY_CONTROL, 473 .selector = UVC_CT_AE_PRIORITY_CONTROL,
474 .size = 1, 474 .size = 1,
475 .offset = 0, 475 .offset = 0,
476 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, 476 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -480,7 +480,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
480 .id = V4L2_CID_EXPOSURE_ABSOLUTE, 480 .id = V4L2_CID_EXPOSURE_ABSOLUTE,
481 .name = "Exposure (Absolute)", 481 .name = "Exposure (Absolute)",
482 .entity = UVC_GUID_UVC_CAMERA, 482 .entity = UVC_GUID_UVC_CAMERA,
483 .selector = CT_EXPOSURE_TIME_ABSOLUTE_CONTROL, 483 .selector = UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL,
484 .size = 32, 484 .size = 32,
485 .offset = 0, 485 .offset = 0,
486 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 486 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -490,7 +490,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
490 .id = V4L2_CID_AUTO_WHITE_BALANCE, 490 .id = V4L2_CID_AUTO_WHITE_BALANCE,
491 .name = "White Balance Temperature, Auto", 491 .name = "White Balance Temperature, Auto",
492 .entity = UVC_GUID_UVC_PROCESSING, 492 .entity = UVC_GUID_UVC_PROCESSING,
493 .selector = PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL, 493 .selector = UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL,
494 .size = 1, 494 .size = 1,
495 .offset = 0, 495 .offset = 0,
496 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, 496 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -500,7 +500,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
500 .id = V4L2_CID_WHITE_BALANCE_TEMPERATURE, 500 .id = V4L2_CID_WHITE_BALANCE_TEMPERATURE,
501 .name = "White Balance Temperature", 501 .name = "White Balance Temperature",
502 .entity = UVC_GUID_UVC_PROCESSING, 502 .entity = UVC_GUID_UVC_PROCESSING,
503 .selector = PU_WHITE_BALANCE_TEMPERATURE_CONTROL, 503 .selector = UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL,
504 .size = 16, 504 .size = 16,
505 .offset = 0, 505 .offset = 0,
506 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 506 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -510,7 +510,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
510 .id = V4L2_CID_AUTO_WHITE_BALANCE, 510 .id = V4L2_CID_AUTO_WHITE_BALANCE,
511 .name = "White Balance Component, Auto", 511 .name = "White Balance Component, Auto",
512 .entity = UVC_GUID_UVC_PROCESSING, 512 .entity = UVC_GUID_UVC_PROCESSING,
513 .selector = PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL, 513 .selector = UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL,
514 .size = 1, 514 .size = 1,
515 .offset = 0, 515 .offset = 0,
516 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, 516 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -520,7 +520,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
520 .id = V4L2_CID_BLUE_BALANCE, 520 .id = V4L2_CID_BLUE_BALANCE,
521 .name = "White Balance Blue Component", 521 .name = "White Balance Blue Component",
522 .entity = UVC_GUID_UVC_PROCESSING, 522 .entity = UVC_GUID_UVC_PROCESSING,
523 .selector = PU_WHITE_BALANCE_COMPONENT_CONTROL, 523 .selector = UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL,
524 .size = 16, 524 .size = 16,
525 .offset = 0, 525 .offset = 0,
526 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 526 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -530,7 +530,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
530 .id = V4L2_CID_RED_BALANCE, 530 .id = V4L2_CID_RED_BALANCE,
531 .name = "White Balance Red Component", 531 .name = "White Balance Red Component",
532 .entity = UVC_GUID_UVC_PROCESSING, 532 .entity = UVC_GUID_UVC_PROCESSING,
533 .selector = PU_WHITE_BALANCE_COMPONENT_CONTROL, 533 .selector = UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL,
534 .size = 16, 534 .size = 16,
535 .offset = 16, 535 .offset = 16,
536 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 536 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -540,7 +540,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
540 .id = V4L2_CID_FOCUS_ABSOLUTE, 540 .id = V4L2_CID_FOCUS_ABSOLUTE,
541 .name = "Focus (absolute)", 541 .name = "Focus (absolute)",
542 .entity = UVC_GUID_UVC_CAMERA, 542 .entity = UVC_GUID_UVC_CAMERA,
543 .selector = CT_FOCUS_ABSOLUTE_CONTROL, 543 .selector = UVC_CT_FOCUS_ABSOLUTE_CONTROL,
544 .size = 16, 544 .size = 16,
545 .offset = 0, 545 .offset = 0,
546 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 546 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -550,7 +550,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
550 .id = V4L2_CID_FOCUS_AUTO, 550 .id = V4L2_CID_FOCUS_AUTO,
551 .name = "Focus, Auto", 551 .name = "Focus, Auto",
552 .entity = UVC_GUID_UVC_CAMERA, 552 .entity = UVC_GUID_UVC_CAMERA,
553 .selector = CT_FOCUS_AUTO_CONTROL, 553 .selector = UVC_CT_FOCUS_AUTO_CONTROL,
554 .size = 1, 554 .size = 1,
555 .offset = 0, 555 .offset = 0,
556 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, 556 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -560,7 +560,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
560 .id = V4L2_CID_ZOOM_ABSOLUTE, 560 .id = V4L2_CID_ZOOM_ABSOLUTE,
561 .name = "Zoom, Absolute", 561 .name = "Zoom, Absolute",
562 .entity = UVC_GUID_UVC_CAMERA, 562 .entity = UVC_GUID_UVC_CAMERA,
563 .selector = CT_ZOOM_ABSOLUTE_CONTROL, 563 .selector = UVC_CT_ZOOM_ABSOLUTE_CONTROL,
564 .size = 16, 564 .size = 16,
565 .offset = 0, 565 .offset = 0,
566 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 566 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -570,7 +570,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
570 .id = V4L2_CID_ZOOM_CONTINUOUS, 570 .id = V4L2_CID_ZOOM_CONTINUOUS,
571 .name = "Zoom, Continuous", 571 .name = "Zoom, Continuous",
572 .entity = UVC_GUID_UVC_CAMERA, 572 .entity = UVC_GUID_UVC_CAMERA,
573 .selector = CT_ZOOM_RELATIVE_CONTROL, 573 .selector = UVC_CT_ZOOM_RELATIVE_CONTROL,
574 .size = 0, 574 .size = 0,
575 .offset = 0, 575 .offset = 0,
576 .v4l2_type = V4L2_CTRL_TYPE_INTEGER, 576 .v4l2_type = V4L2_CTRL_TYPE_INTEGER,
@@ -582,7 +582,7 @@ static struct uvc_control_mapping uvc_ctrl_mappings[] = {
582 .id = V4L2_CID_PRIVACY, 582 .id = V4L2_CID_PRIVACY,
583 .name = "Privacy", 583 .name = "Privacy",
584 .entity = UVC_GUID_UVC_CAMERA, 584 .entity = UVC_GUID_UVC_CAMERA,
585 .selector = CT_PRIVACY_CONTROL, 585 .selector = UVC_CT_PRIVACY_CONTROL,
586 .size = 1, 586 .size = 1,
587 .offset = 0, 587 .offset = 0,
588 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN, 588 .v4l2_type = V4L2_CTRL_TYPE_BOOLEAN,
@@ -675,16 +675,16 @@ static const __u8 uvc_media_transport_input_guid[16] =
675static int uvc_entity_match_guid(struct uvc_entity *entity, __u8 guid[16]) 675static int uvc_entity_match_guid(struct uvc_entity *entity, __u8 guid[16])
676{ 676{
677 switch (UVC_ENTITY_TYPE(entity)) { 677 switch (UVC_ENTITY_TYPE(entity)) {
678 case ITT_CAMERA: 678 case UVC_ITT_CAMERA:
679 return memcmp(uvc_camera_guid, guid, 16) == 0; 679 return memcmp(uvc_camera_guid, guid, 16) == 0;
680 680
681 case ITT_MEDIA_TRANSPORT_INPUT: 681 case UVC_ITT_MEDIA_TRANSPORT_INPUT:
682 return memcmp(uvc_media_transport_input_guid, guid, 16) == 0; 682 return memcmp(uvc_media_transport_input_guid, guid, 16) == 0;
683 683
684 case VC_PROCESSING_UNIT: 684 case UVC_VC_PROCESSING_UNIT:
685 return memcmp(uvc_processing_guid, guid, 16) == 0; 685 return memcmp(uvc_processing_guid, guid, 16) == 0;
686 686
687 case VC_EXTENSION_UNIT: 687 case UVC_VC_EXTENSION_UNIT:
688 return memcmp(entity->extension.guidExtensionCode, 688 return memcmp(entity->extension.guidExtensionCode,
689 guid, 16) == 0; 689 guid, 16) == 0;
690 690
@@ -793,11 +793,13 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
793 v4l2_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY; 793 v4l2_ctrl->flags |= V4L2_CTRL_FLAG_READ_ONLY;
794 794
795 if (ctrl->info->flags & UVC_CONTROL_GET_DEF) { 795 if (ctrl->info->flags & UVC_CONTROL_GET_DEF) {
796 if ((ret = uvc_query_ctrl(video->dev, GET_DEF, ctrl->entity->id, 796 ret = uvc_query_ctrl(video->dev, UVC_GET_DEF, ctrl->entity->id,
797 video->dev->intfnum, ctrl->info->selector, 797 video->dev->intfnum, ctrl->info->selector, data,
798 data, ctrl->info->size)) < 0) 798 ctrl->info->size);
799 if (ret < 0)
799 goto out; 800 goto out;
800 v4l2_ctrl->default_value = mapping->get(mapping, GET_DEF, data); 801 v4l2_ctrl->default_value =
802 mapping->get(mapping, UVC_GET_DEF, data);
801 } 803 }
802 804
803 switch (mapping->v4l2_type) { 805 switch (mapping->v4l2_type) {
@@ -829,25 +831,28 @@ int uvc_query_v4l2_ctrl(struct uvc_video_device *video,
829 } 831 }
830 832
831 if (ctrl->info->flags & UVC_CONTROL_GET_MIN) { 833 if (ctrl->info->flags & UVC_CONTROL_GET_MIN) {
832 if ((ret = uvc_query_ctrl(video->dev, GET_MIN, ctrl->entity->id, 834 ret = uvc_query_ctrl(video->dev, UVC_GET_MIN, ctrl->entity->id,
833 video->dev->intfnum, ctrl->info->selector, 835 video->dev->intfnum, ctrl->info->selector, data,
834 data, ctrl->info->size)) < 0) 836 ctrl->info->size);
837 if (ret < 0)
835 goto out; 838 goto out;
836 v4l2_ctrl->minimum = mapping->get(mapping, GET_MIN, data); 839 v4l2_ctrl->minimum = mapping->get(mapping, UVC_GET_MIN, data);
837 } 840 }
838 if (ctrl->info->flags & UVC_CONTROL_GET_MAX) { 841 if (ctrl->info->flags & UVC_CONTROL_GET_MAX) {
839 if ((ret = uvc_query_ctrl(video->dev, GET_MAX, ctrl->entity->id, 842 ret = uvc_query_ctrl(video->dev, UVC_GET_MAX, ctrl->entity->id,
840 video->dev->intfnum, ctrl->info->selector, 843 video->dev->intfnum, ctrl->info->selector, data,
841 data, ctrl->info->size)) < 0) 844 ctrl->info->size);
845 if (ret < 0)
842 goto out; 846 goto out;
843 v4l2_ctrl->maximum = mapping->get(mapping, GET_MAX, data); 847 v4l2_ctrl->maximum = mapping->get(mapping, UVC_GET_MAX, data);
844 } 848 }
845 if (ctrl->info->flags & UVC_CONTROL_GET_RES) { 849 if (ctrl->info->flags & UVC_CONTROL_GET_RES) {
846 if ((ret = uvc_query_ctrl(video->dev, GET_RES, ctrl->entity->id, 850 ret = uvc_query_ctrl(video->dev, UVC_GET_RES, ctrl->entity->id,
847 video->dev->intfnum, ctrl->info->selector, 851 video->dev->intfnum, ctrl->info->selector, data,
848 data, ctrl->info->size)) < 0) 852 ctrl->info->size);
853 if (ret < 0)
849 goto out; 854 goto out;
850 v4l2_ctrl->step = mapping->get(mapping, GET_RES, data); 855 v4l2_ctrl->step = mapping->get(mapping, UVC_GET_RES, data);
851 } 856 }
852 857
853 ret = 0; 858 ret = 0;
@@ -912,7 +917,7 @@ static int uvc_ctrl_commit_entity(struct uvc_device *dev,
912 continue; 917 continue;
913 918
914 if (!rollback) 919 if (!rollback)
915 ret = uvc_query_ctrl(dev, SET_CUR, ctrl->entity->id, 920 ret = uvc_query_ctrl(dev, UVC_SET_CUR, ctrl->entity->id,
916 dev->intfnum, ctrl->info->selector, 921 dev->intfnum, ctrl->info->selector,
917 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), 922 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
918 ctrl->info->size); 923 ctrl->info->size);
@@ -974,7 +979,7 @@ int uvc_ctrl_get(struct uvc_video_device *video,
974 return -EINVAL; 979 return -EINVAL;
975 980
976 if (!ctrl->loaded) { 981 if (!ctrl->loaded) {
977 ret = uvc_query_ctrl(video->dev, GET_CUR, ctrl->entity->id, 982 ret = uvc_query_ctrl(video->dev, UVC_GET_CUR, ctrl->entity->id,
978 video->dev->intfnum, ctrl->info->selector, 983 video->dev->intfnum, ctrl->info->selector,
979 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), 984 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
980 ctrl->info->size); 985 ctrl->info->size);
@@ -984,7 +989,7 @@ int uvc_ctrl_get(struct uvc_video_device *video,
984 ctrl->loaded = 1; 989 ctrl->loaded = 1;
985 } 990 }
986 991
987 xctrl->value = mapping->get(mapping, GET_CUR, 992 xctrl->value = mapping->get(mapping, UVC_GET_CUR,
988 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT)); 993 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT));
989 994
990 if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) { 995 if (mapping->v4l2_type == V4L2_CTRL_TYPE_MENU) {
@@ -1023,7 +1028,7 @@ int uvc_ctrl_set(struct uvc_video_device *video,
1023 memset(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), 1028 memset(uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
1024 0, ctrl->info->size); 1029 0, ctrl->info->size);
1025 } else { 1030 } else {
1026 ret = uvc_query_ctrl(video->dev, GET_CUR, 1031 ret = uvc_query_ctrl(video->dev, UVC_GET_CUR,
1027 ctrl->entity->id, video->dev->intfnum, 1032 ctrl->entity->id, video->dev->intfnum,
1028 ctrl->info->selector, 1033 ctrl->info->selector,
1029 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT), 1034 uvc_ctrl_data(ctrl, UVC_CTRL_DATA_CURRENT),
@@ -1115,9 +1120,9 @@ int uvc_xu_ctrl_query(struct uvc_video_device *video,
1115 goto out; 1120 goto out;
1116 } 1121 }
1117 1122
1118 ret = uvc_query_ctrl(video->dev, set ? SET_CUR : GET_CUR, xctrl->unit, 1123 ret = uvc_query_ctrl(video->dev, set ? UVC_SET_CUR : UVC_GET_CUR,
1119 video->dev->intfnum, xctrl->selector, data, 1124 xctrl->unit, video->dev->intfnum, xctrl->selector,
1120 xctrl->size); 1125 data, xctrl->size);
1121 if (ret < 0) 1126 if (ret < 0)
1122 goto out; 1127 goto out;
1123 1128
@@ -1211,7 +1216,7 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev,
1211 if (!found) 1216 if (!found)
1212 return; 1217 return;
1213 1218
1214 if (UVC_ENTITY_TYPE(entity) == VC_EXTENSION_UNIT) { 1219 if (UVC_ENTITY_TYPE(entity) == UVC_VC_EXTENSION_UNIT) {
1215 /* Check if the device control information and length match 1220 /* Check if the device control information and length match
1216 * the user supplied information. 1221 * the user supplied information.
1217 */ 1222 */
@@ -1219,8 +1224,9 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev,
1219 __le16 size; 1224 __le16 size;
1220 __u8 inf; 1225 __u8 inf;
1221 1226
1222 if ((ret = uvc_query_ctrl(dev, GET_LEN, ctrl->entity->id, 1227 ret = uvc_query_ctrl(dev, UVC_GET_LEN, ctrl->entity->id,
1223 dev->intfnum, info->selector, (__u8 *)&size, 2)) < 0) { 1228 dev->intfnum, info->selector, (__u8 *)&size, 2);
1229 if (ret < 0) {
1224 uvc_trace(UVC_TRACE_CONTROL, "GET_LEN failed on " 1230 uvc_trace(UVC_TRACE_CONTROL, "GET_LEN failed on "
1225 "control " UVC_GUID_FORMAT "/%u (%d).\n", 1231 "control " UVC_GUID_FORMAT "/%u (%d).\n",
1226 UVC_GUID_ARGS(info->entity), info->selector, 1232 UVC_GUID_ARGS(info->entity), info->selector,
@@ -1236,8 +1242,9 @@ static void uvc_ctrl_add_ctrl(struct uvc_device *dev,
1236 return; 1242 return;
1237 } 1243 }
1238 1244
1239 if ((ret = uvc_query_ctrl(dev, GET_INFO, ctrl->entity->id, 1245 ret = uvc_query_ctrl(dev, UVC_GET_INFO, ctrl->entity->id,
1240 dev->intfnum, info->selector, &inf, 1)) < 0) { 1246 dev->intfnum, info->selector, &inf, 1);
1247 if (ret < 0) {
1241 uvc_trace(UVC_TRACE_CONTROL, "GET_INFO failed on " 1248 uvc_trace(UVC_TRACE_CONTROL, "GET_INFO failed on "
1242 "control " UVC_GUID_FORMAT "/%u (%d).\n", 1249 "control " UVC_GUID_FORMAT "/%u (%d).\n",
1243 UVC_GUID_ARGS(info->entity), info->selector, 1250 UVC_GUID_ARGS(info->entity), info->selector,
@@ -1391,7 +1398,7 @@ uvc_ctrl_prune_entity(struct uvc_device *dev, struct uvc_entity *entity)
1391 unsigned int size; 1398 unsigned int size;
1392 unsigned int i; 1399 unsigned int i;
1393 1400
1394 if (UVC_ENTITY_TYPE(entity) != VC_PROCESSING_UNIT) 1401 if (UVC_ENTITY_TYPE(entity) != UVC_VC_PROCESSING_UNIT)
1395 return; 1402 return;
1396 1403
1397 controls = entity->processing.bmControls; 1404 controls = entity->processing.bmControls;
@@ -1427,13 +1434,13 @@ int uvc_ctrl_init_device(struct uvc_device *dev)
1427 unsigned int bControlSize = 0, ncontrols = 0; 1434 unsigned int bControlSize = 0, ncontrols = 0;
1428 __u8 *bmControls = NULL; 1435 __u8 *bmControls = NULL;
1429 1436
1430 if (UVC_ENTITY_TYPE(entity) == VC_EXTENSION_UNIT) { 1437 if (UVC_ENTITY_TYPE(entity) == UVC_VC_EXTENSION_UNIT) {
1431 bmControls = entity->extension.bmControls; 1438 bmControls = entity->extension.bmControls;
1432 bControlSize = entity->extension.bControlSize; 1439 bControlSize = entity->extension.bControlSize;
1433 } else if (UVC_ENTITY_TYPE(entity) == VC_PROCESSING_UNIT) { 1440 } else if (UVC_ENTITY_TYPE(entity) == UVC_VC_PROCESSING_UNIT) {
1434 bmControls = entity->processing.bmControls; 1441 bmControls = entity->processing.bmControls;
1435 bControlSize = entity->processing.bControlSize; 1442 bControlSize = entity->processing.bControlSize;
1436 } else if (UVC_ENTITY_TYPE(entity) == ITT_CAMERA) { 1443 } else if (UVC_ENTITY_TYPE(entity) == UVC_ITT_CAMERA) {
1437 bmControls = entity->camera.bmControls; 1444 bmControls = entity->camera.bmControls;
1438 bControlSize = entity->camera.bControlSize; 1445 bControlSize = entity->camera.bControlSize;
1439 } 1446 }
diff --git a/drivers/media/video/uvc/uvc_driver.c b/drivers/media/video/uvc/uvc_driver.c
index bebc187846fa..bd040113e9d1 100644
--- a/drivers/media/video/uvc/uvc_driver.c
+++ b/drivers/media/video/uvc/uvc_driver.c
@@ -249,23 +249,23 @@ static struct uvc_entity *uvc_entity_by_reference(struct uvc_device *dev,
249 249
250 list_for_each_entry_continue(entity, &dev->entities, list) { 250 list_for_each_entry_continue(entity, &dev->entities, list) {
251 switch (UVC_ENTITY_TYPE(entity)) { 251 switch (UVC_ENTITY_TYPE(entity)) {
252 case TT_STREAMING: 252 case UVC_TT_STREAMING:
253 if (entity->output.bSourceID == id) 253 if (entity->output.bSourceID == id)
254 return entity; 254 return entity;
255 break; 255 break;
256 256
257 case VC_PROCESSING_UNIT: 257 case UVC_VC_PROCESSING_UNIT:
258 if (entity->processing.bSourceID == id) 258 if (entity->processing.bSourceID == id)
259 return entity; 259 return entity;
260 break; 260 break;
261 261
262 case VC_SELECTOR_UNIT: 262 case UVC_VC_SELECTOR_UNIT:
263 for (i = 0; i < entity->selector.bNrInPins; ++i) 263 for (i = 0; i < entity->selector.bNrInPins; ++i)
264 if (entity->selector.baSourceID[i] == id) 264 if (entity->selector.baSourceID[i] == id)
265 return entity; 265 return entity;
266 break; 266 break;
267 267
268 case VC_EXTENSION_UNIT: 268 case UVC_VC_EXTENSION_UNIT:
269 for (i = 0; i < entity->extension.bNrInPins; ++i) 269 for (i = 0; i < entity->extension.bNrInPins; ++i)
270 if (entity->extension.baSourceID[i] == id) 270 if (entity->extension.baSourceID[i] == id)
271 return entity; 271 return entity;
@@ -297,9 +297,9 @@ static int uvc_parse_format(struct uvc_device *dev,
297 format->index = buffer[3]; 297 format->index = buffer[3];
298 298
299 switch (buffer[2]) { 299 switch (buffer[2]) {
300 case VS_FORMAT_UNCOMPRESSED: 300 case UVC_VS_FORMAT_UNCOMPRESSED:
301 case VS_FORMAT_FRAME_BASED: 301 case UVC_VS_FORMAT_FRAME_BASED:
302 n = buffer[2] == VS_FORMAT_UNCOMPRESSED ? 27 : 28; 302 n = buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED ? 27 : 28;
303 if (buflen < n) { 303 if (buflen < n) {
304 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming " 304 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
305 "interface %d FORMAT error\n", 305 "interface %d FORMAT error\n",
@@ -325,16 +325,16 @@ static int uvc_parse_format(struct uvc_device *dev,
325 } 325 }
326 326
327 format->bpp = buffer[21]; 327 format->bpp = buffer[21];
328 if (buffer[2] == VS_FORMAT_UNCOMPRESSED) { 328 if (buffer[2] == UVC_VS_FORMAT_UNCOMPRESSED) {
329 ftype = VS_FRAME_UNCOMPRESSED; 329 ftype = UVC_VS_FRAME_UNCOMPRESSED;
330 } else { 330 } else {
331 ftype = VS_FRAME_FRAME_BASED; 331 ftype = UVC_VS_FRAME_FRAME_BASED;
332 if (buffer[27]) 332 if (buffer[27])
333 format->flags = UVC_FMT_FLAG_COMPRESSED; 333 format->flags = UVC_FMT_FLAG_COMPRESSED;
334 } 334 }
335 break; 335 break;
336 336
337 case VS_FORMAT_MJPEG: 337 case UVC_VS_FORMAT_MJPEG:
338 if (buflen < 11) { 338 if (buflen < 11) {
339 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming " 339 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
340 "interface %d FORMAT error\n", 340 "interface %d FORMAT error\n",
@@ -347,10 +347,10 @@ static int uvc_parse_format(struct uvc_device *dev,
347 format->fcc = V4L2_PIX_FMT_MJPEG; 347 format->fcc = V4L2_PIX_FMT_MJPEG;
348 format->flags = UVC_FMT_FLAG_COMPRESSED; 348 format->flags = UVC_FMT_FLAG_COMPRESSED;
349 format->bpp = 0; 349 format->bpp = 0;
350 ftype = VS_FRAME_MJPEG; 350 ftype = UVC_VS_FRAME_MJPEG;
351 break; 351 break;
352 352
353 case VS_FORMAT_DV: 353 case UVC_VS_FORMAT_DV:
354 if (buflen < 9) { 354 if (buflen < 9) {
355 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming " 355 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
356 "interface %d FORMAT error\n", 356 "interface %d FORMAT error\n",
@@ -395,8 +395,8 @@ static int uvc_parse_format(struct uvc_device *dev,
395 format->nframes = 1; 395 format->nframes = 1;
396 break; 396 break;
397 397
398 case VS_FORMAT_MPEG2TS: 398 case UVC_VS_FORMAT_MPEG2TS:
399 case VS_FORMAT_STREAM_BASED: 399 case UVC_VS_FORMAT_STREAM_BASED:
400 /* Not supported yet. */ 400 /* Not supported yet. */
401 default: 401 default:
402 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming " 402 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
@@ -416,7 +416,7 @@ static int uvc_parse_format(struct uvc_device *dev,
416 */ 416 */
417 while (buflen > 2 && buffer[2] == ftype) { 417 while (buflen > 2 && buffer[2] == ftype) {
418 frame = &format->frame[format->nframes]; 418 frame = &format->frame[format->nframes];
419 if (ftype != VS_FRAME_FRAME_BASED) 419 if (ftype != UVC_VS_FRAME_FRAME_BASED)
420 n = buflen > 25 ? buffer[25] : 0; 420 n = buflen > 25 ? buffer[25] : 0;
421 else 421 else
422 n = buflen > 21 ? buffer[21] : 0; 422 n = buflen > 21 ? buffer[21] : 0;
@@ -436,7 +436,7 @@ static int uvc_parse_format(struct uvc_device *dev,
436 frame->wHeight = get_unaligned_le16(&buffer[7]); 436 frame->wHeight = get_unaligned_le16(&buffer[7]);
437 frame->dwMinBitRate = get_unaligned_le32(&buffer[9]); 437 frame->dwMinBitRate = get_unaligned_le32(&buffer[9]);
438 frame->dwMaxBitRate = get_unaligned_le32(&buffer[13]); 438 frame->dwMaxBitRate = get_unaligned_le32(&buffer[13]);
439 if (ftype != VS_FRAME_FRAME_BASED) { 439 if (ftype != UVC_VS_FRAME_FRAME_BASED) {
440 frame->dwMaxVideoFrameBufferSize = 440 frame->dwMaxVideoFrameBufferSize =
441 get_unaligned_le32(&buffer[17]); 441 get_unaligned_le32(&buffer[17]);
442 frame->dwDefaultFrameInterval = 442 frame->dwDefaultFrameInterval =
@@ -491,12 +491,12 @@ static int uvc_parse_format(struct uvc_device *dev,
491 buffer += buffer[0]; 491 buffer += buffer[0];
492 } 492 }
493 493
494 if (buflen > 2 && buffer[2] == VS_STILL_IMAGE_FRAME) { 494 if (buflen > 2 && buffer[2] == UVC_VS_STILL_IMAGE_FRAME) {
495 buflen -= buffer[0]; 495 buflen -= buffer[0];
496 buffer += buffer[0]; 496 buffer += buffer[0];
497 } 497 }
498 498
499 if (buflen > 2 && buffer[2] == VS_COLORFORMAT) { 499 if (buflen > 2 && buffer[2] == UVC_VS_COLORFORMAT) {
500 if (buflen < 6) { 500 if (buflen < 6) {
501 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming " 501 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
502 "interface %d COLORFORMAT error\n", 502 "interface %d COLORFORMAT error\n",
@@ -530,7 +530,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
530 int ret = -EINVAL; 530 int ret = -EINVAL;
531 531
532 if (intf->cur_altsetting->desc.bInterfaceSubClass 532 if (intf->cur_altsetting->desc.bInterfaceSubClass
533 != SC_VIDEOSTREAMING) { 533 != UVC_SC_VIDEOSTREAMING) {
534 uvc_trace(UVC_TRACE_DESCR, "device %d interface %d isn't a " 534 uvc_trace(UVC_TRACE_DESCR, "device %d interface %d isn't a "
535 "video streaming interface\n", dev->udev->devnum, 535 "video streaming interface\n", dev->udev->devnum,
536 intf->altsetting[0].desc.bInterfaceNumber); 536 intf->altsetting[0].desc.bInterfaceNumber);
@@ -589,12 +589,12 @@ static int uvc_parse_streaming(struct uvc_device *dev,
589 589
590 /* Parse the header descriptor. */ 590 /* Parse the header descriptor. */
591 switch (buffer[2]) { 591 switch (buffer[2]) {
592 case VS_OUTPUT_HEADER: 592 case UVC_VS_OUTPUT_HEADER:
593 streaming->type = V4L2_BUF_TYPE_VIDEO_OUTPUT; 593 streaming->type = V4L2_BUF_TYPE_VIDEO_OUTPUT;
594 size = 9; 594 size = 9;
595 break; 595 break;
596 596
597 case VS_INPUT_HEADER: 597 case UVC_VS_INPUT_HEADER:
598 streaming->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; 598 streaming->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
599 size = 13; 599 size = 13;
600 break; 600 break;
@@ -618,7 +618,7 @@ static int uvc_parse_streaming(struct uvc_device *dev,
618 618
619 streaming->header.bNumFormats = p; 619 streaming->header.bNumFormats = p;
620 streaming->header.bEndpointAddress = buffer[6]; 620 streaming->header.bEndpointAddress = buffer[6];
621 if (buffer[2] == VS_INPUT_HEADER) { 621 if (buffer[2] == UVC_VS_INPUT_HEADER) {
622 streaming->header.bmInfo = buffer[7]; 622 streaming->header.bmInfo = buffer[7];
623 streaming->header.bTerminalLink = buffer[8]; 623 streaming->header.bTerminalLink = buffer[8];
624 streaming->header.bStillCaptureMethod = buffer[9]; 624 streaming->header.bStillCaptureMethod = buffer[9];
@@ -646,13 +646,13 @@ static int uvc_parse_streaming(struct uvc_device *dev,
646 /* Count the format and frame descriptors. */ 646 /* Count the format and frame descriptors. */
647 while (_buflen > 2 && _buffer[1] == USB_DT_CS_INTERFACE) { 647 while (_buflen > 2 && _buffer[1] == USB_DT_CS_INTERFACE) {
648 switch (_buffer[2]) { 648 switch (_buffer[2]) {
649 case VS_FORMAT_UNCOMPRESSED: 649 case UVC_VS_FORMAT_UNCOMPRESSED:
650 case VS_FORMAT_MJPEG: 650 case UVC_VS_FORMAT_MJPEG:
651 case VS_FORMAT_FRAME_BASED: 651 case UVC_VS_FORMAT_FRAME_BASED:
652 nformats++; 652 nformats++;
653 break; 653 break;
654 654
655 case VS_FORMAT_DV: 655 case UVC_VS_FORMAT_DV:
656 /* DV format has no frame descriptor. We will create a 656 /* DV format has no frame descriptor. We will create a
657 * dummy frame descriptor with a dummy frame interval. 657 * dummy frame descriptor with a dummy frame interval.
658 */ 658 */
@@ -661,22 +661,22 @@ static int uvc_parse_streaming(struct uvc_device *dev,
661 nintervals++; 661 nintervals++;
662 break; 662 break;
663 663
664 case VS_FORMAT_MPEG2TS: 664 case UVC_VS_FORMAT_MPEG2TS:
665 case VS_FORMAT_STREAM_BASED: 665 case UVC_VS_FORMAT_STREAM_BASED:
666 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming " 666 uvc_trace(UVC_TRACE_DESCR, "device %d videostreaming "
667 "interface %d FORMAT %u is not supported.\n", 667 "interface %d FORMAT %u is not supported.\n",
668 dev->udev->devnum, 668 dev->udev->devnum,
669 alts->desc.bInterfaceNumber, _buffer[2]); 669 alts->desc.bInterfaceNumber, _buffer[2]);
670 break; 670 break;
671 671
672 case VS_FRAME_UNCOMPRESSED: 672 case UVC_VS_FRAME_UNCOMPRESSED:
673 case VS_FRAME_MJPEG: 673 case UVC_VS_FRAME_MJPEG:
674 nframes++; 674 nframes++;
675 if (_buflen > 25) 675 if (_buflen > 25)
676 nintervals += _buffer[25] ? _buffer[25] : 3; 676 nintervals += _buffer[25] ? _buffer[25] : 3;
677 break; 677 break;
678 678
679 case VS_FRAME_FRAME_BASED: 679 case UVC_VS_FRAME_FRAME_BASED:
680 nframes++; 680 nframes++;
681 if (_buflen > 21) 681 if (_buflen > 21)
682 nintervals += _buffer[21] ? _buffer[21] : 3; 682 nintervals += _buffer[21] ? _buffer[21] : 3;
@@ -711,10 +711,10 @@ static int uvc_parse_streaming(struct uvc_device *dev,
711 /* Parse the format descriptors. */ 711 /* Parse the format descriptors. */
712 while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE) { 712 while (buflen > 2 && buffer[1] == USB_DT_CS_INTERFACE) {
713 switch (buffer[2]) { 713 switch (buffer[2]) {
714 case VS_FORMAT_UNCOMPRESSED: 714 case UVC_VS_FORMAT_UNCOMPRESSED:
715 case VS_FORMAT_MJPEG: 715 case UVC_VS_FORMAT_MJPEG:
716 case VS_FORMAT_DV: 716 case UVC_VS_FORMAT_DV:
717 case VS_FORMAT_FRAME_BASED: 717 case UVC_VS_FORMAT_FRAME_BASED:
718 format->frame = frame; 718 format->frame = frame;
719 ret = uvc_parse_format(dev, streaming, format, 719 ret = uvc_parse_format(dev, streaming, format,
720 &interval, buffer, buflen); 720 &interval, buffer, buflen);
@@ -819,7 +819,7 @@ static int uvc_parse_vendor_control(struct uvc_device *dev,
819 return -ENOMEM; 819 return -ENOMEM;
820 820
821 unit->id = buffer[3]; 821 unit->id = buffer[3];
822 unit->type = VC_EXTENSION_UNIT; 822 unit->type = UVC_VC_EXTENSION_UNIT;
823 memcpy(unit->extension.guidExtensionCode, &buffer[4], 16); 823 memcpy(unit->extension.guidExtensionCode, &buffer[4], 16);
824 unit->extension.bNumControls = buffer[20]; 824 unit->extension.bNumControls = buffer[20];
825 unit->extension.bNrInPins = get_unaligned_le16(&buffer[21]); 825 unit->extension.bNrInPins = get_unaligned_le16(&buffer[21]);
@@ -856,7 +856,7 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
856 __u16 type; 856 __u16 type;
857 857
858 switch (buffer[2]) { 858 switch (buffer[2]) {
859 case VC_HEADER: 859 case UVC_VC_HEADER:
860 n = buflen >= 12 ? buffer[11] : 0; 860 n = buflen >= 12 ? buffer[11] : 0;
861 861
862 if (buflen < 12 || buflen < 12 + n) { 862 if (buflen < 12 || buflen < 12 + n) {
@@ -883,7 +883,7 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
883 } 883 }
884 break; 884 break;
885 885
886 case VC_INPUT_TERMINAL: 886 case UVC_VC_INPUT_TERMINAL:
887 if (buflen < 8) { 887 if (buflen < 8) {
888 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol " 888 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
889 "interface %d INPUT_TERMINAL error\n", 889 "interface %d INPUT_TERMINAL error\n",
@@ -908,11 +908,11 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
908 p = 0; 908 p = 0;
909 len = 8; 909 len = 8;
910 910
911 if (type == ITT_CAMERA) { 911 if (type == UVC_ITT_CAMERA) {
912 n = buflen >= 15 ? buffer[14] : 0; 912 n = buflen >= 15 ? buffer[14] : 0;
913 len = 15; 913 len = 15;
914 914
915 } else if (type == ITT_MEDIA_TRANSPORT_INPUT) { 915 } else if (type == UVC_ITT_MEDIA_TRANSPORT_INPUT) {
916 n = buflen >= 9 ? buffer[8] : 0; 916 n = buflen >= 9 ? buffer[8] : 0;
917 p = buflen >= 10 + n ? buffer[9+n] : 0; 917 p = buflen >= 10 + n ? buffer[9+n] : 0;
918 len = 10; 918 len = 10;
@@ -932,7 +932,7 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
932 term->id = buffer[3]; 932 term->id = buffer[3];
933 term->type = type | UVC_TERM_INPUT; 933 term->type = type | UVC_TERM_INPUT;
934 934
935 if (UVC_ENTITY_TYPE(term) == ITT_CAMERA) { 935 if (UVC_ENTITY_TYPE(term) == UVC_ITT_CAMERA) {
936 term->camera.bControlSize = n; 936 term->camera.bControlSize = n;
937 term->camera.bmControls = (__u8 *)term + sizeof *term; 937 term->camera.bmControls = (__u8 *)term + sizeof *term;
938 term->camera.wObjectiveFocalLengthMin = 938 term->camera.wObjectiveFocalLengthMin =
@@ -942,7 +942,8 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
942 term->camera.wOcularFocalLength = 942 term->camera.wOcularFocalLength =
943 get_unaligned_le16(&buffer[12]); 943 get_unaligned_le16(&buffer[12]);
944 memcpy(term->camera.bmControls, &buffer[15], n); 944 memcpy(term->camera.bmControls, &buffer[15], n);
945 } else if (UVC_ENTITY_TYPE(term) == ITT_MEDIA_TRANSPORT_INPUT) { 945 } else if (UVC_ENTITY_TYPE(term) ==
946 UVC_ITT_MEDIA_TRANSPORT_INPUT) {
946 term->media.bControlSize = n; 947 term->media.bControlSize = n;
947 term->media.bmControls = (__u8 *)term + sizeof *term; 948 term->media.bmControls = (__u8 *)term + sizeof *term;
948 term->media.bTransportModeSize = p; 949 term->media.bTransportModeSize = p;
@@ -955,9 +956,9 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
955 if (buffer[7] != 0) 956 if (buffer[7] != 0)
956 usb_string(udev, buffer[7], term->name, 957 usb_string(udev, buffer[7], term->name,
957 sizeof term->name); 958 sizeof term->name);
958 else if (UVC_ENTITY_TYPE(term) == ITT_CAMERA) 959 else if (UVC_ENTITY_TYPE(term) == UVC_ITT_CAMERA)
959 sprintf(term->name, "Camera %u", buffer[3]); 960 sprintf(term->name, "Camera %u", buffer[3]);
960 else if (UVC_ENTITY_TYPE(term) == ITT_MEDIA_TRANSPORT_INPUT) 961 else if (UVC_ENTITY_TYPE(term) == UVC_ITT_MEDIA_TRANSPORT_INPUT)
961 sprintf(term->name, "Media %u", buffer[3]); 962 sprintf(term->name, "Media %u", buffer[3]);
962 else 963 else
963 sprintf(term->name, "Input %u", buffer[3]); 964 sprintf(term->name, "Input %u", buffer[3]);
@@ -965,7 +966,7 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
965 list_add_tail(&term->list, &dev->entities); 966 list_add_tail(&term->list, &dev->entities);
966 break; 967 break;
967 968
968 case VC_OUTPUT_TERMINAL: 969 case UVC_VC_OUTPUT_TERMINAL:
969 if (buflen < 9) { 970 if (buflen < 9) {
970 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol " 971 uvc_trace(UVC_TRACE_DESCR, "device %d videocontrol "
971 "interface %d OUTPUT_TERMINAL error\n", 972 "interface %d OUTPUT_TERMINAL error\n",
@@ -1002,7 +1003,7 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
1002 list_add_tail(&term->list, &dev->entities); 1003 list_add_tail(&term->list, &dev->entities);
1003 break; 1004 break;
1004 1005
1005 case VC_SELECTOR_UNIT: 1006 case UVC_VC_SELECTOR_UNIT:
1006 p = buflen >= 5 ? buffer[4] : 0; 1007 p = buflen >= 5 ? buffer[4] : 0;
1007 1008
1008 if (buflen < 5 || buflen < 6 + p) { 1009 if (buflen < 5 || buflen < 6 + p) {
@@ -1031,7 +1032,7 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
1031 list_add_tail(&unit->list, &dev->entities); 1032 list_add_tail(&unit->list, &dev->entities);
1032 break; 1033 break;
1033 1034
1034 case VC_PROCESSING_UNIT: 1035 case UVC_VC_PROCESSING_UNIT:
1035 n = buflen >= 8 ? buffer[7] : 0; 1036 n = buflen >= 8 ? buffer[7] : 0;
1036 p = dev->uvc_version >= 0x0110 ? 10 : 9; 1037 p = dev->uvc_version >= 0x0110 ? 10 : 9;
1037 1038
@@ -1066,7 +1067,7 @@ static int uvc_parse_standard_control(struct uvc_device *dev,
1066 list_add_tail(&unit->list, &dev->entities); 1067 list_add_tail(&unit->list, &dev->entities);
1067 break; 1068 break;
1068 1069
1069 case VC_EXTENSION_UNIT: 1070 case UVC_VC_EXTENSION_UNIT:
1070 p = buflen >= 22 ? buffer[21] : 0; 1071 p = buflen >= 22 ? buffer[21] : 0;
1071 n = buflen >= 24 + p ? buffer[22+p] : 0; 1072 n = buflen >= 24 + p ? buffer[22+p] : 0;
1072 1073
@@ -1194,7 +1195,7 @@ static int uvc_scan_chain_entity(struct uvc_video_device *video,
1194 struct uvc_entity *entity) 1195 struct uvc_entity *entity)
1195{ 1196{
1196 switch (UVC_ENTITY_TYPE(entity)) { 1197 switch (UVC_ENTITY_TYPE(entity)) {
1197 case VC_EXTENSION_UNIT: 1198 case UVC_VC_EXTENSION_UNIT:
1198 if (uvc_trace_param & UVC_TRACE_PROBE) 1199 if (uvc_trace_param & UVC_TRACE_PROBE)
1199 printk(" <- XU %d", entity->id); 1200 printk(" <- XU %d", entity->id);
1200 1201
@@ -1207,7 +1208,7 @@ static int uvc_scan_chain_entity(struct uvc_video_device *video,
1207 list_add_tail(&entity->chain, &video->extensions); 1208 list_add_tail(&entity->chain, &video->extensions);
1208 break; 1209 break;
1209 1210
1210 case VC_PROCESSING_UNIT: 1211 case UVC_VC_PROCESSING_UNIT:
1211 if (uvc_trace_param & UVC_TRACE_PROBE) 1212 if (uvc_trace_param & UVC_TRACE_PROBE)
1212 printk(" <- PU %d", entity->id); 1213 printk(" <- PU %d", entity->id);
1213 1214
@@ -1220,7 +1221,7 @@ static int uvc_scan_chain_entity(struct uvc_video_device *video,
1220 video->processing = entity; 1221 video->processing = entity;
1221 break; 1222 break;
1222 1223
1223 case VC_SELECTOR_UNIT: 1224 case UVC_VC_SELECTOR_UNIT:
1224 if (uvc_trace_param & UVC_TRACE_PROBE) 1225 if (uvc_trace_param & UVC_TRACE_PROBE)
1225 printk(" <- SU %d", entity->id); 1226 printk(" <- SU %d", entity->id);
1226 1227
@@ -1237,16 +1238,16 @@ static int uvc_scan_chain_entity(struct uvc_video_device *video,
1237 video->selector = entity; 1238 video->selector = entity;
1238 break; 1239 break;
1239 1240
1240 case ITT_VENDOR_SPECIFIC: 1241 case UVC_ITT_VENDOR_SPECIFIC:
1241 case ITT_CAMERA: 1242 case UVC_ITT_CAMERA:
1242 case ITT_MEDIA_TRANSPORT_INPUT: 1243 case UVC_ITT_MEDIA_TRANSPORT_INPUT:
1243 if (uvc_trace_param & UVC_TRACE_PROBE) 1244 if (uvc_trace_param & UVC_TRACE_PROBE)
1244 printk(" <- IT %d\n", entity->id); 1245 printk(" <- IT %d\n", entity->id);
1245 1246
1246 list_add_tail(&entity->chain, &video->iterms); 1247 list_add_tail(&entity->chain, &video->iterms);
1247 break; 1248 break;
1248 1249
1249 case TT_STREAMING: 1250 case UVC_TT_STREAMING:
1250 if (uvc_trace_param & UVC_TRACE_PROBE) 1251 if (uvc_trace_param & UVC_TRACE_PROBE)
1251 printk(" <- IT %d\n", entity->id); 1252 printk(" <- IT %d\n", entity->id);
1252 1253
@@ -1291,7 +1292,7 @@ static int uvc_scan_chain_forward(struct uvc_video_device *video,
1291 if (forward == NULL) 1292 if (forward == NULL)
1292 break; 1293 break;
1293 1294
1294 if (UVC_ENTITY_TYPE(forward) != VC_EXTENSION_UNIT || 1295 if (UVC_ENTITY_TYPE(forward) != UVC_VC_EXTENSION_UNIT ||
1295 forward == prev) 1296 forward == prev)
1296 continue; 1297 continue;
1297 1298
@@ -1323,15 +1324,15 @@ static int uvc_scan_chain_backward(struct uvc_video_device *video,
1323 int id = -1, i; 1324 int id = -1, i;
1324 1325
1325 switch (UVC_ENTITY_TYPE(entity)) { 1326 switch (UVC_ENTITY_TYPE(entity)) {
1326 case VC_EXTENSION_UNIT: 1327 case UVC_VC_EXTENSION_UNIT:
1327 id = entity->extension.baSourceID[0]; 1328 id = entity->extension.baSourceID[0];
1328 break; 1329 break;
1329 1330
1330 case VC_PROCESSING_UNIT: 1331 case UVC_VC_PROCESSING_UNIT:
1331 id = entity->processing.bSourceID; 1332 id = entity->processing.bSourceID;
1332 break; 1333 break;
1333 1334
1334 case VC_SELECTOR_UNIT: 1335 case UVC_VC_SELECTOR_UNIT:
1335 /* Single-input selector units are ignored. */ 1336 /* Single-input selector units are ignored. */
1336 if (entity->selector.bNrInPins == 1) { 1337 if (entity->selector.bNrInPins == 1) {
1337 id = entity->selector.baSourceID[0]; 1338 id = entity->selector.baSourceID[0];
@@ -1377,7 +1378,7 @@ static int uvc_scan_chain(struct uvc_video_device *video)
1377 entity = video->oterm; 1378 entity = video->oterm;
1378 uvc_trace(UVC_TRACE_PROBE, "Scanning UVC chain: OT %d", entity->id); 1379 uvc_trace(UVC_TRACE_PROBE, "Scanning UVC chain: OT %d", entity->id);
1379 1380
1380 if (UVC_ENTITY_TYPE(entity) == TT_STREAMING) 1381 if (UVC_ENTITY_TYPE(entity) == UVC_TT_STREAMING)
1381 video->sterm = entity; 1382 video->sterm = entity;
1382 1383
1383 id = entity->output.bSourceID; 1384 id = entity->output.bSourceID;
@@ -1664,7 +1665,8 @@ static void uvc_disconnect(struct usb_interface *intf)
1664 */ 1665 */
1665 usb_set_intfdata(intf, NULL); 1666 usb_set_intfdata(intf, NULL);
1666 1667
1667 if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOSTREAMING) 1668 if (intf->cur_altsetting->desc.bInterfaceSubClass ==
1669 UVC_SC_VIDEOSTREAMING)
1668 return; 1670 return;
1669 1671
1670 /* uvc_v4l2_open() might race uvc_disconnect(). A static driver-wide 1672 /* uvc_v4l2_open() might race uvc_disconnect(). A static driver-wide
@@ -1692,7 +1694,8 @@ static int uvc_suspend(struct usb_interface *intf, pm_message_t message)
1692 intf->cur_altsetting->desc.bInterfaceNumber); 1694 intf->cur_altsetting->desc.bInterfaceNumber);
1693 1695
1694 /* Controls are cached on the fly so they don't need to be saved. */ 1696 /* Controls are cached on the fly so they don't need to be saved. */
1695 if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOCONTROL) 1697 if (intf->cur_altsetting->desc.bInterfaceSubClass ==
1698 UVC_SC_VIDEOCONTROL)
1696 return uvc_status_suspend(dev); 1699 return uvc_status_suspend(dev);
1697 1700
1698 if (dev->video.streaming->intf != intf) { 1701 if (dev->video.streaming->intf != intf) {
@@ -1711,7 +1714,8 @@ static int __uvc_resume(struct usb_interface *intf, int reset)
1711 uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n", 1714 uvc_trace(UVC_TRACE_SUSPEND, "Resuming interface %u\n",
1712 intf->cur_altsetting->desc.bInterfaceNumber); 1715 intf->cur_altsetting->desc.bInterfaceNumber);
1713 1716
1714 if (intf->cur_altsetting->desc.bInterfaceSubClass == SC_VIDEOCONTROL) { 1717 if (intf->cur_altsetting->desc.bInterfaceSubClass ==
1718 UVC_SC_VIDEOCONTROL) {
1715 if (reset) { 1719 if (reset) {
1716 int ret = uvc_ctrl_resume_device(dev); 1720 int ret = uvc_ctrl_resume_device(dev);
1717 1721
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c
index 5e77cad29690..87cb9cc75af2 100644
--- a/drivers/media/video/uvc/uvc_v4l2.c
+++ b/drivers/media/video/uvc/uvc_v4l2.c
@@ -648,7 +648,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
648 memset(input, 0, sizeof *input); 648 memset(input, 0, sizeof *input);
649 input->index = index; 649 input->index = index;
650 strlcpy(input->name, iterm->name, sizeof input->name); 650 strlcpy(input->name, iterm->name, sizeof input->name);
651 if (UVC_ENTITY_TYPE(iterm) == ITT_CAMERA) 651 if (UVC_ENTITY_TYPE(iterm) == UVC_ITT_CAMERA)
652 input->type = V4L2_INPUT_TYPE_CAMERA; 652 input->type = V4L2_INPUT_TYPE_CAMERA;
653 break; 653 break;
654 } 654 }
@@ -663,9 +663,9 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
663 break; 663 break;
664 } 664 }
665 665
666 ret = uvc_query_ctrl(video->dev, GET_CUR, video->selector->id, 666 ret = uvc_query_ctrl(video->dev, UVC_GET_CUR,
667 video->dev->intfnum, SU_INPUT_SELECT_CONTROL, 667 video->selector->id, video->dev->intfnum,
668 &input, 1); 668 UVC_SU_INPUT_SELECT_CONTROL, &input, 1);
669 if (ret < 0) 669 if (ret < 0)
670 return ret; 670 return ret;
671 671
@@ -690,9 +690,9 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg)
690 if (input == 0 || input > video->selector->selector.bNrInPins) 690 if (input == 0 || input > video->selector->selector.bNrInPins)
691 return -EINVAL; 691 return -EINVAL;
692 692
693 return uvc_query_ctrl(video->dev, SET_CUR, video->selector->id, 693 return uvc_query_ctrl(video->dev, UVC_SET_CUR,
694 video->dev->intfnum, SU_INPUT_SELECT_CONTROL, 694 video->selector->id, video->dev->intfnum,
695 &input, 1); 695 UVC_SU_INPUT_SELECT_CONTROL, &input, 1);
696 } 696 }
697 697
698 /* Try, Get, Set & Enum format */ 698 /* Try, Get, Set & Enum format */
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c
index 01b633c73480..cf618d7c1f55 100644
--- a/drivers/media/video/uvc/uvc_video.c
+++ b/drivers/media/video/uvc/uvc_video.c
@@ -129,10 +129,10 @@ static int uvc_get_video_ctrl(struct uvc_video_device *video,
129 return -ENOMEM; 129 return -ENOMEM;
130 130
131 ret = __uvc_query_ctrl(video->dev, query, 0, video->streaming->intfnum, 131 ret = __uvc_query_ctrl(video->dev, query, 0, video->streaming->intfnum,
132 probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, data, size, 132 probe ? UVC_VS_PROBE_CONTROL : UVC_VS_COMMIT_CONTROL, data,
133 UVC_CTRL_STREAMING_TIMEOUT); 133 size, UVC_CTRL_STREAMING_TIMEOUT);
134 134
135 if ((query == GET_MIN || query == GET_MAX) && ret == 2) { 135 if ((query == UVC_GET_MIN || query == UVC_GET_MAX) && ret == 2) {
136 /* Some cameras, mostly based on Bison Electronics chipsets, 136 /* Some cameras, mostly based on Bison Electronics chipsets,
137 * answer a GET_MIN or GET_MAX request with the wCompQuality 137 * answer a GET_MIN or GET_MAX request with the wCompQuality
138 * field only. 138 * field only.
@@ -144,7 +144,7 @@ static int uvc_get_video_ctrl(struct uvc_video_device *video,
144 ctrl->wCompQuality = le16_to_cpup((__le16 *)data); 144 ctrl->wCompQuality = le16_to_cpup((__le16 *)data);
145 ret = 0; 145 ret = 0;
146 goto out; 146 goto out;
147 } else if (query == GET_DEF && probe == 1 && ret != size) { 147 } else if (query == UVC_GET_DEF && probe == 1 && ret != size) {
148 /* Many cameras don't support the GET_DEF request on their 148 /* Many cameras don't support the GET_DEF request on their
149 * video probe control. Warn once and return, the caller will 149 * video probe control. Warn once and return, the caller will
150 * fall back to GET_CUR. 150 * fall back to GET_CUR.
@@ -232,10 +232,10 @@ static int uvc_set_video_ctrl(struct uvc_video_device *video,
232 data[33] = ctrl->bMaxVersion; 232 data[33] = ctrl->bMaxVersion;
233 } 233 }
234 234
235 ret = __uvc_query_ctrl(video->dev, SET_CUR, 0, 235 ret = __uvc_query_ctrl(video->dev, UVC_SET_CUR, 0,
236 video->streaming->intfnum, 236 video->streaming->intfnum,
237 probe ? VS_PROBE_CONTROL : VS_COMMIT_CONTROL, data, size, 237 probe ? UVC_VS_PROBE_CONTROL : UVC_VS_COMMIT_CONTROL, data,
238 UVC_CTRL_STREAMING_TIMEOUT); 238 size, UVC_CTRL_STREAMING_TIMEOUT);
239 if (ret != size) { 239 if (ret != size) {
240 uvc_printk(KERN_ERR, "Failed to set UVC %s control : " 240 uvc_printk(KERN_ERR, "Failed to set UVC %s control : "
241 "%d (exp. %u).\n", probe ? "probe" : "commit", 241 "%d (exp. %u).\n", probe ? "probe" : "commit",
@@ -269,10 +269,10 @@ int uvc_probe_video(struct uvc_video_device *video,
269 269
270 /* Get the minimum and maximum values for compression settings. */ 270 /* Get the minimum and maximum values for compression settings. */
271 if (!(video->dev->quirks & UVC_QUIRK_PROBE_MINMAX)) { 271 if (!(video->dev->quirks & UVC_QUIRK_PROBE_MINMAX)) {
272 ret = uvc_get_video_ctrl(video, &probe_min, 1, GET_MIN); 272 ret = uvc_get_video_ctrl(video, &probe_min, 1, UVC_GET_MIN);
273 if (ret < 0) 273 if (ret < 0)
274 goto done; 274 goto done;
275 ret = uvc_get_video_ctrl(video, &probe_max, 1, GET_MAX); 275 ret = uvc_get_video_ctrl(video, &probe_max, 1, UVC_GET_MAX);
276 if (ret < 0) 276 if (ret < 0)
277 goto done; 277 goto done;
278 278
@@ -280,8 +280,11 @@ int uvc_probe_video(struct uvc_video_device *video,
280 } 280 }
281 281
282 for (i = 0; i < 2; ++i) { 282 for (i = 0; i < 2; ++i) {
283 if ((ret = uvc_set_video_ctrl(video, probe, 1)) < 0 || 283 ret = uvc_set_video_ctrl(video, probe, 1);
284 (ret = uvc_get_video_ctrl(video, probe, 1, GET_CUR)) < 0) 284 if (ret < 0)
285 goto done;
286 ret = uvc_get_video_ctrl(video, probe, 1, UVC_GET_CUR);
287 if (ret < 0)
285 goto done; 288 goto done;
286 289
287 if (video->streaming->intf->num_altsetting == 1) 290 if (video->streaming->intf->num_altsetting == 1)
@@ -1065,7 +1068,7 @@ int uvc_video_init(struct uvc_video_device *video)
1065 * requests on the probe control will just keep their current streaming 1068 * requests on the probe control will just keep their current streaming
1066 * parameters. 1069 * parameters.
1067 */ 1070 */
1068 if (uvc_get_video_ctrl(video, probe, 1, GET_DEF) == 0) 1071 if (uvc_get_video_ctrl(video, probe, 1, UVC_GET_DEF) == 0)
1069 uvc_set_video_ctrl(video, probe, 1); 1072 uvc_set_video_ctrl(video, probe, 1);
1070 1073
1071 /* Initialize the streaming parameters with the probe control current 1074 /* Initialize the streaming parameters with the probe control current
@@ -1073,7 +1076,8 @@ int uvc_video_init(struct uvc_video_device *video)
1073 * control will always use values retrieved from a successful GET_CUR 1076 * control will always use values retrieved from a successful GET_CUR
1074 * request on the probe control, as required by the UVC specification. 1077 * request on the probe control, as required by the UVC specification.
1075 */ 1078 */
1076 if ((ret = uvc_get_video_ctrl(video, probe, 1, GET_CUR)) < 0) 1079 ret = uvc_get_video_ctrl(video, probe, 1, UVC_GET_CUR);
1080 if (ret < 0)
1077 return ret; 1081 return ret;
1078 1082
1079 /* Check if the default format descriptor exists. Use the first 1083 /* Check if the default format descriptor exists. Use the first
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h
index 8232cd5d7dfb..a860c6ba0eae 100644
--- a/drivers/media/video/uvc/uvcvideo.h
+++ b/drivers/media/video/uvc/uvcvideo.h
@@ -72,142 +72,142 @@ struct uvc_xu_control {
72 * UVC constants 72 * UVC constants
73 */ 73 */
74 74
75#define SC_UNDEFINED 0x00 75#define UVC_SC_UNDEFINED 0x00
76#define SC_VIDEOCONTROL 0x01 76#define UVC_SC_VIDEOCONTROL 0x01
77#define SC_VIDEOSTREAMING 0x02 77#define UVC_SC_VIDEOSTREAMING 0x02
78#define SC_VIDEO_INTERFACE_COLLECTION 0x03 78#define UVC_SC_VIDEO_INTERFACE_COLLECTION 0x03
79 79
80#define PC_PROTOCOL_UNDEFINED 0x00 80#define UVC_PC_PROTOCOL_UNDEFINED 0x00
81 81
82/* VideoControl class specific interface descriptor */ 82/* VideoControl class specific interface descriptor */
83#define VC_DESCRIPTOR_UNDEFINED 0x00 83#define UVC_VC_DESCRIPTOR_UNDEFINED 0x00
84#define VC_HEADER 0x01 84#define UVC_VC_HEADER 0x01
85#define VC_INPUT_TERMINAL 0x02 85#define UVC_VC_INPUT_TERMINAL 0x02
86#define VC_OUTPUT_TERMINAL 0x03 86#define UVC_VC_OUTPUT_TERMINAL 0x03
87#define VC_SELECTOR_UNIT 0x04 87#define UVC_VC_SELECTOR_UNIT 0x04
88#define VC_PROCESSING_UNIT 0x05 88#define UVC_VC_PROCESSING_UNIT 0x05
89#define VC_EXTENSION_UNIT 0x06 89#define UVC_VC_EXTENSION_UNIT 0x06
90 90
91/* VideoStreaming class specific interface descriptor */ 91/* VideoStreaming class specific interface descriptor */
92#define VS_UNDEFINED 0x00 92#define UVC_VS_UNDEFINED 0x00
93#define VS_INPUT_HEADER 0x01 93#define UVC_VS_INPUT_HEADER 0x01
94#define VS_OUTPUT_HEADER 0x02 94#define UVC_VS_OUTPUT_HEADER 0x02
95#define VS_STILL_IMAGE_FRAME 0x03 95#define UVC_VS_STILL_IMAGE_FRAME 0x03
96#define VS_FORMAT_UNCOMPRESSED 0x04 96#define UVC_VS_FORMAT_UNCOMPRESSED 0x04
97#define VS_FRAME_UNCOMPRESSED 0x05 97#define UVC_VS_FRAME_UNCOMPRESSED 0x05
98#define VS_FORMAT_MJPEG 0x06 98#define UVC_VS_FORMAT_MJPEG 0x06
99#define VS_FRAME_MJPEG 0x07 99#define UVC_VS_FRAME_MJPEG 0x07
100#define VS_FORMAT_MPEG2TS 0x0a 100#define UVC_VS_FORMAT_MPEG2TS 0x0a
101#define VS_FORMAT_DV 0x0c 101#define UVC_VS_FORMAT_DV 0x0c
102#define VS_COLORFORMAT 0x0d 102#define UVC_VS_COLORFORMAT 0x0d
103#define VS_FORMAT_FRAME_BASED 0x10 103#define UVC_VS_FORMAT_FRAME_BASED 0x10
104#define VS_FRAME_FRAME_BASED 0x11 104#define UVC_VS_FRAME_FRAME_BASED 0x11
105#define VS_FORMAT_STREAM_BASED 0x12 105#define UVC_VS_FORMAT_STREAM_BASED 0x12
106 106
107/* Endpoint type */ 107/* Endpoint type */
108#define EP_UNDEFINED 0x00 108#define UVC_EP_UNDEFINED 0x00
109#define EP_GENERAL 0x01 109#define UVC_EP_GENERAL 0x01
110#define EP_ENDPOINT 0x02 110#define UVC_EP_ENDPOINT 0x02
111#define EP_INTERRUPT 0x03 111#define UVC_EP_INTERRUPT 0x03
112 112
113/* Request codes */ 113/* Request codes */
114#define RC_UNDEFINED 0x00 114#define UVC_RC_UNDEFINED 0x00
115#define SET_CUR 0x01 115#define UVC_SET_CUR 0x01
116#define GET_CUR 0x81 116#define UVC_GET_CUR 0x81
117#define GET_MIN 0x82 117#define UVC_GET_MIN 0x82
118#define GET_MAX 0x83 118#define UVC_GET_MAX 0x83
119#define GET_RES 0x84 119#define UVC_GET_RES 0x84
120#define GET_LEN 0x85 120#define UVC_GET_LEN 0x85
121#define GET_INFO 0x86 121#define UVC_GET_INFO 0x86
122#define GET_DEF 0x87 122#define UVC_GET_DEF 0x87
123 123
124/* VideoControl interface controls */ 124/* VideoControl interface controls */
125#define VC_CONTROL_UNDEFINED 0x00 125#define UVC_VC_CONTROL_UNDEFINED 0x00
126#define VC_VIDEO_POWER_MODE_CONTROL 0x01 126#define UVC_VC_VIDEO_POWER_MODE_CONTROL 0x01
127#define VC_REQUEST_ERROR_CODE_CONTROL 0x02 127#define UVC_VC_REQUEST_ERROR_CODE_CONTROL 0x02
128 128
129/* Terminal controls */ 129/* Terminal controls */
130#define TE_CONTROL_UNDEFINED 0x00 130#define UVC_TE_CONTROL_UNDEFINED 0x00
131 131
132/* Selector Unit controls */ 132/* Selector Unit controls */
133#define SU_CONTROL_UNDEFINED 0x00 133#define UVC_SU_CONTROL_UNDEFINED 0x00
134#define SU_INPUT_SELECT_CONTROL 0x01 134#define UVC_SU_INPUT_SELECT_CONTROL 0x01
135 135
136/* Camera Terminal controls */ 136/* Camera Terminal controls */
137#define CT_CONTROL_UNDEFINED 0x00 137#define UVC_CT_CONTROL_UNDEFINED 0x00
138#define CT_SCANNING_MODE_CONTROL 0x01 138#define UVC_CT_SCANNING_MODE_CONTROL 0x01
139#define CT_AE_MODE_CONTROL 0x02 139#define UVC_CT_AE_MODE_CONTROL 0x02
140#define CT_AE_PRIORITY_CONTROL 0x03 140#define UVC_CT_AE_PRIORITY_CONTROL 0x03
141#define CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04 141#define UVC_CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x04
142#define CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05 142#define UVC_CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x05
143#define CT_FOCUS_ABSOLUTE_CONTROL 0x06 143#define UVC_CT_FOCUS_ABSOLUTE_CONTROL 0x06
144#define CT_FOCUS_RELATIVE_CONTROL 0x07 144#define UVC_CT_FOCUS_RELATIVE_CONTROL 0x07
145#define CT_FOCUS_AUTO_CONTROL 0x08 145#define UVC_CT_FOCUS_AUTO_CONTROL 0x08
146#define CT_IRIS_ABSOLUTE_CONTROL 0x09 146#define UVC_CT_IRIS_ABSOLUTE_CONTROL 0x09
147#define CT_IRIS_RELATIVE_CONTROL 0x0a 147#define UVC_CT_IRIS_RELATIVE_CONTROL 0x0a
148#define CT_ZOOM_ABSOLUTE_CONTROL 0x0b 148#define UVC_CT_ZOOM_ABSOLUTE_CONTROL 0x0b
149#define CT_ZOOM_RELATIVE_CONTROL 0x0c 149#define UVC_CT_ZOOM_RELATIVE_CONTROL 0x0c
150#define CT_PANTILT_ABSOLUTE_CONTROL 0x0d 150#define UVC_CT_PANTILT_ABSOLUTE_CONTROL 0x0d
151#define CT_PANTILT_RELATIVE_CONTROL 0x0e 151#define UVC_CT_PANTILT_RELATIVE_CONTROL 0x0e
152#define CT_ROLL_ABSOLUTE_CONTROL 0x0f 152#define UVC_CT_ROLL_ABSOLUTE_CONTROL 0x0f
153#define CT_ROLL_RELATIVE_CONTROL 0x10 153#define UVC_CT_ROLL_RELATIVE_CONTROL 0x10
154#define CT_PRIVACY_CONTROL 0x11 154#define UVC_CT_PRIVACY_CONTROL 0x11
155 155
156/* Processing Unit controls */ 156/* Processing Unit controls */
157#define PU_CONTROL_UNDEFINED 0x00 157#define UVC_PU_CONTROL_UNDEFINED 0x00
158#define PU_BACKLIGHT_COMPENSATION_CONTROL 0x01 158#define UVC_PU_BACKLIGHT_COMPENSATION_CONTROL 0x01
159#define PU_BRIGHTNESS_CONTROL 0x02 159#define UVC_PU_BRIGHTNESS_CONTROL 0x02
160#define PU_CONTRAST_CONTROL 0x03 160#define UVC_PU_CONTRAST_CONTROL 0x03
161#define PU_GAIN_CONTROL 0x04 161#define UVC_PU_GAIN_CONTROL 0x04
162#define PU_POWER_LINE_FREQUENCY_CONTROL 0x05 162#define UVC_PU_POWER_LINE_FREQUENCY_CONTROL 0x05
163#define PU_HUE_CONTROL 0x06 163#define UVC_PU_HUE_CONTROL 0x06
164#define PU_SATURATION_CONTROL 0x07 164#define UVC_PU_SATURATION_CONTROL 0x07
165#define PU_SHARPNESS_CONTROL 0x08 165#define UVC_PU_SHARPNESS_CONTROL 0x08
166#define PU_GAMMA_CONTROL 0x09 166#define UVC_PU_GAMMA_CONTROL 0x09
167#define PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a 167#define UVC_PU_WHITE_BALANCE_TEMPERATURE_CONTROL 0x0a
168#define PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b 168#define UVC_PU_WHITE_BALANCE_TEMPERATURE_AUTO_CONTROL 0x0b
169#define PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c 169#define UVC_PU_WHITE_BALANCE_COMPONENT_CONTROL 0x0c
170#define PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d 170#define UVC_PU_WHITE_BALANCE_COMPONENT_AUTO_CONTROL 0x0d
171#define PU_DIGITAL_MULTIPLIER_CONTROL 0x0e 171#define UVC_PU_DIGITAL_MULTIPLIER_CONTROL 0x0e
172#define PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f 172#define UVC_PU_DIGITAL_MULTIPLIER_LIMIT_CONTROL 0x0f
173#define PU_HUE_AUTO_CONTROL 0x10 173#define UVC_PU_HUE_AUTO_CONTROL 0x10
174#define PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11 174#define UVC_PU_ANALOG_VIDEO_STANDARD_CONTROL 0x11
175#define PU_ANALOG_LOCK_STATUS_CONTROL 0x12 175#define UVC_PU_ANALOG_LOCK_STATUS_CONTROL 0x12
176 176
177#define LXU_MOTOR_PANTILT_RELATIVE_CONTROL 0x01 177#define UVC_LXU_MOTOR_PANTILT_RELATIVE_CONTROL 0x01
178#define LXU_MOTOR_PANTILT_RESET_CONTROL 0x02 178#define UVC_LXU_MOTOR_PANTILT_RESET_CONTROL 0x02
179#define LXU_MOTOR_FOCUS_MOTOR_CONTROL 0x03 179#define UVC_LXU_MOTOR_FOCUS_MOTOR_CONTROL 0x03
180 180
181/* VideoStreaming interface controls */ 181/* VideoStreaming interface controls */
182#define VS_CONTROL_UNDEFINED 0x00 182#define UVC_VS_CONTROL_UNDEFINED 0x00
183#define VS_PROBE_CONTROL 0x01 183#define UVC_VS_PROBE_CONTROL 0x01
184#define VS_COMMIT_CONTROL 0x02 184#define UVC_VS_COMMIT_CONTROL 0x02
185#define VS_STILL_PROBE_CONTROL 0x03 185#define UVC_VS_STILL_PROBE_CONTROL 0x03
186#define VS_STILL_COMMIT_CONTROL 0x04 186#define UVC_VS_STILL_COMMIT_CONTROL 0x04
187#define VS_STILL_IMAGE_TRIGGER_CONTROL 0x05 187#define UVC_VS_STILL_IMAGE_TRIGGER_CONTROL 0x05
188#define VS_STREAM_ERROR_CODE_CONTROL 0x06 188#define UVC_VS_STREAM_ERROR_CODE_CONTROL 0x06
189#define VS_GENERATE_KEY_FRAME_CONTROL 0x07 189#define UVC_VS_GENERATE_KEY_FRAME_CONTROL 0x07
190#define VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08 190#define UVC_VS_UPDATE_FRAME_SEGMENT_CONTROL 0x08
191#define VS_SYNC_DELAY_CONTROL 0x09 191#define UVC_VS_SYNC_DELAY_CONTROL 0x09
192 192
193#define TT_VENDOR_SPECIFIC 0x0100 193#define UVC_TT_VENDOR_SPECIFIC 0x0100
194#define TT_STREAMING 0x0101 194#define UVC_TT_STREAMING 0x0101
195 195
196/* Input Terminal types */ 196/* Input Terminal types */
197#define ITT_VENDOR_SPECIFIC 0x0200 197#define UVC_ITT_VENDOR_SPECIFIC 0x0200
198#define ITT_CAMERA 0x0201 198#define UVC_ITT_CAMERA 0x0201
199#define ITT_MEDIA_TRANSPORT_INPUT 0x0202 199#define UVC_ITT_MEDIA_TRANSPORT_INPUT 0x0202
200 200
201/* Output Terminal types */ 201/* Output Terminal types */
202#define OTT_VENDOR_SPECIFIC 0x0300 202#define UVC_OTT_VENDOR_SPECIFIC 0x0300
203#define OTT_DISPLAY 0x0301 203#define UVC_OTT_DISPLAY 0x0301
204#define OTT_MEDIA_TRANSPORT_OUTPUT 0x0302 204#define UVC_OTT_MEDIA_TRANSPORT_OUTPUT 0x0302
205 205
206/* External Terminal types */ 206/* External Terminal types */
207#define EXTERNAL_VENDOR_SPECIFIC 0x0400 207#define UVC_EXTERNAL_VENDOR_SPECIFIC 0x0400
208#define COMPOSITE_CONNECTOR 0x0401 208#define UVC_COMPOSITE_CONNECTOR 0x0401
209#define SVIDEO_CONNECTOR 0x0402 209#define UVC_SVIDEO_CONNECTOR 0x0402
210#define COMPONENT_CONNECTOR 0x0403 210#define UVC_COMPONENT_CONNECTOR 0x0403
211 211
212#define UVC_TERM_INPUT 0x0000 212#define UVC_TERM_INPUT 0x0000
213#define UVC_TERM_OUTPUT 0x8000 213#define UVC_TERM_OUTPUT 0x8000