thesofproject / linux

Linux kernel source tree
Other
91 stars 131 forks source link

[ADL-P] Missing topology for ES8336 Alder Lake P device (i5-1240P Huawei Matebook 14 2022) #4111

Closed Jay-716 closed 1 year ago

Jay-716 commented 1 year ago

Sorry for this seemingly duplicate issue.

Problem

tplg request firmware intel/sof-tplg/sof-adl-es83x6-dmic4ch-ssp0.tplg failed err: -2 at every boot. Due to the missing tplg file, my speaker never work.

My Environment

OS: Arch Linux Machine: Huawei Matebook 14 2022 (KLVF-XX M1010) Kernel: 6.0.12-arch1-1 CPU: 12th Gen Intel i5-1240P (16) @ 4.400GHz Soundcard: Intel Corporation Alder Lake PCH-P High Definition Audio Controller (rev 01) sof-firmware version: 2.2.3

Check Support for ES8336 on My Machine

I have read the github wiki and sof docs as well as github issues related to the es8336 issues. I check the kernel(the archlinux official kernel) that I am currently using, and the commits which are related to es8336 and mentioned by the wiki are actually in there. And the compiling configs mentioned in the wiki are the same as mentioned in the wiki. alsa-info.sh also detects my audio device as /sys/bus/acpi/devices/ESSX8336:00 lsmod also shows that es8336 related modules are loaded.

Logs

alsa-info.txt lspci.txt kernel_log.txt

Here is the tplg loading section in the kernel log:

Dec 21 14:55:31 arch kernel: sof-essx8336 sof-essx8336: quirk mask 0x20
Dec 21 14:55:31 arch kernel: sof-essx8336 sof-essx8336: quirk SSP0
Dec 21 14:55:31 arch kernel: sof-essx8336 sof-essx8336: quirk DMIC enabled
Dec 21 14:55:31 arch kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: Direct firmware load for intel/sof-tplg/sof-adl-es83x6-dmic4ch-ssp0.tplg failed with error -2
Dec 21 14:55:31 arch kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: tplg request firmware intel/sof-tplg/sof-adl-es83x6-dmic4ch-ssp0.tplg failed err: -2
Dec 21 14:55:31 arch kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: you may need to download the firmware from https://github.com/thesofproject/sof-bin/
Dec 21 14:55:31 arch kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: error: failed to load DSP topology -2
Dec 21 14:55:31 arch kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at snd_soc_component_probe on 0000:00:1f.3: -2
Dec 21 14:55:31 arch kernel: sof-essx8336 sof-essx8336: ASoC: failed to instantiate card -2
Dec 21 14:55:31 arch kernel: sof-essx8336 sof-essx8336: snd_soc_register_card failed: -2
Dec 21 14:55:31 arch kernel: sof-essx8336: probe of sof-essx8336 failed with error -2

Cannot Find the tplg Required

