Skip to content

Instantly share code, notes, and snippets.

@lamperez
Last active May 8, 2024 16:55
Show Gist options
  • Star 50 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
} }
}
})
}
}
@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
            {
...

@hmyzna
Copy link

hmyzna 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.

@hmyzna
Copy link

hmyzna 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

@hmyzna
Copy link

hmyzna 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

@rmuhamedgaliev
Copy link

rmuhamedgaliev commented Apr 29, 2024

Hello, i tried apply patch but have error

[    0.009166] ACPI: Table Upgrade: install [SSDT-CUSTOM- CSC3551]
[    0.009168] ACPI: SSDT 0x00000000394ED000 000158 (v01 CUSTOM CSC3551  00000001 INTL 20220331)
[    5.850427] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[    6.018972] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.0: OTP Boot status 80000000 error
[    6.031984] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.0 failed with error -5
[    6.039965] cs35l41-hda spi0-CSC3551:00-cs35l41-hda.1: OTP Boot status 80000000 error
[    6.053183] cs35l41-hda: probe of spi0-CSC3551:00-cs35l41-hda.1 failed with error -5

My patch and SPI3 info - https://gist.github.com/rmuhamedgaliev/e0886c86061e0ee99390f9044640c1de

My Setup - ROG Strix SCAR 18 G834JYR_G834JYR - 6.8.7-201.fsync.fc39.x86_64 Nobara 39

@RasAlhague
Copy link

Updated my ASUS Zenbook UX6404VV to Ubuntu 24.04 (which comes with 6.8.0 kernel) and sound works well now. (I did not apply any patches before)
My BIOS is v304

@DeltaNeverUsed
Copy link

I still get no audio on 6.8.8 and the previous solution I used

hda-verb /dev/snd/hwC0D0 0x20 0x500 0x1b
hda-verb /dev/snd/hwC0D0 0x20 0x477 0x4a4b
hda-verb /dev/snd/hwC0D0 0x20 0x500 0xf
hda-verb /dev/snd/hwC0D0 0x20 0x477 0x74

doesn't work on any version higher than 6.6.10 on my ASUS Zenbook UX582L

@bkonkle
Copy link

bkonkle commented May 1, 2024

It works out-of-the-box for me in Ubuntu 24.04 on my ROG Strix G814JZ! 🚀

@Oless-N
Copy link

Oless-N commented May 8, 2024

hello guys!! I need help with a problem: asus rog zephyrus g16 2024 gu605m: low-level sound.
Linux user-GU605MI 6.8.8-060808-generic #202404271536 SMP PREEMPT_DYNAMIC Sat Apr 27 15:54:17 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux Ubuntu 24.04
journalctl -b -g CSC3556 --output short-monotonic
[ 2.373898] user-GU605MI kernel: Serial bus multi instantiate pseudo device driver CSC3556:00: Instantiated 2 SPI devices.
[ 2.484345] user-GU605MI kernel: cs35l56-hda spi0-CSC3556:00-cs35l56-hda.0: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)
[ 2.493213] user-GU605MI kernel: cs35l56-hda spi0-CSC3556:00-cs35l56-hda.1: Reset GPIO busy, assume shared reset
[ 2.500317] user-GU605MI kernel: cs35l56-hda spi0-CSC3556:00-cs35l56-hda.1: Cirrus Logic CS35L56 Rev B0 OTP3 fw:3.4.4 (patched=0)
[ 6122.443562] user-GU605MI kernel: cs35l56-hda spi0-CSC3556:00-cs35l56-hda.0: .bin file required but not found
[ 6122.443566] user-GU605MI kernel: cs35l56-hda spi0-CSC3556:00-cs35l56-hda.0: PM: dpm_run_callback(): cs35l56_hda_system_resume+0x0/0xd0 [snd_hda_scodec_cs35l56] returns -2
[ 6122.443583] user-GU605MI kernel: cs35l56-hda spi0-CSC3556:00-cs35l56-hda.0: PM: failed to resume: error -2
[ 6122.456528] user-GU605MI kernel: cs35l56-hda spi0-CSC3556:00-cs35l56-hda.1: .bin file required but not found
[ 6122.456532] user-GU605MI kernel: cs35l56-hda spi0-CSC3556:00-cs35l56-hda.1: PM: dpm_run_callback(): cs35l56_hda_system_resume+0x0/0xd0 [snd_hda_scodec_cs35l56] returns -2
[ 6122.456544] user-GU605MI kernel: cs35l56-hda spi0-CSC3556:00-cs35l56-hda.1: PM: failed to resume: error -2

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