Closed miquecg closed 2 years ago
Yes, the problem with this hw is that it has only software mute control, so we need to handle it differently than for other devices. The UCM is ready to support this. I'll prepare some test configs when we have the testers, soon.
Great, good to know that you are aware of this. Thanks!
Btw, this hw needs sof-firmware
or is it just for Intel platform?
Btw, this hw needs
sof-firmware
or is it just for Intel platform?
It's an AMD platform, but the microphone is connected to the AMD ACP sound bridge (it's not HDA sound bridge). The sof-firmware is required only for Intel hardware.
Hi, any news on this?
This issue hasn't been resolved yet. Using latest version of Arch 5.13.12. I can manually change the microphone LED and the button works. However the LED does not reflect the current state of the microphone.
Could you test changes in https://github.com/alsa-project/alsa-ucm-conf/pull/115 ?
Could you test changes in #115 ?
For me it doesn't work.
Could you elaborate more? A reboot is required to let the alsactl utility to create the new control at boot (check journal for alsa-state service for errors) and you should see 'Mic ACP LED' control in alsamixer for the HDA card.
Well, I did reboot after editing both files HDA-Intel.conf
and HiFi-acp.conf
. I tested mute/unmute with laptop MIC button, which works (as before), but LED always remains on.
What do you mean by 'new control'? Is this supposed to circumvent the keyboard Fn key to achieve a working LED?
You're using very high level. It's not about key mappings. I need to go down to the ALSA subsystem basics and test things one by one. So, could you show me the alsactl log after boot - journalctl /usr/sbin/alsactl
- and amixer dump - amixer -c 0 controls
- the zero number should be the HDA card number. If you are not sure about the card number, use aplay -l
to list them.
'Mic ACP LED' control doesn't appear.
$ amixer -c 1 controls
numid=12,iface=CARD,name='Headphone Jack'
numid=11,iface=CARD,name='Mic Jack'
numid=13,iface=CARD,name='Speaker Phantom Jack'
numid=10,iface=MIXER,name='Master Playback Switch'
numid=9,iface=MIXER,name='Master Playback Volume'
numid=2,iface=MIXER,name='Headphone Playback Switch'
numid=1,iface=MIXER,name='Headphone Playback Volume'
numid=8,iface=MIXER,name='Mic Boost Volume'
numid=7,iface=MIXER,name='Capture Switch'
numid=6,iface=MIXER,name='Capture Volume'
numid=5,iface=MIXER,name='Auto-Mute Mode'
numid=4,iface=MIXER,name='Speaker Playback Switch'
numid=3,iface=MIXER,name='Speaker Playback Volume'
numid=15,iface=PCM,name='Capture Channel Map'
numid=14,iface=PCM,name='Playback Channel Map'
There is one UCM error in the logs.
$ journalctl /usr/sbin/alsactl
alsactl[783]: alsa-lib parser.c:242:(error_node) UCM is not supported for this HDA model (HD-Audio Generic at 0xfd3c8000 irq 108)
alsactl[783]: alsa-lib main.c:1405:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -6
Kernel 5.14.16
The FixedBootSequence should be executed with command alsactl init 1
(initialize card 1). I would suggest to use the whole tree from my PR https://github.com/alsa-project/alsa-ucm-conf/pull/115 - https://github.com/perexg/alsa-ucm-conf/archive/refs/heads/acp-led.zip . Unpack this, and create a symlink from /usr/share/alsa/ucm2
to the upacked alsa-ucm-conf/ucm2
tree. Rename the original ucm2 tree as backup before.
Verification:
alsactl init 1
snd_ctl_led
kernel module is loaded (lsmod
)Mic ACP LED Switch
control is present (amixer -c 1 controls
)Tested with whole tree from PR and 'Mic ACP LED Switch' appears when listing controls.
If snd_ctl_led
kernel module is loaded, you can control the Mic ACP LED
switch using a mixer and the LED should reflect the changes.
Yes, that's right. I can mute/unmute the new control on alsamixer and the LED switches states.
On the other hand, this has nothing to do with Mic status, which remains the same. I guess that now both things have to be connected somehow, right?
Pulseaudio or pipewire should change the state this control when the microphone is active / inactive. It's the change in ucm2/HDA-Intel/HiFi-acp.conf
. This sound hardware cannot mute the stream in the driver, so the sound server must do the job.
Does it work in the sound server? Note that all microphone inputs must be off (including the headphone / headset mic).
I've checked with pavucontrol:
Thank you for the feedback. I updated the code in my pull request. The CaptureMasterElem
should be CaptureMixerElem
in ucm2/HDA-Intel/HiFi-acp.conf . Could you retest with the recent zip ?
Same behaviour.
Btw, PR is not updated. I just put the change myself.
Could you show the pulseaudio debug log ?
https://fedoraproject.org/wiki/How_to_debug_PulseAudio_problems
The PR is updated now (pushed changes to other repo originally).
No errors so far:
>>> Umute Digital Microphone
D: [pulseaudio] protocol-native.c: Client pavucontrol-qt changes mute of source alsa_input.pci-0000_07_00.6.HiFi__hw_acp__source.
D: [pulseaudio] source.c: The mute of source alsa_input.pci-0000_07_00.6.HiFi__hw_acp__source changed from yes to no.
I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port source:alsa_input.pci-0000_07_00.6.HiFi__hw_acp__source:[In] Mic1.
I: [pulseaudio] module-device-restore.c: Synced.
>>> Mute Digital Microphone
D: [pulseaudio] protocol-native.c: Client pavucontrol-qt changes mute of source alsa_input.pci-0000_07_00.6.HiFi__hw_acp__source.
D: [pulseaudio] source.c: The mute of source alsa_input.pci-0000_07_00.6.HiFi__hw_acp__source changed from no to yes.
I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port source:alsa_input.pci-0000_07_00.6.HiFi__hw_acp__source:[In] Mic1.
I: [pulseaudio] module-device-restore.c: Synced.
>>> Umute Headphones Stereo Microphone
D: [pulseaudio] protocol-native.c: Client pavucontrol-qt changes mute of source alsa_input.pci-0000_07_00.6.HiFi__hw_Generic_1__source.
D: [pulseaudio] source.c: The mute of source alsa_input.pci-0000_07_00.6.HiFi__hw_Generic_1__source changed from yes to no.
I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port source:alsa_input.pci-0000_07_00.6.HiFi__hw_Generic_1__source:[In] Mic2.
>>> Mute Headphones Stereo Microphone
D: [pulseaudio] protocol-native.c: Client pavucontrol-qt changes mute of source alsa_input.pci-0000_07_00.6.HiFi__hw_Generic_1__source.
D: [pulseaudio] source.c: The mute of source alsa_input.pci-0000_07_00.6.HiFi__hw_Generic_1__source changed from no to yes.
I: [pulseaudio] module-device-restore.c: Storing volume/mute for device+port source:alsa_input.pci-0000_07_00.6.HiFi__hw_Generic_1__source:[In] Mic2.
Please, show the full log (use https://gist.github.com/ or https://pastebin.com for example). I need to check, why the switch in mixer is not detected.
PA ignores this mixer control, checking why:
D: [pulseaudio] alsa-mixer.c: Probing path 'Mic ACP LED' D: [pulseaudio] alsa-mixer.c: Probe of element 'Mic ACP LED' succeeded (volume=0, switch=0, enumeration=0, has_dB=0). W: [pulseaudio] alsa-ucm.c: Path Mic ACP LED is not a volume control
Could you dump smixer contents, please? amixer -c 1 scontents
Perhaps, the capture direction is missing in the control name (PR is updated):
diff --git a/ucm2/HDA-Intel/HDA-Intel.conf b/ucm2/HDA-Intel/HDA-Intel.conf index 7bc5f7f..78b46f0 100644 --- a/ucm2/HDA-Intel/HDA-Intel.conf +++ b/ucm2/HDA-Intel/HDA-Intel.conf @@ -30,9 +30,9 @@ If.use { Include.init.File "/HDA-Intel/init.conf" FixedBootSequence [ diff --git a/ucm2/HDA-Intel/HDA-Intel.conf b/ucm2/HDA-Intel/HDA-Intel.conf index 7bc5f7f..78b46f0 100644 --- a/ucm2/HDA-Intel/HDA-Intel.conf +++ b/ucm2/HDA-Intel/HDA-Intel.conf @@ -30,9 +30,9 @@ If.use { Include.init.File "/HDA-Intel/init.conf" FixedBootSequence [ - cset-new "name='Mic ACP LED Switch' type=bool,count=1 off" + cset-new "name='Mic ACP LED Capture Switch' type=bool,count=1 off" exec "-/sbin/modprobe snd_ctl_led" - sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:Mic ACP LED Switch" + sysw "-/class/sound/ctl-led/mic/card${CardNumber}/attach:Mic ACP LED Capture Switch" ] } True { diff --git a/ucm2/HDA-Intel/HiFi-acp.conf b/ucm2/HDA-Intel/HiFi-acp.conf index ead8646..a650f5c 100644 --- a/ucm2/HDA-Intel/HiFi-acp.conf +++ b/ucm2/HDA-Intel/HiFi-acp.conf @@ -5,6 +5,6 @@ SectionDevice."Mic1" { CapturePriority 100 CapturePCM "hw:${var:AcpCardId}" CaptureMixerElem "Mic ACP LED" - CaptureSwitch "Mic ACP LED Switch" + CaptureSwitch "Mic ACP LED Capture Switch" } }
Could you dump smixer contents, please?
amixer -c 1 scontents
Simple mixer control 'Master',0 Capabilities: pvolume pvolume-joined pswitch pswitch-joined Playback channels: Mono Limits: Playback 0 - 87 Mono: Playback 0 [0%] [-65.25dB] [off] Simple mixer control 'Headphone',0 Capabilities: pvolume pswitch Playback channels: Front Left - Front Right Limits: Playback 0 - 87 Mono: Front Left: Playback 52 [60%] [-26.25dB] [on] Front Right: Playback 52 [60%] [-26.25dB] [on] Simple mixer control 'Speaker',0 Capabilities: pvolume pswitch Playback channels: Front Left - Front Right Limits: Playback 0 - 87 Mono: Front Left: Playback 0 [0%] [-65.25dB] [off] Front Right: Playback 0 [0%] [-65.25dB] [off] Simple mixer control 'Mic ACP LED',0 Capabilities: cswitch cswitch-joined Capture channels: Mono Mono: Capture [off] Simple mixer control 'Mic Boost',0 Capabilities: volume Playback channels: Front Left - Front Right Capture channels: Front Left - Front Right Limits: 0 - 3 Front Left: 0 [0%] [0.00dB] Front Right: 0 [0%] [0.00dB] Simple mixer control 'Capture',0 Capabilities: cvolume cswitch Capture channels: Front Left - Front Right Limits: Capture 0 - 63 Front Left: Capture 0 [0%] [-17.25dB] [off] Front Right: Capture 0 [0%] [-17.25dB] [off] Simple mixer control 'Auto-Mute Mode',0 Capabilities: enum Items: 'Disabled' 'Enabled' Item0: 'Disabled'
Now 'Mic ACP LED' went to Capture
view on alsamixer and it's a toggle, not a channel that can be muted/unmuted, but LED switches just fine.
With pavucontrol same as before.
I found it. The mixer devices must be different in HiFi-acp.conf:
SectionDevice."Mic1" {
Comment "Digital Microphone"
Value {
CapturePriority 100
CapturePCM "hw:${var:AcpCardId}"
CaptureMixer "hw:${var:AcpCardId}"
CaptureMixerElem "Mic ACP LED"
CaptureCTL "hw:${var:AcpCardId}"
CaptureSwitch "Mic ACP LED Capture Switch"
}
}
The PR was updated.
Same result, LED only reacts to mute/unmute of Headphones Stereo Mic when using pavucontrol.
It seems that the old config is being used, I don't see updated CaptureCTL
and CaptureMixer
definitions:
I: [pulseaudio] alsa-ucm.c: UCM available for card hw:1
I: [pulseaudio] alsa-ucm.c: Set UCM verb to HiFi
D: [pulseaudio] alsa-ucm.c: Got CapturePCM for device Mic1: _ucm0003.hw:acp
D: [pulseaudio] alsa-ucm.c: Got PlaybackCTL for device Mic1: _ucm0003.hw:Generic_1
D: [pulseaudio] alsa-ucm.c: Got CaptureCTL for device Mic1: _ucm0003.hw:Generic_1
D: [pulseaudio] alsa-ucm.c: Got CaptureSwitch for device Mic1: Mic ACP LED Switch
D: [pulseaudio] alsa-ucm.c: Got CaptureMixerElem for device Mic1: Mic ACP LED
D: [pulseaudio] alsa-ucm.c: Got CapturePriority for device Mic1: 100
D: [pulseaudio] alsa-ucm.c: Got TQ for device Mic1: HiFi
I: [pulseaudio] alsa-ucm.c: UCM file does not specify 'CaptureChannels' for device Mic1, assuming stereo.
D: [pulseaudio] alsa-ucm.c: No _conflictingdevs for device Mic1
D: [pulseaudio] alsa-ucm.c: No _supporteddevs for device Mic1
Let me know. If you don't find anything I can repeat the process.
Did you use the tree from PR ? I pushed a bit optimized version where only CaptureCTL
should be set to *hw:acp
now. It should be enough.
Could you show your test /usr/share/alsa/ucm2/HDA-Intel/HiFi-acp.conf
file ?
EDIT: It should look like https://github.com/perexg/alsa-ucm-conf/blob/0780b6f3c570d1ee8271dd553733ce4d62afc5e6/ucm2/HDA-Intel/HiFi-acp.conf (see CaptureCTL line).
➜ # alsa cat ucm2/HDA-Intel/HiFi-acp.conf
SectionDevice."Mic1" {
Comment "Digital Microphone"
Value {
CapturePriority 100
CapturePCM "hw:${var:AcpCardId}"
CaptureCTL "hw:${var:AcpCardId}"
CaptureMixerElem "Mic ACP LED"
CaptureSwitch "Mic ACP LED Capture Switch"
}
}
Please, attach output from alsaucm -c hw:PCH dump text
(replace PCH with the HDA card number, if it does not work).
➜ # ~ alsaucm -c hw:PCH dump text
ALSA lib confmisc.c:165:(snd_config_get_card) Cannot get card index for PCH
ALSA lib parser.c:2411:(uc_mgr_import_master_config) card 'hw:PCH' is not valid
ALSA lib main.c:1405:(snd_use_case_mgr_open) error: failed to import hw:PCH use case configuration -19
alsaucm: error failed to open sound card hw:PCH: No such device
➜ # ~ alsaucm -c hw:1 dump text
Verb.HiFi {
Comment "Play HiFi quality Music"
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"
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
}
}
Device.Mic1 {
Comment "Digital Microphone"
Values {
CaptureCTL "_ucm0001.hw:Generic_1"
CapturePCM "_ucm0001.hw:acp"
CapturePriority 100
PlaybackCTL "_ucm0001.hw:Generic_1"
TQ HiFi
}
}
}
This is without the fix applied.
Please, apply the fix and show only Device.Mic1
section.
Device.Mic1 {
Comment "Digital Microphone"
Values {
CaptureCTL "_ucm0001.hw:acp"
CaptureMixerElem "Mic ACP LED"
CapturePCM "_ucm0001.hw:acp"
CapturePriority 100
CaptureSwitch "Mic ACP LED Capture Switch"
PlaybackCTL "_ucm0001.hw:Generic_1"
TQ HiFi
}
}
Looking again to https://gist.github.com/miquecg/85f493ab7f0e7c10a6af47367d375f9e#file-pulse-4-log and it's confusing to have all logs in one page (Ctrl-F in the browser looks to old entries and it confused me). After further analysis, the switch is found by PA in the 4th log (thus with the latest UCM configuration):
D: [pulseaudio] alsa-mixer.c: Probing path 'Mic ACP LED'
D: [pulseaudio] alsa-mixer.c: Probe of element 'Mic ACP LED' succeeded (volume=0, switch=1, enumeration=0, has_dB=0).
....
D: [pulseaudio] alsa-mixer.c: Activating path Mic ACP LED
D: [pulseaudio] alsa-mixer.c: Path Mic ACP LED ((null)), direction=2, priority=0, probed=yes, supported=yes, has_mute=yes, has_volume=no, has_dB=no, min_volume=0, max_volume=0, min_dB=-inf, max_dB=0
D: [pulseaudio] alsa-mixer.c: Element 'Mic ACP LED', direction=2, switch=1, volume=0, volume_limit=-1, enumeration=0, required=0, required_any=0, required_absent=0, mask=0x0, n_channels=0, override_map=00
I: [pulseaudio] alsa-source.c: Driver does not support hardware volume control, falling back to software volume control.
I: [pulseaudio] alsa-source.c: Using hardware mute control.
If PA is using the 'hardware control' the 'Mic ACP LED' switch should be toggled by PA (and it should be visible in the mixer).
I suggest to do full reboot with the latest config and try again.
So I applied the patch, did alsactl init 1
and checked. As before, 'Mic ACP LED' shows up on alsamixer and can be toggled, but with pavucontrol only 'Headphones Mic' affects the LED.
Then I rebooted and strangely the changes weren't applied. For some reason I needed to do again alsactl init 1
and results were the same.
Btw, you just can open each log file on its own clicking on 'Raw" button.
If you run alsactl init 1
the pulseaudio must be restarted, too:
Run in terminal (as user not root):
systemctl --user stop pulseaudio.socket
systemctl --user stop pulseaudio.service
systemctl --user start pulseaudio.socket
systemctl --user start pulseaudio.service
I was already doing that when providing logs. Anyway I did stop/start pulseaudio to see and nothing changed.
Ok, I am out of ideas. Latest PA sets the switch correctly in my test envirnoment (but I don't have acp hardware).
Just the last confirmation: If you run amixer -c 1 events
do you see some changes when you turn on / off mute in PA for the Mic1 ?
EDIT: And probably amixer -c 0 events
, too. (assuming that card 0 is your acp card)
EDIT2: Please, forgot the previous questions and show only output from alsa-info.sh --no-upload
.
Please, forgot the previous questions and show only output from
alsa-info.sh --no-upload
.
After applying the patch?
When 'Mic ACP LED' switch appears in the mixer.
➜ # alsa alsa-info.sh --no-upload
cat: '/sys/module/snd_acp3x_rn/parameters/*': No such file or directory
Your ALSA information is in /tmp/alsa-info.txt.zO0AWAUZfG
It seems that I am really dazed with the four files on one page (I have not clicked to raw link for my analysis before). The second PA log seems correct (it's the one where the new switch is detected and should be controlled by PA). So I reverted the last 'CaptureCTL' change. The current change is: https://github.com/alsa-project/alsa-ucm-conf/commit/9add68044679685ecd408bdd11e0c99da490adb5
Could you, please, verify, if the amixer -c 1 events
command (on the command line) sees the 'Mic ACP LED Capture Switch' changes when you mute Mic1 in PA?
Yeah, it rocks now! LED can be toggled for both microphones in pavucontrol.
# Digital Mic
event value: numid=16,iface=MIXER,name='Mic ACP LED Capture Switch'
event value: numid=16,iface=MIXER,name='Mic ACP LED Capture Switch'
# Headphones Mic
event value: numid=7,iface=MIXER,name='Capture Switch'
event value: numid=7,iface=MIXER,name='Capture Switch'
I'm running Arch Linux with
alsa-ucm-conf
1.2.5.1. This problem was present in previous versions and it's being discussed on a forum thread among other things.So the problem is that microphone LED is always ON but mute/unmute behaviour still works.