1 // SPDX-License-Identifier: GPL-2.0+ 1 2 /* 3 * Copyright (c) 2017 Ruslan Bilovol <ruslan.b 4 * 5 * This file holds USB constants and structure 6 * by the USB DEVICE CLASS DEFINITION FOR AUDI 7 */ 8 9 #ifndef __LINUX_USB_AUDIO_V3_H 10 #define __LINUX_USB_AUDIO_V3_H 11 12 #include <linux/types.h> 13 14 /* 15 * v1.0, v2.0 and v3.0 of this standard have m 16 * of the definitions, please refer to audio.h 17 */ 18 19 /* All High Capability descriptors have these 20 struct uac3_hc_descriptor_header { 21 __le16 wLength; 22 __u8 bDescriptorType; 23 __u8 bDescriptorSubtype; 24 __le16 wDescriptorID; 25 } __attribute__ ((packed)); 26 27 /* 4.3.1 CLUSTER DESCRIPTOR HEADER */ 28 struct uac3_cluster_header_descriptor { 29 __le16 wLength; 30 __u8 bDescriptorType; 31 __u8 bDescriptorSubtype; 32 __le16 wDescriptorID; 33 __u8 bNrChannels; 34 } __attribute__ ((packed)); 35 36 /* 4.3.2.1 SEGMENTS */ 37 struct uac3_cluster_segment_descriptor { 38 __le16 wLength; 39 __u8 bSegmentType; 40 /* __u8[0]; segment-specific data */ 41 } __attribute__ ((packed)); 42 43 /* 4.3.2.1.1 END SEGMENT */ 44 struct uac3_cluster_end_segment_descriptor { 45 __le16 wLength; 46 __u8 bSegmentType; /* Con 47 } __attribute__ ((packed)); 48 49 /* 4.3.2.1.3.1 INFORMATION SEGMENT */ 50 struct uac3_cluster_information_segment_descri 51 __le16 wLength; 52 __u8 bSegmentType; 53 __u8 bChPurpose; 54 __u8 bChRelationship; 55 __u8 bChGroupID; 56 } __attribute__ ((packed)); 57 58 /* 4.5.2 CLASS-SPECIFIC AC INTERFACE DESCRIPTO 59 struct uac3_ac_header_descriptor { 60 __u8 bLength; /* 10 61 __u8 bDescriptorType; /* CS_ 62 __u8 bDescriptorSubtype; /* HEA 63 __u8 bCategory; 64 65 /* includes Clock Source, Unit, Termin 66 __le16 wTotalLength; 67 68 __le32 bmControls; 69 } __attribute__ ((packed)); 70 71 /* 4.5.2.1 INPUT TERMINAL DESCRIPTOR */ 72 struct uac3_input_terminal_descriptor { 73 __u8 bLength; 74 __u8 bDescriptorType; 75 __u8 bDescriptorSubtype; 76 __u8 bTerminalID; 77 __le16 wTerminalType; 78 __u8 bAssocTerminal; 79 __u8 bCSourceID; 80 __le32 bmControls; 81 __le16 wClusterDescrID; 82 __le16 wExTerminalDescrID; 83 __le16 wConnectorsDescrID; 84 __le16 wTerminalDescrStr; 85 } __attribute__((packed)); 86 87 /* 4.5.2.2 OUTPUT TERMINAL DESCRIPTOR */ 88 struct uac3_output_terminal_descriptor { 89 __u8 bLength; 90 __u8 bDescriptorType; 91 __u8 bDescriptorSubtype; 92 __u8 bTerminalID; 93 __le16 wTerminalType; 94 __u8 bAssocTerminal; 95 __u8 bSourceID; 96 __u8 bCSourceID; 97 __le32 bmControls; 98 __le16 wExTerminalDescrID; 99 __le16 wConnectorsDescrID; 100 __le16 wTerminalDescrStr; 101 } __attribute__((packed)); 102 103 /* 4.5.2.7 FEATURE UNIT DESCRIPTOR */ 104 struct uac3_feature_unit_descriptor { 105 __u8 bLength; 106 __u8 bDescriptorType; 107 __u8 bDescriptorSubtype; 108 __u8 bUnitID; 109 __u8 bSourceID; 110 /* bmaControls is actually u32, 111 * but u8 is needed for the hybrid par 112 __u8 bmaControls[]; /* variable length 113 /* wFeatureDescrStr omitted */ 114 } __attribute__((packed)); 115 116 #define UAC3_DT_FEATURE_UNIT_SIZE(ch) 117 118 /* As above, but more useful for defining your 119 #define DECLARE_UAC3_FEATURE_UNIT_DESCRIPTOR(c 120 struct uac3_feature_unit_descriptor_##ch { 121 __u8 bLength; 122 __u8 bDescriptorType; 123 __u8 bDescriptorSubtype; 124 __u8 bUnitID; 125 __u8 bSourceID; 126 __le32 bmaControls[ch + 1]; 127 __le16 wFeatureDescrStr; 128 } __attribute__ ((packed)) 129 130 /* 4.5.2.12 CLOCK SOURCE DESCRIPTOR */ 131 struct uac3_clock_source_descriptor { 132 __u8 bLength; 133 __u8 bDescriptorType; 134 __u8 bDescriptorSubtype; 135 __u8 bClockID; 136 __u8 bmAttributes; 137 __le32 bmControls; 138 __u8 bReferenceTerminal; 139 __le16 wClockSourceStr; 140 } __attribute__((packed)); 141 142 /* bmAttribute fields */ 143 #define UAC3_CLOCK_SOURCE_TYPE_EXT 0x0 144 #define UAC3_CLOCK_SOURCE_TYPE_INT 0x1 145 #define UAC3_CLOCK_SOURCE_ASYNC (0 << 146 #define UAC3_CLOCK_SOURCE_SYNCED_TO_SOF (1 << 147 148 /* 4.5.2.13 CLOCK SELECTOR DESCRIPTOR */ 149 struct uac3_clock_selector_descriptor { 150 __u8 bLength; 151 __u8 bDescriptorType; 152 __u8 bDescriptorSubtype; 153 __u8 bClockID; 154 __u8 bNrInPins; 155 __u8 baCSourceID[]; 156 /* bmControls and wCSelectorDescrStr o 157 } __attribute__((packed)); 158 159 /* 4.5.2.14 CLOCK MULTIPLIER DESCRIPTOR */ 160 struct uac3_clock_multiplier_descriptor { 161 __u8 bLength; 162 __u8 bDescriptorType; 163 __u8 bDescriptorSubtype; 164 __u8 bClockID; 165 __u8 bCSourceID; 166 __le32 bmControls; 167 __le16 wCMultiplierDescrStr; 168 } __attribute__((packed)); 169 170 /* 4.5.2.15 POWER DOMAIN DESCRIPTOR */ 171 struct uac3_power_domain_descriptor { 172 __u8 bLength; 173 __u8 bDescriptorType; 174 __u8 bDescriptorSubtype; 175 __u8 bPowerDomainID; 176 __le16 waRecoveryTime1; 177 __le16 waRecoveryTime2; 178 __u8 bNrEntities; 179 __u8 baEntityID[]; 180 /* wPDomainDescrStr omitted */ 181 } __attribute__((packed)); 182 183 /* As above, but more useful for defining your 184 #define DECLARE_UAC3_POWER_DOMAIN_DESCRIPTOR(n 185 struct uac3_power_domain_descriptor_##n { 186 __u8 bLength; 187 __u8 bDescriptorType; 188 __u8 bDescriptorSubtype; 189 __u8 bPowerDomainID; 190 __le16 waRecoveryTime1; 191 __le16 waRecoveryTime2; 192 __u8 bNrEntities; 193 __u8 baEntityID[n]; 194 __le16 wPDomainDescrStr; 195 } __attribute__ ((packed)) 196 197 /* 4.7.2 CLASS-SPECIFIC AS INTERFACE DESCRIPTO 198 struct uac3_as_header_descriptor { 199 __u8 bLength; 200 __u8 bDescriptorType; 201 __u8 bDescriptorSubtype; 202 __u8 bTerminalLink; 203 __le32 bmControls; 204 __le16 wClusterDescrID; 205 __le64 bmFormats; 206 __u8 bSubslotSize; 207 __u8 bBitResolution; 208 __le16 bmAuxProtocols; 209 __u8 bControlSize; 210 } __attribute__((packed)); 211 212 #define UAC3_FORMAT_TYPE_I_RAW_DATA (1 << 213 214 /* 4.8.1.2 CLASS-SPECIFIC AS ISOCHRONOUS AUDIO 215 struct uac3_iso_endpoint_descriptor { 216 __u8 bLength; 217 __u8 bDescriptorType; 218 __u8 bDescriptorSubtype; 219 __le32 bmControls; 220 __u8 bLockDelayUnits; 221 __le16 wLockDelay; 222 } __attribute__((packed)); 223 224 /* 5.2.1.6.1 INSERTION CONTROL PARAMETER BLOCK 225 struct uac3_insertion_ctl_blk { 226 __u8 bSize; 227 __u8 bmConInserted; 228 } __attribute__ ((packed)); 229 230 /* 6.1 INTERRUPT DATA MESSAGE */ 231 struct uac3_interrupt_data_msg { 232 __u8 bInfo; 233 __u8 bSourceType; 234 __le16 wValue; 235 __le16 wIndex; 236 } __attribute__((packed)); 237 238 /* A.2 AUDIO AUDIO FUNCTION SUBCLASS CODES */ 239 #define UAC3_FUNCTION_SUBCLASS_UNDEFINED 240 #define UAC3_FUNCTION_SUBCLASS_FULL_ADC_3_0 241 /* BADD profiles */ 242 #define UAC3_FUNCTION_SUBCLASS_GENERIC_IO 243 #define UAC3_FUNCTION_SUBCLASS_HEADPHONE 244 #define UAC3_FUNCTION_SUBCLASS_SPEAKER 245 #define UAC3_FUNCTION_SUBCLASS_MICROPHONE 246 #define UAC3_FUNCTION_SUBCLASS_HEADSET 247 #define UAC3_FUNCTION_SUBCLASS_HEADSET_ADAPTER 248 #define UAC3_FUNCTION_SUBCLASS_SPEAKERPHONE 249 250 /* A.7 AUDIO FUNCTION CATEGORY CODES */ 251 #define UAC3_FUNCTION_SUBCLASS_UNDEFINED 252 #define UAC3_FUNCTION_DESKTOP_SPEAKER 253 #define UAC3_FUNCTION_HOME_THEATER 254 #define UAC3_FUNCTION_MICROPHONE 255 #define UAC3_FUNCTION_HEADSET 256 #define UAC3_FUNCTION_TELEPHONE 257 #define UAC3_FUNCTION_CONVERTER 258 #define UAC3_FUNCTION_SOUND_RECORDER 259 #define UAC3_FUNCTION_IO_BOX 260 #define UAC3_FUNCTION_MUSICAL_INSTRUMENT 261 #define UAC3_FUNCTION_PRO_AUDIO 262 #define UAC3_FUNCTION_AUDIO_VIDEO 263 #define UAC3_FUNCTION_CONTROL_PANEL 264 #define UAC3_FUNCTION_HEADPHONE 265 #define UAC3_FUNCTION_GENERIC_SPEAKER 266 #define UAC3_FUNCTION_HEADSET_ADAPTER 267 #define UAC3_FUNCTION_SPEAKERPHONE 268 #define UAC3_FUNCTION_OTHER 269 270 /* A.8 AUDIO CLASS-SPECIFIC DESCRIPTOR TYPES * 271 #define UAC3_CS_UNDEFINED 0x20 272 #define UAC3_CS_DEVICE 0x21 273 #define UAC3_CS_CONFIGURATION 0x22 274 #define UAC3_CS_STRING 0x23 275 #define UAC3_CS_INTERFACE 0x24 276 #define UAC3_CS_ENDPOINT 0x25 277 #define UAC3_CS_CLUSTER 0x26 278 279 /* A.10 CLUSTER DESCRIPTOR SEGMENT TYPES */ 280 #define UAC3_SEGMENT_UNDEFINED 0x00 281 #define UAC3_CLUSTER_DESCRIPTION 0x01 282 #define UAC3_CLUSTER_VENDOR_DEFINED 0x1F 283 #define UAC3_CHANNEL_INFORMATION 0x20 284 #define UAC3_CHANNEL_AMBISONIC 0x21 285 #define UAC3_CHANNEL_DESCRIPTION 0x22 286 #define UAC3_CHANNEL_VENDOR_DEFINED 0xFE 287 #define UAC3_END_SEGMENT 0xFF 288 289 /* A.11 CHANNEL PURPOSE DEFINITIONS */ 290 #define UAC3_PURPOSE_UNDEFINED 0x00 291 #define UAC3_PURPOSE_GENERIC_AUDIO 0x01 292 #define UAC3_PURPOSE_VOICE 0x02 293 #define UAC3_PURPOSE_SPEECH 0x03 294 #define UAC3_PURPOSE_AMBIENT 0x04 295 #define UAC3_PURPOSE_REFERENCE 0x05 296 #define UAC3_PURPOSE_ULTRASONIC 0x06 297 #define UAC3_PURPOSE_VIBROKINETIC 0x07 298 #define UAC3_PURPOSE_NON_AUDIO 0xFF 299 300 /* A.12 CHANNEL RELATIONSHIP DEFINITIONS */ 301 #define UAC3_CH_RELATIONSHIP_UNDEFINED 0x00 302 #define UAC3_CH_MONO 0x01 303 #define UAC3_CH_LEFT 0x02 304 #define UAC3_CH_RIGHT 0x03 305 #define UAC3_CH_ARRAY 0x04 306 #define UAC3_CH_PATTERN_X 0x20 307 #define UAC3_CH_PATTERN_Y 0x21 308 #define UAC3_CH_PATTERN_A 0x22 309 #define UAC3_CH_PATTERN_B 0x23 310 #define UAC3_CH_PATTERN_M 0x24 311 #define UAC3_CH_PATTERN_S 0x25 312 #define UAC3_CH_FRONT_LEFT 0x80 313 #define UAC3_CH_FRONT_RIGHT 0x81 314 #define UAC3_CH_FRONT_CENTER 0x82 315 #define UAC3_CH_FRONT_LEFT_OF_CENTER 0x83 316 #define UAC3_CH_FRONT_RIGHT_OF_CENTER 0x84 317 #define UAC3_CH_FRONT_WIDE_LEFT 0x85 318 #define UAC3_CH_FRONT_WIDE_RIGHT 0x86 319 #define UAC3_CH_SIDE_LEFT 0x87 320 #define UAC3_CH_SIDE_RIGHT 0x88 321 #define UAC3_CH_SURROUND_ARRAY_LEFT 0x89 322 #define UAC3_CH_SURROUND_ARRAY_RIGHT 0x8A 323 #define UAC3_CH_BACK_LEFT 0x8B 324 #define UAC3_CH_BACK_RIGHT 0x8C 325 #define UAC3_CH_BACK_CENTER 0x8D 326 #define UAC3_CH_BACK_LEFT_OF_CENTER 0x8E 327 #define UAC3_CH_BACK_RIGHT_OF_CENTER 0x8F 328 #define UAC3_CH_BACK_WIDE_LEFT 0x90 329 #define UAC3_CH_BACK_WIDE_RIGHT 0x91 330 #define UAC3_CH_TOP_CENTER 0x92 331 #define UAC3_CH_TOP_FRONT_LEFT 0x93 332 #define UAC3_CH_TOP_FRONT_RIGHT 0x94 333 #define UAC3_CH_TOP_FRONT_CENTER 0x95 334 #define UAC3_CH_TOP_FRONT_LOC 0x96 335 #define UAC3_CH_TOP_FRONT_ROC 0x97 336 #define UAC3_CH_TOP_FRONT_WIDE_LEFT 0x98 337 #define UAC3_CH_TOP_FRONT_WIDE_RIGHT 0x99 338 #define UAC3_CH_TOP_SIDE_LEFT 0x9A 339 #define UAC3_CH_TOP_SIDE_RIGHT 0x9B 340 #define UAC3_CH_TOP_SURR_ARRAY_LEFT 0x9C 341 #define UAC3_CH_TOP_SURR_ARRAY_RIGHT 0x9D 342 #define UAC3_CH_TOP_BACK_LEFT 0x9E 343 #define UAC3_CH_TOP_BACK_RIGHT 0x9F 344 #define UAC3_CH_TOP_BACK_CENTER 0xA0 345 #define UAC3_CH_TOP_BACK_LOC 0xA1 346 #define UAC3_CH_TOP_BACK_ROC 0xA2 347 #define UAC3_CH_TOP_BACK_WIDE_LEFT 0xA3 348 #define UAC3_CH_TOP_BACK_WIDE_RIGHT 0xA4 349 #define UAC3_CH_BOTTOM_CENTER 0xA5 350 #define UAC3_CH_BOTTOM_FRONT_LEFT 0xA6 351 #define UAC3_CH_BOTTOM_FRONT_RIGHT 0xA7 352 #define UAC3_CH_BOTTOM_FRONT_CENTER 0xA8 353 #define UAC3_CH_BOTTOM_FRONT_LOC 0xA9 354 #define UAC3_CH_BOTTOM_FRONT_ROC 0xAA 355 #define UAC3_CH_BOTTOM_FRONT_WIDE_LEFT 0xAB 356 #define UAC3_CH_BOTTOM_FRONT_WIDE_RIGHT 0xAC 357 #define UAC3_CH_BOTTOM_SIDE_LEFT 0xAD 358 #define UAC3_CH_BOTTOM_SIDE_RIGHT 0xAE 359 #define UAC3_CH_BOTTOM_SURR_ARRAY_LEFT 0xAF 360 #define UAC3_CH_BOTTOM_SURR_ARRAY_RIGHT 0xB0 361 #define UAC3_CH_BOTTOM_BACK_LEFT 0xB1 362 #define UAC3_CH_BOTTOM_BACK_RIGHT 0xB2 363 #define UAC3_CH_BOTTOM_BACK_CENTER 0xB3 364 #define UAC3_CH_BOTTOM_BACK_LOC 0xB4 365 #define UAC3_CH_BOTTOM_BACK_ROC 0xB5 366 #define UAC3_CH_BOTTOM_BACK_WIDE_LEFT 0xB6 367 #define UAC3_CH_BOTTOM_BACK_WIDE_RIGHT 0xB7 368 #define UAC3_CH_LOW_FREQUENCY_EFFECTS 0xB8 369 #define UAC3_CH_LFE_LEFT 0xB9 370 #define UAC3_CH_LFE_RIGHT 0xBA 371 #define UAC3_CH_HEADPHONE_LEFT 0xBB 372 #define UAC3_CH_HEADPHONE_RIGHT 0xBC 373 374 /* A.15 AUDIO CLASS-SPECIFIC AC INTERFACE DESC 375 /* see audio.h for the rest, which is identica 376 #define UAC3_EXTENDED_TERMINAL 0x04 377 #define UAC3_MIXER_UNIT 0x05 378 #define UAC3_SELECTOR_UNIT 0x06 379 #define UAC3_FEATURE_UNIT 0x07 380 #define UAC3_EFFECT_UNIT 0x08 381 #define UAC3_PROCESSING_UNIT 0x09 382 #define UAC3_EXTENSION_UNIT 0x0a 383 #define UAC3_CLOCK_SOURCE 0x0b 384 #define UAC3_CLOCK_SELECTOR 0x0c 385 #define UAC3_CLOCK_MULTIPLIER 0x0d 386 #define UAC3_SAMPLE_RATE_CONVERTER 0x0e 387 #define UAC3_CONNECTORS 0x0f 388 #define UAC3_POWER_DOMAIN 0x10 389 390 /* A.20 PROCESSING UNIT PROCESS TYPES */ 391 #define UAC3_PROCESS_UNDEFINED 0x00 392 #define UAC3_PROCESS_UP_DOWNMIX 0x01 393 #define UAC3_PROCESS_STEREO_EXTENDER 0x02 394 #define UAC3_PROCESS_MULTI_FUNCTION 0x03 395 396 /* A.22 AUDIO CLASS-SPECIFIC REQUEST CODES */ 397 /* see audio-v2.h for the rest, which is ident 398 #define UAC3_CS_REQ_INTEN 399 #define UAC3_CS_REQ_STRING 400 #define UAC3_CS_REQ_HIGH_CAPABILITY_DESCRIPTOR 401 402 /* A.23.1 AUDIOCONTROL INTERFACE CONTROL SELEC 403 #define UAC3_AC_CONTROL_UNDEFINED 404 #define UAC3_AC_ACTIVE_INTERFACE_CONTROL 405 #define UAC3_AC_POWER_DOMAIN_CONTROL 406 407 /* A.23.5 TERMINAL CONTROL SELECTORS */ 408 #define UAC3_TE_UNDEFINED 409 #define UAC3_TE_INSERTION 410 #define UAC3_TE_OVERLOAD 411 #define UAC3_TE_UNDERFLOW 412 #define UAC3_TE_OVERFLOW 413 #define UAC3_TE_LATENCY 414 415 /* A.23.10 PROCESSING UNITS CONTROL SELECTROS 416 417 /* Up/Down Mixer */ 418 #define UAC3_UD_MODE_SELECT 419 420 /* Stereo Extender */ 421 #define UAC3_EXT_WIDTH_CONTROL 422 423 424 /* BADD predefined Unit/Terminal values */ 425 #define UAC3_BADD_IT_ID1 1 /* Input Te 426 #define UAC3_BADD_FU_ID2 2 /* Feature 427 #define UAC3_BADD_OT_ID3 3 /* Output T 428 #define UAC3_BADD_IT_ID4 4 /* Input Te 429 #define UAC3_BADD_FU_ID5 5 /* Feature 430 #define UAC3_BADD_OT_ID6 6 /* Output T 431 #define UAC3_BADD_FU_ID7 7 /* Feature 432 #define UAC3_BADD_MU_ID8 8 /* Mixer Un 433 #define UAC3_BADD_CS_ID9 9 /* Clock So 434 #define UAC3_BADD_PD_ID10 10 /* Power Do 435 #define UAC3_BADD_PD_ID11 11 /* Power Do 436 437 /* BADD wMaxPacketSize of AS endpoints */ 438 #define UAC3_BADD_EP_MAXPSIZE_SYNC_MONO_16 439 #define UAC3_BADD_EP_MAXPSIZE_ASYNC_MONO_16 440 #define UAC3_BADD_EP_MAXPSIZE_SYNC_MONO_24 441 #define UAC3_BADD_EP_MAXPSIZE_ASYNC_MONO_24 442 #define UAC3_BADD_EP_MAXPSIZE_SYNC_STEREO_16 443 #define UAC3_BADD_EP_MAXPSIZE_ASYNC_STEREO_16 444 #define UAC3_BADD_EP_MAXPSIZE_SYNC_STEREO_24 445 #define UAC3_BADD_EP_MAXPSIZE_ASYNC_STEREO_24 446 447 /* BADD sample rate is always fixed to 48kHz * 448 #define UAC3_BADD_SAMPLING_RATE 449 450 /* BADD power domains recovery times in 50us i 451 #define UAC3_BADD_PD_RECOVER_D1D0 452 #define UAC3_BADD_PD_RECOVER_D2D0 453 454 #endif /* __LINUX_USB_AUDIO_V3_H */ 455
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.