Skip to content

Instantly share code, notes, and snippets.

@lamperez
Last active April 15, 2024 23:11
Show Gist options
  • Star 48 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save lamperez/862763881c0e1c812392b5574727f6ff to your computer and use it in GitHub Desktop.
Save lamperez/862763881c0e1c812392b5574727f6ff to your computer and use it in GitHub Desktop.
CS35L41 amplifiers in an ASUS Zenbook on linux

Asus Zenbook UX3402 speakers on Linux

Important

THIS IS NOW OBSOLETE WITH KERNEL VERSIONS ≥ 6.7.0

A recent announcement in the kernel mail list by Cirrus developers will solve the problem described here. Therefore, the proposed solutions will be soon obsolete. See this comment (thanks, @flukejones, for the tip).

I got the speakers working on my Asus Zenbook 14 OLED UX3402, the one with Intel CPU and the two CS35L41 audio amplifiers connected over SPI (not the UM3402YA, with AMD and I²C). The amplifiers are supported by the snd_hda_scodec_cs35l41 module in recent kernel versions, but they require some model-specific configuration paramaters, that should be provided by the BIOS, via ACPI. Of course, they are missing. It seems that the Windows drivers have those parameters somehow hardcoded, instead of using ACPI (bad idea, but who am I to criticise). Since Asus has been nasty and refused/was not able to update the BIOS with the missing data, I have patched the ACPI tables myself.

Warning

As stated by Cirrus developers, if you try this there is a non-zero (low, I hope) possibility of blowing your speakers. Take into account that this procedure is not just configuring your box, it is hardware-level hacking with very scarce information about the hardware (thank you, ASUS, and thank you, Cirrus, for not publishing the CS35L41 datasheet and making it only available by request). Additionally, You should know how to work with DSDT or SSDT files (I have a brief guide here) and how to recover from a non booting system. You are on your own. You have been warned.

Note

I have used the patch for some months, and everything seems OK. As you can see, the most recent versions do not require electrical parameters to be specified, just providing the functions of several GPIO pins, that are already present in the original BIOS, and the behavior associated to them. I am almost sure that the patch is totally safe.

My BIOS is the most recent one (version 310). I have added two _DSD objects in the SSDT file (ssdt_csc3551.dsl, or its already assembled version, ssdt_csc3551.aml):

  • One inside the SPK1 device, providing the missing "cirrus,dev-index" and other properties, just like the I2C models. You can also provide these properties by patching the kernel module (the linux/sound/pci/hda/cs35l41_hda.c file).

  • Another one, after the SPK1 device, with the chip select GPIOs, "cs-gpios", required by the SPI bus (the somehow simpler I²C bus does not use chip select pins, but addresses). Without this _DSD object, only one amplifier can be addressed and activated. In this case, the driver refuses to load even for this single working amplifier.

Obsolete: DSDT patch

Instead of applying a SSDT file, you may patch the full DSDT dissassembled DSDT file (dsdt.dsl). This was my original solution (thanks to @thor2002ro for pointing to the simpler, nicer SSDT solution, see the comment, especially if you use grub). The patch is available for reference, just apply the SSDT file.

Obsolete: internal boost

I keep the old, original patch, that produced AMP short error messages when the volume was high enough, for reference. Please try first the simpler patch with external boost, that seems to work without flaws (thanks to @bdandy, see the comment).

Boot log

Output from journalctl -b -g CSC3551 --output short-monotonic after the old patch:

[5.358062] zenbook kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[5.643640] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[5.680302] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[5.996217] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Falling back to default firmware.
[5.996608] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[5.996611] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[6.069598] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[6.070173] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: 0: ID cd v29.78.0 XM@94 YM@e
[6.070185] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: 1: ID f20b v0.1.0 XM@17c YM@0
[6.070192] zenbook kernel: cs35l41-hda spi1-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
[6.083485] zenbook kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi1-CSC3551:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[6.083899] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Falling back to default firmware.
[6.083962] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: Firmware version: 3
[6.083966] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[6.145224] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[6.145817] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: 0: ID cd v29.78.0 XM@94 YM@e
[6.145828] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: 1: ID f20b v0.1.0 XM@17c YM@0
[6.145834] zenbook kernel: cs35l41-hda spi1-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
[6.161484] zenbook kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi1-CSC3551:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])

The "Falling back to default firmware" disappears if spk-id-gpios are provided (the block is commented in the patch). As a result, a different firmware is loaded, resulting in very low volume and strong distortion. If the new patch is used, that uses external boost, the sound is correct, and the log is

