Skip to content

Instantly share code, notes, and snippets.

@lamperez
Last active November 11, 2024 11:16
Show Gist options
  • 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
} }
}
})
}
}
@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment