Bug 219897 - Sound recording stops working
Summary: Sound recording stops working
Status: RESOLVED CODE_FIX
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: AMD Linux
: P3 low
Assignee: Jaroslav Kysela
URL: https://github.com/NixOS/nixpkgs/issu...
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-19 04:13 UTC by Aravind
Modified: 2025-03-25 14:58 UTC (History)
2 users (show)

See Also:
Kernel Version: 6.12.14, 6.6.80
Subsystem:
Regression: Yes
Bisected commit-id:


Attachments
output of alsa-info command when mic is not working (37.76 KB, text/plain)
2025-03-24 05:41 UTC, Aravind
Details
Output of alsa-info command when mic is working (38.35 KB, text/plain)
2025-03-24 05:42 UTC, Aravind
Details
Fix patch (1.77 KB, patch)
2025-03-24 09:23 UTC, Takashi Iwai
Details | Diff

Description Aravind 2025-03-19 04:13:13 UTC
Audio capture (in built microphone) stopped working when upgrading from xanmod linux kernel 6.12.13 to 6.12.14 on debian (x64v3-xanmod1 testing).

The laptop: ASUSTeK COMPUTER INC. VivoBook_ASUSLaptop X515UA_M515UA/X515UA, BIOS X515UA.306 11/29/2021

Relevant hardware with "lspci":

03:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Renoir Radeon High Definition Audio Controller
03:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h/19h/1ah HD Audio Controller

I also ran into this in regular upstream kernel (6.6.80) on Nix OS (it was working fine in 6.6.63).
Other people seem to have ran into this bug too:

https://github.com/NixOS/nixpkgs/issues/365577

Sorry for reporting this here even though I did not compile the kernel myself but this bug seems to have come up in multiple distributions and versions so found it relevant to report it here.

This is my first bug report so sorry for any missing info, I can provide more info upon request / guidelines.
Comment 1 Aravind 2025-03-22 16:32:44 UTC
Hi, in case this bug report is still being considered, I think the problem might be in the line:

SND_PCI_QUIRK(0x1849, 0x0269, "Positivo Master C6400", ALC269VB_FIXUP_ASUS_ZENBOOK),

of sound/pci/hda/patch_realtek.c (this was introduced in one the newer commits of 6.14 rc)

Sorry, my hardware is a bit slow. Will check and confirm soon.

What does this do exactly (Sorry again, I am a beginner)?
Comment 2 Aravind 2025-03-23 12:27:10 UTC
Hi, the issue was not in the PCI quirk, I managed to narrow it down to these 2 files which changed from 6.12.13 to 6.12.14:

diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 8e74be038b0f..0091ab3f2bd5 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -80,7 +80,11 @@ static int compare_input_type(const void *ap, const void *bp)
 
 	/* In case one has boost and the other one has not,
 	   pick the one with boost first. */
-	return (int)(b->has_boost_on_pin - a->has_boost_on_pin);
+	if (a->has_boost_on_pin != b->has_boost_on_pin)
+		return (int)(b->has_boost_on_pin - a->has_boost_on_pin);
+
+	/* Keep the original order */
+	return a->order - b->order;
 }
 
 /* Reorder the surround channels
@@ -400,6 +404,8 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
 	reorder_outputs(cfg->speaker_outs, cfg->speaker_pins);
 
 	/* sort inputs in the order of AUTO_PIN_* type */
+	for (i = 0; i < cfg->num_inputs; i++)
+		cfg->inputs[i].order = i;
 	sort(cfg->inputs, cfg->num_inputs, sizeof(cfg->inputs[0]),
 	     compare_input_type, NULL);
 
diff --git a/sound/pci/hda/hda_auto_parser.h b/sound/pci/hda/hda_auto_parser.h
index 579b11beac71..87af3d8c02f7 100644
--- a/sound/pci/hda/hda_auto_parser.h
+++ b/sound/pci/hda/hda_auto_parser.h
@@ -37,6 +37,7 @@ struct auto_pin_cfg_item {
 	unsigned int is_headset_mic:1;
 	unsigned int is_headphone_mic:1; /* Mic-only in headphone jack */
 	unsigned int has_boost_on_pin:1;
+	int order;
 };
 
 struct auto_pin_cfg;

diff --git a/sound/soc/amd/Kconfig b/sound/soc/amd/Kconfig
index 6dec44f516c1..c2a5671ba96b 100644
--- a/sound/soc/amd/Kconfig
+++ b/sound/soc/amd/Kconfig
@@ -105,7 +105,7 @@ config SND_SOC_AMD_ACP6x
 config SND_SOC_AMD_YC_MACH
 	tristate "AMD YC support for DMIC"
 	select SND_SOC_DMIC
-	depends on SND_SOC_AMD_ACP6x
+	depends on SND_SOC_AMD_ACP6x && ACPI
 	help
 	  This option enables machine driver for Yellow Carp platform
 	  using dmic. ACP IP has PDM Decoder block with DMA controller.
Comment 3 Aravind 2025-03-23 12:27:37 UTC
by reverting these 2 files, I was able to get the mic working again.
Comment 4 Takashi Iwai 2025-03-23 13:38:28 UTC
That's about the quirk.  The quirk entry casually worked in the past, but not in a proper way, hence it got broken after we corrected the pin table sort.

Please get alsa-info.sh output from the working and non-working cases.
Run the script with --no-upload option and attach the outputs to Bugzilla.
Comment 5 Aravind 2025-03-24 05:41:46 UTC
Created attachment 307887 [details]
output of alsa-info command when mic is not working
Comment 6 Aravind 2025-03-24 05:42:37 UTC
Created attachment 307888 [details]
Output of alsa-info command when mic is working
Comment 7 Takashi Iwai 2025-03-24 09:22:25 UTC
Thanks.  Please try the fix patch below.
Once after confirming it's working, I'll submit and merge to the upstream.
Comment 8 Takashi Iwai 2025-03-24 09:23:08 UTC
Created attachment 307891 [details]
Fix patch
Comment 9 Aravind 2025-03-24 14:21:28 UTC
Yes, it is working properly after the quirk line added, thanks!
Comment 10 Aravind 2025-03-24 14:22:25 UTC
The bug can be closed.

Note You need to log in before you can comment on or make changes to this bug.