ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
@plbossart
Copy link
Member

all quirks for CML support were picked for inclusion in the 5.15 stable kernel.

We still need help to figure out which topology is needed on those Huawei devices.

@eworm-de
Copy link

eworm-de commented Dec 6, 2021

I have access to a D15... How or what to test?

@plbossart
Copy link
Member

If you can recompile a kernel, you'll need to use #3107 (plbossart:fix/es8336-codec)

then you'll have to use
cml.tar.gz
from #3248 (comment) to test which interface this device uses.

(
Please try with sof-cml-es8336-0.tplg copied as /lib/firmware/intel/sof-tplg/sof-cml-es8336.tplg, then 1 and 2. We need this trial-and-error method to figure out where the codec is attached to (I2S/SSP interface 0 1 or 2).
)

imaami pushed a commit to imaami/linux that referenced this issue Dec 6, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
@eworm-de
Copy link

eworm-de commented Dec 6, 2021

Is it sufficient to cherry-pick the three commits from #3107 (1d5f32f 8c33dd9 32049ec) on top of linux 5.15.6?

@plbossart
Copy link
Member

Is it sufficient to cherry-pick the three commits from #3107 (1d5f32f 8c33dd9 32049ec) on top of linux 5.15.6?

possibly. all the quirks were picked up for linux-stable, but there are not yet in linux-5.15.y, so likely in the next stable release.

You will need the codec hack regardless of what linux-stable does, it's not yet upstream.

@eworm-de
Copy link

eworm-de commented Dec 7, 2021

I tried with...

Rebooted trice, with different firmware files in place. Still no sound. 😢

@plbossart
Copy link
Member

thanks for testing @eworm-de. I take from your answer that you did see a card created, started playing/streaming on the ALSA device but did not hear any sound? can you confirm the diagnosis and attach the alsa-info log?

@hli25 would you happen to have a set of ALSA mixer values that are needed for this codec?

@eworm-de
Copy link

eworm-de commented Dec 7, 2021

Uh, I had some borked module parameters around for snd_intel_dspfix... Droped these and tried again.

I do not see a card created (in pavucontrol, as this host is running pulseaudio/pipewire).

On shutdown the system panics...

I have this in logs (with journalctl -b | grep -iE '(snd|sof-audio)'):

Dec 07 16:58:24 linux kernel: snd_hda_intel 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
Dec 07 16:58:24 linux kernel: snd_hda_intel 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
Dec 07 16:58:24 linux kernel: snd_soc_skl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
Dec 07 16:58:24 linux kernel: snd_soc_skl 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: enabling device (0000 -> 0002)
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: use msi interrupt mode
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: hda codecs found, mask 4
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: Firmware info: version 1:9:2-e096c
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: Firmware: ABI 3:20:0 Kernel ABI 3:18:0
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: warn: FW ABI is more recent than kernel
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: Firmware info: version 1:9:2-e096c
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: Firmware: ABI 3:20:0 Kernel ABI 3:18:0
Dec 07 16:58:24 linux kernel: sof-audio-pci-intel-cnl 0000:00:1f.3: warn: FW ABI is more recent than kernel

@plbossart
Copy link
Member

@eworm-de the 'digital mics' log wasn't expected. need more info.

Can you please add this file
sof-dyndbg.conf.txt as /etc/modprobe.d/sof-dyndbg.conf, reboot and attach the entire 'dmesg' log? This will enable dynamic debug on the modules we care about. thanks!

plbossart added a commit that referenced this issue Dec 7, 2021
We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: #3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 8, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
ammarfaizi2 pushed a commit to ammarfaizi2/linux-block that referenced this issue Dec 8, 2021
commit ae26c08 upstream.

We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: thesofproject/linux#3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20211122232254.23362-1-pierre-louis.bossart@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
@hli25
Copy link

hli25 commented Dec 8, 2021

