Bug 217906

Summary: Dell XPS 15 9530: subwoofer not working, and ACPI _DSD Properties are missing for HID CSC3551
Product: Drivers Reporter: mus (mus)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: normal CC: alex.vinarskis, angioli.inspect, josbeir, m, majid, michbar, vladstulikov
Priority: P3    
Hardware: Intel   
OS: Linux   
Kernel Version: Subsystem:
Regression: No Bisected commit-id:
Attachments: alsa-info.txt

Description mus@musalbas.com 2023-09-13 11:36:09 UTC
On the Dell XPS 15 9530, the sound quality sounds bad compared to Windows, because the subwoofers aren't working. On previous models (the 9510 and 9520), this was resolved by applying the dual speaker fixup (https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=v5.15.6&id=da94692001ea45ffa1f5e9f17ecdef7aecd90c27).

However, applying this patch on the 9530 reportedly doesn't work. This seems to be because the 9530 has different audio hardware. The following logs appear in dmesg:

[   16.766716] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[   16.766721] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[   16.766724] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[   16.767722] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[   16.767726] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[   16.767728] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22
Comment 1 angioli.inspect 2023-10-09 15:23:02 UTC
I have the same problem; This is my hardware information (sudo alsa-info.sh --stdout > alsa-info.txt. I hope they can be useful
Comment 2 angioli.inspect 2023-10-09 15:24:31 UTC
Created attachment 305203 [details]
Comment 3 Marc Soda 2023-10-13 00:52:10 UTC
I also have the same issue with the XPS15 9530. The sound is awful and the subwoofers are not used.

One thing that I find interesting is that the XPS15 9530 does NOT use the Realtek ALC289, it uses the ALC3281. However, the ALC289 is references several times in my system, in the kernel, and in the alsa-info.txt posed by @angioli.inspect@gmail.com. I hope that information is useful.
Comment 4 Jasper 2023-10-14 10:05:12 UTC
Also experiencing this issue after receiving my laptop a few weeks ago. I patched the kernel with the ALC289_FIXUP_DUAL_SPK with the correct bit for these laptops

SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530", ALC289_FIXUP_DUAL_SPK) which made me see a LFE channel in alsamixer but it didn't really do anything so i reverted it again.

I also tried adding a /etc/modprobe.d/disable-sof-dsp.conf with options snd-intel-dspcfg dsp_driver=1 but except from not realy fixing it, it disabled the laptop's built in microphone. Which i need.

With what i could find after some intensive searches is that the CS35141 errors are related to missing ACPI code so that the snd_hda_scodec_cs35l41 amplifier driver can recognize that device. 

See this github page https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff for users with a an Asus Zenbook UX3402 that in all likelyhood seems to be the same problem.

I am glad to help out but i'm not sure where to start.
Comment 5 Vlad Stulikov 2023-10-17 00:46:50 UTC
Same problem discussion https://github.com/thesofproject/linux/issues/4624
Comment 6 Aleksandrs Vinarskis 2023-12-12 09:51:18 UTC
There was a lot of development done at link posted by @vladstulikov@gmail.com, and also on discord https://discord.com/channels/1164868856012079126

> One thing that I find interesting is that the XPS15 9530 does NOT use the
> Realtek ALC289, it uses the ALC3281.

It was found that this is the same chip, with ALC3281 likely being Dell-specific model (number).

With a lot of community effort, we have managed to narrowed down, and resolve this issue. It is currently in the process of going upstream, thus I am updating this thread. For full resolution, multiple patches are required:

1. Quirk to `patch-realtek.c` to enable _both_ `ALC289_FIXUP_DUAL_SPK` and `ALC245_FIXUP_CS35L41_SPI_2` (add audio output to woofers and initialize two instances of SPI connected CS35L41 amps) -> [Merged](https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?id=cd14dedf15be432066e63783c63d650f2800cd48)

2. Cirrus amp is missing _DSD properties. SPI bus on which amps are is also missing cs-gpios. All of these can be added by patch to `cs35l41_hda_property.c` -> Patch ready (see github or discord threads), waiting to be upstreamed, held by SPI bug, see below

3. Cirrus amp requires firmware and tuning upload to work correctly. Without it, it would revert to default ones, which will play, but it will not be nice. These files were extracted from Windows Realtek driver -> PR [opened](https://github.com/CirrusLogic/linux-firmware/pull/22) to Cirrus's linux-firmare fork. Unfortunately it is up to them when/if ever this will be accepted.

4. Applying above steps will make speakers work, however it would take ~3 minutes to load the firmware, which results in black screen/hanging on wake up. Seems there is a bug in Dell's firmware, which incorrectly enables `intel-lpss` clock divider, which divides 100mhz clock by 32767 = 3051Hz. Even though Cirrus amp requests 4Mhz, it is capped at controller's speed. Potential resolutions are either Dell fixing their firmware - support request [opened](https://www.dell.com/community/en/conversations/linux-general/xps-9530-firmware-bug-prevents-releasing-audio-fix-for-linux-devices/65774e14dac47011b36c587c), or otherwise, patch to `intel-lpss.c` driver. At present, both options are explored.

Patch No.3 can be submitted upstream either after `intel-lpss.c` patch is merged, or it shall be modified to verify SPI speed to prevent initializing device if it is too low. This way it can be done asynchronously from SPI speed fix, however, not sure it will be accepted upstream.