You are not logged in.

#1 2022-08-15 15:37:05

buckwang
Member
Registered: 2022-08-15
Posts: 5

[SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

The internal mic is recognized by alsa as you can see:

$ arecord -l
**** Liste der Hardware-Geräte (CAPTURE) ****
Karte 1: Generic_1 [HD-Audio Generic], Gerät 0: ALC257 Analog [ALC257 Analog]
  Sub-Geräte: 1/1
  Sub-Gerät #0: subdevice #0

But when I try to record something with

$ arecord --duration=5 --format=dat --device=hw:1,0 test-mic.wav

Then there is no input and the file is just silent.
And it is not muted in alsamixer!

Also it is not recognized by pavucontrol as a mic (the duplex option is not available):

$ pactl list cards
Card #44
	Name: alsa_card.pci-0000_04_00.1
	Driver: alsa
	Owner Module: n/a
	Properties:
		api.acp.auto-port = "false"
		api.acp.auto-profile = "false"
		api.alsa.card = "0"
		api.alsa.card.longname = "HD-Audio Generic at 0x806c8000 irq 106"
		api.alsa.card.name = "HD-Audio Generic"
		api.alsa.path = "hw:0"
		api.alsa.use-acp = "true"
		device.api = "alsa"
		device.bus = "pci"
		device.bus_path = "pci-0000:04:00.1"
		device.description = "Rembrandt Radeon High Definition Audio Controller"
		device.enum.api = "udev"
		device.icon_name = "audio-card-analog-pci"
		device.name = "alsa_card.pci-0000_04_00.1"
		device.nick = "HD-Audio Generic"
		device.plugged.usec = "8479369"
		device.product.id = "0x1640"
		device.product.name = "Rembrandt Radeon High Definition Audio Controller"
		device.subsystem = "sound"
		sysfs.path = "/sys/devices/pci0000:00/0000:00:08.1/0000:04:00.1/sound/card0"
		device.vendor.id = "0x1002"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD/ATI]"
		media.class = "Audio/Device"
		factory.id = "14"
		client.id = "36"
		object.id = "42"
		object.serial = "44"
		object.path = "alsa:pcm:0"
		alsa.card = "0"
		alsa.card_name = "HD-Audio Generic"
		alsa.long_card_name = "HD-Audio Generic at 0x806c8000 irq 106"
		alsa.driver_name = "snd_hda_intel"
		device.string = "0"
	Profiles:
		off: Aus (sinks: 0, sources: 0, priority: 0, available: yes)
		output:hdmi-stereo: Digital Stereo (HDMI)-Ausgabe (sinks: 1, sources: 0, priority: 5900, available: no)
		output:hdmi-stereo-extra1: Digital Stereo (HDMI 2)-Ausgabe (sinks: 1, sources: 0, priority: 5700, available: no)
		output:hdmi-surround: Digital Surround 5.1 (HDMI)-Ausgabe (sinks: 1, sources: 0, priority: 800, available: no)
		output:hdmi-surround71: Digital Surround 7.1 (HDMI)-Ausgabe (sinks: 1, sources: 0, priority: 800, available: no)
		output:hdmi-surround-extra1: Digital Surround 5.1 (HDMI 2)-Ausgabe (sinks: 1, sources: 0, priority: 600, available: no)
		output:hdmi-surround71-extra1: Digital Surround 7.1 (HDMI 2)-Ausgabe (sinks: 1, sources: 0, priority: 600, available: no)
		pro-audio: Pro Audio (sinks: 2, sources: 0, priority: 1, available: yes)
	Active Profile: off
	Ports:
		hdmi-output-0: HDMI / DisplayPort (type: HDMI, priority: 5900, latency offset: 0 usec, availability group: Legacy 1, not available)
			Properties:
				port.type = "hdmi"
				port.availability-group = "Legacy 1"
				device.icon_name = "video-display"
				card.profile.port = "0"
			Part of profile(s): output:hdmi-stereo, output:hdmi-surround, output:hdmi-surround71
		hdmi-output-1: HDMI / DisplayPort 2 (type: HDMI, priority: 5800, latency offset: 0 usec, availability group: Legacy 2, not available)
			Properties:
				port.type = "hdmi"
				port.availability-group = "Legacy 2"
				device.icon_name = "video-display"
				card.profile.port = "1"
			Part of profile(s): output:hdmi-stereo-extra1, output:hdmi-surround-extra1, output:hdmi-surround71-extra1