thanks for testing @eworm-de. I take from your answer that you did see a card created, started playing/streaming on the ALSA device but did not hear any sound? can you confirm the diagnosis and attach the alsa-info log?

@hli25 would you happen to have a set of ALSA mixer values that are needed for this codec?
FYI, I ever met no suound issue, it is fixed by chaning DAC:
alsamixser to set "DAC" to 100

@eworm-de
Copy link

Ha, totally forgot about this... Will try to find some spare time tomorrow (and lend the device).

Can you confirm that Linux 5.15.7 should contain all quirks and only patches from #3107 are required on top?

@plbossart
Copy link
Member

@eworm-de

It looks like 5.15.7 is also missing additional patches. You'll need these patches from upstream

a164137 ASoC: Intel: add machine driver for SOF+ES8336
9d36cea ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec
fa9730b ALSA: intel-dsp-config: add quirk for JSL devices based on ES8336 codec
ae26c08 ALSA: intel-dsp-config: add quirk for CML devices based on ES8336 codec
790049f ASoC: Intel: soc-acpi: apl/glk/tgl: add entry for devices based on ES8336 codec
63ff4c5 ASoC: Intel: soc-acpi: add entry for ESSX8336 on JSL
8a6cc0d ASoC: Intel: soc-acpi: add entry for ESSX8336 on CML

and the codec patches from PR #3107

also make sure to add to select CONFIG_SND_SOC_INTEL_SOF_ES8336_MACH=m

@eworm-de
Copy link

That explains why my tests did not succeed. I will have a look.

@eworm-de
Copy link

Cherry-picking the given commits on top of 5.15.7 gives errors...
I will investigate tomorrow.

@eworm-de
Copy link

Ok, I tried with...

Rebooted trice, with different firmware files in place. Still no sound. 😢

@eworm-de
Copy link

Can you please add this file sof-dyndbg.conf.txt as /etc/modprobe.d/sof-dyndbg.conf, reboot and attach the entire 'dmesg' log? This will enable dynamic debug on the modules we care about. thanks!

See attached dmesg.log.

BTW, system now panics on shutdown.

Does it help if I prepare a live system and give access to the system?

@plbossart
Copy link
Member

plbossart commented Dec 14, 2021

Ah, thanks for the log.

Doesn't look like there are any dmics handled in your system

[    8.110772] sof-audio-pci-intel-cnl 0000:00:1f.3: ASoC: physical link dmic01 (id 1) not exist
[    8.110774] sof-audio-pci-intel-cnl 0000:00:1f.3: ASoC: topology: could not load header: -22
[    8.110825] sof-audio-pci-intel-cnl 0000:00:1f.3: error: tplg component load failed -22
[    8.110831] sof-audio-pci-intel-cnl 0000:00:1f.3: error: failed to load DSP topology -22
[    8.110832] sof-audio-pci-intel-cnl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -22

but they are indeed detected in the hardware

[    7.850139] sof-audio-pci-intel-cnl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[    7.850158] sof-audio-pci-intel-cnl 0000:00:1f.3: intel_nhlt_get_dmic_geo: found 2 format definitions
[    7.850159] sof-audio-pci-intel-cnl 0000:00:1f.3: intel_nhlt_get_dmic_geo: max channels found 2
[    7.850161] sof-audio-pci-intel-cnl 0000:00:1f.3: intel_nhlt_get_dmic_geo: Array with 2 dmics
[    7.850162] sof-audio-pci-intel-cnl 0000:00:1f.3: intel_nhlt_get_dmic_geo: dmic number 2 max_ch 2

You should really not have any card created. can you confirm @eworm-de that 'aplay -l' shows nothing.

The good thing is that we have a quirk to test options

#define SOF_ES8336_SSP_CODEC_MASK (GENMASK(3, 0))
#define SOF_ES8336_TGL_GPIO_QUIRK BIT(4)
#define SOF_ES8336_ENABLE_DMIC BIT(5)

