1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _UAPI__LINUX_USB_AUDIO_H
20 #define _UAPI__LINUX_USB_AUDIO_H
21 #include <linux/types.h>
22 #define UAC_VERSION_1 0x00
23 #define UAC_VERSION_2 0x20
24 #define UAC_VERSION_3 0x30
25 #define USB_SUBCLASS_AUDIOCONTROL 0x01
26 #define USB_SUBCLASS_AUDIOSTREAMING 0x02
27 #define USB_SUBCLASS_MIDISTREAMING 0x03
28 #define UAC_HEADER 0x01
29 #define UAC_INPUT_TERMINAL 0x02
30 #define UAC_OUTPUT_TERMINAL 0x03
31 #define UAC_MIXER_UNIT 0x04
32 #define UAC_SELECTOR_UNIT 0x05
33 #define UAC_FEATURE_UNIT 0x06
34 #define UAC1_PROCESSING_UNIT 0x07
35 #define UAC1_EXTENSION_UNIT 0x08
36 #define UAC_AS_GENERAL 0x01
37 #define UAC_FORMAT_TYPE 0x02
38 #define UAC_FORMAT_SPECIFIC 0x03
39 #define UAC_PROCESS_UNDEFINED 0x00
40 #define UAC_PROCESS_UP_DOWNMIX 0x01
41 #define UAC_PROCESS_DOLBY_PROLOGIC 0x02
42 #define UAC_PROCESS_STEREO_EXTENDER 0x03
43 #define UAC_PROCESS_REVERB 0x04
44 #define UAC_PROCESS_CHORUS 0x05
45 #define UAC_PROCESS_DYN_RANGE_COMP 0x06
46 #define UAC_EP_GENERAL 0x01
47 #define UAC_SET_ 0x00
48 #define UAC_GET_ 0x80
49 #define UAC__CUR 0x1
50 #define UAC__MIN 0x2
51 #define UAC__MAX 0x3
52 #define UAC__RES 0x4
53 #define UAC__MEM 0x5
54 #define UAC_SET_CUR (UAC_SET_ | UAC__CUR)
55 #define UAC_GET_CUR (UAC_GET_ | UAC__CUR)
56 #define UAC_SET_MIN (UAC_SET_ | UAC__MIN)
57 #define UAC_GET_MIN (UAC_GET_ | UAC__MIN)
58 #define UAC_SET_MAX (UAC_SET_ | UAC__MAX)
59 #define UAC_GET_MAX (UAC_GET_ | UAC__MAX)
60 #define UAC_SET_RES (UAC_SET_ | UAC__RES)
61 #define UAC_GET_RES (UAC_GET_ | UAC__RES)
62 #define UAC_SET_MEM (UAC_SET_ | UAC__MEM)
63 #define UAC_GET_MEM (UAC_GET_ | UAC__MEM)
64 #define UAC_GET_STAT 0xff
65 #define UAC_TERM_COPY_PROTECT 0x01
66 #define UAC_FU_MUTE 0x01
67 #define UAC_FU_VOLUME 0x02
68 #define UAC_FU_BASS 0x03
69 #define UAC_FU_MID 0x04
70 #define UAC_FU_TREBLE 0x05
71 #define UAC_FU_GRAPHIC_EQUALIZER 0x06
72 #define UAC_FU_AUTOMATIC_GAIN 0x07
73 #define UAC_FU_DELAY 0x08
74 #define UAC_FU_BASS_BOOST 0x09
75 #define UAC_FU_LOUDNESS 0x0a
76 #define UAC_CONTROL_BIT(CS) (1 << ((CS) - 1))
77 #define UAC_UD_ENABLE 0x01
78 #define UAC_UD_MODE_SELECT 0x02
79 #define UAC_DP_ENABLE 0x01
80 #define UAC_DP_MODE_SELECT 0x02
81 #define UAC_3D_ENABLE 0x01
82 #define UAC_3D_SPACE 0x02
83 #define UAC_REVERB_ENABLE 0x01
84 #define UAC_REVERB_LEVEL 0x02
85 #define UAC_REVERB_TIME 0x03
86 #define UAC_REVERB_FEEDBACK 0x04
87 #define UAC_CHORUS_ENABLE 0x01
88 #define UAC_CHORUS_LEVEL 0x02
89 #define UAC_CHORUS_RATE 0x03
90 #define UAC_CHORUS_DEPTH 0x04
91 #define UAC_DCR_ENABLE 0x01
92 #define UAC_DCR_RATE 0x02
93 #define UAC_DCR_MAXAMPL 0x03
94 #define UAC_DCR_THRESHOLD 0x04
95 #define UAC_DCR_ATTACK_TIME 0x05
96 #define UAC_DCR_RELEASE_TIME 0x06
97 #define UAC_XU_ENABLE 0x01
98 #define UAC_MS_HEADER 0x01
99 #define UAC_MIDI_IN_JACK 0x02
100 #define UAC_MIDI_OUT_JACK 0x03
101 #define UAC_MS_GENERAL 0x01
102 #define UAC_TERMINAL_UNDEFINED 0x100
103 #define UAC_TERMINAL_STREAMING 0x101
104 #define UAC_TERMINAL_VENDOR_SPEC 0x1FF
105 struct uac1_ac_header_descriptor {
106   __u8 bLength;
107   __u8 bDescriptorType;
108   __u8 bDescriptorSubtype;
109   __le16 bcdADC;
110   __le16 wTotalLength;
111   __u8 bInCollection;
112   __u8 baInterfaceNr[];
113 } __attribute__((packed));
114 #define UAC_DT_AC_HEADER_SIZE(n) (8 + (n))
115 #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) struct uac1_ac_header_descriptor_ ##n { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __le16 bcdADC; __le16 wTotalLength; __u8 bInCollection; __u8 baInterfaceNr[n]; \
116 } __attribute__((packed))
117 struct uac_input_terminal_descriptor {
118   __u8 bLength;
119   __u8 bDescriptorType;
120   __u8 bDescriptorSubtype;
121   __u8 bTerminalID;
122   __le16 wTerminalType;
123   __u8 bAssocTerminal;
124   __u8 bNrChannels;
125   __le16 wChannelConfig;
126   __u8 iChannelNames;
127   __u8 iTerminal;
128 } __attribute__((packed));
129 #define UAC_DT_INPUT_TERMINAL_SIZE 12
130 #define UAC_INPUT_TERMINAL_UNDEFINED 0x200
131 #define UAC_INPUT_TERMINAL_MICROPHONE 0x201
132 #define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202
133 #define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203
134 #define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204
135 #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205
136 #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206
137 #define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01
138 struct uac1_output_terminal_descriptor {
139   __u8 bLength;
140   __u8 bDescriptorType;
141   __u8 bDescriptorSubtype;
142   __u8 bTerminalID;
143   __le16 wTerminalType;
144   __u8 bAssocTerminal;
145   __u8 bSourceID;
146   __u8 iTerminal;
147 } __attribute__((packed));
148 #define UAC_DT_OUTPUT_TERMINAL_SIZE 9
149 #define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300
150 #define UAC_OUTPUT_TERMINAL_SPEAKER 0x301
151 #define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302
152 #define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303
153 #define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304
154 #define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305
155 #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306
156 #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307
157 #define UAC_BIDIR_TERMINAL_UNDEFINED 0x400
158 #define UAC_BIDIR_TERMINAL_HANDSET 0x401
159 #define UAC_BIDIR_TERMINAL_HEADSET 0x402
160 #define UAC_BIDIR_TERMINAL_SPEAKER_PHONE 0x403
161 #define UAC_BIDIR_TERMINAL_ECHO_SUPPRESSING 0x404
162 #define UAC_BIDIR_TERMINAL_ECHO_CANCELING 0x405
163 #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2)
164 #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) struct uac_feature_unit_descriptor_ ##ch { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bUnitID; __u8 bSourceID; __u8 bControlSize; __le16 bmaControls[ch + 1]; __u8 iFeature; \
165 } __attribute__((packed))
166 struct uac_mixer_unit_descriptor {
167   __u8 bLength;
168   __u8 bDescriptorType;
169   __u8 bDescriptorSubtype;
170   __u8 bUnitID;
171   __u8 bNrInPins;
172   __u8 baSourceID[];
173 } __attribute__((packed));
174 struct uac_selector_unit_descriptor {
175   __u8 bLength;
176   __u8 bDescriptorType;
177   __u8 bDescriptorSubtype;
178   __u8 bUintID;
179   __u8 bNrInPins;
180   __u8 baSourceID[];
181 } __attribute__((packed));
182 struct uac_feature_unit_descriptor {
183   __u8 bLength;
184   __u8 bDescriptorType;
185   __u8 bDescriptorSubtype;
186   __u8 bUnitID;
187   __u8 bSourceID;
188   __u8 bControlSize;
189   __u8 bmaControls[0];
190 } __attribute__((packed));
191 struct uac_processing_unit_descriptor {
192   __u8 bLength;
193   __u8 bDescriptorType;
194   __u8 bDescriptorSubtype;
195   __u8 bUnitID;
196   __le16 wProcessType;
197   __u8 bNrInPins;
198   __u8 baSourceID[];
199 } __attribute__((packed));
200 struct uac1_as_header_descriptor {
201   __u8 bLength;
202   __u8 bDescriptorType;
203   __u8 bDescriptorSubtype;
204   __u8 bTerminalLink;
205   __u8 bDelay;
206   __le16 wFormatTag;
207 } __attribute__((packed));
208 #define UAC_DT_AS_HEADER_SIZE 7
209 #define UAC_FORMAT_TYPE_I_UNDEFINED 0x0
210 #define UAC_FORMAT_TYPE_I_PCM 0x1
211 #define UAC_FORMAT_TYPE_I_PCM8 0x2
212 #define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3
213 #define UAC_FORMAT_TYPE_I_ALAW 0x4
214 #define UAC_FORMAT_TYPE_I_MULAW 0x5
215 struct uac_format_type_i_continuous_descriptor {
216   __u8 bLength;
217   __u8 bDescriptorType;
218   __u8 bDescriptorSubtype;
219   __u8 bFormatType;
220   __u8 bNrChannels;
221   __u8 bSubframeSize;
222   __u8 bBitResolution;
223   __u8 bSamFreqType;
224   __u8 tLowerSamFreq[3];
225   __u8 tUpperSamFreq[3];
226 } __attribute__((packed));
227 #define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14
228 struct uac_format_type_i_discrete_descriptor {
229   __u8 bLength;
230   __u8 bDescriptorType;
231   __u8 bDescriptorSubtype;
232   __u8 bFormatType;
233   __u8 bNrChannels;
234   __u8 bSubframeSize;
235   __u8 bBitResolution;
236   __u8 bSamFreqType;
237   __u8 tSamFreq[][3];
238 } __attribute__((packed));
239 #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) struct uac_format_type_i_discrete_descriptor_ ##n { __u8 bLength; __u8 bDescriptorType; __u8 bDescriptorSubtype; __u8 bFormatType; __u8 bNrChannels; __u8 bSubframeSize; __u8 bBitResolution; __u8 bSamFreqType; __u8 tSamFreq[n][3]; \
240 } __attribute__((packed))
241 #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3))
242 struct uac_format_type_i_ext_descriptor {
243   __u8 bLength;
244   __u8 bDescriptorType;
245   __u8 bDescriptorSubtype;
246   __u8 bFormatType;
247   __u8 bSubslotSize;
248   __u8 bBitResolution;
249   __u8 bHeaderLength;
250   __u8 bControlSize;
251   __u8 bSideBandProtocol;
252 } __attribute__((packed));
253 #define UAC_FORMAT_TYPE_II_MPEG 0x1001
254 #define UAC_FORMAT_TYPE_II_AC3 0x1002
255 struct uac_format_type_ii_discrete_descriptor {
256   __u8 bLength;
257   __u8 bDescriptorType;
258   __u8 bDescriptorSubtype;
259   __u8 bFormatType;
260   __le16 wMaxBitRate;
261   __le16 wSamplesPerFrame;
262   __u8 bSamFreqType;
263   __u8 tSamFreq[][3];
264 } __attribute__((packed));
265 struct uac_format_type_ii_ext_descriptor {
266   __u8 bLength;
267   __u8 bDescriptorType;
268   __u8 bDescriptorSubtype;
269   __u8 bFormatType;
270   __le16 wMaxBitRate;
271   __le16 wSamplesPerFrame;
272   __u8 bHeaderLength;
273   __u8 bSideBandProtocol;
274 } __attribute__((packed));
275 #define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001
276 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002
277 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003
278 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004
279 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005
280 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006
281 #define UAC_FORMAT_TYPE_UNDEFINED 0x0
282 #define UAC_FORMAT_TYPE_I 0x1
283 #define UAC_FORMAT_TYPE_II 0x2
284 #define UAC_FORMAT_TYPE_III 0x3
285 #define UAC_EXT_FORMAT_TYPE_I 0x81
286 #define UAC_EXT_FORMAT_TYPE_II 0x82
287 #define UAC_EXT_FORMAT_TYPE_III 0x83
288 struct uac_iso_endpoint_descriptor {
289   __u8 bLength;
290   __u8 bDescriptorType;
291   __u8 bDescriptorSubtype;
292   __u8 bmAttributes;
293   __u8 bLockDelayUnits;
294   __le16 wLockDelay;
295 } __attribute__((packed));
296 #define UAC_ISO_ENDPOINT_DESC_SIZE 7
297 #define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
298 #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
299 #define UAC_EP_CS_ATTR_FILL_MAX 0x80
300 #define UAC1_STATUS_TYPE_ORIG_MASK 0x0f
301 #define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0
302 #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1
303 #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2
304 #define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7)
305 #define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6)
306 struct uac1_status_word {
307   __u8 bStatusType;
308   __u8 bOriginator;
309 } __attribute__((packed));
310 #endif
311