[alsa-devel] [PATCH] More generic way to detect DSD capabilities
There is a more generic way to detect DSD capability of popular UAC2 implementations. Advantage is that each new device with DSD capability doesn't have to be explicitly listed through VID:PID.
XMOS/Thesycon implementation uses this method. As a safety precaution I have still left VID detection in place. Many of the implementations use XMOS' VID, but not all. I have moved over the devices that have been tested with these patches. Likely more of at least XMOS VID ones could be removed from the explicit list, but I opted for careful approach.
Add new mostly generic code with Mytek VID to support native DSD mode.
This implementation should be easier to maintain when manufacturers release new products.
Signed-off-by: Jussi Laako jussi@sonarnerd.net --- sound/usb/card.h | 1 + sound/usb/format.c | 5 ++++- sound/usb/quirks.c | 12 ++++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/sound/usb/card.h b/sound/usb/card.h index 1406292..9b41b7d 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -32,6 +32,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 49e7ec6..0a2a27f 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 f4b6917..cc7a623 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1443,6 +1443,18 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, return SNDRV_PCM_FMTBIT_DSD_U32_BE; }
+ /* Mostly generic method to detect many DSD-capable implementations - + * from XMOS/Thesycon */ + switch (USB_ID_VENDOR(chip->usb_id)) { + case 0x25ce: /* Mytek devices */ + if (fp->dsd_raw) + return SNDRV_PCM_FMTBIT_DSD_U32_BE; + break; + default: + break; + + } + return 0; }
On Wed, 13 Jun 2018 00:43:01 +0200, Jussi Laako wrote:
Add new mostly generic code with Mytek VID to support native DSD mode.
This implementation should be easier to maintain when manufacturers release new products.
Signed-off-by: Jussi Laako jussi@sonarnerd.net
It's a good idea. Applied now.
thanks,
Takashi
Use more generic method to detect DSD capability of XMOS-based UAC2 implementations in order to support future devices without having to explicitly list every device separately.
Signed-off-by: Jussi Laako jussi@sonarnerd.net --- sound/usb/quirks.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index cc7a623..845112c 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1362,7 +1362,6 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, case USB_ID(0x1511, 0x0037): /* AURALiC VEGA */ case USB_ID(0x20b1, 0x0002): /* Wyred 4 Sound DAC-2 DSD */ case USB_ID(0x20b1, 0x2004): /* Matrix Audio X-SPDIF 2 */ - case USB_ID(0x20b1, 0x3008): /* iFi Audio micro/nano iDSD */ case USB_ID(0x20b1, 0x2008): /* Matrix Audio X-Sabre */ case USB_ID(0x20b1, 0x300a): /* Matrix Audio Mini-i Pro */ case USB_ID(0x22d9, 0x0416): /* OPPO HA-1 */ @@ -1389,7 +1388,6 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, case USB_ID(0x20b1, 0x3021): /* Eastern El. MiniMax Tube DAC Supreme */ case USB_ID(0x20b1, 0x3023): /* Aune X1S 32BIT/384 DSD DAC */ case USB_ID(0x20b1, 0x302d): /* Unison Research Unico CD Due */ - case USB_ID(0x20b1, 0x3036): /* Holo Springs Level 3 R2R DAC */ case USB_ID(0x20b1, 0x307b): /* CH Precision C1 DAC */ case USB_ID(0x20b1, 0x3086): /* Singxer F-1 converter board */ case USB_ID(0x22d9, 0x0426): /* OPPO HA-2 */ @@ -1446,6 +1444,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip, /* 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 0x25ce: /* Mytek devices */ if (fp->dsd_raw) return SNDRV_PCM_FMTBIT_DSD_U32_BE;
On Wed, 13 Jun 2018 00:43:02 +0200, Jussi Laako wrote:
Use more generic method to detect DSD capability of XMOS-based UAC2 implementations in order to support future devices without having to explicitly list every device separately.
Signed-off-by: Jussi Laako jussi@sonarnerd.net
Applied, thanks.
Takashi
participants (2)
-
Jussi Laako
-
Takashi Iwai