aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-03-11 15:13:20 -0500
committerTakashi Iwai <tiwai@suse.de>2010-03-12 06:19:49 -0500
commit7e847894039d7590321de306fca2b1ae58662f29 (patch)
tree09ff9fc43280cf3263a0501fec6b6feee50e8939 /include/linux/usb
parent36e632d61ae2febf55d5cd93b9e5ae0f5a5c6207 (diff)
linux/usb/audio.h: split header
- Split the audio.h file in two to clearly denote the differences between the standards. - Add many more defines to audio-v2.h. Most of them are not currently used. - Replaced a magic value with a proper define Signed-off-by: Daniel Mack <daniel@caiaq.de> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Cc: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/linux/usb')
-rw-r--r--include/linux/usb/audio-v2.h319
-rw-r--r--include/linux/usb/audio.h50
2 files changed, 326 insertions, 43 deletions
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h
new file mode 100644
index 000000000000..3b8560d233bd
--- /dev/null
+++ b/include/linux/usb/audio-v2.h
@@ -0,0 +1,319 @@
1/*
2 * Copyright (c) 2010 Daniel Mack <daniel@caiaq.de>
3 *
4 * This software is distributed under the terms of the GNU General Public
5 * License ("GPL") version 2, as published by the Free Software Foundation.
6 *
7 * This file holds USB constants and structures defined
8 * by the USB Device Class Definition for Audio Devices in version 2.0.
9 * Comments below reference relevant sections of the documents contained
10 * in http://www.usb.org/developers/devclass_docs/Audio2.0_final.zip
11 */
12
13#ifndef __LINUX_USB_AUDIO_V2_H
14#define __LINUX_USB_AUDIO_V2_H
15
16#include <linux/types.h>
17
18/* v1.0 and v2.0 of this standard have many things in common. For the rest
19 * of the definitions, please refer to audio.h */
20
21/* 4.7.2.1 Clock Source Descriptor */
22
23struct uac_clock_source_descriptor {
24 __u8 bLength;
25 __u8 bDescriptorType;
26 __u8 bDescriptorSubtype;
27 __u8 bClockID;
28 __u8 bmAttributes;
29 __u8 bmControls;
30 __u8 bAssocTerminal;
31 __u8 iClockSource;
32} __attribute__((packed));
33
34/* 4.7.2.2 Clock Source Descriptor */
35
36struct uac_clock_selector_descriptor {
37 __u8 bLength;
38 __u8 bDescriptorType;
39 __u8 bDescriptorSubtype;
40 __u8 bClockID;
41 __u8 bNrInPins;
42 __u8 bmControls;
43 __u8 baCSourceID[];
44} __attribute__((packed));
45
46/* 4.9.2 Class-Specific AS Interface Descriptor */
47
48struct uac_as_header_descriptor_v2 {
49 __u8 bLength;
50 __u8 bDescriptorType;
51 __u8 bDescriptorSubtype;
52 __u8 bTerminalLink;
53 __u8 bmControls;
54 __u8 bFormatType;
55 __u32 bmFormats;
56 __u8 bNrChannels;
57 __u32 bmChannelConfig;
58 __u8 iChannelNames;
59} __attribute__((packed));
60
61
62/* A.7 Audio Function Category Codes */
63#define UAC2_FUNCTION_SUBCLASS_UNDEFINED 0x00
64#define UAC2_FUNCTION_DESKTOP_SPEAKER 0x01
65#define UAC2_FUNCTION_HOME_THEATER 0x02
66#define UAC2_FUNCTION_MICROPHONE 0x03
67#define UAC2_FUNCTION_HEADSET 0x04
68#define UAC2_FUNCTION_TELEPHONE 0x05
69#define UAC2_FUNCTION_CONVERTER 0x06
70#define UAC2_FUNCTION_SOUND_RECORDER 0x07
71#define UAC2_FUNCTION_IO_BOX 0x08
72#define UAC2_FUNCTION_MUSICAL_INSTRUMENT 0x09
73#define UAC2_FUNCTION_PRO_AUDIO 0x0a
74#define UAC2_FUNCTION_AUDIO_VIDEO 0x0b
75#define UAC2_FUNCTION_CONTROL_PANEL 0x0c
76#define UAC2_FUNCTION_OTHER 0xff
77
78/* A.9 Audio Class-Specific AC Interface Descriptor Subtypes */
79/* see audio.h for the rest, which is identical to v1 */
80#define UAC2_EFFECT_UNIT 0x07
81#define UAC2_PROCESSING_UNIT_V2 0x08
82#define UAC2_EXTENSION_UNIT_V2 0x09
83#define UAC2_CLOCK_SOURCE 0x0a
84#define UAC2_CLOCK_SELECTOR 0x0b
85#define UAC2_CLOCK_MULTIPLIER 0x0c
86#define UAC2_SAMPLE_RATE_CONVERTER 0x0d
87
88/* A.10 Audio Class-Specific AS Interface Descriptor Subtypes */
89/* see audio.h for the rest, which is identical to v1 */
90#define UAC2_ENCODER 0x03
91#define UAC2_DECODER 0x04
92
93/* A.11 Effect Unit Effect Types */
94#define UAC2_EFFECT_UNDEFINED 0x00
95#define UAC2_EFFECT_PARAM_EQ 0x01
96#define UAC2_EFFECT_REVERB 0x02
97#define UAC2_EFFECT_MOD_DELAY 0x03
98#define UAC2_EFFECT_DYN_RANGE_COMP 0x04
99
100/* A.12 Processing Unit Process Types */
101#define UAC2_PROCESS_UNDEFINED 0x00
102#define UAC2_PROCESS_UP_DOWNMIX 0x01
103#define UAC2_PROCESS_DOLBY_PROLOCIC 0x02
104#define UAC2_PROCESS_STEREO_EXTENDER 0x03
105
106/* A.14 Audio Class-Specific Request Codes */
107#define UAC2_CS_CUR 0x01
108#define UAC2_CS_RANGE 0x02
109
110/* A.15 Encoder Type Codes */
111#define UAC2_ENCODER_UNDEFINED 0x00
112#define UAC2_ENCODER_OTHER 0x01
113#define UAC2_ENCODER_MPEG 0x02
114#define UAC2_ENCODER_AC3 0x03
115#define UAC2_ENCODER_WMA 0x04
116#define UAC2_ENCODER_DTS 0x05
117
118/* A.16 Decoder Type Codes */
119#define UAC2_DECODER_UNDEFINED 0x00
120#define UAC2_DECODER_OTHER 0x01
121#define UAC2_DECODER_MPEG 0x02
122#define UAC2_DECODER_AC3 0x03
123#define UAC2_DECODER_WMA 0x04
124#define UAC2_DECODER_DTS 0x05
125
126/* A.17.1 Clock Source Control Selectors */
127#define UAC2_CS_UNDEFINED 0x00
128#define UAC2_CS_CONTROL_SAM_FREQ 0x01
129#define UAC2_CS_CONTROL_CLOCK_VALID 0x02
130
131/* A.17.2 Clock Selector Control Selectors */
132#define UAC2_CX_UNDEFINED 0x00
133#define UAC2_CX_CLOCK_SELECTOR 0x01
134
135/* A.17.3 Clock Multiplier Control Selectors */
136#define UAC2_CM_UNDEFINED 0x00
137#define UAC2_CM_NUMERATOR 0x01
138#define UAC2_CM_DENOMINTATOR 0x02
139
140/* A.17.4 Terminal Control Selectors */
141#define UAC2_TE_UNDEFINED 0x00
142#define UAC2_TE_COPY_PROTECT 0x01
143#define UAC2_TE_CONNECTOR 0x02
144#define UAC2_TE_OVERLOAD 0x03
145#define UAC2_TE_CLUSTER 0x04
146#define UAC2_TE_UNDERFLOW 0x05
147#define UAC2_TE_OVERFLOW 0x06
148#define UAC2_TE_LATENCY 0x07
149
150/* A.17.5 Mixer Control Selectors */
151#define UAC2_MU_UNDEFINED 0x00
152#define UAC2_MU_MIXER 0x01
153#define UAC2_MU_CLUSTER 0x02
154#define UAC2_MU_UNDERFLOW 0x03
155#define UAC2_MU_OVERFLOW 0x04
156#define UAC2_MU_LATENCY 0x05
157
158/* A.17.6 Selector Control Selectors */
159#define UAC2_SU_UNDEFINED 0x00
160#define UAC2_SU_SELECTOR 0x01
161#define UAC2_SU_LATENCY 0x02
162
163/* A.17.7 Feature Unit Control Selectors */
164/* see audio.h for the rest, which is identical to v1 */
165#define UAC2_FU_INPUT_GAIN 0x0b
166#define UAC2_FU_INPUT_GAIN_PAD 0x0c
167#define UAC2_FU_PHASE_INVERTER 0x0d
168#define UAC2_FU_UNDERFLOW 0x0e
169#define UAC2_FU_OVERFLOW 0x0f
170#define UAC2_FU_LATENCY 0x10
171
172/* A.17.8.1 Parametric Equalizer Section Effect Unit Control Selectors */
173#define UAC2_PE_UNDEFINED 0x00
174#define UAC2_PE_ENABLE 0x01
175#define UAC2_PE_CENTERFREQ 0x02
176#define UAC2_PE_QFACTOR 0x03
177#define UAC2_PE_GAIN 0x04
178#define UAC2_PE_UNDERFLOW 0x05
179#define UAC2_PE_OVERFLOW 0x06
180#define UAC2_PE_LATENCY 0x07
181
182/* A.17.8.2 Reverberation Effect Unit Control Selectors */
183#define UAC2_RV_UNDEFINED 0x00
184#define UAC2_RV_ENABLE 0x01
185#define UAC2_RV_TYPE 0x02
186#define UAC2_RV_LEVEL 0x03
187#define UAC2_RV_TIME 0x04
188#define UAC2_RV_FEEDBACK 0x05
189#define UAC2_RV_PREDELAY 0x06
190#define UAC2_RV_DENSITY 0x07
191#define UAC2_RV_HIFREQ_ROLLOFF 0x08
192#define UAC2_RV_UNDERFLOW 0x09
193#define UAC2_RV_OVERFLOW 0x0a
194#define UAC2_RV_LATENCY 0x0b
195
196/* A.17.8.3 Modulation Delay Effect Control Selectors */
197#define UAC2_MD_UNDEFINED 0x00
198#define UAC2_MD_ENABLE 0x01
199#define UAC2_MD_BALANCE 0x02
200#define UAC2_MD_RATE 0x03
201#define UAC2_MD_DEPTH 0x04
202#define UAC2_MD_TIME 0x05
203#define UAC2_MD_FEEDBACK 0x06
204#define UAC2_MD_UNDERFLOW 0x07
205#define UAC2_MD_OVERFLOW 0x08
206#define UAC2_MD_LATENCY 0x09
207
208/* A.17.8.4 Dynamic Range Compressor Effect Unit Control Selectors */
209#define UAC2_DR_UNDEFINED 0x00
210#define UAC2_DR_ENABLE 0x01
211#define UAC2_DR_COMPRESSION_RATE 0x02
212#define UAC2_DR_MAXAMPL 0x03
213#define UAC2_DR_THRESHOLD 0x04
214#define UAC2_DR_ATTACK_TIME 0x05
215#define UAC2_DR_RELEASE_TIME 0x06
216#define UAC2_DR_UNDEFLOW 0x07
217#define UAC2_DR_OVERFLOW 0x08
218#define UAC2_DR_LATENCY 0x09
219
220/* A.17.9.1 Up/Down-mix Processing Unit Control Selectors */
221#define UAC2_UD_UNDEFINED 0x00
222#define UAC2_UD_ENABLE 0x01
223#define UAC2_UD_MODE_SELECT 0x02
224#define UAC2_UD_CLUSTER 0x03
225#define UAC2_UD_UNDERFLOW 0x04
226#define UAC2_UD_OVERFLOW 0x05
227#define UAC2_UD_LATENCY 0x06
228
229/* A.17.9.2 Dolby Prologic[tm] Processing Unit Control Selectors */
230#define UAC2_DP_UNDEFINED 0x00
231#define UAC2_DP_ENABLE 0x01
232#define UAC2_DP_MODE_SELECT 0x02
233#define UAC2_DP_CLUSTER 0x03
234#define UAC2_DP_UNDERFFLOW 0x04
235#define UAC2_DP_OVERFLOW 0x05
236#define UAC2_DP_LATENCY 0x06
237
238/* A.17.9.3 Stereo Expander Processing Unit Control Selectors */
239#define UAC2_ST_EXT_UNDEFINED 0x00
240#define UAC2_ST_EXT_ENABLE 0x01
241#define UAC2_ST_EXT_WIDTH 0x02
242#define UAC2_ST_EXT_UNDEFLOW 0x03
243#define UAC2_ST_EXT_OVERFLOW 0x04
244#define UAC2_ST_EXT_LATENCY 0x05
245
246/* A.17.10 Extension Unit Control Selectors */
247#define UAC2_XU_UNDEFINED 0x00
248#define UAC2_XU_ENABLE 0x01
249#define UAC2_XU_CLUSTER 0x02
250#define UAC2_XU_UNDERFLOW 0x03
251#define UAC2_XU_OVERFLOW 0x04
252#define UAC2_XU_LATENCY 0x05
253
254/* A.17.11 AudioStreaming Interface Control Selectors */
255#define UAC2_AS_UNDEFINED 0x00
256#define UAC2_AS_ACT_ALT_SETTING 0x01
257#define UAC2_AS_VAL_ALT_SETTINGS 0x02
258#define UAC2_AS_AUDIO_DATA_FORMAT 0x03
259
260/* A.17.12 Encoder Control Selectors */
261#define UAC2_EN_UNDEFINED 0x00
262#define UAC2_EN_BIT_RATE 0x01
263#define UAC2_EN_QUALITY 0x02
264#define UAC2_EN_VBR 0x03
265#define UAC2_EN_TYPE 0x04
266#define UAC2_EN_UNDERFLOW 0x05
267#define UAC2_EN_OVERFLOW 0x06
268#define UAC2_EN_ENCODER_ERROR 0x07
269#define UAC2_EN_PARAM1 0x08
270#define UAC2_EN_PARAM2 0x09
271#define UAC2_EN_PARAM3 0x0a
272#define UAC2_EN_PARAM4 0x0b
273#define UAC2_EN_PARAM5 0x0c
274#define UAC2_EN_PARAM6 0x0d
275#define UAC2_EN_PARAM7 0x0e
276#define UAC2_EN_PARAM8 0x0f
277
278/* A.17.13.1 MPEG Decoder Control Selectors */
279#define UAC2_MPEG_UNDEFINED 0x00
280#define UAC2_MPEG_DUAL_CHANNEL 0x01
281#define UAC2_MPEG_SECOND_STEREO 0x02
282#define UAC2_MPEG_MULTILINGUAL 0x03
283#define UAC2_MPEG_DYN_RANGE 0x04
284#define UAC2_MPEG_SCALING 0x05
285#define UAC2_MPEG_HILO_SCALING 0x06
286#define UAC2_MPEG_UNDERFLOW 0x07
287#define UAC2_MPEG_OVERFLOW 0x08
288#define UAC2_MPEG_DECODER_ERROR 0x09
289
290/* A17.13.2 AC3 Decoder Control Selectors */
291#define UAC2_AC3_UNDEFINED 0x00
292#define UAC2_AC3_MODE 0x01
293#define UAC2_AC3_DYN_RANGE 0x02
294#define UAC2_AC3_SCALING 0x03
295#define UAC2_AC3_HILO_SCALING 0x04
296#define UAC2_AC3_UNDERFLOW 0x05
297#define UAC2_AC3_OVERFLOW 0x06
298#define UAC2_AC3_DECODER_ERROR 0x07
299
300/* A17.13.3 WMA Decoder Control Selectors */
301#define UAC2_WMA_UNDEFINED 0x00
302#define UAC2_WMA_UNDERFLOW 0x01
303#define UAC2_WMA_OVERFLOW 0x02
304#define UAC2_WMA_DECODER_ERROR 0x03
305
306/* A17.13.4 DTS Decoder Control Selectors */
307#define UAC2_DTS_UNDEFINED 0x00
308#define UAC2_DTS_UNDERFLOW 0x01
309#define UAC2_DTS_OVERFLOW 0x02
310#define UAC2_DTS_DECODER_ERROR 0x03
311
312/* A17.14 Endpoint Control Selectors */
313#define UAC2_EP_CS_UNDEFINED 0x00
314#define UAC2_EP_CS_PITCH 0x01
315#define UAC2_EP_CS_DATA_OVERRUN 0x02
316#define UAC2_EP_CS_DATA_UNDERRUN 0x03
317
318#endif /* __LINUX_USB_AUDIO_V2_H */
319
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index 4d3e450e2b03..cdad728543ae 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -13,6 +13,9 @@
13 * Comments below reference relevant sections of that document: 13 * Comments below reference relevant sections of that document:
14 * 14 *
15 * http://www.usb.org/developers/devclass_docs/audio10.pdf 15 * http://www.usb.org/developers/devclass_docs/audio10.pdf
16 *
17 * Types and defines in this file are either specific to version 1.0 of
18 * this standard or common for newer versions.
16 */ 19 */
17 20
18#ifndef __LINUX_USB_AUDIO_H 21#ifndef __LINUX_USB_AUDIO_H
@@ -20,14 +23,15 @@
20 23
21#include <linux/types.h> 24#include <linux/types.h>
22 25
26/* bInterfaceProtocol values to denote the version of the standard used */
27#define UAC_VERSION_1 0x00
28#define UAC_VERSION_2 0x20
29
23/* A.2 Audio Interface Subclass Codes */ 30/* A.2 Audio Interface Subclass Codes */
24#define USB_SUBCLASS_AUDIOCONTROL 0x01 31#define USB_SUBCLASS_AUDIOCONTROL 0x01
25#define USB_SUBCLASS_AUDIOSTREAMING 0x02 32#define USB_SUBCLASS_AUDIOSTREAMING 0x02
26#define USB_SUBCLASS_MIDISTREAMING 0x03 33#define USB_SUBCLASS_MIDISTREAMING 0x03
27 34
28#define UAC_VERSION_1 0x00
29#define UAC_VERSION_2 0x20
30
31/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ 35/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */
32#define UAC_HEADER 0x01 36#define UAC_HEADER 0x01
33#define UAC_INPUT_TERMINAL 0x02 37#define UAC_INPUT_TERMINAL 0x02
@@ -38,15 +42,6 @@
38#define UAC_PROCESSING_UNIT_V1 0x07 42#define UAC_PROCESSING_UNIT_V1 0x07
39#define UAC_EXTENSION_UNIT_V1 0x08 43#define UAC_EXTENSION_UNIT_V1 0x08
40 44
41/* UAC v2.0 types */
42#define UAC_EFFECT_UNIT 0x07
43#define UAC_PROCESSING_UNIT_V2 0x08
44#define UAC_EXTENSION_UNIT_V2 0x09
45#define UAC_CLOCK_SOURCE 0x0a
46#define UAC_CLOCK_SELECTOR 0x0b
47#define UAC_CLOCK_MULTIPLIER 0x0c
48#define UAC_SAMPLE_RATE_CONVERTER 0x0d
49
50/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ 45/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */
51#define UAC_AS_GENERAL 0x01 46#define UAC_AS_GENERAL 0x01
52#define UAC_FORMAT_TYPE 0x02 47#define UAC_FORMAT_TYPE 0x02
@@ -78,10 +73,6 @@
78 73
79#define UAC_GET_STAT 0xff 74#define UAC_GET_STAT 0xff
80 75
81/* Audio class v2.0 handles all the parameter calls differently */
82#define UAC2_CS_CUR 0x01
83#define UAC2_CS_RANGE 0x02
84
85/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ 76/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */
86#define UAC_MS_HEADER 0x01 77#define UAC_MS_HEADER 0x01
87#define UAC_MIDI_IN_JACK 0x02 78#define UAC_MIDI_IN_JACK 0x02
@@ -200,19 +191,6 @@ struct uac_as_header_descriptor_v1 {
200 __le16 wFormatTag; /* The Audio Data Format */ 191 __le16 wFormatTag; /* The Audio Data Format */
201} __attribute__ ((packed)); 192} __attribute__ ((packed));
202 193
203struct uac_as_header_descriptor_v2 {
204 __u8 bLength;
205 __u8 bDescriptorType;
206 __u8 bDescriptorSubtype;
207 __u8 bTerminalLink;
208 __u8 bmControls;
209 __u8 bFormatType;
210 __u32 bmFormats;
211 __u8 bNrChannels;
212 __u32 bmChannelConfig;
213 __u8 iChannelNames;
214} __attribute__((packed));
215
216#define UAC_DT_AS_HEADER_SIZE 7 194#define UAC_DT_AS_HEADER_SIZE 7
217 195
218/* Formats - A.1.1 Audio Data Format Type I Codes */ 196/* Formats - A.1.1 Audio Data Format Type I Codes */
@@ -277,7 +255,6 @@ struct uac_format_type_i_ext_descriptor {
277 __u8 bSideBandProtocol; 255 __u8 bSideBandProtocol;
278} __attribute__((packed)); 256} __attribute__((packed));
279 257
280
281/* Formats - Audio Data Format Type I Codes */ 258/* Formats - Audio Data Format Type I Codes */
282 259
283#define UAC_FORMAT_TYPE_II_MPEG 0x1001 260#define UAC_FORMAT_TYPE_II_MPEG 0x1001
@@ -336,19 +313,6 @@ struct uac_iso_endpoint_descriptor {
336#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 313#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02
337#define UAC_EP_CS_ATTR_FILL_MAX 0x80 314#define UAC_EP_CS_ATTR_FILL_MAX 0x80
338 315
339/* Audio class v2.0: CLOCK_SOURCE descriptor */
340
341struct uac_clock_source_descriptor {
342 __u8 bLength;
343 __u8 bDescriptorType;
344 __u8 bDescriptorSubtype;
345 __u8 bClockID;
346 __u8 bmAttributes;
347 __u8 bmControls;
348 __u8 bAssocTerminal;
349 __u8 iClockSource;
350} __attribute__((packed));
351
352/* A.10.2 Feature Unit Control Selectors */ 316/* A.10.2 Feature Unit Control Selectors */
353 317
354struct uac_feature_unit_descriptor { 318struct uac_feature_unit_descriptor {