thesofproject / linux

Linux kernel source tree
Other
91 stars 131 forks source link

[BUG] Audio driver fails to load on Dell XPS 16 2024 (9640) with a Cirrus Logic CS42L43 #4879

Closed moritz89 closed 6 months ago

moritz89 commented 6 months ago

Describe the bug The audio driver fails to load with an error that the firmware/topology (intel/sof-ipc4/mtl/sof-mtl.ri and intel/sof-ace-tplg/sof-mtl-rt711.tplg) files were not found.

Attempts to fix where to extract the zst file sof-mtl.ri of the same name and the similarly named sof-mtl-rt711-4ch.tplg.zst, the driver loaded but resulted in the error below.

To Reproduce

Reproduction Rate 100% on boot

Expected behavior The sound card is detected

Impact No audio via built-in speakers

Environment 1) Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).

Screenshots or console output

# dmesg
sof-audio-pci-intel-mtl 0000:00:1f.3: use msi interrupt mode
sof-audio-pci-intel-mtl 0000:00:1f.3: DMICs detected in NHLT tables: 0
sof-audio-pci-intel-mtl 0000:00:1f.3: hda codecs found, mask 4
sof-audio-pci-intel-mtl 0000:00:1f.3: SOF firmware and/or topology file not found.
sof-audio-pci-intel-mtl 0000:00:1f.3: Supported default profiles
sof-audio-pci-intel-mtl 0000:00:1f.3: - ipc type 1 (Requested):
sof-audio-pci-intel-mtl 0000:00:1f.3: Firmware file: intel/sof-ipc4/mtl/sof-mtl.ri
sof-audio-pci-intel-mtl 0000:00:1f.3: Topology file: intel/sof-ace-tplg/sof-mtl-rt711.tplg
sof-audio-pci-intel-mtl 0000:00:1f.3: Check if you have 'sof-firmware' package installed.
sof-audio-pci-intel-mtl 0000:00:1f.3: Optionally it can be manually downloaded from:
sof-audio-pci-intel-mtl 0000:00:1f.3: https://github.com/thesofproject/sof-bin/
sof-audio-pci-intel-mtl 0000:00:1f.3: error: sof_probe_work failed err: -2

After extracting the intel/sof-ipc4/mtl/sof-mtl.ri.zst and intel/sof-ace-tplg/sof-mtl-rt711-4ch.tplg.zst and placing them in the same folder, the following dmesg output is created:

# dmesg
snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
snd_hda_intel 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
sof-audio-pci-intel-mtl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
sof-audio-pci-intel-mtl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
sof-audio-pci-intel-mtl 0000:00:1f.3: use msi interrupt mode
sof-audio-pci-intel-mtl 0000:00:1f.3: DMICs detected in NHLT tables: 0
sof-audio-pci-intel-mtl 0000:00:1f.3: hda codecs found, mask 4
sof-audio-pci-intel-mtl 0000:00:1f.3: Firmware paths/files for ipc type 1:
sof-audio-pci-intel-mtl 0000:00:1f.3: Firmware file: intel/sof-ipc4/mtl/sof-mtl.ri
sof-audio-pci-intel-mtl 0000:00:1f.3: Firmware lib path: intel/sof-ipc4-lib/mtl
sof-audio-pci-intel-mtl 0000:00:1f.3: Topology file: intel/sof-ace-tplg/sof-mtl-rt711.tplg
sof-audio-pci-intel-mtl 0000:00:1f.3: Loaded firmware library: ADSPFW, version: 2.8.1.1
cs42l43 sdw:0:0:01fa:4243:01: supply vdd-p not found, using dummy regulator
cs42l43 sdw:0:0:01fa:4243:01: supply vdd-d not found, using dummy regulator
cs42l43 sdw:0:0:01fa:4243:01: supply vdd-a not found, using dummy regulator
cs42l43 sdw:0:0:01fa:4243:01: supply vdd-io not found, using dummy regulator
cs42l43 sdw:0:0:01fa:4243:01: supply vdd-cp not found, using dummy regulator
cs35l56 sdw:0:2:01fa:3556:01:2: supply VDD_P not found, using dummy regulator
cs35l56 sdw:0:2:01fa:3556:01:2: supply VDD_IO not found, using dummy regulator
cs35l56 sdw:0:2:01fa:3556:01:2: supply VDD_A not found, using dummy regulator
cs35l56 sdw:0:2:01fa:3556:01:3: supply VDD_P not found, using dummy regulator
cs35l56 sdw:0:2:01fa:3556:01:3: supply VDD_IO not found, using dummy regulator
cs35l56 sdw:0:2:01fa:3556:01:3: supply VDD_A not found, using dummy regulator
cs35l56 sdw:0:3:01fa:3556:01:0: supply VDD_P not found, using dummy regulator
cs35l56 sdw:0:3:01fa:3556:01:0: supply VDD_IO not found, using dummy regulator
cs35l56 sdw:0:3:01fa:3556:01:0: supply VDD_A not found, using dummy regulator
cs35l56 sdw:0:3:01fa:3556:01:1: supply VDD_P not found, using dummy regulator
cs35l56 sdw:0:3:01fa:3556:01:1: supply VDD_IO not found, using dummy regulator
cs35l56 sdw:0:3:01fa:3556:01:1: supply VDD_A not found, using dummy regulator
sof-audio-pci-intel-mtl 0000:00:1f.3: Booted firmware version: 2.8.1.1
cs42l43 sdw:0:0:01fa:4243:01: devid: 0x042a43, rev: 0xa1, otp: 0x03
cs35l56 sdw:0:2:01fa:3556:01:3: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)
cs35l56 sdw:0:3:01fa:3556:01:1: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)
cs35l56 sdw:0:2:01fa:3556:01:2: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)
cs35l56 sdw:0:3:01fa:3556:01:0: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)
cs42l43 sdw:0:0:01fa:4243:01: Slave 6 state check1: UNATTACHED, status was 1
cs35l56 sdw:0:2:01fa:3556:01:3: Slave 1 state check1: UNATTACHED, status was 1
cs35l56 sdw:0:2:01fa:3556:01:2: Slave 2 state check1: UNATTACHED, status was 1
cs35l56 sdw:0:3:01fa:3556:01:1: Slave 1 state check1: UNATTACHED, status was 1
cs35l56 sdw:0:3:01fa:3556:01:0: Slave 2 state check1: UNATTACHED, status was 1
Adding alias for supply vdd-amp,(null) -> vdd-amp,sdw:0:0:01fa:4243:01
sof-audio-pci-intel-mtl 0000:00:1f.3: Topology: ABI 3:29:0 Kernel ABI 3:23:0
sof-audio-pci-intel-mtl 0000:00:1f.3: error: can't connect DAI dai-copier.DMIC.dmic01.capture stream dmic01
sof-audio-pci-intel-mtl 0000:00:1f.3: error: failed to add widget id 0 type 28 name : dai-copier.DMIC.dmic01.capture stream dmic01
sof_sdw sof_sdw: ASoC: failed to load widget dai-copier.DMIC.dmic01.capture
sof_sdw sof_sdw: ASoC: topology: could not load header: -22
sof-audio-pci-intel-mtl 0000:00:1f.3: error: tplg component load failed -22
sof-audio-pci-intel-mtl 0000:00:1f.3: error: failed to load DSP topology -22
sof-audio-pci-intel-mtl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -22
sof_sdw sof_sdw: ASoC: failed to instantiate card -22
sof_sdw sof_sdw: error -EINVAL: snd_soc_register_card failed -22
sof_sdw: probe of sof_sdw failed with error -22