Can you try with the following option in /etc/modprobe.d/alsa-base.conf

options snd-soc-sof-es8336 quirk=0x20 (with SSP0 topology)
options snd-soc-sof-es8336 quirk=0x21 (with SSP1 topology)
options snd-soc-sof-es8336 quirk=0x22 (with SSP2 topology)

This may work with the headphone, for the speakers there may be additional work needed, on some platforms there's a GPIO. The following may be used instead.

options snd-soc-sof-es8336 quirk=0x30 (with SSP0 topology)
options snd-soc-sof-es8336 quirk=0x31 (with SSP1 topology)
options snd-soc-sof-es8336 quirk=0x32 (with SSP2 topology)

Make sure you are not using loud files when testing and never ever put a headphone over your ears before a test. Keep in mind that such experiments may blow your ears or your speakers, or both. All standards disclaimers apply.

@plbossart
Copy link
Member

Actually also provide the acpi table dump as attachment, I should be able to find the right SSP from ACPI stuff

'sudo acpidump > cml-dump.bin' and gzip/attach the result.

@eworm-de
Copy link

Here we go... See cml-dump.bin.gz.
I will have a look at the other stuff any time soon.

@plbossart
Copy link
Member

@eworm-de from what I see in the table with the latest version of acpica-tools (20210930), the SSP0 seems to be used.

/* Endpoint Descriptor #2 */
[1769h 5993   4]            Descriptor Length : 000000AB
[176Dh 5997   1]                    Link Type : 03 [Type SSP]
[176Eh 5998   1]                  Instance Id : 01
[176Fh 5999   2]                    Vendor Id : 8086
[1771h 6001   2]                    Device Id : AE34
[1773h 6003   2]                  Revision Id : 0001
[1775h 6005   4]                 Subsystem Id : 00000001
[1779h 6009   1]                  Device Type : 04
[177Ah 6010   1]                    Direction : 00 [Render]
[177Bh 6011   1]               Virtual Bus Id : 00 <<< This is the SSP Port

so you'd need to make sure the SSP0 is used in the topology and machine driver.
Note that the tool seg faults on this config so take the information with a grain of salt.

@Timarrr
Copy link

Timarrr commented Dec 15, 2021

So, is there any working patches right now? I am willing to test any potentially working solutions, as i have Huawei Matebook D16 2021 and no sound

@pwnwithlove
Copy link

I bought a Huawei Matebook D14 and didn't know that.. I'm actually living without sound, and waiting for a solution, please give us a patch ! :((

@Timarrr
Copy link

Timarrr commented Dec 16, 2021

Also, the name of issue is about Intel-based PCs, but i have an AMD-based Matebook and sound doesn't work AFAIK

@playXE
Copy link
Author

playXE commented Dec 16, 2021

@Timarrr

Also, the name of issue is about Intel-based PCs, but i have an AMD-based Matebook and sound doesn't work AFAIK

here's issue for amd version #3249

@Timarrr
Copy link

Timarrr commented Dec 16, 2021

@playXE Oh, thanks

plbossart added a commit that referenced this issue Dec 16, 2021
We've added quirks for ESS8336 but missed CML, add quirks for both LP
and H versions.

BugLink: #3248
Fixes: 9d36cea ("ALSA: intel-dsp-config: add quirk for APL/GLK/TGL devices based on ES8336 codec")
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
@mchehab
Copy link

mchehab commented Dec 23, 2021

Can you try with the following option in /etc/modprobe.d/alsa-base.conf

options snd-soc-sof-es8336 quirk=0x20 (with SSP0 topology)

With the quirk (either 0x20 or 0x30), the speaker started to work on MateBook D15 (Product Name: BOHB-WAX9). The microphone is marked as unavailable. Plugging a headphone also cuts the output. So, it sounds that the topology is not quite right, but at least it is starting to give life signs ;-)

PS.: I applied the relevant patches on the top of 5.15.11: https://github.com/mchehab/linux/tree/sound-es8336, and I'm using this topology firmware: sof-cml-es8336-0.tplg

Sound logs enclosed.

sound_dmesg.txt

@eworm-de
Copy link

I can confirm what @mchehab wrote. I have exactly the same device (MateBook D15 BOHB-WAX9) with identical behavior.

Looks like I borked the code when cherry-picking. This time I used his tree (but dropped the Fedora patches and applied to Arch Linux linux 5.15.11.arch2-1). Also the panic on shutdown is gone.

@mchehab
Copy link

mchehab commented Dec 24, 2021

I can confirm what @mchehab wrote. I have exactly the same device (MateBook D15 BOHB-WAX9) with identical behavior.

Nice to have another test on it.

Btw, with this patch:

mchehab@d560a1c

the speaker will work properly without needing to pass a quirk=0x20 parameter to snd_soc_sof_es8336 via modprobe.d. All it is needed for it to work is to set to SSP0.

Looks like I borked the code when cherry-picking. This time I used his tree (but dropped the Fedora patches and applied to Arch Linux linux 5.15.11.arch2-1).

FYI, I opted to place the Fedora patch there just to warrant that no regressions outside sound would happen. Usually, distro-specific patches are not required, but, as this is a new device, I added it anyway, just in case ;-)