And I check the files under /usr/lib/firmware/intel/sof-tplg-v2.2.3/ , and there is NOT a file named sof-adl-es83x6-dmic4ch-ssp0.tplg, only to find the similar tplg for apl. In the tplgs file([es8336_topologies_main.tar.gz] provided in the wiki page, I cannot find this tplg too.

PS. I don't know exactly if this issue should be submit to thesofproject/sof or thesofproject/linux, so I submit it here. And I owe this problem to the missing tplg file, which may be inappropriate or inaccurate because it is just my guess. If further information is needed, please let me know. I will post them below. Thanks for your viewing. :)

plbossart commented 1 year ago

Thanks for reporting this issue, which is actually a problem on both SOF and linux sides. Gah.

You can try a temporary fix by backup up your files in intel/sof-tplg/ and then cp sof-tgl-es8336-dmic4ch-ssp0.tplg sof-adl-es83x6-dmic4ch-ssp0.tplg

I'll submit a rename and add the missing topologies.

Jay-716 commented 1 year ago

Thanks for your timely reply. I then cp sof-tgl-es8336-dmic4ch-ssp0.tplg sof-adl-es83x6-dmic4ch-ssp0.tplg, and the sound work! But the volume is extremely tiny, though I set all the volume settings to 100%(and even higher). I don't know if it's related to the sound server. I am currently using pipewire, wireplumber, pipewire-alsa now. I try to change the volume in amixer, alsamixer, pavucontrol, wpctl, and the sound are still tiny. I follow the instruction to enable the dynamic debug, and here is the full dmesg log. dmesg.txt Here is the related section:

[    5.478734] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
[    5.478819] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002)
[    5.478970] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[    5.479032] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    5.485846] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode
[    5.594033] sof-audio-pci-intel-tgl 0000:00:1f.3: NHLT_DEVICE_I2S detected, ssp_mask 0x1
[    5.594038] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 4
[    5.596341] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    5.596346] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[    5.596356] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
[    5.689982] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
[    5.689986] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
[   12.131755] sof-essx8336 sof-essx8336: quirk mask 0x20
[   12.131758] sof-essx8336 sof-essx8336: quirk SSP0
[   12.131759] sof-essx8336 sof-essx8336: quirk DMIC enabled
[   12.132925] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0
[   12.133035] sof-essx8336 sof-essx8336: ASoC: Parent card not yet available, widget card binding deferred
[   12.303767] sof-essx8336 sof-essx8336: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3
[   12.330530] input: sof-essx8336 Headset as /devices/pci0000:00/0000:00:1f.3/sof-essx8336/sound/card0/input12
[   12.350352] input: sof-essx8336 HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/sof-essx8336/sound/card0/input13
[   12.350425] input: sof-essx8336 HDMI/DP,pcm=6 as /devices/pci0000:00/0000:00:1f.3/sof-essx8336/sound/card0/input14
[   12.350520] input: sof-essx8336 HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sof-essx8336/sound/card0/input15

If I sould modify the quirk? or if I sould use sof-logger to get the DSP traces? or if I should try pulseaudio? My distro kernel seems does not have the trace support, so it may be a little bit inconvinent to do that because I have never tried to build a custom kernel, but I will have a try if the DSP traces are needed. Sorry. :)

plbossart commented 1 year ago

@yangxiaohua2009 can you comment on the 'low sound' issue reported by multiple people?

yangxiaohua2009 commented 1 year ago

@Jay-716 Can you provide alsainfo/amixer when playing music? Thanks

Jay-716 commented 1 year ago

Here is the output when playing video with mpv: alsa-info.txt amixer.txt wpctl.txt

PS. I suddenly got infected with COVID-19, so my reply may not be timely. Sorry.

Jay-716 commented 1 year ago

@yangxiaohua2009 Additional information is here: pactl_list_sinks.txt pactl_list_sink_inputs.txt

I think it may probably be a pipewire issue, but I cannot make sure.

yangxiaohua2009 commented 1 year ago

Your Headphone is -48dB and your DAC is -60% vol, which makes your sound extremely low. Set them back to 0dB and you can hear load sound.

Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 3
  Mono:
  Front Left: Playback 0 [0%] [-48.00dB] [off]
  Front Right: Playback 0 [0%] [-48.00dB] [off]

Simple mixer control 'DAC',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 192
  Mono:
  Front Left: Playback 115 [60%] [-38.50dB]
  Front Right: Playback 115 [60%] [-38.50dB]
yangxiaohua2009 commented 1 year ago

I actually have a script help you doing that 4.zip

Jay-716 commented 1 year ago

OMG, The sound works perfectly now!!! This problem has confused me for a long time, so I am very grateful to you guys for your timely and enthusiastic help! Given that the pr thesofproject/sof#6878 will solve the original missing topology issue, I shall close this issue after that pr is successfully merged. Thanks. :)

ToutouDogo commented 1 year ago

I actually have a script help you doing that 4.zip

Hello, I'm a beginner with linux. How do we run this please ? Thanks, it might help me for solving https://github.com/thesofproject/linux/issues/4093