sof-logger. See https://thesofproject.github.io/latest/developer_guides/debugability/logger/index.html

# sof-logger
# TBD

The bug has initially been reported on launchpad

plbossart commented 6 months ago

There are multiple problems here....

First, the use of a topology with RT711 on a platform with Cirrus Logic seems very very odd. There's clearly a problem in the detection of the hardware.

Can you please add this file sof-dyndbg.conf.txt to /etc/modprobe.d/sof-dyndbg.conf, reboot and then attach the result of 'alsa-info' and the full dmesg log.

Thanks!

plbossart commented 6 months ago

@bardliao @rfvirgil @charleskeepax FYI

charleskeepax commented 6 months ago

Yeah that is definitely odd, looking at the log it looks like the cs35l56's are on links 2/3 whereas the current MTL topology has them on links 1/2. So that might be why we are not picking up the system, weird it picks a RT711 that makes me wonder if there is some weirdness in the ACPI as well. Let me do some checking at this end.

charleskeepax commented 6 months ago

ah I think the kernel is just missing this patch:

ASoC: Intel: mtl-match: Add cs42l43_l0 cs35l56_l23 for MTL

It is in mainline already but not in the 6.8 kernel, can you please test with Linus's tree.

charleskeepax commented 6 months ago

So taking a dump of the ACPI on our copy of this laptop there does indeed appear to be a spurious rt711 in the ACPI tables, not quite sure where that is coming from. We have tested the laptop so I assume the right topology etc. gets picked once the kernel has support but weird there is a redundant Realtek device in the ACPI table.

plbossart commented 6 months ago

@charleskeepax it's a classic that the DSDT includes devices that are not there. Intel reference has e.g. entries for RT700 and RT701, they are ignored and unused. But if for some reason the entry for the spurious device is added BEFORE the actual devices, then the topology selection will fail. There's an implicit order in the selection.

charleskeepax commented 6 months ago

I see... well in that case everything should be fine here, pretty sure the kernel just needs updating, it will get the new entries and find the correct topology.

plbossart commented 6 months ago

@charleskeepax is this just that one patch that's problematic on this device? Or do we also need all the patches queued up for 6.10?

moritz89 commented 6 months ago

I booted and signed 6.9.0-060900rc1-generic #202403242136 SMP PREEMPT_DYNAMIC Sun Mar 24 21:49:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux and now it seems to recognize the sound card as cs42l43, but cannot find the correct topology file. Will see if I can find it somewhere. Currently using firmware-sof-signed/noble,now 2023.12.1-1ubuntu1