Also the panic on shutdown is gone.

Yeah, it sounds that there's something wrong at the error path... if SSP2 is selected on this device, despite the modprobe errors, it hits an OOPS during device unbind. maybe an use-after-free or something like that. Haven't time to check exactly why it is happening.

@mchehab
Copy link

mchehab commented Dec 24, 2021

You should boot the DSP and reach the point where a topology file is missing.

You will have to try each of the files in this zip cml.tar.gz

Please try with sof-cml-es8336-0.tplg copied as /lib/firmware/intel/sof-tplg/sof-cml-es8336.tplg, then 1 and 2. We need this trial-and-error method to figure out where the codec is attached to (I2S/SSP interface 0 1 or 2).

At least for Intel Matebook D15 (2021 version, afaikt), the codec is attached to I2S/SSP 0. Yet, as only the speaker is working (neither internal mic nor headset works), I suspect that something else could be missing at the topology file. How those sof-cml-es8336-[0-2].tplg files were generated? Could the topology be inferred from the ACPI BIOS or from the windows .inf files?

@dattiluca
Copy link

dattiluca commented Jan 8, 2022

Has someone tried linux 5.16 out? On the amd issue someone said the driver will come with the next kernel release.

EDIT 1: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=986c5b0a1d1c5e9da70d40b88f2bb6f9601bbe41

EDIT 2: Linux 5.16 is out. Can someone please check if the problem is fixed?

@plbossart
Copy link
Member

@mchehab the topologies are generated with a macro, see https://github.com/thesofproject/sof/blob/main/tools/topology/topology1/CMakeLists.txt#L166
I generated the CML topologies with a local change, it's not released yet.

It would indeed be best to use information from ACPI instead of starting an endless list of quirks and random topologies

For the SSP used and topology, I tried to see if the information from NHLT is usable, please see #3338. if you try it on your device it should also detect SSP0 being used.

unfortunately, we have no way of detecting how the GPIOs are configured, or rather I don't know how we might infer which GPIOs are used for what, so there might still be a need for quirks there.

@pierro78
Copy link

pierro78 commented Jan 11, 2022

EDIT 2: Linux 5.16 is out. Can someone please check if the problem is fixed?

just did in #3365 but it didn t work on my Gemini Lake Kuu Yobook M
looks like if you are lucky then the correct "interface" is chosen by the "current system" and it ll work ...

now the sof project wants to guess the correct "interface" with #3338 (linux kernel changes that thorvalds have to accept ... maybe I ll try to merge and compile if I feel l have the time and energy ...)