[EDIT] just had to add bash ./ Sorry for newbie question.

Not sufficient to solve issue #4093. Please let me now if this comment is irrelevant.

yangxiaohua2009 commented 1 year ago

I saw your alsa info. One control is off so you cannot hear sound.

Simple mixer control 'Right Headphone Mixer Right DAC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]

Does the playback device in your sound settings change when you insert a headset/headphone? If so you should have sound after running the shell script which changes the mixer controls

You may run alsainfo again or run amixer -c 0 to see if the 'Right Headphone Mixer Right DAC' mix is now on

yangxiaohua2009 commented 1 year ago

@ToutouDogo Also I cannot see your dmesg. Since your HUAWEI device have 2 gpios, one for speaker and one for headphone, your need to set quirk (to enable 2 gpios). First dmesg | grep tplg and you can see which ssp you're using (0, 1 or 2) Then overwrite the origin quirk. If you are using ssp 0, try options snd_soc_sof_es8336 quirk=0x80 If you are using ssp 1, try options snd_soc_sof_es8336 quirk=0x81 If you are using ssp 2, try options snd_soc_sof_es8336 quirk=0x82

ToutouDogo commented 1 year ago

I saw your alsa info. One control is off so you cannot hear sound.

Simple mixer control 'Right Headphone Mixer Right DAC',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [off]

Does the playback device in your sound settings change when you insert a headset/headphone? If so you should have sound after running the shell script which changes the mixer controls

You may run alsainfo again or run amixer -c 0 to see if the 'Right Headphone Mixer Right DAC' mix is now on

Indeed, inserting headset made it work! amixer -c 0 displays 'Right Headphone Mixer Right DAC' mix on

ToutouDogo commented 1 year ago

@ToutouDogo Also I cannot see your dmesg. Since your HUAWEI device have 2 gpios, one for speaker and one for headphone, your need to set quirk (to enable 2 gpios). First dmesg | grep tplg and you can see which ssp you're using (0, 1 or 2) Then overwrite the origin quirk. If you are using ssp 0, try options snd_soc_sof_es8336 quirk=0x80 If you are using ssp 1, try options snd_soc_sof_es8336 quirk=0x81 If you are using ssp 2, try options snd_soc_sof_es8336 quirk=0x82

Audio from headphones is fixed thank you very much. Only speaker are missing, I feel so close from solving this.

Here is the dmesg with tplg 20230112_dmesg_tplg.txt If I understand well I am using ssp 0.

Yet, when I tried to add the line options snd_soc_sof_es8336 quirk=0x80 in etc/modprobe.d/alsa-base.conf, "dummy output" came back after reboot.

yangxiaohua2009 commented 1 year ago

Please try quirk=0xa0 since you're using dmic.

sstavridis commented 1 year ago

Hi,

I have the same issue on my matebook 14. I tried everything and the sound doesn't work!

My environment

OS: Ubuntu Kernel: 6.1.4-060104-generic Machine: Huawei Matebook 14 2021 (KLVD-WXX9) CPU: 11th Gen i5-1135G7 Soundcard: Intel Corporation Tiger Lake-LP Smart Sound Technology Audio Controller (rev 20)

I tried everything I found and the sound didn't work. Does any suggestions, please?

Jay-716 commented 1 year ago

@sstavridis Hi, The alsa-info.sh output and kernel log may be helpful for the developers to help you. :)

ToutouDogo commented 1 year ago

Please try quirk=0xa0 since you're using dmic.

We're moving forward, since with this quirk 0xa0 the "dummy output" issue does not pop back as it does with other quirks. Nevertheless, still no sound from speakers. dmesg 20230113.txt alsa-info.txt

Jay-716 commented 1 year ago

Late update for the original issue: I was so excited when my speakers worked, so I ignore another two issues. Sorry. This is just some kind of complaint or note about the weird es8336 codec chipset. Just ignore it if you don't want to spend your treasured time helping me fix that.