[0.004000] zenbook kernel: ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[0.004000] zenbook kernel: ACPI: SSDT 0x00000000368FD000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20200925)
[5.607253] zenbook kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[5.906936] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[5.907354] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[5.938136] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[6.239406] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[6.239415] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot-10431e02.wmfw: Fri 27 Aug 2021 14:58:19 W. Europe Daylight Time
[6.313109] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.43.1, 2 algorithms
[6.313524] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: 0: ID cd v29.63.1 XM@94 YM@e
[6.313530] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: 1: ID f20b v0.1.0 XM@176 YM@0
[6.313535] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: spk-prot: C:\Users\tyang\Desktop\Product Setting\SmartAMP\ASUS\ASUS_Zenbook\UX3402\Tuning Release\220304\ASUS_UX3402_L_tuning_IDYC_ReDc_PICL_RTL_0304.bin
[6.337211] zenbook kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi1-CSC3551:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[6.337534] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: Firmware version: 3
[6.337540] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot-10431e02.wmfw: Fri 27 Aug 2021 14:58:19 W. Europe Daylight Time
[6.399070] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: Firmware: 400a4 vendor: 0x2 v0.43.1, 2 algorithms
[6.399612] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: 0: ID cd v29.63.1 XM@94 YM@e
[6.399623] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: 1: ID f20b v0.1.0 XM@176 YM@0
[6.399629] zenbook kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: spk-prot: C:\Users\tyang\Desktop\Product Setting\SmartAMP\ASUS\ASUS_Zenbook\UX3402\Tuning Release\220304\ASUS_UX3402_R_tuning_IDYC_ReDc_PICL_RTL_0304.bin
[6.427637] zenbook kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi1-CSC3551:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
--- dsdt.dsl.old 2023-03-26 01:06:48.845795666 +0100
+++ dsdt.dsl 2023-03-26 12:00:45.643851841 +0200
@@ -18,7 +18,7 @@
* Compiler ID "INTL"
* Compiler Version 0x20200717 (538969879)
*/
-DefinitionBlock ("", "DSDT", 2, "_ASUS_", "Notebook", 0x01072009)
+DefinitionBlock ("", "DSDT", 2, "_ASUS_", "Notebook", 0x0107200A)
{
/*
* iASL Warning: There were 233 external control methods found during
@@ -90642,7 +90642,48 @@
Method (_DIS, 0, NotSerialized) // _DIS: Disable Device
{
}
+
+ Name (_DSD, Package () // _DSD: Device-Specific Data
+ {
+ ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+ Package ()
+ {
+ Package () { "cirrus,dev-index", Package () { Zero, One }},
+ Package () { "reset-gpios", Package () {
+ SPK1, One, Zero, Zero,
+ SPK1, One, Zero, Zero,
+ } },
+ // Package () { "spk-id-gpios", Package () {
+ // SPK1, 0x02, Zero, Zero,
+ // SPK1, 0x02, Zero, Zero,
+ // } },
+ Package () { "cirrus,speaker-position", Package () { Zero, One } },
+ Package () { "cirrus,gpio1-func", Package () { Zero, Zero } },
+ Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
+ // boost-type: 0 internal, 1 external
+ Package () { "cirrus,boost-type", Package () { Zero, Zero } },
+ // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
+ Package () { "cirrus,boost-peak-milliamp", Package () { 4500, 4500 } },
+ // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
+ Package () { "cirrus,boost-ind-nanohenry", Package () { 1000, 1000 } },
+ // boost-cap-microfarad: rounded to the nearest integer
+ Package () { "cirrus,boost-cap-microfarad", Package () { 24, 24 } },
+ },
+ })
}
+
+ Name (_DSD, Package ()
+ {
+ ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+ Package ()
+ {
+ Package () { "cs-gpios", Package () {
+ Zero, // Native CS
+ SPK1, Zero, Zero, Zero // GPIO CS
+ } }
+ }
+ })
+
}
Scope (_SB.PC00.LPCB)
--- dsdt.dsl.old 2023-03-26 01:06:48.845795666 +0100
+++ dsdt.dsl 2023-03-26 12:00:45.643851841 +0200
@@ -18,7 +18,7 @@
* Compiler ID "INTL"
* Compiler Version 0x20200717 (538969879)
*/
-DefinitionBlock ("", "DSDT", 2, "_ASUS_", "Notebook", 0x01072009)
+DefinitionBlock ("", "DSDT", 2, "_ASUS_", "Notebook", 0x0107200A)
{
/*
* iASL Warning: There were 233 external control methods found during
@@ -90642,7 +90642,43 @@
Method (_DIS, 0, NotSerialized) // _DIS: Disable Device
{
}
+
+ Name (_DSD, Package () // _DSD: Device-Specific Data
+ {
+ ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+ Package ()
+ {
+ Package () { "cirrus,dev-index", Package () { Zero, One }},
+ Package () { "reset-gpios", Package () {
+ SPK1, One, Zero, Zero,
+ SPK1, One, Zero, Zero,
+ } },
+ Package () { "spk-id-gpios", Package () {
+ SPK1, 0x02, Zero, Zero,
+ SPK1, 0x02, Zero, Zero,
+ } },
+ Package () { "cirrus,speaker-position", Package () { Zero, One } },
+ // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
+ Package () { "cirrus,gpio1-func", Package () { One, One } },
+ Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
+ // boost-type: 0 internal, 1 external
+ Package () { "cirrus,boost-type", Package () { One, One } },
+ },
+ })
}
+
+ Name (_DSD, Package ()
+ {
+ ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
+ Package ()
+ {
+ Package () { "cs-gpios", Package () {
+ Zero, // Native CS
+ SPK1, Zero, Zero, Zero // GPIO CS
+ } }
+ }
+ })
+
}
Scope (_SB.PC00.LPCB)
DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
External (_SB_.PC00.SPI0, DeviceObj)
External (_SB_.PC00.SPI0.SPK1, DeviceObj)
Scope (_SB.PC00.SPI0.SPK1)
{
Name (_DSD, Package ()
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package ()
{
Package () { "cirrus,dev-index", Package () { Zero, One }},
Package () { "reset-gpios", Package () {
SPK1, One, Zero, Zero,
SPK1, One, Zero, Zero
} },
Package () { "spk-id-gpios", Package () {
SPK1, 0x02, Zero, Zero,
SPK1, 0x02, Zero, Zero
} },
Package () { "cirrus,speaker-position", Package () { Zero, One } },
// gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
Package () { "cirrus,gpio1-func", Package () { One, One } },
Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
// boost-type: 0 internal, 1 external
Package () { "cirrus,boost-type", Package () { One, One } }
}
})
}
Scope (_SB.PC00.SPI0)
{
Name (_DSD, Package ()
{
ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
Package ()
{
Package () { "cs-gpios", Package () {
Zero, // Native CS
SPK1, Zero, Zero, Zero // GPIO CS
} }
}
})
}
}
@thor2002ro
Copy link

made a separate ssdt for laptop no need to patch the dsdt should be easier to use https://github.com/thor2002ro/asus_zenbook_ux3402za

enjoy

@ChrisN812
Copy link

Can anyone comment on getting this to work with Fedora 37 (kernel 6.2.9 currently)?
I tried thor2002ro github instructions, however I do see much in dmesg for cs35 chipset:

[ 5.131979] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[ 5.131987] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[ 5.131991] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.0 failed with error -22
[ 5.134358] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[ 5.134362] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[ 5.134365] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -22

@thor2002ro
Copy link

thor2002ro commented Apr 9, 2023

I belive.... Fedora uses grub-mkconfig -o /boot/grub/grub.cfg not update-grub
The rest should be the same

@ChrisN812
Copy link

I have the entry in grub.cfg ok. Have the dst file in /boot just dont see it getting loaded on reboot:

[root@fedora ~]# ls -l /boot/ssdt*
-rw-r--r--. 1 root root 450944 Apr 10 17:34 /boot/ssdt-cnalley.aml

[root@fedora ~]# grep -B 4 -A 2 ssdt /boot/grub2/grub.cfg

BEGIN /etc/grub.d/01_acpi

insmod part_gpt
insmod ext2
search --no-floppy --fs-uuid --set=root e4d502ec-b82b-445b-8a4e-1e059d524897
acpi ($root)/ssdt-cnalley.aml

END /etc/grub.d/01_acpi

Any suggestions? Perhaps its a Fedora thing to not load ACPI tables through grub2?

@fermino
Copy link

fermino commented Apr 10, 2023

@ChrisN812 what happens when you execute grub-mkconfig?

@ChrisN812
Copy link

@ChrisN812 what happens when you execute grub-mkconfig?

For me with EFI boot I do:

grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg

So took a stab at something and disabled secure boot. All good now!! I have good definition sound now!! WHOO. Thanks all. The only reason I've kept Win 11 on this is cause I didn't have sound in Linux.

[ 5.185627] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[ 5.186188] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[ 5.222768] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[ 5.752537] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[ 5.752546] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot-10431e02.wmfw: Fri 27 Aug 2021 14:58:19 W. Europe Daylight Time
[ 5.908402] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.43.1, 2 algorithms
[ 5.909314] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: 0: ID cd v29.63.1 XM@94 YM@e
[ 5.909319] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: 1: ID f20b v0.1.0 XM@176 YM@0
[ 5.909323] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: spk-prot: C:\Users\tyang\Desktop\Product Setting\SmartAMP\ASUS\ASUS_Zenbook\UX3402\Tuning Release\220304\ASUS_UX3402_L_tuning_IDYC_ReDc_PICL_RTL_0304.bin
[ 5.952078] snd_hda_codec_realtek ehdaudio0D0: bound spi0-CSC3551:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[ 5.955674] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware version: 3
[ 5.955679] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot-10431e02.wmfw: Fri 27 Aug 2021 14:58:19 W. Europe Daylight Time
[ 6.098033] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware: 400a4 vendor: 0x2 v0.43.1, 2 algorithms
[ 6.098891] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: 0: ID cd v29.63.1 XM@94 YM@e
[ 6.098899] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: 1: ID f20b v0.1.0 XM@176 YM@0
[ 6.098904] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: spk-prot: C:\Users\tyang\Desktop\Product Setting\SmartAMP\ASUS\ASUS_Zenbook\UX3402\Tuning Release\220304\ASUS_UX3402_R_tuning_IDYC_ReDc_PICL_RTL_0304.bin
[ 6.144140] snd_hda_codec_realtek ehdaudio0D0: bound spi0-CSC3551:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])

@lamperez
Copy link
Author

lamperez commented Apr 11, 2023

@thor2002ro Many thanks for the SSDT patch. I have learned something new.

@bdandy
Copy link

bdandy commented Apr 12, 2023

Guys, do you also have an issue with headphones on\off ?
I had to restart spotify and pipewire so sound get back work again.
Though might be reset gpio for second amp incorrect in ssdt.

PS. Thanks for SSDT too, much cleaner than patching DSDT

@fantaziskee
Copy link

Guys, do you also have an issue with headphones on\off ? I had to restart spotify and pipewire so sound get back work again. Though might be reset gpio for second amp incorrect in ssdt.

PS. Thanks for SSDT too, much cleaner than patching DSDT

Perhaps I have something similar. For example, when I switch videos on YouTube, the video freezes until I restart pulseaudio. Right now, I'm looking into the possibility that I made a mistake somewhere during installation/configuration, but I don't have this issue on my other computers.

@fermino
Copy link

fermino commented Apr 12, 2023

Hi again, for some reason it stopped working :( I think it might have to do with a pulseaudio update though. I'll update this when I find something.

@fermino
Copy link

fermino commented Apr 12, 2023

A cold boot fixed it. I made sure to unplug the headphones first. Not sure if that had anything to do...

@risemiv
Copy link

risemiv commented Apr 15, 2023

Hi! I, too, have a UX3402Z OLED and I tried to apply the SSDT file (both lamperez's and thor2002ro's version, there seems to be slight differences between the two) using the suggested guide, which is similar to the one on ArchWiki linked by vyacheslav25, to create a cpio file for initrd. (For some reason, the other method of using GRUB to load the custom ACPI tables didn't work for me.) However, after either of the two versions of them are loaded, the system doesn't boot and the Caps Lock key starts flashing like it's being spammed and I have to force shut down. My notebook is running openSuSE Tumbleweed (kernel 6.2.9-1-default) and has the latest BIOS version (310). I would be grateful if you could give me any guidance.

Update: The same happens if I apply the DSDT patch.

@lamperez
Copy link
Author

Hello. As a test, you can try to disassemble and reassemble the DSDT, without applying the patch, and then trying to load it following the corresponding procedure, the grub one, or the initrd one, depending on your boot manager (I think that OpenSuse uses grub2). Basically, you are reloading your own ACPI from a file. If it does not work, the problem is not the patch, but the disassembling/assembling/booting process.

Also, check if secure boot is disabled in your UEFI. I haven't checked it, but I suppose that it is required: our files are not signed at all.

Once solved this, you could try the patch, or better, the SSDT file.

@risemiv
Copy link

risemiv commented Apr 18, 2023

Thank you! You were right. It was my fault, the correct order is:

linux	 /boot/vmlinuz
initrd   /boot/acpi_override /boot/initrd

The following works for openSUSE (kernel 6.2.9-1-default):

iasl -sa ssdt.dsl
mkdir -p kernel/firmware/acpi
cp ssdt.aml kernel/firmware/acpi
find kernel | cpio -H newc --create > /boot/acpi_override
echo GRUB_EARLY_INITRD_LINUX_CUSTOM=\"acpi_override\" >> /etc/default/grub
grub2-mkconfig -o /boot/grub2/grub.cfg

Generating grub configuration file ...
Found theme: /boot/grub2/themes/openSUSE/theme.txt
Found linux image: /boot/vmlinuz-6.2.9-1-default
Found initrd image: /boot/acpi_override /boot/initrd-6.2.9-1-default
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Adding boot menu entry for UEFI Firmware Settings ...
done

There is no need to disable Secure Boot.

@lcompare
Copy link

@thor2002ro thanks a lot! Your ssdt patch worked for me on a UX3402ZA.

https://github.com/thor2002ro/asus_zenbook_ux3402za/tree/main/Sound

I just had a hard time at the beginning understanding the README in github :)
I would separate the comments from the commands for example with a code block.
I was able to understand it after cloning the repo and doing cat to the README.

Thank again!

@thor2002ro
Copy link

@thor2002ro thanks a lot! Your ssdt patch worked for me on a UX3402ZA.

https://github.com/thor2002ro/asus_zenbook_ux3402za/tree/main/Sound

I just had a hard time at the beginning understanding the README in github :) I would separate the comments from the commands for example with a code block. I was able to understand it after cloning the repo and doing cat to the README.

Thank again!

there.... better? I was just lazy.....

@cabradiaz
Copy link

YEAAAAAAAAA GUUUYSS!!!! THANKS !! I waited like 6 months for this !!!

@lcompare
Copy link

@thor2002ro thanks a lot! Your ssdt patch worked for me on a UX3402ZA.
https://github.com/thor2002ro/asus_zenbook_ux3402za/tree/main/Sound
I just had a hard time at the beginning understanding the README in github :) I would separate the comments from the commands for example with a code block. I was able to understand it after cloning the repo and doing cat to the README.
Thank again!

there.... better? I was just lazy.....

Looks great now. It will help a lot of people. Thanks

@plamen-kolev
Copy link

plamen-kolev commented May 1, 2023

Has anyone managed to get it working under UX3402VA
No errors, but my output looks significantly shorter?
Also curious to know, which bios version are you running ?

─$ journalctl -b -g CSC3551 --output short-monotonic
[    0.009843] devlab2 kernel: ACPI: SSDT 0x00000000193432AE 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20221020)
[   14.541722] devlab2 kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[   14.542859] devlab2 kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[   14.581103] devlab2 kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[   14.581144] devlab2 kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.

@B4rb4r0ss4
Copy link

Hi, I use garuda linux on my UX3004Za, after putting this dsdt patch sound works, but only for short time, however after running for example browser sound is broken again :( Is any way to repair it?

@fermino
Copy link

fermino commented May 3, 2023

Hi, I use garuda linux on my UX3004Za, after putting this dsdt patch sound works, but only for short time, however after running for example browser sound is broken again :( Is any way to repair it?

@B4rb4r0ss4 what BIOS version are you running? Try the ssdt patch, that should be cleaner and easier to install. Have you noticed any triggers when the sound stops working? Like a sudden spike in volume, a volume change, or something alike?

@fermino
Copy link

fermino commented May 3, 2023

Has anyone managed to get it working under UX3402VA No errors, but my output looks significantly shorter? Also curious to know, which bios version are you running ?

@plamen-kolev BIOS version for my UX3402ZA. By the way, for what I see in your output the circuit for the amps seems to be the same as in the ZA, right? (SPI and not I2C).

BIOS Information
	Vendor: American Megatrends International, LLC.
	Version: UX3402ZA.310
	Release Date: 12/14/2022

System Information
	Manufacturer: ASUSTeK COMPUTER INC.
	Product Name: Zenbook UX3402ZA_UX3402ZA

@B4rb4r0ss4
Copy link

Hi, I use garuda linux on my UX3004Za, after putting this dsdt patch sound works, but only for short time, however after running for example browser sound is broken again :( Is any way to repair it?

@B4rb4r0ss4 what BIOS version are you running? Try the ssdt patch, that should be cleaner and easier to install. Have you noticed any triggers when the sound stops working? Like a sudden spike in volume, a volume change, or something alike?

Nope, just stop working, after repatching there is sound for a moment again and then stop working, and I use the newest bios probably 310

@fermino
Copy link

fermino commented May 3, 2023

Hi, I use garuda linux on my UX3004Za, after putting this dsdt patch sound works, but only for short time, however after running for example browser sound is broken again :( Is any way to repair it?

@B4rb4r0ss4 what BIOS version are you running? Try the ssdt patch, that should be cleaner and easier to install. Have you noticed any triggers when the sound stops working? Like a sudden spike in volume, a volume change, or something alike?

Nope, just stop working, after repatching there is sound for a moment again and then stop working, and I use the newest bios probably 310

What do you mean by repatching? The patch should be loaded on boot only, it is not necessary to re-compile it. By the way, I had some strange issues at some point, but a cold boot (powering the notebook completely off, waiting a bit and powering it on again) fixed those. Maybe give it a try?

@B4rb4r0ss4
Copy link

@B4rb4r0ss4
Copy link

Hi, I use garuda linux on my UX3004Za, after putting this dsdt patch sound works, but only for short time, however after running for example browser sound is broken again :( Is any way to repair it?

@B4rb4r0ss4 what BIOS version are you running? Try the ssdt patch, that should be cleaner and easier to install. Have you noticed any triggers when the sound stops working? Like a sudden spike in volume, a volume change, or something alike?

Nope, just stop working, after repatching there is sound for a moment again and then stop working, and I use the newest bios probably 310

What do you mean by repatching? The patch should be loaded on boot only, it is not necessary to re-compile it. By the way, I had some strange issues at some point, but a cold boot (powering the notebook completely off, waiting a bit and powering it on again) fixed those. Maybe give it a try?

I mean making update-grub

@B4rb4r0ss4
Copy link

B4rb4r0ss4 commented May 3, 2023

Hi, I use garuda linux on my UX3004Za, after putting this dsdt patch sound works, but only for short time, however after running for example browser sound is broken again :( Is any way to repair it?

@B4rb4r0ss4 what BIOS version are you running? Try the ssdt patch, that should be cleaner and easier to install. Have you noticed any triggers when the sound stops working? Like a sudden spike in volume, a volume change, or something alike?

Nope, just stop working, after repatching there is sound for a moment again and then stop working, and I use the newest bios probably 310

What do you mean by repatching? The patch should be loaded on boot only, it is not necessary to re-compile it. By the way, I had some strange issues at some point, but a cold boot (powering the notebook completely off, waiting a bit and powering it on again) fixed those. Maybe give it a try?

Ok I tried "cold boot" and situation looks similar I had sound for a few seconds, then the sound doesn't work again

@fermino
Copy link

fermino commented May 3, 2023

Ok I tried "cold boot" and situation looks similar I had sound for a few seconds, then the sound doesn't work again

Anything in your dmesg / journalctl logs?

I'm guessing it could be related to the max current setting, reading through the comments it seems it could be related: https://www.reddit.com/r/ASUS/comments/10iv09h/comment/jdv0o22/

Edit: If it is, you should be able to see the "amp short" error in the logs.

@B4rb4r0ss4
Copy link

Ok, I fixed it, now everything works, there were some errors with pulseaudio, I replaced it with pipewire and everything works as never thank you, finally after 0.5 year I have sound :D

@fermino
Copy link

fermino commented May 3, 2023

Awesome! Glad it works, I've been waiting for someone to post a fix for this for quite some time too :)
Thanks @lamperez and @thor2002ro

@plamen-kolev
Copy link

plamen-kolev commented May 3, 2023

@fermino Thanks for sharing the bios string, mine model is slightly different (UX3402VA_UX3402VA) and latest version is 300.
This is probably why it's not working
Will hope 310 gets rolled out to us unlucky folks, or the new kernel will work
Also using 6.2.13 kernel

@plamen-kolev
Copy link

plamen-kolev commented May 4, 2023

Can someone with working speakers also post the ouput for alsa-info Subsystem Id:. Looks like this line
SND_PCI_QUIRK(0x1043, 0x1e02, "ASUS UX3402", ALC245_FIXUP_CS35L41_SPI_2) < the first 2 hex numbers have to match it

@bdandy
Copy link

bdandy commented May 4, 2023

BTW this model has external boost type so amperage settings are obsolete.

Codec: Realtek ALC294
Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x10ec0294
Subsystem Id: 0x10431e02
Revision Id: 0x100004

For those who has VA model the patch may not work, as ZA has SPI connection

@plamen-kolev
Copy link

Belive that VA also has spi connection, can see it in journalctl
Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices., this is without the patch

@plamen-kolev
Copy link

plamen-kolev commented May 4, 2023

Got audio working by setting SND_PCI_QUIRK with the right subsystem id
So getting audio on UX3402VA is also possible

Hope for a real fix down the line

@fermino
Copy link

fermino commented May 4, 2023

Got audio working by setting SND_PCI_QUIRK with the right subsystem id So getting audio on UX3402VA is also possible

Hope for a real fix down the line

I would encourage you to try to send the patch upstream :)

@v4yne1
Copy link

v4yne1 commented May 6, 2023

I just bought a new Zephyrus G16 2023 - GU603VI.

Can this patch also apply for my device? I'm running Arch along with kernel and support from asus-linux.org , and before that speakers were great on Windows. Where did you find informaton about which sound amplifier is used? I don't want to blow my speakers / fk up my device. Thanks

@fermino
Copy link

fermino commented May 6, 2023

I just bought a new Zephyrus G16 2023 - GU603VI.

Can this patch also apply for my device? I'm running Arch along with kernel and support from asus-linux.org , and before that speakers were great on Windows. Where did you find informaton about which sound amplifier is used? I don't want to blow my speakers / fk up my device. Thanks

It's a long long shot but would you mind posting the complete output of dmesg? Maybe uploading it to pastebin or something like that.

@fermino
Copy link

fermino commented May 6, 2023

@v4yne1 there is a brief mention in the specs page about a "smart amp" that could or could not be a cirrus amplifier. I haven't been able to find anything else besides that, but with the kernel output we might be able to figure it out :)

@Syraxius
Copy link

Syraxius commented May 6, 2023

Hi @v4yne1 @fermino

I'm on Zephyrus M16 2023 - GU604VI (Singapore set) and got it working last month using this patch as well as several other hacks.

This patch itself is not enough as you also have to install the right firmwares and patch kernel to apply the right quirks.

A quick summary of all the steps and resources required are here:
https://forums.linuxmint.com/viewtopic.php?p=2315036

(BTW, huge thanks to all you guys and your awesome work! :D)

@v4yne1
Copy link

v4yne1 commented May 6, 2023

dmesg

@fermino , Sure, here you go https://pastebin.com/6AeM96Gz

[    3.343851] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    3.343854] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[    3.343855] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[    3.345544] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    3.345546] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[    3.345548] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22
[    3.345564] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.

@Syraxius hey! Yes, I saw your post. Can you maybe leave your Discord # ? I already tried following your tutorial but got stuck at one point

@armangurkan
Copy link

armangurkan commented May 7, 2023

I have a ROG Strix G614JI and I am running Pop_OS followed the initial guideline. But no luck, I am not defining ACPI tables, I really appreciate any help at this point. Regardless, I believe I have done it correctly.

@kingcong1
Copy link

kingcong1 commented May 7, 2023

Hi, I have a UP6502ZA which should be the same amp setup as the UX3402. I tried applying the SSDT patch with no luck. Any suggestions on how I may be able to modify the patch for my laptop?

dmesg output:

[ 15.634790] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[ 16.294877] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[ 16.294893] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[ 16.294903] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.0 failed with error -22
[ 16.299306] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[ 16.299317] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[ 16.299325] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -22

@lamperez
Copy link
Author

lamperez commented May 8, 2023

@kingcong1, @armangurkan have you applied the SSDT patch? Try dmesg | grep SSDT. It should show lines like these

ACPI: SSDT ACPI table found in initrd [kernel/firmware/acpi/ssdt_csc3551.aml][0x1a0]
ACPI: SSDT 0x0000000040AC0000 00740E (v02 DptfTb DptfTabl 00001000 INTL 20200717)
(...)
ACPI: Reserving SSDT table memory at [mem 0x40ac0000-0x40ac740d]
(...)
ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
(...)
ACPI: SSDT 0x00000000368FD000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20200925)
(...)

If not, you should review what you have done.

@kingcong1
Copy link

@lamperez, I ran that command and came up with the following output:

[ 0.009900] ACPI: SSDT 0x000000004CD692AB 0001A7 (v01 CUSTOM CS3551 0000300A INTL 20220331)
[ 0.009913] ACPI: SSDT 0x000000004CD6A179 000144 (v02 Intel ADebTabl 00001000 INTL 20200717)
[ 0.009915] ACPI: SSDT 0x000000004CD6A2BD 0035A2 (v02 SocCmn SocCmn 00003000 INTL 20200717)
[ 0.009916] ACPI: SSDT 0x000000004CD6D85F 003AEA (v02 SocGpe SocGpe 00003000 INTL 20200717)
[ 0.009920] ACPI: SSDT 0x000000004CD713D1 000D89 (v02 ASUS UsbCTabl 00001000 INTL 20200717)
[ 0.009925] ACPI: SSDT 0x000000004CD721E2 002357 (v02 ASUS TbtTypeC 00000000 INTL 20200717)
[ 0.009930] ACPI: SSDT 0x000000004CD76167 00AD09 (v02 ASUS AdlP_Rvp 00001000 INTL 20200717)
[ 0.009932] ACPI: SSDT 0x000000004CD80E70 0002A6 (v02 ASUS TcssSsdt 00000000 INTL 20200717)
[ 0.009934] ACPI: SSDT 0x000000004CD81116 0001A4 (v01 ASUS SPKRAMPS 00000002 INTL 20200717)
[ 0.009940] ACPI: SSDT 0x000000004CD8150A 00D39F (v02 INTEL TcssSsdt 00001000 INTL 20200717)
[ 0.009942] ACPI: SSDT 0x000000004CD8E8A9 0033D3 (v02 INTEL IgfxSsdt 00003000 INTL 20200717)
[ 0.009944] ACPI: SSDT 0x000000004CD91C7C 002AA1 (v02 SaSsdt SaSsdt 00003000 INTL 20200717)
[ 0.009946] ACPI: SSDT 0x000000004CD9471D 005D0B (v02 CpuRef CpuSsdt 00003000 INTL 20200717)
[ 0.009947] ACPI: SSDT 0x000000004CD9A428 00038C (v02 PmaxDv Pmax_Dev 00000001 INTL 20200717)
[ 0.009954] ACPI: SSDT 0x000000004CD9A966 006D68 (v02 DptfTa DptfTabl 00001000 INTL 20200717)
[ 0.009963] ACPI: Reserving SSDT table memory at [mem 0x4cd692ab-0x4cd69451]
[ 0.009967] ACPI: Reserving SSDT table memory at [mem 0x4cd6a179-0x4cd6a2bc]
[ 0.009968] ACPI: Reserving SSDT table memory at [mem 0x4cd6a2bd-0x4cd6d85e]
[ 0.009969] ACPI: Reserving SSDT table memory at [mem 0x4cd6d85f-0x4cd71348]
[ 0.009970] ACPI: Reserving SSDT table memory at [mem 0x4cd713d1-0x4cd72159]
[ 0.009971] ACPI: Reserving SSDT table memory at [mem 0x4cd721e2-0x4cd74538]
[ 0.009973] ACPI: Reserving SSDT table memory at [mem 0x4cd76167-0x4cd80e6f]
[ 0.009973] ACPI: Reserving SSDT table memory at [mem 0x4cd80e70-0x4cd81115]
[ 0.009974] ACPI: Reserving SSDT table memory at [mem 0x4cd81116-0x4cd812b9]
[ 0.009976] ACPI: Reserving SSDT table memory at [mem 0x4cd8150a-0x4cd8e8a8]
[ 0.009976] ACPI: Reserving SSDT table memory at [mem 0x4cd8e8a9-0x4cd91c7b]
[ 0.009977] ACPI: Reserving SSDT table memory at [mem 0x4cd91c7c-0x4cd9471c]
[ 0.009977] ACPI: Reserving SSDT table memory at [mem 0x4cd9471d-0x4cd9a427]
[ 0.009978] ACPI: Reserving SSDT table memory at [mem 0x4cd9a428-0x4cd9a7b3]
[ 0.009980] ACPI: Reserving SSDT table memory at [mem 0x4cd9a966-0x4cda16cd]
[ 0.377299] ACPI: SSDT 0xFFFF9ED6C23EAA00 0001AB (v02 PmRef Cpu0Psd 00003000 INTL 20200717)
[ 0.387268] ACPI: SSDT 0xFFFF9ED6C0FE8800 000394 (v02 PmRef Cpu0Cst 00003001 INTL 20200717)
[ 0.388893] ACPI: SSDT 0xFFFF9ED6C23B8800 000626 (v02 PmRef Cpu0Ist 00003000 INTL 20200717)
[ 0.390694] ACPI: SSDT 0xFFFF9ED6C23BF800 0004BA (v02 PmRef Cpu0Hwp 00003000 INTL 20200717)
[ 0.392722] ACPI: SSDT 0xFFFF9ED6C0FC6000 001BAF (v02 PmRef ApIst 00003000 INTL 20200717)
[ 0.395265] ACPI: SSDT 0xFFFF9ED6C0FC0000 001038 (v02 PmRef ApHwp 00003000 INTL 20200717)
[ 0.397366] ACPI: SSDT 0xFFFF9ED6C0FC2000 001349 (v02 PmRef ApPsd 00003000 INTL 20200717)
[ 0.399520] ACPI: SSDT 0xFFFF9ED6C23B2000 000FBB (v02 PmRef ApCst 00003000 INTL 20200717}

@lamperez
Copy link
Author

lamperez commented May 9, 2023

@kingcong1 The lines about SSDT ACPI table found and Table upgrade are missing in your log: your system is not applying any patch.

@thor2002ro
Copy link

thor2002ro commented May 9, 2023

apart from SSDT you need patched kernel for it to work... For our Asus laptop its in the mainline already.... different laptops might not be....

here's the patch https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/sound/pci/hda/patch_realtek.c?h=v6.4-rc1&id=491a4ccd8a0258392900c80c6b2b622c7115fc23
we have 2 amplifiers on spi bus others have them on i2c
you cant just copy/paste and they will work spi and i2c are not that plug and play....

you can also look at the file history to see if the laptop has been added https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/sound/pci/hda/patch_realtek.c?h=v6.4-rc1
or search for the sound card id

@brybinski
Copy link

Got it working by applying kernel patch on asus ux3402VA

SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402", ALC245_FIXUP_CS35L41_SPI_2),

@armangurkan
Copy link

@kingcong1, @armangurkan have you applied the SSDT patch? Try dmesg | grep SSDT. It should show lines like these

ACPI: SSDT ACPI table found in initrd [kernel/firmware/acpi/ssdt_csc3551.aml][0x1a0]
ACPI: SSDT 0x0000000040AC0000 00740E (v02 DptfTb DptfTabl 00001000 INTL 20200717)
(...)
ACPI: Reserving SSDT table memory at [mem 0x40ac0000-0x40ac740d]
(...)
ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
(...)
ACPI: SSDT 0x00000000368FD000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20200925)
(...)

If not, you should review what you have done.
@lamperez
I have applied the DSD patch, following option 1. my dmesg shows the following in two different greps.

May 10 19:53:38 pop-os kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
May 10 19:53:38 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
May 10 19:53:38 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
May 10 19:53:38 pop-os kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
May 10 19:53:38 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
May 10 19:53:38 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
May 10 19:53:38 pop-os kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22


> [    0.020171] ACPI: DSDT ACPI table found in initrd [kernel/firmware/acpi/dsdt.aml][0x997e9]
> [    0.020253] ACPI: Early table checksum verification disabled
> [    0.020321] ACPI: Reserving FACP table memory at [mem 0x43a64000-0x43a64113]
> [    0.020322] ACPI: Reserving DSDT table memory at [mem 0x439c8000-0x43a63072]
> [    0.020322] ACPI: Reserving FACS table memory at [mem 0x43c50000-0x43c5003f]
> [    0.020322] ACPI: Reserving SSDT table memory at [mem 0x43a65000-0x43a67d06]
> [    0.020323] ACPI: Reserving FIDT table memory at [mem 0x439c7000-0x439c709b]
> [    0.020323] ACPI: Reserving MSDM table memory at [mem 0x439c6000-0x439c6054]
> [    0.020324] ACPI: Reserving SSDT table memory at [mem 0x439c3000-0x439c5b0f]
> [    0.020324] ACPI: Reserving SSDT table memory at [mem 0x439c2000-0x439c238b]
> [    0.020324] ACPI: Reserving SSDT table memory at [mem 0x439bc000-0x439c1d83]
> [    0.020325] ACPI: Reserving SSDT table memory at [mem 0x439b9000-0x439bbab4]
> [    0.020325] ACPI: Reserving SSDT table memory at [mem 0x439b5000-0x439b837b]
> [    0.020325] ACPI: Reserving HPET table memory at [mem 0x439b4000-0x439b4037]
> [    0.020326] ACPI: Reserving APIC table memory at [mem 0x439b3000-0x439b31db]
> [    0.020326] ACPI: Reserving MCFG table memory at [mem 0x439b2000-0x439b203b]
> [    0.020326] ACPI: Reserving SSDT table memory at [mem 0x439a7000-0x439b15e6]
> [    0.020327] ACPI: Reserving SSDT table memory at [mem 0x439a5000-0x439a6f19]
> [    0.020327] ACPI: Reserving NHLT table memory at [mem 0x439a4000-0x439a42f0]
> [    0.020328] ACPI: Reserving LPIT table memory at [mem 0x439a3000-0x439a30cb]
> [    0.020328] ACPI: Reserving SSDT table memory at [mem 0x4399f000-0x439a1a82]
> [    0.020328] ACPI: Reserving SSDT table memory at [mem 0x4399c000-0x4399e10a]
> [    0.020329] ACPI: Reserving DBGP table memory at [mem 0x4399b000-0x4399b033]
> [    0.020329] ACPI: Reserving DBG2 table memory at [mem 0x4399a000-0x4399a053]
> [    0.020329] ACPI: Reserving SSDT table memory at [mem 0x43998000-0x4399911b]
> [    0.020330] ACPI: Reserving DMAR table memory at [mem 0x43997000-0x43997087]
> [    0.020330] ACPI: Reserving FPDT table memory at [mem 0x43996000-0x43996043]
> [    0.020331] ACPI: Reserving SSDT table memory at [mem 0x43994000-0x43995226]
> [    0.020331] ACPI: Reserving SSDT table memory at [mem 0x43990000-0x43993ae9]
> [    0.020331] ACPI: Reserving SSDT table memory at [mem 0x4398c000-0x4398f9d9]
> [    0.020332] ACPI: Reserving SSDT table memory at [mem 0x4398b000-0x4398b0ad]
> [    0.020332] ACPI: Reserving SSDT table memory at [mem 0x4398a000-0x4398a143]
> [    0.020333] ACPI: Reserving UEFI table memory at [mem 0x43afd000-0x43afd639]
> [    0.020333] ACPI: Reserving UEFI table memory at [mem 0x43afc000-0x43afc05b]
> [    0.020333] ACPI: Reserving TPM2 table memory at [mem 0x43988000-0x4398804b]
> [    0.020334] ACPI: Reserving SSDT table memory at [mem 0x43987000-0x43987725]
> [    0.020334] ACPI: Reserving SSDT table memory at [mem 0x43981000-0x43986d69]
> [    0.020334] ACPI: Reserving BGRT table memory at [mem 0x43989000-0x43989037]
> [    0.020335] ACPI: Reserving PHAT table memory at [mem 0x43980000-0x4398062c]
> [    0.020335] ACPI: Reserving WSMT table memory at [mem 0x439a2000-0x439a2027]
> [    0.292335] ACPI: 19 ACPI AML tables successfully acquired and loaded

@armangurkan
Copy link

armangurkan commented May 11, 2023

@lamperez thank you for helping by the way brother.
Now I applied the ssdt patch, still does not work and my dmesg says the following:

[    0.019392] ACPI: SSDT ACPI table found in initrd [kernel/firmware/acpi/ssdt_csc3551.aml][0x1a0]
[    0.019436] ACPI: SSDT 0x0000000043A65000 002D07 (v02 DptfTb DptfTabl 00001000 INTL 20200717)
[    0.019442] ACPI: SSDT 0x00000000439C3000 002B10 (v02 INTEL  DTbtSsdt 00001000 INTL 20200717)
[    0.019444] ACPI: SSDT 0x00000000439C2000 00038C (v02 PmaxDv Pmax_Dev 00000001 INTL 20200717)
[    0.019446] ACPI: SSDT 0x00000000439BC000 005D84 (v02 CpuRef CpuSsdt  00003000 INTL 20200717)
[    0.019448] ACPI: SSDT 0x00000000439B9000 002AB5 (v02 SaSsdt SaSsdt   00003000 INTL 20200717)
[    0.019449] ACPI: SSDT 0x00000000439B5000 00337C (v02 INTEL  IgfxSsdt 00003000 INTL 20200717)
[    0.019457] ACPI: SSDT 0x00000000439A7000 00A5E7 (v02 _ASUS_ RplSBTbt 00001000 INTL 20200717)
[    0.019458] ACPI: SSDT 0x00000000439A5000 001F1A (v02 _ASUS_ Ther_Rvp 00001000 INTL 20200717)
[    0.019464] ACPI: SSDT 0x000000004399F000 002A83 (v02 _ASUS_ PtidDevc 00001000 INTL 20200717)
[    0.019466] ACPI: SSDT 0x000000004399C000 00210B (v02 _ASUS_ TbtTypeC 00000000 INTL 20200717)
[    0.019471] ACPI: SSDT 0x0000000043998000 00111C (v02 _ASUS_ UsbCTabl 00001000 INTL 20200717)
[    0.019477] ACPI: SSDT 0x0000000043994000 001227 (v02 INTEL  xh_rplsb 00000000 INTL 20200717)
[    0.019479] ACPI: SSDT 0x0000000043990000 003AEA (v02 SocGpe SocGpe   00003000 INTL 20200717)
[    0.019481] ACPI: SSDT 0x000000004398C000 0039DA (v02 SocCmn SocCmn   00003000 INTL 20200717)
[    0.019482] ACPI: SSDT 0x000000004398B000 0000AE (v02 HgRef  HgPeg    00001000 INTL 20200717)
[    0.019484] ACPI: SSDT 0x000000004398A000 000144 (v02 Intel  ADebTabl 00001000 INTL 20200717)
[    0.019492] ACPI: SSDT 0x0000000043987000 000726 (v01 NvDDS  NvDDSN20 00001000 INTL 20200717)
[    0.019494] ACPI: SSDT 0x0000000043981000 005D6A (v01 OptRf2 Opt2Tabl 00001000 INTL 20200717)
[    0.019501] ACPI: Reserving SSDT table memory at [mem 0x43a65000-0x43a67d06]
[    0.019502] ACPI: Reserving SSDT table memory at [mem 0x439c3000-0x439c5b0f]
[    0.019502] ACPI: Reserving SSDT table memory at [mem 0x439c2000-0x439c238b]
[    0.019503] ACPI: Reserving SSDT table memory at [mem 0x439bc000-0x439c1d83]
[    0.019503] ACPI: Reserving SSDT table memory at [mem 0x439b9000-0x439bbab4]
[    0.019503] ACPI: Reserving SSDT table memory at [mem 0x439b5000-0x439b837b]
[    0.019505] ACPI: Reserving SSDT table memory at [mem 0x439a7000-0x439b15e6]
[    0.019505] ACPI: Reserving SSDT table memory at [mem 0x439a5000-0x439a6f19]
[    0.019506] ACPI: Reserving SSDT table memory at [mem 0x4399f000-0x439a1a82]
[    0.019507] ACPI: Reserving SSDT table memory at [mem 0x4399c000-0x4399e10a]
[    0.019508] ACPI: Reserving SSDT table memory at [mem 0x43998000-0x4399911b]
[    0.019509] ACPI: Reserving SSDT table memory at [mem 0x43994000-0x43995226]
[    0.019509] ACPI: Reserving SSDT table memory at [mem 0x43990000-0x43993ae9]
[    0.019510] ACPI: Reserving SSDT table memory at [mem 0x4398c000-0x4398f9d9]
[    0.019510] ACPI: Reserving SSDT table memory at [mem 0x4398b000-0x4398b0ad]
[    0.019510] ACPI: Reserving SSDT table memory at [mem 0x4398a000-0x4398a143]
[    0.019512] ACPI: Reserving SSDT table memory at [mem 0x43987000-0x43987725]
[    0.019512] ACPI: Reserving SSDT table memory at [mem 0x43981000-0x43986d69]
[    0.019520] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.019521] ACPI: SSDT 0x0000000039A65000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20200925)
[    0.369930] ACPI: SSDT 0xFFFF996B03A2C600 0001AB (v02 PmRef  Cpu0Psd  00003000 INTL 20200717)
[    0.371033] ACPI: SSDT 0xFFFF996B017EDC00 000394 (v02 PmRef  Cpu0Cst  00003001 INTL 20200717)
[    0.371728] ACPI: SSDT 0xFFFF996B03A6A800 00053F (v02 PmRef  Cpu0Ist  00003000 INTL 20200717)
[    0.372477] ACPI: SSDT 0xFFFF996B03A6B000 0004B5 (v02 PmRef  Cpu0Hwp  00003000 INTL 20200717)
[    0.373394] ACPI: SSDT 0xFFFF996B017D2000 001BAF (v02 PmRef  ApIst    00003000 INTL 20200717)
[    0.374489] ACPI: SSDT 0xFFFF996B017D0000 001038 (v02 PmRef  ApHwp    00003000 INTL 20200717)
[    0.375453] ACPI: SSDT 0xFFFF996B017D4000 001349 (v02 PmRef  ApPsd    00003000 INTL 20200717)
[    0.376431] ACPI: SSDT 0xFFFF996B017E7000 000FBB (v02 PmRef  ApCst    00003000 INTL 20200717)

@manu3193
Copy link

Hi! I have a similar problem on my Lenovo Thinkpad Z16, dmesg shows messages about Amp short error. I have attached the log output and alsa info output here and here, respectively. I would appreciate your help.

@lamperez
Copy link
Author

@manu3193 In my case short amp errors disappeared when switching from internal to external boost type, that is, when changing from Package () { "cirrus,boost-type", Package () { Zero, Zero } } to Package () { "cirrus,boost-type", Package () { One, One } } in the patches.

Notice that your amplifiers are connected through i2c, not SPI. I suppose that from the point of view of the amplifier output it is not important, but there are differences. For example, your ACPI should define one GPIO less than mine (the chip select, that does not exist in i2c buses).

@BillOTei
Copy link

cs35l41

hey guys thanks for making this alive! Or trying at least,
I gave a try at using the same patch and procedure on my Asus strix scar 18 2023 (G834JY) but without luck.
I believed it had the same speaker configuration, it has CSC3551 for sure.
I did both grub update and grub2-mkconfig

Sourcing file /etc/default/grub' Sourcing file /etc/default/grub.d/init-select.cfg'
Sourcing file `/etc/default/grub.d/kdump-tools.cfg'
Generating grub configuration file ...
Searching for custom ACPI tables in /boot
Found custom ACPI table: /boot/ssdt-csc3551.aml
using custom appearance settings
Found background image: grub-wallpapers.jpg
Found linux image: /boot/vmlinuz-6.2.6-76060206-generic
Found initrd image: /boot/initrd.img-6.2.6-76060206-generic
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/efi/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done

but nothing seem to be loaded in the end (as well as my custom background)

May 19 17:48:48 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
May 19 17:48:48 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
May 19 17:48:48 pop-os kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
May 19 17:48:48 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
May 19 17:48:48 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
May 19 17:48:48 pop-os kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22

secure boot is disabled.

What would you need to provide?
Thanks

@fermino
Copy link

fermino commented May 19, 2023

@BillOTei check the kernel log (dmesg) to see if the SSDT is actually being loaded on boot. If not, check the grub config file (maybe update-grub is not updating the right one, or for some reason the ssdt is not being added although it mentions it when the config file is generated).

@BillOTei
Copy link

no ssdt there :/ https://pastebin.com/raw/t1DnaLmn
I'll check grub then

@fermino
Copy link

fermino commented May 19, 2023

@BillOTei
My grub configuration is the following (for reference, the aml file is in /boot; which is the partition 9FC...).

 insmod part_gpt
 insmod fat
 search --no-floppy --fs-uuid --set=root 9FCD-44E3
acpi ($root)/ssdt-csc3551.aml

@brybinski
Copy link

What kernel version are you on? Iirc on older kernels I couldn't get it to work correctly even with dsdt patch. I also see that PCI QUIRK on your model is not set, you can try to add patch manually

@BillOTei
Copy link

BillOTei commented May 22, 2023

@brybinski

I'm on 6.2.6-76060206-generic pop_os

@lamperez
Copy link
Author

@BillOTei I have tested it in several 6.2.x and 6.3.x kernel versions. It should work.

Check journalctl -b -g CSC3551 to see if it is a problem with the ACPI patch, the kernel module or the firmware files.

@BillOTei
Copy link

journalctl -b -g CSC3551

May 22 10:29:15 pop-os kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
May 22 10:29:15 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
May 22 10:29:15 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
May 22 10:29:15 pop-os kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
May 22 10:29:15 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
May 22 10:29:15 pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
May 22 10:29:15 pop-os kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22

@lamperez
Copy link
Author

@BillOTei No ACPI patch. The two cs35l41 amplifiers are there, but the _DSD properties are missing in the corresponding ACPI table. The patch provides them.

@BillOTei
Copy link

@lamperez indeed... Something must be wrong with my grub as I did all the checks and update steps I think https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff?permalink_comment_id=4573514#gistcomment-4573514

@Moooebie
Copy link

Hello. I have a Lenovo Thinkbook Plus Gen 3 (Alder-lake) which has exactly the same cs35l41 amps and exactly the same issue. Would you mind to share about the idea behind this patch and how are the "model specific" configurations obtained?
I'd like to see if I can also get it working on my laptop.
(I am pretty much a noob, these things are a bit overwhelming to me though)

@lamperez
Copy link
Author

lamperez commented May 26, 2023

@Moooebie The cs35l41 amplifiers are smart, they have their own microcontroller that must be booted and some firmware loaded. On the other hand, the ACPI tables contain a description of the computer hardware. Part of this description should be how the amplifiers are connected to the computer main chipset. It can be through a I2C or a SPI bus, with some additional GPIO pins of the chipset, that control things like the reset of the amplifiers during boot. Both buses are rather, similar with small differences (for example, the SPI connection requires an additional pin, a chip-select for the second amp).

Basically, the problem is that official ACPI contains the identification of the bus devices and the GPIO pins, in some lines like these:

SpiSerialBusV2 (0x0000, ... )
SpiSerialBusV2 (0x0001, ... )
GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
    )
        0x0156
    }
GpioIo (...)
...

but the functions of these devices and pins are not provided. For example, the kernel has no way to know that these two SpiSerialBusV2 devices connected to the SPI bus are cirrus,dev-index, as the driver expects, or that the 0x0156 GPIO is just the chip select pin for the second amplifier. Therefore the linux kernel is not able to communicate with the amplifiers, or even check their status or existence. I suppose the windows driver contains this information, somehow hardcoded.

The SSDT patch just provides the missing information about the bus devices, GPIO pins functions, and some configuration required to correctly boot the amplifiers and load their corresponding firmware (for example, which amplifier is left, which is right). Everything else is already available in linux kernels version 6.2 and above, and modern distro packages (I have checked current Ubuntu and PopOS!).

If your computer is different, expect different GPIO pins, but they should have the same functions. You should start by:

  • Check if your amplifiers are connected through SPI or I2C. The command journalctl -b -g CSC3551 is your friend.
  • The patches here are for SPI. For I2C they should be a bit simpler (no chip-select, the cs-gpios part).
  • Extract and disassemble your ACPI (see my guide).
  • Find the table corresponding to the amplifiers (mine is called CSC3551, easy to find with an editor).
  • If the table has no _DSD block, this is the one the patch needs to provide.
  • The the GPIOs are identified in the patch in order (the first one is SPK1, Zero, Zero, Zero, the second one SPK1, One, Zero, Zero, and so on).

@Moooebie
Copy link

@Moooebie The cs35l41 amplifiers are smart, they have their own microcontroller that must be booted and some firmware loaded. On the other hand, the ACPI tables contain a description of the computer hardware. Part of this description should be how the amplifiers are connected to the computer main chipset. It can be through a I2C or a SPI bus, with some additional GPIO pins of the chipset, that control things like the reset of the amplifiers during boot. Both buses are rather, similar with small differences (for example, the SPI connection requires an additional pin, a chip-select for the second amp).

Basically, the problem is that official ACPI contains the identification of the bus devices and the GPIO pins, in some lines like these:

SpiSerialBusV2 (0x0000, ... )
SpiSerialBusV2 (0x0001, ... )
GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
    )
        0x0156
    }
GpioIo (...)
...

but the functions of these devices and pins are not provided. For example, the kernel has no way to know that these two SpiSerialBusV2 devices connected to the SPI bus are cirrus,dev-index, as the driver expects, or that the 0x0156 GPIO is just the chip select pin for the second amplifier. Therefore the linux kernel is not able to communicate with the amplifiers, or even check their status or existence. I suppose the windows driver contains this information, somehow hardcoded.

The SSDT patch just provides the missing information about the bus devices, GPIO pins functions, and some configuration required to correctly boot the amplifiers and load their corresponding firmware (for example, which amplifier is left, which is right). Everything else is already available in linux kernels version 6.2 and above, and modern distro packages (I have checked current Ubuntu and PopOS!).

If your computer is different, expect different GPIO pins, but they should have the same functions. You should start by:

  • Check if your amplifiers are connected through SPI or I2C. The command journalctl -b -g CSC3551 is your friend.
  • The patches here are for SPI. For I2C they should be a bit simpler (no chip-select, the cs-gpios part).
  • Extract and disassemble your ACPI (see my guide).
  • Find the table corresponding to the amplifiers (mine is called CSC3551, easy to find with an editor).
  • If the table has no _DSD block, this is the one the patch needs to provide.
  • The the GPIOs are identified in the patch in order (the first one is SPK1, Zero, Zero, Zero, the second one SPK1, One, Zero, Zero, and so on).

I run that journalctl command and got these results:

May 26 15:38:06 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
May 26 15:38:06 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
May 26 15:38:06 mx3340-tbplus kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.0 failed with error -22

So I believe they are the same speakers but on i2c bus. Following your guide to dump the file, I got the dsdt.dsl file and as expected it looks different from yours.
Since I don't really understand how the patch works, I just blindly inserted it after the "_DIS" block. The only change is that I replaced the SPK1 with SPKR since my device has a different name there. I also did not include the cs-gpios because it is on I2C bus. The whole scope block looks like this:

    Scope (_SB.PC00.I2C7)
    {
        Name (I2CN, Zero)
        Name (I2CX, Zero)
        Name (I2CI, 0x07)
        Method (_INI, 0, NotSerialized)  // _INI: Initialize
        {
            I2CN = SDS7 /* \SDS7 */
            I2CX = 0x07
        }

        Device (SPKR)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Method (_SUB, 0, NotSerialized)  // _SUB: Subsystem ID
            {
                If ((GGIV (0x090E000B) == One))
                {
                    Return ("17AA3846")
                }

                Return ("17AA3845")
            }

            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (RBUF, ResourceTemplate ()
                {
                    I2cSerialBusV2 (0x0040, ControllerInitiated, 0x000F4240,
                        AddressingMode7Bit, "\\_SB.PC00.I2C7",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    I2cSerialBusV2 (0x0041, ControllerInitiated, 0x000F4240,
                        AddressingMode7Bit, "\\_SB.PC00.I2C7",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0166
                        }
                    GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0165
                        }
                    GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0165
                        }
                })
                Return (RBUF) /* \_SB_.PC00.I2C7.SPKR._CRS.RBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x0F)
            }

            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }

            Name (_DSD, Package ()   // _DSD: Device-Specific Data
            {
                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                Package ()
                {
                    Package () { "cirrus,dev-index", Package () { Zero, One }},
                    Package () { "reset-gpios", Package () {
                       SPKR, One, Zero, Zero,
                       SPKR, One, Zero, Zero,
                    } },
                    Package () { "spk-id-gpios", Package () {
                       SPKR, 0x02, Zero, Zero,
                       SPKR, 0x02, Zero, Zero,
                    } },
                    Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                    // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                    Package () { "cirrus,gpio1-func",           Package () { One, One } },
                    Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                    // boost-type: 0 internal, 1 external
                    Package () { "cirrus,boost-type",           Package () { One, One } },
                },
            })

        }



    }

I also changed the Definition line to prioritize it over the ACPI table from BIOS.
I then compiled it and packed it into cpio following your guide, put it under /boot and manually added the initrd command in grub to load it before initramfs just as your example.
Now when I boot into system, the amps are still not working but with a different error:

May 26 16:34:12 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: No index found in cirrus,dev-index
May 26 16:34:12 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Failed property cirrus,dev-index: -19
May 26 16:34:12 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: error -ENODEV: Platform not supported
May 26 16:34:12 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: No index found in cirrus,dev-index
May 26 16:34:12 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Failed property cirrus,dev-index: -19
May 26 16:34:12 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: error -ENODEV: Platform not supported

I guess this means the patched ACPI table is loaded but I did not configure the "device specific" part correctly. Would you give me some help on how I should change it to resolve this error?
Sorry if I did ask a dumb question and thank you so much for the help!

@Moooebie
Copy link

I went to do some research and learned some basics about the ACPI Source Language. For now what I understand is that the patch which adds the _DSD object with that particular UUID is defining some properties of the device in package() {Key, Val} format, and according to your reply those are things about "GPIO pins functions" and "buses".
So with these errors, there is likely something I didn't correctly configure for the "cirrus,dev-index" part which defines the buses to be connected? If so, I wonder where I will be able to figure out the correct configuration. Also you said "they (GPIO pins) should have the same functions", does that mean that the configs for "gpio*-func" are likely to be good if I just leave them as is? Or I still have to find some other datasheets to figure out the specific config for my computer?
Sorry again for bothering, I don't have experiences in tinkering around these kind of things before and I am feeling lost. Really appreciate for your help!

@Moooebie
Copy link

Moooebie commented May 27, 2023

Just figured out that I should replace the package() {Zero, One} with the actual number for my device (package() {0x40, 0x41}). Now there are no more errors but speakers still not working:

May 27 02:03:55 mx3340-tbplus kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 I2C devices.
May 27 02:03:55 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
May 27 02:03:55 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
May 27 02:03:55 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
May 27 02:04:18 mx3340-tbplus dbus-daemon[548]: [system] Activating via systemd: service name='org.freedesktop.home1' unit='dbus-org.freedesktop.home1.service' >
May 27 02:04:19 mx3340-tbplus sudo[1581]:   mx3340 : TTY=pts/1 ; PWD=/home/mx3340 ; USER=root ; COMMAND=/usr/bin/journalctl -b -g CSC3551
May 27 02:05:11 mx3340-tbplus dbus-daemon[548]: [system] Activating via systemd: service name='org.freedesktop.home1' unit='dbus-org.freedesktop.home1.service' >
May 27 02:05:11 mx3340-tbplus sudo[1667]:   mx3340 : TTY=pts/1 ; PWD=/home/mx3340 ; USER=root ; COMMAND=/usr/bin/journalctl -b -g CSC3551

Looks like for now I have to also do some patch on the kernel driver?

EDIT: I saw another person had the exactly same situation, he figured it out and posted the solution under your dsdt patching guide. I'll try it tomorrow and hopefully it will work for me!

@Moooebie
Copy link

It worked!!! Thank you soooo much!!!!

@BillOTei
Copy link

BillOTei commented May 27, 2023 via email

@Moooebie
Copy link

amazing! Could you list the steps you took please? I need to do the same with my asus strix scar 18 Le sam. 27 mai 2023 à 17:37, Moebie Wu @.> a écrit :

@.
* commented on this gist. ------------------------------ It worked!!! Thank you soooo much!!!! — Reply to this email directly, view it on GitHub https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff#gistcomment-4581541 or unsubscribe https://github.com/notifications/unsubscribe-auth/AARUVKXBT76HQRVIOQ2OF2LXIINSVBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTEMJVHE2TGMBTU52HE2LHM5SXFJTDOJSWC5DF . You are receiving this email because you commented on the thread. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

Sure! Give me a few hours, I'm going to write in details about all what I did to get it working on my laptop/

@lamperez
Copy link
Author

@Moooebie Nice!

@Moooebie
Copy link

Moooebie commented May 29, 2023

amazing! Could you list the steps you took please? I need to do the same with my asus strix scar 18 Le sam. 27 mai 2023 à 17:37, Moebie Wu @.> a écrit :

@.
* commented on this gist. ------------------------------ It worked!!! Thank you soooo much!!!! — Reply to this email directly, view it on GitHub https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff#gistcomment-4581541 or unsubscribe https://github.com/notifications/unsubscribe-auth/AARUVKXBT76HQRVIOQ2OF2LXIINSVBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTEMJVHE2TGMBTU52HE2LHM5SXFJTDOJSWC5DF . You are receiving this email because you commented on the thread. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

Sorry for replying a bit late, I was busy during the weekend and I faced some other problems with my laptop and I just managed to solve it yesterday.
First, you want to see whether your amps are on i2c or spi. To do this, you run the comman sudo journalctl -b -g CSC3551. If it does not show up anything then maybe you do not have the exactly same amp. My laptop has it on i2c so I see similar things like this:

May 26 15:38:06 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
May 26 15:38:06 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
May 26 15:38:06 mx3340-tbplus kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.0 failed with error -22

Then you'll have to dump your dsdt table following OP's guide (here). One you have it decompiled and got the dsdt.dsl, you open it and search for CSC3551. All of the things you have to patch will be inside that scope (...) block. First you copy the first _DSD block from the patch and add it directly after the empty _DIS method, so it will look something like this:

...
            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }

            Name (_DSD, Package ()   // _DSD: Device-Specific Data
            {
                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                Package ()
                {
                    Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                    Package () { "reset-gpios", Package () {
                       SPKR, One, Zero, Zero,
                       SPKR, One, Zero, Zero,
                    } },
                    Package () { "spk-id-gpios", Package () {
                       SPKR, 0x02, Zero, Zero,
                       SPKR, 0x02, Zero, Zero,
                    } },
                    Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                    // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                    Package () { "cirrus,gpio1-func",           Package () { One, One } },
                    Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                    // boost-type: 0 internal, 1 external
                    Package () { "cirrus,boost-type",           Package () { One, One } },
                },
            })
...

The whole scope block of my laptop could be found in my previous post.
Notice that I have SPKR instead of SPK1 and Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }} instead of {Zero, One}? These are the device specific thing you have to change here. The device name could be found in the brackets of the header of the device block, in my case it is: Device (SPKR) {... so I replace SPK1 with SPKR. Since your device is also ASUS maybe it is the same SPK1 so you don't have to change it.
The second change there was the ID of the two buses. You kind find these information under the Name (BRUF, ... which is inside the Name (_UID, .... That for my device looks like:

...
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (RBUF, ResourceTemplate ()
                {
                    I2cSerialBusV2 (0x0040, ControllerInitiated, 0x000F4240,
                        AddressingMode7Bit, "\\_SB.PC00.I2C7",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    I2cSerialBusV2 (0x0041, ControllerInitiated, 0x000F4240,
                        AddressingMode7Bit, "\\_SB.PC00.I2C7",
                        0x00, ResourceConsumer, , Exclusive,
                        )
...

So I replace the {Zero, One} with {0x0040, 0x0041}.
According to OP, if your amps are on SPI then you also want to add the second _DSD block in the patch outside of the device (...) block but still inside the scope.
Once you done that, go back to nearly the beginning of the file, change the very last parameter in the DefinitionBlock (... to a larger value to prioritize this patched table over that from the BIOS. It was 0x00 on my device, but it is probably a larger value on your device and you just have to change it to a larger number. Mine is:

DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000009)

After that you follow the guide to recompile and package it into a .cpio file. Copy the .cpio file into /boot. If you use grub, on reboot you press "e" toward the boot option to enter the edit screen, load this cpio as an init ramdisk after the microcode and before the kernel's initrd. For example it might look like this:

...
initrd  /boot/intel-ucode.img /patched_dsdt.cpio /boot/initramfs-6.3.4.img

Run sudo journalctl -b -g CSC3551 again, if there is no error but similar output as that in my previous post, then the ACPI table patch worked. If your speakers work at this moment, then you are done (you may want to write the initrd loading command into grub's config so you won't need to type that manually on every reboot).
If they are still not working, you need to patch the driver in the kernel. Look for a guide to build a mainline kernel (btw. you need Linux 6.1+ for these speakers to work). I am using Manjaro Linux and I followed the guide on ArchWiki. Once you have the full kernel source ready, go to kernel_source_root/sound/pci/hda/patch_realtek.c and search for FIXUP_CS35L41_ until you find a list of things like this:

SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
...

Add a new line in the same format for your laptop.
The first two parameters can be find from the Subsystem ID. Run alsa-info to obtain it. In the output file, search for Subsystem Id and you get a 4 bytes long hex string, for example mine looks like: Subsystem Id: 0x17aa3875. Put the first four characters into the first parameter and the second for characters into the second parameter. The third parameter is just how you call your laptop, it does not matter in terms of functions and can be whatever. The last parameter could be ALC245_FIXUP_CS35L41_SPI_2 or ALC287_FIXUP_CS35L41_I2C_2 depends on whether your amps are on spi or i2c.
For my device specifically, the line is like:

SND_PCI_QUIRK(0x17aa, 0x3875, "Thinkbook Plus Gen3", ALC287_FIXUP_CS35L41_I2C_2)

Then you just build the kernel and set it up for the bootloader. Don't forget to include the .cpio with your patched dsdt table as a initrd. If you are lucky enough at this point your speakers should be finally working.

@Moooebie
Copy link

@Moooebie Nice!

Thank you so much for the patch and the help!!!

@lamperez
Copy link
Author

And thank you for the excellent guide for the i2c case.

@MotoG1980
Copy link

MotoG1980 commented May 29, 2023

Hello everyone. I would like to thank you very much first of all @Moooebie @lamperez for all that great work !
I need some help also with my rog strix laptop, regarding my spi

Here below, is what I extracted from my latest bios (acpi table) and want to know if I need to modify something here. I think in my case, asus has already patched the acpi table for my laptop. Please, let me know if I need to patch anything here.

sudo journalctl -b -g CSC3551

ACPI: SSDT 0x000000003073118B 000191 (v02 CUSTOM CSC3551 00000003 INTL 20221020)
cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22

Method (XWAK, 1, NotSerialized)
{
}

Scope (_SB.PC00.SPI3)
{
    Device (SPK1)
    {
        Name (_HID, "CSC3551")  // _HID: Hardware ID
        Name (_SUB, "10431C9F")  // _SUB: Subsystem ID
        Name (_UID, One)  // _UID: Unique ID
        Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
        {
            Name (SBUF, ResourceTemplate ()
            {
                SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                    ControllerInitiated, 0x003D0900, ClockPolarityLow,
                    ClockPhaseFirst, "\\_SB.PC00.SPI3",
                    0x00, ResourceConsumer, , Exclusive,
                    )
                SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                    ControllerInitiated, 0x003D0900, ClockPolarityLow,
                    ClockPhaseFirst, "\\_SB.PC00.SPI3",
                    0x00, ResourceConsumer, , Exclusive,
                    )
                GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x01D4
                    }
                GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x0140
                    }
                GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x00C0
                    }
                GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x0141
                    }
                GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x0141
                    }
            })
            Return (SBUF) /* \_SB_.PC00.SPI3.SPK1._CRS.SBUF */
        }

        Method (_STA, 0, NotSerialized)  // _STA: Status
        {
            Return (0x0F)
        }

        Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
        {
        }
    }
}

}

@Moooebie
Copy link

Moooebie commented May 29, 2023

@MotoG1980

Hi! I think your laptop has the exactly same problem which is the dsdt table missing _DSD properties (and I don't really think ASUS did already fixed it in your case). From the information I see, you can probably just apply the patch by OP without any changes. So the patched table for your laptop would probably be like this:

Scope (_SB.PC00.SPI3)
{
    Device (SPK1)
    {
        Name (_HID, "CSC3551")  // _HID: Hardware ID
        Name (_SUB, "10431C9F")  // _SUB: Subsystem ID
        Name (_UID, One)  // _UID: Unique ID
        Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
        {
            Name (SBUF, ResourceTemplate ()
            {
                SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                    ControllerInitiated, 0x003D0900, ClockPolarityLow,
                    ClockPhaseFirst, "\\_SB.PC00.SPI3",
                    0x00, ResourceConsumer, , Exclusive,
                    )
                SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                    ControllerInitiated, 0x003D0900, ClockPolarityLow,
                    ClockPhaseFirst, "\\_SB.PC00.SPI3",
                    0x00, ResourceConsumer, , Exclusive,
                    )
                GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x01D4
                    }
                GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x0140
                    }
                GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x00C0
                    }
                GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x0141
                    }
                GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                    "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                    )
                    {   // Pin list
                        0x0141
                    }
            })
            Return (SBUF) /* \_SB_.PC00.SPI3.SPK1._CRS.SBUF */
        }

        Method (_STA, 0, NotSerialized)  // _STA: Status
        {
            Return (0x0F)
        }

        Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
        {
        }

        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { Zero, One }},
                Package () { "reset-gpios", Package () {
                    SPK1, One, Zero, Zero,
                    SPK1, One, Zero, Zero
                } },
                Package () { "spk-id-gpios", Package () {
                    SPK1, 0x02, Zero, Zero,
                    SPK1, 0x02, Zero, Zero
                } },
                Package () { "cirrus,speaker-position", Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func", Package () { One, One } },
                Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type", Package () { One, One } }
            }
        })
    }
    Name (_DSD, Package ()
    {
        ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
        Package ()
        {
            Package () { "cs-gpios", Package () { 
                Zero,                    // Native CS
                SPK1, Zero, Zero, Zero   // GPIO CS
            } }
        }
    })
}

