1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3  *  v4l2 uvc internal API header
4  *
5  *  Some commonly needed functions for uvc drivers
6  */
7 
8 #ifndef __LINUX_V4L2_UVC_H
9 #define __LINUX_V4L2_UVC_H
10 
11 /* ------------------------------------------------------------------------
12  * GUIDs
13  */
14 #define UVC_GUID_UVC_CAMERA \
15 	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
16 	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01}
17 #define UVC_GUID_UVC_OUTPUT \
18 	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
19 	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02}
20 #define UVC_GUID_UVC_MEDIA_TRANSPORT_INPUT \
21 	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
22 	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03}
23 #define UVC_GUID_UVC_PROCESSING \
24 	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
25 	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01}
26 #define UVC_GUID_UVC_SELECTOR \
27 	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
28 	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02}
29 #define UVC_GUID_EXT_GPIO_CONTROLLER \
30 	{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
31 	 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03}
32 
33 #define UVC_GUID_FORMAT_MJPEG \
34 	{ 'M',  'J',  'P',  'G', 0x00, 0x00, 0x10, 0x00, \
35 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
36 #define UVC_GUID_FORMAT_YUY2 \
37 	{ 'Y',  'U',  'Y',  '2', 0x00, 0x00, 0x10, 0x00, \
38 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
39 #define UVC_GUID_FORMAT_YUY2_ISIGHT \
40 	{ 'Y',  'U',  'Y',  '2', 0x00, 0x00, 0x10, 0x00, \
41 	 0x80, 0x00, 0x00, 0x00, 0x00, 0x38, 0x9b, 0x71}
42 #define UVC_GUID_FORMAT_NV12 \
43 	{ 'N',  'V',  '1',  '2', 0x00, 0x00, 0x10, 0x00, \
44 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
45 #define UVC_GUID_FORMAT_YV12 \
46 	{ 'Y',  'V',  '1',  '2', 0x00, 0x00, 0x10, 0x00, \
47 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
48 #define UVC_GUID_FORMAT_I420 \
49 	{ 'I',  '4',  '2',  '0', 0x00, 0x00, 0x10, 0x00, \
50 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
51 #define UVC_GUID_FORMAT_UYVY \
52 	{ 'U',  'Y',  'V',  'Y', 0x00, 0x00, 0x10, 0x00, \
53 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
54 #define UVC_GUID_FORMAT_Y800 \
55 	{ 'Y',  '8',  '0',  '0', 0x00, 0x00, 0x10, 0x00, \
56 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
57 #define UVC_GUID_FORMAT_Y8 \
58 	{ 'Y',  '8',  ' ',  ' ', 0x00, 0x00, 0x10, 0x00, \
59 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
60 #define UVC_GUID_FORMAT_Y10 \
61 	{ 'Y',  '1',  '0',  ' ', 0x00, 0x00, 0x10, 0x00, \
62 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
63 #define UVC_GUID_FORMAT_Y12 \
64 	{ 'Y',  '1',  '2',  ' ', 0x00, 0x00, 0x10, 0x00, \
65 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
66 #define UVC_GUID_FORMAT_Y16 \
67 	{ 'Y',  '1',  '6',  ' ', 0x00, 0x00, 0x10, 0x00, \
68 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
69 #define UVC_GUID_FORMAT_BY8 \
70 	{ 'B',  'Y',  '8',  ' ', 0x00, 0x00, 0x10, 0x00, \
71 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
72 #define UVC_GUID_FORMAT_BA81 \
73 	{ 'B',  'A',  '8',  '1', 0x00, 0x00, 0x10, 0x00, \
74 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
75 #define UVC_GUID_FORMAT_GBRG \
76 	{ 'G',  'B',  'R',  'G', 0x00, 0x00, 0x10, 0x00, \
77 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
78 #define UVC_GUID_FORMAT_GRBG \
79 	{ 'G',  'R',  'B',  'G', 0x00, 0x00, 0x10, 0x00, \
80 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
81 #define UVC_GUID_FORMAT_RGGB \
82 	{ 'R',  'G',  'G',  'B', 0x00, 0x00, 0x10, 0x00, \
83 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
84 #define UVC_GUID_FORMAT_BG16 \
85 	{ 'B',  'G',  '1',  '6', 0x00, 0x00, 0x10, 0x00, \
86 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
87 #define UVC_GUID_FORMAT_GB16 \
88 	{ 'G',  'B',  '1',  '6', 0x00, 0x00, 0x10, 0x00, \
89 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
90 #define UVC_GUID_FORMAT_RG16 \
91 	{ 'R',  'G',  '1',  '6', 0x00, 0x00, 0x10, 0x00, \
92 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
93 #define UVC_GUID_FORMAT_GR16 \
94 	{ 'G',  'R',  '1',  '6', 0x00, 0x00, 0x10, 0x00, \
95 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
96 #define UVC_GUID_FORMAT_RGBP \
97 	{ 'R',  'G',  'B',  'P', 0x00, 0x00, 0x10, 0x00, \
98 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
99 #define UVC_GUID_FORMAT_BGR3 \
100 	{ 0x7d, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \
101 	 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}
102 #define UVC_GUID_FORMAT_BGR4 \
103 	{ 0x7e, 0xeb, 0x36, 0xe4, 0x4f, 0x52, 0xce, 0x11, \
104 	 0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}
105 #define UVC_GUID_FORMAT_M420 \
106 	{ 'M',  '4',  '2',  '0', 0x00, 0x00, 0x10, 0x00, \
107 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
108 
109 #define UVC_GUID_FORMAT_H264 \
110 	{ 'H',  '2',  '6',  '4', 0x00, 0x00, 0x10, 0x00, \
111 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
112 #define UVC_GUID_FORMAT_H265 \
113 	{ 'H',  '2',  '6',  '5', 0x00, 0x00, 0x10, 0x00, \
114 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
115 #define UVC_GUID_FORMAT_Y8I \
116 	{ 'Y',  '8',  'I',  ' ', 0x00, 0x00, 0x10, 0x00, \
117 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
118 #define UVC_GUID_FORMAT_Y12I \
119 	{ 'Y',  '1',  '2',  'I', 0x00, 0x00, 0x10, 0x00, \
120 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
121 #define UVC_GUID_FORMAT_Z16 \
122 	{ 'Z',  '1',  '6',  ' ', 0x00, 0x00, 0x10, 0x00, \
123 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
124 #define UVC_GUID_FORMAT_RW10 \
125 	{ 'R',  'W',  '1',  '0', 0x00, 0x00, 0x10, 0x00, \
126 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
127 #define UVC_GUID_FORMAT_INVZ \
128 	{ 'I',  'N',  'V',  'Z', 0x90, 0x2d, 0x58, 0x4a, \
129 	 0x92, 0x0b, 0x77, 0x3f, 0x1f, 0x2c, 0x55, 0x6b}
130 #define UVC_GUID_FORMAT_INZI \
131 	{ 'I',  'N',  'Z',  'I', 0x66, 0x1a, 0x42, 0xa2, \
132 	 0x90, 0x65, 0xd0, 0x18, 0x14, 0xa8, 0xef, 0x8a}
133 #define UVC_GUID_FORMAT_INVI \
134 	{ 'I',  'N',  'V',  'I', 0xdb, 0x57, 0x49, 0x5e, \
135 	 0x8e, 0x3f, 0xf4, 0x79, 0x53, 0x2b, 0x94, 0x6f}
136 #define UVC_GUID_FORMAT_CNF4 \
137 	{ 'C',  ' ',  ' ',  ' ', 0x00, 0x00, 0x10, 0x00, \
138 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
139 
140 #define UVC_GUID_FORMAT_D3DFMT_L8 \
141 	{0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, \
142 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
143 #define UVC_GUID_FORMAT_KSMEDIA_L8_IR \
144 	{0x32, 0x00, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, \
145 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
146 
147 #define UVC_GUID_FORMAT_HEVC \
148 	{ 'H',  'E',  'V',  'C', 0x00, 0x00, 0x10, 0x00, \
149 	 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
150 
151 struct uvc_format_desc {
152 	u8 guid[16];
153 	u32 fcc;
154 };
155 
156 const struct uvc_format_desc *uvc_format_by_guid(const u8 guid[16]);
157 
158 #endif /* __LINUX_V4L2_UVC_H */
159