usbaudio: Support for USB audio v2.0 devices
Here's a new version of the patchset to start support for USB audio v2.0 devices. I moved all the definitions to linux/usb/audio.h.
As I did that, I realized that there's actually many definitions in sound/usb/usbaudio.h which don't need to be there at all. Most of them are already defined in audio.h and ch9.h. Hence, I added a 5th patch to consolidate things and ease the chaos a bit. Hope I didn't break anything :)
Daniel
PATCH 1/5 ALSA: usbaudio: parse USB descriptors with structs
In preparation of support for v2.0 audio class, use the structs from linux/usb/audio.h and add some new ones to describe the fields that are actually parsed by the descriptor decoders.
Also, factor out code from usb_create_streams(). This makes it easier to adopt the new iteration logic needed for v2.0.
--- include/linux/usb/audio.h | 32 +++++++- sound/usb/usbaudio.c | 198 +++++++++++++++++++++++++++------------------ sound/usb/usbmixer.c | 39 +++++----- 3 files changed, 168 insertions(+), 101 deletions(-)
include/linux/usb/audio.h +28 -4
@@ -81,7 +81,7 @@/* Terminal Control Selectors */ /* 4.3.2 Class-Specific AC Interface Descriptor */ -struct uac_ac_header_descriptor { +struct uac_ac_header_descriptor_v1 {__u8 bLength;/* 8 + n */ __u8 bDescriptorType;/* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype;/* UAC_MS_HEADER */
@@ -95,7 +95,7 @@ struct uac_ac_header_descriptor {/* As above, but more useful for defining your own descriptors: */ #define DECLARE_UAC_AC_HEADER_DESCRIPTOR (n) \ -struct uac_ac_header_descriptor_##n { \ +struct uac_ac_header_descriptor_v1_##n { \ __u8 bLength; \ __u8 bDescriptorType; \ __u8 bDescriptorSubtype; \
@@ -131,7 +131,7 @@ struct uac_input_terminal_descriptor {#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206/* 4.3.2.2 Output Terminal Descriptor */ -struct uac_output_terminal_descriptor { +struct uac_output_terminal_descriptor_v1 {__u8 bLength;/* in bytes: 9 */ __u8 bDescriptorType;/* CS_INTERFACE descriptor type */ __u8 bDescriptorSubtype;/* OUTPUT_TERMINAL descriptor subtype */
@@ -171,7 +171,7 @@ struct uac_feature_unit_descriptor_##ch { \ } __attribute__ ((packed)) /* 4.5.2 Class-Specific AS Interface Descriptor */ -struct uac_as_header_descriptor { +struct uac_as_header_descriptor_v1 { __u8 bLength; /* in bytes: 7 */ __u8 bDescriptorType; /* USB_DT_CS_INTERFACE */ __u8 bDescriptorSubtype; /* AS_GENERAL */
@@ -232,6 +232,19 @@ struct uac_format_type_i_discrete_descriptor_##n { \#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE (n) (8 + (n * 3)) +/* Formats - Audio Data Format Type I Codes */ + +struct uac_format_type_ii_discrete_descriptor { +__u8 bLength; +__u8 bDescriptorType; +__u8 bDescriptorSubtype; +__u8 bFormatType; +__le16 wMaxBitRate; +__le16 wSamplesPerFrame; +__u8 bSamFreqType; +__u8 tSamFreq[][3 ]; +} __attribute__((packed)); +/* Formats - A.2 Format Type Codes */ #define UAC_FORMAT_TYPE_UNDEFINED 0x0#define UAC_FORMAT_TYPE_I 0x1
@@ -253,6 +266,17 @@ struct uac_iso_endpoint_descriptor {#define UAC_EP_CS_ATTR_FILL_MAX 0x80/* A.10.2 Feature Unit Control Selectors */ + +struct uac_feature_unit_descriptor { +__u8 bLength; +__u8 bDescriptorType; +__u8 bDescriptorSubtype; +__u8 bUnitID; +__u8 bSourceID; +__u8 bControlSize; +__u8 controls[0 ];/* variable length */ +} __attribute__((packed)); +#define UAC_FU_CONTROL_UNDEFINED 0x00#define UAC_MUTE_CONTROL 0x01#define UAC_VOLUME_CONTROL 0x02
sound/usb/usbaudio.c +120 -78
342 lines not on this page · raw message
sound/usb/usbmixer.c +20 -19
@@ -32,6 +32,8 @@#include <linux/slab.h> #include <linux/string.h> #include <linux/usb.h> +#include <linux/usb/audio.h> +#include <sound/core.h> #include <sound/control.h> #include <sound/hwdep.h>
@@ -278,7 +280,6 @@ static void *find_audio_control_unit(struct mixer_build *state, unsigned char un {unsigned char *p; - p =NULL ;while ((p =snd_usb_find_desc (state->buffer, state->buflen, p,USB_DT_CS_INTERFACE )) !=NULL ) {if (p[0 ] >=4 && p[2 ] >=INPUT_TERMINAL && p[2 ] <=EXTENSION_UNIT && p[3 ] == unit)
@@ -1083,29 +1084,30 @@ static void build_feature_ctl(struct mixer_build *state, unsigned char *desc,* * most of controlls are defined here. */ -static int parse_audio_feature_unit (struct mixer_build *state,int unitid,unsigned char *ftr) +static int parse_audio_feature_unit (struct mixer_build *state,int unitid,void *_ftr) {int channels, i, j;struct usb_audio_term iterm;unsigned int master_bits, first_ch_bits;int err, csize; +struct uac_feature_unit_descriptor *ftr = _ftr; -if (ftr[0 ] <7 || ! (csize = ftr[5 ]) || ftr[0 ] <7 + csize) { +if (ftr->bLength <7 || ! (csize = ftr->bControlSize) || ftr->bLength <7 + csize) {snd_printk (KERN_ERR "usbaudio: unit %u: invalid FEATURE_UNIT descriptor\n" , unitid);return -EINVAL ; }/* parse the source unit */ -if ((err =parse_audio_unit (state, ftr[4 ])) <0 ) +if ((err =parse_audio_unit (state, ftr->bSourceID)) <0 )return err;/* determine the input source type and name */ -if (check_input_term (state, ftr[4 ], &iterm) <0 ) +if (check_input_term (state, ftr->bSourceID, &iterm) <0 )return -EINVAL ; - channels = (ftr[0 ] -7 ) / csize -1 ; + channels = (ftr->bLength -7 ) / csize -1 ; - master_bits =snd_usb_combine_bytes (ftr +6 , csize); + master_bits =snd_usb_combine_bytes (ftr->controls, csize);/* master configuration quirks */ switch (state->chip->usb_id) {case USB_ID (0x08bb ,0x2702 ):
@@ -1116,21 +1118,21 @@ static int parse_audio_feature_unit(struct mixer_build *state, int unitid, unsigbreak ; }if (channels >0 ) - first_ch_bits =snd_usb_combine_bytes (ftr +6 + csize, csize); + first_ch_bits =snd_usb_combine_bytes (ftr->controls + csize, csize);else first_ch_bits =0 ;/* check all control types */ for (i =0 ; i <10 ; i++) {unsigned int ch_bits =0 ;for (j =0 ; j < channels; j++) { -unsigned int mask =snd_usb_combine_bytes (ftr +6 + csize * (j+1 ), csize); +unsigned int mask =snd_usb_combine_bytes (ftr->controls + csize * (j+1 ), csize);if (mask & (1 << i)) ch_bits |= (1 << j); }if (ch_bits &1 )/* the first channel must be set (for ease of programming) */ -build_feature_ctl (state, ftr, ch_bits, i, &iterm, unitid); +build_feature_ctl (state, _ftr, ch_bits, i, &iterm, unitid);if (master_bits & (1 << i)) -build_feature_ctl (state, ftr,0 , i, &iterm, unitid); +build_feature_ctl (state, _ftr,0 , i, &iterm, unitid); }return 0 ;
@@ -1777,7 +1779,7 @@ static int snd_usb_mixer_dev_free(struct snd_device *device)*/ static int snd_usb_mixer_controls (struct usb_mixer_interface *mixer) { -unsigned char *desc; +struct uac_output_terminal_descriptor_v1 *desc;struct mixer_build state;int err;const struct usbmix_ctl_map *map;
@@ -1800,15 +1802,14 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) } } - desc =NULL ;while ((desc =snd_usb_find_csint_desc (hostif->extra, hostif->extralen, desc,OUTPUT_TERMINAL )) !=NULL ) { -if (desc[0 ] <9 ) +if (desc->bLength <9 )continue ;/* invalid descriptor? */ -set_bit (desc[3 ], state.unitbitmap);/* mark terminal ID as visited */ - state.oterm.id = desc[3 ]; - state.oterm.type =combine_word (&desc[4 ]); - state.oterm.name = desc[8 ]; - err =parse_audio_unit (&state, desc[7 ]); +set_bit (desc->bTerminalID, state.unitbitmap);/* mark terminal ID as visited */ + state.oterm.id = desc->bTerminalID; + state.oterm.type =le16_to_cpu (desc->wTerminalType); + state.oterm.name = desc->iTerminal; + err =parse_audio_unit (&state, desc->bSourceID);if (err <0 )return err; }
Signature · 1 line
1.6.6.2
Re: [PATCH 1/5] ALSA: usbaudio: parse USB descriptors with structs
include/linux/usb/audio.h line 84
Quoted 12 lines · Daniel Mack
In preparation of support for v2.0 audio class, use the structs from
linux/usb/audio.hand add some new ones to describe the fields that are actually parsed by the descriptor decoders.
...include/linux/usb/audio.h +1
-1@@ -81,7 +81,7 @@/* Terminal Control Selectors */ /* 4.3.2 Class-Specific AC Interface Descriptor */ -struct uac_ac_header_descriptor { +struct uac_ac_header_descriptor_v1 {
This header is already used by drivers in drivers/usb/gadget/.
If there isn't too much overlap between v1 and v2 descriptors, it might make sense to put them in separate headers (audio2.h) and to put the parsers for v1 and v2 into separate files, too.
Regards,
Clemens
Re: [PATCH 1/5] ALSA: usbaudio: parse USB descriptors with structs
At Tue, 23 Feb 2010 08:50:29 +0100,
Quoted 17 lines · Clemens Ladisch
include/linux/usb/audio.h line 84
Quoted 12 lines · Daniel Mack
In preparation of support for v2.0 audio class, use the structs from
linux/usb/audio.hand add some new ones to describe the fields that are actually parsed by the descriptor decoders.
...include/linux/usb/audio.h +1
-1@@ -81,7 +81,7 @@/* Terminal Control Selectors */ /* 4.3.2 Class-Specific AC Interface Descriptor */ -struct uac_ac_header_descriptor { +struct uac_ac_header_descriptor_v1 {This header is already used by drivers in
drivers/usb/gadget/.
Quoted 3 lines
If there isn't too much overlap between v1 and v2 descriptors, it might make sense to put them in separate headers (
audio2.h) and to put the parsers for v1 and v2 into separate files, too.
Good point. But this can be in another patch?
Takashi
Re: [PATCH 1/5] ALSA: usbaudio: parse USB descriptors with structs
Quoted 19 lines · Takashi Iwai
At Tue, 23 Feb 2010 08:50:29 +0100,
Quoted 17 lines · Clemens Ladisch
include/linux/usb/audio.h line 84
Quoted 12 lines · Daniel Mack
In preparation of support for v2.0 audio class, use the structs from
linux/usb/audio.hand add some new ones to describe the fields that are actually parsed by the descriptor decoders.
...include/linux/usb/audio.h +1
-1@@ -81,7 +81,7 @@/* Terminal Control Selectors */ /* 4.3.2 Class-Specific AC Interface Descriptor */ -struct uac_ac_header_descriptor { +struct uac_ac_header_descriptor_v1 {This header is already used by drivers in
drivers/usb/gadget/.
Quoted 5 lines
Quoted 3 lines
If there isn't too much overlap between v1 and v2 descriptors, it might make sense to put them in separate headers (
audio2.h) and to put the parsers for v1 and v2 into separate files, too.Good point. But this can be in another patch?
It does break compilation though, so I'll fix that up somehow before merge.
Daniel
Re: [PATCH 1/5] ALSA: usbaudio: parse USB descriptors with structs
At Tue, 23 Feb 2010 09:10:32 +0100,
Quoted 21 lines · Daniel Mack
Quoted 19 lines · Takashi Iwai
At Tue, 23 Feb 2010 08:50:29 +0100,
Quoted 17 lines · Clemens Ladisch
include/linux/usb/audio.h line 84
Quoted 12 lines · Daniel Mack
In preparation of support for v2.0 audio class, use the structs from
linux/usb/audio.hand add some new ones to describe the fields that are actually parsed by the descriptor decoders.
...include/linux/usb/audio.h +1
-1@@ -81,7 +81,7 @@/* Terminal Control Selectors */ /* 4.3.2 Class-Specific AC Interface Descriptor */ -struct uac_ac_header_descriptor { +struct uac_ac_header_descriptor_v1 {This header is already used by drivers in
drivers/usb/gadget/.
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
If there isn't too much overlap between v1 and v2 descriptors, it might make sense to put them in separate headers (
audio2.h) and to put the parsers for v1 and v2 into separate files, too.Good point. But this can be in another patch?
It does break compilation though, so I'll fix that up somehow before merge.
Well, I'd like to merge this stuff ASAP because the merge window is closing, and I don't want to put such a big thing after the merge window.
If you are OK with merging for 2.6.35, then I'm fine to wait. If this is for 2.6.34, I can't wait long.
Otherwise, it's easier to put things merged first, then refactor gradually.
Takashi
Re: [PATCH 1/5] ALSA: usbaudio: parse USB descriptors with structs
Quoted 6 lines · Takashi Iwai
At Tue, 23 Feb 2010 09:10:32 +0100,
Quoted 2 lines · Daniel Mack
It does break compilation though, so I'll fix that up somehow before merge.
Quoted 6 lines
Well, I'd like to merge this stuff ASAP because the merge window is closing, and I don't want to put such a big thing after the merge window.
If you are OK with merging for 2.6.35, then I'm fine to wait. If this is for 2.6.34, I can't wait long.
That's right. There hasn't been much real refactoring done, so that's a good state to merge it and test it for regressions. More support for v2 can be aimed for for .35.
Quoted 2 lines
Otherwise, it's easier to put things merged first, then refactor gradually.
Ok good. I'll fix the gadget drivers later today.
Thanks,
Daniel
PATCH 1/1 usb/gadget/{f_audio, gmidi}.c: follow recent changes in audio.h
Some structs in linux/usb/audio.h have got new names to mark them as part of version 1.0 of the USB audio standard. Follow these changes in the gadget drivers.
Not that this header and the ALSA USB driver will undergo some refactoring soon, so there might be another update to the gadgets as well.
---
I believe this would be best to go thru the ALSA tree as the other changes are there, too.
drivers/usb/gadget/f_audio.c | 6 +++---
drivers/usb/gadget/gmidi.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/usb/gadget/f_audio.c +3 -3
@@ -60,7 +60,7 @@ DECLARE_UAC_AC_HEADER_DESCRIPTOR(2);#define UAC_DT_TOTAL_LENGTH (UAC_DT_AC_HEADER_LENGTH + UAC_DT_INPUT_TERMINAL_SIZE \ + UAC_DT_OUTPUT_TERMINAL_SIZE + UAC_DT_FEATURE_UNIT_SIZE(0))/* B.3.2 Class-Specific AC Interface Descriptor */ -static struct uac_ac_header_descriptor_2 ac_header_desc = { +static struct uac_ac_header_descriptor_v1_2 ac_header_desc = { .bLength =UAC_DT_AC_HEADER_LENGTH , .bDescriptorType =USB_DT_CS_INTERFACE , .bDescriptorSubtype =UAC_HEADER ,
@@ -124,7 +124,7 @@ static struct usb_audio_control_selector feature_unit = { };#define OUTPUT_TERMINAL_ID 3 -static struct uac_output_terminal_descriptor output_terminal_desc = { +static struct uac_output_terminal_descriptor_v1 output_terminal_desc = { .bLength =UAC_DT_OUTPUT_TERMINAL_SIZE , .bDescriptorType =USB_DT_CS_INTERFACE , .bDescriptorSubtype =UAC_OUTPUT_TERMINAL ,
@@ -154,7 +154,7 @@ static struct usb_interface_descriptor as_interface_alt_1_desc = { };/* B.4.2 Class-Specific AS Interface Descriptor */ -static struct uac_as_header_descriptor as_header_desc = { +static struct uac_as_header_descriptor_v1 as_header_desc = { .bLength =UAC_DT_AS_HEADER_SIZE , .bDescriptorType =USB_DT_CS_INTERFACE , .bDescriptorSubtype =UAC_AS_GENERAL ,
drivers/usb/gadget/gmidi.c +1 -1
@@ -237,7 +237,7 @@ static const struct usb_interface_descriptor ac_interface_desc = { };/* B.3.2 Class-Specific AC Interface Descriptor */ -static const struct uac_ac_header_descriptor_1 ac_header_desc = { +static const struct uac_ac_header_descriptor_v1_1 ac_header_desc = { .bLength =UAC_DT_AC_HEADER_SIZE (1 ), .bDescriptorType =USB_DT_CS_INTERFACE , .bDescriptorSubtype =USB_MS_HEADER ,
Signature · 1 line
1.6.6.2
Re: [PATCH] usb/gadget/{f_audio, gmidi}.c: follow recent changes in audio.h
At Tue, 23 Feb 2010 10:30:00 +0100,
Quoted 5 lines · Daniel Mack
Some structs in
linux/usb/audio.hhave got new names to mark them as part of version 1.0 of the USB audio standard. Follow these changes in the gadget drivers.
Quoted 8 lines
Not that this header and the ALSA USB driver will undergo some refactoring soon, so there might be another update to the gadgets as well.
Signed-off-by Daniel Mack <[email protected]>---
I believe this would be best to go thru the ALSA tree as the other changes are there, too.
Yep, now applied to topic/usb-v2.0 branch of sound git tree.
If anyone has no objection, I'll merge this branch today for linux-next.
thanks,
Takashi
Quoted 51 lines
drivers/usb/gadget/f_audio.c| 6 +++---drivers/usb/gadget/gmidi.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)drivers/usb/gadget/f_audio.c +3
-3@@ -60,7 +60,7 @@ DECLARE_UAC_AC_HEADER_DESCRIPTOR(2);#define UAC_DT_TOTAL_LENGTH (UAC_DT_AC_HEADER_LENGTH + UAC_DT_INPUT_TERMINAL_SIZE \ + UAC_DT_OUTPUT_TERMINAL_SIZE + UAC_DT_FEATURE_UNIT_SIZE(0))/* B.3.2 Class-Specific AC Interface Descriptor */ -static struct uac_ac_header_descriptor_2 ac_header_desc = { +static struct uac_ac_header_descriptor_v1_2 ac_header_desc = { .bLength =UAC_DT_AC_HEADER_LENGTH , .bDescriptorType =USB_DT_CS_INTERFACE , .bDescriptorSubtype =UAC_HEADER ,@@ -124,7 +124,7 @@ static struct usb_audio_control_selector feature_unit = { };#define OUTPUT_TERMINAL_ID 3 -static struct uac_output_terminal_descriptor output_terminal_desc = { +static struct uac_output_terminal_descriptor_v1 output_terminal_desc = { .bLength =UAC_DT_OUTPUT_TERMINAL_SIZE , .bDescriptorType =USB_DT_CS_INTERFACE , .bDescriptorSubtype =UAC_OUTPUT_TERMINAL ,@@ -154,7 +154,7 @@ static struct usb_interface_descriptor as_interface_alt_1_desc = { };/* B.4.2 Class-Specific AS Interface Descriptor */ -static struct uac_as_header_descriptor as_header_desc = { +static struct uac_as_header_descriptor_v1 as_header_desc = { .bLength =UAC_DT_AS_HEADER_SIZE , .bDescriptorType =USB_DT_CS_INTERFACE , .bDescriptorSubtype =UAC_AS_GENERAL ,drivers/usb/gadget/gmidi.c +1
-1@@ -237,7 +237,7 @@ static const struct usb_interface_descriptor ac_interface_desc = { };/* B.3.2 Class-Specific AC Interface Descriptor */ -static const struct uac_ac_header_descriptor_1 ac_header_desc = { +static const struct uac_ac_header_descriptor_v1_1 ac_header_desc = { .bLength =UAC_DT_AC_HEADER_SIZE (1 ), .bDescriptorType =USB_DT_CS_INTERFACE , .bDescriptorSubtype =USB_MS_HEADER ,Signature · 1 line
1.6.6.2
Re: [PATCH] usb/gadget/{f_audio, gmidi}.c: follow recent changes in audio.h
Am Dienstag, den 23.02.2010, 10:51 +0100 schrieb Takashi Iwai:
Quoted 8 lines
At Tue, 23 Feb 2010 10:30:00 +0100,
Quoted 6 lines · Daniel Mack
Some structs in
linux/usb/audio.hhave got new names to mark them as part of version 1.0 of the USB audio standard. Follow these changes in the gadget drivers.Not that this header and the ALSA USB driver will undergo some
s/Not/Note/
[…]
Quoted 4 lines
Yep, now applied to topic/usb-v2.0 branch of sound git tree.
If anyone has no objection, I'll merge this branch today for linux-next.
Sorry for this nit-picking, but I think this typo makes everyone to read this paragraph twice.
Thanks,
Paul
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH] usb/gadget/{f_audio, gmidi}.c: follow recent changes in audio.h
Quoted 14 lines · Paul Menzel
Am Dienstag, den 23.02.2010, 10:51 +0100 schrieb Takashi Iwai:
Quoted 8 lines
At Tue, 23 Feb 2010 10:30:00 +0100,
Quoted 6 lines · Daniel Mack
Some structs in
linux/usb/audio.hhave got new names to mark them as part of version 1.0 of the USB audio standard. Follow these changes in the gadget drivers.Not that this header and the ALSA USB driver will undergo some
s/Not/Note/
[…]
Quoted 7 lines
Quoted 4 lines
Yep, now applied to topic/usb-v2.0 branch of sound git tree.
If anyone has no objection, I'll merge this branch today for linux-next.
Sorry for this nit-picking, but I think this typo makes everyone to read this paragraph twice.
Yes, I noticed that after I sent, sorry. Takashi, can you amend?
Thanks,
Daniel
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH] usb/gadget/{f_audio, gmidi}.c: follow recent changes in audio.h
At Tue, 23 Feb 2010 11:29:23 +0100,
Quoted 18 lines · Daniel Mack
Quoted 16 lines · Paul Menzel
Am Dienstag, den 23.02.2010, 10:51 +0100 schrieb Takashi Iwai:
Quoted 8 lines
At Tue, 23 Feb 2010 10:30:00 +0100,
Quoted 6 lines · Daniel Mack
Some structs in
linux/usb/audio.hhave got new names to mark them as part of version 1.0 of the USB audio standard. Follow these changes in the gadget drivers.Not that this header and the ALSA USB driver will undergo some
s/Not/Note/
[…]
Quoted 2 lines
Yep, now applied to topic/usb-v2.0 branch of sound git tree.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
If anyone has no objection, I'll merge this branch today for linux-next.
Sorry for this nit-picking, but I think this typo makes everyone to read this paragraph twice.
Yes, I noticed that after I sent, sorry. Takashi, can you amend?
Done.
Please check through topic/usb-v2.0 branch if you have time.
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git topic/usb-v2.0
thanks,
Takashi
_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Re: [PATCH] usb/gadget/{f_audio, gmidi}.c: follow recent changes in audio.h
In reply to Takashi IwaiQuoted 16 lines · Takashi Iwai
At Tue, 23 Feb 2010 10:30:00 +0100,
Quoted 5 lines · Daniel Mack
Some structs in
linux/usb/audio.hhave got new names to mark them as part of version 1.0 of the USB audio standard. Follow these changes in the gadget drivers.Quoted 8 lines
Not that this header and the ALSA USB driver will undergo some refactoring soon, so there might be another update to the gadgets as well.
Signed-off-by Daniel Mack <[email protected]>---
I believe this would be best to go thru the ALSA tree as the other changes are there, too.
Quoted 4 lines
Yep, now applied to topic/usb-v2.0 branch of sound git tree.
If anyone has no objection, I'll merge this branch today for linux-next.
No objection from me, thanks for doing this.
greg k-h
Re: [PATCH 1/5] ALSA: usbaudio: parse USB descriptors with structs
In reply to Clemens LadischQuoted 16 lines · Clemens Ladisch
include/linux/usb/audio.h line 84
Quoted 12 lines · Daniel Mack
In preparation of support for v2.0 audio class, use the structs from
linux/usb/audio.hand add some new ones to describe the fields that are actually parsed by the descriptor decoders.
...include/linux/usb/audio.h +1
-1@@ -81,7 +81,7 @@/* Terminal Control Selectors */ /* 4.3.2 Class-Specific AC Interface Descriptor */ -struct uac_ac_header_descriptor { +struct uac_ac_header_descriptor_v1 {This header is already used by drivers in
drivers/usb/gadget/.
Quoted 3 lines
If there isn't too much overlap between v1 and v2 descriptors, it might make sense to put them in separate headers (
audio2.h) and to put the parsers for v1 and v2 into separate files, too.
There's a lot of overlap, v2.0 is more an extension to v1.0, with certain incompatibilties that must be addressed. I can split the headers, that wouldn't be a big thing. But the parsers have too many things in common. I'll have a look whether the common parts could be factored out somehow. I don't like 4000+ line .c files anyway ;)
Daniel
Re: [PATCH 1/5] ALSA: usbaudio: parse USB descriptors with structs
In reply to Daniel MackAt Mon, 22 Feb 2010 23:49:09 +0100,
sound/usb/usbmixer.c static void *find_audio_control_unit(struct mixer_build *state, unsigned char un · line 285
Quoted 9 lines · Daniel Mack
sound/usb/usbmixer.c +0
-1@@ -278,7 +280,6 @@ static void *find_audio_control_unit(struct mixer_build *state, unsigned char un {unsigned char *p; - p =NULL ;while ((p =snd_usb_find_desc (state->buffer, state->buflen, p,USB_DT_CS_INTERFACE )) !=NULL ) { if (p[0] >= 4 && p[2] >= INPUT_TERMINAL && p[2] <= EXTENSION_UN
IT && p[3] == unit)
This causes the random pointer access.
sound/usb/usbmixer.c static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) · line 1805
Quoted 6 lines
sound/usb/usbmixer.c +0
-1@@ -1800,15 +1802,14 @@ static int snd_usb_mixer_controls(struct usb_mixer_interface *mixer) } } - desc =NULL ;while ((desc =snd_usb_find_csint_desc (hostif->extra, hostif->extralen, desc,OUTPUT_TERMINAL )) !=NULL ) {
Ditto.
thanks,
Takashi
PATCH 2/5 ALSA: usbaudio: introduce new types for audio class v2
In reply to Daniel MackThis patch adds some definitions for audio class v2.
Unfortunately, the UNIT types PROCESSING_UNIT and EXTENSION_UNIT have different numerical representations in both standards, so there is need for a _V1 add-on now. usbmixer.c is changed accordingly.
--- include/linux/usb/audio.h | 57 +++++++++++++++++++++++++++++++++++++++++++++ sound/usb/usbaudio.h | 19 ++++++++++++-- sound/usb/usbmixer.c | 14 +++++----- 3 files changed, 80 insertions(+), 10 deletions(-)
include/linux/usb/audio.h +57 -0
@@ -25,6 +25,9 @@#define USB_SUBCLASS_AUDIOSTREAMING 0x02#define USB_SUBCLASS_MIDISTREAMING 0x03 +#define UAC_VERSION_1 0x00 +#define UAC_VERSION_2 0x20 +/* A.5 Audio Class-Specific AC Interface Descriptor Subtypes */ #define UAC_HEADER 0x01#define UAC_INPUT_TERMINAL 0x02
@@ -180,6 +183,19 @@ struct uac_as_header_descriptor_v1 {__le16 wFormatTag;/* The Audio Data Format */ } __attribute__ ((packed)); +struct uac_as_header_descriptor_v2 { +__u8 bLength; +__u8 bDescriptorType; +__u8 bDescriptorSubtype; +__u8 bTerminalLink; +__u8 bmControls; +__u8 bFormatType; +__u32 bmFormats; +__u8 bNrChannels; +__u32 bmChannelConfig; +__u8 iChannelNames; +} __attribute__((packed)); +#define UAC_DT_AS_HEADER_SIZE 7/* Formats - A.1.1 Audio Data Format Type I Codes */
@@ -232,6 +248,19 @@ struct uac_format_type_i_discrete_descriptor_##n { \#define UAC_FORMAT_TYPE_I_DISCRETE_DESC_SIZE (n) (8 + (n * 3)) +struct uac_format_type_i_ext_descriptor { +__u8 bLength; +__u8 bDescriptorType; +__u8 bDescriptorSubtype; +__u8 bSubslotSize; +__u8 bFormatType; +__u8 bBitResolution; +__u8 bHeaderLength; +__u8 bControlSize; +__u8 bSideBandProtocol; +} __attribute__((packed)); + +/* Formats - Audio Data Format Type I Codes */ struct uac_format_type_ii_discrete_descriptor {
@@ -245,11 +274,26 @@ struct uac_format_type_ii_discrete_descriptor {__u8 tSamFreq[][3 ]; } __attribute__((packed)); +struct uac_format_type_ii_ext_descriptor { +__u8 bLength; +__u8 bDescriptorType; +__u8 bDescriptorSubtype; +__u8 bFormatType; +__u16 wMaxBitRate; +__u16 wSamplesPerFrame; +__u8 bHeaderLength; +__u8 bSideBandProtocol; +} __attribute__((packed)); + +/* Formats - A.2 Format Type Codes */ #define UAC_FORMAT_TYPE_UNDEFINED 0x0#define UAC_FORMAT_TYPE_I 0x1#define UAC_FORMAT_TYPE_II 0x2#define UAC_FORMAT_TYPE_III 0x3 +#define UAC_EXT_FORMAT_TYPE_I 0x81 +#define UAC_EXT_FORMAT_TYPE_II 0x82 +#define UAC_EXT_FORMAT_TYPE_III 0x83struct uac_iso_endpoint_descriptor {__u8 bLength;/* in bytes: 7 */
@@ -265,6 +309,19 @@ struct uac_iso_endpoint_descriptor {#define UAC_EP_CS_ATTR_PITCH_CONTROL 0x02#define UAC_EP_CS_ATTR_FILL_MAX 0x80 +/* Audio class v2.0: CLOCK_SOURCE descriptor */ + +struct uac_clock_source_descriptor { +__u8 bLength; +__u8 bDescriptorType; +__u8 bDescriptorSubtype; +__u8 bClockID; +__u8 bmAttributes; +__u8 bmControls; +__u8 bAssocTerminal; +__u8 iClockSource; +} __attribute__((packed)); +/* A.10.2 Feature Unit Control Selectors */ struct uac_feature_unit_descriptor {
sound/usb/usbaudio.h +16 -3
@@ -36,8 +36,17 @@#define MIXER_UNIT 0x04#define SELECTOR_UNIT 0x05#define FEATURE_UNIT 0x06 -#define PROCESSING_UNIT 0x07 -#define EXTENSION_UNIT 0x08 +#define PROCESSING_UNIT_V1 0x07 +#define EXTENSION_UNIT_V1 0x08 + +/* audio class v2 */ +#define EFFECT_UNIT 0x07 +#define PROCESSING_UNIT_V2 0x08 +#define EXTENSION_UNIT_V2 0x09 +#define CLOCK_SOURCE 0x0a +#define CLOCK_SELECTOR 0x0b +#define CLOCK_MULTIPLIER 0x0c +#define SAMPLE_RATE_CONVERTER 0x0d#define AS_GENERAL 0x01#define FORMAT_TYPE 0x02
@@ -60,7 +69,7 @@#define EP_CS_ATTR_PITCH_CONTROL 0x02#define EP_CS_ATTR_FILL_MAX 0x80 -/* Audio Class specific Request Codes */ +/* Audio Class specific Request Codes (v1) */ #define SET_CUR 0x01#define GET_CUR 0x81
@@ -74,6 +83,10 @@#define GET_MEM 0x85#define GET_STAT 0xff +/* Audio Class specific Request Codes (v2) */ +#define CS_CUR 0x01 +#define CS_RANGE 0x02 +/* Terminal Control Selectors */ #define COPY_PROTECT_CONTROL 0x01
sound/usb/usbmixer.c +7 -7
@@ -282,7 +282,7 @@ static void *find_audio_control_unit(struct mixer_build *state, unsigned char unwhile ((p =snd_usb_find_desc (state->buffer, state->buflen, p,USB_DT_CS_INTERFACE )) !=NULL ) { -if (p[0 ] >=4 && p[2 ] >=INPUT_TERMINAL && p[2 ] <=EXTENSION_UNIT && p[3 ] == unit) +if (p[0 ] >=4 && p[2 ] >=INPUT_TERMINAL && p[2 ] <=EXTENSION_UNIT_V1 && p[3 ] == unit)return p; }return NULL ;
@@ -603,9 +603,9 @@ static int get_term_name(struct mixer_build *state, struct usb_audio_term *itermswitch (iterm->type >>16 ) {case SELECTOR_UNIT :strcpy (name,"Selector" );return 8 ; -case PROCESSING_UNIT : +case PROCESSING_UNIT_V1 :strcpy (name,"Process Unit" );return 12 ; -case EXTENSION_UNIT : +case EXTENSION_UNIT_V1 :strcpy (name,"Ext Unit" );return 8 ;case MIXER_UNIT :strcpy (name,"Mixer" );return 5 ;
@@ -669,8 +669,8 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_ term->id = id; term->name = p1[9 + p1[0 ] -1 ];return 0 ; -case PROCESSING_UNIT : -case EXTENSION_UNIT : +case PROCESSING_UNIT_V1 : +case EXTENSION_UNIT_V1 :if (p1[6 ] ==1 ) { id = p1[7 ];break ;/* continue to parse */
@@ -1743,9 +1743,9 @@ static int parse_audio_unit(struct mixer_build *state, int unitid)return parse_audio_selector_unit (state, unitid, p1);case FEATURE_UNIT :return parse_audio_feature_unit (state, unitid, p1); -case PROCESSING_UNIT : +case PROCESSING_UNIT_V1 :return parse_audio_processing_unit (state, unitid, p1); -case EXTENSION_UNIT : +case EXTENSION_UNIT_V1 :return parse_audio_extension_unit (state, unitid, p1);default :snd_printk (KERN_ERR "usbaudio: unit %u: unexpected type 0x%02x\n" , unitid, p1[2 ]);
Signature · 1 line
1.6.6.2
PATCH 3/5 ALSA: usbaudio: implement basic set of class v2.0 parser
In reply to Daniel MackThis adds a number of parsers for audio class v2.0. In particular, the following internals are different and now handled by the code:
* the number of streaming interfaces is now reported by an interface association descriptor. The old approach using a proprietary descriptor is deprecated.
* The number of channels per interface is now stored in the AS_GENERAL descriptor (used to be part of the FORMAT_TYPE descriptor).
* The list of supported sample rates is no longer stored in a variable length appendix of the format_type descriptor but is retrieved from the device using a class specific GET_RANGE command.
* Supported sample formats are now reported as 32bit bitmap rather than a fixed value. For now, this is worked around by choosing just one of them.
* A devices needs to have at least one CLOCK_SOURCE descriptor which denotes a clockID that is needed im the class request command.
* Many descriptors (format_type, ...) have changed their layout. Handle this by casting the descriptors to the appropriate structs.
--- sound/usb/usbaudio.c | 352 +++++++++++++++++++++++++++++++++++++++++--------- sound/usb/usbaudio.h | 3 + 2 files changed, 292 insertions(+), 63 deletions(-)
sound/usb/usbaudio.c +289 -63
@@ -2422,17 +2422,53 @@ static int is_big_endian_format(struct snd_usb_audio *chip, struct audioformat ** @format: the format tag (wFormatTag) * @fmt: the format type descriptor */ -static int parse_audio_format_i_type (struct snd_usb_audio *chip,struct audioformat *fp, -int format,void *fmt_raw) +static int parse_audio_format_i_type (struct snd_usb_audio *chip, +struct audioformat *fp, +int format,void *_fmt, +int protocol) { -int pcm_format; +int pcm_format, i;int sample_width, sample_bytes; -struct uac_format_type_i_discrete_descriptor *fmt = fmt_raw; + +switch (protocol) { +case UAC_VERSION_1 : { +struct uac_format_type_i_discrete_descriptor *fmt = _fmt; + sample_width = fmt->bBitResolution; + sample_bytes = fmt->bSubframeSize; +break ; + } + +case UAC_VERSION_2 : { +struct uac_format_type_i_ext_descriptor *fmt = _fmt; + sample_width = fmt->bBitResolution; + sample_bytes = fmt->bSubslotSize; + +/* +* FIXME +* USB audio class v2 devices specify a bitmap of possible +* audio formats rather than one fix value. For now, we just +* pick one of them and report that as the only possible +* value for this setting. +* The bit allocation map is in fact compatible to the +* wFormatTag of the v1 AS streaming descriptors, which is why +* we can simply map the matrix. +*/ + +for (i =0 ; i <5 ; i++) +if (format & (1UL << i)) { + format = i +1 ; +break ; + } + +break ; + } + +default : +return -EINVAL ; + }/* FIXME: correct endianess and sign? */ pcm_format =-1 ; - sample_width = fmt->bBitResolution; - sample_bytes = fmt->bSubframeSize;switch (format) {case 0 :/* some devices don't define this correctly... */
@@ -2446,6 +2482,7 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip, struct audiofor sample_width, sample_bytes); }/* check the format byte size */ +printk (" XXXXX SAMPLE BYTES %d\n" , sample_bytes);switch (sample_bytes) {case 1 : pcm_format =SNDRV_PCM_FORMAT_S8 ;
@@ -2500,7 +2537,7 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip, struct audiofor/* * parse the format descriptor and stores the possible sample rates -* on the audioformat table. +* on the audioformat table (audio class v1). * * @dev: usb device * @fp: audioformat record
@@ -2508,8 +2545,8 @@ static int parse_audio_format_i_type(struct snd_usb_audio *chip, struct audiofor* @offset: the start offset of descriptor pointing the rate type * (7 for type I and II, 8 for type II) */ -static int parse_audio_format_rates (struct snd_usb_audio *chip,struct audioformat *fp, -unsigned char *fmt,int offset) +static int parse_audio_format_rates_v1 (struct snd_usb_audio *chip,struct audioformat *fp, +unsigned char *fmt,int offset) {int nr_rates = fmt[offset];
@@ -2565,13 +2602,85 @@ static int parse_audio_format_rates(struct snd_usb_audio *chip, struct audioform }/* +* parse the format descriptor and stores the possible sample rates +* on the audioformat table (audio class v2). +*/ +static int parse_audio_format_rates_v2 (struct snd_usb_audio *chip, +struct audioformat *fp, +struct usb_host_interface *iface) +{ +struct usb_device *dev = chip->dev; +unsigned char tmp[2 ], *data; +int i, nr_rates, data_size, ret =0 ; + +/* get the number of sample rates first by only fetching 2 bytes */ + ret =snd_usb_ctl_msg (dev,usb_rcvctrlpipe (dev,0 ),CS_RANGE , +USB_TYPE_CLASS |USB_RECIP_INTERFACE |USB_DIR_IN , +0x0100 , chip->clock_id <<8 , tmp,sizeof (tmp),1000 ); + +if (ret <0 ) { +snd_printk (KERN_ERR "unable to retrieve number of sample rates\n" ); + goto err; + } + + nr_rates = (tmp[1 ] <<8 ) | tmp[0 ]; + data_size =2 +12 * nr_rates; + data =kzalloc (data_size,GFP_KERNEL ); +if (!data) { + ret = -ENOMEM ; + goto err; + } + +/* now get the full information */ + ret =snd_usb_ctl_msg (dev,usb_rcvctrlpipe (dev,0 ),CS_RANGE , +USB_TYPE_CLASS |USB_RECIP_INTERFACE |USB_DIR_IN , +0x0100 , chip->clock_id <<8 , data, data_size,1000 ); + +if (ret <0 ) { +snd_printk (KERN_ERR "unable to retrieve sample rate range\n" ); + ret = -EINVAL ; + goto err_free; + } + + fp->rate_table =kmalloc (sizeof (int ) * nr_rates,GFP_KERNEL ); +if (!fp->rate_table) { + ret = -ENOMEM ; + goto err_free; + } + + fp->nr_rates =0 ; + fp->rate_min = fp->rate_max =0 ; + +for (i =0 ; i < nr_rates; i++) { +int rate =combine_quad (&data[2 +12 * i]); + + fp->rate_table[fp->nr_rates] = rate; +if (!fp->rate_min || rate < fp->rate_min) + fp->rate_min = rate; +if (!fp->rate_max || rate > fp->rate_max) + fp->rate_max = rate; + fp->rates |=snd_pcm_rate_to_rate_bit (rate); + fp->nr_rates++; + } + +err_free: +kfree (data); +err: +return ret; +} + +/* * parse the format type I and III descriptors */ -static int parse_audio_format_i (struct snd_usb_audio *chip,struct audioformat *fp, -int format,void *fmt_raw) +static int parse_audio_format_i (struct snd_usb_audio *chip, +struct audioformat *fp, +int format,void *_fmt, +struct usb_host_interface *iface) { -int pcm_format; -struct uac_format_type_i_discrete_descriptor *fmt = fmt_raw; +struct usb_interface_descriptor *altsd =get_iface_desc (iface); +struct uac_format_type_i_discrete_descriptor *fmt = _fmt; +int protocol = altsd->bInterfaceProtocol; +int pcm_format, ret;if (fmt->bFormatType ==USB_FORMAT_TYPE_III ) {/* FIXME: the format type is really IECxxx
@@ -2591,30 +2700,49 @@ static int parse_audio_format_i(struct snd_usb_audio *chip, struct audioformat * pcm_format =SNDRV_PCM_FORMAT_S16_LE ; } }else { - pcm_format =parse_audio_format_i_type (chip, fp, format, fmt); + pcm_format =parse_audio_format_i_type (chip, fp, format, fmt, protocol);if (pcm_format <0 )return -1 ; } fp->format = pcm_format; - fp->channels = fmt->bNrChannels; + +/* gather possible sample rates */ +/* audio class v1 reports possible sample rates as part of the +* proprietary class specific descriptor. +* audio class v2 uses class specific EP0 range requests for that. +*/ +switch (protocol) { +case UAC_VERSION_1 : + fp->channels = fmt->bNrChannels; + ret =parse_audio_format_rates_v1 (chip, fp, _fmt,7 ); +break ; +case UAC_VERSION_2 : +/* fp->channels is already set in this case */ + ret =parse_audio_format_rates_v2 (chip, fp, iface); +break ; + }if (fp->channels <1 ) {snd_printk (KERN_ERR "%d:%u:%d : invalid channels %d\n" , chip->dev->devnum, fp->iface, fp->altsetting, fp->channels);return -1 ; } -return parse_audio_format_rates (chip, fp, fmt_raw,7 ); + +return ret; }/* * parse the format type II descriptor */ -static int parse_audio_format_ii (struct snd_usb_audio *chip,struct audioformat *fp, -int format,void *fmt_raw) +static int parse_audio_format_ii (struct snd_usb_audio *chip, +struct audioformat *fp, +int format,void *_fmt, +struct usb_host_interface *iface) { -int brate, framesize; -struct uac_format_type_ii_discrete_descriptor *fmt = fmt_raw; +int brate, framesize, ret; +struct usb_interface_descriptor *altsd =get_iface_desc (iface); +int protocol = altsd->bInterfaceProtocol;switch (format) {case USB_AUDIO_FORMAT_AC3 :
@@ -2634,35 +2762,50 @@ static int parse_audio_format_ii(struct snd_usb_audio *chip, struct audioformat fp->channels =1 ; - brate =le16_to_cpu (fmt->wMaxBitRate); - framesize =le16_to_cpu (fmt->wSamplesPerFrame); -snd_printd (KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n" , brate, framesize); - fp->frame_size = framesize; -return parse_audio_format_rates (chip, fp, fmt_raw,8 );/* fmt[8..] sample rates */ +switch (protocol) { +case UAC_VERSION_1 : { +struct uac_format_type_ii_discrete_descriptor *fmt = _fmt; + brate =le16_to_cpu (fmt->wMaxBitRate); + framesize =le16_to_cpu (fmt->wSamplesPerFrame); +snd_printd (KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n" , brate, framesize); + fp->frame_size = framesize; + ret =parse_audio_format_rates_v1 (chip, fp, _fmt,8 );/* fmt[8..] sample rates */ +break ; + } +case UAC_VERSION_2 : { +struct uac_format_type_ii_ext_descriptor *fmt = _fmt; + brate =le16_to_cpu (fmt->wMaxBitRate); + framesize =le16_to_cpu (fmt->wSamplesPerFrame); +snd_printd (KERN_INFO "found format II with max.bitrate = %d, frame size=%d\n" , brate, framesize); + fp->frame_size = framesize; + ret =parse_audio_format_rates_v2 (chip, fp, iface); +break ; + } + } + +return ret; }static int parse_audio_format (struct snd_usb_audio *chip,struct audioformat *fp, -int format,void *fmt_raw,int stream) +int format,unsigned char *fmt,int stream, +struct usb_host_interface *iface) {int err; -/* we only parse the common header of all format types here, -* so it is safe to take a type_i struct */ -struct uac_format_type_i_discrete_descriptor *fmt = fmt_raw; -switch (fmt->bFormatType) { +switch (fmt[3 ]) {case USB_FORMAT_TYPE_I :case USB_FORMAT_TYPE_III : - err =parse_audio_format_i (chip, fp, format, fmt); + err =parse_audio_format_i (chip, fp, format, fmt, iface);break ;case USB_FORMAT_TYPE_II : - err =parse_audio_format_ii (chip, fp, format, fmt); + err =parse_audio_format_ii (chip, fp, format, fmt, iface);break ;default :snd_printd (KERN_INFO "%d:%u:%d : format type %d is not supported yet\n" , - chip->dev->devnum, fp->iface, fp->altsetting, fmt->bFormatType); + chip->dev->devnum, fp->iface, fp->altsetting, fmt[3 ]);return -1 ; } - fp->fmt_type = fmt->bFormatType; + fp->fmt_type = fmt[3 ];if (err <0 )return err;#if 1
@@ -2673,7 +2816,7 @@ static int parse_audio_format(struct snd_usb_audio *chip, struct audioformat *fpif (chip->usb_id ==USB_ID (0x041e ,0x3000 ) || chip->usb_id ==USB_ID (0x041e ,0x3020 ) || chip->usb_id ==USB_ID (0x041e ,0x3061 )) { -if (fmt->bFormatType ==USB_FORMAT_TYPE_I && +if (fmt[3 ] ==USB_FORMAT_TYPE_I && fp->rates !=SNDRV_PCM_RATE_48000 && fp->rates !=SNDRV_PCM_RATE_96000 )return -1 ;
@@ -2702,10 +2845,10 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)struct usb_host_interface *alts;struct usb_interface_descriptor *altsd;int i, altno, err, stream; -int format; +int format =0 , num_channels =0 ;struct audioformat *fp =NULL ;unsigned char *fmt, *csep; -int num; +int num, protocol; dev = chip->dev;
@@ -2722,10 +2865,9 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) num =4 ;for (i =0 ; i < num; i++) { -struct uac_as_header_descriptor_v1 *as; - alts = &iface->altsetting[i]; altsd =get_iface_desc (alts); + protocol = altsd->bInterfaceProtocol;/* skip invalid one */ if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) ||
@@ -2742,7 +2884,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) stream = (get_endpoint (alts,0 )->bEndpointAddress &USB_DIR_IN ) ?SNDRV_PCM_STREAM_CAPTURE :SNDRV_PCM_STREAM_PLAYBACK ; altno = altsd->bAlternateSetting; - +/* audiophile usb: skip altsets incompatible with device_setup */ if (chip->usb_id == USB_ID(0x0763, 0x2003) &&
@@ -2750,21 +2892,54 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)continue ;/* get audio formats */ - as =snd_usb_find_csint_desc (alts->extra, alts->extralen,NULL ,AS_GENERAL ); +switch (protocol) { +case UAC_VERSION_1 : { +struct uac_as_header_descriptor_v1 *as = +snd_usb_find_csint_desc (alts->extra, alts->extralen,NULL ,AS_GENERAL ); + +if (!as) { +snd_printk (KERN_ERR "%d:%u:%d : AS_GENERAL descriptor not found\n" , + dev->devnum, iface_no, altno); +continue ; + } -if (!as) { -snd_printk (KERN_ERR "%d:%u:%d : AS_GENERAL descriptor not found\n" , - dev->devnum, iface_no, altno); -continue ; +if (as->bLength <sizeof (*as)) { +snd_printk (KERN_ERR "%d:%u:%d : invalid AS_GENERAL desc\n" , + dev->devnum, iface_no, altno); +continue ; + } + + format =le16_to_cpu (as->wFormatTag);/* remember the format value */ +break ; } -if (as->bLength <sizeof (*as)) { -snd_printk (KERN_ERR "%d:%u:%d : invalid AS_GENERAL desc\n" , - dev->devnum, iface_no, altno); -continue ; +case UAC_VERSION_2 : { +struct uac_as_header_descriptor_v2 *as = +snd_usb_find_csint_desc (alts->extra, alts->extralen,NULL ,AS_GENERAL ); + +if (!as) { +snd_printk (KERN_ERR "%d:%u:%d : AS_GENERAL descriptor not found\n" , + dev->devnum, iface_no, altno); +continue ; + } + +if (as->bLength <sizeof (*as)) { +snd_printk (KERN_ERR "%d:%u:%d : invalid AS_GENERAL desc\n" , + dev->devnum, iface_no, altno); +continue ; + } + + num_channels = as->bNrChannels; + format =le32_to_cpu (as->bmFormats); + +break ; } - format =le16_to_cpu (as->wFormatTag);/* remember the format value */ +default : +snd_printk (KERN_ERR "%d:%u:%d : unknown interface protocol %04x\n" , + dev->devnum, iface_no, altno, protocol); +continue ; + }/* get format type */ fmt =snd_usb_find_csint_desc (alts->extra, alts->extralen,NULL ,FORMAT_TYPE );
@@ -2773,7 +2948,8 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) dev->devnum, iface_no, altno);continue ; } -if (fmt[0 ] <8 ) { +if (((protocol ==UAC_VERSION_1 ) && (fmt[0 ] <8 )) || + ((protocol ==UAC_VERSION_2 ) && (fmt[0 ] !=6 ))) {snd_printk (KERN_ERR "%d:%u:%d : invalid FORMAT_TYPE desc\n" , dev->devnum, iface_no, altno);continue ;
@@ -2787,6 +2963,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no)if (fmt[4 ] ==1 && fmt[5 ] ==2 && altno ==2 && num ==3 && fp && fp->altsetting ==1 && fp->channels ==1 && fp->format ==SNDRV_PCM_FORMAT_S16_LE && + protocol ==UAC_VERSION_1 &&le16_to_cpu (get_endpoint (alts,0 )->wMaxPacketSize) == fp->maxpacksize *2 )continue ;
@@ -2815,6 +2992,8 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) fp->ep_attr =get_endpoint (alts,0 )->bmAttributes; fp->datainterval =parse_datainterval (chip, alts); fp->maxpacksize =le16_to_cpu (get_endpoint (alts,0 )->wMaxPacketSize); +/* num_channels is only set for v2 interfaces */ + fp->channels = num_channels;if (snd_usb_get_speed (dev) ==USB_SPEED_HIGH ) fp->maxpacksize = (((fp->maxpacksize >>11 ) &3 ) +1 ) * (fp->maxpacksize &0x7ff );
@@ -2850,7 +3029,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) }/* ok, let's parse further... */ -if (parse_audio_format (chip, fp, format, fmt, stream) <0 ) { +if (parse_audio_format (chip, fp, format, fmt, stream, alts) <0 ) {kfree (fp->rate_table);kfree (fp);continue ;
@@ -2958,35 +3137,82 @@ static int snd_usb_create_streams(struct snd_usb_audio *chip, int ctrlif) {struct usb_device *dev = chip->dev;struct usb_host_interface *host_iface; -struct uac_ac_header_descriptor_v1 *h1; +struct usb_interface_descriptor *altsd;void *control_header; -int i; +int i, protocol;/* find audiocontrol interface */ host_iface = &usb_ifnum_to_if (dev, ctrlif)->altsetting[0 ]; control_header =snd_usb_find_csint_desc (host_iface->extra, host_iface->extralen,NULL ,HEADER ); + altsd =get_iface_desc (host_iface); + protocol = altsd->bInterfaceProtocol;if (!control_header) {snd_printk (KERN_ERR "cannot find HEADER\n" );return -EINVAL ; } - h1 = control_header; +switch (protocol) { +case UAC_VERSION_1 : { +struct uac_ac_header_descriptor_v1 *h1 = control_header; -if (!h1->bInCollection) { -snd_printk (KERN_INFO "skipping empty audio interface (v1)\n" ); -return -EINVAL ; +if (!h1->bInCollection) { +snd_printk (KERN_INFO "skipping empty audio interface (v1)\n" ); +return -EINVAL ; + } + +if (h1->bLength <sizeof (*h1) + h1->bInCollection) { +snd_printk (KERN_ERR "invalid HEADER (v1)\n" ); +return -EINVAL ; + } + +for (i =0 ; i < h1->bInCollection; i++) +snd_usb_create_stream (chip, ctrlif, h1->baInterfaceNr[i]); + +break ; } -if (h1->bLength <sizeof (*h1) + h1->bInCollection) { -snd_printk (KERN_ERR "invalid HEADER (v1)\n" ); -return -EINVAL ; +case UAC_VERSION_2 : { +struct uac_clock_source_descriptor *cs; +struct usb_interface_assoc_descriptor *assoc = +usb_ifnum_to_if (dev, ctrlif)->intf_assoc; + +if (!assoc) { +snd_printk (KERN_ERR "Audio class v2 interfaces need an interface association\n" ); +return -EINVAL ; + } + +/* FIXME: for now, we expect there is at least one clock source +* descriptor and we always take the first one. +* We should properly support devices with multiple clock sources, +* clock selectors and sample rate conversion units. */ + + cs =snd_usb_find_csint_desc (host_iface->extra, host_iface->extralen, +NULL ,CLOCK_SOURCE ); + +if (!cs) { +snd_printk (KERN_ERR "CLOCK_SOURCE descriptor not found\n" ); +return -EINVAL ; + } + + chip->clock_id = cs->bClockID; + +for (i =0 ; i < assoc->bInterfaceCount; i++) { +int intf = assoc->bFirstInterface + i; + +if (intf != ctrlif) +snd_usb_create_stream (chip, ctrlif, intf); + } + +break ; } -for (i =0 ; i < h1->bInCollection; i++) -snd_usb_create_stream (chip, ctrlif, h1->baInterfaceNr[i]); +default : +snd_printk (KERN_ERR "unknown protocol version 0x%02x\n" , protocol); +return -EINVAL ; + }return 0 ; }
sound/usb/usbaudio.h +3 -0
@@ -142,6 +142,9 @@ struct snd_usb_audio {int num_interfaces;int num_suspended_intf; +/* for audio class v2 */ +int clock_id; +struct list_head pcm_list;/* list of pcm streams */ int pcm_devs;
Signature · 1 line
1.6.6.2
PATCH 4/5 ALSA: usbmixer: bail out early when parsing audio class v2 descriptors
In reply to Daniel MackThis is just a quick hack that needs to be removed once the new units defined by the audio class v2.0 standard are supported.
However, it allows using these devices for now, without mixer support.
--- sound/usb/usbmixer.c | 13 ++++++++++++- 1 files changed, 12 insertions(+), 1 deletions(-)
sound/usb/usbmixer.c +12 -1
@@ -2211,7 +2211,8 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif, .dev_free = snd_usb_mixer_dev_free };struct usb_mixer_interface *mixer; -int err; +struct usb_host_interface *host_iface; +int err, protocol;strcpy (chip->card->mixername,"USB Mixer" );
@@ -2227,6 +2228,16 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif,return -ENOMEM ; } + host_iface = &usb_ifnum_to_if (chip->dev, ctrlif)->altsetting[0 ]; + protocol = host_iface->desc.bInterfaceProtocol; + +/* FIXME! */ +if (protocol !=UAC_VERSION_1 ) { +snd_printk (KERN_WARNING "mixer interface protocol 0x%02x not yet supported\n" , + protocol); +return 0 ; + } +if ((err =snd_usb_mixer_controls (mixer)) <0 || (err =snd_usb_mixer_status_create (mixer)) <0 ) goto _error;
Signature · 1 line
1.6.6.2
PATCH 5/5 ALSA: usbaudio: consolidate header files
In reply to Daniel MackUse the definitions from linux/usb/audio.h all over the ALSA USB audio driver and add some missing definitions there as well.
Use the endpoint attribute macros from linux/usb/ch9 and remove the own things from sound/usb/usbaudio.h.
Now things are also nicely prefixed which makes understanding the code easier.
--- include/linux/usb/audio.h | 31 ++++++++++- sound/usb/usbaudio.c | 125 +++++++++++++++++++++++---------------------- sound/usb/usbaudio.h | 100 ------------------------------------ sound/usb/usbmidi.c | 10 ++-- sound/usb/usbmixer.c | 62 +++++++++++----------- sound/usb/usbquirks.h | 32 ++++++------ 6 files changed, 145 insertions(+), 215 deletions(-)
include/linux/usb/audio.h +29 -2
@@ -35,8 +35,17 @@#define UAC_MIXER_UNIT 0x04#define UAC_SELECTOR_UNIT 0x05#define UAC_FEATURE_UNIT 0x06 -#define UAC_PROCESSING_UNIT 0x07 -#define UAC_EXTENSION_UNIT 0x08 +#define UAC_PROCESSING_UNIT_V1 0x07 +#define UAC_EXTENSION_UNIT_V1 0x08 + +/* UAC v2.0 types */ +#define UAC_EFFECT_UNIT 0x07 +#define UAC_PROCESSING_UNIT_V2 0x08 +#define UAC_EXTENSION_UNIT_V2 0x09 +#define UAC_CLOCK_SOURCE 0x0a +#define UAC_CLOCK_SELECTOR 0x0b +#define UAC_CLOCK_MULTIPLIER 0x0c +#define UAC_SAMPLE_RATE_CONVERTER 0x0d/* A.6 Audio Class-Specific AS Interface Descriptor Subtypes */ #define UAC_AS_GENERAL 0x01
@@ -69,6 +78,10 @@#define UAC_GET_STAT 0xff +/* Audio class v2.0 handles all the parameter calls differently */ +#define UAC2_CS_CUR 0x01 +#define UAC2_CS_RANGE 0x02 +/* MIDI - A.1 MS Class-Specific Interface Descriptor Subtypes */ #define UAC_MS_HEADER 0x01#define UAC_MIDI_IN_JACK 0x02
@@ -133,6 +146,10 @@ struct uac_input_terminal_descriptor {#define UAC_INPUT_TERMINAL_MICROPHONE_ARRAY 0x205#define UAC_INPUT_TERMINAL_PROC_MICROPHONE_ARRAY 0x206 +/* Terminals - control selectors */ + +#define UAC_TERMINAL_CS_COPY_PROTECT_CONTROL 0x01 +/* 4.3.2.2 Output Terminal Descriptor */ struct uac_output_terminal_descriptor_v1 {__u8 bLength;/* in bytes: 9 */
@@ -263,6 +280,9 @@ struct uac_format_type_i_ext_descriptor {/* Formats - Audio Data Format Type I Codes */ +#define UAC_FORMAT_TYPE_II_MPEG 0x1001 +#define UAC_FORMAT_TYPE_II_AC3 0x1002 +struct uac_format_type_ii_discrete_descriptor {__u8 bLength;__u8 bDescriptorType;
@@ -285,6 +305,13 @@ struct uac_format_type_ii_ext_descriptor {__u8 bSideBandProtocol; } __attribute__((packed)); +/* type III */ +#define UAC_FORMAT_TYPE_III_IEC1937_AC3 0x2001 +#define UAC_FORMAT_TYPE_III_IEC1937_MPEG1_LAYER1 0x2002 +#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_NOEXT 0x2003 +#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_EXT 0x2004 +#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER1_LS 0x2005 +#define UAC_FORMAT_TYPE_III_IEC1937_MPEG2_LAYER23_LS 0x2006/* Formats - A.2 Format Type Codes */ #define UAC_FORMAT_TYPE_UNDEFINED 0x0
sound/usb/usbaudio.c +63 -62
400 lines not on this page · raw message
sound/usb/usbaudio.h +0 -100
106 lines not on this page · raw message
sound/usb/usbmidi.c +6 -4
@@ -46,6 +46,8 @@#include <linux/timer.h> #include <linux/usb.h> #include <linux/wait.h> +#include <linux/usb/audio.h> +#include <sound/core.h> #include <sound/control.h> #include <sound/rawmidi.h>
@@ -1522,7 +1524,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,if (hostif->extralen >=7 && ms_header->bLength >=7 && ms_header->bDescriptorType ==USB_DT_CS_INTERFACE && - ms_header->bDescriptorSubtype ==HEADER ) + ms_header->bDescriptorSubtype ==UAC_HEADER )snd_printdd (KERN_INFO "MIDIStreaming version %02x.%02x\n" , ms_header->bcdMSC[1 ], ms_header->bcdMSC[0 ]);else
@@ -1538,7 +1540,7 @@ static int snd_usbmidi_get_ms_info(struct snd_usb_midi* umidi,if (hostep->extralen <4 || ms_ep->bLength <4 || ms_ep->bDescriptorType !=USB_DT_CS_ENDPOINT || - ms_ep->bDescriptorSubtype !=MS_GENERAL ) + ms_ep->bDescriptorSubtype !=UAC_MS_GENERAL )continue ;if (usb_endpoint_dir_out (ep)) {if (endpoints[epidx].out_ep) {
@@ -1750,9 +1752,9 @@ static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi, cs_desc < hostif->extra + hostif->extralen && cs_desc[0 ] >=2 ; cs_desc += cs_desc[0]) {if (cs_desc[1 ] ==USB_DT_CS_INTERFACE ) { -if (cs_desc[2 ] ==MIDI_IN_JACK ) +if (cs_desc[2 ] ==UAC_MIDI_IN_JACK ) endpoint->in_cables = (endpoint->in_cables <<1 ) |1 ; -else if (cs_desc[2 ] ==MIDI_OUT_JACK ) +else if (cs_desc[2 ] ==UAC_MIDI_OUT_JACK ) endpoint->out_cables = (endpoint->out_cables <<1 ) |1 ; } }
sound/usb/usbmixer.c +31 -31
184 lines not on this page · raw message
sound/usb/usbquirks.h +16 -16
@@ -91,7 +91,7 @@ .idVendor = 0x046d, .idProduct = 0x0850, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass =USB_SUBCLASS_AUDIO_CONTROL + .bInterfaceSubClass =USB_SUBCLASS_AUDIOCONTROL }, { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
@@ -100,7 +100,7 @@ .idVendor = 0x046d, .idProduct = 0x08ae, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass =USB_SUBCLASS_AUDIO_CONTROL + .bInterfaceSubClass =USB_SUBCLASS_AUDIOCONTROL }, { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
@@ -109,7 +109,7 @@ .idVendor = 0x046d, .idProduct = 0x08c6, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass =USB_SUBCLASS_AUDIO_CONTROL + .bInterfaceSubClass =USB_SUBCLASS_AUDIOCONTROL }, { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
@@ -118,7 +118,7 @@ .idVendor = 0x046d, .idProduct = 0x08f0, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass =USB_SUBCLASS_AUDIO_CONTROL + .bInterfaceSubClass =USB_SUBCLASS_AUDIOCONTROL }, { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
@@ -127,7 +127,7 @@ .idVendor = 0x046d, .idProduct = 0x08f5, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass =USB_SUBCLASS_AUDIO_CONTROL + .bInterfaceSubClass =USB_SUBCLASS_AUDIOCONTROL }, { .match_flags = USB_DEVICE_ID_MATCH_DEVICE |
@@ -136,7 +136,7 @@ .idVendor = 0x046d, .idProduct = 0x08f6, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL }, { USB_DEVICE(0x046d, 0x0990),
@@ -301,7 +301,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), .iface = 1, .altsetting = 1, .altset_idx = 1, - .attributes = EP_CS_ATTR_FILL_MAX, + .attributes = UAC_EP_CS_ATTR_FILL_MAX, .endpoint = 0x81, .ep_attr = 0x05, .rates = SNDRV_PCM_RATE_CONTINUOUS,
@@ -2081,7 +2081,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { .vendor_name ="Hauppauge" , .product_name ="HVR-950Q" ,
@@ -2095,7 +2095,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { .vendor_name ="Hauppauge" , .product_name ="HVR-950Q" ,
@@ -2109,7 +2109,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { .vendor_name ="Hauppauge" , .product_name ="HVR-950Q" ,
@@ -2123,7 +2123,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { .vendor_name ="Hauppauge" , .product_name ="HVR-950Q" ,
@@ -2137,7 +2137,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { .vendor_name ="Hauppauge" , .product_name ="HVR-950Q" ,
@@ -2151,7 +2151,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { .vendor_name ="Hauppauge" , .product_name ="HVR-950Q" ,
@@ -2165,7 +2165,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { .vendor_name ="Hauppauge" , .product_name ="HVR-950Q" ,
@@ -2179,7 +2179,7 @@ YAMAHA_DEVICE(0x7010, "UB99"),USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass = USB_SUBCLASS_AUDIO_CONTROL, + .bInterfaceSubClass = USB_SUBCLASS_AUDIOCONTROL, .driver_info = (unsigned long ) &(const struct snd_usb_audio_quirk ) { .vendor_name ="Hauppauge" , .product_name ="HVR-850" ,
@@ -2196,7 +2196,7 @@ YAMAHA_DEVICE(0x7010, "UB99"), .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS | USB_DEVICE_ID_MATCH_INT_SUBCLASS, .bInterfaceClass = USB_CLASS_AUDIO, - .bInterfaceSubClass = USB_SUBCLASS_MIDI_STREAMING, + .bInterfaceSubClass = USB_SUBCLASS_MIDISTREAMING, .driver_info = (unsigned long ) & (const struct snd_usb_audio_quirk ) { .ifnum =QUIRK_ANY_INTERFACE , .type =QUIRK_MIDI_STANDARD_INTERFACE
Signature · 1 line
1.6.6.2
Re: [PATCH 5/5] ALSA: usbaudio: consolidate header files
At Mon, 22 Feb 2010 23:49:13 +0100,
Quoted 11 lines · Daniel Mack
Use the definitions from
linux/usb/audio.hall over the ALSA USB audio driver and add some missing definitions there as well.Use the endpoint attribute macros from linux/usb/ch9 and remove the own things from
sound/usb/usbaudio.h.Now things are also nicely prefixed which makes understanding the code easier.
Signed-off-by Daniel Mack <[email protected]>
You forgot about non-standard usb-audio driver...
I fixed up the compile errors and warnings and put all patches now to topic/usb-v2.0 branch on sound git tree as a reference.
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git topic/usb-v2.0
thanks,
Takashi