Alternatively, since the exactly same patch will likely work for your laptop, you cam probably use the sddt patch directly provided by OP following the the "Option 2" of this guide which would be easier.
After applying the patch if the errors are gong but speakers still not working, you'll need to patch the kernel following the steps in my previous post.
BTW. you should really thank @lamperez for the patch and other people who figured out how the kernel driver should be patched! All what I did is just sharing the process how I used their works to get the speakers of my laptop working.

@JulienQNN
Copy link

Hi guys, thanks for good work and the great discussions, after following the process i'm getting stuck at Instantiated SPI devices, now when i do : journalctl -b -g CSC3551

Jun` 03 00:19:34 archlinux kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
Jun 03 00:19:34 archlinux kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
Jun 03 00:19:34 archlinux kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
Jun 03 00:19:34 archlinux kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices. 

This would be a kernel problem ?
Any clue ?

Thanks a lot

@Moooebie
Copy link

Moooebie commented Jun 2, 2023

Hi guys, thanks for good work and the great discussions, after following the process i'm getting stuck at Instantiated SPI devices, now when i do : journalctl -b -g CSC3551

Jun` 03 00:19:34 archlinux kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
Jun 03 00:19:34 archlinux kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
Jun 03 00:19:34 archlinux kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
Jun 03 00:19:34 archlinux kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices. 

This would be a kernel problem ? Any clue ?

Thanks a lot

If your speakers are still not working, then that means the ACPI patch is done correctly but the kernel has to patched for them to work.

@JulienQNN
Copy link

JulienQNN commented Jun 2, 2023

Hi guys, thanks for good work and the great discussions, after following the process i'm getting stuck at Instantiated SPI devices, now when i do : journalctl -b -g CSC3551

