Skip to content

alsa-mixer: enable the alsa auto-mute if headphone is the active port

Hui Wang requested to merge jason77wang/pulseaudio:fix-spk-mute into master

After applying the commit 19e34d8d, the speakers could be set to active port and could output sound when headphone is plugging in. But it introduced a regression on some old machines, on them there are only one mute and one volume control shared between speakers and headphone, pulseaudio can't mute the speaker standalone when the headphone is playing sound. In such a case, it needs to count on alsa auto-mute to mute the speaker by setting pinctl to 0x0.

To fix this regression and meanwhile not to impact the fix of the commit 19e34d8d, Boris proposed a good idea in the issues#1297, based on that idea, I wrote this patch and validated it on a physical machine:

  • After booting up, the speaker is the active output port, in this case, the auto-mute is disabled and speakers' Pin-ctls: 0x40: OUT
  • plugging a headphone, the headphone is the active output port, in this case, the auto-mute is enabled and speakers' Pin-ctls: 0x00:
  • keeping headphone plugged, use pacmd to change the active port to speaker, the auto-mute becomes disabled and speakers' Pin-ctls: 0x40: OUT

BTW, the patch will not bring any impact to the systems using the ucm in pulseaudio, that is to say, it will not impact most modern laptops.

Thanks to Boris Gjenero to propose the idea of the fix.

Fixes: 19e34d8d ("alsa-mixer: disable the Auto-Mute once the system has speaker") Closes: #1297 Signed-off-by: Hui Wang

Merge request reports