diff options
author | Daniel Mack <zonque@gmail.com> | 2013-03-17 20:07:25 +0800 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2013-03-18 08:47:13 +0100 |
commit | 717bfb5f46f0ee809f6ce04ebdf44521730fff05 (patch) | |
tree | 0d49f0649c15ef37f9f6c04fdb5f2cfd57da90fe | |
parent | 2fcdb06d4919da89ed6d52742dcc83ae4669ac30 (diff) | |
download | op-kernel-dev-717bfb5f46f0ee809f6ce04ebdf44521730fff05.zip op-kernel-dev-717bfb5f46f0ee809f6ce04ebdf44521730fff05.tar.gz |
ALSA: snd-usb: handle raw data format of UAC2 devices
UAC2 compliant audio devices may announce the capability to transport
raw audio data on their endpoints. Catch this and handle it as
'special' stream on the ALSA side.
Signed-off-by: Daniel Mack <zonque@gmail.com>
Reported-by: Andreas Koch <andreas@akdesigninc.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | include/linux/usb/audio-v2.h | 2 | ||||
-rw-r--r-- | sound/usb/format.c | 11 |
2 files changed, 9 insertions, 4 deletions
diff --git a/include/linux/usb/audio-v2.h b/include/linux/usb/audio-v2.h index ed13053..c5f2158 100644 --- a/include/linux/usb/audio-v2.h +++ b/include/linux/usb/audio-v2.h @@ -170,6 +170,8 @@ struct uac2_as_header_descriptor { __u8 iChannelNames; } __attribute__((packed)); +#define UAC2_FORMAT_TYPE_I_RAW_DATA (1 << 31) + /* 4.10.1.2 Class-Specific AS Isochronous Audio Data Endpoint Descriptor */ struct uac2_iso_endpoint_descriptor { diff --git a/sound/usb/format.c b/sound/usb/format.c index b30d6fb..a695caf 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -47,7 +47,7 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, int protocol) { int sample_width, sample_bytes; - u64 pcm_formats; + u64 pcm_formats = 0; switch (protocol) { case UAC_VERSION_1: @@ -63,14 +63,17 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, struct uac_format_type_i_ext_descriptor *fmt = _fmt; sample_width = fmt->bBitResolution; sample_bytes = fmt->bSubslotSize; + + if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) + pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL; + format <<= 1; break; } } - pcm_formats = 0; - - if (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED)) { + if ((pcm_formats == 0) && + (format == 0 || format == (1 << UAC_FORMAT_TYPE_I_UNDEFINED))) { /* some devices don't define this correctly... */ snd_printdd(KERN_INFO "%d:%u:%d : format type 0 is detected, processed as PCM\n", chip->dev->devnum, fp->iface, fp->altsetting); |