I do tons of searching and find tons of different issues related to es8336 codec chipsets. I think this chipset is very annoying and troublesome to some degree. So I may not try to fix these issues these days, because, on one hand, it may be time-consuming for me and the developers, on the other hand, my speakers just work, though not fine. :)

Logs when playing sound with mpv and recording sound with pw-record simultaneously: alsa-info.txt full_kernel_log.txt kernel_log_snd|sound|sof.txt

PS. Sorry for my poor English, please forgive me for my typo and mistakes. Thanks to the developers again.

yangxiaohua2009 commented 1 year ago

@Jay-716 Please try quirk=0xe0 since you have an inverted configuration

yangxiaohua2009 commented 1 year ago

@ToutouDogo There are two gpios, one for speaker and one for headphone. When playing music, insert and unplug your headset and cat /sys/kernel/debug/gpio so you can see the gpio level change. amixer sset Speaker on amixer sset Speaker off and amixer sset Headphone off amixer sset Headphone on can change the Speaker/Headphone gpio level seperately. Either Speaker or Headphone must be on so you can hear sound.

If still nothing happens, try quirk=0xb0 which invert the two gpios

Jay-716 commented 1 year ago

@Jay-716 Please try quirk=0xe0 since you have an inverted configuration

Thanks for your swift reply very much. And thanks for your treasured time.

I use options snd_soc_sof_es8336 quirk=0xe0

Speaker The speaker works not so fine. When I adjust the volume in pavucontrol, I can hear the bubbling sound made by pavucontrol as the feedback of volume adjustment. However, when playing sound with mpv, firefox, they cannot play sound as the video plays. Pipewire seems cannot handle the speaker properly. Many erros like no node avaliable(reported by mpv):

[ao/pipewire] Stream in error state, trying to reload...
[ao/pipewire] Error during playback: No such file or directory, no node available

Mic When I use pw-record to record sound, it exited and reported errors above like no node avaliable. OBS Studio does not work too.

In pavucontrol, the output devices list "Speaker (unavaliable)" and "Headphones", the input devices list "Headset microphone(unplugged)". screenshot1 screenshot2 alsamixer shows the "default sound device"(pipewire) "dose not have any controls". I cannot adjust the volume of pipewire, but the real sound card controls are normal and can be adjusted. screenshot3 screenshot4

Logs Kernel logs with dynamic debug enabled: dmesg.txt alsa-info.sh when playing video in firefox and mpv simultaneously: alsa-info.txt

yangxiaohua2009 commented 1 year ago

The alsa/kernel level works fine but the user/alsa-ucm-conf level works badly. You may try official alsa-ucm-conf here or my ucm script ucm.zip

Also, before change ucm, can you select headphone and see if you can have sound?

Jay-716 commented 1 year ago

Also, before change ucm, can you select headphone and see if you can have sound?

The default output device in pavucontrol is the "Headphone", and the speaker works fine when playing videos. The other output device "Speaker(unavailable)" would not work. The behavior of mpv is weird. It keeps flashing in pavucontrol and plays no sound. It may be corresponding to the errors I mentioned above.([ao/pipewire] Stream in error state, trying to reload...) Here is the log after modifying quirk and before changing ucm: alsa-info-before-ucm.txt

You may try official alsa-ucm-conf here or my ucm script ucm.zip

I'm currently using the official alsa-ucm-conf 1.2.8 (an official package required by alsa in archlinux). I check the files between the official github repo and that installed in my pc, they are actually the same one.

Now I switch to the ucm you provided. Unfortunately, the devices listed do not change. There are sounds both "Headphone" and "Speaker(unavailable)". The volume of the former is higher, and that of the latter is lower. The mic is still "Headset microphone(unplugged)" and do not work. Here is the log after switching to your ucm script(when selecting different output device): alsa-info-Headphone.txt alsa-info-Speaker(unavaliable).txt

I am considering migrating back to pulseaudio instead of pipewire to see if these issues remain. Sorry for this disappointing result.

sstavridis commented 1 year ago