[   18.812926] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
[   18.812962] snd_hda_intel 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
[   18.813079] snd_hda_intel 0000:01:00.1: enabling device (0000 -> 0002)
[   18.813363] snd_hda_intel 0000:01:00.1: Disabling MSI
[   18.813375] snd_hda_intel 0000:01:00.1: Handle vga_switcheroo audio client
[   18.910122] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
[   18.910151] sof-audio-pci-intel-mtl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
[   18.910167] sof-audio-pci-intel-mtl 0000:00:1f.3: enabling device (0000 -> 0002)
[   18.910349] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[   20.366874] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
[   20.366907] snd_hda_intel 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
[   20.366919] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
[   20.366929] sof-audio-pci-intel-mtl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
[   20.367317] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[   20.367423] sof-audio-pci-intel-mtl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[   20.374317] sof-audio-pci-intel-mtl 0000:00:1f.3: use msi interrupt mode
[   20.386135] sof-audio-pci-intel-mtl 0000:00:1f.3: hda codecs found, mask 4
[   20.390341] sof-audio-pci-intel-mtl 0000:00:1f.3: SOF firmware and/or topology file not found.
[   20.390349] sof-audio-pci-intel-mtl 0000:00:1f.3: Supported default profiles
[   20.390350] sof-audio-pci-intel-mtl 0000:00:1f.3: - ipc type 1 (Requested):
[   20.390352] sof-audio-pci-intel-mtl 0000:00:1f.3:  Firmware file: intel/sof-ipc4/mtl/sof-mtl.ri
[   20.390353] sof-audio-pci-intel-mtl 0000:00:1f.3:  Topology file: intel/sof-ace-tplg/sof-mtl-cs42l43-l0-cs35l56-l23.tplg
[   20.390354] sof-audio-pci-intel-mtl 0000:00:1f.3: Check if you have 'sof-firmware' package installed.
[   20.390355] sof-audio-pci-intel-mtl 0000:00:1f.3: Optionally it can be manually downloaded from:
[   20.390356] sof-audio-pci-intel-mtl 0000:00:1f.3:    https://github.com/thesofproject/sof-bin/
[   20.392213] sof-audio-pci-intel-mtl 0000:00:1f.3: error: sof_probe_work failed err: -2

Also, the patch seems to be in the 6.9-rc1 release:

plbossart commented 6 months ago

the topology file is here: https://github.com/thesofproject/sof-bin/blob/8e1cd9b61c312aef5da23c50c88d2496b7c1b955/v2.9.x/sof-ipc4-tplg-v2.9/sof-mtl-cs42l43-l0-cs35l56-l23.tplg

moritz89 commented 6 months ago

Installed the file and now resulting in the following dmesg output. Filtered with sudo dmesg | grep -E 'sof-audio-pci-intel-mtl|snd_hda_intel|cs35l56|sof_sdw|sof-audio-pci-intel-mtl|input|cs42l43-codec'.

Will try debug info from https://github.com/thesofproject/linux/issues/4879#issuecomment-2020625625 next

