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