@Jay-716 Thanks for the advice! I'm not very familiar with Linux, this is my first attempt to install and use linux as my daily device. I managed to make the sound work by following these steps:

  1. I downloaded the es8336_topologies_main.tar.gz file from https://github.com/thesofproject/linux/wiki/ES8336-support
  2. I move the file to this location /usr/lib/firmware/intel/sof-tplgs/
  3. Restart the machine

But after that the sound was very quiet, I was struggling to hear. So I opened pavucontrolmade the appropriate configuration and ran sudo alsactl store. But the setting didn't save, after every restart the sound was very quiet. Furthermore, when I plugged a headphones the sound was playing from the headphones and laptop speakers too.

Then, I realized that the microphone didn't work either. The input devices listed are unplugged. After that, I was so frustrated that I stopped the effort. It is worth trying again or the Huawei devices are incompatible with Linux distros? I even tried DeepinOs which is a distro made by Huawei with the same results...

Jay-716 commented 1 year ago

@sstavridis haha at least your speaker works now. I am not familiar with Ubuntu, but in Arch, there is a systemd service called alsa-restore.service, which will automatically store/restore alsa config(usually located in /var/lib/alsa/asound.state) when shutdown and boot. So you can check if this service exists in Ubuntu. As for the other issues, I am sorry that I cannot help because I know little about them and am frustrated.

PS. Huawei's laptops are very unfriendly to linux actually. I nearly got mad fixing tons of bugs. Btw, Deepin is not made by Huawei. What Huawei made is Euler OS. Regards.

yangxiaohua2009 commented 1 year ago

@Jay-716 Sorry I forgot your are using DMIC. Please try this ucm. sof-essx8336-dmic.zip

basically create a folder named sof-essx8336 under /usr/share/alsa/ucm2/ and copy the three files to the folder.

backup and remove the folder sof-essx8336 under /usr/share/alsa/ucm2/conf.d/

use alsaucm reload to make sure you have a correct ucm configuration.

If you're using pulseaudio and want to debug ucm, try

systemctl --user stop pulseaudio.socket
systemctl --user stop pulseaudio.service
pulseaudio -vvvvv

This prints log about ucm.

Jay-716 commented 1 year ago

@yangxiaohua2009 Here is the result. Unfortunately, the situation is even worse. Sorry about that. What I did:

There is a full list of files under my /usr/share/alsa in my attachment.

Result

Attachments

PS. I will try pulseaudio later when I have time, sorry about that. Thanks.

Jay-716 commented 1 year ago

New errors in kernel(6.1.6) log:

sof-essx8336 sof-essx8336: error -EBUSY: could not get speakers-enable GPIO
sof-essx8336: probe of sof-essx8336 failed with error -1

new kernel log: kernellog.txt

ToutouDogo commented 1 year ago

@ToutouDogo There are two gpios, one for speaker and one for headphone. When playing music, insert and unplug your headset and cat /sys/kernel/debug/gpio so you can see the gpio level change. amixer sset Speaker on amixer sset Speaker off and amixer sset Headphone off amixer sset Headphone on can change the Speaker/Headphone gpio level seperately. Either Speaker or Headphone must be on so you can hear sound.

If still nothing happens, try quirk=0xb0 which invert the two gpios

I played with these commands. Headphones works 'automatically' when I plugged it, but sound stops after amixer sset Headphone off or amixer sset Speaker on , as you mentioned.

On the other hand, when I unplugg headphones, Speaker does not work, even after amixer sset Headphone off and amixer sset Speaker on.

I tried with quirk=0xb0, with similar observations. Also, I was not seeing differences in the output of cat /sys/kernel/debug/gpio , after plugging, unplugging headphones while playing music.

I saved command lines and respective outputs with both quirks in the following text files, maybe there are some information I did'nt understand in the outputs.

gpio display quirk 0xb0.txt gpio display quirk 0xa0.txt

yangxiaohua2009 commented 1 year ago

