From 6227286d980d0bb40bb71d76ce0da7900f1f8f6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=A9=20Koerkamp?= Date: Fri, 4 Jan 2019 12:08:14 +0100 Subject: [PATCH] USB Audio: improve native DSD playback detection (#5) --- sound/usb/card.h | 1 + sound/usb/format.c | 5 ++++- sound/usb/quirks.c | 26 +++++++++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/sound/usb/card.h b/sound/usb/card.h index bf2889a2..1bb17983 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -30,6 +30,7 @@ struct audioformat { struct snd_pcm_chmap_elem *chmap; /* (optional) channel map */ bool dsd_dop; /* add DOP headers in case of DSD samples */ bool dsd_bitrev; /* reverse the bits of each DSD sample */ + bool dsd_raw; /* altsetting is raw DSD */ }; struct snd_usb_substream; diff --git a/sound/usb/format.c b/sound/usb/format.c index 99299ffb..626d8e26 100644 --- a/sound/usb/format.c +++ b/sound/usb/format.c @@ -64,8 +64,11 @@ static u64 parse_audio_format_i_type(struct snd_usb_audio *chip, sample_width = fmt->bBitResolution; sample_bytes = fmt->bSubslotSize; - if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) + if (format & UAC2_FORMAT_TYPE_I_RAW_DATA) { pcm_formats |= SNDRV_PCM_FMTBIT_SPECIAL; + /* flag potentially raw DSD capable altsettings */ + fp->dsd_raw = true; + } format <<= 1; break; diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index e10a93eb..35dbfe5b 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -987,11 +987,13 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, case USB_ID(0x22d9, 0x0436): /* OPPO Sonica */ case USB_ID(0x22d9, 0x0461): /* OPPO UDP-205 */ case USB_ID(0x2522, 0x0012): /* LH Labs VI DAC Infinity */ + case USB_ID(0x2772, 0x0230): /* Pro-Ject Pre Box S2 Digital */ case USB_ID(0x25ce, 0x001f): /* Mytek Brooklyn DAC */ if (fp->altsetting == 2) return SNDRV_PCM_FMTBIT_DSD_U32_BE; break; + case USB_ID(0x16d0, 0x09dd): /* Encore mDSD */ case USB_ID(0x0d8c, 0x0316): /* Hegel HD12 DSD */ case USB_ID(0x16b0, 0x06b2): /* NuPrime DAC-10 */ case USB_ID(0x16d0, 0x0733): /* Furutech ADL Stratos */ @@ -1020,7 +1022,10 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, break; /* Amanero Combo384 USB interface with native DSD support */ - case USB_ID(0x16d0, 0x071a): + case USB_ID(0x16d0, 0x071a): /* Amanero - Combo384 */ + case USB_ID(0x2ab6, 0x0004): /* T+A DAC8DSD-V2.0, MP1000E-V2.0, MP2000R-V2.0, MP2500R-V2.0, MP3100HV-V2.0 */ + case USB_ID(0x2ab6, 0x0005): /* T+A USB HD Audio 1 */ + case USB_ID(0x2ab6, 0x0006): /* T+A USB HD Audio 2 */ if (fp->altsetting == 2) { // switch (chip->dev->descriptor.bcdDevice) { switch (le16_to_cpu(chip->dev->descriptor.bcdDevice)) { @@ -1033,10 +1038,29 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, } } break; + case USB_ID(0x16d0, 0x0a23): + if (fp->altsetting == 2) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + break; + default: + break; + } + /* Mostly generic method to detect many DSD-capable implementations - + * from XMOS/Thesycon + */ + switch (USB_ID_VENDOR(chip->usb_id)) { + case 0x20b1: /* XMOS based devices */ + case 0x152a: /* Thesycon devices */ + case 0x25ce: /* Mytek devices */ + if (fp->dsd_raw) { + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + } + break; default: break; + } return 0;