Audio stops working after suspend (Fedora 44)

So
My device is: Xiaomi Mi Notebook Pro 2020
Audio stops working every time my laptop wakes up from suspend. After reboot audio works normally. Closing the laptop lid causes the sound to stop working after waking up from sleep mode.

About

  • Fedora 44 Workstation
  • Kernel: 7.1.4-204.fc44.x86_64
  • Audio controller: Intel 400 Series Chipset Family On-Package HD Audio (8086:02c8)
  • PipeWire 1.6.8
  • WirePlumber 0.5.14

What I have checked:

  • PipeWire, pipewire-pulse, and WirePlumber are running.
  • Restarting them does not restore audio.
  • looks like aplay -l still lists the sound card correctly:
card 0: PCH [HDA Intel PCH], device 0: ALC256 Analog

I would really like to solve this annoying problem.

Hi and welcome to :fedora:
Is there any difference in the output of:
lspci | grep -i -E 'audio' | cut -b1-7 | xargs -i lspci -vnnks {}

before and after suspending.

or if there’s anything in the journal after resuming.
journalctl --since -5m

So
before sleep (sound works)

dertefter@xiaomi-mi-notebook-pro-2020:~$ lspci |  grep -i -E 'audio' | cut -b1-7 | xargs -i lspci -vnnks {}
00:1f.3 Audio device [0403]: Intel Corporation 400 Series Chipset Family On-Package HD Audio [8086:02c8] (prog-if 80 [HDA compatible with vendor specific extensions])
	Subsystem: Xiaomi Device [1d72:1963]
	Flags: bus master, fast devsel, latency 32, IRQ 162
	Memory at b4314000 (64-bit, non-prefetchable) [size=16K]
	Memory at b4000000 (64-bit, non-prefetchable) [size=1M]
	Capabilities: <access denied>
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_soc_avs, snd_sof_pci_intel_cnl, snd_hda_intel

after sleep (now sound doesn’t work)

dertefter@xiaomi-mi-notebook-pro-2020:~$ lspci |  grep -i -E 'audio' | cut -b1-7 | xargs -i lspci -vnnks {}
00:1f.3 Audio device [0403]: Intel Corporation 400 Series Chipset Family On-Package HD Audio [8086:02c8] (prog-if 80 [HDA compatible with vendor specific extensions])
	Subsystem: Xiaomi Device [1d72:1963]
	Flags: bus master, fast devsel, latency 32, IRQ 162
	Memory at b4314000 (64-bit, non-prefetchable) [size=16K]
	Memory at b4000000 (64-bit, non-prefetchable) [size=1M]
	Capabilities: <access denied>
	Kernel driver in use: snd_hda_intel
	Kernel modules: snd_soc_avs, snd_sof_pci_intel_cnl, snd_hda_intel

looks like output is not changed

And there are logs: journalctl.txt

I did a web search for “linux Xiaomi Mi Notebook Pro 2020 audio stops after wake” and there are a lot of reports of this issue. Maybe you can find a workaround on one of the pages?

I did notice that one of the reports is against the linuxk kernel that suggests is a driver bug. But have not read the report.

I think I’ve found a solution here!

# echo 1 > /sys/bus/pci/devices/0000:00:1f.3/remove
# echo 1 > /sys/bus/pci/rescan

In my case, the sound starts working after that.
However, this response was posted in 2020. It’s strange that this issue hasn’t been fixed in six years :smiling_face_with_tear:

That hints that it’s a power issue.
Maybe there is a way to stop the audio being fully powered down?

Run alsamixer press F6 and select HDA Intel PCH (card 0)

Look at channels listed below eg Master, Speaker etc etc
Look for MM below volume bars, if a channel says MM go there with you arrow key and press M to toggle it back to 00 (unmuted)
if everything is normal now you can save the card state by
sudo alsactl store, then test it after sleep suspend

Suspend your laptop and wake it up, and once sound stops working run
alsactl restore, your audio might come back.

That’s what I tried doing first when I discovered the problem. In my case, it doesn’t solve the problem.

I made small script:

#!/bin/sh
case "$1" in
  post)
    logger -t audio-rescan "post: start"
    logger -t audio-rescan "post: remove"
    [ -e /sys/bus/pci/devices/0000:00:1f.3/remove ] && echo 1 > /sys/bus/pci/devices/0000:00:1f.3/remove
    logger -t audio-rescan "post: rescan"
    echo 1 > /sys/bus/pci/rescan
    logger -t audio-rescan "post: done"
    ;;
esac

and put it in: /usr/lib/systemd/system-sleep/audio-rescan

And finally the sound is restored automatically after waking from sleep mode

Do headphones still work? Maybe the amp is not powered on after resume.

Systemd is happy to look in /etc for your sleep file.
You can put your local config into /etc/systemd/sleep.conf.d/*.conf
See man systemd-sleep.conf

I was checked bluetooth headphones and there was the same problem
(Sorry for my bad English if it is)

Sorry, ofc, I meant wired headphones connected to the 3.5mm jack,

AFAIK bluetooth devices don’t use the internal audio codec. If bluetooth is also affected, then I would assume that pipewire and then also wireplumber are blocked.