Bug 218744

Summary: No sound from internal speakers for Legion Y9000X 2022 IAH7
Product: Drivers Reporter: arcticlampyrid
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: normal CC: arcticlampyrid, patches, sbinding
Priority: P3    
Hardware: All   
OS: Linux   
URL: https://lore.kernel.org/lkml/TYCP286MB25352F3E995FED9CCE90F1F6C40B2@TYCP286MB2535.JPNP286.PROD.OUTLOOK.COM/T
Kernel Version: 6.8.5-arch1 Subsystem:
Regression: No Bisected commit-id:
Attachments: ACPI Info
Proposed fix to ignore IRQ errors
dmesg 20240429

Description arcticlampyrid 2024-04-18 03:56:07 UTC
Created attachment 306178 [details]
ACPI Info

The sound does not work from internal speakers on Lenovo Legion Y9000X 2022 IAH7 models.  


The subsystem id for my cs35l41 device is 17AA386E, connected via I2C bus, using a shared reset GPIO pin and a shared interrupt.  


See also: https://lore.kernel.org/lkml/TYCP286MB25352F3E995FED9CCE90F1F6C40B2@TYCP286MB2535.JPNP286.PROD.OUTLOOK.COM/T
Comment 1 Stefan Binding 2024-04-18 11:07:54 UTC
Hi,

Looking at your ACPI, and the patch you sent, it seems there's something odd about the way its configured. As far as I am aware, every other laptop for CS35L41 uses GpioInt() rather than Interrupt().

Firstly, I can see from the ACPI that the speaker ID is index 2 not index 1, so the entry into cs35l41_config_table must be:

	{ "17AA386E", 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 2, -1, 0, 0, 0 },

Can you retry with this, and show me what errors, if any, you get?

Your other patch throws away the value of irq_pol set by the driver which should be correct for this interrupt, according to the schematic.

I notice that it prints the value of irq_pol, can you tell me what value you are getting?

Thanks,
Stefan
Comment 2 arcticlampyrid 2024-04-18 12:58:16 UTC
> Can you retry with this, and show me what errors, if any, you get?

Well, i've tried it. No changes can be observed (neither fix anything nor cause extra errors). A patch to change irq_pol (IRQ Polarity) or disable interrupts (i know it is not a good idea) is still needed.

> As far as I am aware, every other laptop for CS35L41 uses GpioInt() rather
> than Interrupt().

May be related: 
https://lore.kernel.org/lkml/SY4P282MB18350CD8288687B87FFD2243E037A@SY4P282MB1835.AUSP282.PROD.OUTLOOK.COM/T/


> Your other patch throws away the value of irq_pol set by the driver which
> should be correct for this interrupt, according to the schematic.

> I notice that it prints the value of irq_pol, can you tell me what value you
> are getting?

1, which means IRQF_TRIGGER_RISING
Comment 3 Stefan Binding 2024-04-22 14:07:47 UTC
Hi,

The interrupt inside that DSDT table is configured incorrectly.
Whilst the function call to setup the interrupt may succeed with this solution, the interrupt itself would never occur. 
Additionally, this solution may affect other laptops, and given it does not fix the underlying issue, we do not think this it is the correct solution.
We are still investigating possible solutions to this, but this may take some time.

Thanks,
Stefan
Comment 4 Stefan Binding 2024-04-26 15:32:12 UTC
Created attachment 306220 [details]
Proposed fix to ignore IRQ errors

Hi,

Can you try the attached patch to fix the interrupts to see if audio still works?

Thanks,
Stefan
Comment 5 arcticlampyrid 2024-04-26 17:36:50 UTC
It works well together with https://lore.kernel.org/lkml/TYCP286MB25359B61BB685A4B3110BB44C40E2@TYCP286MB2535.JPNP286.PROD.OUTLOOK.COM/

Logs:
```
[   22.374272] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Adding DSD properties for 17AA386E
[   22.375540] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Using extra _DSD properties, bypassing _DSD in ACPI
[   22.425153] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[   22.426862] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Adding DSD properties for 17AA386E
[   22.427578] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Using extra _DSD properties, bypassing _DSD in ACPI
[   22.427579] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[   22.470491] QLaptopArch kernel: genirq: Flags mismatch irq 58. 00002088 (cs35l41 IRQ1 Controller) vs. 00002088 (cs35l41 IRQ1 Controller)
[   22.470527] QLaptopArch kernel:  cs35l41_hda_probe+0x955/0xa60 [snd_hda_scodec_cs35l41 3c8ec53653718184da8fe7c1038e379c8df4e83c]
[   22.470618] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Failed to request IRQ 58 for cs35l41 IRQ1 Controller: -16
[   22.470621] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: IRQ Config Failed. Amp errors may not be recoverable without reboot.
[   22.470922] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[   25.882367] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Falling back to default firmware.
[   25.882954] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[   25.882956] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[   26.458564] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[   26.461228] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.bin: v0.58.0
[   26.461239] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: DSP1: spk-prot: e:\workspace\workspace\tibranch_release_playback_6.76_2\ormis\staging\default_tunings\internal\CS35L53\Fixed_Attenuation_Mono_48000_29.78.0\full\Fixed_Attenuation_Mono_48000_29.78.0_full.bin
[   26.505270] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: CS35L41 Bound - SSID: 17AA386E, BST: 1, VSPK: 1, CH: L, FW EN: 1, SPKID: 1
[   26.505287] QLaptopArch kernel: snd_hda_codec_realtek ehdaudio0D0: bound i2c-CSC3551:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[   26.532933] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Falling back to default firmware.
[   26.533540] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: DSP1: Firmware version: 3
[   26.533546] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[   27.099424] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[   27.100903] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.bin: v0.58.0
[   27.100906] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: DSP1: spk-prot: e:\workspace\workspace\tibranch_release_playback_6.76_2\ormis\staging\default_tunings\internal\CS35L53\Fixed_Attenuation_Mono_48000_29.78.0\full\Fixed_Attenuation_Mono_48000_29.78.0_full.bin
[   27.135478] QLaptopArch kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: CS35L41 Bound - SSID: 17AA386E, BST: 1, VSPK: 1, CH: R, FW EN: 1, SPKID: 1
[   27.135483] QLaptopArch kernel: snd_hda_codec_realtek ehdaudio0D0: bound i2c-CSC3551:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
```
Comment 6 Stefan Binding 2024-04-29 10:35:03 UTC
Hi,

Can you attach a full dmesg of this?
Are you testing with just my proposed patch and your patch to add it to the config table? Nothing else?

Thanks,
Stefan
Comment 7 arcticlampyrid 2024-04-29 11:55:03 UTC
Created attachment 306241 [details]
dmesg 20240429
Comment 8 arcticlampyrid 2024-04-29 11:55:28 UTC
> Can you attach a full dmesg of this?

See https://bugzilla.kernel.org/attachment.cgi?id=306241

> Are you testing with just my proposed patch and your patch to add it to the
> config table? Nothing else?

I conducted tests on kernel 6.8.7.arch1-2 (though Arch incorporated some patches, they seem unrelated to this issue) using only your suggested patch along with my patch to add it to the config table.
Comment 9 Stefan Binding 2024-04-29 13:04:59 UTC
Hi,

Thanks for this.
I will send my fix upstream.

Please re-send your patch for the config table entry.
Do not send the other patch.
Ensure you use your real name in the Signed-off-by line, as per Documentation/process/submitting-patches.rst.
Also ensure you add the maintainer: Takashi Iwai <tiwai@suse.de> as a recipient to your submission upstream.

Thanks,
Stefan