[    0.608012] input: Lid Switch as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0D:00/input/input0
[    0.608083] input: Power Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0C:00/input/input1
[    0.608196] input: Sleep Button as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0E:00/input/input2
[    0.645175] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input3
[    1.603086] input: PS/2 Generic Mouse as /devices/platform/i8042/serio1/input/input5
[    2.142103] input: VEN_2C2F:00 2C2F:0025 Mouse as /devices/pci0000:00/0000:00:15.2/i2c_designware.1/i2c-1/i2c-VEN_2C2F:00/0018:2C2F:0025.0001/input/input6
[    2.142215] input: VEN_2C2F:00 2C2F:0025 Touchpad as /devices/pci0000:00/0000:00:15.2/i2c_designware.1/i2c-1/i2c-VEN_2C2F:00/0018:2C2F:0025.0001/input/input7
[    2.142305] hid-generic 0018:2C2F:0025.0001: input,hidraw0: I2C HID v1.00 Mouse [VEN_2C2F:00 2C2F:0025] on i2c-VEN_2C2F:00
[    2.220397] input: VEN_2C2F:00 2C2F:0025 Mouse as /devices/pci0000:00/0000:00:15.2/i2c_designware.1/i2c-1/i2c-VEN_2C2F:00/0018:2C2F:0025.0001/input/input9
[    2.220475] input: VEN_2C2F:00 2C2F:0025 Touchpad as /devices/pci0000:00/0000:00:15.2/i2c_designware.1/i2c-1/i2c-VEN_2C2F:00/0018:2C2F:0025.0001/input/input10
[    2.220541] hid-multitouch 0018:2C2F:0025.0001: input,hidraw0: I2C HID v1.00 Mouse [VEN_2C2F:00 2C2F:0025] on i2c-VEN_2C2F:00
[    2.727541] input: Intel HID events as /devices/platform/INTC1077:00/input/input12
[    2.731737] input: Intel HID 5 button array as /devices/platform/INTC1077:00/input/input13
[    3.194870] input: Dell Privacy Driver as /devices/platform/PNP0C14:03/wmi_bus/wmi_bus-PNP0C14:03/6932965F-1671-4CEB-B988-D3AB0A901919/input/input14
[    3.195257] input: Dell WMI hotkeys as /devices/platform/PNP0C14:03/wmi_bus/wmi_bus-PNP0C14:03/9DBB5994-A997-11DA-B012-B622A1EF5492/input/input15
[    5.189601] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/LNXVIDEO:00/input/input16
[    5.189956] input: Video Bus as /devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:68/LNXVIDEO:01/input/input17
[   16.621663] snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
[   16.621691] snd_hda_intel 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
[   16.621763] snd_hda_intel 0000:01:00.1: enabling device (0000 -> 0002)
[   16.621947] snd_hda_intel 0000:01:00.1: Disabling MSI
[   16.621951] snd_hda_intel 0000:01:00.1: Handle vga_switcheroo audio client
[   16.714404] input: HDA NVidia HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input18
[   16.714452] input: HDA NVidia HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input19
[   16.714489] input: HDA NVidia HDMI/DP,pcm=8 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input20
[   16.714587] input: HDA NVidia HDMI/DP,pcm=9 as /devices/pci0000:00/0000:00:01.0/0000:01:00.1/sound/card0/input21
[   16.796998] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
[   16.797027] sof-audio-pci-intel-mtl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
[   16.797050] sof-audio-pci-intel-mtl 0000:00:1f.3: enabling device (0000 -> 0002)
[   16.797211] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[   16.797268] sof-audio-pci-intel-mtl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[   16.804078] sof-audio-pci-intel-mtl 0000:00:1f.3: use msi interrupt mode
[   16.816363] sof-audio-pci-intel-mtl 0000:00:1f.3: hda codecs found, mask 4
[   16.821158] sof-audio-pci-intel-mtl 0000:00:1f.3: Firmware paths/files for ipc type 1:
[   16.821161] sof-audio-pci-intel-mtl 0000:00:1f.3:  Firmware file:     intel/sof-ipc4/mtl/sof-mtl.ri
[   16.821162] sof-audio-pci-intel-mtl 0000:00:1f.3:  Firmware lib path: intel/sof-ipc4-lib/mtl
[   16.821162] sof-audio-pci-intel-mtl 0000:00:1f.3:  Topology file:     intel/sof-ace-tplg/sof-mtl-cs42l43-l0-cs35l56-l23.tplg
[   16.822602] sof-audio-pci-intel-mtl 0000:00:1f.3: Loaded firmware library: ADSPFW, version: 2.8.1.1
[   16.847332] cs35l56 sdw:0:2:01fa:3556:01:2: supply VDD_P not found, using dummy regulator
[   16.847349] cs35l56 sdw:0:2:01fa:3556:01:2: supply VDD_IO not found, using dummy regulator
[   16.847354] cs35l56 sdw:0:2:01fa:3556:01:2: supply VDD_A not found, using dummy regulator
[   16.847557] cs35l56 sdw:0:2:01fa:3556:01:2: Got spk-id from AF01
[   16.847761] cs35l56 sdw:0:2:01fa:3556:01:3: supply VDD_P not found, using dummy regulator
[   16.847807] cs35l56 sdw:0:2:01fa:3556:01:3: supply VDD_IO not found, using dummy regulator
[   16.847816] cs35l56 sdw:0:2:01fa:3556:01:3: supply VDD_A not found, using dummy regulator
[   16.847991] cs35l56 sdw:0:2:01fa:3556:01:3: Got spk-id from AF01
[   16.848293] cs35l56 sdw:0:3:01fa:3556:01:0: supply VDD_P not found, using dummy regulator
[   16.848405] cs35l56 sdw:0:3:01fa:3556:01:0: supply VDD_IO not found, using dummy regulator
[   16.848416] cs35l56 sdw:0:3:01fa:3556:01:0: supply VDD_A not found, using dummy regulator
[   16.848616] cs35l56 sdw:0:3:01fa:3556:01:0: Got spk-id from AF01
[   16.848860] cs35l56 sdw:0:3:01fa:3556:01:1: supply VDD_P not found, using dummy regulator
[   16.848944] cs35l56 sdw:0:3:01fa:3556:01:1: supply VDD_IO not found, using dummy regulator
[   16.848959] cs35l56 sdw:0:3:01fa:3556:01:1: supply VDD_A not found, using dummy regulator
[   16.849116] cs35l56 sdw:0:3:01fa:3556:01:1: Got spk-id from AF01
[   16.927527] sof-audio-pci-intel-mtl 0000:00:1f.3: Booted firmware version: 2.8.1.1
[   16.936641] cs35l56 sdw:0:2:01fa:3556:01:3: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)
[   16.936653] cs35l56 sdw:0:3:01fa:3556:01:1: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)
[   16.949958] cs35l56 sdw:0:2:01fa:3556:01:2: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)
[   16.949965] cs35l56 sdw:0:3:01fa:3556:01:0: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)
[   16.953591] cs35l56 sdw:0:3:01fa:3556:01:1: Slave 1 state check1: UNATTACHED, status was 1
[   16.953794] cs35l56 sdw:0:2:01fa:3556:01:3: Slave 1 state check1: UNATTACHED, status was 1
[   16.953796] cs35l56 sdw:0:2:01fa:3556:01:2: Slave 2 state check1: UNATTACHED, status was 1
[   16.954099] cs35l56 sdw:0:3:01fa:3556:01:0: Slave 2 state check1: UNATTACHED, status was 1
[   17.042271] cs42l43-codec cs42l43-codec: supply vdd-amp not found, using dummy regulator
[   17.044634] sof-audio-pci-intel-mtl 0000:00:1f.3: Topology: ABI 3:29:0 Kernel ABI 3:23:0
[   17.045048] sof_sdw sof_sdw: ASoC: Parent card not yet available, widget card binding deferred
[   17.045119] cs35l56 sdw:0:2:01fa:3556:01:2: supply VDD_B not found, using dummy regulator
[   17.045134] cs35l56 sdw:0:2:01fa:3556:01:2: supply VDD_AMP not found, using dummy regulator
[   17.045717] cs35l56 sdw:0:2:01fa:3556:01:3: supply VDD_B not found, using dummy regulator
[   17.045728] cs35l56 sdw:0:2:01fa:3556:01:3: supply VDD_AMP not found, using dummy regulator
[   17.046817] cs35l56 sdw:0:3:01fa:3556:01:0: supply VDD_B not found, using dummy regulator
[   17.046829] cs35l56 sdw:0:3:01fa:3556:01:0: supply VDD_AMP not found, using dummy regulator
[   17.047485] cs35l56 sdw:0:3:01fa:3556:01:1: supply VDD_B not found, using dummy regulator
[   17.047493] cs35l56 sdw:0:3:01fa:3556:01:1: supply VDD_AMP not found, using dummy regulator
[   17.049660] cs35l56 sdw:0:2:01fa:3556:01:2: DSP1: Firmware: 1a00d6 vendor: 0x2 v3.4.4, 37 algorithms
[   17.050180] cs35l56 sdw:0:3:01fa:3556:01:0: DSP1: Firmware: 1a00d6 vendor: 0x2 v3.4.4, 37 algorithms
[   17.050725] cs35l56 sdw:0:2:01fa:3556:01:3: DSP1: Firmware: 1a00d6 vendor: 0x2 v3.4.4, 37 algorithms
[   17.059582] sof_sdw sof_sdw: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3
[   17.075341] cs35l56 sdw:0:3:01fa:3556:01:1: DSP1: Firmware: 1a00d6 vendor: 0x2 v3.4.4, 37 algorithms
[   17.075860] cs35l56 sdw:0:3:01fa:3556:01:0: Slave 2 state check1: UNATTACHED, status was 1
[   17.098944] cs35l56 sdw:0:2:01fa:3556:01:3: Slave 1 state check1: UNATTACHED, status was 1
[   17.099156] cs35l56 sdw:0:2:01fa:3556:01:2: Slave 2 state check1: UNATTACHED, status was 1
[   17.100936] cs35l56 sdw:0:3:01fa:3556:01:1: Slave 1 state check1: UNATTACHED, status was 1
[   17.105944] cs35l56 sdw:0:3:01fa:3556:01:0: Failed to write to 'CAL_AMBIENT': -2
[   17.106648] cs35l56 sdw:0:2:01fa:3556:01:3: Failed to write to 'CAL_AMBIENT': -2
[   17.107648] input: sof-soundwire Jack as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card1/input22
[   17.108055] input: sof-soundwire HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card1/input23
[   17.108723] input: sof-soundwire HDMI/DP,pcm=6 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card1/input24
[   17.109037] input: sof-soundwire HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card1/input25
[   17.113165] cs35l56 sdw:0:2:01fa:3556:01:2: Failed to write to 'CAL_AMBIENT': -2
[   17.114016] cs35l56 sdw:0:3:01fa:3556:01:1: Failed to write to 'CAL_AMBIENT': -2
[   28.604009] rfkill: input handler disabled
[   32.044460] rfkill: input handler enabled
[   32.801148] rfkill: input handler disabled
moritz89 commented 6 months ago

