thesofproject / linux

Linux kernel source tree
Other
91 stars 131 forks source link

[BUG] Very weak sound on XPS 15 model 9530 (2023) #4624

Closed berbmit closed 6 months ago

berbmit commented 1 year ago

Describe the bug XPS 15 laptop, model 9530 (2023) with latest Linux Mint installed and all updates applied, the sound is soft and tinny. It seems the woofers are not being detected and with only the 2 top tweeters firing. Have tried suggestions I can find on the web, tried kernels up to 6.5, made sure all updates from repositories are applied.

Reproduction Rate 100% Have googled extensively, and seems this problem is prevalent on the XPS 15 9530.

Expected behavior The sound works well under Windows (from testing before deleting windows and installing Linux)

Impact This is a huge frustration for music and games and Zoom calls for work.

Environment I do not know how to get all the template's information

From dmesg: [ 4.817359] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100 [ 4.817376] sof-audio-pci-intel-tgl 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver [ 4.817382] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002) [ 4.817579] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100 [ 4.817633] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915]) [ 4.825894] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode [ 4.852090] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 5 [ 4.852093] sof-audio-pci-intel-tgl 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now [ 4.852095] sof-audio-pci-intel-tgl 0000:00:1f.3: DMICs detected in NHLT tables: 2 [ 4.854782] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864 [ 4.854784] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0 [ 4.854786] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30 [ 4.949656] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864 [ 4.949663] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0 [ 4.957446] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:20:0 Kernel ABI 3:23:0 [ 5.706027] input: sof-hda-dsp Headphone Mic as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input17 [ 5.706071] input: sof-hda-dsp HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input18 [ 5.706100] input: sof-hda-dsp HDMI/DP,pcm=4 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input19 [ 5.706130] input: sof-hda-dsp HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input20

Output from alsa-info attached alsa-info.txt

VladStulikov commented 1 year ago

Seems like it is switching to SOF driver: snd_hda_intel 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver

And does not apply the patch because of that

VladStulikov commented 1 year ago

Okay let us try to reconfigure the codec in runtime..

# echo 0x17 0x90170130 > /sys/class/sound/hwC0D0/user_pin_configs
# echo 1 > /sys/class/sound/hwC0D0/reconfig
marcSoda commented 1 year ago

Okay let us try to reconfigure the codec in runtime..

# echo 0x17 0x90170130 > /sys/class/sound/hwC0D0/user_pin_configs
# echo 1 > /sys/class/sound/hwC0D0/reconfig

echo 1 > /sys/class/sound/hwC0D0/reconfig gives me bash: echo: write error: Device or resource busy

how do I free up the device? I tried restarting, I killed pulseaudio, I have nothing running (knowingly) that would be using the sound card.

josbeir commented 1 year ago

@VladStulikov i did try this today using the bits from the file from windows.

patch= only gets loaded when you disable the dsp_driver (sof)

options snd-intel-dspcfg dsp_driver=1
options snd-hda-intel patch=alc-sound-patch.fw

When i did this, the custom pin settings got loaded and i saw 2 new profiles in the gnome audio settings, the subwoofer device was aslo visible in alsamixer but it didn't work:

I'm guessing if we enable the cirrus CSC3551 amp somehow we will have made more progress!

VladStulikov commented 1 year ago

Okay let us try to reconfigure the codec in runtime..

# echo 0x17 0x90170130 > /sys/class/sound/hwC0D0/user_pin_configs
# echo 1 > /sys/class/sound/hwC0D0/reconfig

echo 1 > /sys/class/sound/hwC0D0/reconfig gives me bash: echo: write error: Device or resource busy

how do I free up the device? I tried restarting, I killed pulseaudio, I have nothing running (knowingly) that would be using the sound card.