Card #45
	Name: alsa_card.pci-0000_04_00.6
	Driver: alsa
	Owner Module: n/a
	Properties:
		api.acp.auto-port = "false"
		api.acp.auto-profile = "false"
		api.alsa.card = "1"
		api.alsa.card.longname = "HD-Audio Generic at 0x806c0000 irq 107"
		api.alsa.card.name = "HD-Audio Generic"
		api.alsa.path = "hw:1"
		api.alsa.use-acp = "true"
		device.api = "alsa"
		device.bus = "pci"
		device.bus_path = "pci-0000:04:00.6"
		device.description = "Family 17h/19h HD Audio Controller"
		device.enum.api = "udev"
		device.icon_name = "audio-card-analog-pci"
		device.name = "alsa_card.pci-0000_04_00.6"
		device.nick = "HD-Audio Generic"
		device.plugged.usec = "9369962"
		device.product.id = "0x15e3"
		device.product.name = "Family 17h/19h HD Audio Controller"
		device.subsystem = "sound"
		sysfs.path = "/sys/devices/pci0000:00/0000:00:08.1/0000:04:00.6/sound/card1"
		device.vendor.id = "0x1022"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
		media.class = "Audio/Device"
		factory.id = "14"
		client.id = "36"
		object.id = "43"
		object.serial = "45"
		object.path = "alsa:pcm:1"
		alsa.card = "1"
		alsa.card_name = "HD-Audio Generic"
		alsa.long_card_name = "HD-Audio Generic at 0x806c0000 irq 107"
		alsa.driver_name = "snd_hda_intel"
		device.string = "1"
	Profiles:
		off: Aus (sinks: 0, sources: 0, priority: 0, available: yes)
		output:analog-stereo+input:analog-stereo: Analog Stereo Duplex (sinks: 1, sources: 1, priority: 6565, available: no)
		output:analog-stereo: Analog Stereo-Ausgabe (sinks: 1, sources: 0, priority: 6500, available: yes)
		input:analog-stereo: Analog Stereo-Eingabe (sinks: 0, sources: 1, priority: 65, available: no)
		pro-audio: Pro Audio (sinks: 1, sources: 1, priority: 1, available: yes)
	Active Profile: output:analog-stereo
	Ports:
		analog-input-mic: Mikrofon (type: Mic, priority: 8700, latency offset: 0 usec, availability group: Legacy 1, not available)
			Properties:
				port.type = "mic"
				port.availability-group = "Legacy 1"
				device.icon_name = "audio-input-microphone"
				card.profile.port = "0"
			Part of profile(s): input:analog-stereo, output:analog-stereo+input:analog-stereo
		analog-output-speaker: Lautsprecher (type: Speaker, priority: 10000, latency offset: 0 usec, availability group: Legacy 2, availability unknown)
			Properties:
				port.type = "speaker"
				port.availability-group = "Legacy 2"
				device.icon_name = "audio-speakers"
				card.profile.port = "1"
			Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo
		analog-output-headphones: Kopfhörer (type: Headphones, priority: 9900, latency offset: 0 usec, availability group: Legacy 3, not available)
			Properties:
				port.type = "headphones"
				port.availability-group = "Legacy 3"
				device.icon_name = "audio-headphones"
				card.profile.port = "2"
			Part of profile(s): output:analog-stereo, output:analog-stereo+input:analog-stereo

If I plug in a pair of headphones with a mic input works just fine, so there must be some issue with the internal mic not being recognized as such by alsa. It's an AMD Ryzen 6000 device and the audio is realtek.

I have tried every suggestion in the wiki on the alsa and pipewire pages but nothing fixed the issue.

Is this a driver issue with Ryzen 6000 maybe? Please let me know if you have any suggestions on how to approach this further.

Last edited by buckwang (2022-09-20 13:13:38)

Offline

#2 2022-09-07 10:40:10

midian
Member
Registered: 2019-02-21
Posts: 25

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Same here, did you find a solution yet?

Offline

#3 2022-09-09 03:46:38

travisghansen
Member
Registered: 2022-06-28
Posts: 19

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Offline

#4 2022-09-16 08:47:03

