Sound not working

I recently installed NixOS alongside Windows on my Lenovo Ideapad 5 Laptop. Though I can’t get the sound working. Some useful outputs:

  • dmesg | grep -i audio:
[    0.069098] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[   18.915697] sof-audio-pci 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[   18.915701] sof-audio-pci 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[   18.915714] sof-audio-pci 0000:00:1f.3: enabling device (0000 -> 0002)
[   18.915840] sof-audio-pci 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[   18.915908] sof-audio-pci 0000:00:1f.3: bound 0000:00:02.0 (ops __SCT__tp_func_render_mmio [i915])
[   18.922192] sof-audio-pci 0000:00:1f.3: use msi interrupt mode
[   19.215090] sof-audio-pci 0000:00:1f.3: hda codecs found, mask 5
[   19.215093] sof-audio-pci 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[   19.215097] sof-audio-pci 0000:00:1f.3: DMICs detected in NHLT tables: 2
[   19.371813] sof-audio-pci 0000:00:1f.3: Direct firmware load for intel/sof/sof-tgl.ri failed with error -2
[   19.371818] sof-audio-pci 0000:00:1f.3: error: request firmware intel/sof/sof-tgl.ri failed err: -2
[   19.371849] sof-audio-pci 0000:00:1f.3: error: failed to load DSP firmware -2
[   19.372147] sof-audio-pci 0000:00:1f.3: error: sof_probe_work failed err: -2
  • lscpi | grep -i audio:
    0000:00:1f.3 Multimedia audio controller: Intel Corporation Tiger Lake-LP Smart Sound Technology Audio Controller (rev 20)

  • aplay -l shows no soundcards found.

  • pavucontrol shows only a dummy output for audio

  • Current configuration for sound:

  sound.enable = true;
  nixpkgs.config.pulseaudio = true;
  hardware.pulseaudio.enable = true;
  nixpkgs.config.allowUnfree = true;
  hardware.enableAllFirmware  = true;

From what I can see the, issue is that the firmware for the sound card is not being loaded. I also tried explicitly installing the sof-firmware package, but no luck. What can I do to get the sound working?

[ 19.371813] sof-audio-pci 0000:00:1f.3: Direct firmware load for intel/sof/sof-tgl.ri failed with error -2
[ 19.371818] sof-audio-pci 0000:00:1f.3: error: request firmware intel/sof/sof-tgl.ri failed err: -2
[ 19.371849] sof-audio-pci 0000:00:1f.3: error: failed to load DSP firmware -2
[ 19.372147] sof-audio-pci 0000:00:1f.3: error: sof_probe_work failed err: -2

I’m guessing you need sof-firmware.

Although I believe hardware.enableAllFirmware = true should install sof-firmware, I did try installing the sof-firmware explicitly too, but it still doesn’t work.

Okay I got the speakers working by adding the following to my config:

boot.extraModprobeConfig = ''
  options snd-intel-dspcfg dsp_driver=1
''

Got to know about this from the sof-firmware docs.
Though, right now only the speakers works, not the mic. The mic works only when my headphones are plugged in, i.e, the in-built mic doesn’t work.

It is just that 20.09 has tool old sof-firmware. Howerver sof-firmware in unstable looks promising

nix build -f channel:nixos-unstable sof-firmware
find ./result/ -name sof-tgl.ri
> ./result/lib/firmware/intel/sof/community/sof-tgl.ri
> ./result/lib/firmware/intel/sof/sof-tgl.ri

You will propably need newer version PulseAudio too to get internal mic workinng.

There is high chance that this will be fixed in 21.05 release.

Sorry for the late reply.

I just tried the unstable one, doesn’t work. Still getting the same errors in dmesg.
I guess for now I’ll just work with the bad-aid solution of adding the modprobe parameters mentioned in the previous comment.

That is strange. Did you have sof-tgl.ri present in firmware?

I have tried simple backport

  nixpkgs.overlays = [ ( self: super: { sof-firmware =
    super.stdenv.mkDerivation rec {
      pname = "sof-firmware";
      version = "1.6";

      src = super.fetchFromGitHub {
        owner = "thesofproject";
        repo = "sof-bin";
        rev = "cbdec6963b2c2d58b0080955d3c11b96ff4c92f0";
        sha256 = "0la2pw1zpv50cywiqcfb00cxqvjc73drxwjchyzi54l508817nxh";
      };

      phases = [ "unpackPhase" "installPhase" ];

      installPhase = ''
        mkdir -p $out/lib/firmware
        patchShebangs go.sh
        ROOT=$out SOF_VERSION=v${version} ./go.sh
      '';
    }; } ) ];

