hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/drivers/usb/gadget/function/uvc.h
....@@ -1,4 +1,4 @@
1
-// SPDX-License-Identifier: GPL-2.0+
1
+/* SPDX-License-Identifier: GPL-2.0+ */
22 /*
33 * uvc_gadget.h -- USB Video Class Gadget driver
44 *
....@@ -11,10 +11,11 @@
1111
1212 #include <linux/list.h>
1313 #include <linux/mutex.h>
14
+#include <linux/pm_qos.h>
1415 #include <linux/spinlock.h>
1516 #include <linux/usb/composite.h>
1617 #include <linux/videodev2.h>
17
-#include <linux/pm_qos.h>
18
+#include <linux/wait.h>
1819
1920 #include <media/v4l2-device.h>
2021 #include <media/v4l2-dev.h>
....@@ -25,6 +26,7 @@
2526 struct usb_ep;
2627 struct usb_request;
2728 struct uvc_descriptor_header;
29
+struct uvc_device;
2830
2931 /* ------------------------------------------------------------------------
3032 * Debugging, printing and logging
....@@ -52,30 +54,38 @@
5254 printk(KERN_DEBUG "uvcvideo: " msg); \
5355 } while (0)
5456
55
-#define uvc_warn_once(dev, warn, msg...) \
56
- do { \
57
- if (!test_and_set_bit(warn, &dev->warnings)) \
58
- printk(KERN_INFO "uvcvideo: " msg); \
59
- } while (0)
60
-
61
-#define uvc_printk(level, msg...) \
62
- printk(level "uvcvideo: " msg)
57
+#define uvcg_dbg(f, fmt, args...) \
58
+ dev_dbg(&(f)->config->cdev->gadget->dev, "%s: " fmt, (f)->name, ##args)
59
+#define uvcg_info(f, fmt, args...) \
60
+ dev_info(&(f)->config->cdev->gadget->dev, "%s: " fmt, (f)->name, ##args)
61
+#define uvcg_warn(f, fmt, args...) \
62
+ dev_warn(&(f)->config->cdev->gadget->dev, "%s: " fmt, (f)->name, ##args)
63
+#define uvcg_err(f, fmt, args...) \
64
+ dev_err(&(f)->config->cdev->gadget->dev, "%s: " fmt, (f)->name, ##args)
6365
6466 /* ------------------------------------------------------------------------
6567 * Driver specific constants
6668 */
6769
68
-#define UVC_NUM_REQUESTS 4
6970 #define UVC_MAX_REQUEST_SIZE 64
7071 #define UVC_MAX_EVENTS 4
71
-#define UVC_MAX_NUM_REQUESTS 8
7272
7373 /* ------------------------------------------------------------------------
7474 * Structures
7575 */
76
+struct uvc_request {
77
+ struct usb_request *req;
78
+ u8 *req_buffer;
79
+ struct uvc_video *video;
80
+#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI)
81
+ struct completion req_done;
82
+#endif
83
+};
7684
7785 struct uvc_video {
86
+ struct uvc_device *uvc;
7887 struct usb_ep *ep;
88
+
7989 struct work_struct pump;
8090 struct workqueue_struct *async_wq;
8191
....@@ -87,10 +97,11 @@
8797 unsigned int imagesize;
8898 struct mutex mutex; /* protects frame parameters */
8999
100
+ unsigned int uvc_num_requests;
101
+
90102 /* Requests */
91103 unsigned int req_size;
92
- struct usb_request *req[UVC_MAX_NUM_REQUESTS];
93
- __u8 *req_buffer[UVC_MAX_NUM_REQUESTS];
104
+ struct uvc_request *ureq;
94105 struct list_head req_free;
95106 spinlock_t req_lock;
96107
....@@ -117,6 +128,8 @@
117128 enum uvc_state state;
118129 struct usb_function func;
119130 struct uvc_video video;
131
+ bool func_connected;
132
+ wait_queue_head_t func_connected_queue;
120133 /* for creating and issuing QoS requests */
121134 struct pm_qos_request pm_qos;
122135
....@@ -150,6 +163,7 @@
150163 struct uvc_file_handle {
151164 struct v4l2_fh vfh;
152165 struct uvc_video *device;
166
+ bool is_uvc_app_handle;
153167 };
154168
155169 #define to_uvc_file_handle(handle) \