epinephrine
Member
From: Frankfurt
Registered: 2012-10-18
Posts: 92

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Maybe there's a way to get the mic array working with the use of SOF? I have no idea how to configure pulseaudio with sof or how these even relate, but the ThinkPad X1 Carbon (Gen 10) wiki page mentions that alsa-firmware and sof-firmware should be used to get the 4-array mic working, without giving any further configuration hints... I just installed both packages and rebooted but the mic still doesn't show up in pavucontrol.

edit: sof-firmware seems to be specific to intel, so this package is probably not helpful for AMD laptops.

Last edited by epinephrine (2022-09-16 14:15:38)

Offline

#5 2022-09-19 20:04:49

zdbiohazard
Member
Registered: 2022-09-19
Posts: 4

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Gentoo user here. I had this same issue with my new Thinkpad T16, (Ryzen 7 6850U) and was able to get it working.

From what I can tell, the "ALC257" device seems to *only* be the speakers and headphone jack, which kept me barking up the wrong tree for quite a while.
The microphone array on the display is a separate `acp6x` DMIC device, the driver for which appears to have been added in kernel 5.16. (I've only tested with 5.19.)

$ lspci | grep Audio
04:00.1 Audio device: Advanced Micro Devices, Inc. [AMD/ATI] Rembrandt Radeon High Definition Audio Controller  <-- HDMI
04:00.5 Multimedia controller: Advanced Micro Devices, Inc. [AMD] ACP/ACP3X/ACP6x Audio Coprocessor (rev 60)  <-- Microphone
04:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller  <-- Speakers/Headphone jack

I needed to enable the `snd_pci_acp6x` driver and it's DMIC support in my kernel config:

CONFIG_SND_SOC=y
CONFIG_SND_SOC_AMD_ACP6x=y
CONFIG_SND_SOC_AMD_YC_MACH=y

(In case it makes a difference, I'm using the 2022-08-08 `amdgpu/yellow_carp_*.bin` firmware, and of course being a Gentoo user, everything is built-into the kernel. wink )

The device then shows up in ALSA as a recording device and works as you'd expect.

$ dmesg | grep '\(acp6x\|DMIC\)'
snd_pci_acp6x 0000:04:00.5: enabling device (0000 -> 0002)
acp_yc_mach acp_yc_mach.0: Enabling ACP DMIC support via DMI

$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 1: Generic_1 [HD-Audio Generic], device 0: ALC257 Analog [ALC257 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: acp6x [acp6x], device 0: DMIC capture dmic-hifi-0 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

$ pactl list cards | grep '\.\(card_name\|description\)'
alsa.card_name = "HD-Audio Generic"
device.description = "HD-Audio Generic"
alsa.card_name = "acp6x"
device.description = "Raven/Raven2/FireFlight/Renoir Audio Processor"
alsa.card_name = "HD-Audio Generic"
device.description = "Family 17h (Models 10h-1fh) HD Audio Controller"

However, when I enabled the `acp6x` driver, `pavucontrol` was only giving me a "Play HiFi quality Music" profile for *all* my devices.
It seems that ALSA UCM doesn't like something about this, so I needed to disable ALSA UCM in `/etc/pulse/default.pa` to get back to normal. (Thanks Arch wiki!)

### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect use_ucm=0
.else

The HDMI audio has it's own separate device too, which I believe uses `CONFIG_SND_HDA_CODEC_HDMI`, but I'm not sure. It worked out of the box for me.

Hopefully this helps out for the other Ryzen 6000-series laptops, too.

Last edited by zdbiohazard (2022-09-19 20:36:39)

Offline

#6 2022-09-20 06:32:49

midian
Member
Registered: 2019-02-21
Posts: 25

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Thanks zdbiohazard !

Offline

#7 2022-09-20 07:30:21

travisghansen
Member
Registered: 2022-06-28
Posts: 19

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

This is helpful! For me I already have both modules (and both are loaded by default it seems) and I simply do not get the 2nd line of the dmesg output but I do get the first. I'm wondering if the kernel is missing a pci id or something somewhere for my specific device?

Offline

#8 2022-09-20 08:01:10

midian
Member
Registered: 2019-02-21
Posts: 25

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

I didn't try but someone on reddit suggested adding the id directly to https://github.com/torvalds/linux/blob/ … mach.c#L47

Offline

#9 2022-09-20 08:04:03

epinephrine
Member
From: Frankfurt
Registered: 2012-10-18
Posts: 92

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Hey @zdbiohazard thanks a lot for these details! Sounds we should be getting there soon with Arch smile

I was actually also suspecting this "Audio Coprocessor" to be the mic and it not being part of the HD Audio Controller, good to have that confirmed!

I can confirm that lspci show the exact same devices

$ lspci -nn | grep Audio
04:00.1 Audio device [0403]: Advanced Micro Devices, Inc. [AMD/ATI] Rembrandt Radeon High Definition Audio Controller [1002:1640]
04:00.5 Multimedia controller [0480]: Advanced Micro Devices, Inc. [AMD] ACP/ACP3X/ACP6x Audio Coprocessor [1022:15e2] (rev 60)
04:00.6 Audio device [0403]: Advanced Micro Devices, Inc. [AMD] Family 17h/19h HD Audio Controller [1022:15e3]

Also, all the modules corresponding to the kernel configs that you mentioned are auto-loaded

$ lsmod | grep soc
snd_soc_acp6x_mach     20480  0
snd_soc_dmic           16384  0
snd_soc_core          393216  4 snd_soc_acp6x_mach,snd_sof,snd_acp6x_pdm_dma,snd_soc_dmic
snd_compress           28672  1 snd_soc_core
ac97_bus               16384  1 snd_soc_core
snd_pcm_dmaengine      16384  1 snd_soc_core
snd_pcm               172032  12 snd_sof_amd_acp,snd_hda_codec_hdmi,snd_pci_acp6x,snd_hda_intel,snd_hda_codec,snd_sof,snd_acp6x_pdm_dma,snd_compress,snd_soc_core,snd_sof_utils,snd_hda_core,snd_pcm_dmaengine
snd_soc_acpi           16384  2 snd_acp_config,snd_sof_amd_renoir
snd                   126976  19 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_sof,snd_timer,snd_compress,snd_soc_core,snd_pcm

At least I think it includes all relevant modules.

However, in my dmesg I only see your first entry

snd_pci_acp6x 0000:04:00.5: enabling device (0000 -> 0002)

The second entry from acp_yc_mach is missing even though the corresponding module snd_soc_acp6x_mach is loaded! So I guess we're getting close to the problem.

I also have the linux-firmware package installed (version 20220815.8413c63-1) , which contains the yellow_carp_* files.

Any idea how I get the module to actually register the DMIC device?

Offline

#10 2022-09-20 08:04:38

epinephrine
Member
From: Frankfurt
Registered: 2012-10-18
Posts: 92

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Here's a relevant kernel bug report https://bugzilla.kernel.org/show_bug.cgi?id=216270

I'll later try to add our laptop to this quirks list and recompile my kernel. Will then report.

Last edited by epinephrine (2022-09-20 08:08:12)

Offline

#11 2022-09-20 08:41:42

zdbiohazard
Member
Registered: 2022-09-19
Posts: 4

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

EDIT: Oh, heh, looks like you guys came to the same conclusion while I was researching. smile

---

Interesting, I dug into the kernel code to find where the missing message is generated, and lo and behold ... Lenovo's ACP DMIC detection is a huge model-specific quirks table. >.>

https://github.com/torvalds/linux/blob/ … p6x-mach.c

Looks like entries for "21CM", "21CN", "21EM", "21EN", "21J5", and "21J6" are added in 6.0-rc2+:
https://github.com/torvalds/linux/commi … 998ab39508
https://github.com/torvalds/linux/commi … 5c61e026a2
https://bugzilla.kernel.org/show_bug.cgi?id=216267

If your model is in the list, you can give a rc2+ kernel a try, or sit tight for 6.0, which should be coming soon.
If not, you can try adding your model to the list, compile the module yourself, and give that a shot.

Last edited by zdbiohazard (2022-09-20 08:44:16)

Offline

#12 2022-09-20 08:47:40

epinephrine
Member
From: Frankfurt
Registered: 2012-10-18
Posts: 92

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

OK it works! I had to add the Slim 7 Pro X to the quirks table, created this patch for it:

diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c
index e0b24e1daef3..735acfb23bc4 100644
--- a/sound/soc/amd/yc/acp6x-mach.c
+++ b/sound/soc/amd/yc/acp6x-mach.c
@@ -171,6 +171,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "21J6"),
 		}
 	},