@ToutouDogo It's a little bit confusing whether the gpio values are high or low when the sound works, Anyway I noticed that when headphone is off, the headphone value is -48dB which makes the sound extremely small. Can you manuelly set it larger with alsamixer or amixer cset name='Headphone Playback Volume' 3,3 and see if the Speaker sound works, with the Headphone either plugged or unplugged? Thanks.

Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 3
  Mono:
  Front Left: Playback 0 [0%] [-48.00dB] [off]
  Front Right: Playback 0 [0%] [-48.00dB] [off]
yangxiaohua2009 commented 1 year ago

@Jay-716 To many errors now, can you return to the original situation when Headphone works but the Speaker is unavaliabe?

alsaucm: error failed to open sound card hw:0: No such file or directory means the ucm is not correctly loaded. Does this message appear when using official ucm?

For the [ao/pipewire] Stream in error state, trying to reload... error, you may want to debug pipewire using methods here.

ToutouDogo commented 1 year ago

When headphones are plugged,

>sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 664-1023, parent: platform/INT34C5:00, INT34C5:00:
 gpio-680 (                    |headphone-enable    ) out lo ACTIVE LOW
 gpio-681 (                    |speakers-enable     ) out lo ACTIVE LOW

and sound works in heaphones. Then, amixer sset Headphone off and amixer sset Speaker on gives

>sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 664-1023, parent: platform/INT34C5:00, INT34C5:00:
 gpio-680 (                    |headphone-enable    ) out hi ACTIVE LOW
 gpio-681 (                    |speakers-enable     ) out hi ACTIVE LOW

Then

>amixer cset name='Headphone Playback Volume' 3,3 
numid=1,iface=MIXER,name='Headphone Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=3,step=0
  : values=3,3
  | dBrange-
    rangemin=0,,rangemax=0
      | dBscale-min=-48.00dB,step=0.00dB,mute=0
    rangemin=1,,rangemax=3
      | dBscale-min=-24.00dB,step=12.00dB,mute=0

Does not fix sound in speakers. I don't know what the ouput means. Why is there only have a headphone volume control in alsamixer and no master volume or speaker volume ? Also, is it normal that Speaker playback channel is Mono ?

>amixer sset Speaker on 
Simple mixer control 'Speaker',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]

[Edit] I edited the post because of syntax error making display a mess

yangxiaohua2009 commented 1 year ago

Does not fix sound in speakers. I don't know what the ouput means. Why is there only have a headphone volume control in alsamixer and no master volume or speaker volume ? Also, is it normal that Speaker playback channel is Mono ?

It's normal.

The Headphone and Speaker are from the same source and controled on/off by GPIO. The Headphone value also affects Speaker Try the following: Keep the headphone plugged.

  1. Turn on the Speaker by >amixer sset Speaker on
  2. Turn on the Speaker and turn off the Headphone by >amixer sset Headphone off
  3. See if Speaker or Headphone work and cat the gpio value.

When the Headphone plugged, some amixer controls change so you cannot hear sound from Speaker.

Jay-716 commented 1 year ago

@yangxiaohua2009 I restore all the things back. (quirk, ucm) Now what I have modified only is the missing tplg file(cp /usr/lib/firmware/intel/sof-tplg/sof-tgl-es8336-dmic4ch-ssp0.tplg /usr/lib/firmware/intel/sof-tplg/sof-adl-es83x6-dmic4ch-ssp0.tplg) with default quirk, default ucm... the alsa-lib main.c:1541:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -2 error still exists in kernel log.

alsa-info.txt more_detailed_kernel_log.txt

maybe I should debug ucm? I know little about it. very sorry. I decide to try pulseaudio later.

ToutouDogo commented 1 year ago

Thank you for the explaination, and for your huge patience.

:~$ amixer sset Speaker on
Simple mixer control 'Speaker',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]

:~$ amixer sset Headphone off
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 3
  Mono:
  Front Left: Playback 3 [100%] [0.00dB] [off]
  Front Right: Playback 3 [100%] [0.00dB] [off]