sudo fuser -v /dev/snd/* and kill/disable them all :-)

VladStulikov commented 1 year ago

@marcSoda see the comment @josbeir:

options snd-intel-dspcfg dsp_driver=1

VladStulikov commented 1 year ago

@VladStulikov i did try this today using the bits from the file from windows.

patch= only gets loaded when you disable the dsp_driver (sof)

options snd-intel-dspcfg dsp_driver=1
options snd-hda-intel patch=alc-sound-patch.fw

When i did this, the custom pin settings got loaded and i saw 2 new profiles in the gnome audio settings, the subwoofer device was aslo visible in alsamixer but it didn't work:

* 2.1 audio (new) (did not produce any sound, but i did got sound when testing the LFE channel, but i don't think it came from the subwoofer) - this is new... only 4.0 showed when applying the kernel patch for the 9510...

* 4.0 audio (new) - only  audio from rear channels

* 2.0 analog stero (worked like before)

I'm guessing if we enable the cirrus CSC3551 amp somehow we will have made more progress!

Hey, thank you so much for the info!

Did you start hearing any low-frequencies sound from subs with overamplifying enabled and max volume?

josbeir commented 1 year ago

Well,

@VladStulikov i did try this today using the bits from the file from windows. patch= only gets loaded when you disable the dsp_driver (sof)

options snd-intel-dspcfg dsp_driver=1
options snd-hda-intel patch=alc-sound-patch.fw

When i did this, the custom pin settings got loaded and i saw 2 new profiles in the gnome audio settings, the subwoofer device was aslo visible in alsamixer but it didn't work:

* 2.1 audio (new) (did not produce any sound, but i did got sound when testing the LFE channel, but i don't think it came from the subwoofer) - this is new... only 4.0 showed when applying the kernel patch for the 9510...

* 4.0 audio (new) - only  audio from rear channels

* 2.0 analog stero (worked like before)

I'm guessing if we enable the cirrus CSC3551 amp somehow we will have made more progress!

Hey, thank you so much for the info!

Did you start hearing any low-frequencies sound from subs with overamplifying enabled and max volume?

Note sure how to do over-amplification. I tried settings the 2.1 profile and played a bass test in youtube but didn't hear anything... Only the "Analog Stereo Output" profile works.

image image

VladStulikov commented 1 year ago

Huh... from the kernel code:

    [ALC289_FIXUP_DELL_SPK2] = {
        .type = HDA_FIXUP_PINS,
        .v.pins = (const struct hda_pintbl[]) {
            { 0x17, 0x90170130 }, /* bass spk */
            { }
        },
        .chained = true,
        .chain_id = ALC269_FIXUP_DELL4_MIC_NO_PRESENCE
    },
    [ALC289_FIXUP_DUAL_SPK] = {
        .type = HDA_FIXUP_FUNC,
        .v.func = alc285_fixup_speaker2_to_dac1,
        .chained = true,
        .chain_id = ALC289_FIXUP_DELL_SPK2
    },

And alc285_fixup_speaker2_to_dac1 is

/* force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker */
static void alc285_fixup_speaker2_to_dac1(struct hda_codec *codec,
                      const struct hda_fixup *fix, int action)
{
    if (action == HDA_FIXUP_ACT_PRE_PROBE) {
        static const hda_nid_t conn[] = { 0x02 };
        snd_hda_override_conn_list(codec, 0x17, ARRAY_SIZE(conn), conn);
    }
}

So it seems connecting pin 0x17 is not enough but also it is needed to force NID 0x17 (Bass Speaker) to DAC1 to share it with the main speaker

I have no idea if it is possible to do via driver config, maybe there is a verb... I do not know.

I start to think that the easiest way to add

SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530", ALC289_FIXUP_DUAL_SPK)

to the realtek patch file and recompile the kernel,

Then maybe we will need to adjust amplifier coeffs..

VladStulikov commented 1 year ago

@josbeir image

image

image

josbeir commented 1 year ago

@josbeir image

image

image

Think that's an Ubuntu option, don't have that on my distro (A_the one that shall not be named_RCH), i'll check tomorrow if i can enable it.

plbossart commented 1 year ago

Belated answer but just to confirm, the SOF driver does not have support for patch and jack retasking. Only snd-hda-intel can do this, and the option to force snd-hda-intel is indeed.

options snd-intel-dspcfg dsp_driver=1

When the correct configuration is found by experimentation/trial-and-error, the expectation is that there's a kernel quirk created for that device in the sound/pci/hda/patch_realtek.c file, and the SOF driver will automagically pick it up since it uses the same codec configuration.

VladStulikov commented 1 year ago

@marcSoda if it is not too much to ask, can you do the following on your 9510 (where bass speakers are working):

sudo su
echo 1 > /sys/module/snd_hda_codec/parameters/dump_coef
alsa-info --no-upload

and post it here please?

Thank you in advance

marcSoda commented 1 year ago

@marcSoda if it is not too much to ask, can you do the following on your 9510 (where bass speakers are working):

sudo su
echo 1 > /sys/module/snd_hda_codec/parameters/dump_coef
alsa-info --no-upload

and post it here please?

Thank you in advance

yessir here it is. alsa-info-9510-dump_coef.txt

VladStulikov commented 1 year ago

Last try before giving up :-)

Can you try to load this patch on your 9530:

marc-9530-patch.fw.txt

This patch configures your codec exactly as it is on the Windows XPS 9530

And do not forget to disable SOF driver with options snd-intel-dspcfg dsp_driver=1

marcSoda commented 1 year ago

Last try before giving up :-)

Can you try to load this patch on your 9530:

marc-9530-patch.fw.txt

This patch configures your codec exactly as it is on the Windows XPS 9530

And do not forget to disable SOF driver with options snd-intel-dspcfg dsp_driver=1

I added that contents of that file to /usr/lib/firmware/hda-jack-retask.fw

contents of /etc/modprobe.d/hda-jack-retask.conf

