All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 13/15] ALSA: usb-audio: Move generic DSD raw detection into quirk_flags
Date: Thu, 29 Jul 2021 09:44:02 +0200	[thread overview]
Message-ID: <20210729074404.19728-4-tiwai@suse.de> (raw)
In-Reply-To: <20210729073855.19043-1-tiwai@suse.de>

The generic DSD raw detection is based on the known allow list, and we
can integrate it into quirk_flags, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/quirks.c   | 51 +++++++++++++++++++++++---------------------
 sound/usb/usbaudio.h |  3 +++
 2 files changed, 30 insertions(+), 24 deletions(-)

diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index fce3a341adc8..670abc6318f2 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1673,29 +1673,9 @@ 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 0x152a:  /* Thesycon devices */
-	case 0x20b1:  /* XMOS based devices */
-	case 0x22d9:  /* Oppo */
-	case 0x23ba:  /* Playback Designs */
-	case 0x25ce:  /* Mytek devices */
-	case 0x278b:  /* Rotel? */
-	case 0x292b:  /* Gustard/Ess based devices */
-	case 0x2972:  /* FiiO devices */
-	case 0x2ab6:  /* T+A devices */
-	case 0x3353:  /* Khadas devices */
-	case 0x3842:  /* EVGA */
-	case 0xc502:  /* HiBy devices */
-		if (fp->dsd_raw)
-			return SNDRV_PCM_FMTBIT_DSD_U32_BE;
-		break;
-	default:
-		break;
-
-	}
+	/* Mostly generic method to detect many DSD-capable implementations */
+	if ((chip->quirk_flags & QUIRK_FLAG_DSD_RAW) && fp->dsd_raw)
+		return SNDRV_PCM_FMTBIT_DSD_U32_BE;
 
 	return 0;
 }
@@ -1917,10 +1897,33 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
 		   QUIRK_FLAG_CTL_MSG_DELAY | QUIRK_FLAG_IFACE_DELAY),
 	VENDOR_FLG(0x07fd, /* MOTU */
 		   QUIRK_FLAG_VALIDATE_RATES),
+	VENDOR_FLG(0x152a, /* Thesycon devices */
+		   QUIRK_FLAG_DSD_RAW),
 	VENDOR_FLG(0x1de7, /* Phoenix Audio */
 		   QUIRK_FLAG_GET_SAMPLE_RATE),
+	VENDOR_FLG(0x20b1, /* XMOS based devices */
+		   QUIRK_FLAG_DSD_RAW),
+	VENDOR_FLG(0x22d9, /* Oppo */
+		   QUIRK_FLAG_DSD_RAW),
 	VENDOR_FLG(0x23ba, /* Playback Design */
-		   QUIRK_FLAG_CTL_MSG_DELAY | QUIRK_FLAG_IFACE_DELAY),
+		   QUIRK_FLAG_CTL_MSG_DELAY | QUIRK_FLAG_IFACE_DELAY |
+		   QUIRK_FLAG_DSD_RAW),
+	VENDOR_FLG(0x25ce, /* Mytek devices */
+		   QUIRK_FLAG_DSD_RAW),
+	VENDOR_FLG(0x278b, /* Rotel? */
+		   QUIRK_FLAG_DSD_RAW),
+	VENDOR_FLG(0x292b, /* Gustard/Ess based devices */
+		   QUIRK_FLAG_DSD_RAW),
+	VENDOR_FLG(0x2972, /* FiiO devices */
+		   QUIRK_FLAG_DSD_RAW),
+	VENDOR_FLG(0x2ab6, /* T+A devices */
+		   QUIRK_FLAG_DSD_RAW),
+	VENDOR_FLG(0x3353, /* Khadas devices */
+		   QUIRK_FLAG_DSD_RAW),
+	VENDOR_FLG(0x3842, /* EVGA */
+		   QUIRK_FLAG_DSD_RAW),
+	VENDOR_FLG(0xc502, /* HiBy devices */
+		   QUIRK_FLAG_DSD_RAW),
 
 	{} /* terminator */
 };
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index a152f5b08c7a..4e93668a2a48 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -159,6 +159,8 @@ extern bool snd_usb_skip_validation;
  *  Disable runtime PM autosuspend
  * QUIRK_FLAG_IGNORE_CTL_ERROR:
  *  Ignore errors for mixer access
+ * QUIRK_FLAG_DSD_RAW:
+ *  Support generic DSD raw U32_BE format
  */
 
 #define QUIRK_FLAG_GET_SAMPLE_RATE	(1U << 0)
@@ -176,5 +178,6 @@ extern bool snd_usb_skip_validation;
 #define QUIRK_FLAG_VALIDATE_RATES	(1U << 12)
 #define QUIRK_FLAG_DISABLE_AUTOSUSPEND	(1U << 13)
 #define QUIRK_FLAG_IGNORE_CTL_ERROR	(1U << 14)
+#define QUIRK_FLAG_DSD_RAW		(1U << 15)
 
 #endif /* __USBAUDIO_H */
-- 
2.26.2


  parent reply	other threads:[~2021-07-29 10:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-29  7:38 [PATCH 00/15] ALSA: usb-audio: Introduce and convert to quirk_flags Takashi Iwai
2021-07-29  7:38 ` [PATCH 01/15] ALSA: usb-audio: Introduce quirk_flags field Takashi Iwai
2021-07-29  7:38 ` [PATCH 02/15] ALSA: usb-audio: Move media-controller API quirk into quirk_flags Takashi Iwai
2021-07-29  7:38 ` [PATCH 03/15] ALSA: usb-audio: Move txfr_quirk handling to quirk_flags Takashi Iwai
2021-07-29  7:38 ` [PATCH 04/15] ALSA: usb-audio: Move tx_length quirk " Takashi Iwai
2021-07-29  7:38 ` [PATCH 05/15] ALSA: usb-audio: Move playback_first flag into quirk_flags Takashi Iwai
2021-07-29  7:38 ` [PATCH 06/15] ALSA: usb-audio: Move clock setup quirk " Takashi Iwai
2021-07-29  7:38 ` [PATCH 07/15] ALSA: usb-audio: Move ITF-USB DSD quirk handling " Takashi Iwai
2021-07-29  7:38 ` [PATCH 08/15] ALSA: usb-audio: Move control message delay quirk " Takashi Iwai
2021-07-29  7:38 ` [PATCH 09/15] ALSA: usb-audio: Move interface setup delay " Takashi Iwai
2021-07-29  7:43 ` [PATCH 10/15] ALSA: usb-audio: Move rate validation quirk " Takashi Iwai
2021-07-29  7:44 ` [PATCH 11/15] ALSA: usb-audio: Move autosuspend " Takashi Iwai
2021-07-29  7:44 ` [PATCH 12/15] ALSA: usb-audio: Move ignore_ctl_error check " Takashi Iwai
2021-07-29  7:44 ` Takashi Iwai [this message]
2021-07-29  7:44 ` [PATCH 14/15] ALSA: usb-audio: Add quirk_flags module option Takashi Iwai
2021-07-29  7:44 ` [PATCH 15/15] ALSA: doc: Add the description of quirk_flags option for snd-usb-audio Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210729074404.19728-4-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.