All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 06/15] ALSA: usb-audio: Move clock setup quirk into quirk_flags
Date: Thu, 29 Jul 2021 09:38:52 +0200	[thread overview]
Message-ID: <20210729073855.19043-7-tiwai@suse.de> (raw)
In-Reply-To: <20210729073855.19043-1-tiwai@suse.de>

There are a couple of device-specific quirks in the clock setup code,
and those can be moved gracefully to quirk_flags, too.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/usb/clock.c    | 13 ++++---------
 sound/usb/quirks.c   |  4 ++++
 sound/usb/usbaudio.h |  6 ++++++
 3 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/sound/usb/clock.c b/sound/usb/clock.c
index 90b03ae03574..81d5ce07d548 100644
--- a/sound/usb/clock.c
+++ b/sound/usb/clock.c
@@ -324,11 +324,8 @@ static int __uac_clock_find_source(struct snd_usb_audio *chip,
 					      sources[ret - 1],
 					      visited, validate);
 		if (ret > 0) {
-			/*
-			 * For Samsung USBC Headset (AKG), setting clock selector again
-			 * will result in incorrect default clock setting problems
-			 */
-			if (chip->usb_id == USB_ID(0x04e8, 0xa051))
+			/* Skip setting clock selector again for some devices */
+			if (chip->quirk_flags & QUIRK_FLAG_SKIP_CLOCK_SELECTOR)
 				return ret;
 			err = uac_clock_selector_set_val(chip, entity_id, cur);
 			if (err < 0)
@@ -541,10 +538,8 @@ static int set_sample_rate_v2v3(struct snd_usb_audio *chip,
 		 */
 		clock = snd_usb_clock_find_source(chip, fmt, false);
 
-		/* Denon DN-X1600 hardcoded
-		 * Sample rate seems to be set on the hardware itself
-		 */
-		if (chip->usb_id == USB_ID(0x154e, 0x500e))
+		/* Hardcoded sample rates */
+		if (chip->quirk_flags & QUIRK_FLAG_IGNORE_CLOCK_SOURCE)
 			return 0;
 
 		if (clock < 0)
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 9f295cb8c3c5..a9d8bde416ce 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -1890,6 +1890,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
 		   QUIRK_FLAG_GET_SAMPLE_RATE),
 	DEVICE_FLG(0x04d8, 0xfeea, /* Benchmark DAC1 Pre */
 		   QUIRK_FLAG_GET_SAMPLE_RATE),
+	DEVICE_FLG(0x04e8, 0xa051, /* Samsung USBC Headset (AKG) */
+		   QUIRK_FLAG_SKIP_CLOCK_SELECTOR),
 	DEVICE_FLG(0x0556, 0x0014, /* Phoenix Audio TMX320VC */
 		   QUIRK_FLAG_GET_SAMPLE_RATE),
 	DEVICE_FLG(0x05a3, 0x9420, /* ELP HD USB Camera */
@@ -1906,6 +1908,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
 		   QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER),
 	DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */
 		   QUIRK_FLAG_GET_SAMPLE_RATE),
+	DEVICE_FLG(0x154e, 0x500e, /* Denon DN-X1600 */
+		   QUIRK_FLAG_IGNORE_CLOCK_SOURCE),
 	DEVICE_FLG(0x1686, 0x00dd, /* Zoom R16/24 */
 		   QUIRK_FLAG_TX_LENGTH),
 	DEVICE_FLG(0x1901, 0x0191, /* GE B850V3 CP2114 audio interface */
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 8de2b6c51dad..82073ebeac5b 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -140,6 +140,10 @@ extern bool snd_usb_skip_validation;
  *  Add length specifier to transfers
  * QUIRK_FLAG_PLAYBACK_FIRST:
  *  Start playback stream at first even in implement feedback mode
+ * QUIRK_FLAG_SKIP_CLOCK_SELECTOR:
+ *  Skip clock selector setup; the device may reset to invalid state
+ * QUIRK_FLAG_IGNORE_CLOCK_SOURCE:
+ *  Ignore errors from clock source search; i.e. hardcoded clock
  */
 
 #define QUIRK_FLAG_GET_SAMPLE_RATE	(1U << 0)
@@ -147,5 +151,7 @@ extern bool snd_usb_skip_validation;
 #define QUIRK_FLAG_ALIGN_TRANSFER	(1U << 2)
 #define QUIRK_FLAG_TX_LENGTH		(1U << 3)
 #define QUIRK_FLAG_PLAYBACK_FIRST	(1U << 4)
+#define QUIRK_FLAG_SKIP_CLOCK_SELECTOR	(1U << 5)
+#define QUIRK_FLAG_IGNORE_CLOCK_SOURCE	(1U << 6)
 
 #endif /* __USBAUDIO_H */
-- 
2.26.2


  parent reply	other threads:[~2021-07-29 10:05 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 ` Takashi Iwai [this message]
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 ` [PATCH 13/15] ALSA: usb-audio: Move generic DSD raw detection " Takashi Iwai
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=20210729073855.19043-7-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.