Jun` 03 00:19:34 archlinux kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
Jun 03 00:19:34 archlinux kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
Jun 03 00:19:34 archlinux kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
Jun 03 00:19:34 archlinux kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices. 

This would be a kernel problem ? Any clue ?
Thanks a lot

If your speakers are still not working, then that means the ACPI patch is done correctly but the kernel has to patched for them to work.

Sorry to bother but i don't understand what i need to do more to the kernel, i saw your very useful comment here where you get the same error,
but i have no idea, what to do with linux/sound/pci/hda/patch_realtek.c, i have an UX3402ZA so i'm not sure i need to do something else ?

Thanks.

@BillOTei
Copy link

BillOTei commented Jun 5, 2023

amazing! Could you list the steps you took please? I need to do the same with my asus strix scar 18 Le sam. 27 mai 2023 à 17:37, Moebie Wu @.> a écrit :

_
@**
.**_* commented on this gist. ------------------------------ It worked!!! Thank you soooo much!!!! — Reply to this email directly, view it on GitHub https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff#gistcomment-4581541 or unsubscribe https://github.com/notifications/unsubscribe-auth/AARUVKXBT76HQRVIOQ2OF2LXIINSVBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFQKSXMYLMOVS2I5DSOVS2I3TBNVS3W5DIOJSWCZC7OBQXE5DJMNUXAYLOORPWCY3UNF3GS5DZVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVEYTEMJVHE2TGMBTU52HE2LHM5SXFJTDOJSWC5DF . You are receiving this email because you commented on the thread. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub .

Sorry for replying a bit late, I was busy during the weekend and I faced some other problems with my laptop and I just managed to solve it yesterday. First, you want to see whether your amps are on i2c or spi. To do this, you run the comman sudo journalctl -b -g CSC3551. If it does not show up anything then maybe you do not have the exactly same amp. My laptop has it on i2c so I see similar things like this:

May 26 15:38:06 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
May 26 15:38:06 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
May 26 15:38:06 mx3340-tbplus kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.0 failed with error -22

Then you'll have to dump your dsdt table following OP's guide (here). One you have it decompiled and got the dsdt.dsl, you open it and search for CSC3551. All of the things you have to patch will be inside that scope (...) block. First you copy the first _DSD block from the patch and add it directly after the empty _DIS method, so it will look something like this:

...
            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }

            Name (_DSD, Package ()   // _DSD: Device-Specific Data
            {
                ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                Package ()
                {
                    Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                    Package () { "reset-gpios", Package () {
                       SPKR, One, Zero, Zero,
                       SPKR, One, Zero, Zero,
                    } },
                    Package () { "spk-id-gpios", Package () {
                       SPKR, 0x02, Zero, Zero,
                       SPKR, 0x02, Zero, Zero,
                    } },
                    Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                    // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                    Package () { "cirrus,gpio1-func",           Package () { One, One } },
                    Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                    // boost-type: 0 internal, 1 external
                    Package () { "cirrus,boost-type",           Package () { One, One } },
                },
            })
...

The whole scope block of my laptop could be found in my previous post. Notice that I have SPKR instead of SPK1 and Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }} instead of {Zero, One}? These are the device specific thing you have to change here. The device name could be found in the brackets of the header of the device block, in my case it is: Device (SPKR) {... so I replace SPK1 with SPKR. Since your device is also ASUS maybe it is the same SPK1 so you don't have to change it. The second change there was the ID of the two buses. You kind find these information under the Name (BRUF, ... which is inside the Name (_UID, .... That for my device looks like:

...
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (RBUF, ResourceTemplate ()
                {
                    I2cSerialBusV2 (0x0040, ControllerInitiated, 0x000F4240,
                        AddressingMode7Bit, "\\_SB.PC00.I2C7",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    I2cSerialBusV2 (0x0041, ControllerInitiated, 0x000F4240,
                        AddressingMode7Bit, "\\_SB.PC00.I2C7",
                        0x00, ResourceConsumer, , Exclusive,
                        )
...

So I replace the {Zero, One} with {0x0040, 0x0041}. According to OP, if your amps are on SPI then you also want to add the second _DSD block in the patch outside of the device (...) block but still inside the scope. Once you done that, go back to nearly the beginning of the file, change the very last parameter in the DefinitionBlock (... to a larger value to prioritize this patched table over that from the BIOS. It was 0x00 on my device, but it is probably a larger value on your device and you just have to change it to a larger number. Mine is:

DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000009)

After that you follow the guide to recompile and package it into a .cpio file. Copy the .cpio file into /boot. If you use grub, on reboot you press "e" toward the boot option to enter the edit screen, load this cpio as an init ramdisk after the microcode and before the kernel's initrd. For example it might look like this:

...
initrd  /boot/intel-ucode.img /patched_dsdt.cpio /boot/initramfs-6.3.4.img

Run sudo journalctl -b -g CSC3551 again, if there is no error but similar output as that in my previous post, then the ACPI table patch worked. If your speakers work at this moment, then you are done (you may want to write the initrd loading command into grub's config so you won't need to type that manually on every reboot). If they are still not working, you need to patch the driver in the kernel. Look for a guide to build a mainline kernel (btw. you need Linux 6.1+ for these speakers to work). I am using Manjaro Linux and I followed the guide on ArchWiki. Once you have the full kernel source ready, go to kernel_source_root/sound/pci/hda/patch_realtek.c and search for FIXUP_CS35L41_ until you find a list of things like this:

SND_PCI_QUIRK(0x1043, 0x12af, "ASUS UX582ZS", ALC245_FIXUP_CS35L41_SPI_2),
...

Add a new line in the same format for your laptop. The first two parameters can be find from the Subsystem ID. Run alsa-info to obtain it. In the output file, search for Subsystem Id and you get a 4 bytes long hex string, for example mine looks like: Subsystem Id: 0x17aa3875. Put the first four characters into the first parameter and the second for characters into the second parameter. The third parameter is just how you call your laptop, it does not matter in terms of functions and can be whatever. The last parameter could be ALC245_FIXUP_CS35L41_SPI_2 or ALC287_FIXUP_CS35L41_I2C_2 depends on whether your amps are on spi or i2c. For my device specifically, the line is like:

SND_PCI_QUIRK(0x17aa, 0x3875, "Thinkbook Plus Gen3", ALC287_FIXUP_CS35L41_I2C_2)

Then you just build the kernel and set it up for the bootloader. Don't forget to include the .cpio with your patched dsdt table as a initrd. If you are lucky enough at this point your speakers should be finally working.

thanks!

@crazyc4t
Copy link

crazyc4t commented Jun 5, 2023

Hello everyone! First of all thank you to @Moooebie @lamperez for their awesome work! I got the same problem as @Moooebie but with a thinkbook 13x gen2, I was just following your steps, so what I did is:

  1. sudo journalctl -b -g CSC3551
Jun 05 14:45:05 wizard kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 I2C devices.
Jun 05 14:45:05 wizard kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
Jun 05 14:45:05 wizard kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
Jun 05 14:45:05 wizard kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.0 failed with error -22
Jun 05 14:45:05 wizard kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
Jun 05 14:45:05 wizard kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
Jun 05 14:45:05 wizard kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.1 failed with error -22

By reading this for sure my speaker is in I2C.

  1. Decompile and get the dsdt.dsl, then search for CSC3551

I did it but there's no match for CSC3551, nor SPKR or SPK1, although I have SPKP, so I don't want to do something that I'm not that certain, so just wanted to ask you guys what could be the best move from here? Thank you so much for reading!

@lamperez
Copy link
Author

lamperez commented Jun 6, 2023

It seems strange, since the devices are called i2c-CSC3551:00-cs35l41-hda.0 (and 1). To my understanding, the kernel only tries to load the cs35l41-hda module if the ACPI device is called CLSA0100, CLSA0101 or CSC3551, as you can see in the source file (for SPI connected devices, only the last one).

@PoSayDone
Copy link

PoSayDone commented Jun 9, 2023

Not working for me with ux3402va

[    0.009317] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.009318] ACPI: SSDT 0x0000000036E63000 0001A0 (v01 CUSTOM CSC3551  0000000A INTL 20200925)
[    3.437382] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[    3.478326] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    3.511465] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[    3.511517] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.

Used SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402", ALC245_FIXUP_CS35L41_SPI_2). I have a chinese version, so maybe I need to use another id? How could I find out which one I need to use?

@PoSayDone
Copy link

Installed sof-firmware package and now everything works!

@JulienQNN
Copy link

The Tables modifications and Updating to Kernel: 6.3.7-arch1-1 today made everything working thanks again for this great work @lamperez

@PoSayDone
Copy link

Maybe someone familiar with contributing to kernel could submit this patch to make ux3402va also work?
https://gist.github.com/PoSayDone/ec01ba84e5aad40f229b034f6beec5d9

@ruineka
Copy link

ruineka commented Jun 15, 2023

It looks like the Asus Ally has the same missing fields....How exactly did you know what values to use?

@tghe-retford
Copy link

Thank you for the patch and @lamperez for the explanation as to what steps to take to attempt to get this to work. I have a ASUS ROG Strix G733PZ which is also missing the DSD properties. I followed the guide, created the CPIO file and booted into Arch Linux. The kernel can now see the device. I also installed sol-firmware but I still get no sound. So it will need the laptop adding to the driver's sound PCI quirk section (at this time by compiling the kernel which I haven't got round to yet due to work commitments).

To save anyone in the future the work I did, the laptop's ID for the two buses is the same as in the guide, the speakers are referred to as SPKR and the amps are on i2c so the sound PCI quirk line should be:

SND_PCI_QUIRK(0x1043, 0x1503, "ASUS ROG Strix G733PZ", ALC287_FIXUP_CS35L41_I2C_2),

I'm not familiar with submitting patches to the kernel but hopefully this helps in the investigation to get other people's speakers working.

@ruineka
Copy link

ruineka commented Jun 18, 2023

Anyone else here have i2c and have it where you won't have sound during reboots and if you do a full power restart (hold power button) then the sound will work again? Another way to get it working is to do three reboots. I suspected it was the GPIO reset but I'm not so sure.

@Moooebie
Copy link

Anyone else here have i2c and have it where you won't have sound during reboots and if you do a full power restart (hold power button) then the sound will work again? Another way to get it working is to do three reboots. I suspected it was the GPIO reset but I'm not so sure.

I have the same issue (also i2c), but not necessarily a force power off by holding the power button, but simply using the "shutdown" option in the OS is enough. If the computer is rebooted then the sound will not work, there are some errors in journalctl log but I don't really have an idea about that...

@ruineka
Copy link

ruineka commented Jun 18, 2023

Anyone else here have i2c and have it where you won't have sound during reboots and if you do a full power restart (hold power button) then the sound will work again? Another way to get it working is to do three reboots. I suspected it was the GPIO reset but I'm not so sure.

I have the same issue (also i2c), but not necessarily a force power off by holding the power button, but simply using the "shutdown" option in the OS is enough. If the computer is rebooted then the sound will not work, there are some errors in journalctl log but I don't really have an idea about that...

What errors are you getting in your log?

@Moooebie
Copy link

Moooebie commented Jun 18, 2023

Anyone else here have i2c and have it where you won't have sound during reboots and if you do a full power restart (hold power button) then the sound will work again? Another way to get it working is to do three reboots. I suspected it was the GPIO reset but I'm not so sure.

I have the same issue (also i2c), but not necessarily a force power off by holding the power button, but simply using the "shutdown" option in the OS is enough. If the computer is rebooted then the sound will not work, there are some errors in journalctl log but I don't really have an idea about that...

What errors are you getting in your log?

Like this:

Jun 18 19:53:51 mx3340-tbplus kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 I2C devices.
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Failed waiting for OTP_BOOT_DONE: -121
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.0 failed with error -121
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

@ruineka
Copy link

ruineka commented Jun 18, 2023

Anyone else here have i2c and have it where you won't have sound during reboots and if you do a full power restart (hold power button) then the sound will work again? Another way to get it working is to do three reboots. I suspected it was the GPIO reset but I'm not so sure.

I have the same issue (also i2c), but not necessarily a force power off by holding the power button, but simply using the "shutdown" option in the OS is enough. If the computer is rebooted then the sound will not work, there are some errors in journalctl log but I don't really have an idea about that...

What errors are you getting in your log?

Like this:

Jun 18 19:53:51 mx3340-tbplus kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 I2C devices.
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Failed waiting for OTP_BOOT_DONE: -121
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.0 failed with error -121
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

Oh, I fixed that. You must have this

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

to fix it do this

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

@ruineka
Copy link

ruineka commented Jun 18, 2023

I believe I just fixed the restart problem as well. I had some stuff at /etc/modprobe.d/alsa-base.conf I commented it out and rebooted and it's working now with reboot and shutdown.

@Moooebie
Copy link

Anyone else here have i2c and have it where you won't have sound during reboots and if you do a full power restart (hold power button) then the sound will work again? Another way to get it working is to do three reboots. I suspected it was the GPIO reset but I'm not so sure.

I have the same issue (also i2c), but not necessarily a force power off by holding the power button, but simply using the "shutdown" option in the OS is enough. If the computer is rebooted then the sound will not work, there are some errors in journalctl log but I don't really have an idea about that...

What errors are you getting in your log?

Like this:

Jun 18 19:53:51 mx3340-tbplus kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 I2C devices.
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Failed waiting for OTP_BOOT_DONE: -121
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.0 failed with error -121
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

Oh, I fixed that. You must have this

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

to fix it do this

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

This fixed the problem. Thanks!

@ruineka
Copy link

ruineka commented Jun 18, 2023

Anyone else here have i2c and have it where you won't have sound during reboots and if you do a full power restart (hold power button) then the sound will work again? Another way to get it working is to do three reboots. I suspected it was the GPIO reset but I'm not so sure.

I have the same issue (also i2c), but not necessarily a force power off by holding the power button, but simply using the "shutdown" option in the OS is enough. If the computer is rebooted then the sound will not work, there are some errors in journalctl log but I don't really have an idea about that...

What errors are you getting in your log?

Like this:

Jun 18 19:53:51 mx3340-tbplus kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 I2C devices.
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Failed waiting for OTP_BOOT_DONE: -121
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.0 failed with error -121
Jun 18 19:53:51 mx3340-tbplus kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

Oh, I fixed that. You must have this

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

to fix it do this

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

This fixed the problem. Thanks!

Thats great! I noticed that putting the system to sleep and waking it up breaks audio for me. Can you confirm that is the case for you too? If i can resolve this then it'll be perfect on the Asus Ally.

@lamperez
Copy link
Author

The need of changing reset-gpios for i2c devices is logical. GPIO indexes are a sequence starting from zero.

For SPI devices:

  • index 0: chip select of one of the amplifiers (cs-gpios),
  • index 1: reset of both amplifiers (reset-gpios),
  • index 2: speaker id (spk-id-gpios).

For i2c devices, the chip select is missing, and therefore you must shift the others by one:

  • index 0: reset (reset-gpios)
  • index 1: speaker id (spk-id-gpios).

The audio breaking after suspend is related to the kernel module, that is the one that should restore the original state. The ACPI just provides the information to the kernel. Maybe a missing quirk for the specific model? I dunno.

@talentlessguy
Copy link

talentlessguy commented Jun 22, 2023

Is there a general instruction how to fix the sound on Zephyrus G16 GU603VV?

I just purchased the laptop and I would like to be very careful with patching anything. Which patch should I apply? Should I modify anything? Thanks in advance

Also here's my journalctl:

juuni 22 23:42:29 Asus kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
juuni 22 23:42:29 Asus kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
juuni 22 23:42:29 Asus kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
juuni 22 23:42:29 Asus kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
juuni 22 23:42:29 Asus kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
juuni 22 23:42:29 Asus kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22

I used this patch: https://github.com/thor2002ro/asus_zenbook_ux3402za/tree/main/Sound it worked!

@phamdangtrung
Copy link

Finally got my ux3402za speakers working on linux using the ssdt solution! You guys rock!!! It spits out some acpi error on boot but speakers are working normally so I guess it's fine in the long run, I hope

@SergioASantosF
Copy link

Thank you very much to everyone involved, especially to @lamperez and @thor2002ro for providing the DSDT patch and the guide to apply it!!!! It worked perfectly on the UX3402ZA.

@cw-87-tw
Copy link

cw-87-tw commented Jul 5, 2023

@SergioASantosF What guide did you follow, I tried https://github.com/thor2002ro/asus_zenbook_ux3402za/blob/main/Sound/README.md but it doesn't work. I'm also using UX3402ZA. and I followed all the guide
When I tried to update grub, here's my output

Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Searching for custom ACPI tables in /boot
Found custom ACPI table: /boot/ssdt-csc3551.aml
Found linux image: /boot/vmlinuz-5.19.0-46-generic
Found initrd image: /boot/initrd.img-5.19.0-46-generic
Found linux image: /boot/vmlinuz-5.19.0-32-generic
Found initrd image: /boot/initrd.img-5.19.0-32-generic
Memtest86+ needs a 16-bit boot, that is not available on EFI, exiting
Warning: os-prober will be executed to detect other bootable partitions.
Its output will be used to detect bootable binaries on them and create new boot entries.
Found Windows Boot Manager on /dev/nvme0n1p1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for UEFI Firmware Settings ...
done

Is that normal?

@speedy01
Copy link

speedy01 commented Jul 5, 2023

@cw-87-tw I'm having the same issue. Please post back if you find a solutions.

@SergioASantosF
Copy link

@cw-87-tw, I followed exactly the tutorial that you also tried, using the files provided by @thor2002ro , without making any modifications, and it worked here on Debian 12, Ubuntu, and Fedora 38 (which is currently installed).

I don't know if it's because I don't have dual boot, so I didn't encounter any issues with the grub update.

Since it was my first attempt and it didn't give any errors, I won't be able to help you.

@fermino
Copy link

fermino commented Jul 5, 2023

@cw-87-tw @speedy01 that output looks completely normal (it's detecting the ACPI table and it's detecting a windows installation). What issue are you having?

@speedy01
Copy link

speedy01 commented Jul 5, 2023

@fermino the issue I'm having is "still no sound" from what I can tell, grub is not loading the custom tables. even though the entry is in the grub.cfg
sudo dmesg | grep SSDT
[ 0.015492] ACPI: SSDT 0x00000000407E3000 00740E (v02 DptfTb DptfTabl 00001000 INTL 20200717)
[ 0.015499] ACPI: SSDT 0x000000004076F000 00038C (v02 PmaxDv Pmax_Dev 00000001 INTL 20200717)
[ 0.015501] ACPI: SSDT 0x0000000040769000 005D0B (v02 CpuRef CpuSsdt 00003000 INTL 20200717)
[ 0.015503] ACPI: SSDT 0x0000000040766000 002AA1 (v02 SaSsdt SaSsdt 00003000 INTL 20200717)
[ 0.015505] ACPI: SSDT 0x0000000040762000 0033D3 (v02 INTEL IgfxSsdt 00003000 INTL 20200717)
[ 0.015508] ACPI: SSDT 0x0000000040754000 00D337 (v02 INTEL TcssSsdt 00001000 INTL 20200717)
[ 0.015516] ACPI: SSDT 0x000000004074B000 005D47 (v02 ASUS AdlP_Rvp 00001000 INTL 20200717)
[ 0.015518] ACPI: SSDT 0x0000000040749000 001F1A (v02 ASUS Ther_Rvp 00001000 INTL 20200717)
[ 0.015523] ACPI: SSDT 0x0000000040744000 002A83 (v02 ASUS PtidDevc 00001000 INTL 20200717)
[ 0.015525] ACPI: SSDT 0x0000000040741000 002357 (v02 ASUS TbtTypeC 00000000 INTL 20200717)
[ 0.015532] ACPI: SSDT 0x000000004073D000 001AC9 (v02 ASUS UsbCTabl 00001000 INTL 20200717)
[ 0.015538] ACPI: SSDT 0x0000000040739000 000B35 (v02 INTEL xh_adlLP 00000000 INTL 20200717)
[ 0.015541] ACPI: SSDT 0x0000000040735000 003AEA (v02 SocGpe SocGpe 00003000 INTL 20200717)
[ 0.015543] ACPI: SSDT 0x0000000040732000 002B2A (v02 SocCmn SocCmn 00003000 INTL 20200717)
[ 0.015545] ACPI: SSDT 0x0000000040731000 000144 (v02 Intel ADebTabl 00001000 INTL 20200717)
[ 0.015567] ACPI: Reserving SSDT table memory at [mem 0x407e3000-0x407ea40d]
[ 0.015568] ACPI: Reserving SSDT table memory at [mem 0x4076f000-0x4076f38b]
[ 0.015569] ACPI: Reserving SSDT table memory at [mem 0x40769000-0x4076ed0a]
[ 0.015569] ACPI: Reserving SSDT table memory at [mem 0x40766000-0x40768aa0]
[ 0.015570] ACPI: Reserving SSDT table memory at [mem 0x40762000-0x407653d2]
[ 0.015571] ACPI: Reserving SSDT table memory at [mem 0x40754000-0x40761336]
[ 0.015573] ACPI: Reserving SSDT table memory at [mem 0x4074b000-0x40750d46]
[ 0.015573] ACPI: Reserving SSDT table memory at [mem 0x40749000-0x4074af19]
[ 0.015574] ACPI: Reserving SSDT table memory at [mem 0x40744000-0x40746a82]
[ 0.015575] ACPI: Reserving SSDT table memory at [mem 0x40741000-0x40743356]
[ 0.015577] ACPI: Reserving SSDT table memory at [mem 0x4073d000-0x4073eac8]
[ 0.015578] ACPI: Reserving SSDT table memory at [mem 0x40739000-0x40739b34]
[ 0.015579] ACPI: Reserving SSDT table memory at [mem 0x40735000-0x40738ae9]
[ 0.015579] ACPI: Reserving SSDT table memory at [mem 0x40732000-0x40734b29]
[ 0.015580] ACPI: Reserving SSDT table memory at [mem 0x40731000-0x40731143]
[ 0.230477] ACPI: SSDT 0xFFFF972441FDE400 0001AB (v02 PmRef Cpu0Psd 00003000 INTL 20200717)
[ 0.237350] ACPI: SSDT 0xFFFF97244120A400 000394 (v02 PmRef Cpu0Cst 00003001 INTL 20200717)
[ 0.238595] ACPI: SSDT 0xFFFF97244245C000 000560 (v02 PmRef Cpu0Ist 00003000 INTL 20200717)
[ 0.239782] ACPI: SSDT 0xFFFF97244245C800 0004BA (v02 PmRef Cpu0Hwp 00003000 INTL 20200717)
[ 0.241187] ACPI: SSDT 0xFFFF972441200000 001BAF (v02 PmRef ApIst 00003000 INTL 20200717)
[ 0.242975] ACPI: SSDT 0xFFFF972441204000 001038 (v02 PmRef ApHwp 00003000 INTL 20200717)
[ 0.244470] ACPI: SSDT 0xFFFF972441206000 001349 (v02 PmRef ApPsd 00003000 INTL 20200717)
[ 0.246178] ACPI: SSDT 0xFFFF972441214000 000FBB (v02 PmRef ApCst 00003000 INTL 20200717)

@fermino
Copy link

fermino commented Jul 5, 2023

@speedy01 maybe the grub cfg is being used from another location? Try pressing e in the GRUB screen and see if the ssdt line is there (press ctrl+x in that screen to boot).

@speedy01
Copy link

speedy01 commented Jul 5, 2023

@fermino thanks for the hint. when I manually entered the command, I got an error. Turns out the secure boot is preventing grub from running acpi. A workaround for me was to disable secure boot.

this also pops up...but prob nothing.
sudo journalctl -b | grep "ACPI Error"
Jul 05 13:35:59 lx-asus kernel: ACPI Error: AE_NOT_FOUND, During name lookup/catalog (20221020/psobject-220)
Jul 05 13:35:59 lx-asus kernel: ACPI Error: AE_NOT_FOUND, During name lookup/catalog (20221020/psobject-220)
Jul 05 13:35:59 lx-asus kernel: ACPI Error: AE_NOT_FOUND, During name lookup/catalog (20221020/psobject-220)
Jul 05 13:35:59 lx-asus kernel: ACPI Error: AE_NOT_FOUND, During name lookup/catalog (20221020/psobject-220)
Jul 05 13:36:01 lx-asus kernel: ACPI Error: Aborting method _SB.PC00.LPCB.H_EC.TFN1._FST due to previous error (AE_NOT_FOUND) (20221020/psparse-529

@fermino
Copy link

fermino commented Jul 5, 2023

@speedy01 awesome! Did it work?

@speedy01
Copy link

speedy01 commented Jul 5, 2023

@fermino yes..disabling secure boot allowed grub to load custom table. I have sound! :)

@cw-87-tw
Copy link

cw-87-tw commented Jul 5, 2023

@fermino yes..disabling secure boot allowed grub to load custom table. I have sound! :)

Thank you so much, it finally worked after I turned off secure boot

@amarkezic
Copy link

amarkezic commented Jul 19, 2023

Just got a new laptop, the asus ux5304v and to no surprise (after reading this thread) the audio doesn't work (just the speakers don't). Did anyone here try to apply the patch to this specific device ?

Another question i have is will this get overwritten if there is a BIOS update?
Does asus even push firmware updates for linux devices (like DELL does) or do i need to dualboot windows for the firmware updates (or if i don't want to dual boot, apply them manually myself)?

P.S. I am quite a linux newbie especially when it comes to this level of customization (BIOS level) and am not really keen into giving so much time to just have a working machine

Thank in advance

@thor2002ro
Copy link

Asus just doesn't care at all....
Might need some adjustment on bios update... But doubt asus will release another bios.... They usually release 2-3 bios-es at launch the forget about it

@amarkezic
Copy link

amarkezic commented Jul 19, 2023

Asus just doesn't care at all.... Might need some adjustment on bios update... But doubt asus will release another bios.... They usually release 2-3 bios-es at launch the forget about it

Yea its a real shame, in the end i opted for windows and WSL for this device (becauseit's a work pc). With the XPS 15 i had the best experience on linux it worked event better than on windows.

Thank you anyway

@phptek
Copy link

phptek commented Jul 21, 2023

I've done about as much as I can, but still can't get this to work :-(

  • Problem: Headphone Sound: OK. Speaker Sound: FAIL
  • Model: Asus Zenbook S 13 UX5304VA_UX5304VA
  • O/S: Ubuntu 22.04.2
  • Dual Boot: No (But the machine came with Win11 which I blew away with Ubuntu the first chance I got)
  • Secure Boot: Disabled
  • Fastboot: Disabled
  • BIOS Version: 304 (Machine came with 300, I upgraded after the fact)
  • Kernel version: 5.19.0-46-generic
  • I tried @thor2002ro 's patch, rebooted - still no sound. Noticed what appears to be a typo in DefinitionBlock ("CS3551" vs "CSC3551"), recompiled, reboot, still nothing.
  • Output of journalctl -b -g CSC3551:
Jul 21 13:29:14 marmadukeIII kernel: ACPI: SSDT 0x000000004841AD76 0001A7 (v01 CUSTOM CSC3551  0000300A INTL 20200925)
Jul 21 13:29:15 marmadukeIII kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
Jul 21 13:29:15 marmadukeIII kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported -22
Jul 21 13:29:15 marmadukeIII kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
Jul 21 13:29:15 marmadukeIII kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported -22
Jul 21 13:29:15 marmadukeIII kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22

Questions/Comments:

In the patch from @thor2002ro what does the hex number "0x0000300A" refer to? Is it a BIOS version string? I was naively thinking to tweak it to "0x0000304A" to suit my BIOs version, but haven't done it yet. This machine is brand new and am not quite ready to brick it yet!

Does anyone have any other ideas?

@phamdangtrung
Copy link

I've done about as much as I can, but still can't get this to work :-(

  • Problem: Headphone Sound: OK. Speaker Sound: FAIL
  • Model: Asus Zenbook S 13 UX5304VA_UX5304VA
  • O/S: Ubuntu 22.04.2
  • Dual Boot: No (But the machine came with Win11 which I blew away with Ubuntu the first chance I got)
  • Secure Boot: Disabled
  • Fastboot: Disabled
  • BIOS Version: 304 (Machine came with 300, I upgraded after the fact)
  • Kernel version: 5.19.0-46-generic
  • I tried @thor2002ro 's patch, rebooted - still no sound. Noticed what appears to be a typo in DefinitionBlock ("CS3551" vs "CSC3551"), recompiled, reboot, still nothing.
  • Output of journalctl -b -g CSC3551:
Jul 21 13:29:14 marmadukeIII kernel: ACPI: SSDT 0x000000004841AD76 0001A7 (v01 CUSTOM CSC3551  0000300A INTL 20200925)
Jul 21 13:29:15 marmadukeIII kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
Jul 21 13:29:15 marmadukeIII kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported -22
Jul 21 13:29:15 marmadukeIII kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
Jul 21 13:29:15 marmadukeIII kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported -22
Jul 21 13:29:15 marmadukeIII kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22

Questions/Comments:

In the patch from @thor2002ro what does the hex number "0x0000300A" refer to? Is it a BIOS version string? I was naively thinking to tweak it to "0x0000304A" to suit my BIOs version, but haven't done it yet. This machine is brand new and am not quite ready to brick it yet!

Does anyone have any other ideas?

Compile a newer version of linux kernel (> 6.1). I'm using linux mint 21.2 with kernel 6.3.9.
5.19 is way too old and doesn't include cs35l41 firmware. After booting up linux with the new kernel, follow this https://github.com/thor2002ro/asus_zenbook_ux3402za.
My ux3402za's speaker is working properly for me.
Note that the compilation process may take 1-2 hours

@phptek
Copy link

phptek commented Jul 21, 2023

@phamdangtrung Thanks. I was afraid I'd need to do this. Long time Linux user, first-time compiling a new kernel. What are the dangers of doing this, if any?

Thank you :-)

@phamdangtrung
Copy link

@phamdangtrung Thanks. I was afraid I'd need to do this. Long time Linux user, first-time compiling a new kernel. What are the dangers of doing this, if any?

Thank you :-)

Nothing actually, but I do recommend backing up your important files first. I got some issue with initramfs after booting up with the new kernel so I used the old kernel and ran the following command
sudo make modules_install INSTALL_MOD_STRIP=1

@phptek
Copy link

phptek commented Jul 21, 2023

I got an initramfs issue too while it waited for my encrypted drive. Couldn't get passed that point. Had to revert to old kernel. sudo make modules_install produces a make error. No matter, I'll keep on with it and post back my findings.

@thierry-carron
Copy link

thank you very much, works fine for me :)
I will report solution onto asus forum.

@badger-ua
Copy link

badger-ua commented Jul 24, 2023

@lamperez @Moooebie
Hello, tried the following patch:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00001000)
{

    External (_SB_.PC00.SPI0, DeviceObj)
    External (_SB_.PC00.SPI0.SPK1, DeviceObj)

    Scope (_SB.PC00.SPI0.SPK1)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cirrus,dev-index", Package () { Zero, One }},
                        Package () { "reset-gpios", Package () {
                           SPK1, One, Zero, Zero,
                           SPK1, One, Zero, Zero
                        } },
                        Package () { "spk-id-gpios", Package () {
                             SPK1, 0x02, Zero, Zero,
                             SPK1, 0x02, Zero, Zero,
                        } },
                        Package () { "cirrus,speaker-position", Package () { Zero, One } },
                        Package () { "cirrus,gpio1-func", Package () { One, One } },
                        Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                        // boost-type: 0 internal, 1 external
                        Package () { "cirrus,boost-type", Package () { One, One } },
                        // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                        //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                        // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                        //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                        // boost-cap-microfarad: rounded to the nearest integer
                        //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
                    }
                }) /* \_SB_.PC00.SPI0.SPK1._DSD */
        }
    }

    Scope (_SB.PC00.SPI0)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cs-gpios", Package () { 
                            Zero,                    // Native CS
                            SPK1, Zero, Zero, Zero   // GPIO CS
                        } }
                    }
                }) /* \_SB_.PC00.SPI0.SPK1._DSD */
        }
    }
}

sudo dmesg | grep SSDT output is seems to be correct I have the line with patch:
[ 0.015531] ACPI: SSDT 0x0000000047E01D76 0001A7 (v01 CUSTOM CSC3551 00001000 INTL 20200925)
but the outpu of: sudo journalctl -b -g CSC3551 still is:

Jul 24 12:43:53 zenbook-pop-os kernel: ACPI: SSDT 0x0000000047E01D76 0001A7 (v01 CUSTOM CSC3551  00001000 INTL 20200925)
Jul 24 12:43:53 zenbook-pop-os kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
Jul 24 12:43:54 zenbook-pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
Jul 24 12:43:54 zenbook-pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
Jul 24 12:43:54 zenbook-pop-os kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
Jul 24 12:43:54 zenbook-pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
Jul 24 12:43:54 zenbook-pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
Jul 24 12:43:54 zenbook-pop-os kernel: cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22

I also tried to extract dsdt.dat by your guide: https://gist.github.com/lamperez/d5b385bc0c0c04928211e297a69f32d7 and dsdt.dsl has nothing CSC3551 related in that file

Device: asus_zenbook_s13_ux5304va
My kernel is: 6.2.6-76060206-generic
Dual Boot: No
Secure Boot: Disabled
Fastboot: Disabled
BIOS Version: 304

I'm assuming I need to modify the patch itself somehow?

P.S: Begging for help 😸

@thor2002ro
Copy link

It won't work on a different models kernel it needs to be adapted and also you have to look it the kernel is patched for you model the quirk is applied based on sound card id

@badger-ua
Copy link

badger-ua commented Jul 24, 2023

It won't work on a different models kernel it needs to be adapted and also you have to look it the kernel is patched for you model the quirk is applied based on sound card id

got it, I'll try to build kernel from sources then with my model included as @Moooebie wrote in his guide, s13 and 14 zenbooks are pretty much the same I had a hope that it will work without kernel patches, I created a working dsl patch (by modifiing depackaged dsdt.dat) via: https://gist.github.com/lamperez/d5b385bc0c0c04928211e297a69f32d7

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000002)
{
    External (_SB_.GPI0, DeviceObj)
    External (_SB_.PC00.SPI1, DeviceObj)

    Scope (\_SB.PC00.SPI1)
    {
        Device (SPK1)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "104316D3")  // _SUB: Subsystem ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (SBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0017
                        }
                    GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0131
                        }
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012E
                        }
                    GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                    GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                })
                Return (SBUF) /* \_SB_.PC00.SPI1.SPK1._CRS.SBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x0F)
            }

            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }

            Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
            {
                Return (Package ()
                    {
                        ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                        Package ()
                        {
                            Package () { "cirrus,dev-index", Package () { Zero, One }},
                            Package () { "reset-gpios", Package () {
                            SPK1, One, Zero, Zero,
                            SPK1, One, Zero, Zero
                            } },
                            Package () { "spk-id-gpios", Package () {
                                SPK1, 0x02, Zero, Zero,
                                SPK1, 0x02, Zero, Zero,
                            } },
                            Package () { "cirrus,speaker-position", Package () { Zero, One } },
                            Package () { "cirrus,gpio1-func", Package () { One, One } },
                            Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                            // boost-type: 0 internal, 1 external
                            Package () { "cirrus,boost-type", Package () { One, One } },
                            // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                            //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                            // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                            //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                            // boost-cap-microfarad: rounded to the nearest integer
                            //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
                        }
                    }) /* \_SB_.PC00.SPI0.SPK1._DSD */
            }
        }

        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cs-gpios", Package () { 
                            Zero,                    // Native CS
                            SPK1, Zero, Zero, Zero   // GPIO CS
                        } }
                    }
                }) /* \_SB_.PC00.SPI0.SPK1._DSD */
        }
    }
}

at least the sudo journalctl -b -g CSC3551 outputs no errors but still no sound, going after kernel then, if that will be successful I'll upload a source code for my model to git, but the question that comes in mind, that to make users life easier just by appling patch without kernel modification as you mentioned my device SND_PCI_QUIRK(0x1043, 0x16d3, "ASUS UX5304VA", ALC245_FIXUP_CS35L41_SPI_2), should be included in kernel, I've never done the kernel modification before, if I'm modifying ubuntus kernel I have to find the kernel sources on ubuntu git and submit a pr?

@badger-ua
Copy link

I have a good news and bad news, good one is that patching kernel done the job, I've got the sound thatnks a lot for guides @lamperez @Moooebie @thor2002ro but with custom kernel wifi module is missing now 😸

@badger-ua
Copy link

wifi is working, just installation of kernel went wrong.
2 new issues I'm trying to solve will keep everyone here updated:

  1. When laptop goes to sleep, speakers doesn't work after wake up
  2. Since speakers are harman kardon branded sound on linux is complete crap comparing to windows, trying to bring some quality back with Easy Effects package but so far no luck.

@fermino
Copy link

fermino commented Jul 24, 2023

@badger-lviv-ua the first problem could be related to your sound server, does the 3.5mm output work after suspending and waking it up?

@badger-ua
Copy link

@badger-lviv-ua the first problem could be related to your sound server, does the 3.5mm output work after suspending and waking it up?

@fermino actually yes 3.5mm works, actually very strange behavior scenarious:

  • if laptop suspend with no sound playing, after laptop awake - speakers sound works
  • if laptop suspend with music playing, after laptop awake - speakers sound doesn't work, but if I inject 3.5mm headphones and unplug them sound is back from speakers

@badger-ua
Copy link

badger-ua commented Jul 24, 2023

Uploaded a patch for asus_zenbook_ux5304va

Special thanks

Author Description
lamperez For ACPI DSDT/SSDT patching guides and tools
Moooebie For ACPI DSDT/SSDT patching guide
thor2002ro For GRUB patch for similar laptop

Warning: patch doesnt work without kernel modification (described in repo readme)

@thor2002ro
Copy link

thor2002ro commented Jul 24, 2023

Try to disable the sound card realtek power saving on my model it tries to save power very aggressively and after a while all audio sounds werid like all highes and not mids and lows this seams to fix it not sure if it's placebo yet.... It's probably related to the fact that the speakers are separate from the card and are on the spi bus

@badger-ua
Copy link

Thanks for the hint @thor2002ro will try that 🤝

@psxpaul
Copy link

psxpaul commented Jul 28, 2023

I have a Dell XPS 15 9530 that seems to have the same CS35L41 amplifier and resulting ACPI _DSD Properties are missing for HID CSC3551 dmesg error. I've tried everything suggested here and this wiki, but it looks like the kernel module is attempting to load more firmware files than the Dell drivers provide. I figured out that if I omit spk-id-gpios from the ssdt patch, it attempts to load the correct firmware files, but it takes several minutes and the sounds doesn't seem improved.

Can someone tell me what some of these properties in the ssdt patch do, or how I can determine the correct values for my hardware?

@talentlessguy
Copy link

talentlessguy commented Jul 28, 2023

I uninstalled the patch since it was for another model, and tried to follow this guide to patch it myself.

dsdt.dsl values are:


    Scope (_SB.PC00.SPI0)
    {
        Device (SPK1)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "10431483")  // _SUB: Subsystem ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (SBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI0",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI0",
                        0x00, ResourceConsumer, , Exclusive,
                        )
// ...

Mine looks like this:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB.PC00.SPI0, DeviceObj)
    External (_SB.PC00.SPI0.SPK1, DeviceObj)

    Scope (_SB.PC00.SPI0.SPK1)
    {
        Name (_DSD, Package ()   // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { Zero, One }},
                Package () { "reset-gpios", Package () {
					SPK1, Zero, Zero, Zero,
					SPK1, Zero, Zero, Zero,
                } },
                Package () { "spk-id-gpios", Package () {
					SPK1, 0x02, Zero, Zero,
					SPK1, 0x02, Zero, Zero,
                } },
                Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func",           Package () { One, One } },
                Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type",           Package () { One, One } },
            },
        })
    }
}

and I'm still having sound issues and this is what I have in dmesg:

[    0.008832] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.008833] ACPI: SSDT 0x000000003652F000 000158 (v01 CUSTOM CSC3551  00000001 INTL 20221020)
[    5.220022] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Failed waiting for OTP_BOOT_DONE: -110
[    5.230196] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -110
[    5.335631] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Failed waiting for OTP_BOOT_DONE: -110
[    5.346835] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -110
[    5.346854] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.

Kernel: 6.4.6-arch1-1-g14
BIOS Version: 301
Laptop: ROG Zephyrus G16 GU603VV_GU603VV

@psxpaul
Copy link

psxpaul commented Jul 30, 2023

I think the OTP_BOOT_DONE error is from not having the cs-gpios for SPI devices

@pczekalski
Copy link

pczekalski commented Aug 5, 2023

Hi Guys, I'm just with a new machine (ASUS ROG Flow Z13 model GZ301VU) trying to make sound working. Obviously, as in the other cases it works with 3.5jack but speakers are silent.
I'm on Ubuntu 23.04, GRUB.
Once installed kernel 6.4.6 and modified: /etc/modprobe.d/alsa-base.conf as described here: look for "Kernel Patch" section + disabling post BIOS sound (during ROG logo), I made it to enables speakers, but they work only with tweeters. Sound is very shallow, so I believe amps are not working. There are still errors in the dmesg, it acknowledges, it does not work as expected:

[    2.104866] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
.....
[    2.193187] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    2.193211] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[    2.193226] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[    2.198675] Intel(R) Wireless WiFi driver for Linux
[    2.198789] iwlwifi 0000:00:14.3: enabling device (0000 -> 0002)
[    2.204499] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    2.204517] asus-nb-wmi asus-nb-wmi: Using throttle_thermal_policy for platform_profile support
[    2.204519] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[    2.204532] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22

Once dumping all ACPI I found CSC3551 in ssdt16.dsl:

/*
 * Intel ACPI Component Architecture
 * AML/ASL+ Disassembler version 20200925 (64-bit version)
 * Copyright (c) 2000 - 2020 Intel Corporation
 * 
 * Disassembling to symbolic ASL+ operators
 *
 * Disassembly of ssdt16.dat, Fri Aug  4 20:43:15 2023
 *
 * Original Table Header:
 *     Signature        "SSDT"
 *     Length           0x000001A4 (420)
 *     Revision         0x01
 *     Checksum         0x0C
 *     OEM ID           "_ASUS_"
 *     OEM Table ID     "SPKRAMPS"
 *     OEM Revision     0x00000002 (2)
 *     Compiler ID      "INTL"
 *     Compiler Version 0x20200717 (538969879)
 */
DefinitionBlock ("", "SSDT", 1, "_ASUS_", "SPKRAMPS", 0x00000002)
{
    External (_SB_.GPI0, DeviceObj)
    External (_SB_.PC00.SPI1, DeviceObj)

    Scope (\_SB.PC00.SPI1)
    {
        Device (SPK1)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "10431573")  // _SUB: Subsystem ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (SBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0017
                        }
                    GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0131
                        }
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012E
                        }
                    GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                    GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                })
                Return (SBUF) /* \_SB_.PC00.SPI1.SPK1._CRS.SBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x0F)
            }

            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }
        }
    }
}

I understand then, my Cirrus amps are driven by SPI1?

Is there any ready patch for this config?

Thanks for any help,

P.

@wrighterase
Copy link

Uploaded a patch for asus_zenbook_ux5304va

Special thanks

Author Description
lamperez For ACPI DSDT/SSDT patching guides and tools
Moooebie For ACPI DSDT/SSDT patching guide
thor2002ro For GRUB patch for similar laptop

Warning: patch doesnt work without kernel modification (described in repo readme)

i had similar success on a 2023 Asus Zenbook Pro 14 UX6404VV. it required kernel patching as well as a patched dsl, but the sound is so terrible the effort doesnt even feel worth it.
when it comes to step 2 in this patch repo for the ux3504va the entry is as follows:
SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VV", ALC245_FIXUP_CS35L41_SPI_2)

i've had very mixed results with this particular model and things working, but Ubuntu 23.04 seems to be the best starting point and manually compiling the iwlwifi driver instead of using apt

i'll clone this repo and modify it for the UX6404VV in the next day or so.

@wrighterase
Copy link

Hi Guys, I'm just with a new machine (ASUS ROG Flow Z13 model GZ301VU) trying to make sound working. Obviously, as in the other cases it works with 3.5jack but speakers are silent. I'm on Ubuntu 23.04, GRUB. Once installed kernel 6.4.6 and modified: /etc/modprobe.d/alsa-base.conf as described here: look for "Kernel Patch" section + disabling post BIOS sound (during ROG logo), I made it to enables speakers, but they work only with tweeters. Sound is very shallow, so I believe amps are not working. There are still errors in the dmesg, it acknowledges, it does not work as expected:

[    2.104866] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
.....
[    2.193187] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    2.193211] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[    2.193226] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[    2.198675] Intel(R) Wireless WiFi driver for Linux
[    2.198789] iwlwifi 0000:00:14.3: enabling device (0000 -> 0002)
[    2.204499] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    2.204517] asus-nb-wmi asus-nb-wmi: Using throttle_thermal_policy for platform_profile support
[    2.204519] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[    2.204532] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22

Once dumping all ACPI I found CSC3551 in ssdt16.dsl:

/*
 * Intel ACPI Component Architecture
 * AML/ASL+ Disassembler version 20200925 (64-bit version)
 * Copyright (c) 2000 - 2020 Intel Corporation
 * 
 * Disassembling to symbolic ASL+ operators
 *
 * Disassembly of ssdt16.dat, Fri Aug  4 20:43:15 2023
 *
 * Original Table Header:
 *     Signature        "SSDT"
 *     Length           0x000001A4 (420)
 *     Revision         0x01
 *     Checksum         0x0C
 *     OEM ID           "_ASUS_"
 *     OEM Table ID     "SPKRAMPS"
 *     OEM Revision     0x00000002 (2)
 *     Compiler ID      "INTL"
 *     Compiler Version 0x20200717 (538969879)
 */
DefinitionBlock ("", "SSDT", 1, "_ASUS_", "SPKRAMPS", 0x00000002)
{
    External (_SB_.GPI0, DeviceObj)
    External (_SB_.PC00.SPI1, DeviceObj)

    Scope (\_SB.PC00.SPI1)
    {
        Device (SPK1)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "10431573")  // _SUB: Subsystem ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (SBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0017
                        }
                    GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0131
                        }
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012E
                        }
                    GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                    GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                })
                Return (SBUF) /* \_SB_.PC00.SPI1.SPK1._CRS.SBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x0F)
            }

            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }
        }
    }
}

I understand then, my Cirrus amps are driven by SPI1?

Is there any ready patch for this config?

Thanks for any help,

P.

you'll need to include the _DSD section. example and also patch the kernel.

in my last test case the dsl example i used was this: https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff?permalink_comment_id=4600010#file-ssdt_csc3551-dsl

this guide helps understand whats happening: https://asus-linux.org/wiki/cirrus-amps/

@pczekalski
Copy link

pczekalski commented Aug 5, 2023

@wrighterase
Thanks for your support.
I made following steps:

  1. Created DSD patch as follows:
DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000002)
{
    External (_SB_.PC00.SPI1, DeviceObj)
    External (_SB_.PC00.SPI1.SPK1, DeviceObj)

    Scope (_SB.PC00.SPI1.SPK1)
    {
        Name (_DSD, Package ()   // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { Zero, One }},
                Package () { "reset-gpios", Package () {
					SPK1, One, Zero, Zero,
					SPK1, One, Zero, Zero,
                } },
                Package () { "spk-id-gpios", Package () {
					SPK1, 0x02, Zero, Zero,
					SPK1, 0x02, Zero, Zero,
                } },
                Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func",           Package () { One, One } },
                Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type",           Package () { One, One } },
            },
        })
    }
    Scope (_SB.PC00.SPI1)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cs-gpios", Package () { 
                    Zero,                    // Native CS
                    SPK1, Zero, Zero, Zero   // GPIO CS
                } }
            }
        })
    }
}
  1. Assembled, injected cpio via GRUB,
  2. Copied firmware as instructed in https://gitlab.com/asus-linux/firmware
  3. Rebooted

Now all dmesg errors are gone but there are no DSP sections as other users reported:

[    0.009652] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.009653] ACPI: SSDT 0x000000005CE44000 0001A0 (v01 CUSTOM CSC3551  00000002 INTL 20200925)
...
[    2.045277] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[    2.186891] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[    2.188875] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    2.235591] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

There is also no report on loading firmware.

Now there is no sound at all :(

Did I miss any steps?

@tejassp919
Copy link

tejassp919 commented Aug 5, 2023

The new SSDT patch has made sound better for my asus m16 G604, but its still not up to the mark as system is using default cirrus firmware. Am using latest provided SSDT patch and appropriate cirrus firmware for my laptop as per asus-linux blog on this

journalctl -b -g CSC3551 --output short-monotonic
[    0.009924] pop-os kernel: ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.009926] pop-os kernel: ACPI: SSDT 0x0000000036AD6000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20200925)
[    3.601585] pop-os kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[    3.914772] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[    3.915223] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    3.946798] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[    3.951124] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Falling back to default firmware.
[    3.951519] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[    3.951521] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[    4.012307] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[    4.012871] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: 0: ID cd v29.78.0 XM@94 YM@e
[    4.012876] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: 1: ID f20b v0.1.0 XM@17c YM@0
[    4.012880] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: spk-prot: e:\workspace\workspace\tibranch_release_playback_6.76_2\ormis\staging\default_>
[    4.025695] pop-os kernel: snd_hda_codec_realtek hdaudioC0D0: bound spi1-CSC3551:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[    4.025844] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Falling back to default firmware.
[    4.025978] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: Firmware version: 3
[    4.025979] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[    4.087102] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[    4.087757] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: 0: ID cd v29.78.0 XM@94 YM@e
[    4.087764] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: 1: ID f20b v0.1.0 XM@17c YM@0
[    4.087769] pop-os kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: DSP1: spk-prot: e:\workspace\workspace\tibranch_release_playback_6.76_2\ormis\staging\default_>
[    4.105604] pop-os kernel: snd_hda_codec_realtek hdaudioC0D0: bound spi1-CSC3551:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
cat dsdt.dsl | grep -A 1 "CSC3551"
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "10431473")  // _SUB: Subsystem ID

ls /lib/firmware/cirrus/ | grep 10431473
cs35l41-dsp1-spk-cali-10431473-spkid0-l0.bin
cs35l41-dsp1-spk-cali-10431473-spkid0-r0.bin
cs35l41-dsp1-spk-prot-10431473-spkid0-l0.bin
cs35l41-dsp1-spk-prot-10431473-spkid0-r0.bin

@wrighterase
Copy link

@wrighterase Thanks for your support. I made following steps:

  1. Created DSD patch as follows:
DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000002)
{
    External (_SB_.PC00.SPI1, DeviceObj)
    External (_SB_.PC00.SPI1.SPK1, DeviceObj)

    Scope (_SB.PC00.SPI1.SPK1)
    {
        Name (_DSD, Package ()   // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { Zero, One }},
                Package () { "reset-gpios", Package () {
					SPK1, One, Zero, Zero,
					SPK1, One, Zero, Zero,
                } },
                Package () { "spk-id-gpios", Package () {
					SPK1, 0x02, Zero, Zero,
					SPK1, 0x02, Zero, Zero,
                } },
                Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func",           Package () { One, One } },
                Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type",           Package () { One, One } },
            },
        })
    }
    Scope (_SB.PC00.SPI1)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cs-gpios", Package () { 
                    Zero,                    // Native CS
                    SPK1, Zero, Zero, Zero   // GPIO CS
                } }
            }
        })
    }
}
  1. Assembled, injected cpio via GRUB,
  2. Copied firmware as instructed in https://gitlab.com/asus-linux/firmware
  3. Rebooted

Now all dmesg errors are gone but there are no DSP sections as other users reported:

[    0.009652] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.009653] ACPI: SSDT 0x000000005CE44000 0001A0 (v01 CUSTOM CSC3551  00000002 INTL 20200925)
...
[    2.045277] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[    2.186891] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[    2.188875] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    2.235591] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

There is also no report on loading firmware.

Now there is no sound at all :(

Did I miss any steps?

thats partial success. when i got the same logs as you now have, i needed to then patch the kernel. you can use @badger-lviv-ua repo here to get that part done as it mostly outlines whats required.

you'll need to pull the kernel source with apt-get source (this link may help you: https://wiki.ubuntu.com/Kernel/BuildYourOwnKernel) and then patch sound/pci/hda/patch_realtek.c with something like this: SND_PCI_QUIRK(0x1043, 0x1863, "ASUS UX6404VV", ALC245_FIXUP_CS35L41_SPI_2) where 0x1043 is the SubVendor id and 0x1863 is the SubDevice id. these can be found using lspci and then using the PCI device name with hwinfo to find them. in my case as an example...
lspci shows Multimedia audio controller
hwinfo | grep "Multimedia audio controller" -A 10

44: PCI 1f.3: 0401 Multimedia audio controller
  [Created at pci.386]
  Unique ID: nS1_.1h_x0r_Xh66
  SysFS ID: /devices/pci0000:00/0000:00:1f.3
  SysFS BusID: 0000:00:1f.3
  Hardware Class: sound
  Model: "Intel Multimedia audio controller"
  Vendor: pci 0x8086 "Intel Corporation"
  Device: pci 0x51ca 
  SubVendor: pci 0x1043 "ASUSTeK Computer Inc."
  SubDevice: pci 0x1863 
  Revision: 0x01
  Driver: "sof-audio-pci-intel-tgl"
  Driver Modules: "snd_sof_pci_intel_tgl"
  Memory Range: 0x622d1a0000-0x622d1a3fff (rw,non-prefetchable)
  Memory Range: 0x622d000000-0x622d0fffff (rw,non-prefetchable)
  IRQ: 189 (2426 events)

hope this helps.

@lal12
Copy link

lal12 commented Aug 6, 2023

For anyone having issues with the ASUS ROG STRIX G17 (2023) G713PV:

I've used the following dsl patch:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB_.I2CD, DeviceObj)
    External (_SB_.I2CD.SPKR, DeviceObj)

    Scope (_SB.I2CD.SPKR)
    {
        Name (_DSD, Package ()   // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                Package () { "reset-gpios", Package () {
                   SPKR, Zero, Zero, Zero,
                   SPKR, Zero, Zero, Zero,
                } },
                Package () { "spk-id-gpios", Package () {
                   SPKR, 0x02, Zero, Zero,
                   SPKR, 0x02, Zero, Zero,
                } },
                Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func",           Package () { One, One } },
                Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type",           Package () { One, One } },
            },
        })
    }
}

The following works with grub:
Compile it with: iasl -tc speaker_amplifier_fix_patch.dsl, copy the resulting speaker_amplifier_fix_patch.aml file file to the boot partition (mostly /boot). Then add the entry acpi speaker_amplifier_fix_patch.aml to the grub config, e.g. to the /etc/grub.d/40_custom file. Don't forget to regenerate your grub config (sudo grub-mkconfig -o /boot/grub/grub.cfg on Arch).

You also need the newest linux-firmware version (20230804) (on arch as of writing only available via AUR linux-firmware-git).
Also the newest kernel version (6.4.8) is necessary.

It is possible to get it working with older kernel by adding some modprobe options to snd-hda-intel, but I don't know which exactly.
Instead of using the newest linux-firmware you can also create links to all files in /lib/firmware/cirrus containing -10431503- by replacing it with -10431d1f-, e.g. cs35l41-dsp1-spk-prot-10431d1f-spkid0-l0.bin -> cs35l41-dsp1-spk-prot-10431503-spkid0-l0.bin

Thanks to this gist and the information in https://asus-linux.org/wiki/cirrus-amps/#create-the-ssdt-patch

@Lumi571
Copy link

Lumi571 commented Aug 13, 2023

Hi. 🙂

A friend of mine recently bought an Asus Zenbook 15 UM3504DA laptop (2023) and installed Fedora Workstation 38 (currently Linux kernel 6.4.8). Unfortunately, the system is unable to produce sound via the built-in speakers. However, speakers connected via jack or Bluetooth provide a functional audio output.

We followed the tutorial at https://asus-linux.org/wiki/cirrus-amps/. (Many thanks to its creators!)
We installed the following SSDT patch:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB_.I2CB, DeviceObj)
    External (_SB_.I2CB.SPKR, DeviceObj)

    Scope (_SB.I2CB.SPKR)
    {
        Name (_DSD, Package ()   // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                Package () { "reset-gpios", Package () {
					SPKR, Zero, Zero, Zero,
					SPKR, Zero, Zero, Zero,
                } },
                Package () { "spk-id-gpios", Package () {
					SPKR, 0x02, Zero, Zero,
					SPKR, 0x02, Zero, Zero,
                } },
                Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func",           Package () { One, One } },
                Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type",           Package () { One, One } },
            },
        })
    }
}

And we installed the 104318d3 firmwares from https://gitlab.com/asus-linux/firmware/-/tree/main/cirrus:

$ ls /lib/firmware/cirrus/ | grep 104318d3
cs35l41-dsp1-spk-cali-104318d3-spkid1-l0.bin
cs35l41-dsp1-spk-cali-104318d3-spkid1-r0.bin
cs35l41-dsp1-spk-prot-104318d3-spkid1-l0.bin
cs35l41-dsp1-spk-prot-104318d3-spkid1-r0.bin

This gave the system speaker recognition, as I understand it:

$ dmesg |grep CSC3551
[    0.003682] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.003683] ACPI: SSDT 0x00000000B9BD5000 00014D (v01 CUSTOM CSC3551  00000001 INTL 20220331)
[   27.685077] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 I2C devices.
[   27.911686] cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[   27.912587] cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[   27.954205] cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

However, the sound is still not working on his computer and it seems to me that some lines are missing in the command return above. Is it necessary to patch and compile the Linux kernel to enable sound to work, even on the latest versions of the Fedora kernel (6.4.8)? Or do we need to do other things to do this?

Thank you for taking the time to read my message. 🪷

@v-gu
Copy link

v-gu commented Aug 17, 2023

Hey guys, I have a G634JZ (Rog Strix Scar 16 2023), using following ssdt(dsdt shows SPI3 and SPK1):

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB_.PC00.SPI3, DeviceObj)
    External (_SB_.PC00.SPI3.SPK1, DeviceObj)

    Scope (_SB.PC00.SPI3.SPK1)
    {
        Name (_DSD, Package ()   // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { Zero, One }},
                Package () { "reset-gpios", Package () {
                                        SPK1, Zero, Zero, Zero,
                                        SPK1, Zero, Zero, Zero,
                } },
                Package () { "spk-id-gpios", Package () {
                                        SPK1, 0x02, Zero, Zero,
                                        SPK1, 0x02, Zero, Zero,
                } },
                Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func",           Package () { One, One } },
                Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type",           Package () { One, One } },
            },
        })
    }

    Scope (_SB.PC00.SPI3)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cs-gpios", Package () {
                    Zero,                    // Native CS
                    SPK1, Zero, Zero, Zero   // GPIO CS
                } }
            }
        })
    }
}

The dmesg shows:

λ sudo dmesg|grep CSC3551
[    0.018409] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.018410] ACPI: SSDT 0x0000000039A7D000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20221020)
[    5.780873] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Reset line busy, assuming shared reset
[    5.884861] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Failed waiting for OTP_BOOT_DONE: -110
[    5.897583] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -110
[    5.899702] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    6.003547] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Failed waiting for OTP_BOOT_DONE: -110
[    6.024392] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -110
[    6.024574] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.

The kernel patch of this device (1043:1caf) seems in the linux-g14 kernel patch code, which I'm using.

So anyone happened to fix the OTP_BOOT_DONE?

@pczekalski
Copy link

pczekalski commented Aug 22, 2023

Apologies for the delay in communication, I was away.
So I need to compile kernel, anyway?
I'm trying to follow the links you've shared (thanks @wrighterase) but I'm stuck with obtaining building dependencies for a kernel. To be clear, I've updated Ubuntu 22.04 kernel to the version 6.46 (using Mainline Kernels App):
$ sudo apt-get build-dep linux linux-image-$(uname -r) Reading package lists... Done E: Unable to find a source package for linux-image-6.4.6-060406-generic
--EDIT--
Meanwhile, I found sub-ids:

57: PCI 05.0: 0480 Multimedia controller
  [Created at pci.386]
  Unique ID: CvwD.Dtjiosnz0WC
  SysFS ID: /devices/pci0000:00/0000:00:05.0
  SysFS BusID: 0000:00:05.0
  Hardware Class: unknown
  Model: "Intel Multimedia controller"
  Vendor: pci 0x8086 "Intel Corporation"
  Device: pci 0xa75d 
  SubVendor: pci 0x1043 "ASUSTeK Computer Inc."
  SubDevice: pci 0x1573 
  Memory Range: 0x682e000000-0x682effffff (rw,non-prefetchable,disabled)
  IRQ: 255 (no events)
  Module Alias: "pci:v00008086d0000A75Dsv00001043sd00001573bc04sc80i00"
  Config Status: cfg=new, avail=yes, need=no, active=unknown

So, the correct patch in the sound/pci/hda/patch_realtek.c would be then:
SND_PCI_QUIRK(0x1043, 0x1573, "ASUS GZ301VU.306", ALC245_FIXUP_CS35L41_SPI_2),?
Just wonder, my soundcard seems to be on SPI1, not SPI2 (as in the patch, but there is no SPI1)...

Any help appreciated.

@flukejones
Copy link

flukejones commented Aug 23, 2023

For everyone ending up here through a boogle search, please see my guide (built from everything here) https://asus-linux.org/wiki/cirrus-amps/ for more info.

I have been pushing Cirrus devs to create proper solutions, and so far we have a patch merged by Taki, and I've submitted a new patch to finish enabling ASUS amps. The info is at the top of the article to be clear.

EDIT

I am now working on new patch

@flukejones
Copy link

flukejones commented Aug 23, 2023

Requires also https://lore.kernel.org/all/20230815161033.3519-1-sbinding@opensource.cirrus.com/

From 7eab52145bd662736ed4975b97cbe3f1a4ec90e1 Mon Sep 17 00:00:00 2001
From: "Luke D. Jones" <luke@ljones.dev>
Date: Wed, 23 Aug 2023 11:05:59 +1200
Subject: [PATCH] ALSA: hda: cs35l41: Support ASUS 2023 laptops with missing
 DSD

Support adding the missing DSD properties required  for ASUS ROG 2023
laptops and other ASUS laptops to properly utilise the cs35l41.

The currently added laptops are:
- ASUS GS650P,   i2c
- ASUS GA402X,   i2c
- ASUS GU604V,   spi
- ASUS GU603V,   spi
- ASUS GV601V,   spi
- ASUS GZ301V,   spi
- ASUS ROG ALLY, i2c
- ASUS G614J,    spi
- ASUS G634J,    spi
- ASUS G614JI,   spi
- ASUS G713P,    i2c
- ASUS H7604JV,  spi

The SPI connected amps may be required to use an external DSD patch
to fix or add the "cs-gpios" property.

Co-developed-by: Jonathan LoBue <jlobue10@gmail.com>
Signed-off-by: Jonathan LoBue <jlobue10@gmail.com>
Co-developed-by: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Luke D. Jones <luke@ljones.dev>
---
 sound/pci/hda/cs35l41_hda_property.c | 47 ++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)

diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
index 673f23257a09..b39f9443e1d6 100644
--- a/sound/pci/hda/cs35l41_hda_property.c
+++ b/sound/pci/hda/cs35l41_hda_property.c
@@ -43,6 +43,41 @@ static int lenovo_legion_no_acpi(struct cs35l41_hda *cs35l41, struct device *phy
 	return 0;
 }
 
+/*
+ * The CSC3551 is used in almost the entire ASUS ROG laptop range in 2023, this is likely to
+ * also include many non ROG labelled laptops. It is also used with either I2C connection or
+ * SPI connection. The SPI connected versions may be missing a chip select GPIO and require
+ * an DSD table patch.
+ */
+static int asus_rog_2023_spkr_id2(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
+				const char *hid)
+{
+	struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
+
+	/* check SPI or I2C address to assign the index */
+	cs35l41->index = (id == 0 || id == 0x40) ? 0 : 1;
+	cs35l41->channel_index = 0;
+	cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2);
+	hw_cfg->spk_pos = cs35l41->index;
+	hw_cfg->bst_type = CS35L41_EXT_BOOST;
+	hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH;
+	hw_cfg->gpio1.valid = true;
+	hw_cfg->gpio2.func = CS35L41_INTERRUPT;
+	hw_cfg->gpio2.valid = true;
+
+	if (strcmp(cs35l41->acpi_subsystem_id, "10431473") == 0
+		|| strcmp(cs35l41->acpi_subsystem_id, "10431483") == 0
+		|| strcmp(cs35l41->acpi_subsystem_id, "10431493") == 0) {
+		cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 1, GPIOD_OUT_HIGH);
+	} else {
+		cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
+	}
+
+	hw_cfg->valid = true;
+
+	return 0;
+}
+
 struct cs35l41_prop_model {
 	const char *hid;
 	const char *ssid;
@@ -53,6 +88,18 @@ struct cs35l41_prop_model {
 const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
 	{ "CLSA0100", NULL, lenovo_legion_no_acpi },
 	{ "CLSA0101", NULL, lenovo_legion_no_acpi },
+	{ "CSC3551", "10431433", asus_rog_2023_spkr_id2 }, // ASUS GS650P - i2c
+	{ "CSC3551", "10431463", asus_rog_2023_spkr_id2 }, // ASUS GA402X/N - i2c
+	{ "CSC3551", "10431473", asus_rog_2023_spkr_id2 }, // ASUS GU604V - spi, reset gpio 1
+	{ "CSC3551", "10431483", asus_rog_2023_spkr_id2 }, // ASUS GU603V - spi, reset gpio 1
+	{ "CSC3551", "10431493", asus_rog_2023_spkr_id2 }, // ASUS GV601V - spi, reset gpio 1
+	{ "CSC3551", "10431573", asus_rog_2023_spkr_id2 }, // ASUS GZ301V - spi, reset gpio 0
+	{ "CSC3551", "104317F3", asus_rog_2023_spkr_id2 }, // ASUS ROG ALLY - i2c
+	{ "CSC3551", "10431B93", asus_rog_2023_spkr_id2 }, // ASUS G614J - spi, reset gpio 0
+	{ "CSC3551", "10431CAF", asus_rog_2023_spkr_id2 }, // ASUS G634J - spi, reset gpio 0
+	{ "CSC3551", "10431C9F", asus_rog_2023_spkr_id2 }, // ASUS G614JI -spi, reset gpio 0
+	{ "CSC3551", "10431D1F", asus_rog_2023_spkr_id2 }, // ASUS G713P - i2c
+	{ "CSC3551", "10431F1F", asus_rog_2023_spkr_id2 }, // ASUS H7604JV - spi, reset gpio 0
 	{}
 };
 
-- 
2.41.0

This will be submitted after I get some additional testing

@pczekalski
Copy link

For everyone ending up here through a boogle search, please see my guide (built from everything here) https://asus-linux.org/wiki/cirrus-amps/ for more info.

I have been pushing Cirrus devs to create proper solutions, and so far we have a patch merged by Taki, and I've submitted a new patch to finish enabling ASUS amps. The info is at the top of the article to be clear.

EDIT

I am now working on new patch

@flukejones Thanks for your effort, really appreciate that.

I have GZ301V so let me know how / if I can be in help for testing.

@flukejones
Copy link

@pczekalski follow the guide I posted.

@pczekalski
Copy link

@flukejones Thanks, I've carefully checked your manual, just one doubt: on the list of 6.5 rc7 my laptop Asus ROG Flow Z13 (GZ301V) is listed in the SPI_2 section. While my SSDT ssdt16.dsl shows it is SPI1:

/*
 * Intel ACPI Component Architecture
 * AML/ASL+ Disassembler version 20200925 (64-bit version)
 * Copyright (c) 2000 - 2020 Intel Corporation
 * 
 * Disassembling to symbolic ASL+ operators
 *
 * Disassembly of ssdt16.dat, Fri Aug  4 20:43:15 2023
 *
 * Original Table Header:
 *     Signature        "SSDT"
 *     Length           0x000001A4 (420)
 *     Revision         0x01
 *     Checksum         0x0C
 *     OEM ID           "_ASUS_"
 *     OEM Table ID     "SPKRAMPS"
 *     OEM Revision     0x00000002 (2)
 *     Compiler ID      "INTL"
 *     Compiler Version 0x20200717 (538969879)
 */
DefinitionBlock ("", "SSDT", 1, "_ASUS_", "SPKRAMPS", 0x00000002)
{
    External (_SB_.GPI0, DeviceObj)
    External (_SB_.PC00.SPI1, DeviceObj)

    Scope (\_SB.PC00.SPI1)
    {
        Device (SPK1)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "10431573")  // _SUB: Subsystem ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (SBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0017
                        }
                    GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0131
                        }
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012E
                        }
                    GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                    GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                })
                Return (SBUF) /* \_SB_.PC00.SPI1.SPK1._CRS.SBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x0F)
            }

            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }
        }
    }
}

@flukejones
Copy link

Current patch, relies on the patch mentioned in my other post still. I2C laptops need to remove the DSD patch hack, and SPI laptops need only the cs-gpio DSD entry.

From 8b3017e3d3317912127dc47a7f327ea81a320003 Mon Sep 17 00:00:00 2001
From: "Luke D. Jones" <luke@ljones.dev>
Date: Wed, 23 Aug 2023 11:05:59 +1200
Subject: [PATCH v2 2/2] ALSA: hda: cs35l41: Support ASUS 2023 laptops with
 missing DSD

Support adding the missing DSD properties required  for ASUS ROG 2023
laptops and other ASUS laptops to properly utilise the cs35l41.

The currently added laptops are:
- ASUS GS650P,   i2c
- ASUS GA402X,   i2c
- ASUS GU604V,   spi
- ASUS GU603V,   spi
- ASUS GV601V,   spi
- ASUS GZ301V,   spi
- ASUS ROG ALLY, i2c
- ASUS G614J,    spi
- ASUS G634J,    spi
- ASUS G614JI,   spi
- ASUS G713P,    i2c
- ASUS H7604JV,  spi

The SPI connected amps may be required to use an external DSD patch
to fix or add the "cs-gpios" property.

Co-developed-by: Jonathan LoBue <jlobue10@gmail.com>
Signed-off-by: Jonathan LoBue <jlobue10@gmail.com>
Co-developed-by: Luke D. Jones <luke@ljones.dev>
Signed-off-by: Luke D. Jones <luke@ljones.dev>
---
 sound/pci/hda/cs35l41_hda_property.c | 53 ++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)

diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
index 673f23257a09..3be804e08d66 100644
--- a/sound/pci/hda/cs35l41_hda_property.c
+++ b/sound/pci/hda/cs35l41_hda_property.c
@@ -43,6 +43,47 @@ static int lenovo_legion_no_acpi(struct cs35l41_hda *cs35l41, struct device *phy
 	return 0;
 }
 
+/*
+ * The CSC3551 is used in almost the entire ROG laptop range in 2023, this is likely to
+ * also include many non ROG labelled laptops. It is also used with either I2C connection or
+ * SPI connection. The SPI connected versions may be missing a chip select GPIO and require
+ * an DSD table patch.
+ */
+static int asus_rog_2023_no_acpi(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
+				const char *hid)
+{
+	struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
+	int reset_gpio = 0;
+	int spkr_gpio = 2;
+
+	/* check SPI or I2C address to assign the index */
+	cs35l41->index = (id == 0 || id == 0x40) ? 0 : 1;
+	cs35l41->channel_index = 0;
+	hw_cfg->spk_pos = cs35l41->index;
+	hw_cfg->bst_type = CS35L41_EXT_BOOST;
+	hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH;
+	hw_cfg->gpio1.valid = true;
+	hw_cfg->gpio2.func = CS35L41_INTERRUPT;
+	hw_cfg->gpio2.valid = true;
+
+	if (strcmp(cs35l41->acpi_subsystem_id, "10431483") == 0)
+		spkr_gpio = 1;
+	cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, spkr_gpio);
+
+	if (strcmp(cs35l41->acpi_subsystem_id, "10431463") == 0)
+		reset_gpio = 0;
+	else if (strcmp(cs35l41->acpi_subsystem_id, "10431473") == 0
+		|| strcmp(cs35l41->acpi_subsystem_id, "10431483") == 0
+		|| strcmp(cs35l41->acpi_subsystem_id, "10431493") == 0) {
+		reset_gpio = 1;
+	}
+	cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, reset_gpio, GPIOD_OUT_HIGH);
+
+	hw_cfg->valid = true;
+
+	return 0;
+}
+
 struct cs35l41_prop_model {
 	const char *hid;
 	const char *ssid;
@@ -53,6 +94,18 @@ struct cs35l41_prop_model {
 const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
 	{ "CLSA0100", NULL, lenovo_legion_no_acpi },
 	{ "CLSA0101", NULL, lenovo_legion_no_acpi },
+	{ "CSC3551", "10431433", asus_rog_2023_no_acpi }, // GS650P - i2c
+	{ "CSC3551", "10431463", asus_rog_2023_no_acpi }, // GA402X/N - i2c, reset gpio 0
+	{ "CSC3551", "10431473", asus_rog_2023_no_acpi }, // GU604V - spi, reset gpio 1
+	{ "CSC3551", "10431483", asus_rog_2023_no_acpi }, // GU603V - spi, reset 1, spkr 1
+	{ "CSC3551", "10431493", asus_rog_2023_no_acpi }, // GV601V - spi, reset gpio 1
+	{ "CSC3551", "10431573", asus_rog_2023_no_acpi }, // GZ301V - spi, reset gpio 0
+	{ "CSC3551", "104317F3", asus_rog_2023_no_acpi }, // ROG ALLY - i2c
+	{ "CSC3551", "10431B93", asus_rog_2023_no_acpi }, // G614J - spi, reset gpio 0
+	{ "CSC3551", "10431CAF", asus_rog_2023_no_acpi }, // G634J - spi, reset gpio 0
+	{ "CSC3551", "10431C9F", asus_rog_2023_no_acpi }, // G614JI -spi, reset gpio 0
+	{ "CSC3551", "10431D1F", asus_rog_2023_no_acpi }, // G713P - i2c
+	{ "CSC3551", "10431F1F", asus_rog_2023_no_acpi }, // H7604JV - spi, reset gpio 0
 	{}
 };
 
-- 
2.41.0

@AlirezaDadrass
Copy link

Hi.
I have bought 'ASUSTeK COMPUTER INC. Zenbook S 13 UX5304VA_UX5304VA' and got similar issue on fedora ws 38:
[ 6.806137] fedora kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices. [ 7.111080] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551. [ 7.111091] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported [ 7.111097] fedora kernel: cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.0 failed with error -22 [ 7.123969] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551. [ 7.123981] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported [ 7.123988] fedora kernel: cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -22
and I have to mention I'm really new in linux. how I can resolve this problem and where i have to start from?

@fermino
Copy link

fermino commented Sep 4, 2023

@AlirezaDadrass what kernel version are you running? (Paste the output of uname -a)

You could try with this:
https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff?permalink_comment_id=4636115#gistcomment-4636115

@fermino
Copy link

fermino commented Sep 4, 2023

@flukejones I don't see the UX3402 (Asus Zenbook) in the list. What I understand is that you're trying to get a patch upstreamed so that no manual patching is required, right? I am using the ssdt patch right now but it'd be nice for other people to have it bundled with the drivers. I'm happy to test things out in my UX3402 if that's of any help!

The currently added laptops are:

  • ASUS GS650P, i2c
  • ASUS GA402X, i2c
  • ASUS GU604V, spi
  • ASUS GU603V, spi
  • ASUS GV601V, spi
  • ASUS GZ301V, spi
  • ASUS ROG ALLY, i2c
  • ASUS G614J, spi
  • ASUS G634J, spi
  • ASUS G614JI, spi
  • ASUS G713P, i2c
  • ASUS H7604JV, spi

@StevenBrons
Copy link

StevenBrons commented Sep 4, 2023

Thanks everyone in this thread! After a lot of iterations I managed to supply my Asus Zenbook 15 UM3504DA with working speakers!

For anyone facing the same issue with the Zenbook 15, give me a message; the working steps included

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB.I2CB, DeviceObj)
    External (_SB.I2CB.SPKR, DeviceObj)

    Scope (_SB.I2CB.SPKR)
    {

        Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
        {
        }
        Name (_DSD, Package ()   // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                Package () { "reset-gpios", Package () {
                    SPKR, Zero, Zero, Zero,
                    SPKR, Zero, Zero, Zero,
                } },
                Package () { "spk-id-gpios", Package () {
                    SPKR, 0x02, Zero, Zero,
                    SPKR, 0x02, Zero, Zero,
                } },
                Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func",           Package () { One, One } },
                Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type",           Package () { One, One } },
                // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                // boost-cap-microfarad: rounded to the nearest integer
                //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
            },
        })
    }


}

I am very greatful for all the guides and especially the asus-linux website.

Some problems I encountered along the way:

  • The asus-linux website does not provide any information the needed kernel patch; I found that in the comments here
  • The 6.5 kernel does have the patch for some models, but not mine
  • There are many versions of the .dsl file floating around, I still don't know what is correct

@AlirezaDadrass
Copy link

AlirezaDadrass commented Sep 5, 2023

Hi @AlirezaDadrass, have you tried this patch? https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff?permalink_comment_id=4639491#gistcomment-4639491

Hi
No I didn't.
there is a command 'sudo update-grub'
sudo: update-grub: command not found

@talentlessguy
Copy link

@AlirezaDadrass might be that you have systemd-boot and not GRUB, check /efi/loader

@AlirezaDadrass
Copy link

Hi @AlirezaDadrass, have you tried this patch? https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff?permalink_comment_id=4639491#gistcomment-4639491

Hello again.
I tried this solution and build the kernel and installed it. nothing happen

@AlirezaDadrass
Copy link

@AlirezaDadrass might be that you have systemd-boot and not GRUB, check /efi/loader

no i have grub2 and /boot folder

@AlirezaDadrass
Copy link

I got
journalctl -b -g CSC3551 --output short-monotonic:
[ 0.013636] fedora kernel: ACPI: SSDT 0x0000000047E9ECA2 0002D6 (v01 CUSTOM CSC3551 00000002 INTL 20220331) [ 7.091287] fedora kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices. [ 7.635535] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2 [ 7.636909] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset [ 7.725514] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
after re build and reinstalling kernel.
but issue is not resolved

@Messier104
Copy link

Got it working by applying kernel patch on asus ux3402VA

SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402", ALC245_FIXUP_CS35L41_SPI_2),

Is there any chance you could elaborate or redirect me to a source on how to apply this? I would love to get this working. Thank you!

b

@fermino
Copy link

fermino commented Sep 6, 2023

@Messier104 that patch is already added on the kernel so there's no need to patch it manually unless you're using an old kernel. It would be a lot easier though to just update it. What distro and kernel version are you using?

@AlirezaDadrass same thing :) You need to have a kernel with the patches and then add the ssdt to the grub config. What kernel are you using currently? Let's get one thing figured out at a time ;)

uname -a

@Messier104
Copy link

Messier104 commented Sep 6, 2023

@Messier104 that patch is already added on the kernel so there's no need to patch it manually unless you're using an old kernel. It would be a lot easier though to just update it. What distro and kernel version are you using?

I'm using Kubuntu 22.04.3 (latest lts) and the kernel was 6.2, I have now also tried the latest one available, 6.5.1 but it does not seem to be fixed. Would you have any pointers?

@fermino
Copy link

fermino commented Sep 6, 2023

I'm using Kubuntu 22.04.3 (latest lts) and the kernel was 6.2, I have now also tried the latest one available, 6.5.1 but it does not seem to be fixed. Would you have any pointers?

@Messier104 I have an UX3402 with kernel 6.1 (working sound), so 6.2 should be just fine.
Check this one out: https://github.com/thor2002ro/asus_zenbook_ux3402za/tree/main/Sound
That's what I'm using currently. You're going to have to install some tools (like iasl), and you might have to tweak some things depending on if you're using grub or another bootloader, but if you're using grub that should do just fine. Make sure the paths are right as it may vary a bit depending on the distro. If you need any help with it just reach out :)

@Messier104
Copy link

I'm using Kubuntu 22.04.3 (latest lts) and the kernel was 6.2, I have now also tried the latest one available, 6.5.1 but it does not seem to be fixed. Would you have any pointers?

@Messier104 I have an UX3402 with kernel 6.1 (working sound), so 6.2 should be just fine. Check this one out: https://github.com/thor2002ro/asus_zenbook_ux3402za/tree/main/Sound That's what I'm using currently. You're going to have to install some tools (like iasl), and you might have to tweak some things depending on if you're using grub or another bootloader, but if you're using grub that should do just fine. Make sure the paths are right as it may vary a bit depending on the distro. If you need any help with it just reach out :)

I have tried that, as far as my understanding goes the paths are also correct but I'm not 100% confident how I can be sure. Are you using the ux3402va model or the ux3402za model? I have the first one, could this be a problem? Would you be available to chat a bit on discord maybe? I would be very grateful! (Piño Palladiño#4084)

@fermino
Copy link

fermino commented Sep 6, 2023

@Messier104 I'll text you there. I do have the UX3402ZA. If we get it working then we can post it here for other people :)

@ctrlzero
Copy link

ctrlzero commented Sep 6, 2023

this is getting to be a lengthy conversation. perhaps it would be more beneficial (and productive) to start a discord server or something?

@BillOTei
Copy link

BillOTei commented Sep 6, 2023 via email

@AlirezaDadrass
Copy link

@Messier104 that patch is already added on the kernel so there's no need to patch it manually unless you're using an old kernel. It would be a lot easier though to just update it. What distro and kernel version are you using?

@AlirezaDadrass same thing :) You need to have a kernel with the patches and then add the ssdt to the grub config. What kernel are you using currently? Let's get one thing figured out at a time ;)

uname -a
Hello again!
I'm using :
Linux fedora 6.4.13-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Aug 30 17:07:31 UTC 2023 x86_64 GNU/Linux

@Messier104
Copy link

Messier104 commented Sep 7, 2023

@Messier104 that patch is already added on the kernel so there's no need to patch it manually unless you're using an old kernel. It would be a lot easier though to just update it. What distro and kernel version are you using?

I'm using kubuntu 22.04.3 LTS (ubuntu with kde plasma). For kernels I've used 6.5.1 (and before also 6.2). My version of the zenbook is ux3402VA (not ZA) if that makes a difference.

Above in the thread people talked about changing this line (I think in the kernel source code)

SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS UX3402", ALC245_FIXUP_CS35L41_SPI_2),

Here the second hex number is different then standard for the VA w.r.t. ZA version (I think). I managed to find how to change this but when I tried compiling the kernel I can't get it to boot (it does show up in grub). I'm a bit of a newbie in regard to this kind of stuff though :/

edit:

I have finally managed to fix it!

For the UX3402VA version, it is really required to change the second hex number to 0x16a3 as in the line above (which can be found in the source of the kernel in "sound/pci/hda/patch_realtek.c" and then build and install the kernel. If you are an ultimate newbie in this regard and are on Ubuntu; following this step-by-step works: https://askubuntu.com/questions/1435591/correct-way-to-build-kernel-with-hardware-support-fix-patches-ubuntu-22-04-lts

@winstonma
Copy link

winstonma commented Sep 8, 2023

Hi @lamperez I am using Zenbook S13 OLED using the same chip. The driver is working but the volume is too low. I would like to amplify the volume. Not sure if I need to use the DSDT method or just need to modify some value in /sys folder.

Also I just use the DSDT without any modification and got the

ACPI BIOS Error (bug): Could not resolve symbol [\_SB.PC00.SPI0.SPK1], AE_NOT_FOUND (20230331/dswload2-162)

Not sure how could I troubleshoot and modify your file to get my device with the right amplification value. Thanks.

EDIT:

It turns out the audio on my laptop is supported by the kernel. The only needed thing is to put the firmware into the system (link). Now the volume is larger.

@armeldemarsac92
Copy link

armeldemarsac92 commented Sep 17, 2023

Thanks everyone in this thread! After a lot of iterations I managed to supply my Asus Zenbook 15 UM3504DA with working speakers!

For anyone facing the same issue with the Zenbook 15, give me a message; the working steps included

* Following the guide on the asus-linux website:  [here](https://asus-linux.org/wiki/cirrus-amps/)

* This very helpful comment, thanks! https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff?permalink_comment_id=4582983#gistcomment-4582983

* building my own linux kernel with the patch from that comment

* changing the dsl config a number of times until I ended up on the following:
DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB.I2CB, DeviceObj)
    External (_SB.I2CB.SPKR, DeviceObj)

    Scope (_SB.I2CB.SPKR)
    {

        Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
        {
        }
        Name (_DSD, Package ()   // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                Package () { "reset-gpios", Package () {
                    SPKR, Zero, Zero, Zero,
                    SPKR, Zero, Zero, Zero,
                } },
                Package () { "spk-id-gpios", Package () {
                    SPKR, 0x02, Zero, Zero,
                    SPKR, 0x02, Zero, Zero,
                } },
                Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func",           Package () { One, One } },
                Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type",           Package () { One, One } },
                // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                // boost-cap-microfarad: rounded to the nearest integer
                //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
            },
        })
    }


}

I am very greatful for all the guides and especially the asus-linux website.

Some problems I encountered along the way:

* The asus-linux website does not provide any information the needed kernel patch; I found that in the comments here

* The 6.5 kernel does have the patch for some models, but not mine

* There are many versions of the .dsl file floating around, I still don't know what is correct

Hi stevens, thanks for your contribution ! I have exactly the same laptop as you and tried following the instructions but still no sound, I remove pulseaudio as it was creating some pbs to use pipewire. Could you provide me with a rundown of everything you did to enable the speakers again ? The instructions are a bit unclear for a newbie like me. Thanks a lot :)

Here is what I did 👍

  1. mkdir cirrus && cd cirrus
    sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.dat
    iasl -d dsdt.dat

  2. I created the patch by copying and pasting your code snippet in a file I created and called "ssdt_csc3551.dsl"

3.iasl -tc ssdt_csc3551.dsl
mkdir -p kernel/firmware/acpi
cp ssdt_csc3551.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

4.I added this line "GRUB_EARLY_INITRD_LINUX_CUSTOM="patched_cirrus_acpi.cpio" to my grub file "/etc/default/grub"

5.I updated the grub config with "sudo grub2-mkconfig -o /etc/grub2-efi.cfg"

6.Reboot but still no sound, here is the dmseg :
dmesg |grep CSC3551
[ 6.024384] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 I2C devices.
[ 6.278538] cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[ 6.278545] cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[ 6.278574] cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.0 failed with error -22
[ 6.278700] cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[ 6.278703] cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[ 6.278723] cs35l41-hda: probe of i2c-CSC3551:00-cs35l41-hda.1 failed with error -22

I am surely missing something as there was a lot of options in the tutorias you linked.

@PoSayDone
Copy link

Users of ux3402va, I finally submitted a fix for our model to the kernel so that we don't need to use kernel patches!
https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?id=07058dceb038a4b0dd49af07118b6b2a685bb4a6

@rainydaysavings
Copy link

Hey guys, I have a G634JZ (Rog Strix Scar 16 2023), using following ssdt(dsdt shows SPI3 and SPK1):

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB_.PC00.SPI3, DeviceObj)
    External (_SB_.PC00.SPI3.SPK1, DeviceObj)

    Scope (_SB.PC00.SPI3.SPK1)
    {
        Name (_DSD, Package ()   // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { Zero, One }},
                Package () { "reset-gpios", Package () {
                                        SPK1, Zero, Zero, Zero,
                                        SPK1, Zero, Zero, Zero,
                } },
                Package () { "spk-id-gpios", Package () {
                                        SPK1, 0x02, Zero, Zero,
                                        SPK1, 0x02, Zero, Zero,
                } },
                Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func",           Package () { One, One } },
                Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type",           Package () { One, One } },
            },
        })
    }

    Scope (_SB.PC00.SPI3)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cs-gpios", Package () {
                    Zero,                    // Native CS
                    SPK1, Zero, Zero, Zero   // GPIO CS
                } }
            }
        })
    }
}

The dmesg shows:

λ sudo dmesg|grep CSC3551
[    0.018409] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.018410] ACPI: SSDT 0x0000000039A7D000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20221020)
[    5.780873] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Reset line busy, assuming shared reset
[    5.884861] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Failed waiting for OTP_BOOT_DONE: -110
[    5.897583] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -110
[    5.899702] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    6.003547] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Failed waiting for OTP_BOOT_DONE: -110
[    6.024392] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -110
[    6.024574] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.

The kernel patch of this device (1043:1caf) seems in the linux-g14 kernel patch code, which I'm using.

So anyone happened to fix the OTP_BOOT_DONE?

Can confirm this patch also works with the ROG Strix G814JZ model!
Appreciate it!

$ sudo dmesg | grep CSC3551                                                                                                                                                                                                 
[    0.018977] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.018979] ACPI: SSDT 0x00000000392AF000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20220331)
[   35.442408] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Reset line busy, assuming shared reset
[   35.482909] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[   35.486857] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[   35.530909] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[   35.532929] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.

@JYInMyHeart
Copy link

Hey guys. Does ROG Strix G614JV spport? I Just find G614J and G614JI.

@AlirezaDadrass
Copy link

I solved my problem with https://github.com/badgers-ua/asus_zenbook_ux5304va_sound.
Thank you all.
But i have to do the whole process after each kernel update. I hope fedora team insert path in next version

@Mikchel
Copy link

Mikchel commented Sep 26, 2023

For anyone having issues with the ASUS ROG STRIX G17 (2023) G713PV:

I've used the following dsl patch:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB_.I2CD, DeviceObj)
    External (_SB_.I2CD.SPKR, DeviceObj)

    Scope (_SB.I2CD.SPKR)
    {
        Name (_DSD, Package ()   // _DSD: Device-Specific Data
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                Package () { "reset-gpios", Package () {
                   SPKR, Zero, Zero, Zero,
                   SPKR, Zero, Zero, Zero,
                } },
                Package () { "spk-id-gpios", Package () {
                   SPKR, 0x02, Zero, Zero,
                   SPKR, 0x02, Zero, Zero,
                } },
                Package () { "cirrus,speaker-position",     Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func",           Package () { One, One } },
                Package () { "cirrus,gpio2-func",           Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type",           Package () { One, One } },
            },
        })
    }
}

The following works with grub: Compile it with: iasl -tc speaker_amplifier_fix_patch.dsl, copy the resulting speaker_amplifier_fix_patch.aml file file to the boot partition (mostly /boot). Then add the entry acpi speaker_amplifier_fix_patch.aml to the grub config, e.g. to the /etc/grub.d/40_custom file. Don't forget to regenerate your grub config (sudo grub-mkconfig -o /boot/grub/grub.cfg on Arch).

You also need the newest linux-firmware version (20230804) (on arch as of writing only available via AUR linux-firmware-git). Also the newest kernel version (6.4.8) is necessary.

It is possible to get it working with older kernel by adding some modprobe options to snd-hda-intel, but I don't know which exactly. Instead of using the newest linux-firmware you can also create links to all files in /lib/firmware/cirrus containing -10431503- by replacing it with -10431d1f-, e.g. cs35l41-dsp1-spk-prot-10431d1f-spkid0-l0.bin -> cs35l41-dsp1-spk-prot-10431503-spkid0-l0.bin

Thanks to this gist and the information in https://asus-linux.org/wiki/cirrus-amps/#create-the-ssdt-patch

I can confirm that this works on ASUS ROG G713PV. Thank you
The only thing that i noticed notebook started to heat too match. It is very strange that one mp3 track playing on VLC force to heat notebook which is expecting to spread 300W (AMD 7845 + NVIDIA 4060).
Probably something wrong inside of schematic because of that patch.
Also sometimes VLC is playing with big noise.
So, yes, that works. But with some strange effects affected to notebook hardware

@kureta
Copy link

kureta commented Sep 28, 2023

I solved my problem with https://github.com/badgers-ua/asus_zenbook_ux5304va_sound. Thank you all. But i have to do the whole process after each kernel update. I hope fedora team insert path in next version

I have been trying to get this to work for 2 days now. I patched and compiled the kernel. I use systemd-boot so I followed those instructions, made a patched.cpio, added it as an initrd flag in boot config, added it into the mkinitcpio. This is what I get when I boot my machine after doing everything.

❯ sudo dmesg | grep CSC3551
[sudo] password for kureta:
[    0.014530] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.014532] ACPI: SSDT 0x000000004F164000 0002D6 (v01 CUSTOM CSC3551  00000002 INTL 20230628)
[    3.033166] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    3.033174] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[    3.033179] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[    3.054463] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[    3.054469] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[    3.054473] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22
[    3.054513] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.

I can also grep ACPI but that is a huge wall of text.

@lamperez
Copy link
Author

@kureta, you are applying the patch (ACPI: Table Upgrade: ...), but clearly the patch is not ok. Maybe the identifier in the Scope blocks are different for your computer model. You have to disassemble your ACPI, search for "CSC3551" and find the corresponding Scope block.

@kureta
Copy link

kureta commented Sep 29, 2023

This is from my disassembled ACPI:

DefinitionBlock ("", "SSDT", 1, "_ASUS_", "SPKRAMPS", 0x00000002)
{
    External (_SB_.GPI0, DeviceObj)
    External (_SB_.PC00.SPI1, DeviceObj)

    Scope (\_SB.PC00.SPI1)
    {
        Device (SPK1)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "104316D3")  // _SUB: Subsystem ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (SBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0017
                        }
                    GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0131
                        }
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012E
                        }
                    GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                    GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                })
                Return (SBUF) /* \_SB_.PC00.SPI1.SPK1._CRS.SBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x0F)
            }

            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }
        }
    }
}

and this is the patch I am using:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000002)
{
    External (_SB_.GPI0, DeviceObj)
    External (_SB_.PC00.SPI1, DeviceObj)

    Scope (\_SB.PC00.SPI1)
    {
        Device (SPK1)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "104316D3")  // _SUB: Subsystem ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (SBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI1",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0017
                        }
                    GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0131
                        }
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012E
                        }
                    GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                    GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x012F
                        }
                })
                Return (SBUF) /* \_SB_.PC00.SPI1.SPK1._CRS.SBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x0F)
            }

            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }

            Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
            {
                Return (Package ()
                    {
                        ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                        Package ()
                        {
                            Package () { "cirrus,dev-index", Package () { Zero, One }},
                            Package () { "reset-gpios", Package () {
                            SPK1, One, Zero, Zero,
                            SPK1, One, Zero, Zero
                            } },
                            Package () { "spk-id-gpios", Package () {
                                SPK1, 0x02, Zero, Zero,
                                SPK1, 0x02, Zero, Zero,
                            } },
                            Package () { "cirrus,speaker-position", Package () { Zero, One } },
                            Package () { "cirrus,gpio1-func", Package () { One, One } },
                            Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                            // boost-type: 0 internal, 1 external
                            Package () { "cirrus,boost-type", Package () { One, One } },
                            // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                            //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                            // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                            //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                            // boost-cap-microfarad: rounded to the nearest integer
                            //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
                        }
                    }) /* \_SB_.PC00.SPI0.SPK1._DSD */
            }
        }

        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cs-gpios", Package () { 
                            Zero,                    // Native CS
                            SPK1, Zero, Zero, Zero   // GPIO CS
                        } }
                    }
                }) /* \_SB_.PC00.SPI0.SPK1._DSD */
        }
    }
}

and these are the commands I use to apply it all:

iasl -sa ssdt_csc3551.dsl
mkdir -p kernel/firmware/acpi
cp ssdt_csc3551.aml kernel/firmware/acpi/ssdt_csc3551.aml
find kernel | cpio -H newc --create >acpi_override
sudo cp acpi_override /boot/
sudo mkinitcpio -p linux65-tkg-cfs

I cannot find the problem.

@kureta
Copy link

kureta commented Sep 29, 2023

I have finally found the problem and it's working. Only the first lines were different. So I changed the patch to DefinitionBlock ("", "SSDT", 1, "_ASUS_", "SPKRAMPS", 0x00000003). Apparently the last number is OEM revision number and it should be incremented. now it works! Thank you everyone in this thread!

@isle9
Copy link

isle9 commented Sep 29, 2023

I solved my problem with https://github.com/badgers-ua/asus_zenbook_ux5304va_sound. Thank you all. But i have to do the whole process after each kernel update. I hope fedora team insert path in next version

Hey I get page not found when I try to open your link.

@kureta
Copy link

kureta commented Sep 29, 2023

@mypsik
Copy link

mypsik commented Oct 16, 2023

Working ssdt-csc3551.dsl for ASUS Zenbook UM3402Y (the speakers are connected to I2C, not SPI).
Follow the rest from https://github.com/badgers-ua/asus_zenbook_ux5304va_sound

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CS3551", 0x0000300A)
{

    External (_SB_.I2CD, DeviceObj)
    External (_SB_.I2CD.SPKR, DeviceObj)

    Scope (_SB.I2CD.SPKR)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                        Package () { "reset-gpios", Package () {
                           SPKR, Zero, Zero, Zero,
                           SPKR, Zero, Zero, Zero
                        } },
                        Package () { "spk-id-gpios", Package () {
                             SPKR, 0x02, Zero, Zero,
                             SPKR, 0x02, Zero, Zero,
                        } },
                        Package () { "cirrus,speaker-position", Package () { Zero, One } },
                        Package () { "cirrus,gpio1-func", Package () { One, One } },
                        Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                        // boost-type: 0 internal, 1 external
                        Package () { "cirrus,boost-type", Package () { One, One } },
                        // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                        //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                        // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                        //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                        // boost-cap-microfarad: rounded to the nearest integer
                        //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
                    }
                })
        }
    }

    Scope (_SB.I2CD)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cs-gpios", Package () { 
                            Zero,                    // Native CS
                            SPKR, Zero, Zero, Zero   // GPIO CS
                        } }
                    }
                })
        }
    }
}

@dabendji2000
Copy link

Working ssdt-csc3551.dsl for ASUS Zenbook UM3402Y (the speakers are connected to I2C, not SPI). Follow the rest from https://github.com/badgers-ua/asus_zenbook_ux5304va_sound

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CS3551", 0x0000300A)
{

    External (_SB_.I2CD, DeviceObj)
    External (_SB_.I2CD.SPKR, DeviceObj)

    Scope (_SB.I2CD.SPKR)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                        Package () { "reset-gpios", Package () {
                           SPKR, Zero, Zero, Zero,
                           SPKR, Zero, Zero, Zero
                        } },
                        Package () { "spk-id-gpios", Package () {
                             SPKR, 0x02, Zero, Zero,
                             SPKR, 0x02, Zero, Zero,
                        } },
                        Package () { "cirrus,speaker-position", Package () { Zero, One } },
                        Package () { "cirrus,gpio1-func", Package () { One, One } },
                        Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                        // boost-type: 0 internal, 1 external
                        Package () { "cirrus,boost-type", Package () { One, One } },
                        // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                        //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                        // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                        //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                        // boost-cap-microfarad: rounded to the nearest integer
                        //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
                    }
                })
        }
    }

    Scope (_SB.I2CD)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cs-gpios", Package () { 
                            Zero,                    // Native CS
                            SPKR, Zero, Zero, Zero   // GPIO CS
                        } }
                    }
                })
        }
    }
}

Hi, I have an Asus Zenbook UM3402YAR-UM3402YA laptop I've purchased a week ago. I have installed the Ubuntu 23.10 and have no sound from the speakers. I've been searching over the internet and have come across this community and this post dealing with the issuue. Unfortunately I have no practical experience on how to make a patch to the kernel that is required. Is there a chance that you help me somehow (maybe through a remote connection or similar)? Really appreciate all the help...

@alex-spataru
Copy link

For those with an ASUS UX7602ZM laptop, you can check the guide & SSDT patches here: https://github.com/alex-spataru/asus_zenbook_ux7602zm_sound.

Basically, getting sound to work boils down to two things:

  1. Modifying the patch_realtek.c file and add the following quirck SND_PCI_QUIRK(0x1043, 0x1f62, "ASUS UX7602ZM", ALC245_FIXUP_CS35L41_SPI_2).
  2. Compiling and installing the SSDT patch in a very similar way that with the other Zenbook models.

Thanks everyone for helping me find a way to get the sound working with my laptop, happy hacking!

@abishekmuthian
Copy link

abishekmuthian commented Nov 6, 2023

Folks, Can anyone help me? After patching the SSDT for my G634JY on Fedora 38 with 6.6.0-61.rog.fc38.x86_64 I get the following in the dmesg; I have very low volume from rear-speakers and front speakers doesn't work.

[    0.019213] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.019215] ACPI: SSDT 0x0000000039533000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20220331)
[   16.010867] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[   16.134141] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Using extra _DSD properties, bypassing _DSD in ACPI
[   16.134143] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: error -ENOENT: Failed to get reset GPIO
[   16.158265] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.0 failed with error -2
[   16.158384] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Using extra _DSD properties, bypassing _DSD in ACPI
[   16.158387] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: error -ENOENT: Failed to get reset GPIO
[   16.176295] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -2

This is my patch

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB_.PC00.SPI3, DeviceObj)
    External (_SB_.PC00.SPI3.SPK1, DeviceObj)

    Scope (_SB.PC00.SPI3.SPK1)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { Zero, One }},
                Package () { "reset-gpios", Package () {
		            SPK1, Zero, Zero, Zero,
		            SPK1, Zero, Zero, Zero
                } },
                Package () { "spk-id-gpios", Package () {
                    SPK1, 0x02, Zero, Zero,
                    SPK1, 0x02, Zero, Zero
                } },
                Package () { "cirrus,speaker-position",		Package () { Zero, One } },
                Package () { "cirrus,gpio1-func",			Package () { One, One } },
                Package () { "cirrus,gpio2-func",			Package () { 0x02, 0x02 } },
                Package () { "cirrus,boost-type",			Package () { One, One } }
            }
        })
    }

    Scope (_SB.PC00.SPI3)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cs-gpios", Package () {
                    Zero,                    // Native CS
                    SPK1, Zero, Zero, Zero   // GPIO CS
                } }
            }
        })
    }
}

I tried,

SPK1, One, Zero, Zero,
SPK1, One, Zero, Zero,
Package () { "cirrus,gpio1-func",           Package () { Zero, Zero } },

And get the same result. Any help would be much appreciated.

@alex-spataru
Copy link

alex-spataru commented Nov 7, 2023

By the way, I also contacted ASUS, and their (rephrased & summarized) response was:

We're sorry for the limited Linux support and encourage you to reach out to the software manufacturer for more comprehensive assistance, as they often provide substantial online support.

I already asked for a contact from the "software manufacturer" they mentioned. I might be naive, but hopefully we can pressure them into fixing their ACPI tables...

@alex-spataru
Copy link

@abishekmuthian Could you please provide us with your original SSDT7 dump? In my case it was necessary to modify my SSDT dump and adding the _DST methods without modifying anything else, I also needed to modify the patch_realtek.c file in the Linux kernel.

@abishekmuthian
Copy link

abishekmuthian commented Nov 7, 2023

@alex-spataru Thank you for your reply and thank you for contacting Asus on behalf of us, I think if we all contact they'll feel the need to address the Linux support issues.

Here's my original SSDT7.dsl .

Here's my original DSDT SPI3 scope :

Scope (_SB.PC00.SPI3)
    {
        Device (SPK1)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "10431CAF")  // _SUB: Subsystem ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (SBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI3",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI3",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x01D4
                        }
                    GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0140
                        }
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x00C0
                        }
                    GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0141
                        }
                    GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0141
                        }
                })
                Return (SBUF) /* \_SB_.PC00.SPI3.SPK1._CRS.SBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x0F)
            }

            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }
        }
    }

@avasnik
Copy link

avasnik commented Nov 7, 2023

Users of ux3402va, I finally submitted a fix for our model to the kernel so that we don't need to use kernel patches! https://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git/commit/?id=07058dceb038a4b0dd49af07118b6b2a685bb4a6

Hello; do you have any idea of when the patch will be available? I'm running
uname -a  ✔ Linux andrey-zenbookux3402va 6.5.9-1-MANJARO #1 SMP PREEMPT_DYNAMIC Wed Oct 25 13:14:27 UTC 2023 x86_64 GNU/Linux
and have no sound at the moment.
Thanks a lot for your effort!

@alex-spataru
Copy link

alex-spataru commented Nov 7, 2023

@abishekmuthian

I believe your SSDT patch should be:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000002)
{
    External (_SB_.PC00.SPI3, DeviceObj)
    External (_SB_.PC00.SPI3.SPK1, DeviceObj)
    
    Scope (_SB.PC00.SPI3)
    {
        Device (SPK1)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "10431CAF")  // _SUB: Subsystem ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (SBUF, ResourceTemplate ()
                {
                    SpiSerialBusV2 (0x0000, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI3",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    SpiSerialBusV2 (0x0001, PolarityLow, FourWireMode, 0x08,
                        ControllerInitiated, 0x003D0900, ClockPolarityLow,
                        ClockPhaseFirst, "\\_SB.PC00.SPI3",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x01D4
                        }
                    GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0140
                        }
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x00C0
                        }
                    GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0141
                        }
                    GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                        "\\_SB.GPI0", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0141
                        }
                })
                Return (SBUF) /* \_SB_.PC00.SPI3.SPK1._CRS.SBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                Return (0x0F)
            }

            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }
            
            Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
            {
                Return (Package ()
                    {
                        ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                        Package ()
                        {
                            Package () { "cirrus,dev-index", Package () { Zero, One }},
                            Package () { "reset-gpios", Package () {
                            SPK1, One, Zero, Zero,
                            SPK1, One, Zero, Zero
                            } },
                            Package () { "spk-id-gpios", Package () {
                                SPK1, 0x02, Zero, Zero,
                                SPK1, 0x02, Zero, Zero,
                            } },
                            Package () { "cirrus,speaker-position", Package () { Zero, One } },
                            Package () { "cirrus,gpio1-func", Package () { One, One } },
                            Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                            // boost-type: 0 internal, 1 external
                            Package () { "cirrus,boost-type", Package () { One, One } },
                            // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                            //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                            // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                            //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                            // boost-cap-microfarad: rounded to the nearest integer
                            //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
                        }
                    })
            }
        }
        
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cs-gpios", Package () { 
                            Zero,                    // Native CS
                            SPK1, Zero, Zero, Zero   // GPIO CS
                        } }
                    }
                })
        }
    }
}

If after applying the SSDT patch your speakers still do not work, it might be necessary to modify and install a custom Linux kernel, to do so:

  1. Pull the kernel source code.

  2. Open kernel_source_root/sound/pci/hda/patch_realtek.c with your text editor and search for ALC245_FIXUP_CS35L41_SPI_2 until you find a list of definitions like this:

SND_PCI_QUIRK(0x1043, 0x3a50, "ASUS G834JYR/JZR", ALC245_FIXUP_CS35L41_SPI_2),
  1. Insert the configuration for your laptop:
SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JY", ALC245_FIXUP_CS35L41_SPI_2),

Edit: I just took a look at the kernel source code, it already has the following quirk for your laptop model:

SND_PCI_QUIRK(0x1043, 0x1caf, "ASUS G634JYR/JZR", ALC285_FIXUP_ASUS_SPI_REAR_SPEAKERS),

In that case, it might be only necessary to add the modified SSDT. I am not really sure if the ALC245_FIXUP_CS35L41_SPI_2 fixup is required for your model.

Please let me know if it works for you!

@abishekmuthian
Copy link

@alex-spataru Thank you so much for your effort, dmesg now shows Reset line busy, assuming shared reset which I don't think I had got before but the audio is still from rear speakers with very low volume.

[    0.018671] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.018673] ACPI: SSDT 0x0000000039533000 0002DE (v01 CUSTOM CSC3551  00000002 INTL 20220331)
[   20.698885] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[   20.790197] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Using extra _DSD properties, bypassing _DSD in ACPI
[   20.790199] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Reset line busy, assuming shared reset
[   20.892699] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Failed waiting for OTP_BOOT_DONE: -110
[   20.905002] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.0 failed with error -110
[   20.905231] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Using extra _DSD properties, bypassing _DSD in ACPI
[   20.905233] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[   21.007673] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Failed waiting for OTP_BOOT_DONE: -110
[   21.020006] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -110

In the asus linux discord channel, @v-gu has made an old post telling how he fixed OTP_BOOT_DONE error for his G634JZ ,

He states -

After some trial and error, I found that my version of the laptop requires reset-gpios to be on , One, Zero, Zero instead of , Zero, Zero, Zero. So I edited the second patch on the guide and add "10431CAF" to the if condition, with:

+    if (strcmp(cs35l41->acpi_subsystem_id, "10431473") == 0
+        || strcmp(cs35l41->acpi_subsystem_id, "10431483") == 0
+        || strcmp(cs35l41->acpi_subsystem_id, "10431493") == 0
+        || strcmp(cs35l41->acpi_subsystem_id, "10431CAF") == 0) {
+        cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 1, GPIOD_OUT_HIGH);
+    } else {
+        cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
+    }

Since I was running rog 6.6 kernel I thought I need not mess with the kernel, I guess now I have to attempt the above changes to the patch?
I

@phaserblast
Copy link

phaserblast commented Nov 8, 2023

UPDATE: Sound on the ASUS GV302XA is working! The reason the Cirrus firmware wasn't loading was I didn't add the laptop's subsystem ID in /sound/pci/hda/patch_realtek.c. Once I did that, it worked. I used the following line:

SND_PCI_QUIRK(0x1043, 0x1533, "ASUS GV302XA", ALC294_FIXUP_CS35L41_I2C_2),

It also works with ALC287_FIXUP_CS35L41_I2C_2 and ALC285_FIXUP_ASUS_I2C_HEADSET_MIC. I don't know if these are the best quirks to use, but ALC294_FIXUP_CS35L41_I2C_2 seems to work okay so far!
Quick side note: Sound actually works on this laptop without the ACPI patch (only the subsystem ID in the kernel is needed), but the sound will only be mono out of both speakers. To get stereo, you need the additional cpio loaded during boot.

Original Post:

Hey all, I picked up an ASUS ROG Flow X13 (2023) this week from Best Buy in the US. The model number is GLV302X (actually GV302XA) and it has the two Cirrus amps connected via I2C. The laptop uses an AMD Ryzen 9 7940HS CPU. The subsystem ID for this laptop is 1043:1533.

I'm running Debian trixie with a 6.5.0 kernel. Although I was able to apply the ACPI patch using systemd-boot and get no dmesg errors, the firmware is never loaded for the amps. I copied the entire 'cirrus' directory from the linux-firmware git to my system, but no firmware load is even attempted. I have not patched the kernel yet:

[    0.002898] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.002900] ACPI: SSDT 0x00000000BB4CE000 00014D (v01 CUSTOM CSC3551  00000001 INTL 20230628)
[    9.601723] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 I2C devices.
[    9.719731] cs35l41-hda i2c-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[    9.719913] cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    9.774618] cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

That's all I get.

Here's the relevant section from the ACPI dump:

Scope (_SB.I2CD)
{
	Device (SPKR)
	{
		Name (_HID, "CSC3551")  // _HID: Hardware ID
		Name (_SUB, "10431533")  // _SUB: Subsystem ID
		Name (_UID, One)  // _UID: Unique ID
		Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
		{
			Name (RBUF, ResourceTemplate ()
			{
				I2cSerialBusV2 (0x0040, ControllerInitiated, 0x000F4240,
					AddressingMode7Bit, "\\_SB.I2CD",
					0x00, ResourceConsumer, , Exclusive,
					)
				I2cSerialBusV2 (0x0041, ControllerInitiated, 0x000F4240,
					AddressingMode7Bit, "\\_SB.I2CD",
					0x00, ResourceConsumer, , Exclusive,
					)
				GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
					"\\_SB.GPIO", 0x00, ResourceConsumer, ,
					)
					{   // Pin list
						0x005A
					}
				GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
					"\\_SB.GPIO", 0x00, ResourceConsumer, ,
					)
					{   // Pin list
						0x008E
					}
				GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
					"\\_SB.GPIO", 0x00, ResourceConsumer, ,
					)
					{   // Pin list
						0x0054
					}
				GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
					"\\_SB.GPIO", 0x00, ResourceConsumer, ,
					)
					{   // Pin list
						0x0054
					}
			})
			Return (RBUF) /* \_SB_.I2CD.SPKR._CRS.RBUF */
		}

		Method (_STA, 0, NotSerialized)  // _STA: Status
		{
			Return (0x0F)
		}

		Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
		{
		}
	}
}

Has anyone else encountered this problem?

@Xishang7707
Copy link

Hello, G814JV has been processed according to the steps described by https://asus-linux.org/wiki/cirrus-amps/. Although there is sound, the models that have been tried have current sounds.What should I do?

@Peter-Ries
Copy link

Peter-Ries commented Nov 24, 2023

Hi everyone. Thanks to all for contributing and trying to get things work. I read this thread three times, asus-linux.org, and several other git pages. I'm lost now...

Sum up:

  • I have a fresh Asus Zenbook 14 OLED UX3402-VA model (german)
  • I updated to BIOS 302 (latest available from Asus website as of today)
  • Secure boot is off
  • Running an Ubuntu 23.10 with kernel 6.5.0-13-generic

What I did up to now...

  • with the output of dsdt.dsl grepping for 3551 I created/modified the ssdt-csc3551.dsl to the one at the end of this comment
  • I created the aml file from it and copied it to /boot
  • I copied and chmod +x the acpi_01 file to /etc/default/grub.d
  • sudo update-grub
  • reboot: sound not working yet

I don't know if the ubuntu kernel already has the patch for asus sound included nor how to find it out...

Do you have any hint how to get the laptop sound to work?

here's the dsl file:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB_.PC00.SPI0, DeviceObj)
    External (_SB_.PC00.SPI0.SPK1, DeviceObj)

    Scope (_SB.PC00.SPI0.SPK1)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { Zero, One }},
                Package () { "reset-gpios", Package () {
                    SPK1, One, Zero, Zero,
                    SPK1, One, Zero, Zero
                } },
                Package () { "spk-id-gpios", Package () {
                    SPK1, 0x02, Zero, Zero,
                    SPK1, 0x02, Zero, Zero
                } },
                Package () { "cirrus,speaker-position", Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func", Package () { One, One } },
                Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type", Package () { One, One } }
            }
        })
    }

    Scope (_SB.PC00.SPI0)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cs-gpios", Package () { 
                    Zero,                    // Native CS
                    SPK1, Zero, Zero, Zero   // GPIO CS
                } }
            }
        })
    }
}

here's the relevant grepped part searching for 3551:

Scope (_SB.PC00.SPI0)
    {
        Device (SPK1)
        {
            Name (_HID, "CSC3551")  // _HID: Hardware ID
            Name (_SUB, "104316A3")  // _SUB: Subsystem ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
...

@awesqm
Copy link

awesqm commented Nov 27, 2023

Thanks to you all I got sound working on UM3504DA (Asus Zenbook 15 OLED)!

My dsl file looks like this:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CS3551", 0x0000300A)
{

    External (_SB_.I2CB, DeviceObj)
    External (_SB_.I2CB.SPKR, DeviceObj)

    Scope (_SB.I2CB.SPKR)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                        Package () { "reset-gpios", Package () {
                           SPKR, One, Zero, Zero,
                           SPKR, One, Zero, Zero
                        } },
                        Package () { "spk-id-gpios", Package () {
                             SPKR, 0x02, Zero, Zero,
                             SPKR, 0x02, Zero, Zero,
                        } },
                        Package () { "cirrus,speaker-position", Package () { Zero, One } },
                        Package () { "cirrus,gpio1-func", Package () { One, One } },
                        Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                        // boost-type: 0 internal, 1 external
                        Package () { "cirrus,boost-type", Package () { One, One } },
                        // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                        //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                        // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                        //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                        // boost-cap-microfarad: rounded to the nearest integer
                        //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
                    }
                }) /* \_SB.I2CB.SPKR._DSD */
        }
    }

    Scope (_SB.I2CB)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cs-gpios", Package () { 
                            Zero,                    // Native CS
                            SPKR, Zero, Zero, Zero   // GPIO CS
                        } }
                    }
                }) /* \_SB.I2CB.SPKR._DSD */
        }
    }
}

I had to add SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC287_FIXUP_CS35L41_I2C_2), to static const struct snd_pci_quirk alc269_fixup_tbl at line 9500 in file sound/pci/hda/patch_realtek.c and compile linux 6.6.2 kernel (never did it before).

In 6.7 there's ALC294_FIXUP_CS35L41_I2C_2 which appears to do the same as ALC287_FIXUP_CS35L41_I2C_2. UM3504 has ALC294 by the way.

Is there anything I can do to make SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2), appear in source code of the linux kernel so that I never have to compile it again?

@armeldemarsac92
Copy link

Thanks to you all I got sound working on UM3504DA (Asus Zenbook 15 OLED)!

My dsl file looks like this:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CS3551", 0x0000300A)
{

    External (_SB_.I2CB, DeviceObj)
    External (_SB_.I2CB.SPKR, DeviceObj)

    Scope (_SB.I2CB.SPKR)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                        Package () { "reset-gpios", Package () {
                           SPKR, One, Zero, Zero,
                           SPKR, One, Zero, Zero
                        } },
                        Package () { "spk-id-gpios", Package () {
                             SPKR, 0x02, Zero, Zero,
                             SPKR, 0x02, Zero, Zero,
                        } },
                        Package () { "cirrus,speaker-position", Package () { Zero, One } },
                        Package () { "cirrus,gpio1-func", Package () { One, One } },
                        Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                        // boost-type: 0 internal, 1 external
                        Package () { "cirrus,boost-type", Package () { One, One } },
                        // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                        //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                        // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                        //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                        // boost-cap-microfarad: rounded to the nearest integer
                        //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
                    }
                }) /* \_SB.I2CB.SPKR._DSD */
        }
    }

    Scope (_SB.I2CB)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cs-gpios", Package () { 
                            Zero,                    // Native CS
                            SPKR, Zero, Zero, Zero   // GPIO CS
                        } }
                    }
                }) /* \_SB.I2CB.SPKR._DSD */
        }
    }
}

I had to add SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC287_FIXUP_CS35L41_I2C_2), to static const struct snd_pci_quirk alc269_fixup_tbl at line 9500 in file sound/pci/hda/patch_realtek.c and compile linux 6.6.2 kernel (never did it before).

In 6.7 there's ALC294_FIXUP_CS35L41_I2C_2 which appears to do the same as ALC287_FIXUP_CS35L41_I2C_2. UM3504 has ALC294 by the way.

Is there anything I can do to make SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2), appear in source code of the linux kernel so that I never have to compile it again?

awesome ! could you please elaborate a bit on the kernel part ? where you downloaded it and how you edited it ? it would be very nice of you, i have the same model and the sound issue is driving me mad.

@awesqm
Copy link

awesqm commented Nov 27, 2023

awesome ! could you please elaborate a bit on the kernel part ? where you downloaded it and how you edited it ? it would be very nice of you, i have the same model and the sound issue is driving me mad.

I downloaded tarball with wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.2.tar.xz, extracted it, copied default arch linux configuration with sudo zcat /proc/config.gz > .config and added a single line SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC287_FIXUP_CS35L41_I2C_2), to file patch_realtek.c, 9876 on screenshot
image
then built it with the help of this 3 y.o. youtube video.

I barely know what I'm doing so there's probably better way to handle "custom" kernels.

@lamentary
Copy link

Is there anything I can do to make SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2), appear in source code of the linux kernel so that I never have to compile it again?

Great work! I'll have to give it a try, as I have the same model. FWIW, if you want to submit it as a kernel patch (as your question seems to indicate), here are the instructions: https://docs.kernel.org/process/submitting-patches.html

@Peter-Ries
Copy link

Finally got it working on ASUS Zenbook 14 OLED Model UX3402VA.

Using Ubuntu 23.10.

Working dsl file looks like this:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB_.PC00.SPI0, DeviceObj)
    External (_SB_.PC00.SPI0.SPK1, DeviceObj)

    Scope (_SB.PC00.SPI0.SPK1)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { Zero, One }},
                Package () { "reset-gpios", Package () {
                    SPK1, One, Zero, Zero,
                    SPK1, One, Zero, Zero
                } },
                Package () { "spk-id-gpios", Package () {
                    SPK1, 0x02, Zero, Zero,
                    SPK1, 0x02, Zero, Zero
                } },
                Package () { "cirrus,speaker-position", Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func", Package () { One, One } },
                Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type", Package () { One, One } }
            }
        })
    }

    Scope (_SB.PC00.SPI0)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cs-gpios", Package () { 
                    Zero,                    // Native CS
                    SPK1, Zero, Zero, Zero   // GPIO CS
                } }
            }
        })
    }
}

Using the commands provided here for Ubuntu/Debain it worked. My mistake was to copy the 01_acpi file into /etc/default/grub.d instead of /etc/grub.d

Furthermore I found out that the Kernel patch to distinguish betweek UX3402ZA and UX3402VA has been added starting with Kernel 6.5.6 so you need a Kernel >= 6.5.6

For Ubuntu 23.10 shipping 6.5.0-xxx at this time I use a mainline kernel for this. Please google for mainline ppa ubuntu. three lines of code then you can use a mainline-gtk interface to easily install a suitable kernel.

So as of thor2002ro git page:

  • create the aml file from my dsl file
  • copy aml file to /boot
  • copy acpi_01 fiel to /etc/grub.d and make it executable
  • get a mainline kernel 6.5.6+
  • sudo update-grub
  • reboot & select kernel
  • have sound :)

Thanks community.

@staropram
Copy link

staropram commented Dec 1, 2023

I'm trying to get sound working on Zenbook UP6502ZD_UP6502ZD. I've tried various dsl variants, but the best I can get is this:

[    0.012272] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.012274] ACPI: SSDT 0x00000000546E6000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20200925)
[   11.234682] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[   11.811372] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Reset line busy, assuming shared reset
[   11.914416] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Failed waiting for OTP_BOOT_DONE: -110
[   11.927120] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.0 failed with error -110
[   11.927667] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[   12.032348] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Failed waiting for OTP_BOOT_DONE: -110
[   12.043625] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -110

I'm a bit confused about what I can expect to see depending on the absence/presence of the factors.

What is needed to initialise the SPI amplifiers? Just the correct _DSD or do you need that, the firmware, and the kernel patched?

If I get the _DSD correct should I then expect to see non-erroneous output in dmesg or would I also need to have firmware and kernel to see non-erroneous output?

How are people figuring out the correct parameters for the dsl file? (besides the SPI address and SPK name which we get from disassembling the acpidump)

Are people just using random trial and error for things like the reset-gpios parameters? Or is there some logic here? Its a shame we can't just look at the technical spec of the amplifier...

@lamperez
Copy link
Author

lamperez commented Dec 4, 2023

@staropram You should see:

ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
ACPI: SSDT 0x00000000368FC000 0001A0 (v01 CUSTOM CSC3551  00000001 INTL 20200925)
Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

This means that both amplifiers have been detected and reset, that is, both cs-gpios and reset-gpios are good. Notice that the reset GPIO is the same for both amplifiers, and therefore the message Reset line busy, assuming shared reset. Also for SPI, the first chip select GPIO (cs-gpios) is Zero, meaning the default pin provided by the SPI bus, while the other is another GPIO, specified in the ACPI dump. As a result, typically only one amplifier is reset, but this is not your case.

After this, the next log lines should be about loading the correct firmware files, that must be available (package provided by your distro). If only one amplifier is reset, the kernel refuses to load the firmware and nothing works.

And yes, trial and error was the name of the game to get the first working patch. That, and reading a lot of kernel code and specifications of the SPI bus.

@staropram
Copy link

@lamperez thanks for that! I've got a bit of an odd situation now where I have patched the kernel as the top of https://asus-linux.org/wiki/cirrus-amps/ and then I just defined a _DSD for the cs-gpios section:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB_.PC00.SPI1, DeviceObj)
    External (_SB_.PC00.SPI1.SPK1, DeviceObj)

   Scope (_SB.PC00.SPI1)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cs-gpios", Package () {
                    Zero,                    // Native CS
                    SPK1, Zero, Zero, Zero   // GPIO CS
                } }
            }
        })
    }
}

Now I get something a little bid odd from the dmesg output:

$ sudo dmesg | grep CSC
[   11.706278] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[   12.412121] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Using extra _DSD properties, bypassing _DSD in ACPI
[   12.461060] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[   12.484874] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Using extra _DSD properties, bypassing _DSD in ACPI
[   12.484901] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[   12.587890] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Failed waiting for OTP_BOOT_DONE: -110
[   12.599850] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -110

So now it looks like progress was made but that only the first amplifier has been detected? reset?

It's quite hard to understand if they are both detected and not reset or if only one is detected, and whether I have a problem with the reset-gpios in the patch or the cs-gpios in the _DSD.

What do you think?

@alexVinarskis
Copy link

Dell laptop here, XPS 9530 with SPI connected CS35L41, making some progress thanks to this thread, but there are weird SPI issues - takes ~3 minutes to load the firmware, then it all works. I suspect there are misconfiguration in Dell's ACPI tables wrt to SPI configuration. Anyone by chance had a similar problem?

@Peter-Ries I see that you also have SPI connected amp, and managed to make it work - is there a chance you could share ACPI dumps from your machine? Complete one via sudo acpidump > acpi.log , that would really help. Thanks in advance :)

@AlexeyPashnin1
Copy link

Hey guys! Sorry for asking but I'm ubuntu newbee. I've downloaded the files, what should I do next? Except for killing myself with my new laptop of course

@staropram
Copy link

staropram commented Dec 6, 2023

Hey guys! Sorry for asking but I'm ubuntu newbee. I've downloaded the files, what should I do next? Except for killing myself with my new laptop of course

what laptop do you have: can you share the output of

inxi -MA

This should give us the model and the audio system. You might get lucky and have a laptop that already has bleeding edge kernel integration.

Also:

sudo dmesg | grep CSC

@AlexeyPashnin1
Copy link

Hi @staropram :) Here's the outputs

inxi -MA

Machine:
Type: Laptop System: ASUSTeK product: Zenbook UX3402VA_UX3402VA v: 1.0
serial:
Mobo: ASUSTeK model: UX3402VA v: 1.0 serial:
UEFI: American Megatrends LLC. v: UX3402VA.302 date: 05/23/2023
Audio:
Device-1: Intel Raptor Lake-P/U/H cAVS driver: sof-audio-pci-intel-tgl
API: ALSA v: k6.5.0-13-generic status: kernel-api
Server-1: PipeWire v: 0.3.79 status: active

sudo dmesg | grep CSC

[ 2.103571] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[ 2.345764] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[ 2.346390] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[ 2.381187] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

Is there a chance to fix it? Thank you!

@staropram
Copy link

staropram commented Dec 7, 2023

@AlexeyPashnin1

You're lucky, it isn't an issue with the CSC3551 in your case as both CS35l41 ppear to be instantiated, and by the looks of it a quirk was added recently for your machine: see this mailing list entry

Was that all the output from dmesg relating to CSC? There should also be some lines about firmware?

In anycase, you can try applying that kernel patch. Follow this tutorial to compile the linux kernel: don't worry the old kernel will still be an option in the boot menu if something goes wrong (make sure you edit /etc/default/grub and comment out the GRUB_TIMEOUT_STYLE=hidden option and then add GRUB_TIMEOUT=10 otherwise you'll never see the boot menu if something was going wrong, then run sudo update-grub to make sure this change is applied).

The patch looks like it is already in the current stable version 6.6.4 if you look here: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/sound/pci/hda/patch_realtek.c?h=v6.6.4#n9892

So it hopefully is as straightforward as compiling and installing the 6.6.4 kernel and it should work.

What kernel are you currently running btw? run uname -a pls

@AlexeyPashnin1
Copy link

@staropram

Was that all the output from dmesg relating to CSC?

Yeah, that's it. I've grepped this now, too
sudo dmesg | grep 'firmware'

[ 1.869087] systemd[1]: systemd-pcrmachine.service - TPM2 PCR Machine ID Measurement was skipped because of an unmet condition check (ConditionPathExists=/sys/firmware/efi/efivars/StubPcrKernelImage-4a67b082-0a4c-41cf-b6c7-440b29bb8c4f).
[ 2.330088] iwlwifi 0000:00:14.3: loaded firmware version 83.e8f84e98.0 so-a0-gf-a0-83.ucode op_mode iwlmvm
[ 2.707903] i915 0000:00:02.0: [drm] Finished loading DMC firmware i915/adlp_dmc.bin (v2.20)
[ 2.729786] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/adlp_guc_70.bin version 70.5.1
[ 2.729797] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc.bin version 7.9.3
[ 2.829317] Bluetooth: hci0: Minimum firmware build 1 week 10 2014
[ 2.839905] Bluetooth: hci0: Found device firmware: intel/ibt-0040-0041.sfi
[ 4.363514] Bluetooth: hci0: Waiting for firmware download to complete
[ 4.405729] iwlwifi 0000:00:14.3: Loaded firmware version: 83.e8f84e98.0 so-a0-gf-a0-83.ucode
[26973.001094] i915 0000:00:02.0: [drm] GT0: GuC firmware i915/adlp_guc_70.bin version 70.5.1
[26973.001098] i915 0000:00:02.0: [drm] GT0: HuC firmware i915/tgl_huc.bin version 7.9.3
[26973.594981] audit: type=1400 audit(1701948974.855:188): apparmor="DENIED" operation="open" class="file" profile="snap.firmware-updater.firmware-notifier" name="/proc/sys/vm/max_map_count" pid=4008 comm="firmware-notifi" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

Follow this tutorial to compile the linux kernel

I've run the command for Debian users (because Ubuntu is Debian-based, if I get it right)
sudo apt install bc binutils bison dwarves flex gcc git gnupg2 gzip libelf-dev libncurses5-dev libssl-dev make openssl pahole perl-base rsync tar xz-utils

downloaded the patch,

then unxz --keep linux-*.tar.xz

then gpg2 --locate-keys torvalds@kernel.org gregkh@kernel.org (got the same output as in the manual)

but stuck on the next step gpg2 --verify linux-*.tar.sign with this output

gpg: can't open 'linux-*.tar.sign': No such file or directory
gpg: verify signatures failed: No such file or directory

I was in the Downloads folder. Also tried cd to .gnupg and run the command there - no luck. God, its so embarrassing

Could you please point out to me where I failed?

What kernel are you currently running btw

I've found that previously, sorry that didn't specify it
6.5.0-13-generic

@staropram
Copy link

@AlexeyPashnin1 yes that step isn't particularly clear as you have to manually download the signature from kernel.org homepage it's the link for the kernel you chose called pgp

@kverb
Copy link

kverb commented Dec 7, 2023

[updated solution at the bottom] ux5304va (raptor-lake intel, SPI amp) here still with no sound, and I believe i've grokked all the steps involved. I've followed steps from this gist, asus-linux.org, and Badger's solution, but still have no sound. I'm using EndeavourOS (arch-based) and systemd-boot. I do not have windows dual-booted. In alsamixer / pavucontrol etc, i can see the sound card, the speaker output can be used as a playback device, and its meters show as if sound is playing, but nothing is audible over the speakers.

My output of journalctl -b -g 'hda|audio' --case-sensitive=false --output short-monotonic[1] shows something a little different from @lamperez 's gist - i don't see the cs35l41 firmware being loaded. instead, it appears that sof-audio-pci-intel-tgl is being used. I'm not sure how to override this to use the firmware files from asus-linux's git repo. Uninstalling the sof-firmware package in pacman just results in firmware files not being found.

great info in the comments here, TIA for any guidance.

1:

[    5.426584] zb13 kernel: snd_hda_intel 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[    5.514875] zb13 kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[    5.517543] zb13 kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    5.559239] zb13 kernel: cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[    5.742253] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[    5.742324] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[    5.742359] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002)
[    5.743009] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[    7.293260] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    7.397241] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode
[    7.454518] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 5
[    7.454525] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[    7.454530] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: DMICs detected in NHLT tables: 2
[    7.456071] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    7.456075] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[    7.456082] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
[    7.570438] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    7.570454] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[    7.602488] zb13 kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0
[    7.602820] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Parent card not yet available, widget card binding deferred
[    7.645047] zb13 kernel: snd_hda_codec_realtek ehdaudio0D0: autoconfig for ALC294: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
[    7.645054] zb13 kernel: snd_hda_codec_realtek ehdaudio0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    7.645056] zb13 kernel: snd_hda_codec_realtek ehdaudio0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[    7.645059] zb13 kernel: snd_hda_codec_realtek ehdaudio0D0:    mono: mono_out=0x0
[    7.645060] zb13 kernel: snd_hda_codec_realtek ehdaudio0D0:    inputs:
[    7.645061] zb13 kernel: snd_hda_codec_realtek ehdaudio0D0:      Headset Mic=0x19
[    8.087668] zb13 kernel: snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX overwritten
[    8.087689] zb13 kernel: snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX overwritten
[    8.088062] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi3 overwritten
[    8.088076] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi2 overwritten
[    8.088087] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget hifi1 overwritten
[    8.088098] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Codec Output Pin1 overwritten
[    8.088109] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Codec Input Pin1 overwritten
[    8.088125] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Analog Codec Playback overwritten
[    8.088140] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Digital Codec Playback overwritten
[    8.088156] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Alt Analog Codec Playback overwritten
[    8.088182] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Analog Codec Capture overwritten
[    8.088198] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Digital Codec Capture overwritten
[    8.088213] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget Alt Analog Codec Capture overwritten
[    8.088247] zb13 kernel: skl_hda_dsp_generic skl_hda_dsp_generic: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3
[    8.111434] zb13 kernel: input: sof-hda-dsp Headset Mic as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input11
[    8.111595] zb13 kernel: input: sof-hda-dsp Headphone as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input12
[    8.111834] zb13 kernel: input: sof-hda-dsp HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input13
[    8.111932] zb13 kernel: input: sof-hda-dsp HDMI/DP,pcm=4 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input14
[    8.112140] zb13 kernel: input: sof-hda-dsp HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input15

update, Dec 9 2023. SOLVED, sort of. In addition to the SSDT and kernel patch, I added to a modprobe.d conf, and sudo depmod -a to rebuild module deps:

options snd-intel-dspcfg dsp_driver=1
options snd-hda-intel model=1043:1c9f

With both of these options enabled, I now get the DSP firmware files loaded and speaker sound works. Still not sure why my firmware is not getting loaded otherwise. My best guess is that I'm not doing the patch to patch_realtek.c correctly, and dmesg output matches similarly to OP's.

@abishekmuthian
Copy link

G634JY Audio success thanks to @alex-spataru & @flukejones . Special mention @v-gu for sharing his trick as well.

After patching the SSDT as per advice of Alex https://gist.github.com/lamperez/862763881c0e1c812392b5574727f6ff?permalink_comment_id=4752975#gistcomment-4752975 and with recent kernel of Luke (6.6.3-666.rog.fc39.x86_64) which has reset_gpio = 1 for 10431CAF the audio is perfect.

intel VMD has to be disabled for fixing the crackling noise (Note if you dual boot Windows, it needs to be enabled each time). Asus doesn't seem to be providing bios profiles for laptops?

dmesg |grep CSC3551
[    0.019249] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.019250] ACPI: SSDT 0x0000000039533000 0002DE (v01 CUSTOM CSC3551  00000002 INTL 20220331)
[   27.382513] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[   27.523446] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Using extra _DSD properties, bypassing _DSD in ACPI
[   27.561671] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[   27.561877] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Using extra _DSD properties, bypassing _DSD in ACPI
[   27.561879] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[   27.586603] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[   27.646130] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[   27.646134] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot-10431caf.wmfw: Fri 27 Aug 2021 14:58:19 W. Europe Daylight Time
[   27.787018] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.43.1, 2 algorithms
[   27.787769] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot-10431caf-spkid0-l0.bin: v0.43.1
[   27.787772] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: spk-prot: C:\Users\dchunyi\Documents\Asus_ROG\Project\G6_Strix16\Tuning\20220930\G634\10431CAF_220930_V1_A0.bin
[   27.821862] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: CS35L41 Bound - SSID: 10431CAF, BST: 1, VSPK: 1, CH: L, FW EN: 1, SPKID: 0
[   27.821865] snd_hda_codec_realtek hdaudioC0D0: bound spi0-CSC3551:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[   27.824017] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware version: 3
[   27.824020] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot-10431caf.wmfw: Fri 27 Aug 2021 14:58:19 W. Europe Daylight Time
[   27.963499] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware: 400a4 vendor: 0x2 v0.43.1, 2 algorithms
[   27.964142] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot-10431caf-spkid0-r0.bin: v0.43.1
[   27.964144] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: spk-prot: C:\Users\dchunyi\Documents\Asus_ROG\Project\G6_Strix16\Tuning\20220930\G634\10431CAF_220930_V1_A1.bin
[   28.003888] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: CS35L41 Bound - SSID: 10431CAF, BST: 1, VSPK: 1, CH: R, FW EN: 1, SPKID: 0
[   28.003891] snd_hda_codec_realtek hdaudioC0D0: bound spi0-CSC3551:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[  358.577016] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Failed to read 256 bytes from 2800608: -16

@AlexeyPashnin1
Copy link

AlexeyPashnin1 commented Dec 8, 2023

@staropram when I make sudo gpg2 --locate-keys torvalds@kernel.org gregkh@kernel.org i can see this path with the .pgp in the output /root/.gnupg/trustdb.gpg

Oh, I saw the mistake after I wrote this: you told about the pgp link, not gpg. Then I don't see anything like it :(

gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key 38DBBDC86092693E: public key "Greg Kroah-Hartman gregkh@kernel.org" imported
gpg: Total number processed: 1
gpg: imported: 1
gpg: key 79BE3E4300411886: public key "Linus Torvalds torvalds@kernel.org" imported
gpg: Total number processed: 1
gpg: imported: 1
pub rsa4096 2011-09-23 [SC]
647F28654894E3BD457199BE38DBBDC86092693E
uid [ unknown] Greg Kroah-Hartman gregkh@kernel.org
sub rsa4096 2011-09-23 [E]

pub rsa2048 2011-09-20 [SC]
ABAF11C65A2970B130ABE3C479BE3E4300411886
uid [ unknown] Linus Torvalds torvalds@kernel.org
sub rsa2048 2011-09-20 [E]

but when I try gpg2 --verify /root/.gnupg/trustdb.gpg as a superuser I get the following

gpg: no valid OpenPGP data found.
gpg: the signature could not be verified.
Please remember that the signature file (.sig or .asc)
should be the first file given on the command line.

Or did I misunderstand you and something else needs to be done with this file?

UPD: I get that I need to load the archive and .sign file. Now I'm in the process of finding the suitable for 6.5.0-13-generic

UPD2: got the linux_6.5.0.orig.tar.gz package from https://launchpad.net/ubuntu/+source/linux/6.5.0-13.13, but the unxz linux_6.5.0.orig.tar.gz returns

unxz: linux_6.5.0.orig.tar.gz: File format not recognized

And also I can't find the .sign file for this :(

@staropram
Copy link

staropram commented Dec 8, 2023

@AlexeyPashnin1 hi

Checking the signature isn't strictly necessary depending on how paranoid you are. You are checking that the kernel source tar is signed by one of the kernel devs so that there hasn't been a man-in-the-middle attack. I think this is unlikely but is always wise to be cautious as the kernel would be the perfect place to put a rootkit. You should see output like this:

ash@sparky2:~/kernel$ ls | grep 6.6.3
linux-6.6.3
linux-6.6.3.tar
linux-6.6.3.tar.sign
linux-6.6.3.tar.xz

ash@sparky2:~/kernel$ gpg2 --verify linux-*.tar.sign
gpg: assuming signed data in 'linux-6.6.3.tar'
gpg: Signature made Tue 28 Nov 2023 17:21:00 GMT
gpg:                using RSA key 647F28654894E3BD457199BE38DBBDC86092693E
gpg: Good signature from "Greg Kroah-Hartman <gregkh@kernel.org>" [unknown]
gpg: WARNING: This key is not certified with a trusted signature!
gpg:          There is no indication that the signature belongs to the owner.
Primary key fingerprint: 647F 2865 4894 E3BD 4571  99BE 38DB BDC8 6092 693E

The WARNING it gives can be ignored if we are sure we trust Greg and that really is his signature. You'll see this fingerprint everywhere associated with him so we can safely assume it is him (or someone is able to impersonate him over multiple years and trusted positions, at which point it may as well be him).

Once you know your tar is legit, you can proceed.

Why are you trying to find 6.5.0-13-generic? Just use 6.6.5 directly from kernel.org. Unless there is some specific reason you need 6.5.0-13-generic?

@AlexeyPashnin1
Copy link

AlexeyPashnin1 commented Dec 8, 2023

@staropram Hi!

From your previous answer, I understood that I need to download a different version. Obviously, I got it wrong.

I'm still at the verifying step and I don't know what I need to do to get off it. Did I understand correctly that it is optional? gpg2 --verify linux-*.tar.sign.

I'm not paranoid and just want to hear the sound on the laptop, but I get the No such file or directory output and does it make sense to move to the next step?

UPD: I tried to go from the beginning.

  1. downloaded the linux-6.6.5.tar.xz
  2. unxz --keep linux-*.tar.xz
  3. the linux-6.6.5.tar archive has appeared in the Downloads folder
  4. unpacked it
  5. cd to the Downloads/linux-6.6.5/kernel
  6. ls | grep 6.6.5 - nothing
  7. gpg2 --verify linux-*.tar.sign - No such file or directory

Obviously, I don't understand some basic things, but I won't jump over this wall without help. I'm sorry if I'm being stupid.

UPD2: I just skipped this step and followed the commands further along the manual. I broke the system, now it doesn't boot. Reinstalling it.
R.I.P.

@alexVinarskis
Copy link

alexVinarskis commented Dec 8, 2023

Not sure you guys were familiar with it - i was debugging Dell's Cirrus amps over SPI, which were also missing cs-gpios, and found a way to set them from kernel patch, no more need for .dsl at all

From what i saw above, some of Asus models with SPI also are missing cs-gpio pins, and on top of your upcoming kernel patch required smaller .dsl overwrite. This should help you fix it:

From c814d07190a645dcce33e4407c6f6d8bb7ebaef2 Mon Sep 17 00:00:00 2001
From: Aleksandrs Vinarskis <alex.vinarskis@gmail.com>
Date: Mon, 4 Dec 2023 19:16:18 +0100
Subject: [PATCH] ALSA: hda: cs35l41: Dell Fiorano add missing _DSD properties

---
 sound/pci/hda/cs35l41_hda_property.c | 39 ++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
index c83328971728..066ec38e3d3c 100644
--- a/sound/pci/hda/cs35l41_hda_property.c
+++ b/sound/pci/hda/cs35l41_hda_property.c
@@ -8,6 +8,7 @@
 
 #include <linux/gpio/consumer.h>
 #include <linux/string.h>
+#include <linux/spi/spi.h>
 #include "cs35l41_hda_property.h"
 
 /*
@@ -43,6 +44,43 @@ static int lenovo_legion_no_acpi(struct cs35l41_hda *cs35l41, struct device *phy
 	return 0;
 }
 
+/*
+ * Device 10280BEB (Dell XPS 9530) doesn't have _DSD at all. Moreover, pin that is typically
+ * used for `speaker_id` is missing.
+ * The CSC3551 is SPI connected. Since chip select GPIOs are not present either, at the
+ * moment 10280BEB requires an ACPI table patch in addition to this patch.
+ */
+static int dell_fiorano_no_acpi(struct cs35l41_hda *cs35l41, struct device *physdev, int id,
+				const char *hid)
+{
+	struct cs35l41_hw_cfg *hw_cfg = &cs35l41->hw_cfg;
+
+	dev_info(cs35l41->dev, "Adding DSD properties for %s\n", cs35l41->acpi_subsystem_id);
+
+	/* check SPI address to assign the index */
+	cs35l41->index = id;
+	cs35l41->channel_index = 0;
+	/* 10280BEB is missing pin which is typically assigned to `spk-id-gpios` */
+	cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, cs35l41->index, 2, -1);
+	cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 1, GPIOD_OUT_LOW);
+
+	hw_cfg->spk_pos = cs35l41->index  ? 1 : 0;	// 0th L, 1st R
+	hw_cfg->bst_type = CS35L41_EXT_BOOST;
+	hw_cfg->gpio1.func = CS35l41_VSPK_SWITCH;
+	hw_cfg->gpio1.valid = true;
+	hw_cfg->gpio2.func = CS35L41_INTERRUPT;
+	hw_cfg->gpio2.valid = true;
+	hw_cfg->valid = true;
+
+	/* Add second cs-gpio here */
+	if (cs35l41->index) {
+		struct spi_device *spi = to_spi_device(cs35l41->dev);
+		spi->cs_gpiod = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
+	}
+
+	return 0;
+}
+
 /*
  * Device 103C89C6 does have _DSD, however it is setup to use the wrong boost type.
  * We can override the _DSD to correct the boost type here.
@@ -92,6 +130,7 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
 	{ "CLSA0100", NULL, lenovo_legion_no_acpi },
 	{ "CLSA0101", NULL, lenovo_legion_no_acpi },
 	{ "CSC3551", "103C89C6", hp_vision_acpi_fix },
+	{ "CSC3551", "10280BEB", dell_fiorano_no_acpi },
 	{}
 };
 
-- 
2.40.1


Particularly:

include <linux/spi/spi.h>
...

	if (cs35l41->index) {
		struct spi_device *spi = to_spi_device(cs35l41->dev);
		spi->cs_gpiod = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
	}

this adds 0th pin from ACPI table to as 2nd amp's chipselect. 1st amp uses native chip select by default, which makes it equivalent to:

Scope (_SB.SPI2)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cs-gpios", Package () { 
                            Zero,                    // Native CS
                            SPKR, Zero, Zero, Zero   // GPIO CS
                        } }
                    }
                }) /* \_SB.SPI2.SPKR._DSD */
        }
    }

Hope this helps!

@staropram
Copy link

@AlexeyPashnin1 the reason the command doesn't work is because the signature file isn't there.

Say you download 6.6.5 from kernel.org then you also need the signature file, which for 6.6.5 is this on kernel.org this is the file called pgp that is on the same line as 6.6.5, does that make sense? Now the verification should work

@staropram
Copy link

@alexVinarskis that's cool, thanks, it's quite similar to luke's patch here except you are also setting the 2nd CS, I will give that a go.

Is id always 0 on the first call and then 1 on the subsequent call? Presumably, would make sense.

How did you figure out that for your device you needed cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 1, GPIOD_OUT_LOW); for the 1st chip and spi->cs_gpiod = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH); for the 2nd chip? How did you know this corresponds to those _DSD settings?

I feel like I'm missing some information others seem to have, did you manage to get the spec sheet or something?

@alexVinarskis
Copy link

@staropram unfortunately I do not have anymore information, most of my cirrus knowladge comes from this thread, and luke's patch you have posted.

it's quite similar to luke's patch here except you are also setting the 2nd CS, I will give that a go.

Correct, its mostly similar to Luke's patch, and to HP patch that Cirrus devs already added to the file. Minor differnces in pin configs

Is id always 0 on the first call and then 1 on the subsequent call? Presumably, would make sense.

yes seems that the order of initialization. One may change which one is left, which is right, but seems matching id with index is correct way to go

How did you figure out that for your device you needed cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 1, GPIOD_OUT_LOW); for the 1st chip and spi->cs_gpiod = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);

Some confusion here - both chips have reset pins, and both chips need chip select pin.

The pin number (Zero, One, 0x02 for .dsl, and gpiod_get_index(physdev, NULL, XX, GPIOD_OUT_LOW); - XX in kernel) represent order of pins in ACPI table. You first see x2 SPI/I2C identifiers, then followed by 4 or 5 pins definitions - these pins shall be allocated to functions.

Last two pins are the same pin (check by hex number), which are also shared - this seems to be interrupt, and we do not need to allocated them. It leaves us with 3 pins (for most of you) or 2 pins (for my unlucky case) to allocated.

Seems that on all dual CS amps system reset line is shared. Reset line is output and it is active HIGH (electronics), so default state is PullDown (.dsl) or GPIOD_OUT_LOW (kernel). That means both chips would have the same entry of cs35l41->reset_gpio = gpiod_get_index(physdev, NULL, 1, GPIOD_OUT_LOW); for those who have reset pin 1st (seems that SPI devices have chip select pin 0th, while for I2C devices reset is 0th, but you guys already figured this one out :)

Next, for SPI devices there shall be chip select pin. The way it works is the SPI controller has one native chip select, but you have two chips, so there need to be two pins to talk to two chips - one is used by default (SPI controller's native one), and it opens connection to 1st instance of driver (whichever device has id 0). Second pin is generic motherboard pin which shall be allocated for SPI driver to know that - which is why you would require .dsl patch to add SPKR, Zero, Zero, Zero - here 1st Zero you see is 0th pin from ACPI table. Easy way to tell which one it is that chip select is active low (again electronics), so default state would be PullUp/GPIOD_OUT_HIGH. It is also an Output pin. Taking a glance at ACPI pins order, for devices with SPI its the 0th entry.

Thus, in my patch i added the code

if (cs35l41->index) {
		struct spi_device *spi = to_spi_device(cs35l41->dev);
		spi->cs_gpiod = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
	}

=> non-0 index (aka index=1) set chip select to 0th pin from ACPI table, in 'PullUp' mode. Strictly speaking probably even if you set it low instead, and same for reset, it would still work, as driver starts fast and switch them to correct mode. Doesn't hurt to be correct though. The reason 0th chip did not need to specify pin select is because every SPI master has one native chip select pin, and would use that one on its own, assuming its connected somewhere. For any more pins, someone has to inform it about.

Finally, in your cases guys, SPI devices have 5th pin, which in ACPI is indicated as InputOnly, meaning it can be used for reading data in - its index 0x02 for you. That is the only pin which can be used as spk-id pin, and is also likely shared for both ICs. In my case, that pin is simply missing, similarly to HP device which Cirrus dev's already added. Which is why in my case I call internal function with different parameters (id of current chip, total number of chips, and negative pin number, so that it will not use external pin for that), which evaluated to SPK_ID=-19, and loads firmware without _spkidX_ prefix in its name.

To summarize, i believe all you have to do is to add my code extract above to all SPI powered devices (if you do it to I2C device, it will likely crash), without any modification, and it should just work without .dsl. Only exception would be if there is different pin order in ACPI table, but i believe with info i wrote above one shall be able to easily identify which pin is used for what

@staropram
Copy link

staropram commented Dec 8, 2023

@alexVinarskis you're a genius! by adding

if (cs35l41->index) {
		struct spi_device *spi = to_spi_device(cs35l41->dev);
		spi->cs_gpiod = gpiod_get_index(physdev, NULL, 0, GPIOD_OUT_HIGH);
}

it appears as if both cs35l41 are initialised:

$ sudo dmesg | grep CSC
[   11.824760] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[   12.579937] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Calling cs35l41_hda_probe
[   12.580115] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Adding DSD properties for 10431DA2
[   12.580857] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Using extra _DSD properties, bypassing _DSD in ACPI
[   12.629292] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[   12.629833] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Calling cs35l41_hda_probe
[   12.630020] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Adding DSD properties for 10431DA2
[   12.631180] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Using extra _DSD properties, bypassing _DSD in ACPI
[   12.631197] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[   12.674447] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2

Sound still doesn't work as I still see no speaker:

$ sudo dmesg | grep speaker
[   13.045871] snd_hda_codec_realtek ehdaudio0D0: autoconfig for ALC294: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
[   13.045881] snd_hda_codec_realtek ehdaudio0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)

Not sure why it's not working. I tried adding ALC294_FIXUP_ASUS_DUAL_SPK to patch_realtek.c for my model but I am completely guessing at this point so I've deleted that.

My current speaker Id line is this: cs35l41->speaker_id = cs35l41_get_speaker_id(physdev, 0, 0, 2); since that was from another patch. I'm guessing this is incorrect and this is why I don't init speakers.

@alexVinarskis
Copy link

@staropram indeed you would need ALC294_FIXUP_ASUS_DUAL_SPK or something similar to a) do 0x17 quirk and b) initialize x2 SPI instances of the Cirrus - as per your dmesg there is no firmware loading attempt. ALC245_FIXUP_CS35L41_SPI_2 should enable firmware loading - try it, and you should see firmware loading in dmesg, altough most likely speakers still will not work due to missing 0x17 quirk

In that case, try something similar to ALC289_FIXUP_DELL_CS35L41_SPI_2 in this commit - you need to create new function which chains ALC245_FIXUP_CS35L41_SPI_2 and ALC294_FIXUP_ASUS_DUAL_SPK

@staropram
Copy link

@alexVinarskis it works!! The speakers actually work!

ALC245_FIXUP_CS35L41_SPI_2 quirk was the final piece of the puzzle! Thank you so much for your help.

@armeldemarsac92
Copy link

awesome ! could you please elaborate a bit on the kernel part ? where you downloaded it and how you edited it ? it would be very nice of you, i have the same model and the sound issue is driving me mad.

I downloaded tarball with wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.6.2.tar.xz, extracted it, copied default arch linux configuration with sudo zcat /proc/config.gz > .config and added a single line SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC287_FIXUP_CS35L41_I2C_2), to file patch_realtek.c, 9876 on screenshot image then built it with the help of this 3 y.o. youtube video.

I barely know what I'm doing so there's probably better way to handle "custom" kernels.

I finally got it working thanks to your explanations and those from Sir Desjardin ! Thanks a lot 👍

@jnbrunet
Copy link

jnbrunet commented Dec 9, 2023

Hey all,

I've got an asus UX7602Z (no M at the end) and I'm trying to make the sound work. Following this tutorial by @alex-spataru for the asus UX7602ZM, along with installing the 6.7.rc4 kernel on my fedora 39, the sound is much better than before (much louder).

However it is still not completely right. It looks like I have only 3 or 4 sound "volume stage", each time I have to turn the volume up a couple of time for it to finally change and jump to another sound "volume stage". It is also a bit distorted.

I have the following log using journalctl -b -g CSC3551 --output short-monotonic:

[    0.013934] fedora kernel: ACPI: SSDT 0x000000004D5FE6D3 0002D6 (v01 CUSTOM CSC3551  00000003 INTL 20220331)
[    7.583769] fedora kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[    7.833083] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[    7.834786] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    7.876442] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[    8.237378] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Falling back to default firmware.
[    8.239523] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[    8.239525] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[    8.392367] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[    8.393684] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.bin: v0.58.0
[    8.393687] fedora kernel: cs35l41-hda spi0-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\Fix>
[    8.417152] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: CS35L41 Bound - SSID: 10431F62, BST: 1, VSPK: 1, CH: L, FW EN: 1, SPKID: 0
[    8.417161] fedora kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi0-CSC3551:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[    8.417307] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Falling back to default firmware.
[    8.419473] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware version: 3
[    8.419476] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[    8.559588] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[    8.560734] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.bin: v0.58.0
[    8.560736] fedora kernel: cs35l41-hda spi0-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\Fix>
[    8.586371] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: CS35L41 Bound - SSID: 10431F62, BST: 1, VSPK: 1, CH: R, FW EN: 1, SPKID: 0
[    8.586378] fedora kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi0-CSC3551:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])

Any idea what could be going on here?

@staropram
Copy link

staropram commented Dec 9, 2023

@jnbrunet this might be a red herring but does Falling back to default firmware mean that it isn't using the exact firmware for your machine? I actually get the same and I do wonder why this is as I did copy the firmware files.

Looking at the function cs35l41_request_firmware_files in cs35141_hda.c the function cs35l41_fallback_firmware_file which outputs our message is only called if all the various ways of looking up the firmware fail. So, let us examine these outputs. I will add a printout to cs35l41_request_firmware_file :

printk(KERN_INFO "Stripped firmware name: \"%s\"\n",*filename);

Just after it constructs the filename and strips it to see what it is actually looking for. Rebooted and this is the output:

[   13.074470] Stripped firmware name: "cirrus/cs35l41-dsp1-spk-prot-10431da2-l0.wmfw"
[   13.076476] Stripped firmware name: "cirrus/cs35l41-dsp1-spk-prot-10431da2.wmfw"
[   13.078222] Stripped firmware name: "cirrus/cs35l41-dsp1-spk-prot-10431da2-l0.bin"
[   13.079021] Stripped firmware name: "cirrus/cs35l41-dsp1-spk-prot-10431da2.bin"
[   13.079636] Stripped firmware name: "cirrus/cs35l41-dsp1-spk-prot.wmfw"
[   13.080231] Stripped firmware name: "cirrus/cs35l41-dsp1-spk-prot.bin"

And what do I have:

# ls -l /lib/firmware/cirrus/ | grep 10431da2
-rw-r--r-- 1 root root  1152 Dec  1 21:25 cs35l41-dsp1-spk-cali-10431da2-spkid1-l0.bin.zst
-rw-r--r-- 1 root root  1150 Dec  1 21:25 cs35l41-dsp1-spk-cali-10431da2-spkid1-r0.bin.zst
lrwxrwxrwx 1 root root    73 Dec  1 21:27 cs35l41-dsp1-spk-cali-10431da2.wmfw -> /lib/firmware/cirrus/cs35l41/v6.61.1/halo_cspl_RAM_revB2_29.63.1.wmfw.zst
lrwxrwxrwx 1 root root    73 Dec  1 21:28 cs35l41-dsp1-spk-cali-10431da2.wmfw.zst -> /lib/firmware/cirrus/cs35l41/v6.61.1/halo_cspl_RAM_revB2_29.63.1.wmfw.zst
-rw-r--r-- 1 root root  2869 Dec  1 21:25 cs35l41-dsp1-spk-prot-10431da2-spkid1-l0.bin.zst
-rw-r--r-- 1 root root  2873 Dec  1 21:25 cs35l41-dsp1-spk-prot-10431da2-spkid1-r0.bin.zst
lrwxrwxrwx 1 root root    73 Dec  9 08:14 cs35l41-dsp1-spk-prot-10431da2.wmfw -> /lib/firmware/cirrus/cs35l41/v6.83.0/halo_cspl_RAM_revB2_29.85.0.wmfw.zst
lrwxrwxrwx 1 root root    73 Dec  1 21:28 cs35l41-dsp1-spk-prot-10431da2.wmfw.zst -> /lib/firmware/cirrus/cs35l41/v6.61.1/halo_cspl_RAM_revB2_29.63.1.wmfw.zst

So not sure what is going on here, only filename that would directly match is cirrus/cs35l41-dsp1-spk-prot-10431da2.wmfw so I wonder if its symlink is wrong as there are several options:

# ls /lib/firmware/cirrus/cs35l41/
v6.39.0  v6.47.0  v6.61.1  v6.63.0  v6.78.0  v6.83.0

I will try symlinking my matching file to the latest version.

...OK that didn't work.

but I would guess either this is your issue or there is some quirk you need in patch_realtek.c. I'll see if I can fix this firmware issue later (my sound works fine but I wonder if it would sound better if the correct firmware was loaded).

@jnbrunet
Copy link

jnbrunet commented Dec 9, 2023

@staropram very good idea to trace the cs35l41_request_firmware_files function.

How did you get those firmware files in the first place? In my case, I have nothing in /lib/firmware/cirrus matching my id 10431F62. I do however have the same as you in /lib/firmware/cirrus/cs35l41:

# ls /lib/firmware/cirrus/cs35l41/
v6.39.0  v6.47.0  v6.61.1  v6.63.0  v6.78.0  v6.83.0

In my case however, the wmfw files are compressed as xz files, for eg: /lib/firmware/cirrus/cs35l41/v6.83.0/halo_cspl_RAM_revB2_29.85.0.wmfw.xz. So I tried to uncompress them and sym link into /lib/firmware/cirrus using the 10431F62 ID...

# ln -s /lib/firmware/cirrus/cs35l41/v6.83.0/halo_cspl_RAM_revB2_29.85.0.wmfw /lib/firmware/cirrus/cs35l41-dsp1-spk-prot-10431f62.wmfw
# ls /lib/firmware/cirrus | grep 10431f62
lrwxrwxrwx. 1 root root    69 Dec  9 17:47 cs35l41-dsp1-spk-prot-10431f62.wmfw -> /lib/firmware/cirrus/cs35l41/v6.83.0/halo_cspl_RAM_revB2_29.85.0.wmfw

However I still get the Falling back to default firmware after a reboot.

[    0.014267] fedora kernel: ACPI: SSDT 0x000000004D6006D3 0002D6 (v01 CUSTOM CSC3551  00000003 INTL 20220331)
[    7.615769] fedora kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[    7.853871] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[    7.854399] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    7.912831] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[    8.239638] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Falling back to default firmware.
[    8.241986] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[    8.241989] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[    8.392546] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[    8.393611] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.bin: v0.58.0
[    8.393640] fedora kernel: cs35l41-hda spi0-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\Fix>
[    8.414885] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: CS35L41 Bound - SSID: 10431F62, BST: 1, VSPK: 1, CH: L, FW EN: 1, SPKID: 0
[    8.414889] fedora kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi0-CSC3551:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[    8.415047] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Falling back to default firmware.
[    8.416668] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware version: 3
[    8.416679] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[    8.559904] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[    8.561188] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.bin: v0.58.0
[    8.561191] fedora kernel: cs35l41-hda spi0-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\Fix>
[    8.586473] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: CS35L41 Bound - SSID: 10431F62, BST: 1, VSPK: 1, CH: R, FW EN: 1, SPKID: 0
[    8.586478] fedora kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi0-CSC3551:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[  322.821071] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Failed to read 256 bytes from 2800620: -16

@awesqm
Copy link

awesqm commented Dec 9, 2023

@jnbrunet see https://gist.github.com/masselstine/8fe9634b4c31cef07b8dfab089e4eb38 , I just used blobs from windows and I don't get Falling back to default firmware anymore.

@dorian-cruveiller
Copy link

dorian-cruveiller commented Dec 10, 2023

Hi @lamperez, i have the same chip but in i2c, how did you found the gpios cause i'm searching the gpio for reset but i cannot get it, here is the error from journalctl:

kernel: cs35l41-hda i2c-CSC3551:00-cs35l41-hda.1: error -ENOENT: Failed to get reset GPIO

My laptop is the Legion Slim 7 Gen 8 16APH8 with AMD CPU by the way

@jnbrunet
Copy link

@jnbrunet see https://gist.github.com/masselstine/8fe9634b4c31cef07b8dfab089e4eb38 , I just used blobs from windows and I don't get Falling back to default firmware anymore.

@yaktoni that was it ! Thanks a lot

I had to use the uncompressed files, for some reason compressing them to zst or xz files didn't work on Fedora.

For someone else with UX7602Z and Fedora, this is what I did:

  1. Upgrade kernel to 6.7
  2. Follow https://github.com/badgers-ua/asus_zenbook_ux5304va_sound#patch-installation (the patch installation section)
  3. Instead of sudo update-grub, use grub2-mkconfig -o /boot/grub2/grub.cfg
  4. Get the directory "c:\windows\system32\csaudio" from the Windows partition
  5. Add the following script "compress-rename.sh" inside this csaudio folder (script that I updated from here
#!/usr/bin/bash
#
# Create the needed Linux firmware files from a copy of the firmware
# files from Windows (c:\windows\system32\csaudio)
#
mkdir -p out
for t in cali prot
do    
    for i in 0 1
    do
        for side in l r
        do
            j=0
            if [ $side == "r" ]; then
                j=1
            fi
            deco=""
            if [ $t == "cali" ]; then
                deco="_cal"
            fi
	    cp 10431F62_220112_V01_A${j}${deco}.bin out/cs35l41-dsp1-spk-${t}-10431f62-spkid${i}-${side}0.bin
        done
    done
    cp halo_cspl_RAM_revB2_29.63.1.wmfw out/cs35l41-dsp1-spk-${t}-10431f62.wmfw
done
  1. Execute the script and copy the raw files to /lib/firmware/cirrus:
./compress-rename.sh
sudo cp out/* /lib/firmware/cirrus/
  1. reboot

@staropram
Copy link

@jnbrunet good advice,

btw you can also just install and choose the extract option under wine if you deleted windows

For me however the firmware files were not any different to those I'd already obtained from here however there are several different versions shipped with the driver so i will try a few out next time I'm messing about with this

@staropram
Copy link

@dorian-cruveiller not sure if this helps but the schema for the amps DSD was posted on another thread

@isle9
Copy link

isle9 commented Dec 13, 2023

Finally got it working on ASUS Zenbook 14 OLED Model UX3402VA.

Using Ubuntu 23.10.

Working dsl file looks like this:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CSC3551", 0x00000001)
{
    External (_SB_.PC00.SPI0, DeviceObj)
    External (_SB_.PC00.SPI0.SPK1, DeviceObj)

    Scope (_SB.PC00.SPI0.SPK1)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cirrus,dev-index", Package () { Zero, One }},
                Package () { "reset-gpios", Package () {
                    SPK1, One, Zero, Zero,
                    SPK1, One, Zero, Zero
                } },
                Package () { "spk-id-gpios", Package () {
                    SPK1, 0x02, Zero, Zero,
                    SPK1, 0x02, Zero, Zero
                } },
                Package () { "cirrus,speaker-position", Package () { Zero, One } },
                // gpioX-func: 0 not used, 1 VPSK_SWITCH, 2: INTERRUPT, 3: SYNC
                Package () { "cirrus,gpio1-func", Package () { One, One } },
                Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                // boost-type: 0 internal, 1 external
                Package () { "cirrus,boost-type", Package () { One, One } }
            }
        })
    }

    Scope (_SB.PC00.SPI0)
    {
        Name (_DSD, Package ()
        {
            ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
            Package ()
            {
                Package () { "cs-gpios", Package () { 
                    Zero,                    // Native CS
                    SPK1, Zero, Zero, Zero   // GPIO CS
                } }
            }
        })
    }
}

Using the commands provided here for Ubuntu/Debain it worked. My mistake was to copy the 01_acpi file into /etc/default/grub.d instead of /etc/grub.d

Furthermore I found out that the Kernel patch to distinguish betweek UX3402ZA and UX3402VA has been added starting with Kernel 6.5.6 so you need a Kernel >= 6.5.6

For Ubuntu 23.10 shipping 6.5.0-xxx at this time I use a mainline kernel for this. Please google for mainline ppa ubuntu. three lines of code then you can use a mainline-gtk interface to easily install a suitable kernel.

So as of thor2002ro git page:

* create the aml file from **my** dsl file

* copy aml file to /boot

* copy acpi_01 fiel to /etc/grub.d and make it executable

* get a mainline kernel 6.5.6+

* sudo update-grub

* reboot & select kernel

* **have sound :)**

Thanks community.

Thanks a lot. This worked for me. I did it previously after installing Ubuntu 23.10 recently, but the kernel was still 6.5.0 there iirc.

@Peter-Ries Btw, are the speakers a bit low for you too?

@Peter-Ries
Copy link

@isle9 - I'd say they are around 50% of the volume I have on my Lenoveo t14. I was so happy that I got sound so I forgot to investigate more ;)

May be (hopefully) there's a small fix to the dsl file to raise max volume, but I have absolutely no clue what's in the file.

Glad my small "how to" helped you :)

@Peter-Ries
Copy link

just found that link up in a comment regarding low volume:

latin-1/um5302ta#8 (comment)

ATM I have no opprtunity to check. Does it work for you to do the steps as mentioned there..?


$ cd /tmp
$ git clone https://gitlab.com/asus-linux/firmware
$ cd firmware
$ sudo cp -r cirrus /lib/firmware/

@flukejones
Copy link

flukejones commented Dec 19, 2023

PSA: cirrus opensource team have pushed a new series of patches upstream for review which completely fix the amp issues.

https://lore.kernel.org/all/20231218151221.388745-1-sbinding@opensource.cirrus.com/

You will need to:

  1. remove the dsd patching
  2. remove /boot/grub2/grubenv if it exists
  3. add entries to the new tables if your model is not there.

I will be writing a blog post on https://asus-linux.org/ with more details about all this work soon.

Note: these patches will override any bios or _dsd patching.

@alex-spataru
Copy link

@flukejones Thank you very much for the announcement! I just updated my repo/guide for UX7602ZM laptops with the information that you provided. 😄

@lamperez
Copy link
Author

@flukejones I will put a warning with this info at the top of the gist file. Thanks for the announcement.

@grounshelter
Copy link

I have an ASUS UM3504DA-DS76 with a Ryzen 7 and no audio in Linux Mint. Can I patch to add sound now or can I obtain the mentioned upstream patches soon?

@flukejones
Copy link

List of 2023 ROG laptops wit fixed sound in 6.7:

ASUS GX650PY/PZ/PV/PU/PYV/PZV/PIV/PVVA
Asus GA402X/GA402NA
ASUS GU604VI/VC/VE/VG/VJ/VQ/VU/VV/VY/VZA
ASUS GU603VQ/VU/VV/VJ/VIA
ASUS GV601VV/VU/VJ/VQ/VIA
ASUS G614JY/JZ/JGA
ASUS G513PI/PU/PVA
ASUS G733PY/PZ/PZV/PYVA
ASUS GV302XA/XJ/XQ/XU/XV/XIA
ASUS GZ301VV/VQ/VU/VJ/VA/VC/VE/VVC/VQC/VUC/VJC/VEC/VCCA
ASUS GV301QHA
ASUS GU603ZI/ZJ/ZQ/ZU/ZVA
ASUS GU603A
Asus G73JwA
ASUS G614JVR/JIRA
ASUS GU603A
ASUS ROG Strix G15A
ASUS G614JU/JV/JIA
ASUS G634JY/JZ/JI/JGA
ASUS G814JU/JV/JIA
ASUS G814JY/JZ/JGA
ASUS G834JY/JZ/JI/JGA
ASUS G713PI/PU/PV/PVNA
ASUS G614JZRA
ASUS G814JVR/JIRA
ASUS G814JZRA
ASUS G834JYR/JZRA
ASUS G634JYR/JZRA

putting this here as this thread comes up in many searches.

@BillOTei
Copy link

great news!

@sarfarazahmad89
Copy link

Do you guys have any opinion on when they/Cirrus will do this for Lenovo laptops? I wonder if the push came from Asus for them/Cirrus to do this.

@sarfarazahmad89
Copy link

@dorian-cruveiller this works for Slim7 16APH8 but I think you figured that out already.

@staropram
Copy link

Excellent news. I notice they also added support for my model. I suppose this shows that making noise about this stuff works. I don't mean in a kind of "complaints" way, but more that if the open source developers at cirrus and elsewhere can see that people really want this stuff to work, it will motivate them to work on these issues and helps to prioritise their time. That's what I imagine anyway. Thanks to all who have made this possible!

@flukejones
Copy link

@staropram I definitely made some waves to get this done and the asus rog laptop support is a direct result of me requesting help from an asus contact, and making some efforts in lkml. But the overall result here is due to it being a cross-vendor issue

@staropram
Copy link

@flukejones Thank you very much for your efforts Luke in getting this working, you've served us all, Merry Christmas!

What's the reason this happened in the first place? Why didn't asus put the DSD data in the bios? Is it deliberate collusion with MS to make it more difficult to use Linux on these new machines? Or perhaps they just think, oh having all these different ACPI tables is annoying, let's just do it in software?

Also, why do you think people like cirrus are so shady about just sharing the spec sheet? Or are they generally open? Some of this kind of closed-ness seems pointless because presumably their competitors can easily figure out what they are doing anyway?

@dorian-cruveiller
Copy link

HI, i have another laptop using this chip and is connected in I2C. Everything works great except when rebooting, i have the the following error:

Failed waiting for OTP_BOOT_DONE: -121

I tried to change reset-gpios like this:

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

I also tried 0x02 and 0x03 but none of these work when rebooting.

Any help would be very appreciated.

@socketpair
Copy link

socketpair commented Jan 6, 2024

YAY!
UX3402ZA.310
Sound works! Just upgraded to Fedora 39 (and upgraded to the latest kernel within + all packages), and did nothing!

Did not upgrade BIOS (vendor did not make update).

Kernel 6.6.8-200.fc39.x86_64
linux-firmware-20231211-1.fc39.noarch

$ dmesg | grep  cs
[108004.282525] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[108004.282533] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot-10431e02.wmfw: Fri 27 Aug 2021 14:58:19 W. Europe Daylight Time
[108004.423081] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.43.1, 2 algorithms
[108004.425027] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot-10431e02-spkid1-l0.bin: v0.43.1
[108004.425029] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: spk-prot: C:\Users\tyang\Desktop\Product Setting\SmartAMP\ASUS\ASUS_Zenbook\UX3402\Tuning Release\220304\ASUS_UX3402_L_tuning_IDYC_ReDc_PICL_RTL_0304.bin

Before:

$ journalctl -b -1 | fgrep cs35
дек 20 08:12:28 asus kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Failed property cirrus,dev-index: -22
дек 20 08:12:28 asus kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
дек 20 08:12:28 asus kernel: cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.0 failed with error -22
дек 20 08:12:28 asus kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Failed property cirrus,dev-index: -22
дек 20 08:12:28 asus kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
дек 20 08:12:28 asus kernel: cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -22

Even more before:

$ journalctl -b -5 | fgrep cs35
ноя 27 17:07:44 asus kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
ноя 27 17:07:44 asus kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
ноя 27 17:07:44 asus kernel: cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.0 failed with error -22
ноя 27 17:07:44 asus kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
ноя 27 17:07:44 asus kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
ноя 27 17:07:44 asus kernel: cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -22

@socketpair
Copy link

But by feelings, volume is not enough. I don't have Windows, so I can not compare. I know everything this is about amplifier and some secret coefficients.

@dabendji2000
Copy link

dabendji2000 commented Jan 6, 2024

@socketpair I had the same issue on my Zenbook UM3402YAR - meaning that when I finally was able to get the sound working (and that was only yesterday after three months of trial and error) the sound was lower than it should be normally. The solution was to grab the files from my windows partition and to rename them into the linux naming convention for my soundcard by using the rename script and then to copy them to /lib/firmware/cirrus directory.
After restart I was able to get the sound on Nobara 39 as it should be.

Since you do not have windows you need to get the files from either someone else who has the same machine as you do and has windows installed or from the Realtek website.

@socketpair
Copy link

socketpair commented Jan 6, 2024

Sometimes (I don't know, what triggers) the following happens:

[533077.684431] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Failed to read 256 bytes from 2800608: -16
[534920.946475] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Failed to read 256 bytes from 2800608: -16
[536684.320479] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Failed to read 256 bytes from 2800608: -16

@kenzoi
Copy link

kenzoi commented Jan 6, 2024

Thanks all for this valuable information resources.

I have a Zenbook UX3402VA without patches since audio is a non-essential to my work and I was waiting for a native BIOS or kernel solution. So when I saw the news I got very excited about the new kernel patches of Kernel 6.7, but sadly testing the latest kernel-6.7.0-0.rc8 using Fedora Rawhide I don't have sound yet on this model.

I'm not sure because I'm not very familiar with low level code or C, but as others have mentioned the possibility, apparently this model is missing on cs35l41_config_table and cs35l41_prop_model_table on kernel > sound > pci > hda > cs35l41_hda_property.c. I used this command lspci -vn which gave me the subsystem id 1043:16a3, which is not included. (I'm assuming that the number at that table are subsystem ids of course)

I didn't have the knowledge or time to get what values should have the cs35l41_config_table.
I'll try to learn more about, but due of my lack of knowledge on this matter I may fallback to a LTS kernel + dsd patching until someone get a solution or continue living without sound.

@Da-Viper
Copy link

Da-Viper commented Jan 8, 2024

@dorian-cruveiller did this work for Lenovo slim 7 16aph8 ?

@phaserblast
Copy link

To those suffering the low audio volume issue with the new 6.7 kernel fix, this is what worked for me. All I needed to do was create two symlinks to a file in /lib/firmware/cirrus/cs35l41 (my machine is a GV302XA, id 1043:1533). Note that both of these links point to the same file:

ln -s /lib/firmware/cirrus/cs35l41/v6.61.1/halo_cspl_RAM_revB2_29.63.1.wmfw /lib/firmware/cirrus/cs35l41-dsp1-spk-prot-10431533.wmfw
ln -s /lib/firmware/cirrus/cs35l41/v6.61.1/halo_cspl_RAM_revB2_29.63.1.wmfw /lib/firmware/cirrus/cs35l41-dsp1-spk-cali-10431533.wmfw

Ensure your links contain the machine ID in the file name. I think the Cirrus kernel module looks for these files, and if it doesn't find them you get the dreaded "Falling back to default firmware" note in dmesg. With the symlinks, I don't get the "default firmware" message anymore and the volume can get much louder!

@Dertosh
Copy link

Dertosh commented Jan 8, 2024

Thanks to you all I got sound working on UM3504DA (Asus Zenbook 15 OLED)!

My dsl file looks like this:

DefinitionBlock ("", "SSDT", 1, "CUSTOM", "CS3551", 0x0000300A)
{

    External (_SB_.I2CB, DeviceObj)
    External (_SB_.I2CB.SPKR, DeviceObj)

    Scope (_SB.I2CB.SPKR)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cirrus,dev-index", Package () { 0x0040, 0x0041 }},
                        Package () { "reset-gpios", Package () {
                           SPKR, One, Zero, Zero,
                           SPKR, One, Zero, Zero
                        } },
                        Package () { "spk-id-gpios", Package () {
                             SPKR, 0x02, Zero, Zero,
                             SPKR, 0x02, Zero, Zero,
                        } },
                        Package () { "cirrus,speaker-position", Package () { Zero, One } },
                        Package () { "cirrus,gpio1-func", Package () { One, One } },
                        Package () { "cirrus,gpio2-func", Package () { 0x02, 0x02 } },
                        // boost-type: 0 internal, 1 external
                        Package () { "cirrus,boost-type", Package () { One, One } },
                        // boost-peak-milliamp: 1600 to 4500, increments of 50 mA
                        //Package () { "cirrus,boost-peak-milliamp",  Package () { 3000, 3000 } },
                        // boost-ind-nanohenry: 1000 | 1200 | 1500 | 2200 nH
                        //Package () { "cirrus,boost-ind-nanohenry",  Package () { 1000, 1000 } },
                        // boost-cap-microfarad: rounded to the nearest integer
                        //Package () { "cirrus,boost-cap-microfarad", Package () { 15, 15 } },
                    }
                }) /* \_SB.I2CB.SPKR._DSD */
        }
    }

    Scope (_SB.I2CB)
    {
        Method (_DSD, 0, NotSerialized)  // _DSD: Device Specific Data
        {
            Return (Package ()
                {
                    ToUUID ("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
                    Package ()
                    {
                        Package () { "cs-gpios", Package () { 
                            Zero,                    // Native CS
                            SPKR, Zero, Zero, Zero   // GPIO CS
                        } }
                    }
                }) /* \_SB.I2CB.SPKR._DSD */
        }
    }
}

I had to add SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC287_FIXUP_CS35L41_I2C_2), to static const struct snd_pci_quirk alc269_fixup_tbl at line 9500 in file sound/pci/hda/patch_realtek.c and compile linux 6.6.2 kernel (never did it before).

In 6.7 there's ALC294_FIXUP_CS35L41_I2C_2 which appears to do the same as ALC287_FIXUP_CS35L41_I2C_2. UM3504 has ALC294 by the way.

Is there anything I can do to make SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS UM3504DA", ALC294_FIXUP_CS35L41_I2C_2), appear in source code of the linux kernel so that I never have to compile it again?

Thank you, it's work for me! ASUSTeK COMPUTER INC. Zenbook 15 UM3504DA_UM3504DA Linux 6.6.8-2-MANJARO

@SergioASantosF
Copy link

First of all, I would like to thank everyone who made this happen, without your time diving in to solve this issue, this solution would not be possible!! I installed EndeavourOS today and on the kernel version it was on when installed (6.6.10), the sound didn't work without a patch. However, after compiling the latest version of the mainline kernel 6.7.0, and rebooting, the sound worked without any modifications, natively.

I used this laptop - UX3402ZA (Bios 310) throughout the year with Windows, and the times I tested the patches on Linux, the sound only came from one side, it was low, but it was already a path towards a solution, which made me very happy. However, using it like that made me go back to Windows to avoid damaging the speaker and wait, until I could extract 100% from the laptop (which isn't very cheap here in Brazil).

But now, after this kernel update, the sound is loud, not as loud as Windows, which could reach a level where it distorted the sound, sometimes losing quality. But on Linux, it's loud and at a level where the sound is perfect, it doesn’t distort, meaning, it's at an ideal maximum sound level for the speakers.

Again, many thanks to everyone involved who made it happen, now it's just a matter of waiting as the distros update their kernel and soon it will be resolved for most of the machines we use.

THANK YOU!

@plamen-kolev
Copy link

Thanks all for this valuable information resources.

I have a Zenbook UX3402VA without patches since audio is a non-essential to my work and I was waiting for a native BIOS or kernel solution. So when I saw the news I got very excited about the new kernel patches of Kernel 6.7, but sadly testing the latest kernel-6.7.0-0.rc8 using Fedora Rawhide I don't have sound yet on this model.

I'm not sure because I'm not very familiar with low level code or C, but as others have mentioned the possibility, apparently this model is missing on cs35l41_config_table and cs35l41_prop_model_table on kernel > sound > pci > hda > cs35l41_hda_property.c. I used this command lspci -vn which gave me the subsystem id 1043:16a3, which is not included. (I'm assuming that the number at that table are subsystem ids of course)

I didn't have the knowledge or time to get what values should have the cs35l41_config_table. I'll try to learn more about, but due of my lack of knowledge on this matter I may fallback to a LTS kernel + dsd patching until someone get a solution or continue living without sound.

Sad to hear, hope someone tackles this in the near future

@anthonyryan1
Copy link

anthonyryan1 commented Jan 10, 2024

Also no luck with the ASUS UM3402Y on kernel 6.7 with all the cs35l41 options enabled in the kernel, apparently more tinkering needed.

(Interestingly, in spite of the physical label on the device listing UM3402Y, the software internally says UM3402YA. I suspect those are the same model.)

@AlexeyPashnin1
Copy link

AlexeyPashnin1 commented Jan 11, 2024

@staropram Hi! It's me, the guy who doesn't have anything working. After the system stopped booting, I got upset and put the laptop in the pantry. But now I have made one more attempt to fix the sound before abandoning the laptop altogether.

Following the instructions and your advice, I tried to install kernel versions 6.6.11 and 6.7, but it didn't help. The sound is still only in the headphones.

Tell me, please, is there any other chance or way that I can try? So far, this thread is the only clue for me, because I tried everything else on the Internet and it didn't help.

Here are the outputs that you asked me earlier:

$ inxi -MA

Machine:
Type: Laptop System: ASUSTeK product: Zenbook UX3402VA_UX3402VA v: 1.0
serial:
Mobo: ASUSTeK model: UX3402VA v: 1.0 serial:
UEFI: American Megatrends LLC. v: UX3402VA.302 date: 05/23/2023
Audio:
Device-1: Intel Raptor Lake-P/U/H cAVS driver: sof-audio-pci-intel-tgl
API: ALSA v: k6.5.0-14-generic status: kernel-api
Server-1: PipeWire v: 0.3.79 status: active

sudo dmesg | grep CSC

[ 2.045365] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[ 2.677091] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[ 2.677107] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[ 2.677115] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.0 failed with error -22
[ 2.677616] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[ 2.677620] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[ 2.677623] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -22

uname -a

Linux alex 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

I would appreciate any help. Thank you!

@lamperez
Copy link
Author

lamperez commented Jan 11, 2024

@AlexeyPashnin1 Not exactly a solution to your problem, but for reference: if you want to check if your laptop model is supported in the latest kernel version, first get the vendor and model ID:

udevadm info /sys/bus/pci/devices/0000:00:00.0 | grep PCI_SUBSYS_ID

That gives me (Asus Zenbook UX3402ZA)

E: PCI_SUBSYS_ID=1043:1E02

Then, just look for the ID in the kernel source, here and here, without the colon.

Also, I suppose that these are the places to patch the kernel to support a model that is not yet included.

@kenzoi
Copy link

kenzoi commented Jan 12, 2024

Yesterday I took some time to read again the new kernel tables, the working SSDT patch published here for the Asus Zenbook UX3402VA and those instructions at asus-linux.org, downloaded the latest kernel source and made a patch adding the a new entry for UX3402VA model and now the audio is working correctly, I have been using it all day and I didn't detected any problem.

I didn't know how to find the nanohenry, microfarad, and milliamp values, but then I read these are just for the models that have the INTERNAL boost_type, then we just need to leave these values as 0. So for this model the entry is really the same as the UX3402ZA just changing the vendor and model ID.

I've just submitted the patch to the maintainer list.
Thank you all very much! Thank you @lamperez ! I'm really happy that I finally have the audio working.

Edit: the table must be sorted by SSID.

diff --git a/sound/pci/hda/cs35l41_hda_property.c b/sound/pci/hda/cs35l41_hda_property.c
index c1afb721b4c6..9ec5773e580e 100644
--- a/sound/pci/hda/cs35l41_hda_property.c
+++ b/sound/pci/hda/cs35l41_hda_property.c
@@ -54,6 +54,7 @@ static const struct cs35l41_config cs35l41_config_table[] = {
 	{ "10431533", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
 	{ "10431573", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 1000, 4500, 24 },
 	{ "10431663", SPI, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, -1, 0, 1000, 4500, 24 },
+	{ "104316A3", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
 	{ "104316D3", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
 	{ "104316F3", SPI, 2, EXTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 1, 2, 0, 0, 0, 0 },
 	{ "104317F3", I2C, 2, INTERNAL, { CS35L41_LEFT, CS35L41_RIGHT, 0, 0 }, 0, 1, -1, 1000, 4500, 24 },
@@ -358,6 +359,7 @@ static const struct cs35l41_prop_model cs35l41_prop_model_table[] = {
 	{ "CSC3551", "10431533", generic_dsd_config },
 	{ "CSC3551", "10431573", generic_dsd_config },
 	{ "CSC3551", "10431663", generic_dsd_config },
+	{ "CSC3551", "104316A3", generic_dsd_config },
 	{ "CSC3551", "104316D3", generic_dsd_config },
 	{ "CSC3551", "104316F3", generic_dsd_config },
 	{ "CSC3551", "104317F3", generic_dsd_config },
-- 
2.43.0

@lamperez
Copy link
Author

@kenzoi you are welcome. Glad to be helpful.

@AlexeyPashnin1
Copy link

@lamperez Hi! I get this output
PCI_SUBSYS_ID=1043:16A3

and it seems that the model isn't supported
104316A3

It's a pity. I didn't think that in 2024 the operating system might not support sound.

Anyway, thanks for the help!
cc @staropram

@kenzoi
Copy link

kenzoi commented Jan 13, 2024

@AlexeyPashnin1 we have the same model, check my last comment if you want to try a patch for the kernel 6.7, it's just 2 lines.
The patch was already submitted, such small change I hope won't take much time to get merged into mainline.

@lamperez
Copy link
Author

AlexeyPashnin1: It is not the operative system, it is the vendor the one to blame.

@AlexeyPashnin1
Copy link

@kenzoi Hi! Thank you, but still no luck. But it may very well be that I'm not doing something completely, because when I execute a command uname -a, I get this output

Linux alex 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Where the 6.5.0-14-generic version is indicated and not the 6.7.

I've downloaded the archive from https://kernel.org/ and and installed it according to the instructions https://itsfoss.com/compile-linux-kernel/.

It's probably important to note that I only got to the line make -j$(nproc) 2>&1 | tee log

Did I miss any mandatory actions that caused the kernel not to update?

@AlexeyPashnin1
Copy link

@lamperez well, I got Ubuntu from ubuntu.com, so the vendor is official :)

@lamperez
Copy link
Author

@AlexeyPashnin1 How funny, haha. The computer vendor, the one that builds and sells hardware without its specifications, or following the standards.

@AlexeyPashnin1
Copy link

@lamperez sorry, I didn't know Asus didn't follow the standards

@lamperez
Copy link
Author

@AlexPashnin1 Just read the thread from the beginning, the amplifier parameters are not provided anywhere by ASUS. The almost 30 years old standard way to describe a PC hardware configuration exposed to an operative system is the ACPI, that means "Advanced Configuration and Power Interface". And ASUS just keeps a hole in some of the vital configuration, that we have to guess and patch at boot, or alternatively it must be hardcoded in the kernel module (or Windows driver), something that is done several years after the hardware is in the market. Not very standard, if you ask me.

@AlexeyPashnin1
Copy link

@lamperez well, then I chose the wrong vendor and wasn't ready to edit the kernel to adjust the sound :) Now I will keep this in mind when choosing the next laptop.

Thank you, anyway, for your time.

@Mikchel
Copy link

Mikchel commented Jan 15, 2024

Alexey, you are right. It was surprise for me that quite expensive ASUS ROG laptop has so strange sound problems. That was very surprise for me. And i won't suggest anybody to get ASUS's laptops. Quite bad commercial for big company.

@FrankKipf
Copy link

Keep in mind, that Lenovo Legion series - highend gaming laptop like Asus ROG - suffers the same problem. They use the same Cirruslogic-chips and Lenovo has like Asus "forgotten" to provide the infos via ACPI / Bios. I can't tell you how much this f.... me up.

@BuenGenio
Copy link

Could any of this be re-used to enable the second pair of bass speakers on a Dell XPS 15 9530, which also uses the same chip?
Thanks!

@alexVinarskis
Copy link

alexVinarskis commented Jan 16, 2024

Could any of this be re-used to enable the second pair of bass speakers on a Dell XPS 15 9530, which also uses the same chip?
Thanks!

TL:DR; already done, coming in 6.8

Me and some other community members did it, but even though we submitted the patch, Cirrus changed their framework, and right after added their own support for xps 9530. They also just merged firmware/tuning files few days back. XPS 9530 also has a firmware bug which caps SPI speed, and thus firmware loading wouldve take ~3mins. I made a patch and it got accepted, should be coming in 6.8

Edit: most of development happened here on discord server

@isle9
Copy link

isle9 commented Jan 20, 2024

I've just submitted the patch to the maintainer list.

@kenzoi Any idea when this will be available?

@Raymo111
Copy link

Fixed on UM3504 as well, at long last!!

@Mikchel
Copy link

Mikchel commented Jan 21, 2024

Hi,
I have strange sound conflict on ROG 713PV 2023 with Firefox browser. When i visit page which wants to play DRM content (same time VLC is playing some of mp3 track) , i have additional noise on speakers. As soon i close such web page noise is disappear.
Does anybody have similar problems? Can anybody suggest what i have to do to fix that?

@isle9
Copy link

isle9 commented Jan 21, 2024

  • remove the dsd patching

  • remove /boot/grub2/grubenv if it exists

Why do we need to do these two things if the patches will override them anyways? @flukejones

@isle9
Copy link

isle9 commented Jan 21, 2024

just found that link up in a comment regarding low volume:

latin-1/um5302ta#8 (comment)

ATM I have no opprtunity to check. Does it work for you to do the steps as mentioned there..?


$ cd /tmp
$ git clone https://gitlab.com/asus-linux/firmware
$ cd firmware
$ sudo cp -r cirrus /lib/firmware/

Did you end up checking? Doesn't seem to work for me.

@bkonkle
Copy link

bkonkle commented Jan 25, 2024

I can confirm that this patch is obsolete with Linux Kernel >= 6.7. I'm running Ubuntu 23.10 (dual-boot with Windows 11) with a ROG Strix G18 laptop (G814JZ) and the latest nvidia-driver-545 installed (and I've also tested with nvidia-driver-535). I used the mainline GUI/CLI tool to install Kernel 6.7.2. I followed the instructions here to sign my kernel for Secure Boot, and I was then able to boot successfully! 🚀 The built-in laptop audio works flawlessly for me now, and my NVidia card is working smoothly and supporting my Samsung Thunderbolt display nicely.

Thank you, Cirrus open source!

@DemikGit
Copy link

Did you end up checking? Doesn't seem to work for me.

It works for me, thx = )

@kenzoi
Copy link

kenzoi commented Jan 27, 2024

Any idea when this will be available?

@isle9 I've resubmitted today because of a small difference related to the latest branch. I think this (UX3402VA model)
will be available on Linux 6.8

@HARDWELL9191
Copy link

HARDWELL9191 commented Jan 30, 2024

I have got my speakers working on my UX3402VA on Ubuntu with the 6.7.2 mainline kernel and applying the ssdt patch, but the volume is way too low and that's why I've also downloaded the firmware using this guide: Firmware. The volume is still way too low. This is the ID for the device: E: PCI_SUBSYS_ID=1043:16A3
Any fix for this on my device?
Edit: It seems to still be falling back to default firmware.

[    3.896842] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[    3.906683] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    3.944156] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[    5.313758] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Falling back to default firmware.
[    5.314678] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[    5.314685] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[    5.388399] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[    5.389088] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.bin: v0.58.0
[    5.389098] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: spk-prot: e:\workspace\workspace\tibranch_release_playback_6.76_2\ormis\staging\default_tunings>
[    5.404412] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: CS35L41 Bound - SSID: 104316A3, BST: 1, VSPK: 1, CH: L, FW EN: 1, SPKID: 0
[    5.404423] UbuntuTop kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi0-CSC3551:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[    5.404707] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Falling back to default firmware.
[    5.405036] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware version: 3
[    5.405039] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[    5.467265] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[    5.468338] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.bin: v0.58.0
[    5.468347] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: spk-prot: e:\workspace\workspace\tibranch_release_playback_6.76_2\ormis\staging\default_tunings>
[    5.490012] UbuntuTop kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: CS35L41 Bound - SSID: 104316A3, BST: 1, VSPK: 1, CH: R, FW EN: 1, SPKID: 0
[    5.490026] UbuntuTop kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi0-CSC3551:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])```

