Commit | Line | Data |
---|---|---|
f2ebf92c BW |
1 | /* |
2 | * <linux/usb/audio.h> -- USB Audio definitions. | |
3 | * | |
4 | * Copyright (C) 2006 Thumtronics Pty Ltd. | |
5 | * Developed for Thumtronics by Grey Innovation | |
6 | * Ben Williamson <ben.williamson@greyinnovation.com> | |
7 | * | |
8 | * This software is distributed under the terms of the GNU General Public | |
9 | * License ("GPL") version 2, as published by the Free Software Foundation. | |
10 | * | |
11 | * This file holds USB constants and structures defined | |
12 | * by the USB Device Class Definition for Audio Devices. | |
13 | * Comments below reference relevant sections of that document: | |
14 | * | |
15 | * http://www.usb.org/developers/devclass_docs/audio10.pdf | |
7e847894 DM |
16 | * |
17 | * Types and defines in this file are either specific to version 1.0 of | |
18 | * this standard or common for newer versions. | |
f2ebf92c BW |
19 | */ |
20 | ||
21 | #ifndef __LINUX_USB_AUDIO_H | |
22 | #define __LINUX_USB_AUDIO_H | |
23 | ||
24 | #include <linux/types.h> | |
25 | ||
7e847894 DM |
26 | /* bInterfaceProtocol values to denote the version of the standard used */ |
27 | #define UAC_VERSION_1 0x00 | |
28 | #define UAC_VERSION_2 0x20 | |
29 | ||
f2ebf92c BW |
30 | /* A.2 Audio Interface Subclass Codes */ |
31 | #define USB_SUBCLASS_AUDIOCONTROL 0x01 | |
32 | #define USB_SUBCLASS_AUDIOSTREAMING 0x02 | |
33 | #define USB_SUBCLASS_MIDISTREAMING 0x03 | |
34 | ||
512ad27d LP |
35 | /* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ |
36 | #define UAC_HEADER 0x01 | |
37 | #define UAC_INPUT_TERMINAL 0x02 | |
38 | #define UAC_OUTPUT_TERMINAL 0x03 | |
39 | #define UAC_MIXER_UNIT 0x04 | |
40 | #define UAC_SELECTOR_UNIT 0x05 | |
41 | #define UAC_FEATURE_UNIT 0x06 | |
de48c7bc DM |
42 | #define UAC_PROCESSING_UNIT_V1 0x07 |
43 | #define UAC_EXTENSION_UNIT_V1 0x08 | |
44 | ||
512ad27d LP |
45 | /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ |
46 | #define UAC_AS_GENERAL 0x01 | |
47 | #define UAC_FORMAT_TYPE 0x02 | |
48 | #define UAC_FORMAT_SPECIFIC 0x03 | |
49 | ||
50 | /* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */ | |
51 | #define UAC_EP_GENERAL 0x01 | |
52 | ||
53 | /* A.9 Audio Class-Specific Request Codes */ | |
54 | #define UAC_SET_ 0x00 | |
55 | #define UAC_GET_ 0x80 | |
56 | ||
57 | #define UAC__CUR 0x1 | |
58 | #define UAC__MIN 0x2 | |
59 | #define UAC__MAX 0x3 | |
60 | #define UAC__RES 0x4 | |
61 | #define UAC__MEM 0x5 | |
62 | ||
63 | #define UAC_SET_CUR (UAC_SET_ | UAC__CUR) | |
64 | #define UAC_GET_CUR (UAC_GET_ | UAC__CUR) | |
65 | #define UAC_SET_MIN (UAC_SET_ | UAC__MIN) | |
66 | #define UAC_GET_MIN (UAC_GET_ | UAC__MIN) | |
67 | #define UAC_SET_MAX (UAC_SET_ | UAC__MAX) | |
68 | #define UAC_GET_MAX (UAC_GET_ | UAC__MAX) | |
69 | #define UAC_SET_RES (UAC_SET_ | UAC__RES) | |
70 | #define UAC_GET_RES (UAC_GET_ | UAC__RES) | |
71 | #define UAC_SET_MEM (UAC_SET_ | UAC__MEM) | |
72 | #define UAC_GET_MEM (UAC_GET_ | UAC__MEM) | |
73 | ||
74 | #define UAC_GET_STAT 0xff | |
75 | ||
76 | /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ | |
77 | #define UAC_MS_HEADER 0x01 | |
78 | #define UAC_MIDI_IN_JACK 0x02 | |
79 | #define UAC_MIDI_OUT_JACK 0x03 | |
80 | ||
81 | /* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */ | |
82 | #define UAC_MS_GENERAL 0x01 | |
83 | ||
84 | /* Terminals - 2.1 USB Terminal Types */ | |
85 | #define UAC_TERMINAL_UNDEFINED 0x100 | |
86 | #define UAC_TERMINAL_STREAMING 0x101 | |
87 | #define UAC_TERMINAL_VENDOR_SPEC 0x1FF | |
c47d7b09 BW |
88 | |
89 | /* Terminal Control Selectors */ | |
f2ebf92c | 90 | /* 4.3.2 Class-Specific AC Interface Descriptor */ |
28e1b773 | 91 | struct uac_ac_header_descriptor_v1 { |
c47d7b09 | 92 | __u8 bLength; /* 8 + n */ |
41dceed5 | 93 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ |
512ad27d | 94 | __u8 bDescriptorSubtype; /* UAC_MS_HEADER */ |
41dceed5 GKH |
95 | __le16 bcdADC; /* 0x0100 */ |
96 | __le16 wTotalLength; /* includes Unit and Terminal desc. */ | |
97 | __u8 bInCollection; /* n */ | |
98 | __u8 baInterfaceNr[]; /* [n] */ | |
f2ebf92c BW |
99 | } __attribute__ ((packed)); |
100 | ||
512ad27d | 101 | #define UAC_DT_AC_HEADER_SIZE(n) (8 + (n)) |
f2ebf92c BW |
102 | |
103 | /* As above, but more useful for defining your own descriptors: */ | |
512ad27d | 104 | #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n) \ |
28e1b773 | 105 | struct uac_ac_header_descriptor_v1_##n { \ |
f2ebf92c BW |
106 | __u8 bLength; \ |
107 | __u8 bDescriptorType; \ | |
108 | __u8 bDescriptorSubtype; \ | |
109 | __le16 bcdADC; \ | |
110 | __le16 wTotalLength; \ | |
111 | __u8 bInCollection; \ | |
112 | __u8 baInterfaceNr[n]; \ | |
113 | } __attribute__ ((packed)) | |
114 | ||
c47d7b09 | 115 | /* 4.3.2.1 Input Terminal Descriptor */ |
512ad27d | 116 | struct uac_input_terminal_descriptor { |
c47d7b09 BW |
117 | __u8 bLength; /* in bytes: 12 */ |
118 | __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ | |
119 | __u8 bDescriptorSubtype; /* INPUT_TERMINAL descriptor subtype */ | |
120 | __u8 bTerminalID; /* Constant uniquely terminal ID */ | |
121 | __le16 wTerminalType; /* USB Audio Terminal Types */ | |
122 | __u8 bAssocTerminal; /* ID of the Output Terminal associated */ | |
123 | __u8 bNrChannels; /* Number of logical output channels */ | |
124 | __le16 wChannelConfig; | |
125 | __u8 iChannelNames; | |
126 | __u8 iTerminal; | |
127 | } __attribute__ ((packed)); | |
128 | ||
512ad27d | 129 | #define UAC_DT_INPUT_TERMINAL_SIZE 12 |
c47d7b09 | 130 | |
512ad27d LP |
131 | /* Terminals - 2.2 Input Terminal Types */ |
132 | #define UAC_INPUT_TERMINAL_UNDEFINED 0x200 | |
133 | #define UAC_INPUT_TERMINAL_MICROPHONE 0x201 | |
134 | #define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE 0x202 | |
135 | #define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE 0x203 | |
136 | #define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE 0x204 | |
137 | #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205 | |
138 | #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 | |
c47d7b09 | 139 | |
de48c7bc DM |
140 | /* Terminals - control selectors */ |
141 | ||
142 | #define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01 | |
143 | ||
c47d7b09 | 144 | /* 4.3.2.2 Output Terminal Descriptor */ |
28e1b773 | 145 | struct uac_output_terminal_descriptor_v1 { |
c47d7b09 BW |
146 | __u8 bLength; /* in bytes: 9 */ |
147 | __u8 bDescriptorType; /* CS_INTERFACE descriptor type */ | |
148 | __u8 bDescriptorSubtype; /* OUTPUT_TERMINAL descriptor subtype */ | |
149 | __u8 bTerminalID; /* Constant uniquely terminal ID */ | |
150 | __le16 wTerminalType; /* USB Audio Terminal Types */ | |
151 | __u8 bAssocTerminal; /* ID of the Input Terminal associated */ | |
152 | __u8 bSourceID; /* ID of the connected Unit or Terminal*/ | |
153 | __u8 iTerminal; | |
154 | } __attribute__ ((packed)); | |
155 | ||
512ad27d | 156 | #define UAC_DT_OUTPUT_TERMINAL_SIZE 9 |
c47d7b09 | 157 | |
512ad27d LP |
158 | /* Terminals - 2.3 Output Terminal Types */ |
159 | #define UAC_OUTPUT_TERMINAL_UNDEFINED 0x300 | |
160 | #define UAC_OUTPUT_TERMINAL_SPEAKER 0x301 | |
161 | #define UAC_OUTPUT_TERMINAL_HEADPHONES 0x302 | |
162 | #define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO 0x303 | |
163 | #define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER 0x304 | |
164 | #define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER 0x305 | |
165 | #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER 0x306 | |
166 | #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER 0x307 | |
c47d7b09 BW |
167 | |
168 | /* Set bControlSize = 2 as default setting */ | |
512ad27d | 169 | #define UAC_DT_FEATURE_UNIT_SIZE(ch) (7 + ((ch) + 1) * 2) |
c47d7b09 BW |
170 | |
171 | /* As above, but more useful for defining your own descriptors: */ | |
512ad27d LP |
172 | #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch) \ |
173 | struct uac_feature_unit_descriptor_##ch { \ | |
c47d7b09 BW |
174 | __u8 bLength; \ |
175 | __u8 bDescriptorType; \ | |
176 | __u8 bDescriptorSubtype; \ | |
177 | __u8 bUnitID; \ | |
178 | __u8 bSourceID; \ | |
179 | __u8 bControlSize; \ | |
180 | __le16 bmaControls[ch + 1]; \ | |
181 | __u8 iFeature; \ | |
182 | } __attribute__ ((packed)) | |
183 | ||
99fc8645 DM |
184 | /* 4.3.2.3 Mixer Unit Descriptor */ |
185 | struct uac_mixer_unit_descriptor { | |
186 | __u8 bLength; | |
187 | __u8 bDescriptorType; | |
188 | __u8 bDescriptorSubtype; | |
189 | __u8 bUnitID; | |
190 | __u8 bNrInPins; | |
191 | __u8 baSourceID[]; | |
192 | } __attribute__ ((packed)); | |
193 | ||
194 | static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc) | |
195 | { | |
196 | return desc->baSourceID[desc->bNrInPins]; | |
197 | } | |
198 | ||
199 | static inline __u16 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc) | |
200 | { | |
201 | return (desc->baSourceID[desc->bNrInPins + 2] << 8) | | |
202 | desc->baSourceID[desc->bNrInPins + 1]; | |
203 | } | |
204 | ||
205 | static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc) | |
206 | { | |
207 | return desc->baSourceID[desc->bNrInPins + 3]; | |
208 | } | |
209 | ||
210 | static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc) | |
211 | { | |
212 | return &desc->baSourceID[desc->bNrInPins + 4]; | |
213 | } | |
214 | ||
215 | static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc) | |
216 | { | |
217 | __u8 *raw = (__u8 *) desc; | |
218 | return raw[desc->bLength - 1]; | |
219 | } | |
220 | ||
221 | /* 4.3.2.4 Selector Unit Descriptor */ | |
222 | struct uac_selector_unit_descriptor { | |
223 | __u8 bLength; | |
224 | __u8 bDescriptorType; | |
225 | __u8 bDescriptorSubtype; | |
226 | __u8 bUintID; | |
227 | __u8 bNrInPins; | |
228 | __u8 baSourceID[]; | |
229 | } __attribute__ ((packed)); | |
230 | ||
231 | static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc) | |
232 | { | |
233 | __u8 *raw = (__u8 *) desc; | |
234 | return raw[desc->bLength - 1]; | |
235 | } | |
236 | ||
237 | /* 4.3.2.5 Feature Unit Descriptor */ | |
238 | struct uac_feature_unit_descriptor { | |
239 | __u8 bLength; | |
240 | __u8 bDescriptorType; | |
241 | __u8 bDescriptorSubtype; | |
242 | __u8 bUnitID; | |
243 | __u8 bSourceID; | |
244 | __u8 bControlSize; | |
245 | __u8 bmaControls[0]; /* variable length */ | |
246 | } __attribute__((packed)); | |
247 | ||
248 | static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc) | |
249 | { | |
250 | __u8 *raw = (__u8 *) desc; | |
251 | return raw[desc->bLength - 1]; | |
252 | } | |
253 | ||
254 | /* 4.3.2.6 Processing Unit Descriptors */ | |
255 | struct uac_processing_unit_descriptor { | |
256 | __u8 bLength; | |
257 | __u8 bDescriptorType; | |
258 | __u8 bDescriptorSubtype; | |
259 | __u8 bUnitID; | |
260 | __u16 wProcessType; | |
261 | __u8 bNrInPins; | |
262 | __u8 baSourceID[]; | |
263 | } __attribute__ ((packed)); | |
264 | ||
265 | static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc) | |
266 | { | |
267 | return desc->baSourceID[desc->bNrInPins]; | |
268 | } | |
269 | ||
270 | static inline __u16 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc) | |
271 | { | |
272 | return (desc->baSourceID[desc->bNrInPins + 2] << 8) | | |
273 | desc->baSourceID[desc->bNrInPins + 1]; | |
274 | } | |
275 | ||
276 | static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc) | |
277 | { | |
278 | return desc->baSourceID[desc->bNrInPins + 3]; | |
279 | } | |
280 | ||
281 | static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc) | |
282 | { | |
283 | return desc->baSourceID[desc->bNrInPins + 4]; | |
284 | } | |
285 | ||
286 | static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc) | |
287 | { | |
288 | return &desc->baSourceID[desc->bNrInPins + 5]; | |
289 | } | |
290 | ||
291 | static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc) | |
292 | { | |
293 | __u8 control_size = uac_processing_unit_bControlSize(desc); | |
294 | return desc->baSourceID[desc->bNrInPins + control_size]; | |
295 | } | |
296 | ||
297 | static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc) | |
298 | { | |
299 | __u8 control_size = uac_processing_unit_bControlSize(desc); | |
300 | return &desc->baSourceID[desc->bNrInPins + control_size + 1]; | |
301 | } | |
302 | ||
c47d7b09 | 303 | /* 4.5.2 Class-Specific AS Interface Descriptor */ |
28e1b773 | 304 | struct uac_as_header_descriptor_v1 { |
c47d7b09 BW |
305 | __u8 bLength; /* in bytes: 7 */ |
306 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | |
307 | __u8 bDescriptorSubtype; /* AS_GENERAL */ | |
308 | __u8 bTerminalLink; /* Terminal ID of connected Terminal */ | |
309 | __u8 bDelay; /* Delay introduced by the data path */ | |
310 | __le16 wFormatTag; /* The Audio Data Format */ | |
311 | } __attribute__ ((packed)); | |
312 | ||
512ad27d | 313 | #define UAC_DT_AS_HEADER_SIZE 7 |
c47d7b09 | 314 | |
512ad27d LP |
315 | /* Formats - A.1.1 Audio Data Format Type I Codes */ |
316 | #define UAC_FORMAT_TYPE_I_UNDEFINED 0x0 | |
317 | #define UAC_FORMAT_TYPE_I_PCM 0x1 | |
318 | #define UAC_FORMAT_TYPE_I_PCM8 0x2 | |
319 | #define UAC_FORMAT_TYPE_I_IEEE_FLOAT 0x3 | |
320 | #define UAC_FORMAT_TYPE_I_ALAW 0x4 | |
321 | #define UAC_FORMAT_TYPE_I_MULAW 0x5 | |
c47d7b09 | 322 | |
512ad27d | 323 | struct uac_format_type_i_continuous_descriptor { |
c47d7b09 BW |
324 | __u8 bLength; /* in bytes: 8 + (ns * 3) */ |
325 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | |
326 | __u8 bDescriptorSubtype; /* FORMAT_TYPE */ | |
327 | __u8 bFormatType; /* FORMAT_TYPE_1 */ | |
328 | __u8 bNrChannels; /* physical channels in the stream */ | |
329 | __u8 bSubframeSize; /* */ | |
330 | __u8 bBitResolution; | |
331 | __u8 bSamFreqType; | |
332 | __u8 tLowerSamFreq[3]; | |
333 | __u8 tUpperSamFreq[3]; | |
334 | } __attribute__ ((packed)); | |
335 | ||
512ad27d | 336 | #define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE 14 |
c47d7b09 | 337 | |
512ad27d | 338 | struct uac_format_type_i_discrete_descriptor { |
c47d7b09 BW |
339 | __u8 bLength; /* in bytes: 8 + (ns * 3) */ |
340 | __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ | |
341 | __u8 bDescriptorSubtype; /* FORMAT_TYPE */ | |
342 | __u8 bFormatType; /* FORMAT_TYPE_1 */ | |
343 | __u8 bNrChannels; /* physical channels in the stream */ | |
344 | __u8 bSubframeSize; /* */ | |
345 | __u8 bBitResolution; | |
346 | __u8 bSamFreqType; | |
347 | __u8 tSamFreq[][3]; | |
348 | } __attribute__ ((packed)); | |
349 | ||
512ad27d LP |
350 | #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n) \ |
351 | struct uac_format_type_i_discrete_descriptor_##n { \ | |
c47d7b09 BW |
352 | __u8 bLength; \ |
353 | __u8 bDescriptorType; \ | |
354 | __u8 bDescriptorSubtype; \ | |
355 | __u8 bFormatType; \ | |
356 | __u8 bNrChannels; \ | |
357 | __u8 bSubframeSize; \ | |
358 | __u8 bBitResolution; \ | |
359 | __u8 bSamFreqType; \ | |
360 | __u8 tSamFreq[n][3]; \ | |
361 | } __attribute__ ((packed)) | |
362 | ||
512ad27d | 363 | #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n) (8 + (n * 3)) |
c47d7b09 | 364 | |
8fee4aff DM |
365 | struct uac_format_type_i_ext_descriptor { |
366 | __u8 bLength; | |
367 | __u8 bDescriptorType; | |
368 | __u8 bDescriptorSubtype; | |
8fee4aff | 369 | __u8 bFormatType; |
2b9ddcb8 | 370 | __u8 bSubslotSize; |
8fee4aff DM |
371 | __u8 bBitResolution; |
372 | __u8 bHeaderLength; | |
373 | __u8 bControlSize; | |
374 | __u8 bSideBandProtocol; | |
375 | } __attribute__((packed)); | |
376 | ||
28e1b773 DM |
377 | /* Formats - Audio Data Format Type I Codes */ |
378 | ||
de48c7bc DM |
379 | #define UAC_FORMAT_TYPE_II_MPEG 0x1001 |
380 | #define UAC_FORMAT_TYPE_II_AC3 0x1002 | |
381 | ||
28e1b773 DM |
382 | struct uac_format_type_ii_discrete_descriptor { |
383 | __u8 bLength; | |
384 | __u8 bDescriptorType; | |
385 | __u8 bDescriptorSubtype; | |
386 | __u8 bFormatType; | |
387 | __le16 wMaxBitRate; | |
388 | __le16 wSamplesPerFrame; | |
389 | __u8 bSamFreqType; | |
390 | __u8 tSamFreq[][3]; | |
391 | } __attribute__((packed)); | |
392 | ||
8fee4aff DM |
393 | struct uac_format_type_ii_ext_descriptor { |
394 | __u8 bLength; | |
395 | __u8 bDescriptorType; | |
396 | __u8 bDescriptorSubtype; | |
397 | __u8 bFormatType; | |
398 | __u16 wMaxBitRate; | |
399 | __u16 wSamplesPerFrame; | |
400 | __u8 bHeaderLength; | |
401 | __u8 bSideBandProtocol; | |
402 | } __attribute__((packed)); | |
403 | ||
de48c7bc DM |
404 | /* type III */ |
405 | #define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001 | |
406 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002 | |
407 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003 | |
408 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004 | |
409 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005 | |
410 | #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006 | |
8fee4aff | 411 | |
512ad27d LP |
412 | /* Formats - A.2 Format Type Codes */ |
413 | #define UAC_FORMAT_TYPE_UNDEFINED 0x0 | |
414 | #define UAC_FORMAT_TYPE_I 0x1 | |
415 | #define UAC_FORMAT_TYPE_II 0x2 | |
416 | #define UAC_FORMAT_TYPE_III 0x3 | |
8fee4aff DM |
417 | #define UAC_EXT_FORMAT_TYPE_I 0x81 |
418 | #define UAC_EXT_FORMAT_TYPE_II 0x82 | |
419 | #define UAC_EXT_FORMAT_TYPE_III 0x83 | |
c47d7b09 | 420 | |
512ad27d | 421 | struct uac_iso_endpoint_descriptor { |
c47d7b09 BW |
422 | __u8 bLength; /* in bytes: 7 */ |
423 | __u8 bDescriptorType; /* USB_DT_CS_ENDPOINT */ | |
424 | __u8 bDescriptorSubtype; /* EP_GENERAL */ | |
425 | __u8 bmAttributes; | |
426 | __u8 bLockDelayUnits; | |
427 | __le16 wLockDelay; | |
428 | }; | |
512ad27d LP |
429 | #define UAC_ISO_ENDPOINT_DESC_SIZE 7 |
430 | ||
431 | #define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01 | |
432 | #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 | |
433 | #define UAC_EP_CS_ATTR_FILL_MAX 0x80 | |
434 | ||
435 | /* A.10.2 Feature Unit Control Selectors */ | |
28e1b773 | 436 | |
512ad27d LP |
437 | #define UAC_FU_CONTROL_UNDEFINED 0x00 |
438 | #define UAC_MUTE_CONTROL 0x01 | |
439 | #define UAC_VOLUME_CONTROL 0x02 | |
440 | #define UAC_BASS_CONTROL 0x03 | |
441 | #define UAC_MID_CONTROL 0x04 | |
442 | #define UAC_TREBLE_CONTROL 0x05 | |
443 | #define UAC_GRAPHIC_EQUALIZER_CONTROL 0x06 | |
444 | #define UAC_AUTOMATIC_GAIN_CONTROL 0x07 | |
445 | #define UAC_DELAY_CONTROL 0x08 | |
446 | #define UAC_BASS_BOOST_CONTROL 0x09 | |
447 | #define UAC_LOUDNESS_CONTROL 0x0a | |
448 | ||
449 | #define UAC_FU_MUTE (1 << (UAC_MUTE_CONTROL - 1)) | |
450 | #define UAC_FU_VOLUME (1 << (UAC_VOLUME_CONTROL - 1)) | |
451 | #define UAC_FU_BASS (1 << (UAC_BASS_CONTROL - 1)) | |
452 | #define UAC_FU_MID (1 << (UAC_MID_CONTROL - 1)) | |
453 | #define UAC_FU_TREBLE (1 << (UAC_TREBLE_CONTROL - 1)) | |
454 | #define UAC_FU_GRAPHIC_EQ (1 << (UAC_GRAPHIC_EQUALIZER_CONTROL - 1)) | |
455 | #define UAC_FU_AUTO_GAIN (1 << (UAC_AUTOMATIC_GAIN_CONTROL - 1)) | |
456 | #define UAC_FU_DELAY (1 << (UAC_DELAY_CONTROL - 1)) | |
457 | #define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1)) | |
458 | #define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1)) | |
c47d7b09 | 459 | |
c3501308 MT |
460 | #ifdef __KERNEL__ |
461 | ||
c47d7b09 BW |
462 | struct usb_audio_control { |
463 | struct list_head list; | |
464 | const char *name; | |
465 | u8 type; | |
466 | int data[5]; | |
467 | int (*set)(struct usb_audio_control *con, u8 cmd, int value); | |
468 | int (*get)(struct usb_audio_control *con, u8 cmd); | |
469 | }; | |
470 | ||
c47d7b09 BW |
471 | struct usb_audio_control_selector { |
472 | struct list_head list; | |
473 | struct list_head control; | |
474 | u8 id; | |
475 | const char *name; | |
476 | u8 type; | |
477 | struct usb_descriptor_header *desc; | |
478 | }; | |
479 | ||
c3501308 MT |
480 | #endif /* __KERNEL__ */ |
481 | ||
dda43a0e | 482 | #endif /* __LINUX_USB_AUDIO_H */ |