options snd-intel-dspcfg dsp_driver=1
options snd-hda-intel patch=hda-jack-retask.fw

I rebooted and nothing seems to have changed in terms of sound quality. Is there any log output or additional information that you would like?

VladStulikov commented 1 year ago

Can you see similar lines now in the sudo dmesg | grep snd?

[ 3.953765] snd_hda_intel 0000:00:1f.3: Applying patch firmware 'hda-jack-retask.fw' [ 3.953869] snd_hda_intel 0000:00:1f.3: firmware: direct-loading firmware hda-jack-retask.fw

VladStulikov commented 1 year ago

I added that contents of that file to /usr/lib/firmware/hda-jack-retask.fw

I would say "replace", not "add"

VladStulikov commented 1 year ago

To recap:

1) XPS 9510 with the kernel patch applied -> no bass. Same PIN config/processing caps as a XPS 9510 with working bass -> no bass. Tried same PIN config/processing caps as Windows XPS 9530 -> no bass. Tried same PIN config/processing caps as Linux XPS 9530 -> no bass 2) XPS 9530 with the kernel patch applied -> no bass. Same PIN config/processing caps as a XPS 9510 with working bass -> no bass. Tried same PIN config/processing caps as Windows XPS 9530 -> no bass.

I am inclined to consider it to be not a problem of pin config or missing verbs, it is something else. Otherwise I cannot explain how an XPS 9510 with config identical to another XPS 9510 with working bass can have no bass. And how an XPS 9530 with a config identical to a Windows XPS 9530 have no bass.

So I am giving up

marcSoda commented 1 year ago

sudo dmesg | grep snd

EDIT: sudo dmesg | grep snd

sudo dmesg | grep snd
[    4.063388] snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002)
[    4.063628] snd_hda_intel 0000:00:1f.3: Applying patch firmware 'hda-jack-retask.fw'
[    4.063841] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    4.229121] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC289: line_outs=2 (0x17/0x14/0x0/0x0/0x0) type:speaker
[    4.229125] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    4.229127] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[    4.229128] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
[    4.229129] snd_hda_codec_realtek hdaudioC0D0:    inputs:
[    4.229130] snd_hda_codec_realtek hdaudioC0D0:      Headset Mic=0x19
[    4.229131] snd_hda_codec_realtek hdaudioC0D0:      Headphone Mic=0x1b
[    4.229132] snd_hda_codec_realtek hdaudioC0D0:    dig-in=0x18

I believe the patch was successful per this line [ 4.229121] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC289: line_outs=2 (0x17/0x14/0x0/0x0/0x0) type:speaker

Not sure what to do from here. I feel like the issue is at a lower level.

josbeir commented 1 year ago

@VladStulikov over-amplification to test didn't do anything.

I even wrote a small kernel patch especially for the xps with the sniffed pin addresses + the subwoofer DAC fix (as it is on the 9510) but with no real change. xps_15_9530_audio.patch.txt

But as @marcSoda said, the issue is lower level. The Cirrcus cs35l41 amp device is not activated as you can see here.

A bit of good news tho: the cs35l41 driver has a patch that was merged (will be available in kernel 6.6) to make it more easy to support devices where no _DSD properties are available. This is the case for the XPS 9530 as there is nothing present for it in the DSDT file.

We will probably need to write a proper fix for it in the cs35l41_hda_property.c to activate the device and see from there.

If someone can point me in the right direction on how to find/sniff the correct bits for this device i could probably figure it out but i'm not experienced in these things so not sure where to begin.

alexVinarskis commented 1 year ago

@VladStulikov i did try this today using the bits from the file from windows.

patch= only gets loaded when you disable the dsp_driver (sof)

options snd-intel-dspcfg dsp_driver=1 options snd-hda-intel patch=alc-sound-patch.fw

When i did this, the custom pin settings got loaded and i saw 2 new profiles in the gnome audio settings, the subwoofer device was aslo visible in alsamixer but it didn't work:

2.1 audio (new) (did not produce any sound, but i did got sound when testing the LFE channel, but i don't think it came from the subwoofer) - this is new... only 4.0 showed when applying the kernel patch for the 9510...
4.0 audio (new) - only audio from rear channels
2.0 analog stero (worked like before)

I'm guessing if we enable the cirrus CSC3551 amp somehow we will have made more progress!

Same outcome here - got the Analog audio, got bass speaker recognized, but no woofer sound. 2.1 also not working, besides LFE from tweeters. Tested on my 9530 with provided marc-9530-patch.fw. Whats a bit interesting is that with this config, volume slider corresponds to "bass speaker", and "speaker" is fixed. When I tired running 0x17 quirk only, "speaker" would be with volume slider, and "bass speaker" would just appear there.

image

FYI if you patch kernel qith 0x17 quirk directly, "bass speaker" will show up even if dsp_driver is not disabled, but still will not work. That would mean it only prevents loading of .fw, and not actual modification. Perhaps worth trying patching kernel with this change directly, to test with dsp_driver?

alexVinarskis commented 1 year ago

I'm having the same issue on the 9530, however, in response to the above comment by @VladStulikov, the issue does not exist on the 9510. I have had it since it came out and the audo works just fine.

EDIT: One interesting thing that I noticed is that the XPS15 9530 has the Realtek ALC3281 chip, but my system references the ALC289 (which was present on the 9510 and on the 9520 (I think). I posted my alsa-info.sh dump for both my 9510 and 9530 (running the same kernel) in a message a few below this one.

@marcSoda what BIOS version do you have?

Really interesting, can you post/send me you alsa-info.sh output please?

I have XPS 9510 from when it came out and no version of Ubuntu/Debian/kernel fixed the issue.

And just to make sure: the issue is not a complete absence of sound but a cutoff of low frequencies as the bass speakers are not activated at all. You can check it playing 20-20000Hz video from Youtube, I bet you hear no sound lower 150Hz on your laptop.

@VladStulikov what BIOS versions do you have? Can check via sudo dmidecode -s bios-version. Afaik, BIOS's ACPI sets initial configs/verbs to chips, which can then be overwritten by individual drivers. Could be hypothetically the case that some BIOS (earlier?) bios versions still had Cirrcus amp correctly configured?

I also had passive access to 9510, and similarly no Ubuntu/Kernel fixed any issue, it never really worked. That machine was purchased in late Nov/Dec, so over half a year after it came out, thus i would assume it wasn't running the earlier BIOS build. (Assuming those are actually related to this problem). UPD: Currently it runs BIOS 1.22

EDIT: Currently trying out Asus link with firmware loading, seems promising

VladStulikov commented 1 year ago

@VladStulikov over-amplification to test didn't do anything.

I even wrote a small kernel patch especially for the xps with the sniffed pin addresses + the subwoofer DAC fix (as it is on the 9510) but with no real change. xps_15_9530_audio.patch.txt

Yes, the patch looks correct. Then we can exclude 1) pin config 2) DAC config 3) verbs from the list of possible reasons

But as @marcSoda said, the issue is lower level. The Cirrcus cs35l41 amp device is not activated as you can see here.

I see nothing similar on my XPS with not working bass, so I think it is a red herring

VladStulikov commented 1 year ago

@alexVinarskis

FYI if you patch kernel qith 0x17 quirk directly, "bass speaker" will show up even if dsp_driver is not disabled, but still will not work. That would mean it only prevents loading of .fw, and not actual modification. Perhaps worth trying patching kernel with this change directly, to test with dsp_driver?

Here the logic is the following:

1) Kernel patch sets pin configuration (connects pin 0x17) 2) The firmware patch passed to the snd-hda-intel-driver overrides the pin configuration

You can look at /sys/class/sound/hwC0D0

Here init_pin_configs is what came from BIOS driver_pin_configs is what driver code loaded (the kernel patch pin config) user_pin_config is what the patch=....fw kernel module options loaded. (the custom config of pins/verbs) It overrides driver_pin_configs

More info here https://docs.kernel.org/sound/hd-audio/notes.html

VladStulikov commented 1 year ago

@alexVinarskis

@VladStulikov what BIOS versions do you have?

1.24.0

I also had passive access to 9510, and similarly no Ubuntu/Kernel fixed any issue, it never really worked. That machine was purchased in late Nov/Dec, so over half a year after it came out, thus i would assume it wasn't running the earlier BIOS build. (Assuming those are actually related to this problem). UPD: Currently it runs BIOS 1.22

Hmm... Marco's XPS BIOS is 1.9.0, it is probably the first version. And bass is working there. Can we ask him to upgrade his BIOS? lol

VladStulikov commented 1 year ago

On the other hand both the driver and the user patch are able to override the BIOS pin config and verbs. So even if BIOS sets them incorrectly (and it does indeed judging by initial_pin_configs) the manual pin config should have helped

alexVinarskis commented 1 year ago

Hmm... Marco's XPS BIOS is 1.9.0, it is probably the first version. And bass is working there. Can we ask him to upgrade his BIOS? lol

and lose speakers?))

1.9.0 is indeed much older hehe, although by far not the earliest one. (dell has 1.2.0)

technically (not suggesting), there is a settings to allow BIOS downgrade in the BIOS. Although, i'm not sure how smart that action would be :D

I see nothing similar on my XPS with not working bass, so I think it is a red herring

@VladStulikov hmmm thats interesting. Maybe different amp? Do you have anything at all from sudo dmesg | grep cs35? On my 9530 i have same errors:

[    4.916931] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    4.916937] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[    4.916940] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[    4.918035] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    4.918037] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[    4.918038] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22
VladStulikov commented 1 year ago

@alexVinarskis

vlad@vlad-xps-15-9510:~$ sudo dmesg | grep cs35 vlad@vlad-xps-15-9510:~$