dmesg.txt alsa-info.txt

plbossart commented 6 months ago

Looks liek the card is created

card 1: sofsoundwire [sof-soundwire], device 0: Jack Out (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sofsoundwire [sof-soundwire], device 2: Speaker (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sofsoundwire [sof-soundwire], device 5: HDMI1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sofsoundwire [sof-soundwire], device 6: HDMI2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sofsoundwire [sof-soundwire], device 7: HDMI3 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sofsoundwire [sof-soundwire], device 31: Deepbuffer Jack Out (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

ARECORD

**** List of CAPTURE Hardware Devices ****
card 1: sofsoundwire [sof-soundwire], device 1: Jack In (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: sofsoundwire [sof-soundwire], device 4: Microphone (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

is this usable or not? I am not sure if the "Failed to write to 'CAL_AMBIENT'" reports are a problem, that would be for Cirrus folks to comment on.

moritz89 commented 6 months ago

It is not recognized by Pipewire. Still only dummy audio. Can I test it any other way?

moritz89 commented 6 months ago

I can see the device with pavucontrol but when enabling it, the gnome settings sound page states that there are no speakers. Tried the 3.5mm jack, but that also does not seem to be responding.

image image image image

moritz89 commented 6 months ago

I did get some audio out. Ran aplay /usr/share/sounds/alsa/* and put the output stream on the following channel. The other channels don't result in any audio.

image

mstrozek commented 6 months ago

Hi @moritz89 , can you please share output of "alsaucm dump text" and "wpctl status"? If I'm seeing correctly, Ubuntu 24.04 has wireplumber version 0.4.17, can you also try updating to https://gitlab.freedesktop.org/pipewire/wireplumber/-/releases/0.5.0 ? This version has fixed some problems with switching outputs and broken GUIs.

charleskeepax commented 6 months ago

Regarding the:

[ 17.114016] cs35l56 sdw:0:3:01fa:3556:01:1: Failed to write to 'CAL_AMBIENT': -2

This indicates that the firmware for the cs35l56 is missing it should work fine without although the performance might be slightly worse. If you want to add the firmware it was added in this commit:

https://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git/commit/?id=57077702373e7ef40f0ca197724428d614bd92f8

The current message is a little obtuse but it has been improved in the recently merged commit e2d7ad717a6b ("ASoC: cs-amp-lib: Check for no firmware controls when writing calibration").

It would also be worth checking you have the latest UCM files:

https://github.com/alsa-project/alsa-ucm-conf/commit/e87dde51d68950537f92af955ad0633437cc419a https://github.com/alsa-project/alsa-ucm-conf/commit/8e39917518b62cce44d098bd6fe5d2c1b41f92bd

These being missing might stop pipewire correctly setting things up.

moritz89 commented 6 months ago

Resuming from sleep resulted in the following dmesg output: dmesg.txt

After a reboot I ran the following commands:

(sudo) alsaucm dump text

ALSA lib parser.c:244:(error_node) UCM is not supported for this HDA model (HDA NVidia at 0x8e000000 irq 17)
ALSA lib main.c:1554:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -6
alsaucm: error failed to open sound card hw:0: No such device or address

(sudo) alsaucm listcards

ALSA lib utils.c:364:(uc_mgr_config_load_into) could not open configuration file /usr/share/alsa/ucm2/sof-soundwire/cs35l56-4.conf
ALSA lib parser.c:78:(uc_mgr_config_load_file) error: failed to open file /usr/share/alsa/ucm2/sof-soundwire/cs35l56-4.conf: -2
ALSA lib main.c:1554:(snd_use_case_mgr_open) error: failed to import hw:1 use case configuration -2
  list is empty

wpctl status

PipeWire 'pipewire-0' [1.0.3, moritz@moritz-XPS-16-9640, cookie:2905168662]
 └─ Clients:
        32. pipewire                            [1.0.3, moritz@moritz-XPS-16-9640, pid:2406]
        34. WirePlumber                         [1.0.3, moritz@moritz-XPS-16-9640, pid:2405]
        35. WirePlumber [export]                [1.0.3, moritz@moritz-XPS-16-9640, pid:2405]
       115. gnome-shell                         [1.0.3, moritz@moritz-XPS-16-9640, pid:2652]
       116. GNOME Shell Volume Control          [1.0.3, moritz@moritz-XPS-16-9640, pid:2652]
       117. GNOME Volume Control Media Keys     [1.0.3, moritz@moritz-XPS-16-9640, pid:2866]
       118. xdg-desktop-portal                  [1.0.3, moritz@moritz-XPS-16-9640, pid:3237]
       119. Mutter                              [1.0.3, moritz@moritz-XPS-16-9640, pid:2652]
       120. wpctl                               [1.0.3, moritz@moritz-XPS-16-9640, pid:4732]

Audio
 ├─ Devices:
 │      46. Meteor Lake-P HD Audio Controller   [alsa]
 │      47. HDA NVidia                          [alsa]
 │  
 ├─ Sinks:
 │  *   48. Meteor Lake-P HD Audio Controller Pro [vol: 0.56]
 │      49. Meteor Lake-P HD Audio Controller Pro 2 [vol: 1.00]
 │      50. Meteor Lake-P HD Audio Controller Pro 5 [vol: 1.00]
 │      51. Meteor Lake-P HD Audio Controller Pro 6 [vol: 1.00]
 │      52. Meteor Lake-P HD Audio Controller Pro 7 [vol: 1.00]
 │      53. Meteor Lake-P HD Audio Controller Pro 31 [vol: 1.00]
 │  
 ├─ Sink endpoints:
 │  
 ├─ Sources:
 │  *   54. Meteor Lake-P HD Audio Controller Pro 1 [vol: 1.00]
 │      55. Meteor Lake-P HD Audio Controller Pro 4 [vol: 1.00]
 │  
 ├─ Source endpoints:
 │  
 └─ Streams:

Video
 ├─ Devices:
 │  
 ├─ Sinks:
 │  
 ├─ Sink endpoints:
 │  
 ├─ Sources:
 │  
 ├─ Source endpoints:
 │  
 └─ Streams:

Settings
 └─ Default Configured Node Names:
         0. Audio/Sink    alsa_output.pci-0000_00_1f.3-platform-sof_sdw.pro-output-0
moritz89 commented 6 months ago

I've compiled and installed wireplumber 5.0 from source but it does not seem to have an effect on pavucontrol or gnome-settings.

wireplumber --version
wireplumber
Compiled with libwireplumber 0.5.0
Linked with libwireplumber 0.5.0

In the dropdown it only has ... Controller Pro 31 image

The aplay /usr/share/sounds/alsa/* command sometimes results in clear and sometimes distorted (tinny) audio.

image

moritz89 commented 6 months ago

@charleskeepax I checked my installed alsa-ucm-conf and the patch is not present in the installed version (checked the contents of /usr/share/alsa/ucm2/sof-soundwire/sof-soundwire.conf and the ucm2/codecs/cs42l43/* files were not present).

charleskeepax commented 6 months ago

Sorry I think you also need

https://github.com/alsa-project/alsa-ucm-conf/commit/c0a4df6037860b4e1dffb497e5a28258a351a0f8

Shouldn't be trying to load the amp config with the -4 on the end.

moritz89 commented 6 months ago

@charleskeepax I installed the conf files from the latest master commit from https://github.com/alsa-project/alsa-ucm-conf which contains the above files.

curl -L -o alsa-ucm-conf.tar.gz https://github.com/alsa-project/alsa-ucm-conf/archive/refs/heads/master.tar.gz
tar xvzf alsa-ucm-conf.tar.gz -C /usr/share/alsa --strip-components=1 --wildcards "*/ucm" "*/ucm2"

I now have an new option in pavucontrol, Play HiFi Quality Music, next to the Pro Audio and off options. I now have a microphone that can record audio.

record-thesofproject-linux-issues-4879_24-03-27.zip

The settings in gnome-settings seem sensible and it recognizes two speakers and a microphone.

image

However, the sound crashed while running a youtube speaker test video when jumping to a later part of the video. It seems pipewire had a problem as when gnome-settings said there was no audio and pavucontrol also said it was waiting for pulseaudio to load...

dmesg is spammed with the following error:

[  215.089659]  SDW0-Playback-SimpleJack: ASoC: error at snd_soc_link_prepare on SDW0-Playback-SimpleJack: -22
[  215.091216] soundwire sdw-master-0-0: Program transport params failed: -22
[  215.091219] soundwire sdw-master-0-0: Program params failed: -22
[  215.091220]  SDW0-Capture-SimpleJack: ASoC: error at snd_soc_link_prepare on SDW0-Capture-SimpleJack: -22
[  215.097883] soundwire sdw-master-0-0: Program transport params failed: -22
[  215.097885] soundwire sdw-master-0-0: Program params failed: -22
[  215.097886]  SDW0-Playback-SimpleJack: ASoC: error at snd_soc_link_prepare on SDW0-Playback-SimpleJack: -22
[  215.106468] soundwire sdw-master-0-0: Program transport params failed: -22
[  215.106469] soundwire sdw-master-0-0: Program params failed: -22
charleskeepax commented 6 months ago

Hmm... I am not sure that is one we have seen before. The -22 along with the no specific error message leads to me a slight suspicion that the check at the top of sdw_program_slave_port_params is failing:

       dpn_prop = sdw_get_slave_dpn_prop(s_rt->slave,
                                          s_rt->direction,
                                          t_params->port_num);
        if (!dpn_prop)
                return -EINVAL;

But why is a bit of a mystery. If you felt up to it a printk checking if this is the failure point and letting us know the port number would be handy.

The other thing that would be really handy here would be a full kernel log, ideally if you can manage to be fast enough covering the bit where the error actually starts happening. These soundwire errors can be a bit annoyingly spammy at times which tends to run the important info off the top of the kernel buffer. Meanwhile will see if we can reproduce anything here. Also any further detail on how easy the error is to trigger and what things cause it would be valuable. For example does it always happen immediately when you jump forward in a youtube video or only sometimes?

moritz89 commented 6 months ago

Compiling the kernel is a bit too involved, but I found that I could access all dmesg (kernel logs) via journalctl -k.

journalctl.txt

charleskeepax commented 6 months ago

Your attached log, whilst it does show the boot of the device nicely, it doesn't appear to show the actual error you reported. Would be good if you could generate a new log including that. And any additional information you can provide about how easy to reproduce the issue is and if there is anything other than skipping through a youtube video we need to do, that would also be very handy.

moritz89 commented 6 months ago

Just reinstalled Ubuntu and all the steps above and it seems to be working as it should. Tested the speakers with <100Hz and while they are EQed differently than on Windows, can still hear them. I guess now it's a waiting game until the kernel is packaged by Ubuntu and the other packages are as well. So the bug can be closed?

charleskeepax commented 6 months ago

Groovy, glad it is working for you. I would probably say let's leave it open for a few days see if you hit that weird issue again and then close.

alexhulbert commented 6 months ago

Hi, I tried all the steps listed above.

$ uname -r
6.9.0-rc1-linux-rc
$ pacman -Qi sof-firmware
Name            : sof-firmware
Version         : 2023.12.1-1

I have /usr/lib/firmware/intel/sof-ace-tplg/sof-mtl-cs42l43-l0-cs35l56-l23.tplg and ran

$ curl -L -o alsa-ucm-conf.tar.gz https://github.com/alsa-project/alsa-ucm-conf/archive/refs/heads/master.tar.gz
$ tar xvzf alsa-ucm-conf.tar.gz -C /usr/share/alsa --strip-components=1 --wildcards "*/ucm" "*/ucm2"

but I get the following output from sudo dmesg | grep -E 'sof-audio-pci-intel-mtl|snd_hda_intel|cs35l56|sof_sdw|sof-audio-pci-intel-mtl|input|cs42l43-codec':

https://pastebin.com/3Cipwj1v

The end of the log reads:

[   10.315894] sof_sdw sof_sdw: ASoC: invalid header size for type 541413465 at offset 0x0 size 0x25e13.
[   10.315899] sof-audio-pci-intel-mtl 0000:00:1f.3: error: tplg component load failed -22
[   10.315906] sof-audio-pci-intel-mtl 0000:00:1f.3: error: failed to load DSP topology -22
[   10.315908] sof-audio-pci-intel-mtl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -22
[   10.315921] sof_sdw sof_sdw: ASoC: failed to instantiate card -22
[   10.316557] sof_sdw sof_sdw: error -EINVAL: snd_soc_register_card failed -22
[   10.316563] sof_sdw sof_sdw: probe with driver sof_sdw failed with error -22

Any ideas what might be different on my machine?

alexhulbert commented 6 months ago

Never mind! The tplg was 4kb so I redownloaded it and it works!!

SanderTuit commented 6 months ago

Just reinstalled Ubuntu and all the steps above and it seems to be working as it should. Tested the speakers with <100Hz and while they are EQed differently than on Windows, can still hear them. I guess now it's a waiting game until the kernel is packaged by Ubuntu and the other packages are as well. So the bug can be closed?

It seems the woofers are not used on Linux on my XPS 16.

moritz89 commented 6 months ago

Is there a way to test just that channel?

vinassefranche commented 5 months ago

Hi! I have the same issue and I can't fix it with what I see here. I'm using Ubuntu 24.

$ uname -r
6.8.0-31-generic

I also have /usr/lib/firmware/intel/sof-ace-tplg/sof-mtl-cs42l43-l0-cs35l56-l23.tplg and ran (I had so sudo the tar, though)

 $ curl -L -o alsa-ucm-conf.tar.gz https://github.com/alsa-project/alsa-ucm-conf/archive/refs/heads/master.tar.gz
 $ tar xvzf alsa-ucm-conf.tar.gz -C /usr/share/alsa --strip-components=1 --wildcards "*/ucm" "*/ucm2"

but I get the following output from sudo dmesg | grep -i 'audio:

[   26.733382] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
[   26.733526] sof-audio-pci-intel-mtl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
[   26.733549] sof-audio-pci-intel-mtl 0000:00:1f.3: enabling device (0000 -> 0002)
[   26.733728] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[   27.938116] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040380
[   27.938134] sof-audio-pci-intel-mtl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
[   27.938395] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040380
[   29.011018] sof-audio-pci-intel-mtl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[   29.018706] sof-audio-pci-intel-mtl 0000:00:1f.3: use msi interrupt mode
[   30.383794] sof-audio-pci-intel-mtl 0000:00:1f.3: DMICs detected in NHLT tables: 0
[   30.383798] sof-audio-pci-intel-mtl 0000:00:1f.3: hda codecs found, mask 4
[   30.388283] sof-audio-pci-intel-mtl 0000:00:1f.3: SOF firmware and/or topology file not found.
[   30.388286] sof-audio-pci-intel-mtl 0000:00:1f.3: Supported default profiles
[   30.388287] sof-audio-pci-intel-mtl 0000:00:1f.3: - ipc type 1 (Requested):
[   30.388288] sof-audio-pci-intel-mtl 0000:00:1f.3:  Firmware file: intel/sof-ipc4/mtl/sof-mtl.ri
[   30.388289] sof-audio-pci-intel-mtl 0000:00:1f.3:  Topology file: intel/sof-ace-tplg/sof-mtl-rt711.tplg
[   30.388291] sof-audio-pci-intel-mtl 0000:00:1f.3: Check if you have 'sof-firmware' package installed.
[   30.388291] sof-audio-pci-intel-mtl 0000:00:1f.3: Optionally it can be manually downloaded from:
[   30.388292] sof-audio-pci-intel-mtl 0000:00:1f.3:    https://github.com/thesofproject/sof-bin/
[   30.389977] sof-audio-pci-intel-mtl 0000:00:1f.3: error: sof_probe_work failed err: -2

Any ideas what might be different on my machine?

charleskeepax commented 5 months ago

6.8.0-31-generic

You will need a newer kernel: https://github.com/thesofproject/linux/issues/4879#issuecomment-2020728316

vinassefranche commented 5 months ago

@charleskeepax thanks for your answer! I have updated the kernel:

$ uname -r
6.8.7-060807-generic

but I still have the same output of sudo dmesg | grep -i 'audio', and the soundcard is not recognized. Any idea what's wrong?

charleskeepax commented 5 months ago

You would need one of the 6.9 RC kernels to get the required patches. If you are comfortable building a kernel that is the way to go, if not you will need to wait until Ubuntu either backports the support or updates to the 6.9 series once it is released.

vinassefranche commented 5 months ago

Thanks again! I think I'll try installing the RC5 of 6.9 (I see it here).

vinassefranche commented 5 months ago

It worked! Let's see if I face issues with the RC kernel but I'm really happy to be able to plug my headphone!

Thanks a lot!

vinassefranche commented 5 months ago

Just in case you had an idea why: it seems like the microphone of my computer is recognized but not the microphone of my plugged headphone.

charleskeepax commented 5 months ago

Hmm... would be good to narrow down if it is an issue detecting your headset or headsets in general.

vinassefranche commented 5 months ago

I don't know what happened but it seems to be fixed. I first ran your 2 commands and then plugged another headphone which worked. Then I switched back to the first headphone and it worked. I'll see if everything is still working when I reboot my computer but for now, it looks fine. Thanks again!

charleskeepax commented 5 months ago

Groovy glad it is working, would still appreciate if you could let us know the make and model of the headset just in case we see issues in the future.

vinassefranche commented 5 months ago

Groovy glad it is working, would still appreciate if you could let us know the make and model of the headset just in case we see issues in the future.

It's this one: https://www.thomann.de/fr/beyerdynamic_mmx_300_2._generation.htm

charleskeepax commented 5 months ago

Thank you kindly. Let us know if you see anymore issues with it and if we hear anything from anyone else we will investigate further.

vinassefranche commented 5 months ago

I just restarted my computer and the mic worked fine without having to do anything so I guess I'm good now! Thanks again for the support! I could not have done without this github issue!

alexhulbert commented 5 months ago

I'm only getting audio out of one ear when I plug in headphones. Tried multiple pairs so its definitely not a hardware problem. Other than that, everything is working perfectly, though! Any ideas on how to fix the issue or debug? I'm running 6.9-rc1.

charleskeepax commented 5 months ago

Hmm... that is weird could you attach the contents of the alsa controls for the card whilst you are playing audio to the headphone?

vinassefranche commented 5 months ago

Hi @charleskeepax I randomly have the issue that the microphone of the headphones is not recognized when I restart my computer. Plugging and unplugging the headphones does not fix the issue. I fix the issues by plugging another pair of headphones, removing it and plugging again the problematic headphones. From the few tests I've done, it's not always the case. Anything I can do or check when this issue occurs to troubleshoot it?

charleskeepax commented 5 months ago
vinassefranche commented 5 months ago

Will do next time I have the issue. What's the best way to "capture a kernel log after the failing detect"? I'm not used to do these low level stuff, sorry...