ALSA: include/linux/usb/audio.h: add __attribute__((packed))
PATCH 1/2 ALSA: include/linux/usb/audio.h: add __attribute__((packed))
This was missing on the definition of struct uac_iso_endpoint_descriptor
--- include/linux/usb/audio.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/linux/usb/audio.h +1 -1
@@ -456,7 +456,7 @@ struct uac_iso_endpoint_descriptor {__u8 bmAttributes;__u8 bLockDelayUnits;__le16 wLockDelay; -}; +} __attribute__((packed));#define UAC_ISO_ENDPOINT_DESC_SIZE 7#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01
Signature · 1 line
1.7.1
PATCH 2/2 ALSA: sound/usb: add preliminary support for UAC2 interrupts
For both UAC1 and UAC2, interrupt endpoint messages are now parsed with structs rather that with anonymous buffer array accesses.
For UAC2, only CUR interrupt notifications are supported for now.
snd_usb_mixer_status_complete() was renamed tosnd_usb_mixer_interrupt().
Fixed one indentation flaw on the way.
--- include/linux/usb/audio-v2.h | 12 +++++ include/linux/usb/audio.h | 15 ++++++ sound/usb/mixer.c | 98 ++++++++++++++++++++++++++++++++++++------ 3 files changed, 112 insertions(+), 13 deletions(-)
include/linux/usb/audio-v2.h +12 -0
@@ -105,6 +105,17 @@ struct uac_as_header_descriptor_v2 {__u8 iChannelNames; } __attribute__((packed)); +/* 6.1 Interrupt Data Message */ + +#define UAC2_INTERRUPT_DATA_MSG_VENDOR (1 << 0) +#define UAC2_INTERRUPT_DATA_MSG_EP (1 << 1) + +struct uac2_interrupt_data_msg { +__u8 bInfo; +__u8 bAttribute; +__le16 wValue; +__le16 wIndex; +} __attribute__((packed));/* A.7 Audio Function Category Codes */ #define UAC2_FUNCTION_SUBCLASS_UNDEFINED 0x00
@@ -153,6 +164,7 @@ struct uac_as_header_descriptor_v2 {/* A.14 Audio Class-Specific Request Codes */ #define UAC2_CS_CUR 0x01#define UAC2_CS_RANGE 0x02 +#define UAC2_CS_MEM 0x03/* A.15 Encoder Type Codes */ #define UAC2_ENCODER_UNDEFINED 0x00
include/linux/usb/audio.h +15 -0
@@ -488,6 +488,21 @@ struct uac_iso_endpoint_descriptor {#define UAC_FU_BASS_BOOST (1 << (UAC_BASS_BOOST_CONTROL - 1))#define UAC_FU_LOUDNESS (1 << (UAC_LOUDNESS_CONTROL - 1)) +/* status word format (3.7.1.1) */ + +#define UAC1_STATUS_TYPE_ORIG_MASK 0x0f +#define UAC1_STATUS_TYPE_ORIG_AUDIO_CONTROL_IF 0x0 +#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_IF 0x1 +#define UAC1_STATUS_TYPE_ORIG_AUDIO_STREAM_EP 0x2 + +#define UAC1_STATUS_TYPE_IRQ_PENDING (1 << 7) +#define UAC1_STATUS_TYPE_MEM_CHANGED (1 << 6) + +struct uac1_status_word { +__u8 bStatusType; +__u8 bOriginator; +} __attribute__((packed)); +#ifdef __KERNEL__ struct usb_audio_control {
sound/usb/mixer.c +85 -13
126 lines not on this page · raw message
Signature · 1 line
1.7.1
Takashi Iwai
AppliedAt Tue, 11 May 2010 18:13:49 +0200,
Quoted 6 lines · Daniel Mack
This was missing on the definition of struct
uac_iso_endpoint_descriptorSigned-off-by Daniel Mack <[email protected]>Cc Takashi Iwai <[email protected]>Cc Clemens Ladisch <[email protected]>
Applied these fixes now. Thanks.
Takashi
Quoted 20 lines
--- include/linux/usb/audio.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)include/linux/usb/audio.h +1
-1@@ -456,7 +456,7 @@ struct uac_iso_endpoint_descriptor {__u8 bmAttributes;__u8 bLockDelayUnits;__le16 wLockDelay; -}; +} __attribute__((packed));#define UAC_ISO_ENDPOINT_DESC_SIZE 7#define UAC_EP_CS_ATTR_SAMPLE_RATE 0x01Signature · 1 line
1.7.1
Quoted 10 lines · Takashi Iwai
At Tue, 11 May 2010 18:13:49 +0200,
Quoted 6 lines · Daniel Mack
This was missing on the definition of struct
uac_iso_endpoint_descriptorSigned-off-by Daniel Mack <[email protected]>Cc Takashi Iwai <[email protected]>Cc Clemens Ladisch <[email protected]>Applied these fixes now. Thanks.
Thanks! One of the noted TODOs is that UAC2 offers the ability to a device to dynamically change the supported range of options for a given control. So an enum-driven control can get new values, lose some, whatever. What would be the best way to map that to ALSA controls?
Another thing that we would need to support at some time is clock selectors to switch from an internal clock to some external one. And this can also be notfied dynamically - so for example: once an external S/PDIF transmitter is connected, the driver gets informed about a new valid clock source. I haven't found anything how this could be passed on to higher levels from a driver, but I might have missed something :)
Daniel
Quoted 5 lines · Daniel Mack
...
Thanks! One of the noted TODOs is that UAC2 offers the ability to a device to dynamically change the supported range of options for a given control. So an enum-driven control can get new values, lose some, whatever. What would be the best way to map that to ALSA controls?
The control callbacks accept and return the new values; userspace gets notified of the changed control information with snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO, &elem_id);
I'm quite sure that alsamixer can cope with this, but I don't know about any other mixers. :)
I think "alsactl restore" already does the right thing for controls that have changed.
Quoted 6 lines
Another thing that we would need to support at some time is clock selectors to switch from an internal clock to some external one. And this can also be notfied dynamically - so for example: once an external S/PDIF transmitter is connected, the driver gets informed about a new valid clock source. I haven't found anything how this could be passed on to higher levels from a driver, but I might have missed something :)
With a mixer control "Clock Source", of course. :) Or are you talking about new samples rates made available?
Regards,
Clemens
Quoted 24 lines · Clemens Ladisch
Quoted 5 lines · Daniel Mack
...
Thanks! One of the noted TODOs is that UAC2 offers the ability to a device to dynamically change the supported range of options for a given control. So an enum-driven control can get new values, lose some, whatever. What would be the best way to map that to ALSA controls?The control callbacks accept and return the new values; userspace gets notified of the changed control information with
snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO, &elem_id);I'm quite sure that alsamixer can cope with this, but I don't know about any other mixers. :)
I think "alsactl restore" already does the right thing for controls that have changed.
Quoted 6 lines
Another thing that we would need to support at some time is clock selectors to switch from an internal clock to some external one. And this can also be notfied dynamically - so for example: once an external S/PDIF transmitter is connected, the driver gets informed about a new valid clock source. I haven't found anything how this could be passed on to higher levels from a driver, but I might have missed something :)
Quoted 2 lines
With a mixer control "Clock Source", of course. :) Or are you talking about new samples rates made available?
This is in theory possible, yet rather unlikely in reality. But a range descriptor for available (valid) clock sources could do such a thing.
Ok, I'll go ahead and implement it, and then see what it takes.
Thanks,
Daniel