+	{
+		.driver_data = &acp6x_card,
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "82"),
+		}
+	},
 	{}
 };
 

But like you said, I also had to disable ALSA UCM in the PA config. Otherwise, nothing worked.

This is great, will update the Slim 7 Pro X wiki and report this quirk upstream.

OP, this can be marked as solved.

Last edited by epinephrine (2022-09-20 08:48:03)

Offline

#13 2022-09-20 13:12:51

buckwang
Member
Registered: 2022-08-15
Posts: 5

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Yes, it works! Thank you everyone for the input.

This might be a fix for more Ryzen 6000 systems, so should I change the title to say Ryzen 6000 instead of just this model? (Edit: Had to, the title was too long otherwise)

Last edited by buckwang (2022-09-20 13:14:06)

Offline

#14 2022-09-20 14:17:07

travisghansen
Member
Registered: 2022-06-28
Posts: 19

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Yup, applied to 6.0rc6 here and it works for me. I'm using pipewire and nothing addition seems to be needed beyond that.

Offline

#15 2022-09-20 16:06:00

buckwang
Member
Registered: 2022-08-15
Posts: 5

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

I'm also using pipewire with wireplumber and I had to set

["api.alsa.use-ucm"] = false

to fix the hifi issue. Maybe you had already done this trying to solve the issue before?

