Dell XPS 13 (9320): microphone not working

I was very surprised to see that my Dell XPS 13 (9320) is not able to record from the microphone: I get a white noise:

I tried both NixOs unstable and 23.11, kernel 6.1 and 6.7, pipewire and pulseaudio… no success (except that in pulseaudio, it does not record any noise).

I tried to check in alsamixer if I could change some settings to make it work… but it’s like huge. I tried to move all bars, without success:

What is surprising is that in Dell XPS 13 Plus (9320) - ArchWiki they mention that the microphone should work out of the box, and indeed ubuntu (Dell flavor) had no issue with the microphone.

In 23.11 I get this message in dmesg:

[   12.571529] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[   12.571532] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
...
[   12.595314] intel vsc not ready
[   12.603233] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0
[   12.603345] sof_sdw sof_sdw: ASoC: Parent card not yet available, widget card binding deferred
[   12.603424] dw-apb-uart.2: ttyS0 at MMIO 0x4017002000 (irq = 16, base_baud = 6250000) is a 16550A
[   12.617348] sof_sdw sof_sdw: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3

Any idea what I can try next?

$ lspci
00:00.0 Host bridge: Intel Corporation Device 4621 (rev 02)
00:02.0 VGA compatible controller: Intel Corporation Alder Lake-P GT2 [Iris Xe Graphics] (rev 0c)
00:04.0 Signal processing controller: Intel Corporation Alder Lake Innovation Platform Framework Processor Participant (rev 02)
00:05.0 Multimedia controller: Intel Corporation Alder Lake Imaging Signal Processor (rev 02)
00:06.0 PCI bridge: Intel Corporation 12th Gen Core Processor PCI Express x4 Controller #0 (rev 02)
00:07.0 PCI bridge: Intel Corporation Alder Lake-P Thunderbolt 4 PCI Express Root Port #0 (rev 02)
00:07.2 PCI bridge: Intel Corporation Alder Lake-P Thunderbolt 4 PCI Express Root Port #2 (rev 02)
00:08.0 System peripheral: Intel Corporation 12th Gen Core Processor Gaussian & Neural Accelerator (rev 02)
00:0d.0 USB controller: Intel Corporation Alder Lake-P Thunderbolt 4 USB Controller (rev 02)
00:0d.2 USB controller: Intel Corporation Alder Lake-P Thunderbolt 4 NHI #0 (rev 02)
00:0d.3 USB controller: Intel Corporation Alder Lake-P Thunderbolt 4 NHI #1 (rev 02)
00:12.0 Serial controller: Intel Corporation Alder Lake-P Integrated Sensor Hub (rev 01)
00:14.0 USB controller: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller (rev 01)
00:14.2 RAM memory: Intel Corporation Alder Lake PCH Shared SRAM (rev 01)
00:14.3 Network controller: Intel Corporation Alder Lake-P PCH CNVi WiFi (rev 01)
00:15.0 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 (rev 01)
00:15.1 Serial bus controller: Intel Corporation Alder Lake PCH Serial IO I2C Controller #1 (rev 01)
00:16.0 Communication controller: Intel Corporation Alder Lake PCH HECI Controller (rev 01)
00:1e.0 Communication controller: Intel Corporation Alder Lake PCH UART #0 (rev 01)
00:1e.3 Serial bus controller: Intel Corporation Alder Lake SPI Controller (rev 01)
00:1f.0 ISA bridge: Intel Corporation Alder Lake PCH eSPI Controller (rev 01)
00:1f.3 Multimedia audio controller: Intel Corporation Alder Lake PCH-P High Definition Audio Controller (rev 01)
00:1f.4 SMBus: Intel Corporation Alder Lake PCH-P SMBus Host Controller (rev 01)
00:1f.5 Serial bus controller: Intel Corporation Alder Lake-P PCH SPI Controller (rev 01)
01:00.0 Non-Volatile memory controller: SK hynix Gold P31/BC711/PC711 NVMe Solid State Drive

EDIT

I also tried to add

boot.initrd.availableKernelModules = [ "xhci_pci" "thunderbolt" "nvme" "usb_storage" "usbhid" "sd_mod" "snd_soc_rt715_sdca" "snd_soc_rt1316_sdw" "snd_sof_pci_intel_tgl" "snd_hda_intel" "snd_soc_sof_sdw" "i915" ];

but then it is even worse, I get an error

[    4.275488] sof-audio-pci-intel-tgl 0000:00:1f.3: Direct firmware load for intel/sof/sof-adl.ri failed with error -2
[    4.275490] sof-audio-pci-intel-tgl 0000:00:1f.3: error: sof firmware file is missing, you might need to
[    4.275490] sof-audio-pci-intel-tgl 0000:00:1f.3:        download it from https://github.com/thesofproject/sof-bin/
[    4.275491] sof-audio-pci-intel-tgl 0000:00:1f.3: error: failed to load DSP firmware -2
[    4.280408] sof-audio-pci-intel-tgl 0000:00:1f.3: error: sof_probe_work failed err: -2
[    4.281944] i915 0000:00:02.0: [drm] fb0: i915drmfb frame buffer device

not sure if it is expected or not (note that I get this error in unstable). But this file seems to exist (in its compressed form):

$ $ less /run/current-system/firmware/intel/sof/sof-adl.ri.xz  | head
==> (lesspipe 2.11) append : to filename to view the original octet-stream file
XMan
dtermin.
extman
57864
 <RG-2017.8-linux>
$CPD
ADSP
ADSP.man
cavs0015.met

Here is the output of dmesg

EDIT I even tried to upgrade the bios, not a single change

Whoooo after so long I finally found the solution… surprisingly simple (I saw it in some threads, but I was not expect it to work, and for some reasons I was not able to find the package where it is installed). The idea is to run:

$ nix-shell -p alsa-utils
$ sudo alsactl init

The only problem is that it tries to use /bin/rm and /bin/mkdir, so I needed a simple dirty workaround presented here alsactl init refers to /bin/rm and /bin/mkdir · Issue #294170 · NixOS/nixpkgs · GitHub

But I tried to reboot, and it seems to work even after a reboot, so this change does not even need to be permanent!

For reference, the configuration I tested is basically taken from here NixOS config on Dell XPS 13 Plus 9320 · GitHub, running 23.11 and default kernel 6.1, see also this discussion It Just Works ™️ · GitHub