aboutsummaryrefslogtreecommitdiffstats
path: root/sound/usb
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2013-04-16 12:01:40 -0400
committerTakashi Iwai <tiwai@suse.de>2013-04-18 04:03:53 -0400
commit126825e7ea271ae8e3172e10ca1fc22c908b5385 (patch)
treeb19bbca378e58874625132b41aaaea1855ec44f6 /sound/usb
parent44dcbbb1cd615634c09d1bf31c124332795903a8 (diff)
ALSA: snd-usb: add quirks handler for DSD streams
Unfortunately, none of the UAC standards provides a way to identify DSD (Direct Stream Digital) formats. Hence, this patch adds a quirks handler to identify USB interfaces that are capable of handling DSD. That quirks handler can augment the already parsed formats bit-field, by any of the new SNDRV_PCM_FMTBIT_DSD_{U8_U16} and setting the dsd_dop flag in the audio format, if the driver should take care for the DOP byte stuffing. The only devices that are known to work with this are the ones with a 'Playback Designs' vendor id. Signed-off-by: Daniel Mack <zonque@gmail.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r--sound/usb/format.c3
-rw-r--r--sound/usb/quirks.c28
-rw-r--r--sound/usb/quirks.h4
3 files changed, 35 insertions, 0 deletions
diff --git a/sound/usb/format.c b/sound/usb/format.c
index 20c775170959..020ede0259eb 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -136,6 +136,9 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip,
136 snd_printk(KERN_INFO "%d:%u:%d : unsupported format bits %#x\n", 136 snd_printk(KERN_INFO "%d:%u:%d : unsupported format bits %#x\n",
137 chip->dev->devnum, fp->iface, fp->altsetting, format); 137 chip->dev->devnum, fp->iface, fp->altsetting, format);
138 } 138 }
139
140 pcm_formats |= snd_usb_interface_dsd_format_quirks(chip, fp, sample_bytes);
141
139 return pcm_formats; 142 return pcm_formats;
140} 143}
141 144
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 175fbb7d334a..e564adb74852 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -916,3 +916,31 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
916 mdelay(20); 916 mdelay(20);
917} 917}
918 918
919/*
920 * snd_usb_interface_dsd_format_quirks() is called from format.c to
921 * augment the PCM format bit-field for DSD types. The UAC standards
922 * don't have a designated bit field to denote DSD-capable interfaces,
923 * hence all hardware that is known to support this format has to be
924 * listed here.
925 */
926u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
927 struct audioformat *fp,
928 unsigned int sample_bytes)
929{
930 /* Playback Designs */
931 if (le16_to_cpu(chip->dev->descriptor.idVendor) == 0x23ba) {
932 switch (fp->altsetting) {
933 case 1:
934 fp->dsd_dop = true;
935 return SNDRV_PCM_FMTBIT_DSD_U16_LE;
936 case 2:
937 fp->dsd_bitrev = true;
938 return SNDRV_PCM_FMTBIT_DSD_U8;
939 case 3:
940 fp->dsd_bitrev = true;
941 return SNDRV_PCM_FMTBIT_DSD_U16_LE;
942 }
943 }
944
945 return 0;
946}
diff --git a/sound/usb/quirks.h b/sound/usb/quirks.h
index 7c3681fd1c3c..665e972a1b40 100644
--- a/sound/usb/quirks.h
+++ b/sound/usb/quirks.h
@@ -31,4 +31,8 @@ void snd_usb_ctl_msg_quirk(struct usb_device *dev, unsigned int pipe,
31 __u8 request, __u8 requesttype, __u16 value, 31 __u8 request, __u8 requesttype, __u16 value,
32 __u16 index, void *data, __u16 size); 32 __u16 index, void *data, __u16 size);
33 33
34u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
35 struct audioformat *fp,
36 unsigned int sample_bytes);
37
34#endif /* __USBAUDIO_QUIRKS_H */ 38#endif /* __USBAUDIO_QUIRKS_H */