Bug 217381

Summary: No sound from speakers on HP ENVY 16 h0005TX / ALC245
Product: Drivers Reporter: Stanislav (ssergiienko.s)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: high    
Priority: P3    
Hardware: Intel   
OS: Linux   
Kernel Version: 6.2.12 Subsystem:
Regression: No Bisected commit-id:
Attachments: dmesg
dmesg from v6.8rc3

Description Stanislav 2023-04-28 08:22:45 UTC
Created attachment 304194 [details]
dmesg

Distro: ArchLinux
Kernel: 6.2.12
BIOS: HP HP ENVY Laptop 16-h0xxx/8A2C, BIOS F.11 03/21/2023

Headphones / mic / bluetooth - works out of the box.

I did a pretty big research on topic and tried all kinds of solutions/workarounds including patching kernel and loading custom SSDT acpi tables.

It's clear that issue is due to missing BIOS parameters:

> kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties
> are missing for HID CSC3551.
> kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not
> supported
> kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.0 failed with error
> -22
> kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties
> are missing for HID CSC3551.
> kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not
> supported
> kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.1 failed with error
> -22

Looks like just yet another quirk in the kernel required for this ALC245 and Laptop model.

I was able to PARTIALLY workaround that by compiling custom kernel with a patch similar to this
https://lore.kernel.org/lkml/20220811053950.11810-1-faenkhauser@gmail.com/
but used a bit different fix-up string of course:
> SND_PCI_QUIRK(0x103c, 0x8a2c, "HP Envy 16-h0xxx",
> ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED),

"Partially" is because:
1. Sound is severely both not laud and lower quality, comparing to Windows. I believe this is due to the reasons similar to https://bugzilla.kernel.org/show_bug.cgi?id=216206
2. I've tried randomly few quirks and settled on ALC287_FIXUP_CS35L41_I2C_2_HP_GPIO_LED, but in general I have no idea which one is correct because few of them worked. As far as I read somewhere, this quirk is more or less universal and fit not only for ALC287 (ALC245 in my case)
3. I've read that patch is obviously not very correct and will not be accepted as is because it doesn't take into account which type of boost (internal/external) is used on the specific device etc. And looks like sound is not laud exactly because quirk does only "partially" good configuration.

I had no luck with patching ACPI with SSDT, but only because I was unable to find (even with brute force trial) correct _DSD parameters for my case. Also maybe just parameters are not enough and it requires something from the Kernel side as well in addition. Hope that someone could help to find them or at least point where to get them.

I'm able to test any patches if needed and provide any more information as needed.
Thanks in advance and really hope for your help!
Comment 1 Stanislav 2024-02-10 17:04:12 UTC
I noticed that there was some work on fixing such issues from the Kernel side:

https://patchew.org/linux/20240102214821.3394810-1-lorenz@brun.one/

So I tried to use Linux 6.8rc3 where these patches are and with latest linux-firmware:

https://lore.kernel.org/all/9ea61a5b-17c1-4c7c-8560-cbd9fe7678f4@opensource.cirrus.com/

But unfortunately, it still doesn't work:
- there is no visual errors from the Kernel side in dmesg
- but there are errors from pulseaudio / pipewire with failing to open device (busy)
- mic seems working fine
Comment 2 Stanislav 2024-02-10 17:08:08 UTC
Created attachment 305852 [details]
dmesg from v6.8rc3

I'm attaching dmesg from v6.8rc3 + linux-firmware-git (~2024-02-11)
Comment 3 Stanislav 2024-02-10 17:10:20 UTC
And here the only error I saw, which says device or resource busy.
Btw, I did tried to restart pulsaudio and error has gone but there is still no sound.

```
pipewire[1867]: spa.alsa: '_ucm0001.hw:sofhdadsp,5': playback open failed: Устройство или ресурс занято
pipewire[1867]: mod.adapter: 0x55c98494f620: can't get format: Устройство или ресурс занято
pipewire-media-session[1868]: ms.core: error id:41 seq:223 res:-16 (Device or resource busy): can't create node: Устройство или ресурс занято
pipewire[1867]: spa.alsa: '_ucm0002.hw:sofhdadsp,4': playback open failed: Устройство или ресурс занято
pipewire[1867]: spa.alsa: '_ucm0002.hw:sofhdadsp,3': playback open failed: Устройство или ресурс занято
pulseaudio[1977]: Failed to find a working profile.
pulseaudio[1977]: Failed to load module "module-alsa-card" (argument: "device_id="1" name="pci-0000_00_1f.3-platform-skl_hda_dsp_generic" card_name="alsa_card.pci-0000_00_1f.3-platform-skl_hda_dsp_generic" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_volume=yes use_ucm=yes avoid_resampling=no card_properties="module-udev-detect.discovered=1""): initialization failed.
pipewire-media-session[1868]: ms.core: error id:42 seq:235 res:-16 (Device or resource busy): enum params id:3 (Spa:Enum:ParamId:EnumFormat) failed
pipewire-media-session[1868]: ms.core: error id:43 seq:255 res:-16 (Device or resource busy): enum params id:3 (Spa:Enum:ParamId:EnumFormat) failed
```
Comment 4 Stanislav 2024-02-11 12:38:32 UTC
With latest kernel from https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/
and latest linux-firmware-git everything finally works! Thanks!

Btw, subjectively quality is a bit different from Windows but not much.