@kenzoi
Copy link

kenzoi commented Jan 30, 2024

@HARDWELL9191 the ssdt patch is an older solution, from before the recent kernel rework.
But to be honest I don't know if this impact the volume somehow, I think not since the values in the ssdt patch and kernel table probably are the same.

I've created this basic instruction on how I applied the kernel patch on linux 6.7.2 using Fedora.
The patch was accepted today by one of the sound.git maintainers. I hope that soon we won't need it anymore.

@HARDWELL9191
Copy link

HARDWELL9191 commented Jan 31, 2024

@kenzoi I checked using this guide if my device was actually in the kernel and it wasn't so I suppose that's why my sound didn't work until I applied the SSDT patch, but the volume with the patch is still too low and falls back to default firmware. Idk why, maybe someone can tell me if there's a fix for this without building a kernel myself. Otherwise I'll just wait for the 6.8 kernel to come out ;)

@lonk42
Copy link

lonk42 commented Feb 16, 2024

Has anyone managed to get something working on the UM3402YA yet? Neither kernel 6.7.4 or any combination of the patches here I've tried have done the trick so far.

@joezhouchenye
Copy link

Has anyone managed to get something working on the UM3402YA yet? Neither kernel 6.7.4 or any combination of the patches here I've tried have done the trick so far.

