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

usb: gadget: uvc: Move userspace API definition to public header

The UVC gadget userspace API (V4L2 events and custom ioctls) is defined
in a header internal to the kernel. Move it to a new public header to
make it accessible to userspace.

The UVC_INTF_CONTROL and UVC_INTF_STREAMING macros are not used, so
remove them in the process.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>

authored by

Laurent Pinchart and committed by
Felipe Balbi
d396e47f d72e90f3

+45 -40
+1
MAINTAINERS
··· 14996 14996 S: Maintained 14997 14997 F: drivers/usb/gadget/function/*uvc* 14998 14998 F: drivers/usb/gadget/legacy/webcam.c 14999 + F: include/uapi/linux/usb/g_uvc.h 14999 15000 15000 15001 USB WIRELESS RNDIS DRIVER (rndis_wlan) 15001 15002 M: Jussi Kivilinna <jussi.kivilinna@iki.fi>
+5 -40
drivers/usb/gadget/function/uvc.h
··· 9 9 #ifndef _UVC_GADGET_H_ 10 10 #define _UVC_GADGET_H_ 11 11 12 - #include <linux/ioctl.h> 13 - #include <linux/types.h> 14 - #include <linux/usb/ch9.h> 15 - 16 - #define UVC_EVENT_FIRST (V4L2_EVENT_PRIVATE_START + 0) 17 - #define UVC_EVENT_CONNECT (V4L2_EVENT_PRIVATE_START + 0) 18 - #define UVC_EVENT_DISCONNECT (V4L2_EVENT_PRIVATE_START + 1) 19 - #define UVC_EVENT_STREAMON (V4L2_EVENT_PRIVATE_START + 2) 20 - #define UVC_EVENT_STREAMOFF (V4L2_EVENT_PRIVATE_START + 3) 21 - #define UVC_EVENT_SETUP (V4L2_EVENT_PRIVATE_START + 4) 22 - #define UVC_EVENT_DATA (V4L2_EVENT_PRIVATE_START + 5) 23 - #define UVC_EVENT_LAST (V4L2_EVENT_PRIVATE_START + 5) 24 - 25 - struct uvc_request_data { 26 - __s32 length; 27 - __u8 data[60]; 28 - }; 29 - 30 - struct uvc_event { 31 - union { 32 - enum usb_device_speed speed; 33 - struct usb_ctrlrequest req; 34 - struct uvc_request_data data; 35 - }; 36 - }; 37 - 38 - #define UVCIOC_SEND_RESPONSE _IOW('U', 1, struct uvc_request_data) 39 - 40 - #define UVC_INTF_CONTROL 0 41 - #define UVC_INTF_STREAMING 1 42 - 43 - /* ------------------------------------------------------------------------ 44 - * Debugging, printing and logging 45 - */ 46 - 47 - #ifdef __KERNEL__ 48 - 49 12 #include <linux/usb.h> /* For usb_endpoint_* */ 50 13 #include <linux/usb/composite.h> 51 14 #include <linux/usb/gadget.h> 15 + #include <linux/usb/g_uvc.h> 52 16 #include <linux/videodev2.h> 53 17 #include <media/v4l2-fh.h> 54 18 #include <media/v4l2-device.h> 55 19 56 20 #include "uvc_queue.h" 21 + 22 + /* ------------------------------------------------------------------------ 23 + * Debugging, printing and logging 24 + */ 57 25 58 26 #define UVC_TRACE_PROBE (1 << 0) 59 27 #define UVC_TRACE_DESCR (1 << 1) ··· 152 184 extern void uvc_function_connect(struct uvc_device *uvc); 153 185 extern void uvc_function_disconnect(struct uvc_device *uvc); 154 186 155 - #endif /* __KERNEL__ */ 156 - 157 187 #endif /* _UVC_GADGET_H_ */ 158 -
+39
include/uapi/linux/usb/g_uvc.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0+ */ 2 + /* 3 + * g_uvc.h -- USB Video Class Gadget driver API 4 + * 5 + * Copyright (C) 2009-2010 Laurent Pinchart <laurent.pinchart@ideasonboard.com> 6 + */ 7 + 8 + #ifndef __LINUX_USB_G_UVC_H 9 + #define __LINUX_USB_G_UVC_H 10 + 11 + #include <linux/ioctl.h> 12 + #include <linux/types.h> 13 + #include <linux/usb/ch9.h> 14 + 15 + #define UVC_EVENT_FIRST (V4L2_EVENT_PRIVATE_START + 0) 16 + #define UVC_EVENT_CONNECT (V4L2_EVENT_PRIVATE_START + 0) 17 + #define UVC_EVENT_DISCONNECT (V4L2_EVENT_PRIVATE_START + 1) 18 + #define UVC_EVENT_STREAMON (V4L2_EVENT_PRIVATE_START + 2) 19 + #define UVC_EVENT_STREAMOFF (V4L2_EVENT_PRIVATE_START + 3) 20 + #define UVC_EVENT_SETUP (V4L2_EVENT_PRIVATE_START + 4) 21 + #define UVC_EVENT_DATA (V4L2_EVENT_PRIVATE_START + 5) 22 + #define UVC_EVENT_LAST (V4L2_EVENT_PRIVATE_START + 5) 23 + 24 + struct uvc_request_data { 25 + __s32 length; 26 + __u8 data[60]; 27 + }; 28 + 29 + struct uvc_event { 30 + union { 31 + enum usb_device_speed speed; 32 + struct usb_ctrlrequest req; 33 + struct uvc_request_data data; 34 + }; 35 + }; 36 + 37 + #define UVCIOC_SEND_RESPONSE _IOW('U', 1, struct uvc_request_data) 38 + 39 + #endif /* __LINUX_USB_G_UVC_H */