[PATCH 1/2] ALSA: usb-audio: Add module param mixer_min_mute

Cryolitia PukNgae via B4 Relay posted 2 patches 1 month ago
[PATCH 1/2] ALSA: usb-audio: Add module param mixer_min_mute
Posted by Cryolitia PukNgae via B4 Relay 1 month ago
From: Cryolitia PukNgae <cryolitia@uniontech.com>

As already discussed[1], a module parameter called mixer_min_mute is
added to make it easier for end users to debug the widespread problem
without recompiling the kernel, where USB audio devices are muted when
the volume is set to the minimum value.

1.
https://lore.kernel.org/all/20250827-sound-quirk-min-mute-v1-1-4717aa8a4f6a@uniontech.com/

Tested-by: Guoli An <anguoli@uniontech.com>
Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>
---
 sound/usb/card.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/sound/usb/card.c b/sound/usb/card.c
index 0265206a8e8cf31133e8463c98fe0497d8ace89e..bf65727ad213f2897d735c1f3c55bfc3f85971cf 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -74,6 +74,7 @@ static char *quirk_alias[SNDRV_CARDS];
 static char *delayed_register[SNDRV_CARDS];
 static bool implicit_fb[SNDRV_CARDS];
 static unsigned int quirk_flags[SNDRV_CARDS];
+static bool mixer_min_mute;
 
 bool snd_usb_use_vmalloc = true;
 bool snd_usb_skip_validation;
@@ -109,6 +110,9 @@ module_param_named(use_vmalloc, snd_usb_use_vmalloc, bool, 0444);
 MODULE_PARM_DESC(use_vmalloc, "Use vmalloc for PCM intermediate buffers (default: yes).");
 module_param_named(skip_validation, snd_usb_skip_validation, bool, 0444);
 MODULE_PARM_DESC(skip_validation, "Skip unit descriptor validation (default: no).");
+module_param(mixer_min_mute, bool, 0444);
+MODULE_PARM_DESC(mixer_min_mute,
+		 "Set minimum volume control value as mute (default: no).");
 
 /*
  * we keep the snd_usb_audio_t instances by ourselves for merging
@@ -959,6 +963,9 @@ static int usb_audio_probe(struct usb_interface *intf,
 	if (ignore_ctl_error)
 		chip->quirk_flags |= QUIRK_FLAG_IGNORE_CTL_ERROR;
 
+	if (mixer_min_mute)
+		chip->quirk_flags |= QUIRK_FLAG_MIXER_MIN_MUTE;
+
 	if (chip->quirk_flags & QUIRK_FLAG_DISABLE_AUTOSUSPEND)
 		usb_disable_autosuspend(interface_to_usbdev(intf));
 

-- 
2.51.0
Re: [PATCH 1/2] ALSA: usb-audio: Add module param mixer_min_mute
Posted by Takashi Iwai 1 month ago
On Fri, 29 Aug 2025 07:10:59 +0200,
Cryolitia PukNgae via B4 Relay wrote:
> 
> From: Cryolitia PukNgae <cryolitia@uniontech.com>
> 
> As already discussed[1], a module parameter called mixer_min_mute is
> added to make it easier for end users to debug the widespread problem
> without recompiling the kernel, where USB audio devices are muted when
> the volume is set to the minimum value.
> 
> 1.
> https://lore.kernel.org/all/20250827-sound-quirk-min-mute-v1-1-4717aa8a4f6a@uniontech.com/
> 
> Tested-by: Guoli An <anguoli@uniontech.com>
> Signed-off-by: Cryolitia PukNgae <cryolitia@uniontech.com>

Err, maybe I misunderstood your suggestion in the previous patch.
I didn't mean to add a new option, but only about adding the quirk
bit.

Honestly speaking, I don't want to add yet new option for a specific
quirk behavior.  Once when we add, it's sticking almost forever and we
can't delete it any longer.  Also, this option will apply to all USB
connected USB-audio devices, which may have ill effect, too.

What I had in mind instead is to extend the syntax of quirk option.
e.g. it can accept a string like "mixer_min_mute" not only the integer
value.  Or it may have a form like "$vendor:$value" so that it can be
applied no matter which slot it's assigned.


thanks,

Takashi

> ---
>  sound/usb/card.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/sound/usb/card.c b/sound/usb/card.c
> index 0265206a8e8cf31133e8463c98fe0497d8ace89e..bf65727ad213f2897d735c1f3c55bfc3f85971cf 100644
> --- a/sound/usb/card.c
> +++ b/sound/usb/card.c
> @@ -74,6 +74,7 @@ static char *quirk_alias[SNDRV_CARDS];
>  static char *delayed_register[SNDRV_CARDS];
>  static bool implicit_fb[SNDRV_CARDS];
>  static unsigned int quirk_flags[SNDRV_CARDS];
> +static bool mixer_min_mute;
>  
>  bool snd_usb_use_vmalloc = true;
>  bool snd_usb_skip_validation;
> @@ -109,6 +110,9 @@ module_param_named(use_vmalloc, snd_usb_use_vmalloc, bool, 0444);
>  MODULE_PARM_DESC(use_vmalloc, "Use vmalloc for PCM intermediate buffers (default: yes).");
>  module_param_named(skip_validation, snd_usb_skip_validation, bool, 0444);
>  MODULE_PARM_DESC(skip_validation, "Skip unit descriptor validation (default: no).");
> +module_param(mixer_min_mute, bool, 0444);
> +MODULE_PARM_DESC(mixer_min_mute,
> +		 "Set minimum volume control value as mute (default: no).");
>  
>  /*
>   * we keep the snd_usb_audio_t instances by ourselves for merging
> @@ -959,6 +963,9 @@ static int usb_audio_probe(struct usb_interface *intf,
>  	if (ignore_ctl_error)
>  		chip->quirk_flags |= QUIRK_FLAG_IGNORE_CTL_ERROR;
>  
> +	if (mixer_min_mute)
> +		chip->quirk_flags |= QUIRK_FLAG_MIXER_MIN_MUTE;
> +
>  	if (chip->quirk_flags & QUIRK_FLAG_DISABLE_AUTOSUSPEND)
>  		usb_disable_autosuspend(interface_to_usbdev(intf));
>  
> 
> -- 
> 2.51.0
> 
>