You may be in trouble with the reset_gpio field, I am using ROG STRIX though. I have a similar patch for my laptop. It worked before, but it suddenly had misfunctions today.

It turns out that the BIOS setting of the boot logo sound is causing this problem (I changed it today).

If the boot logo sound is enabled, the reset-gpios filed should be

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

If disabled, the field should be

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

@slayerjain
Copy link

slayerjain commented Feb 26, 2024

@kenzoi as per torvalds/linux@c16dfab, this patch should be released in the v6.8-rc6. I tried installing this on my UX3405MA and had no luck.

In my case, the audio works but the volume is really low (compared to windows), like speech is barely audible - like 20% of windows volume. There was no difference in installing v6.8-rc6 and v6.7.x

[    6.172395] fedora kernel: Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[    6.441606] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[    6.441834] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[    6.475276] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Cirrus Logic CS35L41 (35a40), Revision: B2
[    7.011838] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: Falling back to default firmware.
[    7.015348] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware version: 3
[    7.015353] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[    7.146892] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[    7.148120] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: cirrus/cs35l41-dsp1-spk-prot.bin: v0.58.0
[    7.148125] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: spk-prot: e:\workspace\workspace\tibranch_release_playback_6.76_2\ormis\staging\default_tunings\in>
[    7.161724] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: CS35L41 Bound - SSID: 10431A63, BST: 1, VSPK: 1, CH: L, FW EN: 1, SPKID: -19
[    7.161731] fedora kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi0-CSC3551:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[    7.164371] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: Falling back to default firmware.
[    7.166774] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware version: 3
[    7.166777] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.wmfw: Fri 24 Jun 2022 14:55:56 GMT Daylight Time
[    7.284208] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: Firmware: 400a4 vendor: 0x2 v0.58.0, 2 algorithms
[    7.285221] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: cirrus/cs35l41-dsp1-spk-prot.bin: v0.58.0
[    7.285231] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: DSP1: spk-prot: e:\workspace\workspace\tibranch_release_playback_6.76_2\ormis\staging\default_tunings\in>
[    7.300136] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: CS35L41 Bound - SSID: 10431A63, BST: 1, VSPK: 0, CH: R, FW EN: 1, SPKID: -19
[    7.300146] fedora kernel: snd_hda_codec_realtek ehdaudio0D0: bound spi0-CSC3551:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[  321.135983] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Failed to read 256 bytes from 2800620: -16
[  667.964185] fedora kernel: cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: DSP1: Failed to read 256 bytes from 2800620: -16

