18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _USB_VIDEO_H_
38c2ecf20Sopenharmony_ci#define _USB_VIDEO_H_
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#ifndef __KERNEL__
68c2ecf20Sopenharmony_ci#error "The uvcvideo.h header is deprecated, use linux/uvcvideo.h instead."
78c2ecf20Sopenharmony_ci#endif /* __KERNEL__ */
88c2ecf20Sopenharmony_ci
98c2ecf20Sopenharmony_ci#include <linux/kernel.h>
108c2ecf20Sopenharmony_ci#include <linux/poll.h>
118c2ecf20Sopenharmony_ci#include <linux/usb.h>
128c2ecf20Sopenharmony_ci#include <linux/usb/video.h>
138c2ecf20Sopenharmony_ci#include <linux/uvcvideo.h>
148c2ecf20Sopenharmony_ci#include <linux/videodev2.h>
158c2ecf20Sopenharmony_ci#include <linux/workqueue.h>
168c2ecf20Sopenharmony_ci#include <media/media-device.h>
178c2ecf20Sopenharmony_ci#include <media/v4l2-device.h>
188c2ecf20Sopenharmony_ci#include <media/v4l2-event.h>
198c2ecf20Sopenharmony_ci#include <media/v4l2-fh.h>
208c2ecf20Sopenharmony_ci#include <media/videobuf2-v4l2.h>
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_ci/* --------------------------------------------------------------------------
238c2ecf20Sopenharmony_ci * UVC constants
248c2ecf20Sopenharmony_ci */
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#define UVC_TERM_INPUT			0x0000
278c2ecf20Sopenharmony_ci#define UVC_TERM_OUTPUT			0x8000
288c2ecf20Sopenharmony_ci#define UVC_TERM_DIRECTION(term)	((term)->type & 0x8000)
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#define UVC_ENTITY_TYPE(entity)		((entity)->type & 0x7fff)
318c2ecf20Sopenharmony_ci#define UVC_ENTITY_IS_UNIT(entity)	(((entity)->type & 0xff00) == 0)
328c2ecf20Sopenharmony_ci#define UVC_ENTITY_IS_TERM(entity)	(((entity)->type & 0xff00) != 0)
338c2ecf20Sopenharmony_ci#define UVC_ENTITY_IS_ITERM(entity) \
348c2ecf20Sopenharmony_ci	(UVC_ENTITY_IS_TERM(entity) && \
358c2ecf20Sopenharmony_ci	((entity)->type & 0x8000) == UVC_TERM_INPUT)
368c2ecf20Sopenharmony_ci#define UVC_ENTITY_IS_OTERM(entity) \
378c2ecf20Sopenharmony_ci	(UVC_ENTITY_IS_TERM(entity) && \
388c2ecf20Sopenharmony_ci	((entity)->type & 0x8000) == UVC_TERM_OUTPUT)
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------
428c2ecf20Sopenharmony_ci * GUIDs
438c2ecf20Sopenharmony_ci */
448c2ecf20Sopenharmony_ci#define UVC_GUID_UVC_CAMERA \
458c2ecf20Sopenharmony_ci	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
468c2ecf20Sopenharmony_ci	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
478c2ecf20Sopenharmony_ci#define UVC_GUID_UVC_OUTPUT \
488c2ecf20Sopenharmony_ci	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
498c2ecf20Sopenharmony_ci	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}
508c2ecf20Sopenharmony_ci#define UVC_GUID_UVC_MEDIA_TRANSPORT_INPUT \
518c2ecf20Sopenharmony_ci	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
528c2ecf20Sopenharmony_ci	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03}
538c2ecf20Sopenharmony_ci#define UVC_GUID_UVC_PROCESSING \
548c2ecf20Sopenharmony_ci	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
558c2ecf20Sopenharmony_ci	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01}
568c2ecf20Sopenharmony_ci#define UVC_GUID_UVC_SELECTOR \
578c2ecf20Sopenharmony_ci	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
588c2ecf20Sopenharmony_ci	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02}
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_MJPEG \
618c2ecf20Sopenharmony_ci	{ 'M',  'J',  'P',  'G', 0x00, 0x00, 0x10, 0x00, \
628c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
638c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_YUY2 \
648c2ecf20Sopenharmony_ci	{ 'Y',  'U',  'Y',  '2', 0x00, 0x00, 0x10, 0x00, \
658c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
668c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_YUY2_ISIGHT \
678c2ecf20Sopenharmony_ci	{ 'Y',  'U',  'Y',  '2', 0x00, 0x00, 0x10, 0x00, \
688c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9b, 0x71}
698c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_NV12 \
708c2ecf20Sopenharmony_ci	{ 'N',  'V',  '1',  '2', 0x00, 0x00, 0x10, 0x00, \
718c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
728c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_YV12 \
738c2ecf20Sopenharmony_ci	{ 'Y',  'V',  '1',  '2', 0x00, 0x00, 0x10, 0x00, \
748c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
758c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_I420 \
768c2ecf20Sopenharmony_ci	{ 'I',  '4',  '2',  '0', 0x00, 0x00, 0x10, 0x00, \
778c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
788c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_UYVY \
798c2ecf20Sopenharmony_ci	{ 'U',  'Y',  'V',  'Y', 0x00, 0x00, 0x10, 0x00, \
808c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
818c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_Y800 \
828c2ecf20Sopenharmony_ci	{ 'Y',  '8',  '0',  '0', 0x00, 0x00, 0x10, 0x00, \
838c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
848c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_Y8 \
858c2ecf20Sopenharmony_ci	{ 'Y',  '8',  ' ',  ' ', 0x00, 0x00, 0x10, 0x00, \
868c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
878c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_Y10 \
888c2ecf20Sopenharmony_ci	{ 'Y',  '1',  '0',  ' ', 0x00, 0x00, 0x10, 0x00, \
898c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
908c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_Y12 \
918c2ecf20Sopenharmony_ci	{ 'Y',  '1',  '2',  ' ', 0x00, 0x00, 0x10, 0x00, \
928c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
938c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_Y16 \
948c2ecf20Sopenharmony_ci	{ 'Y',  '1',  '6',  ' ', 0x00, 0x00, 0x10, 0x00, \
958c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
968c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_BY8 \
978c2ecf20Sopenharmony_ci	{ 'B',  'Y',  '8',  ' ', 0x00, 0x00, 0x10, 0x00, \
988c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
998c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_BA81 \
1008c2ecf20Sopenharmony_ci	{ 'B',  'A',  '8',  '1', 0x00, 0x00, 0x10, 0x00, \
1018c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1028c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_GBRG \
1038c2ecf20Sopenharmony_ci	{ 'G',  'B',  'R',  'G', 0x00, 0x00, 0x10, 0x00, \
1048c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1058c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_GRBG \
1068c2ecf20Sopenharmony_ci	{ 'G',  'R',  'B',  'G', 0x00, 0x00, 0x10, 0x00, \
1078c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1088c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_RGGB \
1098c2ecf20Sopenharmony_ci	{ 'R',  'G',  'G',  'B', 0x00, 0x00, 0x10, 0x00, \
1108c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1118c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_BG16 \
1128c2ecf20Sopenharmony_ci	{ 'B',  'G',  '1',  '6', 0x00, 0x00, 0x10, 0x00, \
1138c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1148c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_GB16 \
1158c2ecf20Sopenharmony_ci	{ 'G',  'B',  '1',  '6', 0x00, 0x00, 0x10, 0x00, \
1168c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1178c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_RG16 \
1188c2ecf20Sopenharmony_ci	{ 'R',  'G',  '1',  '6', 0x00, 0x00, 0x10, 0x00, \
1198c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1208c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_GR16 \
1218c2ecf20Sopenharmony_ci	{ 'G',  'R',  '1',  '6', 0x00, 0x00, 0x10, 0x00, \
1228c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1238c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_RGBP \
1248c2ecf20Sopenharmony_ci	{ 'R',  'G',  'B',  'P', 0x00, 0x00, 0x10, 0x00, \
1258c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1268c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_BGR3 \
1278c2ecf20Sopenharmony_ci	{ 0x7d, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \
1288c2ecf20Sopenharmony_ci	 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}
1298c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_M420 \
1308c2ecf20Sopenharmony_ci	{ 'M',  '4',  '2',  '0', 0x00, 0x00, 0x10, 0x00, \
1318c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1328c2ecf20Sopenharmony_ci
1338c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_H264 \
1348c2ecf20Sopenharmony_ci	{ 'H',  '2',  '6',  '4', 0x00, 0x00, 0x10, 0x00, \
1358c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1368c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_Y8I \
1378c2ecf20Sopenharmony_ci	{ 'Y',  '8',  'I',  ' ', 0x00, 0x00, 0x10, 0x00, \
1388c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1398c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_Y12I \
1408c2ecf20Sopenharmony_ci	{ 'Y',  '1',  '2',  'I', 0x00, 0x00, 0x10, 0x00, \
1418c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1428c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_Z16 \
1438c2ecf20Sopenharmony_ci	{ 'Z',  '1',  '6',  ' ', 0x00, 0x00, 0x10, 0x00, \
1448c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1458c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_RW10 \
1468c2ecf20Sopenharmony_ci	{ 'R',  'W',  '1',  '0', 0x00, 0x00, 0x10, 0x00, \
1478c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1488c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_INVZ \
1498c2ecf20Sopenharmony_ci	{ 'I',  'N',  'V',  'Z', 0x90, 0x2d, 0x58, 0x4a, \
1508c2ecf20Sopenharmony_ci	 0x92, 0x0b, 0x77, 0x3f, 0x1f, 0x2c, 0x55, 0x6b}
1518c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_INZI \
1528c2ecf20Sopenharmony_ci	{ 'I',  'N',  'Z',  'I', 0x66, 0x1a, 0x42, 0xa2, \
1538c2ecf20Sopenharmony_ci	 0x90, 0x65, 0xd0, 0x18, 0x14, 0xa8, 0xef, 0x8a}
1548c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_INVI \
1558c2ecf20Sopenharmony_ci	{ 'I',  'N',  'V',  'I', 0xdb, 0x57, 0x49, 0x5e, \
1568c2ecf20Sopenharmony_ci	 0x8e, 0x3f, 0xf4, 0x79, 0x53, 0x2b, 0x94, 0x6f}
1578c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_CNF4 \
1588c2ecf20Sopenharmony_ci	{ 'C',  ' ',  ' ',  ' ', 0x00, 0x00, 0x10, 0x00, \
1598c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1608c2ecf20Sopenharmony_ci
1618c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_D3DFMT_L8 \
1628c2ecf20Sopenharmony_ci	{0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \
1638c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1648c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_KSMEDIA_L8_IR \
1658c2ecf20Sopenharmony_ci	{0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, \
1668c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1678c2ecf20Sopenharmony_ci
1688c2ecf20Sopenharmony_ci#define UVC_GUID_FORMAT_HEVC \
1698c2ecf20Sopenharmony_ci	{ 'H',  'E',  'V',  'C', 0x00, 0x00, 0x10, 0x00, \
1708c2ecf20Sopenharmony_ci	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci
1738c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------
1748c2ecf20Sopenharmony_ci * Driver specific constants.
1758c2ecf20Sopenharmony_ci */
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci#define DRIVER_VERSION		"1.1.1"
1788c2ecf20Sopenharmony_ci
1798c2ecf20Sopenharmony_ci/* Number of isochronous URBs. */
1808c2ecf20Sopenharmony_ci#define UVC_URBS		5
1818c2ecf20Sopenharmony_ci/* Maximum number of packets per URB. */
1828c2ecf20Sopenharmony_ci#define UVC_MAX_PACKETS		32
1838c2ecf20Sopenharmony_ci/* Maximum status buffer size in bytes of interrupt URB. */
1848c2ecf20Sopenharmony_ci#define UVC_MAX_STATUS_SIZE	16
1858c2ecf20Sopenharmony_ci
1868c2ecf20Sopenharmony_ci#define UVC_CTRL_CONTROL_TIMEOUT	5000
1878c2ecf20Sopenharmony_ci#define UVC_CTRL_STREAMING_TIMEOUT	5000
1888c2ecf20Sopenharmony_ci
1898c2ecf20Sopenharmony_ci/* Maximum allowed number of control mappings per device */
1908c2ecf20Sopenharmony_ci#define UVC_MAX_CONTROL_MAPPINGS	1024
1918c2ecf20Sopenharmony_ci#define UVC_MAX_CONTROL_MENU_ENTRIES	32
1928c2ecf20Sopenharmony_ci
1938c2ecf20Sopenharmony_ci/* Devices quirks */
1948c2ecf20Sopenharmony_ci#define UVC_QUIRK_STATUS_INTERVAL	0x00000001
1958c2ecf20Sopenharmony_ci#define UVC_QUIRK_PROBE_MINMAX		0x00000002
1968c2ecf20Sopenharmony_ci#define UVC_QUIRK_PROBE_EXTRAFIELDS	0x00000004
1978c2ecf20Sopenharmony_ci#define UVC_QUIRK_BUILTIN_ISIGHT	0x00000008
1988c2ecf20Sopenharmony_ci#define UVC_QUIRK_STREAM_NO_FID		0x00000010
1998c2ecf20Sopenharmony_ci#define UVC_QUIRK_IGNORE_SELECTOR_UNIT	0x00000020
2008c2ecf20Sopenharmony_ci#define UVC_QUIRK_FIX_BANDWIDTH		0x00000080
2018c2ecf20Sopenharmony_ci#define UVC_QUIRK_PROBE_DEF		0x00000100
2028c2ecf20Sopenharmony_ci#define UVC_QUIRK_RESTRICT_FRAME_RATE	0x00000200
2038c2ecf20Sopenharmony_ci#define UVC_QUIRK_RESTORE_CTRLS_ON_INIT	0x00000400
2048c2ecf20Sopenharmony_ci#define UVC_QUIRK_FORCE_Y8		0x00000800
2058c2ecf20Sopenharmony_ci#define UVC_QUIRK_FORCE_BPP		0x00001000
2068c2ecf20Sopenharmony_ci#define UVC_QUIRK_WAKE_AUTOSUSPEND	0x00002000
2078c2ecf20Sopenharmony_ci
2088c2ecf20Sopenharmony_ci/* Format flags */
2098c2ecf20Sopenharmony_ci#define UVC_FMT_FLAG_COMPRESSED		0x00000001
2108c2ecf20Sopenharmony_ci#define UVC_FMT_FLAG_STREAM		0x00000002
2118c2ecf20Sopenharmony_ci
2128c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------
2138c2ecf20Sopenharmony_ci * Structures.
2148c2ecf20Sopenharmony_ci */
2158c2ecf20Sopenharmony_ci
2168c2ecf20Sopenharmony_cistruct uvc_device;
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/* TODO: Put the most frequently accessed fields at the beginning of
2198c2ecf20Sopenharmony_ci * structures to maximize cache efficiency.
2208c2ecf20Sopenharmony_ci */
2218c2ecf20Sopenharmony_cistruct uvc_control_info {
2228c2ecf20Sopenharmony_ci	struct list_head mappings;
2238c2ecf20Sopenharmony_ci
2248c2ecf20Sopenharmony_ci	u8 entity[16];
2258c2ecf20Sopenharmony_ci	u8 index;	/* Bit index in bmControls */
2268c2ecf20Sopenharmony_ci	u8 selector;
2278c2ecf20Sopenharmony_ci
2288c2ecf20Sopenharmony_ci	u16 size;
2298c2ecf20Sopenharmony_ci	u32 flags;
2308c2ecf20Sopenharmony_ci};
2318c2ecf20Sopenharmony_ci
2328c2ecf20Sopenharmony_cistruct uvc_control_mapping {
2338c2ecf20Sopenharmony_ci	struct list_head list;
2348c2ecf20Sopenharmony_ci	struct list_head ev_subs;
2358c2ecf20Sopenharmony_ci
2368c2ecf20Sopenharmony_ci	u32 id;
2378c2ecf20Sopenharmony_ci	u8 name[32];
2388c2ecf20Sopenharmony_ci	u8 entity[16];
2398c2ecf20Sopenharmony_ci	u8 selector;
2408c2ecf20Sopenharmony_ci
2418c2ecf20Sopenharmony_ci	u8 size;
2428c2ecf20Sopenharmony_ci	u8 offset;
2438c2ecf20Sopenharmony_ci	enum v4l2_ctrl_type v4l2_type;
2448c2ecf20Sopenharmony_ci	u32 data_type;
2458c2ecf20Sopenharmony_ci
2468c2ecf20Sopenharmony_ci	const struct uvc_menu_info *menu_info;
2478c2ecf20Sopenharmony_ci	u32 menu_count;
2488c2ecf20Sopenharmony_ci
2498c2ecf20Sopenharmony_ci	u32 master_id;
2508c2ecf20Sopenharmony_ci	s32 master_manual;
2518c2ecf20Sopenharmony_ci	u32 slave_ids[2];
2528c2ecf20Sopenharmony_ci
2538c2ecf20Sopenharmony_ci	s32 (*get)(struct uvc_control_mapping *mapping, u8 query,
2548c2ecf20Sopenharmony_ci		   const u8 *data);
2558c2ecf20Sopenharmony_ci	void (*set)(struct uvc_control_mapping *mapping, s32 value,
2568c2ecf20Sopenharmony_ci		    u8 *data);
2578c2ecf20Sopenharmony_ci};
2588c2ecf20Sopenharmony_ci
2598c2ecf20Sopenharmony_cistruct uvc_control {
2608c2ecf20Sopenharmony_ci	struct uvc_entity *entity;
2618c2ecf20Sopenharmony_ci	struct uvc_control_info info;
2628c2ecf20Sopenharmony_ci
2638c2ecf20Sopenharmony_ci	u8 index;	/* Used to match the uvc_control entry with a
2648c2ecf20Sopenharmony_ci			   uvc_control_info. */
2658c2ecf20Sopenharmony_ci	u8 dirty:1,
2668c2ecf20Sopenharmony_ci	   loaded:1,
2678c2ecf20Sopenharmony_ci	   modified:1,
2688c2ecf20Sopenharmony_ci	   cached:1,
2698c2ecf20Sopenharmony_ci	   initialized:1;
2708c2ecf20Sopenharmony_ci
2718c2ecf20Sopenharmony_ci	u8 *uvc_data;
2728c2ecf20Sopenharmony_ci
2738c2ecf20Sopenharmony_ci	struct uvc_fh *handle;	/* File handle that last changed the control. */
2748c2ecf20Sopenharmony_ci};
2758c2ecf20Sopenharmony_ci
2768c2ecf20Sopenharmony_cistruct uvc_format_desc {
2778c2ecf20Sopenharmony_ci	char *name;
2788c2ecf20Sopenharmony_ci	u8 guid[16];
2798c2ecf20Sopenharmony_ci	u32 fcc;
2808c2ecf20Sopenharmony_ci};
2818c2ecf20Sopenharmony_ci
2828c2ecf20Sopenharmony_ci/* The term 'entity' refers to both UVC units and UVC terminals.
2838c2ecf20Sopenharmony_ci *
2848c2ecf20Sopenharmony_ci * The type field is either the terminal type (wTerminalType in the terminal
2858c2ecf20Sopenharmony_ci * descriptor), or the unit type (bDescriptorSubtype in the unit descriptor).
2868c2ecf20Sopenharmony_ci * As the bDescriptorSubtype field is one byte long, the type value will
2878c2ecf20Sopenharmony_ci * always have a null MSB for units. All terminal types defined by the UVC
2888c2ecf20Sopenharmony_ci * specification have a non-null MSB, so it is safe to use the MSB to
2898c2ecf20Sopenharmony_ci * differentiate between units and terminals as long as the descriptor parsing
2908c2ecf20Sopenharmony_ci * code makes sure terminal types have a non-null MSB.
2918c2ecf20Sopenharmony_ci *
2928c2ecf20Sopenharmony_ci * For terminals, the type's most significant bit stores the terminal
2938c2ecf20Sopenharmony_ci * direction (either UVC_TERM_INPUT or UVC_TERM_OUTPUT). The type field should
2948c2ecf20Sopenharmony_ci * always be accessed with the UVC_ENTITY_* macros and never directly.
2958c2ecf20Sopenharmony_ci */
2968c2ecf20Sopenharmony_ci
2978c2ecf20Sopenharmony_ci#define UVC_ENTITY_FLAG_DEFAULT		(1 << 0)
2988c2ecf20Sopenharmony_ci
2998c2ecf20Sopenharmony_cistruct uvc_entity {
3008c2ecf20Sopenharmony_ci	struct list_head list;		/* Entity as part of a UVC device. */
3018c2ecf20Sopenharmony_ci	struct list_head chain;		/* Entity as part of a video device
3028c2ecf20Sopenharmony_ci					 * chain. */
3038c2ecf20Sopenharmony_ci	unsigned int flags;
3048c2ecf20Sopenharmony_ci
3058c2ecf20Sopenharmony_ci	u8 id;
3068c2ecf20Sopenharmony_ci	u16 type;
3078c2ecf20Sopenharmony_ci	char name[64];
3088c2ecf20Sopenharmony_ci
3098c2ecf20Sopenharmony_ci	/* Media controller-related fields. */
3108c2ecf20Sopenharmony_ci	struct video_device *vdev;
3118c2ecf20Sopenharmony_ci	struct v4l2_subdev subdev;
3128c2ecf20Sopenharmony_ci	unsigned int num_pads;
3138c2ecf20Sopenharmony_ci	unsigned int num_links;
3148c2ecf20Sopenharmony_ci	struct media_pad *pads;
3158c2ecf20Sopenharmony_ci
3168c2ecf20Sopenharmony_ci	union {
3178c2ecf20Sopenharmony_ci		struct {
3188c2ecf20Sopenharmony_ci			u16 wObjectiveFocalLengthMin;
3198c2ecf20Sopenharmony_ci			u16 wObjectiveFocalLengthMax;
3208c2ecf20Sopenharmony_ci			u16 wOcularFocalLength;
3218c2ecf20Sopenharmony_ci			u8  bControlSize;
3228c2ecf20Sopenharmony_ci			u8  *bmControls;
3238c2ecf20Sopenharmony_ci		} camera;
3248c2ecf20Sopenharmony_ci
3258c2ecf20Sopenharmony_ci		struct {
3268c2ecf20Sopenharmony_ci			u8  bControlSize;
3278c2ecf20Sopenharmony_ci			u8  *bmControls;
3288c2ecf20Sopenharmony_ci			u8  bTransportModeSize;
3298c2ecf20Sopenharmony_ci			u8  *bmTransportModes;
3308c2ecf20Sopenharmony_ci		} media;
3318c2ecf20Sopenharmony_ci
3328c2ecf20Sopenharmony_ci		struct {
3338c2ecf20Sopenharmony_ci		} output;
3348c2ecf20Sopenharmony_ci
3358c2ecf20Sopenharmony_ci		struct {
3368c2ecf20Sopenharmony_ci			u16 wMaxMultiplier;
3378c2ecf20Sopenharmony_ci			u8  bControlSize;
3388c2ecf20Sopenharmony_ci			u8  *bmControls;
3398c2ecf20Sopenharmony_ci			u8  bmVideoStandards;
3408c2ecf20Sopenharmony_ci		} processing;
3418c2ecf20Sopenharmony_ci
3428c2ecf20Sopenharmony_ci		struct {
3438c2ecf20Sopenharmony_ci		} selector;
3448c2ecf20Sopenharmony_ci
3458c2ecf20Sopenharmony_ci		struct {
3468c2ecf20Sopenharmony_ci			u8  guidExtensionCode[16];
3478c2ecf20Sopenharmony_ci			u8  bNumControls;
3488c2ecf20Sopenharmony_ci			u8  bControlSize;
3498c2ecf20Sopenharmony_ci			u8  *bmControls;
3508c2ecf20Sopenharmony_ci			u8  *bmControlsType;
3518c2ecf20Sopenharmony_ci		} extension;
3528c2ecf20Sopenharmony_ci	};
3538c2ecf20Sopenharmony_ci
3548c2ecf20Sopenharmony_ci	u8 bNrInPins;
3558c2ecf20Sopenharmony_ci	u8 *baSourceID;
3568c2ecf20Sopenharmony_ci
3578c2ecf20Sopenharmony_ci	unsigned int ncontrols;
3588c2ecf20Sopenharmony_ci	struct uvc_control *controls;
3598c2ecf20Sopenharmony_ci};
3608c2ecf20Sopenharmony_ci
3618c2ecf20Sopenharmony_cistruct uvc_frame {
3628c2ecf20Sopenharmony_ci	u8  bFrameIndex;
3638c2ecf20Sopenharmony_ci	u8  bmCapabilities;
3648c2ecf20Sopenharmony_ci	u16 wWidth;
3658c2ecf20Sopenharmony_ci	u16 wHeight;
3668c2ecf20Sopenharmony_ci	u32 dwMinBitRate;
3678c2ecf20Sopenharmony_ci	u32 dwMaxBitRate;
3688c2ecf20Sopenharmony_ci	u32 dwMaxVideoFrameBufferSize;
3698c2ecf20Sopenharmony_ci	u8  bFrameIntervalType;
3708c2ecf20Sopenharmony_ci	u32 dwDefaultFrameInterval;
3718c2ecf20Sopenharmony_ci	u32 *dwFrameInterval;
3728c2ecf20Sopenharmony_ci};
3738c2ecf20Sopenharmony_ci
3748c2ecf20Sopenharmony_cistruct uvc_format {
3758c2ecf20Sopenharmony_ci	u8 type;
3768c2ecf20Sopenharmony_ci	u8 index;
3778c2ecf20Sopenharmony_ci	u8 bpp;
3788c2ecf20Sopenharmony_ci	enum v4l2_colorspace colorspace;
3798c2ecf20Sopenharmony_ci	enum v4l2_xfer_func xfer_func;
3808c2ecf20Sopenharmony_ci	enum v4l2_ycbcr_encoding ycbcr_enc;
3818c2ecf20Sopenharmony_ci	u32 fcc;
3828c2ecf20Sopenharmony_ci	u32 flags;
3838c2ecf20Sopenharmony_ci
3848c2ecf20Sopenharmony_ci	char name[32];
3858c2ecf20Sopenharmony_ci
3868c2ecf20Sopenharmony_ci	unsigned int nframes;
3878c2ecf20Sopenharmony_ci	struct uvc_frame *frame;
3888c2ecf20Sopenharmony_ci};
3898c2ecf20Sopenharmony_ci
3908c2ecf20Sopenharmony_cistruct uvc_streaming_header {
3918c2ecf20Sopenharmony_ci	u8 bNumFormats;
3928c2ecf20Sopenharmony_ci	u8 bEndpointAddress;
3938c2ecf20Sopenharmony_ci	u8 bTerminalLink;
3948c2ecf20Sopenharmony_ci	u8 bControlSize;
3958c2ecf20Sopenharmony_ci	u8 *bmaControls;
3968c2ecf20Sopenharmony_ci	/* The following fields are used by input headers only. */
3978c2ecf20Sopenharmony_ci	u8 bmInfo;
3988c2ecf20Sopenharmony_ci	u8 bStillCaptureMethod;
3998c2ecf20Sopenharmony_ci	u8 bTriggerSupport;
4008c2ecf20Sopenharmony_ci	u8 bTriggerUsage;
4018c2ecf20Sopenharmony_ci};
4028c2ecf20Sopenharmony_ci
4038c2ecf20Sopenharmony_cienum uvc_buffer_state {
4048c2ecf20Sopenharmony_ci	UVC_BUF_STATE_IDLE	= 0,
4058c2ecf20Sopenharmony_ci	UVC_BUF_STATE_QUEUED	= 1,
4068c2ecf20Sopenharmony_ci	UVC_BUF_STATE_ACTIVE	= 2,
4078c2ecf20Sopenharmony_ci	UVC_BUF_STATE_READY	= 3,
4088c2ecf20Sopenharmony_ci	UVC_BUF_STATE_DONE	= 4,
4098c2ecf20Sopenharmony_ci	UVC_BUF_STATE_ERROR	= 5,
4108c2ecf20Sopenharmony_ci};
4118c2ecf20Sopenharmony_ci
4128c2ecf20Sopenharmony_cistruct uvc_buffer {
4138c2ecf20Sopenharmony_ci	struct vb2_v4l2_buffer buf;
4148c2ecf20Sopenharmony_ci	struct list_head queue;
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ci	enum uvc_buffer_state state;
4178c2ecf20Sopenharmony_ci	unsigned int error;
4188c2ecf20Sopenharmony_ci
4198c2ecf20Sopenharmony_ci	void *mem;
4208c2ecf20Sopenharmony_ci	unsigned int length;
4218c2ecf20Sopenharmony_ci	unsigned int bytesused;
4228c2ecf20Sopenharmony_ci
4238c2ecf20Sopenharmony_ci	u32 pts;
4248c2ecf20Sopenharmony_ci
4258c2ecf20Sopenharmony_ci	/* Asynchronous buffer handling. */
4268c2ecf20Sopenharmony_ci	struct kref ref;
4278c2ecf20Sopenharmony_ci};
4288c2ecf20Sopenharmony_ci
4298c2ecf20Sopenharmony_ci#define UVC_QUEUE_DISCONNECTED		(1 << 0)
4308c2ecf20Sopenharmony_ci#define UVC_QUEUE_DROP_CORRUPTED	(1 << 1)
4318c2ecf20Sopenharmony_ci
4328c2ecf20Sopenharmony_cistruct uvc_video_queue {
4338c2ecf20Sopenharmony_ci	struct vb2_queue queue;
4348c2ecf20Sopenharmony_ci	struct mutex mutex;			/* Protects queue */
4358c2ecf20Sopenharmony_ci
4368c2ecf20Sopenharmony_ci	unsigned int flags;
4378c2ecf20Sopenharmony_ci	unsigned int buf_used;
4388c2ecf20Sopenharmony_ci
4398c2ecf20Sopenharmony_ci	spinlock_t irqlock;			/* Protects irqqueue */
4408c2ecf20Sopenharmony_ci	struct list_head irqqueue;
4418c2ecf20Sopenharmony_ci};
4428c2ecf20Sopenharmony_ci
4438c2ecf20Sopenharmony_cistruct uvc_video_chain {
4448c2ecf20Sopenharmony_ci	struct uvc_device *dev;
4458c2ecf20Sopenharmony_ci	struct list_head list;
4468c2ecf20Sopenharmony_ci
4478c2ecf20Sopenharmony_ci	struct list_head entities;		/* All entities */
4488c2ecf20Sopenharmony_ci	struct uvc_entity *processing;		/* Processing unit */
4498c2ecf20Sopenharmony_ci	struct uvc_entity *selector;		/* Selector unit */
4508c2ecf20Sopenharmony_ci
4518c2ecf20Sopenharmony_ci	struct mutex ctrl_mutex;		/* Protects ctrl.info */
4528c2ecf20Sopenharmony_ci
4538c2ecf20Sopenharmony_ci	struct v4l2_prio_state prio;		/* V4L2 priority state */
4548c2ecf20Sopenharmony_ci	u32 caps;				/* V4L2 chain-wide caps */
4558c2ecf20Sopenharmony_ci};
4568c2ecf20Sopenharmony_ci
4578c2ecf20Sopenharmony_cistruct uvc_stats_frame {
4588c2ecf20Sopenharmony_ci	unsigned int size;		/* Number of bytes captured */
4598c2ecf20Sopenharmony_ci	unsigned int first_data;	/* Index of the first non-empty packet */
4608c2ecf20Sopenharmony_ci
4618c2ecf20Sopenharmony_ci	unsigned int nb_packets;	/* Number of packets */
4628c2ecf20Sopenharmony_ci	unsigned int nb_empty;		/* Number of empty packets */
4638c2ecf20Sopenharmony_ci	unsigned int nb_invalid;	/* Number of packets with an invalid header */
4648c2ecf20Sopenharmony_ci	unsigned int nb_errors;		/* Number of packets with the error bit set */
4658c2ecf20Sopenharmony_ci
4668c2ecf20Sopenharmony_ci	unsigned int nb_pts;		/* Number of packets with a PTS timestamp */
4678c2ecf20Sopenharmony_ci	unsigned int nb_pts_diffs;	/* Number of PTS differences inside a frame */
4688c2ecf20Sopenharmony_ci	unsigned int last_pts_diff;	/* Index of the last PTS difference */
4698c2ecf20Sopenharmony_ci	bool has_initial_pts;		/* Whether the first non-empty packet has a PTS */
4708c2ecf20Sopenharmony_ci	bool has_early_pts;		/* Whether a PTS is present before the first non-empty packet */
4718c2ecf20Sopenharmony_ci	u32 pts;			/* PTS of the last packet */
4728c2ecf20Sopenharmony_ci
4738c2ecf20Sopenharmony_ci	unsigned int nb_scr;		/* Number of packets with a SCR timestamp */
4748c2ecf20Sopenharmony_ci	unsigned int nb_scr_diffs;	/* Number of SCR.STC differences inside a frame */
4758c2ecf20Sopenharmony_ci	u16 scr_sof;			/* SCR.SOF of the last packet */
4768c2ecf20Sopenharmony_ci	u32 scr_stc;			/* SCR.STC of the last packet */
4778c2ecf20Sopenharmony_ci};
4788c2ecf20Sopenharmony_ci
4798c2ecf20Sopenharmony_cistruct uvc_stats_stream {
4808c2ecf20Sopenharmony_ci	ktime_t start_ts;		/* Stream start timestamp */
4818c2ecf20Sopenharmony_ci	ktime_t stop_ts;		/* Stream stop timestamp */
4828c2ecf20Sopenharmony_ci
4838c2ecf20Sopenharmony_ci	unsigned int nb_frames;		/* Number of frames */
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ci	unsigned int nb_packets;	/* Number of packets */
4868c2ecf20Sopenharmony_ci	unsigned int nb_empty;		/* Number of empty packets */
4878c2ecf20Sopenharmony_ci	unsigned int nb_invalid;	/* Number of packets with an invalid header */
4888c2ecf20Sopenharmony_ci	unsigned int nb_errors;		/* Number of packets with the error bit set */
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci	unsigned int nb_pts_constant;	/* Number of frames with constant PTS */
4918c2ecf20Sopenharmony_ci	unsigned int nb_pts_early;	/* Number of frames with early PTS */
4928c2ecf20Sopenharmony_ci	unsigned int nb_pts_initial;	/* Number of frames with initial PTS */
4938c2ecf20Sopenharmony_ci
4948c2ecf20Sopenharmony_ci	unsigned int nb_scr_count_ok;	/* Number of frames with at least one SCR per non empty packet */
4958c2ecf20Sopenharmony_ci	unsigned int nb_scr_diffs_ok;	/* Number of frames with varying SCR.STC */
4968c2ecf20Sopenharmony_ci	unsigned int scr_sof_count;	/* STC.SOF counter accumulated since stream start */
4978c2ecf20Sopenharmony_ci	unsigned int scr_sof;		/* STC.SOF of the last packet */
4988c2ecf20Sopenharmony_ci	unsigned int min_sof;		/* Minimum STC.SOF value */
4998c2ecf20Sopenharmony_ci	unsigned int max_sof;		/* Maximum STC.SOF value */
5008c2ecf20Sopenharmony_ci};
5018c2ecf20Sopenharmony_ci
5028c2ecf20Sopenharmony_ci#define UVC_METADATA_BUF_SIZE 1024
5038c2ecf20Sopenharmony_ci
5048c2ecf20Sopenharmony_ci/**
5058c2ecf20Sopenharmony_ci * struct uvc_copy_op: Context structure to schedule asynchronous memcpy
5068c2ecf20Sopenharmony_ci *
5078c2ecf20Sopenharmony_ci * @buf: active buf object for this operation
5088c2ecf20Sopenharmony_ci * @dst: copy destination address
5098c2ecf20Sopenharmony_ci * @src: copy source address
5108c2ecf20Sopenharmony_ci * @len: copy length
5118c2ecf20Sopenharmony_ci */
5128c2ecf20Sopenharmony_cistruct uvc_copy_op {
5138c2ecf20Sopenharmony_ci	struct uvc_buffer *buf;
5148c2ecf20Sopenharmony_ci	void *dst;
5158c2ecf20Sopenharmony_ci	const __u8 *src;
5168c2ecf20Sopenharmony_ci	size_t len;
5178c2ecf20Sopenharmony_ci};
5188c2ecf20Sopenharmony_ci
5198c2ecf20Sopenharmony_ci/**
5208c2ecf20Sopenharmony_ci * struct uvc_urb - URB context management structure
5218c2ecf20Sopenharmony_ci *
5228c2ecf20Sopenharmony_ci * @urb: the URB described by this context structure
5238c2ecf20Sopenharmony_ci * @stream: UVC streaming context
5248c2ecf20Sopenharmony_ci * @buffer: memory storage for the URB
5258c2ecf20Sopenharmony_ci * @dma: DMA coherent addressing for the urb_buffer
5268c2ecf20Sopenharmony_ci * @async_operations: counter to indicate the number of copy operations
5278c2ecf20Sopenharmony_ci * @copy_operations: work descriptors for asynchronous copy operations
5288c2ecf20Sopenharmony_ci * @work: work queue entry for asynchronous decode
5298c2ecf20Sopenharmony_ci */
5308c2ecf20Sopenharmony_cistruct uvc_urb {
5318c2ecf20Sopenharmony_ci	struct urb *urb;
5328c2ecf20Sopenharmony_ci	struct uvc_streaming *stream;
5338c2ecf20Sopenharmony_ci
5348c2ecf20Sopenharmony_ci	char *buffer;
5358c2ecf20Sopenharmony_ci	dma_addr_t dma;
5368c2ecf20Sopenharmony_ci
5378c2ecf20Sopenharmony_ci	unsigned int async_operations;
5388c2ecf20Sopenharmony_ci	struct uvc_copy_op copy_operations[UVC_MAX_PACKETS];
5398c2ecf20Sopenharmony_ci	struct work_struct work;
5408c2ecf20Sopenharmony_ci};
5418c2ecf20Sopenharmony_ci
5428c2ecf20Sopenharmony_cistruct uvc_streaming {
5438c2ecf20Sopenharmony_ci	struct list_head list;
5448c2ecf20Sopenharmony_ci	struct uvc_device *dev;
5458c2ecf20Sopenharmony_ci	struct video_device vdev;
5468c2ecf20Sopenharmony_ci	struct uvc_video_chain *chain;
5478c2ecf20Sopenharmony_ci	atomic_t active;
5488c2ecf20Sopenharmony_ci
5498c2ecf20Sopenharmony_ci	struct usb_interface *intf;
5508c2ecf20Sopenharmony_ci	int intfnum;
5518c2ecf20Sopenharmony_ci	u16 maxpsize;
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_ci	struct uvc_streaming_header header;
5548c2ecf20Sopenharmony_ci	enum v4l2_buf_type type;
5558c2ecf20Sopenharmony_ci
5568c2ecf20Sopenharmony_ci	unsigned int nformats;
5578c2ecf20Sopenharmony_ci	struct uvc_format *format;
5588c2ecf20Sopenharmony_ci
5598c2ecf20Sopenharmony_ci	struct uvc_streaming_control ctrl;
5608c2ecf20Sopenharmony_ci	struct uvc_format *def_format;
5618c2ecf20Sopenharmony_ci	struct uvc_format *cur_format;
5628c2ecf20Sopenharmony_ci	struct uvc_frame *cur_frame;
5638c2ecf20Sopenharmony_ci
5648c2ecf20Sopenharmony_ci	/* Protect access to ctrl, cur_format, cur_frame and hardware video
5658c2ecf20Sopenharmony_ci	 * probe control.
5668c2ecf20Sopenharmony_ci	 */
5678c2ecf20Sopenharmony_ci	struct mutex mutex;
5688c2ecf20Sopenharmony_ci
5698c2ecf20Sopenharmony_ci	/* Buffers queue. */
5708c2ecf20Sopenharmony_ci	unsigned int frozen : 1;
5718c2ecf20Sopenharmony_ci	struct uvc_video_queue queue;
5728c2ecf20Sopenharmony_ci	struct workqueue_struct *async_wq;
5738c2ecf20Sopenharmony_ci	void (*decode)(struct uvc_urb *uvc_urb, struct uvc_buffer *buf,
5748c2ecf20Sopenharmony_ci		       struct uvc_buffer *meta_buf);
5758c2ecf20Sopenharmony_ci
5768c2ecf20Sopenharmony_ci	struct {
5778c2ecf20Sopenharmony_ci		struct video_device vdev;
5788c2ecf20Sopenharmony_ci		struct uvc_video_queue queue;
5798c2ecf20Sopenharmony_ci		u32 format;
5808c2ecf20Sopenharmony_ci	} meta;
5818c2ecf20Sopenharmony_ci
5828c2ecf20Sopenharmony_ci	/* Context data used by the bulk completion handler. */
5838c2ecf20Sopenharmony_ci	struct {
5848c2ecf20Sopenharmony_ci		u8 header[256];
5858c2ecf20Sopenharmony_ci		unsigned int header_size;
5868c2ecf20Sopenharmony_ci		int skip_payload;
5878c2ecf20Sopenharmony_ci		u32 payload_size;
5888c2ecf20Sopenharmony_ci		u32 max_payload_size;
5898c2ecf20Sopenharmony_ci	} bulk;
5908c2ecf20Sopenharmony_ci
5918c2ecf20Sopenharmony_ci	struct uvc_urb uvc_urb[UVC_URBS];
5928c2ecf20Sopenharmony_ci	unsigned int urb_size;
5938c2ecf20Sopenharmony_ci
5948c2ecf20Sopenharmony_ci	u32 sequence;
5958c2ecf20Sopenharmony_ci	u8 last_fid;
5968c2ecf20Sopenharmony_ci
5978c2ecf20Sopenharmony_ci	/* debugfs */
5988c2ecf20Sopenharmony_ci	struct dentry *debugfs_dir;
5998c2ecf20Sopenharmony_ci	struct {
6008c2ecf20Sopenharmony_ci		struct uvc_stats_frame frame;
6018c2ecf20Sopenharmony_ci		struct uvc_stats_stream stream;
6028c2ecf20Sopenharmony_ci	} stats;
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci	/* Timestamps support. */
6058c2ecf20Sopenharmony_ci	struct uvc_clock {
6068c2ecf20Sopenharmony_ci		struct uvc_clock_sample {
6078c2ecf20Sopenharmony_ci			u32 dev_stc;
6088c2ecf20Sopenharmony_ci			u16 dev_sof;
6098c2ecf20Sopenharmony_ci			u16 host_sof;
6108c2ecf20Sopenharmony_ci			ktime_t host_time;
6118c2ecf20Sopenharmony_ci		} *samples;
6128c2ecf20Sopenharmony_ci
6138c2ecf20Sopenharmony_ci		unsigned int head;
6148c2ecf20Sopenharmony_ci		unsigned int count;
6158c2ecf20Sopenharmony_ci		unsigned int size;
6168c2ecf20Sopenharmony_ci
6178c2ecf20Sopenharmony_ci		u16 last_sof;
6188c2ecf20Sopenharmony_ci		u16 sof_offset;
6198c2ecf20Sopenharmony_ci
6208c2ecf20Sopenharmony_ci		u8 last_scr[6];
6218c2ecf20Sopenharmony_ci
6228c2ecf20Sopenharmony_ci		spinlock_t lock;
6238c2ecf20Sopenharmony_ci	} clock;
6248c2ecf20Sopenharmony_ci};
6258c2ecf20Sopenharmony_ci
6268c2ecf20Sopenharmony_ci#define for_each_uvc_urb(uvc_urb, uvc_streaming) \
6278c2ecf20Sopenharmony_ci	for ((uvc_urb) = &(uvc_streaming)->uvc_urb[0]; \
6288c2ecf20Sopenharmony_ci	     (uvc_urb) < &(uvc_streaming)->uvc_urb[UVC_URBS]; \
6298c2ecf20Sopenharmony_ci	     ++(uvc_urb))
6308c2ecf20Sopenharmony_ci
6318c2ecf20Sopenharmony_cistatic inline u32 uvc_urb_index(const struct uvc_urb *uvc_urb)
6328c2ecf20Sopenharmony_ci{
6338c2ecf20Sopenharmony_ci	return uvc_urb - &uvc_urb->stream->uvc_urb[0];
6348c2ecf20Sopenharmony_ci}
6358c2ecf20Sopenharmony_ci
6368c2ecf20Sopenharmony_cistruct uvc_device_info {
6378c2ecf20Sopenharmony_ci	u32	quirks;
6388c2ecf20Sopenharmony_ci	u32	meta_format;
6398c2ecf20Sopenharmony_ci};
6408c2ecf20Sopenharmony_ci
6418c2ecf20Sopenharmony_cistruct uvc_device {
6428c2ecf20Sopenharmony_ci	struct usb_device *udev;
6438c2ecf20Sopenharmony_ci	struct usb_interface *intf;
6448c2ecf20Sopenharmony_ci	unsigned long warnings;
6458c2ecf20Sopenharmony_ci	u32 quirks;
6468c2ecf20Sopenharmony_ci	int intfnum;
6478c2ecf20Sopenharmony_ci	char name[32];
6488c2ecf20Sopenharmony_ci
6498c2ecf20Sopenharmony_ci	const struct uvc_device_info *info;
6508c2ecf20Sopenharmony_ci
6518c2ecf20Sopenharmony_ci	struct mutex lock;		/* Protects users */
6528c2ecf20Sopenharmony_ci	unsigned int users;
6538c2ecf20Sopenharmony_ci	atomic_t nmappings;
6548c2ecf20Sopenharmony_ci
6558c2ecf20Sopenharmony_ci	/* Video control interface */
6568c2ecf20Sopenharmony_ci#ifdef CONFIG_MEDIA_CONTROLLER
6578c2ecf20Sopenharmony_ci	struct media_device mdev;
6588c2ecf20Sopenharmony_ci#endif
6598c2ecf20Sopenharmony_ci	struct v4l2_device vdev;
6608c2ecf20Sopenharmony_ci	u16 uvc_version;
6618c2ecf20Sopenharmony_ci	u32 clock_frequency;
6628c2ecf20Sopenharmony_ci
6638c2ecf20Sopenharmony_ci	struct list_head entities;
6648c2ecf20Sopenharmony_ci	struct list_head chains;
6658c2ecf20Sopenharmony_ci
6668c2ecf20Sopenharmony_ci	/* Video Streaming interfaces */
6678c2ecf20Sopenharmony_ci	struct list_head streams;
6688c2ecf20Sopenharmony_ci	struct kref ref;
6698c2ecf20Sopenharmony_ci
6708c2ecf20Sopenharmony_ci	/* Status Interrupt Endpoint */
6718c2ecf20Sopenharmony_ci	struct usb_host_endpoint *int_ep;
6728c2ecf20Sopenharmony_ci	struct urb *int_urb;
6738c2ecf20Sopenharmony_ci	bool flush_status;
6748c2ecf20Sopenharmony_ci	u8 *status;
6758c2ecf20Sopenharmony_ci	struct input_dev *input;
6768c2ecf20Sopenharmony_ci	char input_phys[64];
6778c2ecf20Sopenharmony_ci
6788c2ecf20Sopenharmony_ci	struct uvc_ctrl_work {
6798c2ecf20Sopenharmony_ci		struct work_struct work;
6808c2ecf20Sopenharmony_ci		struct urb *urb;
6818c2ecf20Sopenharmony_ci		struct uvc_video_chain *chain;
6828c2ecf20Sopenharmony_ci		struct uvc_control *ctrl;
6838c2ecf20Sopenharmony_ci		const void *data;
6848c2ecf20Sopenharmony_ci	} async_ctrl;
6858c2ecf20Sopenharmony_ci};
6868c2ecf20Sopenharmony_ci
6878c2ecf20Sopenharmony_cienum uvc_handle_state {
6888c2ecf20Sopenharmony_ci	UVC_HANDLE_PASSIVE	= 0,
6898c2ecf20Sopenharmony_ci	UVC_HANDLE_ACTIVE	= 1,
6908c2ecf20Sopenharmony_ci};
6918c2ecf20Sopenharmony_ci
6928c2ecf20Sopenharmony_cistruct uvc_fh {
6938c2ecf20Sopenharmony_ci	struct v4l2_fh vfh;
6948c2ecf20Sopenharmony_ci	struct uvc_video_chain *chain;
6958c2ecf20Sopenharmony_ci	struct uvc_streaming *stream;
6968c2ecf20Sopenharmony_ci	enum uvc_handle_state state;
6978c2ecf20Sopenharmony_ci};
6988c2ecf20Sopenharmony_ci
6998c2ecf20Sopenharmony_cistruct uvc_driver {
7008c2ecf20Sopenharmony_ci	struct usb_driver driver;
7018c2ecf20Sopenharmony_ci};
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_ci/* ------------------------------------------------------------------------
7048c2ecf20Sopenharmony_ci * Debugging, printing and logging
7058c2ecf20Sopenharmony_ci */
7068c2ecf20Sopenharmony_ci
7078c2ecf20Sopenharmony_ci#define UVC_TRACE_PROBE		(1 << 0)
7088c2ecf20Sopenharmony_ci#define UVC_TRACE_DESCR		(1 << 1)
7098c2ecf20Sopenharmony_ci#define UVC_TRACE_CONTROL	(1 << 2)
7108c2ecf20Sopenharmony_ci#define UVC_TRACE_FORMAT	(1 << 3)
7118c2ecf20Sopenharmony_ci#define UVC_TRACE_CAPTURE	(1 << 4)
7128c2ecf20Sopenharmony_ci#define UVC_TRACE_CALLS		(1 << 5)
7138c2ecf20Sopenharmony_ci#define UVC_TRACE_FRAME		(1 << 7)
7148c2ecf20Sopenharmony_ci#define UVC_TRACE_SUSPEND	(1 << 8)
7158c2ecf20Sopenharmony_ci#define UVC_TRACE_STATUS	(1 << 9)
7168c2ecf20Sopenharmony_ci#define UVC_TRACE_VIDEO		(1 << 10)
7178c2ecf20Sopenharmony_ci#define UVC_TRACE_STATS		(1 << 11)
7188c2ecf20Sopenharmony_ci#define UVC_TRACE_CLOCK		(1 << 12)
7198c2ecf20Sopenharmony_ci
7208c2ecf20Sopenharmony_ci#define UVC_WARN_MINMAX		0
7218c2ecf20Sopenharmony_ci#define UVC_WARN_PROBE_DEF	1
7228c2ecf20Sopenharmony_ci#define UVC_WARN_XU_GET_RES	2
7238c2ecf20Sopenharmony_ci
7248c2ecf20Sopenharmony_ciextern unsigned int uvc_clock_param;
7258c2ecf20Sopenharmony_ciextern unsigned int uvc_no_drop_param;
7268c2ecf20Sopenharmony_ciextern unsigned int uvc_trace_param;
7278c2ecf20Sopenharmony_ciextern unsigned int uvc_timeout_param;
7288c2ecf20Sopenharmony_ciextern unsigned int uvc_hw_timestamps_param;
7298c2ecf20Sopenharmony_ci
7308c2ecf20Sopenharmony_ci#define uvc_trace(flag, msg...) \
7318c2ecf20Sopenharmony_ci	do { \
7328c2ecf20Sopenharmony_ci		if (uvc_trace_param & flag) \
7338c2ecf20Sopenharmony_ci			printk(KERN_DEBUG "uvcvideo: " msg); \
7348c2ecf20Sopenharmony_ci	} while (0)
7358c2ecf20Sopenharmony_ci
7368c2ecf20Sopenharmony_ci#define uvc_warn_once(dev, warn, msg...) \
7378c2ecf20Sopenharmony_ci	do { \
7388c2ecf20Sopenharmony_ci		if (!test_and_set_bit(warn, &dev->warnings)) \
7398c2ecf20Sopenharmony_ci			printk(KERN_INFO "uvcvideo: " msg); \
7408c2ecf20Sopenharmony_ci	} while (0)
7418c2ecf20Sopenharmony_ci
7428c2ecf20Sopenharmony_ci#define uvc_printk(level, msg...) \
7438c2ecf20Sopenharmony_ci	printk(level "uvcvideo: " msg)
7448c2ecf20Sopenharmony_ci
7458c2ecf20Sopenharmony_ci/* --------------------------------------------------------------------------
7468c2ecf20Sopenharmony_ci * Internal functions.
7478c2ecf20Sopenharmony_ci */
7488c2ecf20Sopenharmony_ci
7498c2ecf20Sopenharmony_ci/* Core driver */
7508c2ecf20Sopenharmony_ciextern struct uvc_driver uvc_driver;
7518c2ecf20Sopenharmony_ci
7528c2ecf20Sopenharmony_cistruct uvc_entity *uvc_entity_by_id(struct uvc_device *dev, int id);
7538c2ecf20Sopenharmony_ci
7548c2ecf20Sopenharmony_ci/* Video buffers queue management. */
7558c2ecf20Sopenharmony_ciint uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type,
7568c2ecf20Sopenharmony_ci		   int drop_corrupted);
7578c2ecf20Sopenharmony_civoid uvc_queue_release(struct uvc_video_queue *queue);
7588c2ecf20Sopenharmony_ciint uvc_request_buffers(struct uvc_video_queue *queue,
7598c2ecf20Sopenharmony_ci			struct v4l2_requestbuffers *rb);
7608c2ecf20Sopenharmony_ciint uvc_query_buffer(struct uvc_video_queue *queue,
7618c2ecf20Sopenharmony_ci		     struct v4l2_buffer *v4l2_buf);
7628c2ecf20Sopenharmony_ciint uvc_create_buffers(struct uvc_video_queue *queue,
7638c2ecf20Sopenharmony_ci		       struct v4l2_create_buffers *v4l2_cb);
7648c2ecf20Sopenharmony_ciint uvc_queue_buffer(struct uvc_video_queue *queue,
7658c2ecf20Sopenharmony_ci		     struct media_device *mdev,
7668c2ecf20Sopenharmony_ci		     struct v4l2_buffer *v4l2_buf);
7678c2ecf20Sopenharmony_ciint uvc_export_buffer(struct uvc_video_queue *queue,
7688c2ecf20Sopenharmony_ci		      struct v4l2_exportbuffer *exp);
7698c2ecf20Sopenharmony_ciint uvc_dequeue_buffer(struct uvc_video_queue *queue,
7708c2ecf20Sopenharmony_ci		       struct v4l2_buffer *v4l2_buf, int nonblocking);
7718c2ecf20Sopenharmony_ciint uvc_queue_streamon(struct uvc_video_queue *queue, enum v4l2_buf_type type);
7728c2ecf20Sopenharmony_ciint uvc_queue_streamoff(struct uvc_video_queue *queue, enum v4l2_buf_type type);
7738c2ecf20Sopenharmony_civoid uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect);
7748c2ecf20Sopenharmony_cistruct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue,
7758c2ecf20Sopenharmony_ci					 struct uvc_buffer *buf);
7768c2ecf20Sopenharmony_cistruct uvc_buffer *uvc_queue_get_current_buffer(struct uvc_video_queue *queue);
7778c2ecf20Sopenharmony_civoid uvc_queue_buffer_release(struct uvc_buffer *buf);
7788c2ecf20Sopenharmony_ciint uvc_queue_mmap(struct uvc_video_queue *queue,
7798c2ecf20Sopenharmony_ci		   struct vm_area_struct *vma);
7808c2ecf20Sopenharmony_ci__poll_t uvc_queue_poll(struct uvc_video_queue *queue, struct file *file,
7818c2ecf20Sopenharmony_ci			poll_table *wait);
7828c2ecf20Sopenharmony_ci#ifndef CONFIG_MMU
7838c2ecf20Sopenharmony_ciunsigned long uvc_queue_get_unmapped_area(struct uvc_video_queue *queue,
7848c2ecf20Sopenharmony_ci					  unsigned long pgoff);
7858c2ecf20Sopenharmony_ci#endif
7868c2ecf20Sopenharmony_ciint uvc_queue_allocated(struct uvc_video_queue *queue);
7878c2ecf20Sopenharmony_cistatic inline int uvc_queue_streaming(struct uvc_video_queue *queue)
7888c2ecf20Sopenharmony_ci{
7898c2ecf20Sopenharmony_ci	return vb2_is_streaming(&queue->queue);
7908c2ecf20Sopenharmony_ci}
7918c2ecf20Sopenharmony_ci
7928c2ecf20Sopenharmony_ci/* V4L2 interface */
7938c2ecf20Sopenharmony_ciextern const struct v4l2_ioctl_ops uvc_ioctl_ops;
7948c2ecf20Sopenharmony_ciextern const struct v4l2_file_operations uvc_fops;
7958c2ecf20Sopenharmony_ci
7968c2ecf20Sopenharmony_ci/* Media controller */
7978c2ecf20Sopenharmony_ciint uvc_mc_register_entities(struct uvc_video_chain *chain);
7988c2ecf20Sopenharmony_civoid uvc_mc_cleanup_entity(struct uvc_entity *entity);
7998c2ecf20Sopenharmony_ci
8008c2ecf20Sopenharmony_ci/* Video */
8018c2ecf20Sopenharmony_ciint uvc_video_init(struct uvc_streaming *stream);
8028c2ecf20Sopenharmony_ciint uvc_video_suspend(struct uvc_streaming *stream);
8038c2ecf20Sopenharmony_ciint uvc_video_resume(struct uvc_streaming *stream, int reset);
8048c2ecf20Sopenharmony_ciint uvc_video_start_streaming(struct uvc_streaming *stream);
8058c2ecf20Sopenharmony_civoid uvc_video_stop_streaming(struct uvc_streaming *stream);
8068c2ecf20Sopenharmony_ciint uvc_probe_video(struct uvc_streaming *stream,
8078c2ecf20Sopenharmony_ci		    struct uvc_streaming_control *probe);
8088c2ecf20Sopenharmony_ciint uvc_query_ctrl(struct uvc_device *dev, u8 query, u8 unit,
8098c2ecf20Sopenharmony_ci		   u8 intfnum, u8 cs, void *data, u16 size);
8108c2ecf20Sopenharmony_civoid uvc_video_clock_update(struct uvc_streaming *stream,
8118c2ecf20Sopenharmony_ci			    struct vb2_v4l2_buffer *vbuf,
8128c2ecf20Sopenharmony_ci			    struct uvc_buffer *buf);
8138c2ecf20Sopenharmony_ciint uvc_meta_register(struct uvc_streaming *stream);
8148c2ecf20Sopenharmony_ci
8158c2ecf20Sopenharmony_ciint uvc_register_video_device(struct uvc_device *dev,
8168c2ecf20Sopenharmony_ci			      struct uvc_streaming *stream,
8178c2ecf20Sopenharmony_ci			      struct video_device *vdev,
8188c2ecf20Sopenharmony_ci			      struct uvc_video_queue *queue,
8198c2ecf20Sopenharmony_ci			      enum v4l2_buf_type type,
8208c2ecf20Sopenharmony_ci			      const struct v4l2_file_operations *fops,
8218c2ecf20Sopenharmony_ci			      const struct v4l2_ioctl_ops *ioctl_ops);
8228c2ecf20Sopenharmony_ci
8238c2ecf20Sopenharmony_ci/* Status */
8248c2ecf20Sopenharmony_ciint uvc_status_init(struct uvc_device *dev);
8258c2ecf20Sopenharmony_civoid uvc_status_unregister(struct uvc_device *dev);
8268c2ecf20Sopenharmony_civoid uvc_status_cleanup(struct uvc_device *dev);
8278c2ecf20Sopenharmony_ciint uvc_status_start(struct uvc_device *dev, gfp_t flags);
8288c2ecf20Sopenharmony_civoid uvc_status_stop(struct uvc_device *dev);
8298c2ecf20Sopenharmony_ci
8308c2ecf20Sopenharmony_ci/* Controls */
8318c2ecf20Sopenharmony_ciextern const struct v4l2_subscribed_event_ops uvc_ctrl_sub_ev_ops;
8328c2ecf20Sopenharmony_ci
8338c2ecf20Sopenharmony_ciint uvc_query_v4l2_ctrl(struct uvc_video_chain *chain,
8348c2ecf20Sopenharmony_ci			struct v4l2_queryctrl *v4l2_ctrl);
8358c2ecf20Sopenharmony_ciint uvc_query_v4l2_menu(struct uvc_video_chain *chain,
8368c2ecf20Sopenharmony_ci			struct v4l2_querymenu *query_menu);
8378c2ecf20Sopenharmony_ci
8388c2ecf20Sopenharmony_ciint uvc_ctrl_add_mapping(struct uvc_video_chain *chain,
8398c2ecf20Sopenharmony_ci			 const struct uvc_control_mapping *mapping);
8408c2ecf20Sopenharmony_ciint uvc_ctrl_init_device(struct uvc_device *dev);
8418c2ecf20Sopenharmony_civoid uvc_ctrl_cleanup_device(struct uvc_device *dev);
8428c2ecf20Sopenharmony_ciint uvc_ctrl_restore_values(struct uvc_device *dev);
8438c2ecf20Sopenharmony_cibool uvc_ctrl_status_event_async(struct urb *urb, struct uvc_video_chain *chain,
8448c2ecf20Sopenharmony_ci				 struct uvc_control *ctrl, const u8 *data);
8458c2ecf20Sopenharmony_civoid uvc_ctrl_status_event(struct uvc_video_chain *chain,
8468c2ecf20Sopenharmony_ci			   struct uvc_control *ctrl, const u8 *data);
8478c2ecf20Sopenharmony_ci
8488c2ecf20Sopenharmony_ciint uvc_ctrl_begin(struct uvc_video_chain *chain);
8498c2ecf20Sopenharmony_ciint __uvc_ctrl_commit(struct uvc_fh *handle, int rollback,
8508c2ecf20Sopenharmony_ci		      const struct v4l2_ext_control *xctrls,
8518c2ecf20Sopenharmony_ci		      unsigned int xctrls_count);
8528c2ecf20Sopenharmony_cistatic inline int uvc_ctrl_commit(struct uvc_fh *handle,
8538c2ecf20Sopenharmony_ci				  const struct v4l2_ext_control *xctrls,
8548c2ecf20Sopenharmony_ci				  unsigned int xctrls_count)
8558c2ecf20Sopenharmony_ci{
8568c2ecf20Sopenharmony_ci	return __uvc_ctrl_commit(handle, 0, xctrls, xctrls_count);
8578c2ecf20Sopenharmony_ci}
8588c2ecf20Sopenharmony_cistatic inline int uvc_ctrl_rollback(struct uvc_fh *handle)
8598c2ecf20Sopenharmony_ci{
8608c2ecf20Sopenharmony_ci	return __uvc_ctrl_commit(handle, 1, NULL, 0);
8618c2ecf20Sopenharmony_ci}
8628c2ecf20Sopenharmony_ci
8638c2ecf20Sopenharmony_ciint uvc_ctrl_get(struct uvc_video_chain *chain, struct v4l2_ext_control *xctrl);
8648c2ecf20Sopenharmony_ciint uvc_ctrl_set(struct uvc_fh *handle, struct v4l2_ext_control *xctrl);
8658c2ecf20Sopenharmony_ci
8668c2ecf20Sopenharmony_ciint uvc_xu_ctrl_query(struct uvc_video_chain *chain,
8678c2ecf20Sopenharmony_ci		      struct uvc_xu_control_query *xqry);
8688c2ecf20Sopenharmony_ci
8698c2ecf20Sopenharmony_ci/* Utility functions */
8708c2ecf20Sopenharmony_civoid uvc_simplify_fraction(u32 *numerator, u32 *denominator,
8718c2ecf20Sopenharmony_ci			   unsigned int n_terms, unsigned int threshold);
8728c2ecf20Sopenharmony_ciu32 uvc_fraction_to_interval(u32 numerator, u32 denominator);
8738c2ecf20Sopenharmony_cistruct usb_host_endpoint *uvc_find_endpoint(struct usb_host_interface *alts,
8748c2ecf20Sopenharmony_ci					    u8 epaddr);
8758c2ecf20Sopenharmony_ci
8768c2ecf20Sopenharmony_ci/* Quirks support */
8778c2ecf20Sopenharmony_civoid uvc_video_decode_isight(struct uvc_urb *uvc_urb,
8788c2ecf20Sopenharmony_ci			     struct uvc_buffer *buf,
8798c2ecf20Sopenharmony_ci			     struct uvc_buffer *meta_buf);
8808c2ecf20Sopenharmony_ci
8818c2ecf20Sopenharmony_ci/* debugfs and statistics */
8828c2ecf20Sopenharmony_civoid uvc_debugfs_init(void);
8838c2ecf20Sopenharmony_civoid uvc_debugfs_cleanup(void);
8848c2ecf20Sopenharmony_civoid uvc_debugfs_init_stream(struct uvc_streaming *stream);
8858c2ecf20Sopenharmony_civoid uvc_debugfs_cleanup_stream(struct uvc_streaming *stream);
8868c2ecf20Sopenharmony_ci
8878c2ecf20Sopenharmony_cisize_t uvc_video_stats_dump(struct uvc_streaming *stream, char *buf,
8888c2ecf20Sopenharmony_ci			    size_t size);
8898c2ecf20Sopenharmony_ci
8908c2ecf20Sopenharmony_ci#endif
891