Suspend/resume issues with sound on intel

Hello, I’m running NixOS unstable with the configuration boot.kernelPackages = pkgs.linuxPackages_latest; on a 9th generation ThinkPad X1.

I’m having issues with sound not being available after a resume and since a week I’m having troubles with suspend as well, so now I’m reaching out for help.

The symptoms are that the machine does some number of suspend/resume cycles but then it fails to go to sleep. In the kernel log I found the following lines:

lug 17 23:42:27 bean kernel: Filesystems sync: 0.048 seconds
lug 17 23:42:27 bean kernel: Freezing user space processes ... (elapsed 0.002 seconds) done.
lug 17 23:42:27 bean kernel: OOM killer disabled.
lug 17 23:42:27 bean kernel: Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
lug 17 23:42:27 bean kernel: printk: Suspending console(s) (use no_console_suspend to debug)
lug 17 23:42:27 bean kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: PM_GATE ipc error -19
lug 17 23:42:27 bean kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: failed to set requested target DSP state 0 substate 1
lug 17 23:42:27 bean kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: setting dsp state 0 substate 1
lug 17 23:42:27 bean kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: failed to power down DSP during suspend -19
lug 17 23:42:27 bean kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: PM: pci_pm_suspend(): snd_sof_suspend+0x0/0x10 [snd_sof] returns -19
lug 17 23:42:27 bean kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -19
lug 17 23:42:27 bean kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: PM: failed to suspend async: error -19
lug 17 23:42:27 bean kernel: PM: Some devices failed to suspend, or early wake event detected
lug 17 23:42:27 bean kernel: OOM killer enabled.
lug 17 23:42:27 bean kernel: Restarting tasks ... done.
lug 17 23:42:28 bean kernel: PM: suspend exit

Looking up the error I found an old issue with the sof subsystem here: https://github.com/thesofproject/sof/issues/5168 and using the manual reset:

sudo rmmod snd_sof_pci_intel_tgl
sudo modprobe snd_sof_pci_intel_tgl

… works but I would like a more automated fix. His anyone having the same issues? A quick search on nixpkgs issues hasn’t returned any valid entry…

Likely unrelated, but in case it’s not, I had strange suspend/resume issues on P-series thinkpads (not-suspending, not-coming-back-from-a-suspend) until I enabled non-redistributable firmware downloads (which also made my wireless work).

hardware.enableAllFirmware = true;

After that, I could not repeat the suspend weirdness I had been having.

BTW, if you’ve not seen it yet, there is a database of hardware configurations named nixos-hardware; your system is listed. https://github.com/NixOS/nixos-hardware/blob/76c9664813ed7082115ac7efb8a1619a804a631f/lenovo/thinkpad/x1/9th-gen/default.nix . It does not, however, set that firmware flag, but you might compare notes with it for other things.

Thanks @chrism, I’ll will investigate the enableAllFirmware but I think that the two machines are somewhat different machines. The X1 has been historically a complete Intel laptop in almost every peripheral, while I think the P-series are a more “mixed” brand and anyway in my case the firmware is already included and loaded…

I didn’t notice the addition of the profile for the 9th generation on nixos-hardware, thanks for the heads up, I’ll give it a try.

Mind bending, mind bending

:rofl:

Sorry, I just watched one of your videos on youtube…
It’s good to know that you’ve jumped on NixOS bandwagon, cheers!

The other thing that that profile will do is load tlp and the right acpi kernel boot module, which may have some impact (maybe not even good!) on sleep :wink:

Ha, thanks!