I then turn up volume to maximum with keyboard key, and no sound either from Speaker, or Headphone.

:~$ sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 664-1023, parent: platform/INT34C5:00, INT34C5:00:
 gpio-680 (                    |headphone-enable    ) out hi ACTIVE LOW
 gpio-681 (                    |speakers-enable     ) out hi ACTIVE LOW

:~$ amixer cset name='Headphone Playback Volume' 3,3 
numid=1,iface=MIXER,name='Headphone Playback Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=3,step=0
  : values=3,3
  | dBrange-
    rangemin=0,,rangemax=0
      | dBscale-min=-48.00dB,step=0.00dB,mute=0
    rangemin=1,,rangemax=3
      | dBscale-min=-24.00dB,step=12.00dB,mute=0

And sill no sound, either from Speaker, or Headphone, Headphone being plugged all along as you precised. Maybe its dumb but I also tried 10, 100, 1000, 10000 instead of 3,3 for the last command, without success.

yangxiaohua2009 commented 1 year ago

@ToutouDogo You may want to try this patch https://github.com/thesofproject/linux/pull/4112. This patch changes the gpio level.

yangxiaohua2009 commented 1 year ago

@Jay-716 a folder named sof-essx8336 with sof-essx8336.conf in it under ucm2 or ucm2/conf.d should give you normal ucm configuration. Even if the ucm is not working The speaker can be available. Yes you should debug pipewire or switch to pulseaudio.

ToutouDogo commented 1 year ago

@ToutouDogo You may want to try this patch #4112. This patch changes the gpio level.

I did try.

With headphones plugged in, there's sound from headphone as previously reported.

sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 664-1023, parent: platform/INT34C5:00, INT34C5:00:
 gpio-680 (                    |speakers-enable     ) out lo 
 gpio-681 (                    |headphone-enable    ) out lo ACTIVE LOW

This output does not changes, when I amixer sset Headphone off amixer sset Headphone on, but sound goes off if I set Headphone off.

amixer sset Speaker on cut sound from headphones when headphones are plugged, but no sound from speaker, even with amixer sset Headphone off.

sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 664-1023, parent: platform/INT34C5:00, INT34C5:00:
 gpio-680 (                    |speakers-enable     ) out hi 
 gpio-681 (                    |headphone-enable    ) out hi ACTIVE LOW

The output is the same when I unplugg headphones, and still no sound from speakers.

Headphones plugged, sound from headphones.

sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 664-1023, parent: platform/INT34C5:00, INT34C5:00:
 gpio-680 (                    |headphone-enable    ) out lo ACTIVE LOW
 gpio-681 (                    |speakers-enable     ) out lo 

amixer sset Speaker on

sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 664-1023, parent: platform/INT34C5:00, INT34C5:00:
 gpio-680 (                    |headphone-enable    ) out hi ACTIVE LOW
 gpio-681 (                    |speakers-enable     ) out hi 

amixer sset Heaphone off

sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 664-1023, parent: platform/INT34C5:00, INT34C5:00:
 gpio-680 (                    |headphone-enable    ) out hi ACTIVE LOW
 gpio-681 (                    |speakers-enable     ) out hi 

Unplugged Headphones, still no sound. Same cat. amixer sset Headphone on amixer sset Speaker off

sudo cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 664-1023, parent: platform/INT34C5:00, INT34C5:00:
 gpio-680 (                    |headphone-enable    ) out lo ACTIVE LOW
 gpio-681 (                    |speakers-enable     ) out lo 

No sound. Plugging Headphones, sounds back in Headphones.

sstavridis commented 1 year ago

@sstavridis haha at least your speaker works now. I am not familiar with Ubuntu, but in Arch, there is a systemd service called alsa-restore.service, which will automatically store/restore alsa config(usually located in /var/lib/alsa/asound.state) when shutdown and boot. So you can check if this service exists in Ubuntu. As for the other issues, I am sorry that I cannot help because I know little about them and am frustrated.

