Skip to content

Instantly share code, notes, and snippets.

@lamperez
Last active November 11, 2024 11:16
Show Gist options
  • Save lamperez/862763881c0e1c812392b5574727f6ff to your computer and use it in GitHub Desktop.
Save lamperez/862763881c0e1c812392b5574727f6ff to your computer and use it in GitHub Desktop.
CS35L41 amplifiers in an ASUS Zenbook on linux

Asus Zenbook UX3402 speakers on Linux

Important

THIS IS NOW OBSOLETE WITH KERNEL VERSIONS ≥ 6.7.0

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

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

Warning

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

Note

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

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

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

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

Obsolete: DSDT patch

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

Obsolete: internal boost

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

Boot log

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

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

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

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

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.

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