vlad@vlad-xps-15-9510:~$ sudo dmesg | grep failed [ 0.495890] pci 0000:01:00.0: BAR 6: failed to assign [mem size 0x00080000 pref] [ 1.214955] pci 10000:e0:01.2: BAR 13: failed to assign [io size 0x1000] [ 3.678964] nvidia: module verification failed: signature and/or required key missing - tainting kernel [ 3.999156] thermal thermal_zone11: failed to read out thermal zone (-61)

No errors related to sound, last one is just the temperature sensor and the nvidia message is just a warning about having nvidia proprietary driver installed

VladStulikov commented 1 year ago

@marcSoda sorry for asking again, but are you 100% sure your 9510 bass spks are working? I was confused yesterday by the sound presenting when playing 20-150Hz test sound and overamplification on. I thought bass speakers were activated.

But then I checked frequencies using my mobile phone and the sound was 250-300Hz actually and the bass appeared at 100Hz only. So bass speakers still did not work.

Can you install on your phone an app measuring spectrum, play 20-150Hz sound and check in the app that you actually getting low frequencies (< 100Hz, this is cutoff frequency for subwoofers), that readings in the mobile app match the displayed frequencies in the Youtube test video in real time?

I have a strong suspicion your 9510 has no bass speakers working and the sound you can hear is actually from tweeters?

VladStulikov commented 1 year ago

Haha, googled for "realtek hda bass", a ton of issues on Windows with Realtek codecs and bass speakers, including Dell laptops like https://answers.microsoft.com/en-us/windows/forum/all/bass-boost-lost-from-realtek-audio-from-windows/d8372c53-6c61-4ddc-a3c2-ff3c52f93975

https://www.windowsphoneinfo.com/threads/realtek-audio-is-flat-and-has-no-bass.356540/ https://superuser.com/questions/958121/realtek-hd-audio-low-and-bad-quality-sound-after-windows-10-upgrade https://answers.microsoft.com/en-us/windows/forum/all/realtek-hd-audio-volume-limited-no-bass-seems-to/e571771a-b812-4b2c-abac-cf55e2b3224e - exactly our issue but on Windows

It seems that only Realtek guys know how to enable the bass speakers properly and even they sometimes fail to make it lol

josbeir commented 1 year ago

@VladStulikov

I see nothing similar on my XPS with not working bass, so I think it is a red herring

To be sure, we are talking about the same device right? The XPS 15 9530. The cirrus chip is present on all of them. Latest bios on these devices is 1.7.0.

marcSoda commented 1 year ago

sudo dmidecode -s bios-version

Bios is 1.7.0 (latest) on 9530. Bois is 1.9.0 on 9510. I do not believe that I have ever updated the bios on 9510 since I have gotten it almost two years ago.

marcSoda commented 1 year ago

@VladStulikov i did try this today using the bits from the file from windows. patch= only gets loaded when you disable the dsp_driver (sof) options snd-intel-dspcfg dsp_driver=1 options snd-hda-intel patch=alc-sound-patch.fw When i did this, the custom pin settings got loaded and i saw 2 new profiles in the gnome audio settings, the subwoofer device was aslo visible in alsamixer but it didn't work:

2.1 audio (new) (did not produce any sound, but i did got sound when testing the LFE channel, but i don't think it came from the subwoofer) - this is new... only 4.0 showed when applying the kernel patch for the 9510...
4.0 audio (new) - only audio from rear channels
2.0 analog stero (worked like before)

I'm guessing if we enable the cirrus CSC3551 amp somehow we will have made more progress!

Same outcome here - got the Analog audio, got bass speaker recognized, but no woofer sound. 2.1 also not working, besides LFE from tweeters. Tested on my 9530 with provided marc-9530-patch.fw. Whats a bit interesting is that with this config, volume slider corresponds to "bass speaker", and "speaker" is fixed. When I tired running 0x17 quirk only, "speaker" would be with volume slider, and "bass speaker" would just appear there.

image

FYI if you patch kernel qith 0x17 quirk directly, "bass speaker" will show up even if dsp_driver is not disabled, but still will not work. That would mean it only prevents loading of .fw, and not actual modification. Perhaps worth trying patching kernel with this change directly, to test with dsp_driver?

These are my exact observations after applying the patch on the 9530.

marcSoda commented 1 year ago

Hmm... Marco's XPS BIOS is 1.9.0, it is probably the first version. And bass is working there. Can we ask him to upgrade his BIOS? lol

and lose speakers?))

1.9.0 is indeed much older hehe, although by far not the earliest one. (dell has 1.2.0)

technically (not suggesting), there is a settings to allow BIOS downgrade in the BIOS. Although, i'm not sure how smart that action would be :D

I see nothing similar on my XPS with not working bass, so I think it is a red herring

@VladStulikov hmmm thats interesting. Maybe different amp? Do you have anything at all from sudo dmesg | grep cs35? On my 9530 i have same errors:

[    4.916931] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    4.916937] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[    4.916940] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[    4.918035] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    4.918037] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[    4.918038] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22

I have the same errors on 9530:

sudo dmesg | grep cs35
[    4.229067] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    4.229069] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[    4.229071] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[    4.230171] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    4.230173] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[    4.230174] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22
marcSoda commented 1 year ago

@marcSoda sorry for asking again, but are you 100% sure your 9510 bass spks are working? I was confused yesterday by the sound presenting when playing 20-150Hz test sound and overamplification on. I thought bass speakers were activated.

But then I checked frequencies using my mobile phone and the sound was 250-300Hz actually and the bass appeared at 100Hz only. So bass speakers still did not work.

Can you install on your phone an app measuring spectrum, play 20-150Hz sound and check in the app that you actually getting low frequencies (< 100Hz, this is cutoff frequency for subwoofers), that readings in the mobile app match the displayed frequencies in the Youtube test video in real time?

I have a strong suspicion your 9510 has no bass speakers working and the sound you can hear is actually from tweeters?

Okay so my (very strange) observations when doing this:

The frequency analyzer that I am using is called CleanTune from IOS app store. I used play -n synth <duration> sine <frequency to produce the sounds. I beleive it is from the sox package.

First, for a sanity check, I plugged in an external speaker that I know has decent bass and tested it. At high and low frequencies, it read them as the correct frequency (with a small margin of error, but that's to be expected).

Second, I tested the XPS15 9530. The sound produced in the 10-150hz range is hardly audible regardless of volume level and my phone mic cannot pick them up. The sounds are audible, but very faint. Above that range, the mic picks them up and reads them fine, but they are still faint (more on this later).

Third, tested on 9510. The sound produced in the 10-150hz range is very audible and sounds how I would excpect. However, the speaker somtimes has trouble picking them up below 50ish hz (above that is picked up fine) despite the fac that they are loud enough. It tends to read them as higher frequencies than they actually are. However, I can confirm that they are not. The bass sounds reasonably good to me on the 9510. I do not think there are any issues here. I would not consider the sound to be "faint" at any frequency. This is different from my observation on the 9530 (more on this later).

A side by side comparision of the 9510 and 9530 makes it very clear that the bass works fine on the 9510 and hardly at all on the 9530. I say "hardly at all" and not "not at all" because I do hear some sound on the 9530 below at 10-150hz. Even just playing music you can tell that the 9510 is significantly better.

Interestingly, however, I find it strange that the 9530 produces sound at all at lower DB levels. They are hardly audible, but I can hear them and distinguish that there is variability among the frequencies. Furthermore, at 100% volume on 9530, the sound level at ANY frequency (even those above 150hz) is (very, very, very) significantly more faint than on the 9510 (also full volume). I have no idea why this would be. Could there be another issue at play here? It seems that even if I set the 9530 volume to 150% or higher, the sound level produced by play -n synth <duration> sine <frequency does NOT increase at all. In contrast, on 9510, if I set volume to 150%, it's super loud.

VladStulikov commented 1 year ago

However, the speaker somtimes has trouble picking them up below 50ish hz (above that is picked up fine) despite the fac that they are loud enough. It tends to read them as higher frequencies than they actually are.

That is exactly what I am getting on my 9510. It does not "tends to read them" but they are actually of that frequency. So bass speakers do not work on your 9510 as well. Just the patch imitates the real bass frequencies less that 100Hz with much higher frequencies. You hear them and overall it sounds better for sure and louder than on you 9530, that is why you think bass is working on 9510 but actually it is NOT, as I suspected.

Even just playing music you can tell that the 9510 is significantly better.

It is just a psychological effect, I bought it as well the day before yesterday lol, You still have NO frequencies <100Hz and the iOS app is absolutely correct.

A side by side comparision of the 9510 and 9530 makes it very clear that the bass works fine on the 9510 and hardly at all on the 9530.

It is not bass, those are your tweeters trying to imitate the low frequncies because the kernel patch for 9510/9520 connects bass output to the tweeters. So the patch have never actually worked. People just were misled by improvement in the loudness and sound thinking bass speakers now work.

alexVinarskis commented 1 year ago

It is not bass, those are your tweeters trying to reproduce the bass because the patch connects bass output to the tweeters. So the patch have never actually worked. People just were misled by improvement in the loudness and sound thinking bass speakers now work.

If you are unsure, just boot to windows. Day & night difference. Could compare 'working' 9510 on linux to 9530 on windows

VladStulikov commented 1 year ago

if you are unsure, just boot to windows. Day & night difference. Could compare 'working' 9510 on linux to 9530 on windows

Windows was deleted the same day I bought the laptop lol

But I believe to the spectrum analyser app and my ears. No low frequencies on 9510 and the patch has never actually activated subwoofers either it is 9510 or 9520 or 9530.

marcSoda commented 1 year ago

However, the speaker somtimes has trouble picking them up below 50ish hz (above that is picked up fine) despite the fac that they are loud enough. It tends to read them as higher frequencies than they actually are.

That is exactly what I am getting on my 9510. It does not "tends to read them" but they are actually of that frequency. So bass speakers do not work on your 9510 as well. Just the patch imitates the real bass frequencies less that 100Hz with much higher frequencies. You hear them and overall it sounds better for sure and louder than on you 9530, that is why you think bass is working on 9510 but actually it is NOT, as I suspected.

Even just playing music you can tell that the 9510 is significantly better.

It is just a psychological effect, I bought it as well the day before yesterday lol, You still have NO frequencies <100Hz and the iOS app is absolutely correct.

A side by side comparision of the 9510 and 9530 makes it very clear that the bass works fine on the 9510 and hardly at all on the 9530.

It is not bass, those are your tweeters trying to imitate the low frequncies because the kernel patch for 9510/9520 connects bass output to the tweeters. So the patch have never actually worked. People just were misled by improvement in the loudness and sound thinking bass speakers now work.

It is not bass, those are your tweeters trying to reproduce the bass because the patch connects bass output to the tweeters. So the patch have never actually worked. People just were misled by improvement in the loudness and sound thinking bass speakers now work.

If you are unsure, just boot to windows. Day & night difference. Could compare 'working' 9510 on linux to 9530 on windows

Okay, I belive you are both absolutely correct. My 9510 speakers sound pretty good and "bassy" on linux (even if it is just trick by the tweeters), however, in windows, they sound leaps and bounds better. In contrast, the bass on the 9530 sounds god awful (incredible on windows), but they sound so much better. on the 9530 linux. Windows sound between 9510 and 9530 is pretty much the same.

VladStulikov commented 1 year ago

My 9510 speakers sound pretty good and "bassy" on linux (even if it is just trick by the tweeters), however, in windows, they sound leaps and bounds better.

Right because Windows Realtek driver knows how to activate subwoofers. And the Linux patch to connect pin 0x17 just does not activate them, although making overall impression little better by redirecting everything to tweeters.

marcSoda commented 1 year ago

My 9510 speakers sound pretty good and "bassy" on linux (even if it is just trick by the tweeters), however, in windows, they sound leaps and bounds better.

Right because Windows Realtek driver knows how to activate subwoofers. And the Linux patch to connect pin 0x17 just does not activate them, although making overall impression little better by redirecting everything to tweeters.

I see. Well I'm sorry that I mislead you to believe that the subwoofers on the 9510 work on linux! I'm not sure where to go from here. The 9510 came out over two years ago so it doesn't seem like finding a fix for this is a priority for anyone.

VladStulikov commented 1 year ago

My 9510 speakers sound pretty good and "bassy" on linux (even if it is just trick by the tweeters), however, in windows, they sound leaps and bounds better.

Right because Windows Realtek driver knows how to activate subwoofers. And the Linux patch to connect pin 0x17 just does not activate them, although making overall impression little better by redirecting everything to tweeters.

I see. Well I'm sorry that I mislead you to believe that the subwoofers on the 9510 work on linux! I'm not sure to go from here. The 9510 came out over two years ago so it doesn't seem like finding a fix for this is a priority for anyone.

No worries :-)