@saaska-kim
Copy link

@lonk42 I have sound working on UM3402YA with kernel 6.7 using this SSDT file.

@lonk42
Copy link

lonk42 commented Mar 4, 2024

@lonk42 I have sound working on UM3402YA with kernel 6.7 using this SSDT file.

Awesome that one works!

@tholden92
Copy link

Following. Have the same problem with UX3405MA and default firmware error. Running the 6.8-rc7 kernel.

@tiaga
Copy link

tiaga commented Mar 8, 2024

As a workaround for Linux Mint 21.3 and Asus Zenbook 14 UX3402VA I've installed 6.7.7 kernel from Zabbly repo. However, microphone on my wire headset stopped working (no sound can be detected) on that kernel. Is there any workaround for that?

@isle9
Copy link

isle9 commented Mar 13, 2024

@kenzoi Still the same issue with default firmware fallback error and low sound on 6.8...

@slayerjain
Copy link

On a fresh installation, are we supposed to do any extra step (like SSDT patching) apart from installing linux 6.8 kernel?

@HARDWELL9191
Copy link

HARDWELL9191 commented Mar 19, 2024

@slayerjain @kenzoi Yep I've been having the volume issue as well. With both the ssdt patch before and in the 6.8 rc6 kernel now as well on my UX3402VA. It falls back to default firmware for some reason. Max volume on linux is like being at 20% on windows and if you try going past that with pavucontrol, the sound just gets distorted af. Hopefully someone can find a fix for this so we can actually get solid sound out of our laptops. It's literally the only thing that's holding me back from permanently switching to linux on my laptop and just remove my dual boot. I need me some good music sometimes ;)

