Skip to content

Commit 1ab4052

Browse files
pinchartlHans Verkuil
authored andcommitted
media: uvcvideo: Move MSXU_CONTROL_METADATA definition to header
Move the MSXU_CONTROL_METADATA control definitino to the include/linux/usb/uvc.h header, alongside the corresponding XU GUID. Add a UVC_ prefix to avoid namespace clashes. While at it, add the definition for the other controls for that extension unit, as defined in https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-extensions-1-5#222-extension-unit-controls. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Ricardo Ribalda <ribalda@chromium.org> Reviewed-by: Hans de Goede <hansg@kernel.org> Signed-off-by: Hans de Goede <hansg@kernel.org> Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>
1 parent 50c320a commit 1ab4052

2 files changed

Lines changed: 22 additions & 6 deletions

File tree

drivers/media/usb/uvc/uvc_metadata.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ static struct uvc_entity *uvc_meta_find_msxu(struct uvc_device *dev)
171171
return NULL;
172172
}
173173

174-
#define MSXU_CONTROL_METADATA 0x9
175174
static int uvc_meta_detect_msxu(struct uvc_device *dev)
176175
{
177176
u32 *data __free(kfree) = NULL;
@@ -195,7 +194,7 @@ static int uvc_meta_detect_msxu(struct uvc_device *dev)
195194
* returns metadata.
196195
*/
197196
ret = uvc_query_ctrl(dev, UVC_GET_CUR, entity->id, dev->intfnum,
198-
MSXU_CONTROL_METADATA, data, sizeof(*data));
197+
UVC_MSXU_CONTROL_METADATA, data, sizeof(*data));
199198
if (ret)
200199
return 0;
201200

@@ -205,23 +204,23 @@ static int uvc_meta_detect_msxu(struct uvc_device *dev)
205204
}
206205

207206
/*
208-
* Set the value of MSXU_CONTROL_METADATA to the value reported by
207+
* Set the value of UVC_MSXU_CONTROL_METADATA to the value reported by
209208
* GET_MAX to enable production of MSXU metadata. The GET_MAX request
210209
* reports the maximum size of the metadata, if its value is 0 then MSXU
211210
* metadata is not supported. For more information, see
212211
* https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-extensions-1-5#2229-metadata-control
213212
*/
214213
ret = uvc_query_ctrl(dev, UVC_GET_MAX, entity->id, dev->intfnum,
215-
MSXU_CONTROL_METADATA, data, sizeof(*data));
214+
UVC_MSXU_CONTROL_METADATA, data, sizeof(*data));
216215
if (ret || !*data)
217216
return 0;
218217

219218
/*
220-
* If we can set MSXU_CONTROL_METADATA, the device will report
219+
* If we can set UVC_MSXU_CONTROL_METADATA, the device will report
221220
* metadata.
222221
*/
223222
ret = uvc_query_ctrl(dev, UVC_SET_CUR, entity->id, dev->intfnum,
224-
MSXU_CONTROL_METADATA, data, sizeof(*data));
223+
UVC_MSXU_CONTROL_METADATA, data, sizeof(*data));
225224
if (!ret)
226225
dev->quirks |= UVC_QUIRK_MSXU_META;
227226

include/linux/usb/uvc.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,23 @@
3333
{0xdc, 0x95, 0x3f, 0x0f, 0x32, 0x26, 0x4e, 0x4c, \
3434
0x92, 0xc9, 0xa0, 0x47, 0x82, 0xf4, 0x3b, 0xc8}
3535

36+
/* https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-extensions-1-5#222-extension-unit-controls */
37+
#define UVC_MSXU_CONTROL_FOCUS 0x01
38+
#define UVC_MSXU_CONTROL_EXPOSURE 0x02
39+
#define UVC_MSXU_CONTROL_EVCOMPENSATION 0x03
40+
#define UVC_MSXU_CONTROL_WHITEBALANCE 0x04
41+
#define UVC_MSXU_CONTROL_FACE_AUTHENTICATION 0x06
42+
#define UVC_MSXU_CONTROL_CAMERA_EXTRINSICS 0x07
43+
#define UVC_MSXU_CONTROL_CAMERA_INTRINSICS 0x08
44+
#define UVC_MSXU_CONTROL_METADATA 0x09
45+
#define UVC_MSXU_CONTROL_IR_TORCH 0x0a
46+
#define UVC_MSXU_CONTROL_DIGITALWINDOW 0x0b
47+
#define UVC_MSXU_CONTROL_DIGITALWINDOW_CONFIG 0x0c
48+
#define UVC_MSXU_CONTROL_VIDEO_HDR 0x0d
49+
#define UVC_MSXU_CONTROL_FRAMERATE_THROTTLE 0x0e
50+
#define UVC_MSXU_CONTROL_FIELDOFVIEW2_CONFIG 0x0f
51+
#define UVC_MSXU_CONTROL_FIELDOFVIEW2 0x10
52+
3653
#define UVC_GUID_FORMAT_MJPEG \
3754
{ 'M', 'J', 'P', 'G', 0x00, 0x00, 0x10, 0x00, \
3855
0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}

0 commit comments

Comments
 (0)