As the same issue exists on the new 9530 there is a hope it is going to be fixed. And I believe the patch will work for older models too,

alexVinarskis commented 1 year ago

hmmm interesting I guess the only option then is to follow Asus guide to load firmware to cirrus chip?

I got some minor progress: extracted firmware .bin from windows, added to linux. Patched kernel and DSD patch allows chip to actually init, however, it still wont load firmware (neither custom or default).

[ 5.712320] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Reset line busy, assuming shared reset [ 12.290562] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2 [ 12.290772] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset [ 19.060793] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

At above-mentioned state woofers (unsurprisingly) still do not play. Will update as I progress...

marcSoda commented 1 year ago

hmmm interesting I guess the only option then is to follow Asus guide to load firmware to cirrus chip?

I got some minor progress: extracted firmware .bin from windows, added to linux. Patched kernel and DSD patch allows chip to actually init, however, it still wont load firmware (neither custom or default).

[ 5.712320] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Reset line busy, assuming shared reset [ 12.290562] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2 [ 12.290772] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset [ 19.060793] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

At above-mentioned state woofers (unsurprisingly) still do not play. Will update as I progress...

That sounds like a great next step to take. Let me know if there's anything I can do to help.

josbeir commented 1 year ago

@alexVinarskis Nice, did you find the correct references in the DSL file ? i couldn't find them in mine. Care to share the patch and firmware files?

Maybe we need to use it in combination with the kernel patch thats sets the correct pins?

plbossart commented 1 year ago

