diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-20 12:41:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-05-20 12:41:44 -0400 |
commit | 7f06a8b26aba1dc03b42272dc0089a800372c575 (patch) | |
tree | 7c67198f83d069eb13fd417e022d111b7e4c82a1 /include/linux/usb | |
parent | c3ad33c9bcb6616999953af76f16318120fe3691 (diff) | |
parent | d71f4cece4bd97d05592836202fc04ff2e7817e3 (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (250 commits)
ALSA: hda: Storage class should be before const qualifier
ASoC: tpa6130a2: Remove CPVSS and HPVdd supplies
ASoC: tpa6130a2: Define output pins with SND_SOC_DAPM_OUTPUT
ASoC: sdp4430 - add sdp4430 pcm ops to DAI.
ASoC: TWL6040: Enable earphone path in codec
ASoC: SDP4430: Add support for Earphone speaker
ASoC: SDP4430: Add sdp4430 machine driver
ASoC: tlv320dac33: Avoid powering off while in BIAS_OFF
ASoC: tlv320dac33: Use dev_dbg in dac33_hard_power function
ALSA: sound/pci/asihpi: Use kzalloc
ALSA: hdmi - dont fail on extra nodes
ALSA: intelhdmi - add id for the CougarPoint chipset
ALSA: intelhdmi - user friendly codec name
ALSA: intelhdmi - add dependency on SND_DYNAMIC_MINORS
ALSA: asihpi: incorrect range check
ALSA: asihpi: testing the wrong variable
ALSA: es1688: add pedantic range checks
ARM: McBSP: Add support for omap4 in McBSP driver
ARM: McBSP: Fix request for irq in OMAP4
OMAP: McBSP: Add 32-bit mode support
...
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/audio-v2.h | 378 | ||||
-rw-r--r-- | include/linux/usb/audio.h | 227 |
2 files changed, 551 insertions, 54 deletions
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h new file mode 100644 index 000000000000..2389f93a28b5 --- /dev/null +++ b/include/linux/usb/audio-v2.h | |||
@@ -0,0 +1,378 @@ | |||
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 | |||
23 | struct 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 | |||
36 | struct 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.7.2.4 Input terminal descriptor */ | ||
47 | |||
48 | struct uac2_input_terminal_descriptor { | ||
49 | __u8 bLength; | ||
50 | __u8 bDescriptorType; | ||
51 | __u8 bDescriptorSubtype; | ||
52 | __u8 bTerminalID; | ||
53 | __u16 wTerminalType; | ||
54 | __u8 bAssocTerminal; | ||
55 | __u8 bCSourceID; | ||
56 | __u8 bNrChannels; | ||
57 | __u32 bmChannelConfig; | ||
58 | __u8 iChannelNames; | ||
59 | __u16 bmControls; | ||
60 | __u8 iTerminal; | ||
61 | } __attribute__((packed)); | ||
62 | |||
63 | /* 4.7.2.5 Output terminal descriptor */ | ||
64 | |||
65 | struct uac2_output_terminal_descriptor { | ||
66 | __u8 bLength; | ||
67 | __u8 bDescriptorType; | ||
68 | __u8 bDescriptorSubtype; | ||
69 | __u8 bTerminalID; | ||
70 | __u16 wTerminalType; | ||
71 | __u8 bAssocTerminal; | ||
72 | __u8 bSourceID; | ||
73 | __u8 bCSourceID; | ||
74 | __u16 bmControls; | ||
75 | __u8 iTerminal; | ||
76 | } __attribute__((packed)); | ||
77 | |||
78 | |||
79 | |||
80 | /* 4.7.2.8 Feature Unit Descriptor */ | ||
81 | |||
82 | struct uac2_feature_unit_descriptor { | ||
83 | __u8 bLength; | ||
84 | __u8 bDescriptorType; | ||
85 | __u8 bDescriptorSubtype; | ||
86 | __u8 bUnitID; | ||
87 | __u8 bSourceID; | ||
88 | /* bmaControls is actually u32, | ||
89 | * but u8 is needed for the hybrid parser */ | ||
90 | __u8 bmaControls[0]; /* variable length */ | ||
91 | } __attribute__((packed)); | ||
92 | |||
93 | /* 4.9.2 Class-Specific AS Interface Descriptor */ | ||
94 | |||
95 | struct uac_as_header_descriptor_v2 { | ||
96 | __u8 bLength; | ||
97 | __u8 bDescriptorType; | ||
98 | __u8 bDescriptorSubtype; | ||
99 | __u8 bTerminalLink; | ||
100 | __u8 bmControls; | ||
101 | __u8 bFormatType; | ||
102 | __u32 bmFormats; | ||
103 | __u8 bNrChannels; | ||
104 | __u32 bmChannelConfig; | ||
105 | __u8 iChannelNames; | ||
106 | } __attribute__((packed)); | ||
107 | |||
108 | /* 6.1 Interrupt Data Message */ | ||
109 | |||
110 | #define UAC2_INTERRUPT_DATA_MSG_VENDOR (1 << 0) | ||
111 | #define UAC2_INTERRUPT_DATA_MSG_EP (1 << 1) | ||
112 | |||
113 | struct uac2_interrupt_data_msg { | ||
114 | __u8 bInfo; | ||
115 | __u8 bAttribute; | ||
116 | __le16 wValue; | ||
117 | __le16 wIndex; | ||
118 | } __attribute__((packed)); | ||
119 | |||
120 | /* A.7 Audio Function Category Codes */ | ||
121 | #define UAC2_FUNCTION_SUBCLASS_UNDEFINED 0x00 | ||
122 | #define UAC2_FUNCTION_DESKTOP_SPEAKER 0x01 | ||
123 | #define UAC2_FUNCTION_HOME_THEATER 0x02 | ||
124 | #define UAC2_FUNCTION_MICROPHONE 0x03 | ||
125 | #define UAC2_FUNCTION_HEADSET 0x04 | ||
126 | #define UAC2_FUNCTION_TELEPHONE 0x05 | ||
127 | #define UAC2_FUNCTION_CONVERTER 0x06 | ||
128 | #define UAC2_FUNCTION_SOUND_RECORDER 0x07 | ||
129 | #define UAC2_FUNCTION_IO_BOX 0x08 | ||
130 | #define UAC2_FUNCTION_MUSICAL_INSTRUMENT 0x09 | ||
131 | #define UAC2_FUNCTION_PRO_AUDIO 0x0a | ||
132 | #define UAC2_FUNCTION_AUDIO_VIDEO 0x0b | ||
133 | #define UAC2_FUNCTION_CONTROL_PANEL 0x0c | ||
134 | #define UAC2_FUNCTION_OTHER 0xff | ||
135 | |||
136 | /* A.9 Audio Class-Specific AC Interface Descriptor Subtypes */ | ||
137 | /* see audio.h for the rest, which is identical to v1 */ | ||
138 | #define UAC2_EFFECT_UNIT 0x07 | ||
139 | #define UAC2_PROCESSING_UNIT_V2 0x08 | ||
140 | #define UAC2_EXTENSION_UNIT_V2 0x09 | ||
141 | #define UAC2_CLOCK_SOURCE 0x0a | ||
142 | #define UAC2_CLOCK_SELECTOR 0x0b | ||
143 | #define UAC2_CLOCK_MULTIPLIER 0x0c | ||
144 | #define UAC2_SAMPLE_RATE_CONVERTER 0x0d | ||
145 | |||
146 | /* A.10 Audio Class-Specific AS Interface Descriptor Subtypes */ | ||
147 | /* see audio.h for the rest, which is identical to v1 */ | ||
148 | #define UAC2_ENCODER 0x03 | ||
149 | #define UAC2_DECODER 0x04 | ||
150 | |||
151 | /* A.11 Effect Unit Effect Types */ | ||
152 | #define UAC2_EFFECT_UNDEFINED 0x00 | ||
153 | #define UAC2_EFFECT_PARAM_EQ 0x01 | ||
154 | #define UAC2_EFFECT_REVERB 0x02 | ||
155 | #define UAC2_EFFECT_MOD_DELAY 0x03 | ||
156 | #define UAC2_EFFECT_DYN_RANGE_COMP 0x04 | ||
157 | |||
158 | /* A.12 Processing Unit Process Types */ | ||
159 | #define UAC2_PROCESS_UNDEFINED 0x00 | ||
160 | #define UAC2_PROCESS_UP_DOWNMIX 0x01 | ||
161 | #define UAC2_PROCESS_DOLBY_PROLOCIC 0x02 | ||
162 | #define UAC2_PROCESS_STEREO_EXTENDER 0x03 | ||
163 | |||
164 | /* A.14 Audio Class-Specific Request Codes */ | ||
165 | #define UAC2_CS_CUR 0x01 | ||
166 | #define UAC2_CS_RANGE 0x02 | ||
167 | #define UAC2_CS_MEM 0x03 | ||
168 | |||
169 | /* A.15 Encoder Type Codes */ | ||
170 | #define UAC2_ENCODER_UNDEFINED 0x00 | ||
171 | #define UAC2_ENCODER_OTHER 0x01 | ||
172 | #define UAC2_ENCODER_MPEG 0x02 | ||
173 | #define UAC2_ENCODER_AC3 0x03 | ||
174 | #define UAC2_ENCODER_WMA 0x04 | ||
175 | #define UAC2_ENCODER_DTS 0x05 | ||
176 | |||
177 | /* A.16 Decoder Type Codes */ | ||
178 | #define UAC2_DECODER_UNDEFINED 0x00 | ||
179 | #define UAC2_DECODER_OTHER 0x01 | ||
180 | #define UAC2_DECODER_MPEG 0x02 | ||
181 | #define UAC2_DECODER_AC3 0x03 | ||
182 | #define UAC2_DECODER_WMA 0x04 | ||
183 | #define UAC2_DECODER_DTS 0x05 | ||
184 | |||
185 | /* A.17.1 Clock Source Control Selectors */ | ||
186 | #define UAC2_CS_UNDEFINED 0x00 | ||
187 | #define UAC2_CS_CONTROL_SAM_FREQ 0x01 | ||
188 | #define UAC2_CS_CONTROL_CLOCK_VALID 0x02 | ||
189 | |||
190 | /* A.17.2 Clock Selector Control Selectors */ | ||
191 | #define UAC2_CX_UNDEFINED 0x00 | ||
192 | #define UAC2_CX_CLOCK_SELECTOR 0x01 | ||
193 | |||
194 | /* A.17.3 Clock Multiplier Control Selectors */ | ||
195 | #define UAC2_CM_UNDEFINED 0x00 | ||
196 | #define UAC2_CM_NUMERATOR 0x01 | ||
197 | #define UAC2_CM_DENOMINTATOR 0x02 | ||
198 | |||
199 | /* A.17.4 Terminal Control Selectors */ | ||
200 | #define UAC2_TE_UNDEFINED 0x00 | ||
201 | #define UAC2_TE_COPY_PROTECT 0x01 | ||
202 | #define UAC2_TE_CONNECTOR 0x02 | ||
203 | #define UAC2_TE_OVERLOAD 0x03 | ||
204 | #define UAC2_TE_CLUSTER 0x04 | ||
205 | #define UAC2_TE_UNDERFLOW 0x05 | ||
206 | #define UAC2_TE_OVERFLOW 0x06 | ||
207 | #define UAC2_TE_LATENCY 0x07 | ||
208 | |||
209 | /* A.17.5 Mixer Control Selectors */ | ||
210 | #define UAC2_MU_UNDEFINED 0x00 | ||
211 | #define UAC2_MU_MIXER 0x01 | ||
212 | #define UAC2_MU_CLUSTER 0x02 | ||
213 | #define UAC2_MU_UNDERFLOW 0x03 | ||
214 | #define UAC2_MU_OVERFLOW 0x04 | ||
215 | #define UAC2_MU_LATENCY 0x05 | ||
216 | |||
217 | /* A.17.6 Selector Control Selectors */ | ||
218 | #define UAC2_SU_UNDEFINED 0x00 | ||
219 | #define UAC2_SU_SELECTOR 0x01 | ||
220 | #define UAC2_SU_LATENCY 0x02 | ||
221 | |||
222 | /* A.17.7 Feature Unit Control Selectors */ | ||
223 | /* see audio.h for the rest, which is identical to v1 */ | ||
224 | #define UAC2_FU_INPUT_GAIN 0x0b | ||
225 | #define UAC2_FU_INPUT_GAIN_PAD 0x0c | ||
226 | #define UAC2_FU_PHASE_INVERTER 0x0d | ||
227 | #define UAC2_FU_UNDERFLOW 0x0e | ||
228 | #define UAC2_FU_OVERFLOW 0x0f | ||
229 | #define UAC2_FU_LATENCY 0x10 | ||
230 | |||
231 | /* A.17.8.1 Parametric Equalizer Section Effect Unit Control Selectors */ | ||
232 | #define UAC2_PE_UNDEFINED 0x00 | ||
233 | #define UAC2_PE_ENABLE 0x01 | ||
234 | #define UAC2_PE_CENTERFREQ 0x02 | ||
235 | #define UAC2_PE_QFACTOR 0x03 | ||
236 | #define UAC2_PE_GAIN 0x04 | ||
237 | #define UAC2_PE_UNDERFLOW 0x05 | ||
238 | #define UAC2_PE_OVERFLOW 0x06 | ||
239 | #define UAC2_PE_LATENCY 0x07 | ||
240 | |||
241 | /* A.17.8.2 Reverberation Effect Unit Control Selectors */ | ||
242 | #define UAC2_RV_UNDEFINED 0x00 | ||
243 | #define UAC2_RV_ENABLE 0x01 | ||
244 | #define UAC2_RV_TYPE 0x02 | ||
245 | #define UAC2_RV_LEVEL 0x03 | ||
246 | #define UAC2_RV_TIME 0x04 | ||
247 | #define UAC2_RV_FEEDBACK 0x05 | ||
248 | #define UAC2_RV_PREDELAY 0x06 | ||
249 | #define UAC2_RV_DENSITY 0x07 | ||
250 | #define UAC2_RV_HIFREQ_ROLLOFF 0x08 | ||
251 | #define UAC2_RV_UNDERFLOW 0x09 | ||
252 | #define UAC2_RV_OVERFLOW 0x0a | ||
253 | #define UAC2_RV_LATENCY 0x0b | ||
254 | |||
255 | /* A.17.8.3 Modulation Delay Effect Control Selectors */ | ||
256 | #define UAC2_MD_UNDEFINED 0x00 | ||
257 | #define UAC2_MD_ENABLE 0x01 | ||
258 | #define UAC2_MD_BALANCE 0x02 | ||
259 | #define UAC2_MD_RATE 0x03 | ||
260 | #define UAC2_MD_DEPTH 0x04 | ||
261 | #define UAC2_MD_TIME 0x05 | ||
262 | #define UAC2_MD_FEEDBACK 0x06 | ||
263 | #define UAC2_MD_UNDERFLOW 0x07 | ||
264 | #define UAC2_MD_OVERFLOW 0x08 | ||
265 | #define UAC2_MD_LATENCY 0x09 | ||
266 | |||
267 | /* A.17.8.4 Dynamic Range Compressor Effect Unit Control Selectors */ | ||
268 | #define UAC2_DR_UNDEFINED 0x00 | ||
269 | #define UAC2_DR_ENABLE 0x01 | ||
270 | #define UAC2_DR_COMPRESSION_RATE 0x02 | ||
271 | #define UAC2_DR_MAXAMPL 0x03 | ||
272 | #define UAC2_DR_THRESHOLD 0x04 | ||
273 | #define UAC2_DR_ATTACK_TIME 0x05 | ||
274 | #define UAC2_DR_RELEASE_TIME 0x06 | ||
275 | #define UAC2_DR_UNDEFLOW 0x07 | ||
276 | #define UAC2_DR_OVERFLOW 0x08 | ||
277 | #define UAC2_DR_LATENCY 0x09 | ||
278 | |||
279 | /* A.17.9.1 Up/Down-mix Processing Unit Control Selectors */ | ||
280 | #define UAC2_UD_UNDEFINED 0x00 | ||
281 | #define UAC2_UD_ENABLE 0x01 | ||
282 | #define UAC2_UD_MODE_SELECT 0x02 | ||
283 | #define UAC2_UD_CLUSTER 0x03 | ||
284 | #define UAC2_UD_UNDERFLOW 0x04 | ||
285 | #define UAC2_UD_OVERFLOW 0x05 | ||
286 | #define UAC2_UD_LATENCY 0x06 | ||
287 | |||
288 | /* A.17.9.2 Dolby Prologic[tm] Processing Unit Control Selectors */ | ||
289 | #define UAC2_DP_UNDEFINED 0x00 | ||
290 | #define UAC2_DP_ENABLE 0x01 | ||
291 | #define UAC2_DP_MODE_SELECT 0x02 | ||
292 | #define UAC2_DP_CLUSTER 0x03 | ||
293 | #define UAC2_DP_UNDERFFLOW 0x04 | ||
294 | #define UAC2_DP_OVERFLOW 0x05 | ||
295 | #define UAC2_DP_LATENCY 0x06 | ||
296 | |||
297 | /* A.17.9.3 Stereo Expander Processing Unit Control Selectors */ | ||
298 | #define UAC2_ST_EXT_UNDEFINED 0x00 | ||
299 | #define UAC2_ST_EXT_ENABLE 0x01 | ||
300 | #define UAC2_ST_EXT_WIDTH 0x02 | ||
301 | #define UAC2_ST_EXT_UNDEFLOW 0x03 | ||
302 | #define UAC2_ST_EXT_OVERFLOW 0x04 | ||
303 | #define UAC2_ST_EXT_LATENCY 0x05 | ||
304 | |||
305 | /* A.17.10 Extension Unit Control Selectors */ | ||
306 | #define UAC2_XU_UNDEFINED 0x00 | ||
307 | #define UAC2_XU_ENABLE 0x01 | ||
308 | #define UAC2_XU_CLUSTER 0x02 | ||
309 | #define UAC2_XU_UNDERFLOW 0x03 | ||
310 | #define UAC2_XU_OVERFLOW 0x04 | ||
311 | #define UAC2_XU_LATENCY 0x05 | ||
312 | |||
313 | /* A.17.11 AudioStreaming Interface Control Selectors */ | ||
314 | #define UAC2_AS_UNDEFINED 0x00 | ||
315 | #define UAC2_AS_ACT_ALT_SETTING 0x01 | ||
316 | #define UAC2_AS_VAL_ALT_SETTINGS 0x02 | ||
317 | #define UAC2_AS_AUDIO_DATA_FORMAT 0x03 | ||
318 | |||
319 | /* A.17.12 Encoder Control Selectors */ | ||
320 | #define UAC2_EN_UNDEFINED 0x00 | ||
321 | #define UAC2_EN_BIT_RATE 0x01 | ||
322 | #define UAC2_EN_QUALITY 0x02 | ||
323 | #define UAC2_EN_VBR 0x03 | ||
324 | #define UAC2_EN_TYPE 0x04 | ||
325 | #define UAC2_EN_UNDERFLOW 0x05 | ||
326 | #define UAC2_EN_OVERFLOW 0x06 | ||
327 | #define UAC2_EN_ENCODER_ERROR 0x07 | ||
328 | #define UAC2_EN_PARAM1 0x08 | ||
329 | #define UAC2_EN_PARAM2 0x09 | ||
330 | #define UAC2_EN_PARAM3 0x0a | ||
331 | #define UAC2_EN_PARAM4 0x0b | ||
332 | #define UAC2_EN_PARAM5 0x0c | ||
333 | #define UAC2_EN_PARAM6 0x0d | ||
334 | #define UAC2_EN_PARAM7 0x0e | ||
335 | #define UAC2_EN_PARAM8 0x0f | ||
336 | |||
337 | /* A.17.13.1 MPEG Decoder Control Selectors */ | ||
338 | #define UAC2_MPEG_UNDEFINED 0x00 | ||
339 | #define UAC2_MPEG_DUAL_CHANNEL 0x01 | ||
340 | #define UAC2_MPEG_SECOND_STEREO 0x02 | ||
341 | #define UAC2_MPEG_MULTILINGUAL 0x03 | ||
342 | #define UAC2_MPEG_DYN_RANGE 0x04 | ||
343 | #define UAC2_MPEG_SCALING 0x05 | ||
344 | #define UAC2_MPEG_HILO_SCALING 0x06 | ||
345 | #define UAC2_MPEG_UNDERFLOW 0x07 | ||
346 | #define UAC2_MPEG_OVERFLOW 0x08 | ||
347 | #define UAC2_MPEG_DECODER_ERROR 0x09 | ||
348 | |||
349 | /* A17.13.2 AC3 Decoder Control Selectors */ | ||
350 | #define UAC2_AC3_UNDEFINED 0x00 | ||
351 | #define UAC2_AC3_MODE 0x01 | ||
352 | #define UAC2_AC3_DYN_RANGE 0x02 | ||
353 | #define UAC2_AC3_SCALING 0x03 | ||
354 | #define UAC2_AC3_HILO_SCALING 0x04 | ||
355 | #define UAC2_AC3_UNDERFLOW 0x05 | ||
356 | #define UAC2_AC3_OVERFLOW 0x06 | ||
357 | #define UAC2_AC3_DECODER_ERROR 0x07 | ||
358 | |||
359 | /* A17.13.3 WMA Decoder Control Selectors */ | ||
360 | #define UAC2_WMA_UNDEFINED 0x00 | ||
361 | #define UAC2_WMA_UNDERFLOW 0x01 | ||
362 | #define UAC2_WMA_OVERFLOW 0x02 | ||
363 | #define UAC2_WMA_DECODER_ERROR 0x03 | ||
364 | |||
365 | /* A17.13.4 DTS Decoder Control Selectors */ | ||
366 | #define UAC2_DTS_UNDEFINED 0x00 | ||
367 | #define UAC2_DTS_UNDERFLOW 0x01 | ||
368 | #define UAC2_DTS_OVERFLOW 0x02 | ||
369 | #define UAC2_DTS_DECODER_ERROR 0x03 | ||
370 | |||
371 | /* A17.14 Endpoint Control Selectors */ | ||
372 | #define UAC2_EP_CS_UNDEFINED 0x00 | ||
373 | #define UAC2_EP_CS_PITCH 0x01 | ||
374 | #define UAC2_EP_CS_DATA_OVERRUN 0x02 | ||
375 | #define UAC2_EP_CS_DATA_UNDERRUN 0x03 | ||
376 | |||
377 | #endif /* __LINUX_USB_AUDIO_V2_H */ | ||
378 | |||
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h index 4d3e450e2b03..c0ef18dc2da7 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 |
@@ -190,6 +181,156 @@ struct uac_feature_unit_descriptor_##ch { \ | |||
190 | __u8 iFeature; \ | 181 | __u8 iFeature; \ |
191 | } __attribute__ ((packed)) | 182 | } __attribute__ ((packed)) |
192 | 183 | ||
184 | /* 4.3.2.3 Mixer Unit Descriptor */ | ||
185 | struct uac_mixer_unit_descriptor { | ||
186 | __u8 bLength; | ||
187 | __u8 bDescriptorType; | ||
188 | __u8 bDescriptorSubtype; | ||
189 | __u8 bUnitID; | ||
190 | __u8 bNrInPins; | ||
191 | __u8 baSourceID[]; | ||
192 | } __attribute__ ((packed)); | ||
193 | |||
194 | static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *desc) | ||
195 | { | ||
196 | return desc->baSourceID[desc->bNrInPins]; | ||
197 | } | ||
198 | |||
199 | static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc, | ||
200 | int protocol) | ||
201 | { | ||
202 | if (protocol == UAC_VERSION_1) | ||
203 | return (desc->baSourceID[desc->bNrInPins + 2] << 8) | | ||
204 | desc->baSourceID[desc->bNrInPins + 1]; | ||
205 | else | ||
206 | return (desc->baSourceID[desc->bNrInPins + 4] << 24) | | ||
207 | (desc->baSourceID[desc->bNrInPins + 3] << 16) | | ||
208 | (desc->baSourceID[desc->bNrInPins + 2] << 8) | | ||
209 | (desc->baSourceID[desc->bNrInPins + 1]); | ||
210 | } | ||
211 | |||
212 | static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc, | ||
213 | int protocol) | ||
214 | { | ||
215 | return (protocol == UAC_VERSION_1) ? | ||
216 | desc->baSourceID[desc->bNrInPins + 3] : | ||
217 | desc->baSourceID[desc->bNrInPins + 5]; | ||
218 | } | ||
219 | |||
220 | static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc, | ||
221 | int protocol) | ||
222 | { | ||
223 | return (protocol == UAC_VERSION_1) ? | ||
224 | &desc->baSourceID[desc->bNrInPins + 4] : | ||
225 | &desc->baSourceID[desc->bNrInPins + 6]; | ||
226 | } | ||
227 | |||
228 | static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc) | ||
229 | { | ||
230 | __u8 *raw = (__u8 *) desc; | ||
231 | return raw[desc->bLength - 1]; | ||
232 | } | ||
233 | |||
234 | /* 4.3.2.4 Selector Unit Descriptor */ | ||
235 | struct uac_selector_unit_descriptor { | ||
236 | __u8 bLength; | ||
237 | __u8 bDescriptorType; | ||
238 | __u8 bDescriptorSubtype; | ||
239 | __u8 bUintID; | ||
240 | __u8 bNrInPins; | ||
241 | __u8 baSourceID[]; | ||
242 | } __attribute__ ((packed)); | ||
243 | |||
244 | static inline __u8 uac_selector_unit_iSelector(struct uac_selector_unit_descriptor *desc) | ||
245 | { | ||
246 | __u8 *raw = (__u8 *) desc; | ||
247 | return raw[9 + desc->bLength - 1]; | ||
248 | } | ||
249 | |||
250 | /* 4.3.2.5 Feature Unit Descriptor */ | ||
251 | struct uac_feature_unit_descriptor { | ||
252 | __u8 bLength; | ||
253 | __u8 bDescriptorType; | ||
254 | __u8 bDescriptorSubtype; | ||
255 | __u8 bUnitID; | ||
256 | __u8 bSourceID; | ||
257 | __u8 bControlSize; | ||
258 | __u8 bmaControls[0]; /* variable length */ | ||
259 | } __attribute__((packed)); | ||
260 | |||
261 | static inline __u8 uac_feature_unit_iFeature(struct uac_feature_unit_descriptor *desc) | ||
262 | { | ||
263 | __u8 *raw = (__u8 *) desc; | ||
264 | return raw[desc->bLength - 1]; | ||
265 | } | ||
266 | |||
267 | /* 4.3.2.6 Processing Unit Descriptors */ | ||
268 | struct uac_processing_unit_descriptor { | ||
269 | __u8 bLength; | ||
270 | __u8 bDescriptorType; | ||
271 | __u8 bDescriptorSubtype; | ||
272 | __u8 bUnitID; | ||
273 | __u16 wProcessType; | ||
274 | __u8 bNrInPins; | ||
275 | __u8 baSourceID[]; | ||
276 | } __attribute__ ((packed)); | ||
277 | |||
278 | static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_descriptor *desc) | ||
279 | { | ||
280 | return desc->baSourceID[desc->bNrInPins]; | ||
281 | } | ||
282 | |||
283 | static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc, | ||
284 | int protocol) | ||
285 | { | ||
286 | if (protocol == UAC_VERSION_1) | ||
287 | return (desc->baSourceID[desc->bNrInPins + 2] << 8) | | ||
288 | desc->baSourceID[desc->bNrInPins + 1]; | ||
289 | else | ||
290 | return (desc->baSourceID[desc->bNrInPins + 4] << 24) | | ||
291 | (desc->baSourceID[desc->bNrInPins + 3] << 16) | | ||
292 | (desc->baSourceID[desc->bNrInPins + 2] << 8) | | ||
293 | (desc->baSourceID[desc->bNrInPins + 1]); | ||
294 | } | ||
295 | |||
296 | static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc, | ||
297 | int protocol) | ||
298 | { | ||
299 | return (protocol == UAC_VERSION_1) ? | ||
300 | desc->baSourceID[desc->bNrInPins + 3] : | ||
301 | desc->baSourceID[desc->bNrInPins + 5]; | ||
302 | } | ||
303 | |||
304 | static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc, | ||
305 | int protocol) | ||
306 | { | ||
307 | return (protocol == UAC_VERSION_1) ? | ||
308 | desc->baSourceID[desc->bNrInPins + 4] : | ||
309 | desc->baSourceID[desc->bNrInPins + 6]; | ||
310 | } | ||
311 | |||
312 | static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc, | ||
313 | int protocol) | ||
314 | { | ||
315 | return (protocol == UAC_VERSION_1) ? | ||
316 | &desc->baSourceID[desc->bNrInPins + 5] : | ||
317 | &desc->baSourceID[desc->bNrInPins + 7]; | ||
318 | } | ||
319 | |||
320 | static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc, | ||
321 | int protocol) | ||
322 | { | ||
323 | __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); | ||
324 | return desc->baSourceID[desc->bNrInPins + control_size]; | ||
325 | } | ||
326 | |||
327 | static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc, | ||
328 | int protocol) | ||
329 | { | ||
330 | __u8 control_size = uac_processing_unit_bControlSize(desc, protocol); | ||
331 | return &desc->baSourceID[desc->bNrInPins + control_size + 1]; | ||
332 | } | ||
333 | |||
193 | /* 4.5.2 Class-Specific AS Interface Descriptor */ | 334 | /* 4.5.2 Class-Specific AS Interface Descriptor */ |
194 | struct uac_as_header_descriptor_v1 { | 335 | struct uac_as_header_descriptor_v1 { |
195 | __u8 bLength; /* in bytes: 7 */ | 336 | __u8 bLength; /* in bytes: 7 */ |
@@ -200,19 +341,6 @@ struct uac_as_header_descriptor_v1 { | |||
200 | __le16 wFormatTag; /* The Audio Data Format */ | 341 | __le16 wFormatTag; /* The Audio Data Format */ |
201 | } __attribute__ ((packed)); | 342 | } __attribute__ ((packed)); |
202 | 343 | ||
203 | struct 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 | 344 | #define UAC_DT_AS_HEADER_SIZE 7 |
217 | 345 | ||
218 | /* Formats - A.1.1 Audio Data Format Type I Codes */ | 346 | /* Formats - A.1.1 Audio Data Format Type I Codes */ |
@@ -277,7 +405,6 @@ struct uac_format_type_i_ext_descriptor { | |||
277 | __u8 bSideBandProtocol; | 405 | __u8 bSideBandProtocol; |
278 | } __attribute__((packed)); | 406 | } __attribute__((packed)); |
279 | 407 | ||
280 | |||
281 | /* Formats - Audio Data Format Type I Codes */ | 408 | /* Formats - Audio Data Format Type I Codes */ |
282 | 409 | ||
283 | #define UAC_FORMAT_TYPE_II_MPEG 0x1001 | 410 | #define UAC_FORMAT_TYPE_II_MPEG 0x1001 |
@@ -329,38 +456,15 @@ struct uac_iso_endpoint_descriptor { | |||
329 | __u8 bmAttributes; | 456 | __u8 bmAttributes; |
330 | __u8 bLockDelayUnits; | 457 | __u8 bLockDelayUnits; |
331 | __le16 wLockDelay; | 458 | __le16 wLockDelay; |
332 | }; | 459 | } __attribute__((packed)); |
333 | #define UAC_ISO_ENDPOINT_DESC_SIZE 7 | 460 | #define UAC_ISO_ENDPOINT_DESC_SIZE 7 |
334 | 461 | ||
335 | #define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01 | 462 | #define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01 |
336 | #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 | 463 | #define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02 |
337 | #define UAC_EP_CS_ATTR_FILL_MAX 0x80 | 464 | #define UAC_EP_CS_ATTR_FILL_MAX 0x80 |
338 | 465 | ||
339 | /* Audio class v2.0: CLOCK_SOURCE descriptor */ | ||
340 | |||
341 | struct 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 */ | 466 | /* A.10.2 Feature Unit Control Selectors */ |
353 | 467 | ||
354 | struct uac_feature_unit_descriptor { | ||
355 | __u8 bLength; | ||
356 | __u8 bDescriptorType; | ||
357 | __u8 bDescriptorSubtype; | ||
358 | __u8 bUnitID; | ||
359 | __u8 bSourceID; | ||
360 | __u8 bControlSize; | ||
361 | __u8 controls[0]; /* variable length */ | ||
362 | } __attribute__((packed)); | ||
363 | |||
364 | #define UAC_FU_CONTROL_UNDEFINED 0x00 | 468 | #define UAC_FU_CONTROL_UNDEFINED 0x00 |
365 | #define UAC_MUTE_CONTROL 0x01 | 469 | #define UAC_MUTE_CONTROL 0x01 |
366 | #define UAC_VOLUME_CONTROL 0x02 | 470 | #define UAC_VOLUME_CONTROL 0x02 |
@@ -384,6 +488,21 @@ struct uac_feature_unit_descriptor { | |||
384 | #define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1)) | 488 | #define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1)) |
385 | #define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1)) | 489 | #define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1)) |
386 | 490 | ||
491 | /* status word format (3.7.1.1) */ | ||
492 | |||
493 | #define UAC1_STATUS_TYPE_ORIG_MASK 0x0f | ||
494 | #define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0 | ||
495 | #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1 | ||
496 | #define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2 | ||
497 | |||
498 | #define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7) | ||
499 | #define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6) | ||
500 | |||
501 | struct uac1_status_word { | ||
502 | __u8 bStatusType; | ||
503 | __u8 bOriginator; | ||
504 | } __attribute__((packed)); | ||
505 | |||
387 | #ifdef __KERNEL__ | 506 | #ifdef __KERNEL__ |
388 | 507 | ||
389 | struct usb_audio_control { | 508 | struct usb_audio_control { |