aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/audio.h
diff options
context:
space:
mode:
authorDaniel Mack <daniel@caiaq.de>2010-03-11 15:13:25 -0500
committerTakashi Iwai <tiwai@suse.de>2010-03-12 06:21:26 -0500
commit23caaf19b11eda7054348452e1618d4512a86907 (patch)
treede0f69f74931fb033f3291c27691a3c2ac6367a2 /include/linux/usb/audio.h
parent99fc86450c439039d2ef88d06b222fd51a779176 (diff)
ALSA: usb-mixer: Add support for Audio Class v2.0
USB Audio Class v2.0 compliant devices have different descriptors and a different way of setting/getting min/max/res/cur properties. This patch adds support for them. Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'include/linux/usb/audio.h')
-rw-r--r--include/linux/usb/audio.h71
1 files changed, 51 insertions, 20 deletions
diff --git a/include/linux/usb/audio.h b/include/linux/usb/audio.h
index bc78a83d0f48..905a87caf3fb 100644
--- a/include/linux/usb/audio.h
+++ b/include/linux/usb/audio.h
@@ -196,20 +196,33 @@ static inline __u8 uac_mixer_unit_bNrChannels(struct uac_mixer_unit_descriptor *
196 return desc->baSourceID[desc->bNrInPins]; 196 return desc->baSourceID[desc->bNrInPins];
197} 197}
198 198
199static inline __u16 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc) 199static inline __u32 uac_mixer_unit_wChannelConfig(struct uac_mixer_unit_descriptor *desc,
200 int protocol)
200{ 201{
201 return (desc->baSourceID[desc->bNrInPins + 2] << 8) | 202 if (protocol == UAC_VERSION_1)
202 desc->baSourceID[desc->bNrInPins + 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]);
203} 210}
204 211
205static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc) 212static inline __u8 uac_mixer_unit_iChannelNames(struct uac_mixer_unit_descriptor *desc,
213 int protocol)
206{ 214{
207 return desc->baSourceID[desc->bNrInPins + 3]; 215 return (protocol == UAC_VERSION_1) ?
216 desc->baSourceID[desc->bNrInPins + 3] :
217 desc->baSourceID[desc->bNrInPins + 5];
208} 218}
209 219
210static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc) 220static inline __u8 *uac_mixer_unit_bmControls(struct uac_mixer_unit_descriptor *desc,
221 int protocol)
211{ 222{
212 return &desc->baSourceID[desc->bNrInPins + 4]; 223 return (protocol == UAC_VERSION_1) ?
224 &desc->baSourceID[desc->bNrInPins + 4] :
225 &desc->baSourceID[desc->bNrInPins + 6];
213} 226}
214 227
215static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc) 228static inline __u8 uac_mixer_unit_iMixer(struct uac_mixer_unit_descriptor *desc)
@@ -267,36 +280,54 @@ static inline __u8 uac_processing_unit_bNrChannels(struct uac_processing_unit_de
267 return desc->baSourceID[desc->bNrInPins]; 280 return desc->baSourceID[desc->bNrInPins];
268} 281}
269 282
270static inline __u16 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc) 283static inline __u32 uac_processing_unit_wChannelConfig(struct uac_processing_unit_descriptor *desc,
284 int protocol)
271{ 285{
272 return (desc->baSourceID[desc->bNrInPins + 2] << 8) | 286 if (protocol == UAC_VERSION_1)
273 desc->baSourceID[desc->bNrInPins + 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]);
274} 294}
275 295
276static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc) 296static inline __u8 uac_processing_unit_iChannelNames(struct uac_processing_unit_descriptor *desc,
297 int protocol)
277{ 298{
278 return desc->baSourceID[desc->bNrInPins + 3]; 299 return (protocol == UAC_VERSION_1) ?
300 desc->baSourceID[desc->bNrInPins + 3] :
301 desc->baSourceID[desc->bNrInPins + 5];
279} 302}
280 303
281static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc) 304static inline __u8 uac_processing_unit_bControlSize(struct uac_processing_unit_descriptor *desc,
305 int protocol)
282{ 306{
283 return desc->baSourceID[desc->bNrInPins + 4]; 307 return (protocol == UAC_VERSION_1) ?
308 desc->baSourceID[desc->bNrInPins + 4] :
309 desc->baSourceID[desc->bNrInPins + 6];
284} 310}
285 311
286static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc) 312static inline __u8 *uac_processing_unit_bmControls(struct uac_processing_unit_descriptor *desc,
313 int protocol)
287{ 314{
288 return &desc->baSourceID[desc->bNrInPins + 5]; 315 return (protocol == UAC_VERSION_1) ?
316 &desc->baSourceID[desc->bNrInPins + 5] :
317 &desc->baSourceID[desc->bNrInPins + 7];
289} 318}
290 319
291static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc) 320static inline __u8 uac_processing_unit_iProcessing(struct uac_processing_unit_descriptor *desc,
321 int protocol)
292{ 322{
293 __u8 control_size = uac_processing_unit_bControlSize(desc); 323 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
294 return desc->baSourceID[desc->bNrInPins + control_size]; 324 return desc->baSourceID[desc->bNrInPins + control_size];
295} 325}
296 326
297static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc) 327static inline __u8 *uac_processing_unit_specific(struct uac_processing_unit_descriptor *desc,
328 int protocol)
298{ 329{
299 __u8 control_size = uac_processing_unit_bControlSize(desc); 330 __u8 control_size = uac_processing_unit_bControlSize(desc, protocol);
300 return &desc->baSourceID[desc->bNrInPins + control_size + 1]; 331 return &desc->baSourceID[desc->bNrInPins + control_size + 1];
301} 332}
302 333