Skip to contentSkip to conversation

More generic way to detect DSD capabilities

PATCH New Jussi Laako 2 participants 5 messages Jun 12, 2018 – Jun 13, 2018 Sound

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

#1 lore raw

PATCH 1/2 ALSA: usb-audio: Add native DSD support for Mytek DACs

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.

---
 sound/usb/card.h   |  1 +
 sound/usb/format.c |  5 ++++-
 sound/usb/quirks.c | 12 ++++++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)
sound/usb/card.h +1 -0
index 1406292..9b41b7d 100644
@@ -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;
sound/usb/format.c +4 -1
index 49e7ec6..0a2a27f 100644
@@ -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;
sound/usb/quirks.c +12 -0
index f4b6917..cc7a623 100644
@@ -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;
 }
 
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/2] ALSA: usb-audio: Add native DSD support for Mytek DACs

Quoted 7 lines · Jussi Laako

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.

It's a good idea. Applied now.

thanks,

Takashi

#3 lore raw

PATCH 2/2 ALSA: usb-audio: Generic DSD detection for XMOS-based implementations

In reply to Jussi Laako

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.

---
 sound/usb/quirks.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
sound/usb/quirks.c +1 -2
index cc7a623..845112c 100644
@@ -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;
Signature · 1 line
2.7.4
Applied
#4 lore raw

Re: [PATCH 2/2] ALSA: usb-audio: Generic DSD detection for XMOS-based implementations

Quoted 6 lines · Jussi Laako

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.

Applied, thanks.

Takashi