I just bought an ASUS Zenbook 14, model UX3402 (Q409Z when purchased from Best Buy in the US). It came with Windows 11 installed, and sound output works perfectly on Windows. I installed Ubuntu 22.04 on it, and everything works except for the internal speakers. It uses the Realtek ALC294 codec, and shows both Harman/Kardon and Dolby Atmos logos on the keyboard deck. I've tried all the suggestions, like using hdajackretask to enable and route various pins, forcing the snd_hda_intel kernel module (snd_sof_intel_hda was the default), reinstalling alsa and pulseaudio, disabling fastboot in the BIOS but nothing works. Not one peep out of the internal speakers. I also tried messing with the GPIO assignments using hda-verb, but no luck.
The funny thing is, the headphone jack and audio out from both HDMI and Thunderbolt/DisplayPort works. I can plug in headphones and hear sound without any issue. So clearly the sound hardware is supported. I think the problem may be with this particular laptop's sound system. It uses a surround-style audio setup, with possibly 4 speakers. It may also be using a built-in amplifier that is not getting enabled. When Windows was installed, the Device Manager showed a "Cirrus Logic Awesome Speaker Amps" device under "Sound, video and game controllers":
However, I didn't see anything about this when running lspci under Ubuntu.
Here's the output from dmesg when the sound driver loads:
[ 3.628292] snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002)
[ 3.628620] snd_hda_intel 0000:00:1f.3: Applying patch firmware 'hda-jack-retask.fw'
[ 4.956625] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[ 5.052007] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC294: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
[ 5.052013] snd_hda_codec_realtek hdaudioC0D0: speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[ 5.052016] snd_hda_codec_realtek hdaudioC0D0: hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[ 5.052017] snd_hda_codec_realtek hdaudioC0D0: mono: mono_out=0x0
[ 5.052018] snd_hda_codec_realtek hdaudioC0D0: inputs:
[ 5.052019] snd_hda_codec_realtek hdaudioC0D0: Headset Mic=0x19
Has anyone encountered this problem with a laptop using a built-in amplifier?
UPDATE 1:
I believe the laptop's speakers rely on a Cirrus Logic CS35L41 amplifier IC connected over the SPI bus. Unfortunately, I don't think there is a Linux driver, so no way to enable it and send commands to it. A driver is apparently being worked on by a Cirrus Logic employee, but there's no telling if/when it will be completed and if it will be compatible with this laptop:
UPDATE 2:
I installed kernel 5.18.0rc7, and got the following output from dmesg:
[ 1.718769] platform CSC3551:00: hash matches
[ 1.718805] acpi CSC3551:00: hash matches
[ 2.896282] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[ 2.989842] cs35l41_hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[ 2.990220] cs35l41_hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22
Looks like the kernel is detecting the amps on the SPI bus, but cannot get past the probing due to the -22 error. So, seems like things are getting closer, but not quite there yet.
UPDATE 3:
I opened the laptop, and I see two CS35L51X chips side by side on the motherboard. So this laptop uses two CS35L51 amplifiers, not CS35L41. Not sure if this matters, but it's definitely a different (newer?) chip.
UPDATE 4:
Tried with kernel 5.19.0rc4. Still not working, although there is an additional "platform not supported" message. I guess this is what error -22 means:
[ 4.807553] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[ 5.053785] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported -22
[ 5.053791] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[ 5.054477] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported -22
[ 5.054487] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22
UPDATE 5:
Tried with kernel 6.0 RC3. I am getting the same results described by Bo Gao below (missing ACPI _DSD properties). Here is the dmesg output:
[ 4.245350] Serial bus multi instantiate pseudo device driver CSC3551:00: Instantiated 2 SPI devices.
[ 4.674892] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Error: ACPI _DSD Properties are missing for HID CSC3551.
[ 4.674953] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: error -EINVAL: Platform not supported
[ 4.675000] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.0 failed with error -22
[ 4.675363] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Error: ACPI _DSD Properties are missing for HID CSC3551.
[ 4.675413] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: error -EINVAL: Platform not supported
[ 4.675454] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -22
Despite these properties missing from the BIOS, these amplifiers still work perfectly on Windows. So perhaps these properties can be recovered from a Windows install. I have dual Linux/Windows boot on this laptop, so it's easy for me to look for anything needed by the the Cirrus Logic open source people (if you're listening, let me know!).
UPDATE 6:
I tried compiling a 5.19 kernel using (modified) patches referenced by Bo Gao. At least one amp appeared to activate OK, but still no sound and rebooting did not help. However, my setup is different. The PCI quirks patch posted might not work with this laptop, as the amps are connected over SPI, not I2C and the patch referenced seems to be for I2C. Also, this laptop uses the Realtek ALC294 codec. Here is the dmesg output:
[ 4.272896] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.0: Cirrus Logic CS35L41 (35a40), Revision: B2
[ 4.273073] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Reset line busy, assuming shared reset
[ 4.377887] cs35l41-hda spi1-CSC3551:00-cs35l41-hda.1: Failed waiting for OTP_BOOT_DONE: -110
[ 4.377984] cs35l41-hda: probe of spi1-CSC3551:00-cs35l41-hda.1 failed with error -110
I tried a few variations of the PCI quirks in the Realtek patch (the ones prefixed with "ALC294"), but none worked. I'm not sure these quirks are actually being selected. Is there any way to verify they're active?