xref: /linux/include/uapi/linux/usb/audio.h (revision 6da2ec56059c3c7a7e5f729e6349e74ace1e5c57)
1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2 /*
3  * <linux/usb/audio.h> -- USB Audio definitions.
4  *
5  * Copyright (C) 2006 Thumtronics Pty Ltd.
6  * Developed for Thumtronics by Grey Innovation
7  * Ben Williamson <ben.williamson@greyinnovation.com>
8  *
9  * This software is distributed under the terms of the GNU General Public
10  * License ("GPL") version 2, as published by the Free Software Foundation.
11  *
12  * This file holds USB constants and structures defined
13  * by the USB Device Class Definition for Audio Devices.
14  * Comments below reference relevant sections of that document:
15  *
16  * http://www.usb.org/developers/devclass_docs/audio10.pdf
17  *
18  * Types and defines in this file are either specific to version 1.0 of
19  * this standard or common for newer versions.
20  */
21 
22 #ifndef _UAPI__LINUX_USB_AUDIO_H
23 #define _UAPI__LINUX_USB_AUDIO_H
24 
25 #include <linux/types.h>
26 
27 /* bInterfaceProtocol values to denote the version of the standard used */
28 #define UAC_VERSION_1			0x00
29 #define UAC_VERSION_2			0x20
30 #define UAC_VERSION_3			0x30
31 
32 /* A.2 Audio Interface Subclass Codes */
33 #define USB_SUBCLASS_AUDIOCONTROL	0x01
34 #define USB_SUBCLASS_AUDIOSTREAMING	0x02
35 #define USB_SUBCLASS_MIDISTREAMING	0x03
36 
37 /* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
38 #define UAC_HEADER			0x01
39 #define UAC_INPUT_TERMINAL		0x02
40 #define UAC_OUTPUT_TERMINAL		0x03
41 #define UAC_MIXER_UNIT			0x04
42 #define UAC_SELECTOR_UNIT		0x05
43 #define UAC_FEATURE_UNIT		0x06
44 #define UAC1_PROCESSING_UNIT		0x07
45 #define UAC1_EXTENSION_UNIT		0x08
46 
47 /* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
48 #define UAC_AS_GENERAL			0x01
49 #define UAC_FORMAT_TYPE			0x02
50 #define UAC_FORMAT_SPECIFIC		0x03
51 
52 /* A.7 Processing Unit Process Types */
53 #define UAC_PROCESS_UNDEFINED		0x00
54 #define UAC_PROCESS_UP_DOWNMIX		0x01
55 #define UAC_PROCESS_DOLBY_PROLOGIC	0x02
56 #define UAC_PROCESS_STEREO_EXTENDER	0x03
57 #define UAC_PROCESS_REVERB		0x04
58 #define UAC_PROCESS_CHORUS		0x05
59 #define UAC_PROCESS_DYN_RANGE_COMP	0x06
60 
61 /* A.8 Audio Class-Specific Endpoint Descriptor Subtypes */
62 #define UAC_EP_GENERAL			0x01
63 
64 /* A.9 Audio Class-Specific Request Codes */
65 #define UAC_SET_			0x00
66 #define UAC_GET_			0x80
67 
68 #define UAC__CUR			0x1
69 #define UAC__MIN			0x2
70 #define UAC__MAX			0x3
71 #define UAC__RES			0x4
72 #define UAC__MEM			0x5
73 
74 #define UAC_SET_CUR			(UAC_SET_ | UAC__CUR)
75 #define UAC_GET_CUR			(UAC_GET_ | UAC__CUR)
76 #define UAC_SET_MIN			(UAC_SET_ | UAC__MIN)
77 #define UAC_GET_MIN			(UAC_GET_ | UAC__MIN)
78 #define UAC_SET_MAX			(UAC_SET_ | UAC__MAX)
79 #define UAC_GET_MAX			(UAC_GET_ | UAC__MAX)
80 #define UAC_SET_RES			(UAC_SET_ | UAC__RES)
81 #define UAC_GET_RES			(UAC_GET_ | UAC__RES)
82 #define UAC_SET_MEM			(UAC_SET_ | UAC__MEM)
83 #define UAC_GET_MEM			(UAC_GET_ | UAC__MEM)
84 
85 #define UAC_GET_STAT			0xff
86 
87 /* A.10 Control Selector Codes */
88 
89 /* A.10.1 Terminal Control Selectors */
90 #define UAC_TERM_COPY_PROTECT		0x01
91 
92 /* A.10.2 Feature Unit Control Selectors */
93 #define UAC_FU_MUTE			0x01
94 #define UAC_FU_VOLUME			0x02
95 #define UAC_FU_BASS			0x03
96 #define UAC_FU_MID			0x04
97 #define UAC_FU_TREBLE			0x05
98 #define UAC_FU_GRAPHIC_EQUALIZER	0x06
99 #define UAC_FU_AUTOMATIC_GAIN		0x07
100 #define UAC_FU_DELAY			0x08
101 #define UAC_FU_BASS_BOOST		0x09
102 #define UAC_FU_LOUDNESS			0x0a
103 
104 #define UAC_CONTROL_BIT(CS)	(1 << ((CS) - 1))
105 
106 /* A.10.3.1 Up/Down-mix Processing Unit Controls Selectors */
107 #define UAC_UD_ENABLE			0x01
108 #define UAC_UD_MODE_SELECT		0x02
109 
110 /* A.10.3.2 Dolby Prologic (tm) Processing Unit Controls Selectors */
111 #define UAC_DP_ENABLE			0x01
112 #define UAC_DP_MODE_SELECT		0x02
113 
114 /* A.10.3.3 3D Stereo Extender Processing Unit Control Selectors */
115 #define UAC_3D_ENABLE			0x01
116 #define UAC_3D_SPACE			0x02
117 
118 /* A.10.3.4 Reverberation Processing Unit Control Selectors */
119 #define UAC_REVERB_ENABLE		0x01
120 #define UAC_REVERB_LEVEL		0x02
121 #define UAC_REVERB_TIME			0x03
122 #define UAC_REVERB_FEEDBACK		0x04
123 
124 /* A.10.3.5 Chorus Processing Unit Control Selectors */
125 #define UAC_CHORUS_ENABLE		0x01
126 #define UAC_CHORUS_LEVEL		0x02
127 #define UAC_CHORUS_RATE			0x03
128 #define UAC_CHORUS_DEPTH		0x04
129 
130 /* A.10.3.6 Dynamic Range Compressor Unit Control Selectors */
131 #define UAC_DCR_ENABLE			0x01
132 #define UAC_DCR_RATE			0x02
133 #define UAC_DCR_MAXAMPL			0x03
134 #define UAC_DCR_THRESHOLD		0x04
135 #define UAC_DCR_ATTACK_TIME		0x05
136 #define UAC_DCR_RELEASE_TIME		0x06
137 
138 /* A.10.4 Extension Unit Control Selectors */
139 #define UAC_XU_ENABLE			0x01
140 
141 /* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
142 #define UAC_MS_HEADER			0x01
143 #define UAC_MIDI_IN_JACK		0x02
144 #define UAC_MIDI_OUT_JACK		0x03
145 
146 /* MIDI - A.1 MS Class-Specific Endpoint Descriptor Subtypes */
147 #define UAC_MS_GENERAL			0x01
148 
149 /* Terminals - 2.1 USB Terminal Types */
150 #define UAC_TERMINAL_UNDEFINED		0x100
151 #define UAC_TERMINAL_STREAMING		0x101
152 #define UAC_TERMINAL_VENDOR_SPEC	0x1FF
153 
154 /* Terminal Control Selectors */
155 /* 4.3.2  Class-Specific AC Interface Descriptor */
156 struct uac1_ac_header_descriptor {
157 	__u8  bLength;			/* 8 + n */
158 	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
159 	__u8  bDescriptorSubtype;	/* UAC_MS_HEADER */
160 	__le16 bcdADC;			/* 0x0100 */
161 	__le16 wTotalLength;		/* includes Unit and Terminal desc. */
162 	__u8  bInCollection;		/* n */
163 	__u8  baInterfaceNr[];		/* [n] */
164 } __attribute__ ((packed));
165 
166 #define UAC_DT_AC_HEADER_SIZE(n)	(8 + (n))
167 
168 /* As above, but more useful for defining your own descriptors: */
169 #define DECLARE_UAC_AC_HEADER_DESCRIPTOR(n)			\
170 struct uac1_ac_header_descriptor_##n {			\
171 	__u8  bLength;						\
172 	__u8  bDescriptorType;					\
173 	__u8  bDescriptorSubtype;				\
174 	__le16 bcdADC;						\
175 	__le16 wTotalLength;					\
176 	__u8  bInCollection;					\
177 	__u8  baInterfaceNr[n];					\
178 } __attribute__ ((packed))
179 
180 /* 4.3.2.1 Input Terminal Descriptor */
181 struct uac_input_terminal_descriptor {
182 	__u8  bLength;			/* in bytes: 12 */
183 	__u8  bDescriptorType;		/* CS_INTERFACE descriptor type */
184 	__u8  bDescriptorSubtype;	/* INPUT_TERMINAL descriptor subtype */
185 	__u8  bTerminalID;		/* Constant uniquely terminal ID */
186 	__le16 wTerminalType;		/* USB Audio Terminal Types */
187 	__u8  bAssocTerminal;		/* ID of the Output Terminal associated */
188 	__u8  bNrChannels;		/* Number of logical output channels */
189 	__le16 wChannelConfig;
190 	__u8  iChannelNames;
191 	__u8  iTerminal;
192 } __attribute__ ((packed));
193 
194 #define UAC_DT_INPUT_TERMINAL_SIZE			12
195 
196 /* Terminals - 2.2 Input Terminal Types */
197 #define UAC_INPUT_TERMINAL_UNDEFINED			0x200
198 #define UAC_INPUT_TERMINAL_MICROPHONE			0x201
199 #define UAC_INPUT_TERMINAL_DESKTOP_MICROPHONE		0x202
200 #define UAC_INPUT_TERMINAL_PERSONAL_MICROPHONE		0x203
201 #define UAC_INPUT_TERMINAL_OMNI_DIR_MICROPHONE		0x204
202 #define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY		0x205
203 #define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY	0x206
204 
205 /* Terminals - control selectors */
206 
207 #define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL		0x01
208 
209 /* 4.3.2.2 Output Terminal Descriptor */
210 struct uac1_output_terminal_descriptor {
211 	__u8  bLength;			/* in bytes: 9 */
212 	__u8  bDescriptorType;		/* CS_INTERFACE descriptor type */
213 	__u8  bDescriptorSubtype;	/* OUTPUT_TERMINAL descriptor subtype */
214 	__u8  bTerminalID;		/* Constant uniquely terminal ID */
215 	__le16 wTerminalType;		/* USB Audio Terminal Types */
216 	__u8  bAssocTerminal;		/* ID of the Input Terminal associated */
217 	__u8  bSourceID;		/* ID of the connected Unit or Terminal*/
218 	__u8  iTerminal;
219 } __attribute__ ((packed));
220 
221 #define UAC_DT_OUTPUT_TERMINAL_SIZE			9
222 
223 /* Terminals - 2.3 Output Terminal Types */
224 #define UAC_OUTPUT_TERMINAL_UNDEFINED			0x300
225 #define UAC_OUTPUT_TERMINAL_SPEAKER			0x301
226 #define UAC_OUTPUT_TERMINAL_HEADPHONES			0x302
227 #define UAC_OUTPUT_TERMINAL_HEAD_MOUNTED_DISPLAY_AUDIO	0x303
228 #define UAC_OUTPUT_TERMINAL_DESKTOP_SPEAKER		0x304
229 #define UAC_OUTPUT_TERMINAL_ROOM_SPEAKER		0x305
230 #define UAC_OUTPUT_TERMINAL_COMMUNICATION_SPEAKER	0x306
231 #define UAC_OUTPUT_TERMINAL_LOW_FREQ_EFFECTS_SPEAKER	0x307
232 
233 /* Set bControlSize = 2 as default setting */
234 #define UAC_DT_FEATURE_UNIT_SIZE(ch)		(7 + ((ch) + 1) * 2)
235 
236 /* As above, but more useful for defining your own descriptors: */
237 #define DECLARE_UAC_FEATURE_UNIT_DESCRIPTOR(ch)			\
238 struct uac_feature_unit_descriptor_##ch {			\
239 	__u8  bLength;						\
240 	__u8  bDescriptorType;					\
241 	__u8  bDescriptorSubtype;				\
242 	__u8  bUnitID;						\
243 	__u8  bSourceID;					\
244 	__u8  bControlSize;					\
245 	__le16 bmaControls[ch + 1];				\
246 	__u8  iFeature;						\
247 } __attribute__ ((packed))
248 
249 /* 4.3.2.3 Mixer Unit Descriptor */
250 struct uac_mixer_unit_descriptor {
251 	__u8 bLength;
252 	__u8 bDescriptorType;
253 	__u8 bDescriptorSubtype;
254 	__u8 bUnitID;
255 	__u8 bNrInPins;
256 	__u8 baSourceID[];
257 } __attribute__ ((packed));
258 
259 static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc)
260 {
261 	return desc->baSourceID[desc->bNrInPins];
262 }
263 
264 static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
265 						  int protocol)
266 {
267 	if (protocol == UAC_VERSION_1)
268 		return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
269 			desc->baSourceID[desc->bNrInPins + 1];
270 	else
271 		return  (desc->baSourceID[desc->bNrInPins + 4] << 24) |
272 			(desc->baSourceID[desc->bNrInPins + 3] << 16) |
273 			(desc->baSourceID[desc->bNrInPins + 2] << 8)  |
274 			(desc->baSourceID[desc->bNrInPins + 1]);
275 }
276 
277 static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
278 						int protocol)
279 {
280 	return (protocol == UAC_VERSION_1) ?
281 		desc->baSourceID[desc->bNrInPins + 3] :
282 		desc->baSourceID[desc->bNrInPins + 5];
283 }
284 
285 static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
286 					      int protocol)
287 {
288 	switch (protocol) {
289 	case UAC_VERSION_1:
290 		return &desc->baSourceID[desc->bNrInPins + 4];
291 	case UAC_VERSION_2:
292 		return &desc->baSourceID[desc->bNrInPins + 6];
293 	case UAC_VERSION_3:
294 		return &desc->baSourceID[desc->bNrInPins + 2];
295 	default:
296 		return NULL;
297 	}
298 }
299 
300 static inline __u16 uac3_mixer_unit_wClusterDescrID(struct uac_mixer_unit_descriptor *desc)
301 {
302 	return (desc->baSourceID[desc->bNrInPins + 1] << 8) |
303 		desc->baSourceID[desc->bNrInPins];
304 }
305 
306 static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
307 {
308 	__u8 *raw = (__u8 *) desc;
309 	return raw[desc->bLength - 1];
310 }
311 
312 /* 4.3.2.4 Selector Unit Descriptor */
313 struct uac_selector_unit_descriptor {
314 	__u8 bLength;
315 	__u8 bDescriptorType;
316 	__u8 bDescriptorSubtype;
317 	__u8 bUintID;
318 	__u8 bNrInPins;
319 	__u8 baSourceID[];
320 } __attribute__ ((packed));
321 
322 static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc)
323 {
324 	__u8 *raw = (__u8 *) desc;
325 	return raw[desc->bLength - 1];
326 }
327 
328 /* 4.3.2.5 Feature Unit Descriptor */
329 struct uac_feature_unit_descriptor {
330 	__u8 bLength;
331 	__u8 bDescriptorType;
332 	__u8 bDescriptorSubtype;
333 	__u8 bUnitID;
334 	__u8 bSourceID;
335 	__u8 bControlSize;
336 	__u8 bmaControls[0]; /* variable length */
337 } __attribute__((packed));
338 
339 static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc)
340 {
341 	__u8 *raw = (__u8 *) desc;
342 	return raw[desc->bLength - 1];
343 }
344 
345 /* 4.3.2.6 Processing Unit Descriptors */
346 struct uac_processing_unit_descriptor {
347 	__u8 bLength;
348 	__u8 bDescriptorType;
349 	__u8 bDescriptorSubtype;
350 	__u8 bUnitID;
351 	__le16 wProcessType;
352 	__u8 bNrInPins;
353 	__u8 baSourceID[];
354 } __attribute__ ((packed));
355 
356 static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc)
357 {
358 	return desc->baSourceID[desc->bNrInPins];
359 }
360 
361 static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
362 						       int protocol)
363 {
364 	if (protocol == UAC_VERSION_1)
365 		return (desc->baSourceID[desc->bNrInPins + 2] << 8) |
366 			desc->baSourceID[desc->bNrInPins + 1];
367 	else
368 		return  (desc->baSourceID[desc->bNrInPins + 4] << 24) |
369 			(desc->baSourceID[desc->bNrInPins + 3] << 16) |
370 			(desc->baSourceID[desc->bNrInPins + 2] << 8)  |
371 			(desc->baSourceID[desc->bNrInPins + 1]);
372 }
373 
374 static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
375 						     int protocol)
376 {
377 	return (protocol == UAC_VERSION_1) ?
378 		desc->baSourceID[desc->bNrInPins + 3] :
379 		desc->baSourceID[desc->bNrInPins + 5];
380 }
381 
382 static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
383 						    int protocol)
384 {
385 	return (protocol == UAC_VERSION_1) ?
386 		desc->baSourceID[desc->bNrInPins + 4] :
387 		2; /* in UAC2, this value is constant */
388 }
389 
390 static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
391 						   int protocol)
392 {
393 	return (protocol == UAC_VERSION_1) ?
394 		&desc->baSourceID[desc->bNrInPins + 5] :
395 		&desc->baSourceID[desc->bNrInPins + 6];
396 }
397 
398 static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
399 						   int protocol)
400 {
401 	__u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
402 	return *(uac_processing_unit_bmControls(desc, protocol)
403 			+ control_size);
404 }
405 
406 static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
407 						 int protocol)
408 {
409 	__u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
410 	return uac_processing_unit_bmControls(desc, protocol)
411 			+ control_size + 1;
412 }
413 
414 /* 4.5.2 Class-Specific AS Interface Descriptor */
415 struct uac1_as_header_descriptor {
416 	__u8  bLength;			/* in bytes: 7 */
417 	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
418 	__u8  bDescriptorSubtype;	/* AS_GENERAL */
419 	__u8  bTerminalLink;		/* Terminal ID of connected Terminal */
420 	__u8  bDelay;			/* Delay introduced by the data path */
421 	__le16 wFormatTag;		/* The Audio Data Format */
422 } __attribute__ ((packed));
423 
424 #define UAC_DT_AS_HEADER_SIZE		7
425 
426 /* Formats - A.1.1 Audio Data Format Type I Codes */
427 #define UAC_FORMAT_TYPE_I_UNDEFINED	0x0
428 #define UAC_FORMAT_TYPE_I_PCM		0x1
429 #define UAC_FORMAT_TYPE_I_PCM8		0x2
430 #define UAC_FORMAT_TYPE_I_IEEE_FLOAT	0x3
431 #define UAC_FORMAT_TYPE_I_ALAW		0x4
432 #define UAC_FORMAT_TYPE_I_MULAW		0x5
433 
434 struct uac_format_type_i_continuous_descriptor {
435 	__u8  bLength;			/* in bytes: 8 + (ns * 3) */
436 	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
437 	__u8  bDescriptorSubtype;	/* FORMAT_TYPE */
438 	__u8  bFormatType;		/* FORMAT_TYPE_1 */
439 	__u8  bNrChannels;		/* physical channels in the stream */
440 	__u8  bSubframeSize;		/* */
441 	__u8  bBitResolution;
442 	__u8  bSamFreqType;
443 	__u8  tLowerSamFreq[3];
444 	__u8  tUpperSamFreq[3];
445 } __attribute__ ((packed));
446 
447 #define UAC_FORMAT_TYPE_I_CONTINUOUS_DESC_SIZE	14
448 
449 struct uac_format_type_i_discrete_descriptor {
450 	__u8  bLength;			/* in bytes: 8 + (ns * 3) */
451 	__u8  bDescriptorType;		/* USB_DT_CS_INTERFACE */
452 	__u8  bDescriptorSubtype;	/* FORMAT_TYPE */
453 	__u8  bFormatType;		/* FORMAT_TYPE_1 */
454 	__u8  bNrChannels;		/* physical channels in the stream */
455 	__u8  bSubframeSize;		/* */
456 	__u8  bBitResolution;
457 	__u8  bSamFreqType;
458 	__u8  tSamFreq[][3];
459 } __attribute__ ((packed));
460 
461 #define DECLARE_UAC_FORMAT_TYPE_I_DISCRETE_DESC(n)		\
462 struct uac_format_type_i_discrete_descriptor_##n {		\
463 	__u8  bLength;						\
464 	__u8  bDescriptorType;					\
465 	__u8  bDescriptorSubtype;				\
466 	__u8  bFormatType;					\
467 	__u8  bNrChannels;					\
468 	__u8  bSubframeSize;					\
469 	__u8  bBitResolution;					\
470 	__u8  bSamFreqType;					\
471 	__u8  tSamFreq[n][3];					\
472 } __attribute__ ((packed))
473 
474 #define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE(n)	(8 + (n * 3))
475 
476 struct uac_format_type_i_ext_descriptor {
477 	__u8 bLength;
478 	__u8 bDescriptorType;
479 	__u8 bDescriptorSubtype;
480 	__u8 bFormatType;
481 	__u8 bSubslotSize;
482 	__u8 bBitResolution;
483 	__u8 bHeaderLength;
484 	__u8 bControlSize;
485 	__u8 bSideBandProtocol;
486 } __attribute__((packed));
487 
488 /* Formats - Audio Data Format Type I Codes */
489 
490 #define UAC_FORMAT_TYPE_II_MPEG	0x1001
491 #define UAC_FORMAT_TYPE_II_AC3	0x1002
492 
493 struct uac_format_type_ii_discrete_descriptor {
494 	__u8 bLength;
495 	__u8 bDescriptorType;
496 	__u8 bDescriptorSubtype;
497 	__u8 bFormatType;
498 	__le16 wMaxBitRate;
499 	__le16 wSamplesPerFrame;
500 	__u8 bSamFreqType;
501 	__u8 tSamFreq[][3];
502 } __attribute__((packed));
503 
504 struct uac_format_type_ii_ext_descriptor {
505 	__u8 bLength;
506 	__u8 bDescriptorType;
507 	__u8 bDescriptorSubtype;
508 	__u8 bFormatType;
509 	__le16 wMaxBitRate;
510 	__le16 wSamplesPerFrame;
511 	__u8 bHeaderLength;
512 	__u8 bSideBandProtocol;
513 } __attribute__((packed));
514 
515 /* type III */
516 #define UAC_FORMAT_TYPE_III_IEC1937_AC3	0x2001
517 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1	0x2002
518 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT	0x2003
519 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT	0x2004
520 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS	0x2005
521 #define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS	0x2006
522 
523 /* Formats - A.2 Format Type Codes */
524 #define UAC_FORMAT_TYPE_UNDEFINED	0x0
525 #define UAC_FORMAT_TYPE_I		0x1
526 #define UAC_FORMAT_TYPE_II		0x2
527 #define UAC_FORMAT_TYPE_III		0x3
528 #define UAC_EXT_FORMAT_TYPE_I		0x81
529 #define UAC_EXT_FORMAT_TYPE_II		0x82
530 #define UAC_EXT_FORMAT_TYPE_III		0x83
531 
532 struct uac_iso_endpoint_descriptor {
533 	__u8  bLength;			/* in bytes: 7 */
534 	__u8  bDescriptorType;		/* USB_DT_CS_ENDPOINT */
535 	__u8  bDescriptorSubtype;	/* EP_GENERAL */
536 	__u8  bmAttributes;
537 	__u8  bLockDelayUnits;
538 	__le16 wLockDelay;
539 } __attribute__((packed));
540 #define UAC_ISO_ENDPOINT_DESC_SIZE	7
541 
542 #define UAC_EP_CS_ATTR_SAMPLE_RATE	0x01
543 #define UAC_EP_CS_ATTR_PITCH_CONTROL	0x02
544 #define UAC_EP_CS_ATTR_FILL_MAX		0x80
545 
546 /* status word format (3.7.1.1) */
547 
548 #define UAC1_STATUS_TYPE_ORIG_MASK		0x0f
549 #define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF	0x0
550 #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF	0x1
551 #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP	0x2
552 
553 #define UAC1_STATUS_TYPE_IRQ_PENDING		(1 << 7)
554 #define UAC1_STATUS_TYPE_MEM_CHANGED		(1 << 6)
555 
556 struct uac1_status_word {
557 	__u8 bStatusType;
558 	__u8 bOriginator;
559 } __attribute__((packed));
560 
561 
562 #endif /* _UAPI__LINUX_USB_AUDIO_H */
563