PS for myself :
. here are some instructions on how to create the 3 kernel .deb files from the sof project : https://thesofproject.github.io/latest/getting_started/build-guide/build-from-scratch.html#step-6-build-linux-kernel ...
... oops a precompiled custom kernel seems to be already available here : #2955 (comment)

@playXE
Copy link
Author

playXE commented Jan 12, 2022

@pierro78 would that kernel work with CML?

@pierro78
Copy link

@playXE maybe check what they are saying about issues with CML in #3338 (I have GML so I didn t read it)

@simas-b
Copy link

simas-b commented Jan 12, 2022

@playXE @dattiluca I installed 5.16 kernel (with Ubuntu 22.04) with CML my sound card is not recognized. Alsa info: http://alsa-project.org/db/?f=b47d70cceb570c0ccf77e1f9187e96f8c1e8c427

@plbossart
Copy link
Member

plbossart commented Jan 12, 2022

@butavicius your card is recognized but the quirk you added is not compatible with the topology file you used

[ 4.178290] sof-essx8336 sof-essx8336: Overriding quirk 0x2 => 0x20

that forces DMIC to be enabled,

#define SOF_ES8336_TGL_GPIO_QUIRK BIT(4)
#define SOF_ES8336_ENABLE_DMIC BIT(5)

but then kaboom you don't have dmic support.
[ 4.179416] sof-essx8336 sof-essx8336: ASoC: failed to load widget DMIC0.IN

try quirk=0x0 or 0x10

plbossart added a commit to plbossart/sound that referenced this issue Jan 12, 2022
Different topology filenames may be required depending on which SSP is
used, and whether or not digital mics are present.

This patch adds a tplg_quirk_mask and in the case of the SOF driver
adds the relevant configurations.

This is a short-term solution to the ES8336 support issues.

In a long-term solution, we would need an interface where the machine
driver or platform driver have the ability to alter the topology
hard-coded low-level hardware support, e.g. by substituting an
interface for another, or disabling an interface that is not supported
on a given skew.

BugLink: thesofproject#3248
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
@simas-b
Copy link

simas-b commented Jan 12, 2022

@plbossart I have tried with 0x0, 0x10, 0x20, 0x21, 0x22, 0x30, 0x31, 0x32 with no luck. After each alsa-base.conf edit i ran sudo alsa force-reload and alsa-info. After each change, it was reflected in alsa-info ALSA/HDA dmesg part. Last alsa-info has info on all these variations:

options snd-soc-sof-es8336 quirk=0x22
http://alsa-project.org/db/?f=c7c104e91b961b6f344d654973fb140fcda95857

options snd-soc-sof-es8336 quirk=0x21
http://alsa-project.org/db/?f=13d24fceaaf4c7cda65d8602c9694e76f7f55457

options snd-soc-sof-es8336 quirk=0x20
http://alsa-project.org/db/?f=56771297c61a7a304c54b7c2f79e875e3b6e1cb7

options snd-soc-sof-es8336 quirk=0x0
http://alsa-project.org/db/?f=a3aaace401351503233f73928f69739f6558c4d9

options snd-soc-sof-es8336 quirk=0x32
http://alsa-project.org/db/?f=d22e1b0744d584108944ce49a4edb7aa6ba5ffb0

options snd-soc-sof-es8336 quirk=0x31
http://alsa-project.org/db/?f=d61f4414e488890090fd1cb656403fd657214964

options snd-soc-sof-es8336 quirk=0x10
http://alsa-project.org/db/?f=9cd398148eb53435fdb4f4ae5635c1e588f6ad57

options snd-soc-sof-es8336 quirk=0x30
http://alsa-project.org/db/?f=246d37b398b99e1e8136beaee000a588e679d87b

P.S. I really don't know what i'm doing so I can try whatever you need me to, but you'd have to walk me through it, thanks.

@plbossart
Copy link
Member

@butavicius it's just too difficult to provide support like this, I am working on a better solution with no quirks. stay tuned.