and got

ls -l /run/current-system/firmware/intel/sof/sof-tgl.ri
> lrwxrwxrwx 1 root root 33  1. led  1970 /run/current-system/firmware/intel/sof/sof-tgl.ri -> v1.6/intel-signed/sof-tgl-v1.6.ri```

Okay, this is wierd, I think I’ve installed the unstable version by following this FAQ.

But running ls -l /run/current-system/firmware/intel/sof/ doesn’t list sof-tgl.ri. Plus, it just lists the older version. Here’s the exact output:

$ ls -l /run/current-system/firmware/intel/sof/
total 4
lrwxrwxrwx 1 root root   37 Jan  1  1970 sof-apl.ri -> v1.5.1/intel-signed/sof-apl-v1.5.1.ri
lrwxrwxrwx 1 root root   24 Jan  1  1970 sof-bdw.ri -> v1.5.1/sof-bdw-v1.5.1.ri
lrwxrwxrwx 1 root root   24 Jan  1  1970 sof-byt.ri -> v1.5.1/sof-byt-v1.5.1.ri
lrwxrwxrwx 1 root root   37 Jan  1  1970 sof-cfl.ri -> v1.5.1/intel-signed/sof-cnl-v1.5.1.ri
lrwxrwxrwx 1 root root   24 Jan  1  1970 sof-cht.ri -> v1.5.1/sof-cht-v1.5.1.ri
lrwxrwxrwx 1 root root   37 Jan  1  1970 sof-cml.ri -> v1.5.1/intel-signed/sof-cnl-v1.5.1.ri
lrwxrwxrwx 1 root root   37 Jan  1  1970 sof-cnl.ri -> v1.5.1/intel-signed/sof-cnl-v1.5.1.ri
lrwxrwxrwx 1 root root   37 Jan  1  1970 sof-glk.ri -> v1.5.1/intel-signed/sof-apl-v1.5.1.ri
lrwxrwxrwx 1 root root   37 Jan  1  1970 sof-icl.ri -> v1.5.1/intel-signed/sof-icl-v1.5.1.ri
dr-xr-xr-x 4 root root 4096 Jan  1  1970 v1.5.1

I’m not sure if it matters or not, but I also did try disabling the hardware.enableAllFirmware option, but didn’t get any different results.

Also, I’m a bit new to nix, so I’m not aware how to do that. Can you explain it, or link a resource I could follow?

Update:
Okay, I looked up overlays and was able to successfully install version 1.6. Now, running ls -l /run/current-system/firmware/intel/sof/ does list sof-tgl.r, and the audio devices do show up in pavucontrol but, I’m not getting any sound. Any idea what could be the problem here?

Good. This could by just old PulsaAudio deamon. If you have added nixos-unstable channel and imported it in configuration.nix same as in the FAQ, this should help by adding to configuration.nix.

  hardware.pulseaudio.package = unstable.pulseaudioFull;

20.09 has 13.0 pulseaudio, I’m running 13.99 and unstable has 14.2. I will try 14.2 just to check if still work on my 10th gen intel.

Yup! Upgrading PulseAudio did work, now audio (both input and output) works perfectly fine.
Thanks a lot for your help!

1 Like

Nice. With importing of unstable channe lt can be simplified to this form:

{ config, pkgs, ... }:
let
  unstable = import <nixos-unstable> {};
in
{
    nixpkgs.overlays = [ ( self: super: { sof-firmware = unstable.sof-firmware; } ) ];
    hardware.pulseaudio.package = unstable.pulseaudioFull;
}

And don’t forget remove it when upgrading to the next release.

1 Like

Right, will do. Once again, thanks for the help!

P.S. Until a few moths ago the intel sof driver would sometimes crash randomly. If you ever experienced it, upgrade to lastest kernel boot.kernelPackages = pkgs.linuxPackages_latest;.

I already am on the latest kernel. Had to upgrade during OS installation itself. On the standard installation image with the older kernel (5.4), none of my storage devices were being detected, so I couldn’t even install NixOS :P. Had to use an image with a newer kernel.

help sound not working
dmesg

[ 5.934778] sof-audio-pci-intel-apl 0000:00:0e.0: DSP detected with PCI class/subclass/prog-if info 0x040100
[ 5.935768] sof-audio-pci-intel-apl 0000:00:0e.0: DSP detected with PCI class/subclass/prog-if 0x040100
[ 5.935938] sof-audio-pci-intel-apl 0000:00:0e.0: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[ 5.964333] sof-audio-pci-intel-apl 0000:00:0e.0: use msi interrupt mode
[ 5.976327] NET: Registered PF_ALG protocol family
[ 5.987670] sof-audio-pci-intel-apl 0000:00:0e.0: hda codecs found, mask 4
[ 5.987678] sof-audio-pci-intel-apl 0000:00:0e.0: using HDA machine driver skl_hda_dsp_generic now
[ 5.987686] sof-audio-pci-intel-apl 0000:00:0e.0: DMICs detected in NHLT tables: 0
[ 6.005190] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware info: version 2:2:0-57864
[ 6.005198] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware: ABI 3:22:1 Kernel ABI 3:18:0
[ 6.005201] sof-audio-pci-intel-apl 0000:00:0e.0: warn: FW ABI is more recent than kernel
[ 6.005211] sof-audio-pci-intel-apl 0000:00:0e.0: unknown sof_ext_man header type 3 size 0x30
[ 6.059686] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware info: version 2:2:0-57864
[ 6.059693] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware: ABI 3:22:1 Kernel ABI 3:18:0
[ 6.059696] sof-audio-pci-intel-apl 0000:00:0e.0: warn: FW ABI is more recent than kernel
[ 6.071610] sof-audio-pci-intel-apl 0000:00:0e.0: Topology: ABI 3:22:1 Kernel ABI 3:18:0
[ 6.071619] sof-audio-pci-intel-apl 0000:00:0e.0: warn: topology ABI is more recent than kernel
[ 6.075621] sof-audio-pci-intel-apl 0000:00:0e.0: ASoC: Parent card not yet available, widget card binding deferred[quote=“Assyaiban, post:15, topic:12585, full:true”]
[ 5.934778] sof-audio-pci-intel-apl 0000:00:0e.0: DSP detected with PCI class/subclass/prog-if info 0x040100
[ 5.935768] sof-audio-pci-intel-apl 0000:00:0e.0: DSP detected with PCI class/subclass/prog-if 0x040100
[ 5.935938] sof-audio-pci-intel-apl 0000:00:0e.0: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[ 5.964333] sof-audio-pci-intel-apl 0000:00:0e.0: use msi interrupt mode
[ 5.976327] NET: Registered PF_ALG protocol family
[ 5.987670] sof-audio-pci-intel-apl 0000:00:0e.0: hda codecs found, mask 4
[ 5.987678] sof-audio-pci-intel-apl 0000:00:0e.0: using HDA machine driver skl_hda_dsp_generic now
[ 5.987686] sof-audio-pci-intel-apl 0000:00:0e.0: DMICs detected in NHLT tables: 0
[ 6.005190] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware info: version 2:2:0-57864
[ 6.005198] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware: ABI 3:22:1 Kernel ABI 3:18:0
[ 6.005201] sof-audio-pci-intel-apl 0000:00:0e.0: warn: FW ABI is more recent than kernel
[ 6.005211] sof-audio-pci-intel-apl 0000:00:0e.0: unknown sof_ext_man header type 3 size 0x30
[ 6.059686] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware info: version 2:2:0-57864
[ 6.059693] sof-audio-pci-intel-apl 0000:00:0e.0: Firmware: ABI 3:22:1 Kernel ABI 3:18:0
[ 6.059696] sof-audio-pci-intel-apl 0000:00:0e.0: warn: FW ABI is more recent than kernel
[ 6.071610] sof-audio-pci-intel-apl 0000:00:0e.0: Topology: ABI 3:22:1 Kernel ABI 3:18:0
[ 6.071619] sof-audio-pci-intel-apl 0000:00:0e.0: warn: topology ABI is more recent than kernel
[ 6.075621] sof-audio-pci-intel-apl 0000:00:0e.0: ASoC: Parent card not yet available, widget card binding deferred
[/quote]

1 Like