Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Laurent Pinchart and committed by
Hans Verkuil
1ab40529 50c320a5

+22 -6
+5 -6
drivers/media/usb/uvc/uvc_metadata.c
··· 171 171 return NULL; 172 172 } 173 173 174 - #define MSXU_CONTROL_METADATA 0x9 175 174 static int uvc_meta_detect_msxu(struct uvc_device *dev) 176 175 { 177 176 u32 *data __free(kfree) = NULL; ··· 194 195 * returns metadata. 195 196 */ 196 197 ret = uvc_query_ctrl(dev, UVC_GET_CUR, entity->id, dev->intfnum, 197 - MSXU_CONTROL_METADATA, data, sizeof(*data)); 198 + UVC_MSXU_CONTROL_METADATA, data, sizeof(*data)); 198 199 if (ret) 199 200 return 0; 200 201 ··· 204 205 } 205 206 206 207 /* 207 - * Set the value of MSXU_CONTROL_METADATA to the value reported by 208 + * Set the value of UVC_MSXU_CONTROL_METADATA to the value reported by 208 209 * GET_MAX to enable production of MSXU metadata. The GET_MAX request 209 210 * reports the maximum size of the metadata, if its value is 0 then MSXU 210 211 * metadata is not supported. For more information, see 211 212 * https://learn.microsoft.com/en-us/windows-hardware/drivers/stream/uvc-extensions-1-5#2229-metadata-control 212 213 */ 213 214 ret = uvc_query_ctrl(dev, UVC_GET_MAX, entity->id, dev->intfnum, 214 - MSXU_CONTROL_METADATA, data, sizeof(*data)); 215 + UVC_MSXU_CONTROL_METADATA, data, sizeof(*data)); 215 216 if (ret || !*data) 216 217 return 0; 217 218 218 219 /* 219 - * If we can set MSXU_CONTROL_METADATA, the device will report 220 + * If we can set UVC_MSXU_CONTROL_METADATA, the device will report 220 221 * metadata. 221 222 */ 222 223 ret = uvc_query_ctrl(dev, UVC_SET_CUR, entity->id, dev->intfnum, 223 - MSXU_CONTROL_METADATA, data, sizeof(*data)); 224 + UVC_MSXU_CONTROL_METADATA, data, sizeof(*data)); 224 225 if (!ret) 225 226 dev->quirks |= UVC_QUIRK_MSXU_META; 226 227
+17
include/linux/usb/uvc.h
··· 33 33 {0xdc, 0x95, 0x3f, 0x0f, 0x32, 0x26, 0x4e, 0x4c, \ 34 34 0x92, 0xc9, 0xa0, 0x47, 0x82, 0xf4, 0x3b, 0xc8} 35 35 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 + 36 53 #define UVC_GUID_FORMAT_MJPEG \ 37 54 { 'M', 'J', 'P', 'G', 0x00, 0x00, 0x10, 0x00, \ 38 55 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}