]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - sys/dev/sound/usb/uaudioreg.h
- Copy stable/9 to releng/9.2 as part of the 9.2-RELEASE cycle.
[FreeBSD/releng/9.2.git] / sys / dev / sound / usb / uaudioreg.h
1 /*      $NetBSD: uaudioreg.h,v 1.12 2004/11/05 19:08:29 kent Exp $      */
2 /* $FreeBSD$ */
3
4 /*-
5  * Copyright (c) 1999 The NetBSD Foundation, Inc.
6  * All rights reserved.
7  *
8  * This code is derived from software contributed to The NetBSD Foundation
9  * by Lennart Augustsson (lennart@augustsson.net) at
10  * Carlstedt Research & Technology.
11  *
12  * Redistribution and use in source and binary forms, with or without
13  * modification, are permitted provided that the following conditions
14  * are met:
15  * 1. Redistributions of source code must retain the above copyright
16  *    notice, this list of conditions and the following disclaimer.
17  * 2. Redistributions in binary form must reproduce the above copyright
18  *    notice, this list of conditions and the following disclaimer in the
19  *    documentation and/or other materials provided with the distribution.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
22  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
23  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
24  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
25  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  */
33
34 #ifndef _UAUDIOREG_H_
35 #define _UAUDIOREG_H_
36
37 #define UAUDIO_VERSION          0x0100
38 #define UAUDIO_VERSION_20       0x0200
39 #define UAUDIO_VERSION_30       0x0300
40
41 #define UAUDIO_PROTOCOL_20      0x20
42
43 #define UDESC_CS_UNDEFINED      0x20
44 #define UDESC_CS_DEVICE         0x21
45 #define UDESC_CS_CONFIG         0x22
46 #define UDESC_CS_STRING         0x23
47 #define UDESC_CS_INTERFACE      0x24
48 #define UDESC_CS_ENDPOINT       0x25
49
50 #define UDESCSUB_AC_HEADER      1
51 #define UDESCSUB_AC_INPUT       2
52 #define UDESCSUB_AC_OUTPUT      3
53 #define UDESCSUB_AC_MIXER       4
54 #define UDESCSUB_AC_SELECTOR    5
55 #define UDESCSUB_AC_FEATURE     6
56 #define UDESCSUB_AC_PROCESSING  7
57 #define UDESCSUB_AC_EXTENSION   8
58 /* ==== USB audio v2.0 ==== */
59 #define UDESCSUB_AC_EFFECT      7
60 #define UDESCSUB_AC_PROCESSING_V2 8
61 #define UDESCSUB_AC_EXTENSION_V2 9
62 #define UDESCSUB_AC_CLOCK_SRC   10
63 #define UDESCSUB_AC_CLOCK_SEL   11
64 #define UDESCSUB_AC_CLOCK_MUL   12
65 #define UDESCSUB_AC_SAMPLE_RT   13
66
67 /* These macros check if the endpoint descriptor has additional fields */
68 #define UEP_MINSIZE     7
69 #define UEP_HAS_REFRESH(ep)     ((ep)->bLength >= 8)
70 #define UEP_HAS_SYNCADDR(ep)    ((ep)->bLength >= 9)
71
72 /* The first fields are identical to struct usb_endpoint_descriptor */
73 typedef struct {
74         uByte   bLength;
75         uByte   bDescriptorType;
76         uByte   bEndpointAddress;
77         uByte   bmAttributes;
78         uWord   wMaxPacketSize;
79         uByte   bInterval;
80         /*
81          * The following two entries are only used by the Audio Class.
82          * And according to the specs the Audio Class is the only one
83          * allowed to extend the endpoint descriptor.
84          * Who knows what goes on in the minds of the people in the USB
85          * standardization?  :-(
86          */
87         uByte   bRefresh;
88         uByte   bSynchAddress;
89 } __packed usb_endpoint_descriptor_audio_t;
90
91 struct usb_audio_control_descriptor {
92         uByte   bLength;
93         uByte   bDescriptorType;
94         uByte   bDescriptorSubtype;
95         uWord   bcdADC;
96         uWord   wTotalLength;
97         uByte   bInCollection;
98         uByte   baInterfaceNr[1];
99 } __packed;
100
101 struct usb_audio_streaming_interface_descriptor {
102         uByte   bLength;
103         uByte   bDescriptorType;
104         uByte   bDescriptorSubtype;
105         uByte   bTerminalLink;
106         uByte   bDelay;
107         uWord   wFormatTag;
108 } __packed;
109
110 struct usb_audio_streaming_endpoint_descriptor {
111         uByte   bLength;
112         uByte   bDescriptorType;
113         uByte   bDescriptorSubtype;
114         uByte   bmAttributes;
115 #define UA_SED_FREQ_CONTROL     0x01
116 #define UA_SED_PITCH_CONTROL    0x02
117 #define UA_SED_MAXPACKETSONLY   0x80
118         uByte   bLockDelayUnits;
119         uWord   wLockDelay;
120 } __packed;
121
122 struct usb_audio_streaming_type1_descriptor {
123         uByte   bLength;
124         uByte   bDescriptorType;
125         uByte   bDescriptorSubtype;
126         uByte   bFormatType;
127         uByte   bNrChannels;
128         uByte   bSubFrameSize;
129         uByte   bBitResolution;
130         uByte   bSamFreqType;
131 #define UA_SAMP_CONTNUOUS 0
132         uByte   tSamFreq[0];
133 #define UA_GETSAMP(p, n) ((uint32_t)((((p)->tSamFreq[((n)*3)+0]) | \
134                           ((p)->tSamFreq[((n)*3)+1] << 8) | \
135                           ((p)->tSamFreq[((n)*3)+2] << 16))))
136 #define UA_SAMP_LO(p) UA_GETSAMP(p, 0)
137 #define UA_SAMP_HI(p) UA_GETSAMP(p, 1)
138 } __packed;
139
140 struct usb_audio_cluster {
141         uByte   bNrChannels;
142         uWord   wChannelConfig;
143 #define UA_CHANNEL_LEFT         0x0001
144 #define UA_CHANNEL_RIGHT        0x0002
145 #define UA_CHANNEL_CENTER       0x0004
146 #define UA_CHANNEL_LFE          0x0008
147 #define UA_CHANNEL_L_SURROUND   0x0010
148 #define UA_CHANNEL_R_SURROUND   0x0020
149 #define UA_CHANNEL_L_CENTER     0x0040
150 #define UA_CHANNEL_R_CENTER     0x0080
151 #define UA_CHANNEL_SURROUND     0x0100
152 #define UA_CHANNEL_L_SIDE       0x0200
153 #define UA_CHANNEL_R_SIDE       0x0400
154 #define UA_CHANNEL_TOP          0x0800
155         uByte   iChannelNames;
156 } __packed;
157
158 /* Shared by all units and terminals */
159 struct usb_audio_unit {
160         uByte   bLength;
161         uByte   bDescriptorType;
162         uByte   bDescriptorSubtype;
163         uByte   bUnitId;
164 };
165
166 /* UDESCSUB_AC_INPUT */
167 struct usb_audio_input_terminal {
168         uByte   bLength;
169         uByte   bDescriptorType;
170         uByte   bDescriptorSubtype;
171         uByte   bTerminalId;
172         uWord   wTerminalType;
173         uByte   bAssocTerminal;
174         uByte   bNrChannels;
175         uWord   wChannelConfig;
176         uByte   iChannelNames;
177 /*      uByte           iTerminal; */
178 } __packed;
179
180 /* UDESCSUB_AC_OUTPUT */
181 struct usb_audio_output_terminal {
182         uByte   bLength;
183         uByte   bDescriptorType;
184         uByte   bDescriptorSubtype;
185         uByte   bTerminalId;
186         uWord   wTerminalType;
187         uByte   bAssocTerminal;
188         uByte   bSourceId;
189         uByte   iTerminal;
190 } __packed;
191
192 /* UDESCSUB_AC_MIXER */
193 struct usb_audio_mixer_unit_0 {
194         uByte   bLength;
195         uByte   bDescriptorType;
196         uByte   bDescriptorSubtype;
197         uByte   bUnitId;
198         uByte   bNrInPins;
199         uByte   baSourceId[0];          /* [bNrInPins] */
200         /* struct usb_audio_mixer_unit_1 */
201 } __packed;
202 struct usb_audio_mixer_unit_1 {
203         uByte   bNrChannels;
204         uWord   wChannelConfig;
205         uByte   iChannelNames;
206         uByte   bmControls[0];          /* [see source code] */
207         /* uByte                iMixer; */
208 } __packed;
209
210 /* UDESCSUB_AC_SELECTOR */
211 struct usb_audio_selector_unit {
212         uByte   bLength;
213         uByte   bDescriptorType;
214         uByte   bDescriptorSubtype;
215         uByte   bUnitId;
216         uByte   bNrInPins;
217         uByte   baSourceId[0];          /* [bNrInPins] */
218         /* uByte        iSelector; */
219 } __packed;
220
221 /* UDESCSUB_AC_FEATURE */
222 struct usb_audio_feature_unit {
223         uByte   bLength;
224         uByte   bDescriptorType;
225         uByte   bDescriptorSubtype;
226         uByte   bUnitId;
227         uByte   bSourceId;
228         uByte   bControlSize;
229         uByte   bmaControls[0];         /* [bControlSize * x] */
230         /* uByte        iFeature; */
231 } __packed;
232
233 /* UDESCSUB_AC_PROCESSING */
234 struct usb_audio_processing_unit_0 {
235         uByte   bLength;
236         uByte   bDescriptorType;
237         uByte   bDescriptorSubtype;
238         uByte   bUnitId;
239         uWord   wProcessType;
240         uByte   bNrInPins;
241         uByte   baSourceId[0];          /* [bNrInPins] */
242         /* struct usb_audio_processing_unit_1 */
243 } __packed;
244 struct usb_audio_processing_unit_1 {
245         uByte   bNrChannels;
246         uWord   wChannelConfig;
247         uByte   iChannelNames;
248         uByte   bControlSize;
249         uByte   bmControls[0];          /* [bControlSize] */
250 #define UA_PROC_ENABLE_MASK 1
251 } __packed;
252
253 struct usb_audio_processing_unit_updown {
254         uByte   iProcessing;
255         uByte   bNrModes;
256         uWord   waModes[0];             /* [bNrModes] */
257 } __packed;
258
259 /* UDESCSUB_AC_EXTENSION */
260 struct usb_audio_extension_unit_0 {
261         uByte   bLength;
262         uByte   bDescriptorType;
263         uByte   bDescriptorSubtype;
264         uByte   bUnitId;
265         uWord   wExtensionCode;
266         uByte   bNrInPins;
267         uByte   baSourceId[0];          /* [bNrInPins] */
268         /* struct usb_audio_extension_unit_1 */
269 } __packed;
270
271 struct usb_audio_extension_unit_1 {
272         uByte   bNrChannels;
273         uWord   wChannelConfig;
274         uByte   iChannelNames;
275         uByte   bControlSize;
276         uByte   bmControls[0];          /* [bControlSize] */
277 #define UA_EXT_ENABLE_MASK 1
278 #define UA_EXT_ENABLE 1
279         /* uByte                iExtension; */
280 } __packed;
281
282 /* USB terminal types */
283 #define UAT_UNDEFINED           0x0100
284 #define UAT_STREAM              0x0101
285 #define UAT_VENDOR              0x01ff
286 /* input terminal types */
287 #define UATI_UNDEFINED          0x0200
288 #define UATI_MICROPHONE         0x0201
289 #define UATI_DESKMICROPHONE     0x0202
290 #define UATI_PERSONALMICROPHONE 0x0203
291 #define UATI_OMNIMICROPHONE     0x0204
292 #define UATI_MICROPHONEARRAY    0x0205
293 #define UATI_PROCMICROPHONEARR  0x0206
294 /* output terminal types */
295 #define UATO_UNDEFINED          0x0300
296 #define UATO_SPEAKER            0x0301
297 #define UATO_HEADPHONES         0x0302
298 #define UATO_DISPLAYAUDIO       0x0303
299 #define UATO_DESKTOPSPEAKER     0x0304
300 #define UATO_ROOMSPEAKER        0x0305
301 #define UATO_COMMSPEAKER        0x0306
302 #define UATO_SUBWOOFER          0x0307
303 /* bidir terminal types */
304 #define UATB_UNDEFINED          0x0400
305 #define UATB_HANDSET            0x0401
306 #define UATB_HEADSET            0x0402
307 #define UATB_SPEAKERPHONE       0x0403
308 #define UATB_SPEAKERPHONEESUP   0x0404
309 #define UATB_SPEAKERPHONEECANC  0x0405
310 /* telephony terminal types */
311 #define UATT_UNDEFINED          0x0500
312 #define UATT_PHONELINE          0x0501
313 #define UATT_TELEPHONE          0x0502
314 #define UATT_DOWNLINEPHONE      0x0503
315 /* external terminal types */
316 #define UATE_UNDEFINED          0x0600
317 #define UATE_ANALOGCONN         0x0601
318 #define UATE_DIGITALAUIFC       0x0602
319 #define UATE_LINECONN           0x0603
320 #define UATE_LEGACYCONN         0x0604
321 #define UATE_SPDIF              0x0605
322 #define UATE_1394DA             0x0606
323 #define UATE_1394DV             0x0607
324 /* embedded function terminal types */
325 #define UATF_UNDEFINED          0x0700
326 #define UATF_CALIBNOISE         0x0701
327 #define UATF_EQUNOISE           0x0702
328 #define UATF_CDPLAYER           0x0703
329 #define UATF_DAT                0x0704
330 #define UATF_DCC                0x0705
331 #define UATF_MINIDISK           0x0706
332 #define UATF_ANALOGTAPE         0x0707
333 #define UATF_PHONOGRAPH         0x0708
334 #define UATF_VCRAUDIO           0x0709
335 #define UATF_VIDEODISCAUDIO     0x070a
336 #define UATF_DVDAUDIO           0x070b
337 #define UATF_TVTUNERAUDIO       0x070c
338 #define UATF_SATELLITE          0x070d
339 #define UATF_CABLETUNER         0x070e
340 #define UATF_DSS                0x070f
341 #define UATF_RADIORECV          0x0710
342 #define UATF_RADIOXMIT          0x0711
343 #define UATF_MULTITRACK         0x0712
344 #define UATF_SYNTHESIZER        0x0713
345
346
347 #define SET_CUR 0x01
348 #define GET_CUR 0x81
349 #define SET_MIN 0x02
350 #define GET_MIN 0x82
351 #define SET_MAX 0x03
352 #define GET_MAX 0x83
353 #define SET_RES 0x04
354 #define GET_RES 0x84
355 #define SET_MEM 0x05
356 #define GET_MEM 0x85
357 #define GET_STAT 0xff
358
359 #define MUTE_CONTROL    0x01
360 #define VOLUME_CONTROL  0x02
361 #define BASS_CONTROL    0x03
362 #define MID_CONTROL     0x04
363 #define TREBLE_CONTROL  0x05
364 #define GRAPHIC_EQUALIZER_CONTROL       0x06
365 #define AGC_CONTROL     0x07
366 #define DELAY_CONTROL   0x08
367 #define BASS_BOOST_CONTROL 0x09
368 #define LOUDNESS_CONTROL 0x0a
369 /* ==== USB audio v2.0 ==== */
370 #define INPUT_GAIN_CONTROL 0x0b
371 #define INPUT_GAIN_PAD_CONTROL 0x0c
372 #define PHASE_INVERTER_CONTROL 0x0d
373 #define UNDERFLOW_CONTROL 0x0e
374 #define OVERFLOW_CONTROL 0x0f
375 #define LATENCY_CONTROL 0x10
376
377 #define FU_MASK(u) (1 << ((u)-1))
378
379 #define MASTER_CHAN     0
380
381 #define AS_GENERAL      1
382 #define FORMAT_TYPE     2
383 #define FORMAT_SPECIFIC 3
384 /* ==== USB audio v2.0 ==== */
385 #define FORMAT_ENCODER  3
386 #define FORMAT_DECODER  4
387
388 #define UA_FMT_PCM      1
389 #define UA_FMT_PCM8     2
390 #define UA_FMT_IEEE_FLOAT 3
391 #define UA_FMT_ALAW     4
392 #define UA_FMT_MULAW    5
393 #define UA_FMT_MPEG     0x1001
394 #define UA_FMT_AC3      0x1002
395
396 #define SAMPLING_FREQ_CONTROL   0x01
397 #define PITCH_CONTROL           0x02
398
399 #define FORMAT_TYPE_UNDEFINED 0
400 #define FORMAT_TYPE_I 1
401 #define FORMAT_TYPE_II 2
402 #define FORMAT_TYPE_III 3
403
404 #define UA_PROC_MASK(n) (1<< ((n)-1))
405 #define PROCESS_UNDEFINED               0
406 #define XX_ENABLE_CONTROL                       1
407 #define UPDOWNMIX_PROCESS               1
408 #define UD_ENABLE_CONTROL                       1
409 #define UD_MODE_SELECT_CONTROL                  2
410 #define DOLBY_PROLOGIC_PROCESS          2
411 #define DP_ENABLE_CONTROL                       1
412 #define DP_MODE_SELECT_CONTROL                  2
413 #define P3D_STEREO_EXTENDER_PROCESS     3
414 #define P3D_ENABLE_CONTROL                      1
415 #define P3D_SPACIOUSNESS_CONTROL                2
416 #define REVERBATION_PROCESS             4
417 #define RV_ENABLE_CONTROL                       1
418 #define RV_LEVEL_CONTROL                        2
419 #define RV_TIME_CONTROL                 3
420 #define RV_FEEDBACK_CONTROL                     4
421 #define CHORUS_PROCESS                  5
422 #define CH_ENABLE_CONTROL                       1
423 #define CH_LEVEL_CONTROL                        2
424 #define CH_RATE_CONTROL                 3
425 #define CH_DEPTH_CONTROL                        4
426 #define DYN_RANGE_COMP_PROCESS          6
427 #define DR_ENABLE_CONTROL                       1
428 #define DR_COMPRESSION_RATE_CONTROL             2
429 #define DR_MAXAMPL_CONTROL                      3
430 #define DR_THRESHOLD_CONTROL                    4
431 #define DR_ATTACK_TIME_CONTROL                  5
432 #define DR_RELEASE_TIME_CONTROL         6
433
434 /*------------------------------------------------------------------------*
435  * USB audio v2.0 definitions
436  *------------------------------------------------------------------------*/
437
438 struct usb_audio20_streaming_interface_descriptor {
439         uByte   bLength;
440         uByte   bDescriptorType;
441         uByte   bDescriptorSubtype;
442         uByte   bTerminalLink;
443         uByte   bmControls;
444         uByte   bFormatType;
445         uDWord  bmFormats;
446         uByte   bNrChannels;
447         uDWord  bmChannelConfig;
448         uByte   iChannelNames;
449 } __packed;
450
451 struct usb_audio20_encoder_descriptor {
452         uByte   bLength;
453         uByte   bDescriptorType;
454         uByte   bDescriptorSubtype;
455         uByte   bEncoderID;
456         uByte   bEncoder;
457         uDWord  bmControls;
458         uByte   iParam1;
459         uByte   iParam2;
460         uByte   iParam3;
461         uByte   iParam4;
462         uByte   iParam5;
463         uByte   iParam6;
464         uByte   iParam7;
465         uByte   iParam8;
466         uByte   iEncoder;
467 } __packed;
468
469 struct usb_audio20_streaming_endpoint_descriptor {
470         uByte   bLength;
471         uByte   bDescriptorType;
472         uByte   bDescriptorSubtype;
473         uByte   bmAttributes;
474 #define UA20_MPS_ONLY           0x80
475         uByte   bmControls;
476 #define UA20_PITCH_CONTROL_MASK 0x03
477 #define UA20_DATA_OVERRUN_MASK  0x0C
478 #define UA20_DATA_UNDERRUN_MASK 0x30
479         uByte   bLockDelayUnits;
480         uWord   wLockDelay;
481 } __packed;
482
483 struct usb_audio20_feedback_endpoint_descriptor {
484         uByte   bLength;
485         uByte   bDescriptorType;
486         uByte   bEndpointAddress;
487         uByte   bmAttributes;
488         uWord   wMaxPacketSize;
489         uByte   bInterval;
490 } __packed;
491
492 #define UA20_CS_CUR     0x01
493 #define UA20_CS_RANGE   0x02
494 #define UA20_CS_MEM     0x03
495
496 struct usb_audio20_cur1_parameter {
497         uByte   bCur;
498 } __packed;
499
500 struct usb_audio20_ctl1_range_sub {
501         uByte   bMIN;
502         uByte   bMAX;
503         uByte   bRES;
504 } __packed;
505
506 struct usb_audio20_ctl1_range {
507         uWord   wNumSubRanges;
508         struct usb_audio20_ctl1_range_sub sub[1];
509 } __packed;
510
511 struct usb_audio20_cur2_parameter {
512         uWord   wCur;
513 } __packed;
514
515 struct usb_audio20_ctl2_range_sub {
516         uWord   wMIN;
517         uWord   wMAX;
518         uWord   wRES;
519 } __packed;
520
521 struct usb_audio20_ctl2_range {
522         uWord   wNumSubRanges;
523         struct usb_audio20_ctl2_range_sub sub[1];
524 } __packed;
525
526 struct usb_audio20_cur4_parameter {
527         uDWord  dCur;
528 } __packed;
529
530 struct usb_audio20_ctl4_range_sub {
531         uDWord  dMIN;
532         uDWord  dMAX;
533         uDWord  dRES;
534 } __packed;
535
536 struct usb_audio20_ctl4_range {
537         uWord   wNumSubRanges;
538         struct usb_audio20_ctl4_range_sub sub[1];
539 } __packed;
540
541 struct usb_audio20_cc_cluster_descriptor {
542         uByte   bNrChannels;
543         uDWord  bmChannelConfig;
544         uByte   iChannelNames;
545 } __packed;
546
547 struct usb_audio20_streaming_type1_descriptor {
548         uByte   bLength;
549         uByte   bDescriptorType;
550         uByte   bDescriptorSubtype;
551         uByte   bFormatType;
552         uByte   bSubslotSize;
553         uByte   bBitResolution;
554 } __packed;
555
556 #define UA20_EERROR_NONE        0
557 #define UA20_EERROR_MEMORY      1
558 #define UA20_EERROR_BANDWIDTH   2
559 #define UA20_EERROR_CPU         3
560 #define UA20_EERROR_FORMATFR_ER 4
561 #define UA20_EERROR_FORMATFR_SM 5
562 #define UA20_EERROR_FORMATFR_LG 6
563 #define UA20_EERROR_DATAFORMAT  7
564 #define UA20_EERROR_NUMCHANNELS 8
565 #define UA20_EERROR_SAMPLERATE  9
566 #define UA20_EERROR_BITRATE     10
567 #define UA20_EERROR_PARAM       11
568 #define UA20_EERROR_NREADY      12
569 #define UA20_EERROR_BUSY        13
570
571 struct usb_audio20_cc_alt_setting {
572         uByte   bControlSize;
573         uDWord  bmValidAltSettings;
574 } __packed;
575
576 struct usb_audio20_interrupt_message {
577         uByte   bInfo;
578         uByte   bAttribute;
579         uDWord  wValue;
580         uDWord  wIndex;
581 } __packed;
582
583 /* UDESCSUB_AC_CLOCK_SRC */
584 struct usb_audio20_clock_source_unit {
585         uByte   bLength;
586         uByte   bDescriptorType;
587         uByte   bDescriptorSubtype;
588         uByte   bClockId;
589         uByte   bmAttributes;
590         uByte   bmControls;
591         uByte   bAssocTerminal;
592         uByte   iClockSource;
593 } __packed;
594
595 /* UDESCSUB_AC_CLOCK_SEL */
596 struct usb_audio20_clock_selector_unit_0 {
597         uByte   bLength;
598         uByte   bDescriptorType;
599         uByte   bDescriptorSubtype;
600         uByte   bClockId;
601         uByte   bNrInPins;
602         uByte   baCSourceId[0];
603 } __packed;
604
605 struct usb_audio20_clock_selector_unit_1 {
606         uByte   bmControls;
607         uByte   iClockSelector;
608 } __packed;
609
610 /* UDESCSUB_AC_CLOCK_MUL */
611 struct usb_audio20_clock_multiplier_unit {
612         uByte   bLength;
613         uByte   bDescriptorType;
614         uByte   bDescriptorSubtype;
615         uByte   bClockId;
616         uByte   bCSourceId;
617         uByte   bmControls;
618         uByte   iClockMultiplier;
619 } __packed;
620
621 /* UDESCSUB_AC_INPUT */
622 struct usb_audio20_input_terminal {
623         uByte   bLength;
624         uByte   bDescriptorType;
625         uByte   bDescriptorSubtype;
626         uByte   bTerminalId;
627         uWord   wTerminalType;
628         uByte   bAssocTerminal;
629         uByte   bCSourceId;
630         uByte   bNrChannels;
631         uDWord  bmChannelConfig;
632         uByte   iCHannelNames;
633         uWord   bmControls;
634         uByte   iTerminal;
635 } __packed;
636
637 /* UDESCSUB_AC_OUTPUT */
638 struct usb_audio20_output_terminal {
639         uByte   bLength;
640         uByte   bDescriptorType;
641         uByte   bDescriptorSubtype;
642         uByte   bTerminalId;
643         uWord   wTerminalType;
644         uByte   bAssocTerminal;
645         uByte   bSourceId;
646         uByte   bCSourceId;
647         uWord   bmControls;
648         uByte   iTerminal;
649 } __packed;
650
651 /* UDESCSUB_AC_MIXER */
652 struct usb_audio20_mixer_unit_0 {
653         uByte   bLength;
654         uByte   bDescriptorType;
655         uByte   bDescriptorSubtype;
656         uByte   bUnitId;
657         uByte   bNrInPins;
658         uByte   baSourceId[0];
659         /* struct usb_audio20_mixer_unit_1 */
660 } __packed;
661
662 struct usb_audio20_mixer_unit_1 {
663         uByte   bNrChannels;
664         uDWord  bmChannelConfig;
665         uByte   iChannelNames;
666         uByte   bmControls[0];
667         /* uByte        iMixer; */
668 } __packed;
669
670 /* UDESCSUB_AC_SELECTOR */
671 struct usb_audio20_selector_unit {
672         uByte   bLength;
673         uByte   bDescriptorType;
674         uByte   bDescriptorSubtype;
675         uByte   bUnitId;
676         uByte   bNrInPins;
677         uByte   baSourceId[0];
678         /* uByte        iSelector; */
679 } __packed;
680
681 /* UDESCSUB_AC_FEATURE */
682 struct usb_audio20_feature_unit {
683         uByte   bLength;
684         uByte   bDescriptorType;
685         uByte   bDescriptorSubtype;
686         uByte   bUnitId;
687         uByte   bSourceId;
688         uDWord  bmaControls[0];
689         /* uByte        iFeature; */
690 } __packed;
691
692 /* UDESCSUB_AC_SAMPLE_RT */
693 struct usb_audio20_sample_rate_unit {
694         uByte   bLength;
695         uByte   bDescriptorType;
696         uByte   bDescriptorSubtype;
697         uByte   bUnitId;
698         uByte   bSourceId;
699         uByte   bSourceInId;
700         uByte   bSourceOutId;
701         uByte   iSrc;
702 } __packed;
703
704 /* UDESCSUB_AC_EFFECT */
705 struct usb_audio20_effect_unit {
706         uByte   bLength;
707         uByte   bDescriptorType;
708         uByte   bDescriptorSubtype;
709         uByte   bUnitId;
710         uWord   wEffectType;
711         uByte   bSourceId;
712         uDWord  bmaControls[0];
713         uByte   iEffects;
714 } __packed;
715
716 /* UDESCSUB_AC_PROCESSING_V2 */
717 struct usb_audio20_processing_unit_0 {
718         uByte   bLength;
719         uByte   bDescriptorType;
720         uByte   bDescriptorSubtype;
721         uByte   bUnitId;
722         uWord   wProcessType;
723         uByte   bNrInPins;
724         uByte   baSourceId[0];          /* [bNrInPins] */
725 } __packed;
726
727 struct usb_audio20_processing_unit_1 {
728         uByte   bNrChannels;
729         uDWord  bmChannelConfig;
730         uByte   iChannelNames;
731         uWord   bmControls;
732         uByte   iProcessing;
733 } __packed;
734
735 /* UDESCSUB_AC_EXTENSION_V2 */
736 struct usb_audio20_extension_unit_0 {
737         uByte   bLength;
738         uByte   bDescriptorType;
739         uByte   bDescriptorSubtype;
740         uByte   bUnitId;
741         uWord   wExtensionCode;
742         uByte   bNrInPins;
743         uByte   baSourceId[0];
744 } __packed;
745
746 struct usb_audio20_extension_unit_1 {
747         uByte   bNrChannels;
748         uDWord  bmChannelConfig;
749         uByte   iChannelNames;
750         uByte   bmControls;
751         uByte   iExtension;
752 } __packed;
753
754 struct usb_audio20_cluster {
755         uByte   bNrChannels;
756         uDWord  bmChannelConfig;
757         uByte   iChannelNames;
758 } __packed;
759
760 #define UA20_TF_UNDEFINED               0x00
761 #define UA20_TF_DESKTOP_SPEAKER         0x01
762 #define UA20_TF_HOME_THEATER            0x02
763 #define UA20_TF_MICROPHONE              0x03
764 #define UA20_TF_HEADSET                 0x04
765 #define UA20_TF_TELEPHONE               0x05
766 #define UA20_TF_CONVERTER               0x06
767 #define UA20_TF_SOUND_RECORDER          0x07
768 #define UA20_TF_IO_BOX                  0x08
769 #define UA20_TF_MUSICAL_INSTRUMENT      0x09
770 #define UA20_TF_PRO_AUDIO               0x0A
771 #define UA20_TF_AV                      0x0B
772 #define UA20_TF_CONTROL_PANEL           0x0C
773 #define UA20_TF_OTHER                   0xFF
774
775 #define UA20_CS_SAM_FREQ_CONTROL        0x01
776 #define UA20_CS_CLOCK_VALID_CONTROL     0x02
777
778 #define UA20_TE_COPY_PROTECT_CONTROL    0x01
779 #define UA20_TE_CONNECTOR_CONTROL       0x02
780 #define UA20_TE_OVERLOAD_CONTROL        0x03
781 #define UA20_TE_CLUSTER_CONTROL         0x04
782 #define UA20_TE_UNDERFLOW_CONTROL       0x05
783 #define UA20_TE_OVERFLOW_CONTROL        0x06
784 #define UA20_TE_LATENCY_CONTROL         0x07
785
786 #define UA20_MU_MIXER_CONTROL           0x01
787 #define UA20_MU_CLUSTER_CONTROL         0x02
788 #define UA20_MU_UNDERFLOW_CONTROL       0x03
789 #define UA20_MU_OVERFLOW_CONTROL        0x04
790 #define UA20_MU_LATENCY_CONTROL         0x05
791
792 #define UA20_FMT_PCM    (1U << 0)
793 #define UA20_FMT_PCM8   (1U << 1)
794 #define UA20_FMT_FLOAT  (1U << 2)
795 #define UA20_FMT_ALAW   (1U << 3)
796 #define UA20_FMT_MULAW  (1U << 4)
797 #define UA20_FMT_RAW    (1U << 31)
798
799 #endif                                  /* _UAUDIOREG_H_ */