alsa-ucm-conf icon indicating copy to clipboard operation
alsa-ucm-conf copied to clipboard

ACP6x: PulseAudio profiles different (from the legacy probe)

Open sebastianst opened this issue 3 years ago • 14 comments

My Ryzen 6000 laptop has an AMD audio coprocessor driving the microphone with the ACP6x kernel module. #138 added initial support for this, but me and some other people on different Ryzen 6000 laptops have issues with alsa-ucm not configuring the microphone properly. We have to disable alsa-ucm to get any sound input or output working with pulseaudio, see https://bbs.archlinux.org/viewtopic.php?pid=2058087#p2058087 for the relevant discussion. Note that we first had to add our laptops to some quirk table of the kernel module to get it working at all.

Any idea how to fix this?

sebastianst avatar Sep 20 '22 16:09 sebastianst

Sound input should be fixed via https://lore.kernel.org/alsa-devel/[email protected]/

superm1 avatar Sep 20 '22 17:09 superm1

As a heads up I'm running wireplumber with the same setup and everything appears to 'just work' in my setup (after applying the quirk patch that is).

travisghansen avatar Sep 20 '22 18:09 travisghansen

Sound input should be fixed via https://lore.kernel.org/alsa-devel/[email protected]/

I know, I'm running a 6.0 kernel with this patch applied. My bug report relates to the fact that it seems that no correct alsa-ucm configuration is loaded because pulseaudio suddenly shows all devices with the generic "HiFi Stereo" profile and no sound input or output works at all, unless alsa-ucm is disabled in the pulseaudio configuration.

sebastianst avatar Sep 22 '22 08:09 sebastianst

Could you attach alsaucm -c hw:0 dump text output? Replace 0 with the HDA card number (aplay -l).

perexg avatar Sep 22 '22 09:09 perexg

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Generic [HD-Audio Generic], device 3: HDMI 0 [DELL S2722QC]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Generic [HD-Audio Generic], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic_1 [HD-Audio Generic], device 0: ALC257 Analog [ALC257 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
$ alsaucm -c hw:1 dump text
Verb.HiFi {
	Comment "Play HiFi quality Music"
	Device.Mic1 {
		Comment "Digital Microphone"
		Values {
			CaptureCTL "_ucm0001.hw:Generic_1"
			CaptureMixerElem "Mic ACP LED"
			CapturePCM "_ucm0001.hw:acp6x"
			CapturePriority 100
			CaptureSwitch "Mic ACP LED Capture Switch"
			PlaybackCTL "_ucm0001.hw:Generic_1"
			TQ HiFi
		}
	}
	Device.Headphones {
		Comment Headphones
		Values {
			CaptureCTL "_ucm0001.hw:Generic_1"
			JackControl "Headphone Jack"
			PlaybackCTL "_ucm0001.hw:Generic_1"
			PlaybackMasterElem Master
			PlaybackMixerElem Headphone
			PlaybackPCM "_ucm0001.hw:Generic_1"
			PlaybackPriority 200
			PlaybackSwitch "Headphone Playback Switch"
			PlaybackVolume "Headphone Playback Volume"
			TQ HiFi
		}
	}
	Device.Speaker {
		Comment Speaker
		Values {
			CaptureCTL "_ucm0001.hw:Generic_1"
			PlaybackCTL "_ucm0001.hw:Generic_1"
			PlaybackMasterElem Master
			PlaybackMixerElem Speaker
			PlaybackPCM "_ucm0001.hw:Generic_1"
			PlaybackPriority 100
			PlaybackSwitch "Speaker Playback Switch"
			PlaybackVolume "Speaker Playback Volume"
			TQ HiFi
		}
	}
	Device.Mic2 {
		Comment "Headphones Stereo Microphone"
		Values {
			CaptureCTL "_ucm0001.hw:Generic_1"
			CaptureMasterElem "Mic Boost"
			CaptureMixerElem Capture
			CapturePCM "_ucm0001.hw:Generic_1"
			CapturePriority 200
			CaptureSwitch "Capture Switch"
			CaptureVolume "Capture Volume"
			JackControl "Mic Jack"
			PlaybackCTL "_ucm0001.hw:Generic_1"
			TQ HiFi
		}
	}
}

And for completeness

$ 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

card 2 is the mic and alsaucm -c hw:2 dump text is empty.

sebastianst avatar Sep 22 '22 15:09 sebastianst

Maybe also interesting

$ 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]

The second Audio Coprocessor is the mic.

sebastianst avatar Sep 22 '22 15:09 sebastianst

I don't see an obvious error here. Could you attach the pulseaudio debug log?

https://fedoraproject.org/wiki/How_to_debug_PulseAudio_problems

perexg avatar Sep 22 '22 15:09 perexg

  • pa-no-ucm.log - pulseaudio daemon output with alsa-ucm disabled in /etc/pulse/default.pa using line load-module module-udev-detect use_ucm=0 -> inputs and outputs visible in pavucontrol
  • pa-ucm.log - daemon output with ucm enabled -> no inputs or outputs visible in pavucontrol

sebastianst avatar Sep 22 '22 15:09 sebastianst

The wrong comment in the PA config broke everything (duplicate whole line and comment out the use_ucm=0 version):

Failed to load module "module-udev-detect" (argument: "#use_ucm=0"): initialization failed.

perexg avatar Sep 22 '22 15:09 perexg

oops sorry! pa-ucm.log

sebastianst avatar Sep 22 '22 16:09 sebastianst

If you select the 'Speaker' device, then there is no sound ? Could you attach output from amixer -c Generic_1 contents command when the playback using the UCM device is active?

perexg avatar Sep 22 '22 16:09 perexg

Here are the contents with pulseaudio running with and without the use_ucm=0 settings amixer-contents-ucm.txt amixer-contents-no-ucm.txt Basically the same output, just the Speaker Playback Volume is 0,0 in one case and 71,71 in the other.

Maybe I didn't make the problem clear in my first post, I do still hear audio even with UCM. The problem is just that pulseaudio only shows the generic profiles Play HiFi quality Music for all cards. So it wouldn't know about 5.1 HDMI etc. With ucm disabled in pa, it shows proper profiles, not the generic ones. Or when the mic kernel module is not loaded but ucm is enabled, pa also shows proper profiles.

sebastianst avatar Sep 23 '22 11:09 sebastianst

UCM describes the hardware in a different way than the legacy PA probe, thus there are some differences. I am aware about it (missing multichannel configs). On the other hand, you can use multiple HDMI stereo outputs with UCM (impossible with the default PA probe) and UCM combines the analog i/o (HDA codec) and digital mic (ACP) to one logical internal soundcard.

Do you use another configuration for HDMI out than stereo at the time ?

perexg avatar Sep 23 '22 12:09 perexg

I am very glad to find solutions to the audio problem I'm facing now. It seems I should change the audio codex and reset the kernel. But due to my lack of knowledge and I'm not good at English, I don't know how to complete the steps. I hope you can give me a detailed guidance. Thank you!

ashixu avatar May 06 '23 16:05 ashixu