mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Cryolitia PukNgae via B4 Relay <devnull+cryolitia.uniontech.com@kernel.org>
To: Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
	 Jonathan Corbet <corbet@lwn.net>
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
	 Mingcong Bai <jeffbai@aosc.io>,
	Kexy Biscuit <kexybiscuit@aosc.io>,
	 Nie Cheng <niecheng1@uniontech.com>,
	Zhan Jun <zhanjun@uniontech.com>,
	 Feng Yuan <fengyuan@uniontech.com>,
	Celeste Liu <uwu@coelacanthus.name>,
	 qaqland <anguoli@uniontech.com>,
	linux-doc@vger.kernel.org,
	 Cryolitia PukNgae <cryolitia@uniontech.com>
Subject: [PATCH 2/4] ALSA: usb-audio: add quirk QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE
Date: Wed, 03 Sep 2025 13:09:46 +0800	[thread overview]
Message-ID: <20250903-sound-v1-2-d4ca777b8512@uniontech.com> (raw)
In-Reply-To: <20250903-sound-v1-0-d4ca777b8512@uniontech.com>

From: Cryolitia PukNgae <cryolitia@uniontech.com>

The same hardware problem to QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE also
occurs on the capture streams on some USB devices. Add a new flag for
processing the quirk.

Link: https://lore.kernel.org/all/C22C1A172EBB9BD9+eccc2e4a-d21e-4a7d-848c-bbf3982feb94@uniontech.com/
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
---
 Documentation/sound/alsa-configuration.rst | 1 +
 sound/usb/mixer_quirks.c                   | 7 +++++++
 sound/usb/usbaudio.h                       | 3 +++
 3 files changed, 11 insertions(+)

diff --git a/Documentation/sound/alsa-configuration.rst b/Documentation/sound/alsa-configuration.rst
index 062b86522e4d9cc7ec19e978e0efc934dae9ab1b..bf45df1558bbc361ca165abaf9c5d83bfe3188e2 100644
--- a/Documentation/sound/alsa-configuration.rst
+++ b/Documentation/sound/alsa-configuration.rst
@@ -2329,6 +2329,7 @@ quirk_flags
         * bit 24: Set minimum volume control value as mute for devices
           where the lowest playback value represents muted state instead
           of minimum audible volume
+        * bit 25: Be similar to bit 24 but for capture streams
 
 This module supports multiple devices, autoprobe and hotplugging.
 
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index 2a1abc24dbfc0c6b69d64529eda01bc25f1a6dd1..828af3095b86ee0aa8f2d248d8e714b5d3ae20eb 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -4550,6 +4550,13 @@ void snd_usb_mixer_fu_apply_quirk(struct usb_mixer_interface *mixer,
 			cval->min_mute = 1;
 		}
 
+	/* lowest capture value is muted on some devices */
+	if (mixer->chip->quirk_flags & QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE)
+		if (strstr(kctl->id.name, "Capture")) {
+			usb_audio_info(mixer->chip,
+				       "applying capture min mute quirk\n");
+			cval->min_mute = 1;
+		}
 	/* ALSA-ify some Plantronics headset control names */
 	if (USB_ID_VENDOR(mixer->chip->usb_id) == 0x047f &&
 	    (cval->control == UAC_FU_MUTE || cval->control == UAC_FU_VOLUME))
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index 707b3037b1b3a3d2997157154cf78d71455bfe4b..30b5102e3caed01eeb86d0075c41338104c58950 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -222,6 +222,8 @@ extern bool snd_usb_skip_validation;
  * QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE
  *  Set minimum volume control value as mute for devices where the lowest
  *  playback value represents muted state instead of minimum audible volume
+ * QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE
+ *  Similar to QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE, but for capture streams
  */
 
 #define QUIRK_FLAG_GET_SAMPLE_RATE	(1U << 0)
@@ -249,5 +251,6 @@ extern bool snd_usb_skip_validation;
 #define QUIRK_FLAG_MIC_RES_16		(1U << 22)
 #define QUIRK_FLAG_MIC_RES_384		(1U << 23)
 #define QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE	(1U << 24)
+#define QUIRK_FLAG_MIXER_CAPTURE_MIN_MUTE	(1U << 25)
 
 #endif /* __USBAUDIO_H */

-- 
2.51.0



  parent reply	other threads:[~2025-09-03  5:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-03  5:09 [PATCH 0/4] ALSA: usb-audio: series of improvements to min_mute Cryolitia PukNgae via B4 Relay
2025-09-03  5:09 ` [PATCH 1/4] ALSA: usb-audio: rename QUIRK_FLAG_MIXER_MIN_MUTE to QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE Cryolitia PukNgae via B4 Relay
2025-09-03  5:09 ` Cryolitia PukNgae via B4 Relay [this message]
2025-09-03  5:09 ` [PATCH 3/4] ALSA: usb-audio: apply "mixer_min_mute" quirks on some devices Cryolitia PukNgae via B4 Relay
2025-09-03  5:09 ` [PATCH 4/4] ALSA: usb-audio: apply quirk for MOONDROP Quark2 Cryolitia PukNgae via B4 Relay
2025-09-04 14:58 ` [PATCH 0/4] ALSA: usb-audio: series of improvements to min_mute 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=20250903-sound-v1-2-d4ca777b8512@uniontech.com \
    --to=devnull+cryolitia.uniontech.com@kernel.org \
    --cc=anguoli@uniontech.com \
    --cc=corbet@lwn.net \
    --cc=cryolitia@uniontech.com \
    --cc=fengyuan@uniontech.com \
    --cc=jeffbai@aosc.io \
    --cc=kexybiscuit@aosc.io \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=niecheng1@uniontech.com \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=uwu@coelacanthus.name \
    --cc=zhanjun@uniontech.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®