PS. Huawei's laptops are very unfriendly to linux actually. I nearly got mad fixing tons of bugs. Btw, Deepin is not made by Huawei. What Huawei made is Euler OS. Regards.

@Jay-716 Even though I was frustrated I decided to give it one more chance. So, I installed Manjaro and it seems to recognize everything out of the box. The only issue is that the sound is too low. I open the alsamixer make the appropriate settings, exit, and then execute sudo alsactl store. But after a reboot, it seems that the setting didn't save. Any recommendation?

yangxiaohua2009 commented 1 year ago

@sstavridis edit the file /usr/share/alsa/ucm2/Intel/sof-essx8336/sof-essx8336.conf and change the 'DAC Volume' from 60% to 100% should solve your problem.

sstavridis commented 1 year ago

@sstavridis edit the file /usr/share/alsa/ucm2/Intel/sof-essx8336/sof-essx8336.conf and change the 'DAC Volume' from 60% to 100% should solve your problem.

@yangxiaohua2009 I can't find this file, this location doesn't even exists

yangxiaohua2009 commented 1 year ago

@sstavridis what does alsaucm reload tell you? If no result returns then you can find the file using find -name sof-essx8336.conf under folder /usr/share/alsa/ucm2/

sstavridis commented 1 year ago

@yangxiaohua2009 alsaucm reload doesn't return anything. When I run find -name sof-essx8336.conf I get two results

./conf.d/sof-essx8336/sof-essx8336.conf
./Intel/sof-essx8336/sof-essx8336.conf

What should I do? Furthermore it seems that the microphone doesn't work

yangxiaohua2009 commented 1 year ago

You may change the DAC volume in /usr/share/alsa/ucm2/Intel/sof-essx8336/sof-essx8336.conf

Also, you may want to manuelly enable mic by

                        cset "name='Internal Mic Switch' on"
            cset "name='ADC PGA Gain Volume' 10"
            cset "name='ADC Capture Volume' 150"
            cset "name='Headset Mic Switch' on"
            cset "name='Digital Mic Mux' 'dmic disable'"            

and switch between the two mic input via

cset "name='Differential Mux' 'lin1-rin1'"
cset "name='Differential Mux' 'lin2-rin2'"

@sstavridis

sstavridis commented 1 year ago

@yangxiaohua2009 I made the changes to DAC volume but the sound is still very low, you can see the attached file sof-essx8336.conf.txt Also, I have run your 4.zip script in which you run the same commands as above to enable the mic but it didn't work, should I copy and paste them inside the conf instead? The only way I managed to make the sound louder is to open terminal type alsamixer as shown in step1.png then F6 and select default: 0 sof-essx8336 as shown in step2.png and the raise the first Headphone bar as show in step3.png.

Sorry all this question but I'm new to linux. Thanks for your help!

sof-essx8336.conf.txt step1 step2 step3

yangxiaohua2009 commented 1 year ago

You may want to backup and replace your HiFi.conf file with this one: HiFi.zip.

cset "name='Headphone Playback Volume' 3,3" added to EnableSequence. @sstavridis

sstavridis commented 1 year ago

@yangxiaohua2009 Unfortunately, it didn't work...

Jay-716 commented 1 year ago

@yangxiaohua2009 Sorry for disturbing you again. This is just a late inform, and my issues are almost finished. No need to reply if you don't want to. Thanks. :) My speaker and mic work relatively fine now. I applied the dmic ucm you provided wrongly so they are not correctly loaded. And now I figure it out and they loaded correctly. I find that only when I select the "Pro Audio" profile in pavucontrol, the mic starts to work.

Here are my tests:

Remaining small problems:

These problems are relatively tolerable. At least the mic works. Thank you very very much for your patience and enthusiasm. Best regards.

yangxiaohua2009 commented 1 year ago

@Jay-716 You may want to follow this link to disable suspend on idle so that there is no pop noise, at the cost that you may not have sound after system suspend and resume. Or you may open sound settings to keep the codec always on at the cost of more power consumption.