Offline

#16 2022-09-20 16:09:40

travisghansen
Member
Registered: 2022-06-28
Posts: 19

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

I’m relatively confident I didn’t even have to do that but which file is that setting in for pipewire and I’ll make sure?

Offline

#17 2022-09-20 16:44:24

buckwang
Member
Registered: 2022-08-15
Posts: 5

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

The template I copied to my .config/ and edited is

/usr/share/wireplumber/main.lua.d/50-alsa-config.lua

Offline

#18 2022-09-20 17:06:01

epinephrine
Member
From: Frankfurt
Registered: 2012-10-18
Posts: 92

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Posted an issue to the alsa-ucm-conf Github repo about this: https://github.com/alsa-project/alsa-uc … issues/215
Feel free to add any info that I was missing.

Offline

#19 2022-09-20 17:30:26

travisghansen
Member
Registered: 2022-06-28
Posts: 19

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Yeah, I have no custom files/etc for wireplumber that I'm aware of and everything 'just works' after patching the kernel (I did crank the volume up to 100% on the mic as it was initially at 75% or so). I'm running 6.0rc6 + this mic patch + acpi patch for suspend/resume woes on this machine. Otherwise I'm on an up-to-date arch install with a gnome desktop etc. I'll keep an eye out to see if it doesn't work in some weird scenario for the next little bit but I've already done a couple conference calls etc and all worked just fine.

Offline

#20 2022-09-20 20:15:05

zdbiohazard
Member
Registered: 2022-09-19
Posts: 4

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

To clarify a the UCM thing a bit, with UCM enabled and only the "HiFi" profile available, I *can* get sound to "work" with a bit of fiddling with the profile selectors and messing with the outputs, but functionality is limited, (analog stereo only, etc.) and the mixer controls don't work quite properly.

It's possible that for some users/systems, the mixer can just so happen to land in a state that "just works" well enough for most purposes.

(On a side note, an interesting observation to me is that out of the many HDA systems I've used, apparently none of them have ever had a valid UCM config, so I've only ever seen the normal PulseAudio profiles until now. Not sure if that's intentional. /shrug)

Offline

#21 2022-09-21 09:41:05

buckwang
Member
Registered: 2022-08-15
Posts: 5

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

To clarify a the UCM thing a bit, with UCM enabled and only the "HiFi" profile available, I *can* get sound to "work" with a bit of fiddling with the profile selectors and messing with the outputs, but functionality is limited, (analog stereo only, etc.) and the mixer controls don't work quite properly.

Yes, same here.

Offline

#22 2022-09-21 18:41:01

travisghansen
Member
Registered: 2022-06-28
Posts: 19

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Fair enough. I have simple needs and don't know anything really about the profiles, etc so as long as sound is coming out the built-in speakers I'm happy and for me that 'just works'. I suppose I should try out the headphones etc though and make sure those work as expected..

Offline

#23 2022-09-26 16:34:32

halogen
Member
Registered: 2014-06-12
Posts: 55

Re: [SOLVED] ALSA: no input through internal microphone (Ryzen 6000)

Looks like kernel 6.0 is almost ready, but I can't see the patch to the quirk list for the Slim 7 Pro X, maybe in 6.1 ?

Offline

Board footer

Powered by FluxBB