My 9510 speakers sound pretty good and "bassy" on linux (even if it is just trick by the tweeters), however, in windows, they sound leaps and bounds better.

Right because Windows Realtek driver knows how to activate subwoofers. And the Linux patch to connect pin 0x17 just does not activate them, although making overall impression little better by redirecting everything to tweeters.

it's also possible that the speakers sound better because of some processing with an APO or DSP firmware on the host side. It's not necessarily "just" an HDaudio codec configuration. Linux distros do not have access to fancy 3rd party IP because of obvious redistribution rights and licensing problems.

alexVinarskis commented 1 year ago

@josbeir got the entries from .dsl, but had to dump the whole acpi as per example with

sudo acpidump > acpi.log
acpixtract acpi.log
iasl -d *.dat

This will create multiple .dsl, in my case ssdt2.dsl was the correct one:

...

    External (_SB_.PC00.SPI2, DeviceObj)

    Scope (\_SB.PC00.SPI2)
    {
        Device (SPKR)
       ...
                Return ("10280BEB")
            }
...

10280BEB is indeed correct for my 9530, and its SPI2 device with SPKR as a name. Based on that, derived cirrus_ssdt_patch.dsl : (rename to .dls, github is picky) cirrus_ssdt_patch.txt

You would also need to change grub params. Since i was trying many combos, this monster command may come handy to edit&apply&reboot(&get disappointment):

mkdir -p kernel/firmware/acpi && iasl -tc cirrus_ssdt_patch.dsl && cp cirrus_ssdt_patch.aml kernel/firmware/acpi && find kernel | cpio -H newc --create > patched_cirrus_acpi.cpio && sudo cp patched_cirrus_acpi.cpio /boot/patched_cirrus_acpi.cpio

Played with params, both:

              Package () { "reset-gpios", Package () {
            SPKR, One, Zero, Zero,
            SPKR, One, Zero, Zero,
              } },

and

                Package () { "reset-gpios", Package () {
                    SPKR, Zero, Zero, Zero,
                    SPKR, Zero, Zero, Zero,
                } },

work identically. So far so good, device does not throw errors (see my output above). With some other configs, it does crash, so overlay is loaded correctly and is at least partially correct.

I am running .fw overlay to enable 0x17 (tried both 9510 config, and windows dump config) , and speakers still do not work. Also tried directly with quirk patch

    SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
    SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
+   SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DUAL_SPK),

My guess is that for full cirrus config, its DSP shall load firmware, as per Asus exampe, either Default one (bad) or correctly placed specific one. I followed Asus guide to extract my .bin from windows, placed to correct folder etc, however, it does not get that far - so far i cannot get cirrus to load anything. Whatever I do, it simply wont do anything firmware/DSP related.

As used in some Asus/Dells, I tried applying generic cirrus quirk, but also no results:

    SND_PCI_QUIRK(0x1028, 0x0b37, "Dell Inspiron 16 Plus 7620 2-in-1", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
    SND_PCI_QUIRK(0x1028, 0x0b71, "Dell Inspiron 16 Plus 7620", ALC295_FIXUP_DELL_INSPIRON_TOP_SPEAKERS),
+   SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC289_FIXUP_DUAL_SPK),
+   SND_PCI_QUIRK(0x1028, 0x0beb, "Dell XPS 15 9530 (2023)", ALC245_FIXUP_CS35L41_SPI_2),

FYI as per guide, im running changes on top of 6.6-rc6, it had first patch, and I manually applied second patch the presented just to see, (although its Asus config specific)

EDIT: following Asus's firmware repos setup, I made this repo and added there my bins from Windows (more in readme branch). Note that I still couldn't get cirrus to load them, so there is chance naming strategy is wrong, current one just follows Asus's example. I also tried to extract those from friend's 9510, and to my surprise it does not have them? Perhaps its indeed different amp on 9510..

josbeir commented 1 year ago

@alexVinarskis thanks, that's much info to look into the coming days but this is a big step forward if you ask me!

VladStulikov commented 1 year ago

My 9510 speakers sound pretty good and "bassy" on linux (even if it is just trick by the tweeters), however, in windows, they sound leaps and bounds better.

Right because Windows Realtek driver knows how to activate subwoofers. And the Linux patch to connect pin 0x17 just does not activate them, although making overall impression little better by redirecting everything to tweeters.

it's also possible that the speakers sound better because of some processing with an APO or DSP firmware on the host side. It's not necessarily "just" an HDaudio codec configuration. Linux distros do not have access to fancy 3rd party IP because of obvious redistribution rights and licensing problems.

BTW do you know how to verify if the .fw patch configuration was really applied by the driver? I can see "[ 4.063628] snd_hda_intel 0000:00:1f.3: Applying patch firmware 'hda-jack-retask.fw'" in the logs BUT if I try to read pin config via hda-verb it still returns the BIOS-set wrong pin configuration? Does it mean the driver did not apply the patch?