@steffengy
Copy link

steffengy commented Apr 3, 2024

For 10431A63 - UX3405MA.304
@tholden92 @slayerjain and whoever else with one might want to test.
The following patch/hack works for me
and also confirmed different firmware being loaded / fallback messages fixed.

[ 11.160796] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: DSP1: spk-prot: C:\Users\tyang\Desktop\Product Setting\SmartAMP\ASUS\ASUS_Zenbook\2023Projects\UX3405MA\Tuning_release\06082023\UX3405UM_19p5dB_Mock_NM_Lch_finish_ID_6p83_US_Xmax0p65.bin

For context: In bios version 304 pretty much all the config is present (confirmed via dumping and looking at ssdt16),
except for "spk-id-gpios". The patch below should force creation of only that GPIO in the driver - which doesnt seem to account for the case where a DSD is present but only 99% complete, hence the hack to skip that check
since I know the 1 missing gpio still needs to be initialized and isnt present in DSD.

https://gist.github.com/steffengy/aa48549f40c37acf85de7a7f9a6c0475

@tholden92
Copy link

tholden92 commented Apr 3, 2024

Tried to apply the patch, but got an error message.

Setting version...
Applying patch linux-v6.8.2-arch2.patch...
patching file Makefile
patching file arch/Kconfig
patching file drivers/firmware/sysfb.c
patching file drivers/net/xen-netfront.c
patching file include/linux/user_namespace.h
patching file init/Kconfig
patching file kernel/fork.c
patching file kernel/sysctl.c
patching file kernel/user_namespace.c
Applying patch sound-fix.patch...
patching file sound/pci/hda/cs35l41_hda_property.c
Hunk #1 succeeded at 85 with fuzz 1.
Hunk #2 FAILED at 232.
Hunk #3 FAILED at 240.
Hunk #4 succeeded at 423 with fuzz 1.
2 out of 4 hunks FAILED -- saving rejects to file sound/pci/hda/cs35l41_hda_property.c.rej

This is how the reject file looks like

    --- /dev/null
    +++ sound/pci/hda/cs35l41_hda_property.c    2024-04-03 12:27:54.540979240 +0100
    @@ -232,3 +233,3 @@
     
    -       if (!dsd_found) {
    +       // if (!dsd_found) {
                    ret = cs35l41_add_gpios(cs35l41, physdev, cfg->reset_gpio_index,
    @@ -240,6 +241,6 @@
                    }
    -       } else if (cfg->reset_gpio_index >= 0 || cfg->spkid_gpio_index >= 0) {
    +       /*} else if (cfg->reset_gpio_index >= 0 || cfg->spkid_gpio_index >= 0) {
                    dev_warn(cs35l41->dev, "Cannot add Reset/Speaker ID/SPI CS GPIO Mapping, "
                             "_DSD already exists.\n");
    -       }
    +       }*/

@steffengy
Copy link

@tholden92 Updated above with gist with more patch context, as the "short" version doesnt seem to apply well.

@tholden92
Copy link

tholden92 commented Apr 3, 2024

I can confirm that the patch works :-)

Edit: Forked a PKGBUILD from the CachyOS kernel and added your patch for anyone that wants to test.

https://aur.archlinux.org/packages/linux-cachyos-zenbook

@szweep
Copy link

szweep commented Apr 5, 2024

I recently bought a UX3402V and ran into the "no speaker sound" issue after installing Kubuntu. I was able to fix it by updating the kernel (using 6.7.10), but then observed the very low volume levels noted by others. I also saw kernel messages that the default firmware was loading.

This commit to the linux-firmware package is supposed to add the firmware links for my hardware (1043:16a3). After creating these links, no change was observed and the default firmware was still loaded.

I noticed that the links created by that patch use an upper case "A" (e.g. cs35l41-dsp1-spk-cali-104316A3.wmfw) in the filename which is different from all the other firmware files, so I recreated all the links using "104316a3" in the filenames. This worked: firmware was loaded and volume levels are back to normal. It appears this is a bug in the current linux-firmware package for this hardware.

@pavelkaptsiuh
Copy link

pavelkaptsiuh commented Apr 5, 2024

As a workaround for Linux Mint 21.3 and Asus Zenbook 14 UX3402VA I've installed 6.7.7 kernel from Zabbly repo. However, microphone on my wire headset stopped working (no sound can be detected) on that kernel. Is there any workaround for that?

There is a similar issue with UX3402ZA. I have Mint 5.15/Arch 6.8 dual boot.
5.15 kernel is the last kernel where headset microphone is working properly. But it have no fix for a speaker.
6.8 kernel has speaker fix but headset microphone is broken.
I tried to find a fix for a broken microphone few months earlier but without a luck.
You could try to go this rabbit hole. But it's an advanced topic and I had no motivation to spend days on replicating the solution. https://asus-linux.org/blog/sound-2021-01-11/

@pavelkaptsiuh
Copy link

BTW, guys with UX3402ZA/UX3402VA, could you please check is headset mic working properly in your laptops with 6.7+ kernels?

@isle9
Copy link

isle9 commented Apr 7, 2024

BTW, guys with UX3402ZA/UX3402VA, could you please check is headset mic working properly in your laptops with 6.7+ kernels?

@pave
Bluetooth ones work, but they worked even before 6.8 for me, so maybe there's some other issue that's causing it.

@isle9
Copy link

isle9 commented Apr 7, 2024

I recently bought a UX3402V and ran into the "no speaker sound" issue after installing Kubuntu. I was able to fix it by updating the kernel (using 6.7.10), but then observed the very low volume levels noted by others. I also saw kernel messages that the default firmware was loading.

This commit to the linux-firmware package is supposed to add the firmware links for my hardware (1043:16a3). After creating these links, no change was observed and the default firmware was still loaded.

I noticed that the links created by that patch use an upper case "A" (e.g. cs35l41-dsp1-spk-cali-104316A3.wmfw) in the filename which is different from all the other firmware files, so I recreated all the links using "104316a3" in the filenames. This worked: firmware was loaded and volume levels are back to normal. It appears this is a bug in the current linux-firmware package for this hardware.

Oh my lord, it finally works!
I tried creating links previosuly per @phaserblast advice, but it didin't really work, and I'm guessing the reason why it didn't work is because I only created links for .wmfw files. After going through the commit you linked, I noticed that there are also some .bin files that need to be linked.

Keep in mind that I didn't have any .bin files at all for my model until I created them myself. That's why I missed those the first time. I just searched for my model, and only the .wmfw files were in the folder.

@pavelkaptsiuh
Copy link

pavelkaptsiuh commented Apr 8, 2024

BTW, guys with UX3402ZA/UX3402VA, could you please check is headset mic working properly in your laptops with 6.7+ kernels?

@pave Bluetooth ones work, but they worked even before 6.8 for me, so maybe there's some other issue that's causing it.

I mean wired headset mic. Is it working for you?

@isle9
Copy link

isle9 commented Apr 8, 2024

Wired seems to work for me too.

@HARDWELL9191
Copy link

I recently bought a UX3402V and ran into the "no speaker sound" issue after installing Kubuntu. I was able to fix it by updating the kernel (using 6.7.10), but then observed the very low volume levels noted by others. I also saw kernel messages that the default firmware was loading.

This commit to the linux-firmware package is supposed to add the firmware links for my hardware (1043:16a3). After creating these links, no change was observed and the default firmware was still loaded.

I noticed that the links created by that patch use an upper case "A" (e.g. cs35l41-dsp1-spk-cali-104316A3.wmfw) in the filename which is different from all the other firmware files, so I recreated all the links using "104316a3" in the filenames. This worked: firmware was loaded and volume levels are back to normal. It appears this is a bug in the current linux-firmware package for this hardware.

Can you tell me the process of creating these links? I have a low volume issue with falling back to default firmware. I have the same device ID as you. I just don't know how to create these links.

@kenzoi
Copy link

kenzoi commented Apr 8, 2024

I noticed that the links created by that patch use an upper case "A" (e.g. cs35l41-dsp1-spk-cali-104316A3.wmfw) in the filename which is different from all the other firmware files, so I recreated all the links using "104316a3" in the filenames. This worked: firmware was loaded and volume levels are back to normal. It appears this is a bug in the current linux-firmware package for this hardware.

Very nice! This worked for me too! @szweep could you send a patch with this fix to upstream?

@HARDWELL9191 for me on Fedora the files are located here /lib/firmware/cirrus.

Create new symlinks as proposed above:

ln -s cs35l41-dsp1-spk-cali-10431e12-spkid0-l0.bin.xz cs35l41-dsp1-spk-cali-104316a3-spkid0-l0.bin.xz
ln -s cs35l41-dsp1-spk-cali-10431e12-spkid0-r0.bin.xz cs35l41-dsp1-spk-cali-104316a3-spkid0-r0.bin.xz
ln -s cs35l41-dsp1-spk-cali-10431e12-spkid1-l0.bin.xz cs35l41-dsp1-spk-cali-104316a3-spkid1-l0.bin.xz
ln -s cs35l41-dsp1-spk-cali-10431e12-spkid1-r0.bin.xz cs35l41-dsp1-spk-cali-104316a3-spkid1-r0.bin.xz
ln -s cs35l41/v6.61.1/halo_cspl_RAM_revB2_29.63.1.wmfw.xz cs35l41-dsp1-spk-cali-104316a3.wmfw.xz
ln -s cs35l41-dsp1-spk-prot-10431e12-spkid0-l0.bin.xz cs35l41-dsp1-spk-prot-104316a3-spkid0-l0.bin.xz
ln -s cs35l41-dsp1-spk-prot-10431e12-spkid0-r0.bin.xz cs35l41-dsp1-spk-prot-104316a3-spkid0-r0.bin.xz
ln -s cs35l41-dsp1-spk-prot-10431e12-spkid1-l0.bin.xz cs35l41-dsp1-spk-prot-104316a3-spkid1-l0.bin.xz
ln -s cs35l41-dsp1-spk-prot-10431e12-spkid1-r0.bin.xz cs35l41-dsp1-spk-prot-104316a3-spkid1-r0.bin.xz
ln -s cs35l41/v6.61.1/halo_cspl_RAM_revB2_29.63.1.wmfw cs35l41-dsp1-spk-prot-104316a3.wmfw
ln -s cs35l41/v6.61.1/halo_cspl_RAM_revB2_29.63.1.wmfw.xz cs35l41-dsp1-spk-prot-104316a3.wmfw.xz

@tiaga
Copy link

tiaga commented Apr 8, 2024

BTW, guys with UX3402ZA/UX3402VA, could you please check is headset mic working properly in your laptops with 6.7+ kernels?

For me on UX3402VA and Linux Mint 21.3 headset microphone stopped working.
Same issue can be seen in 6.5.0-17 from official Linux Mint repo. I guess something is wrong with 3.5 jack pins mapping, but unfortunately I couldn't figure what changes lead to this.

@pavelkaptsiuh
Copy link

BTW, guys with UX3402ZA/UX3402VA, could you please check is headset mic working properly in your laptops with 6.7+ kernels?

For me on UX3402VA and Linux Mint 21.3 headset microphone stopped working. Same issue can be seen in 6.5.0-17 from official Linux Mint repo. I guess something is wrong with 3.5 jack pins mapping, but unfortunately I couldn't figure what changes lead to this.

Wired seems to work for me too.

Interesting. I searched the internet quite extensively for a headset mic issue and it was nothing there. Might be it's some how related to BIOS config or Mint's version of GRUB.

@szweep
Copy link

szweep commented Apr 13, 2024

Very nice! This worked for me too! @szweep could you send a patch with this fix to upstream?

@kenzoi - I created a PR here: CirrusLogic/linux-firmware#31. I'm not sure what the procedures are for approval and merge as I've never done this before, but hopefully it will be seen.

@smallcms
Copy link

Looks, UX3405MA works now on kernel 6.8.5. Tested on Fedora 39, works: amplifiers, 3.5 jack headset. Like @steffengy i'm decompiled ssdt16.dat, but added "spk-id-gpios" Package section. Works without patching kernel:
https://github.com/smallcms/asus_zenbook_ux3405ma

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment