Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No sound on 6.7rc3 and Matebook 14 2021 AMD #26

Closed
TomZanna opened this issue Nov 29, 2023 · 47 comments
Closed

No sound on 6.7rc3 and Matebook 14 2021 AMD #26

TomZanna opened this issue Nov 29, 2023 · 47 comments

Comments

@TomZanna
Copy link

TomZanna commented Nov 29, 2023

Hi @codepayne,
today I booted up kernel 6.7rc3 (from Fedora Rawhide 20231129) on my Matebook 14 2021 but I can't see the sound card in the alsa mixer.
The exact model written on the bottom of the laptop is "KLVL-WXX9-PCB-B1" and it has a R7 4800H.

Here are the outputs of alsa-info.sh and dmesg:
alsa-info.txt
dmesg.txt

Also, do you accept donations? I would like to send you a small reward for your work.

@TomZanna TomZanna changed the title No sound on Matebook 14 2021 AMD No sound on 6.7rc3 and Matebook 14 2021 AMD Nov 29, 2023
@fernandosang
Copy link

I have the same model. I thought the 6.7 kernel would fix that :(

@codepayne
Copy link
Owner

codepayne commented Dec 2, 2023

@TomZanna @fernandosang My assumption is that the kernel config option that enables the sound driver is not enabled. Can you obtain the kernel config of your running kernel?
Check if CONFIG_SND_SOC_AMD_LEGACY_MACH is present

For example Ubuntu seems to have this option enabled by default, I just checked the latest ubuntu: 23.10:

ubuntu@ubuntu:/boot$ cat config-6.5.0-9-generic | grep -i "soc_amd"
CONFIG_SND_SOC_AMD_ACP=m

CONFIG_SND_SOC_AMD_CZ_DA7219MX98357_MACH=m
CONFIG_SND_SOC_AMD_CZ_RT5645_MACH=m
CONFIG_SND_SOC_AMD_ST_ES8336_MACH=m
CONFIG_SND_SOC_AMD_ACP3x=m
CONFIG_SND_SOC_AMD_RV_RT5682_MACH=m
CONFIG_SND_SOC_AMD_RENOIR=m
CONFIG_SND_SOC_AMD_RENOIR_MACH=m
CONFIG_SND_SOC_AMD_ACP5x=m
CONFIG_SND_SOC_AMD_VANGOGH_MACH=m
CONFIG_SND_SOC_AMD_ACP6x=m
CONFIG_SND_SOC_AMD_YC_MACH=m
CONFIG_SND_SOC_AMD_ACP_COMMON=m
CONFIG_SND_SOC_AMD_ACP_PDM=m
CONFIG_SND_SOC_AMD_ACP_I2S=m
CONFIG_SND_SOC_AMD_ACP_PCM=m
CONFIG_SND_SOC_AMD_ACP_PCI=m
CONFIG_SND_SOC_AMD_MACH_COMMON=m
CONFIG_SND_SOC_AMD_LEGACY_MACH=m
CONFIG_SND_SOC_AMD_SOF_MACH=m
CONFIG_SND_SOC_AMD_RPL_ACP6x=m
CONFIG_SND_SOC_AMD_PS=m
CONFIG_SND_SOC_AMD_PS_MACH=m

@fernandosang
Copy link

Hi @codepayne, thanks for replying.

I did find CONFIG_SND_SOC_AMD_LEGACY_MACH but it's as "is not set".
What should I do?

Also, I tested the pop_os kernel 6.0.12, and it detected Huawei stuff, but still no audio. My laptop is Huawei Matebook 14 AMD (KLVL-WXX9)

@codepayne
Copy link
Owner

codepayne commented Dec 2, 2023

@fernandosang I'm not familiar with Fedora distros. You could try to test the latest normal fedora release, and see if there they enable this option. If they do enable then I suppose there is nothing to worry about, when a new fedora release will happen with kernel 6.7 at least, you will have sound working automatically.
If they don't enable even in normal versions of Fedora then there are two options:

  • Raise a ticket to fedora team to also enable this kernel option in their distro
  • Compile the fedora kernel yourself and enable this kernel option

@fernandosang
Copy link

fernandosang commented Dec 2, 2023

Oh, I forgot to mention, I'm using KDE Neon at the moment.

Is there anything I can do now to make it work? I really need audio and I just don't wanna go back to Windows.

@fernandosang
Copy link

fernandosang commented Dec 2, 2023

Also, quick question, sorry. If I'm going to compile 6.7-rc3, am I supposed to do it with the config in your repo "working-config-huawei..."; or is it not necessary there anymore?

Sorry, I want to give that a try again.

@TomZanna
Copy link
Author

TomZanna commented Dec 2, 2023

My assumption is that the kernel config option that enables the sound driver is not enabled. Can you obtain the kernel config of your running kernel? Check if CONFIG_SND_SOC_AMD_LEGACY_MACH is present

OK. That flag was missing in Fedora Rawhide (daily build), so I tried with the latest Ubuntu Noble+6.7rc3 from https://kernel.ubuntu.com/mainline. The sound card is now visible from both alsamixer and Gnome and I can hear some pops coming from the speakers. However, no sound is played with either Firefox or aplay.

E.g. aplay. Note that I have to stop it manually otherwise it stays that way indefinitely

tomzanna@wuawai:~$ aplay -d 1 /usr/share/sounds/alsa/Noise.wav 
Playing WAVE '/usr/share/sounds/alsa/Noise.wav' : Signed 16 bit Little Endian, Rate 48000 Hz, Mono
^CAborted by signal Interrupt...
aplay: pcm_write:2146: write error: Interrupted system call

This is the new alsa-info.sh output: alsa-info.txt

Here are the alsamixer nobs. Is it right that I don't see the master?
Screenshot from 2023-12-02 23-29-20
Screenshot from 2023-12-02 23-28-55

@codepayne
Copy link
Owner

@TomZanna I see some issues in your alsa mixer setup, I set the settings you have and the sound is very low, barely audible but still hearable, and I do have some pops.

Firstly make sure that DAC source mux is set to: LDaTA to LDAC, RDATA to RDAC. Without it there will be no sound.

Disable Left Headphone Mixer LLIN and Right Headphone Mixer RLIN - these ones seem to add pops

Push DAC, Headphone Mixer and Headphone to 100.

These should give you audible sound.

@codepayne
Copy link
Owner

Also, quick question, sorry. If I'm going to compile 6.7-rc3, am I supposed to do it with the config in your repo "working-config-huawei..."; or is it not necessary there anymore?

Sorry, I want to give that a try again.

I would use the config of the kernel you are running right now and just enable CONFIG_SND_SOC_AMD_LEGACY_MACH.

@fernandosang
Copy link

Also, quick question, sorry. If I'm going to compile 6.7-rc3, am I supposed to do it with the config in your repo "working-config-huawei..."; or is it not necessary there anymore?
Sorry, I want to give that a try again.

I would use the config of the kernel you are running right now and just enable CONFIG_SND_SOC_AMD_LEGACY_MACH.

Thank you. Unfortunately, I tried that and I didn't have any luck. I mean, it does show the ess8336 on alsa mixer but there's no audio yet. Do I have to do anything else after the kernel? Copying any files or something like that? Sorry to bother this much.

@codepayne
Copy link
Owner

@TomZanna @fernandosang
I think I know what is going on. I forgot that AMD introduced a regression the PM handling of the ACP sound controller. More info here:
https://lore.kernel.org/alsa-devel/87a5v8szhc.fsf@mutex.one/

Supposedly a fix will be sent in time so that 6.7 will have it in, but it may also not happen, depends on AMD engineers.

There is a workaround you can use for the moment:
you have to run this command as root:
echo -1 > /sys/bus/pci/drivers/snd_acp_pci/0000:03:00.5/power/autosuspend_delay_ms

In your case "0000:03:00.5" may not exist at that path, replace it with what you have there instead.

You need to do it once per boot.
You can create a systemd service file to do it for you in each boot:

Create a shell script at /usr/local/bin/disable-sound-autosuspend.sh
sudo nano /usr/local/bin/disable-sound-autosuspend.sh

#!/bin/bash
echo -1 > /sys/bus/pci/drivers/snd_acp_pci/0000:03:00.5/power/autosuspend_delay_ms

sudo chmod +x /usr/local/bin/disable-sound-autosuspend.sh

sudo nano /lib/systemd/system/disable-sound-autosuspend.service

[Unit]
Description=Disable Sound Autosuspend
After=syslog.target

[Service]
Type=oneshot
ExecStart=/usr/local/bin/disable-sound-autosuspend.sh

[Install]
WantedBy=multi-user.target

sudo systemctl enable disable-sound-autosuspend.service

sudo systemctl start disable-sound-autosuspend.service

After this your sound should work (of course you also have to configure alsamixer according to the wiki)

@fernandosang
Copy link

@codepayne I understand. I'll test and let you know.
Really appreciate your taking the time to do all this and to further support us here. You're awesome, man!

@TomZanna
Copy link
Author

TomZanna commented Dec 3, 2023

IT WORKS! Thanks @codepayne for the help.

The speakers have an ok-ish volume despite having set alsamixer as you suggested and maxing out the volume in Gnome. Also, when I plug-unplug the headphones the Headphones nob is set to 0... maybe it's a problem on the Pipewire/WirePlumber side?

Overall it's great that the headphones sound loud and clear.

@fernandosang
Copy link

@codepayne I tried 6.7 rc4 that came out today, apparently. Added:

CONFIG_SND_SOC_AMD_LEGACY_MACH=m

But now it's not detecting anything at all. Could something have been removed on this new release? Or should I have done something else? I remember the only way it's actually worked is by using your config, I used mine from KDE kernel 6.2.

@fernandosang
Copy link

I'm glad this worked for @TomZanna.

Thank you so much for your patience and support, @codepayne. I give up. Nothing worked so I'll just sadly go back to Windows. This was really exhausting and I'm sure I just don't have the knowledge to figure out what I'm doing wrong.

Thanks again.

@Lamafout
Copy link

Lamafout commented Dec 3, 2023

I have done everything that is written here, but on Ubuntu 23.10 with kernel 6.7 rc4 the sound still does not appear.... I hope that the solution will be found and the owners of this beautiful laptop will be able to use linux comfortably without unnecessary actions

@fernandosang
Copy link

@codepayne Just wanted to report I gave this thread a try again and sound's working lol
I moved to Ubuntu Noble+6.7rc3 from the link Tom suggested. Did the autosuspend thing and configured alsa.
It's now working just fine.

2 problems only.
1st, there's a "pop" sound every couple seconds/minutes. Not a big problem, I guess, but still weird and a bit scary.
2nd, microphone's not working. I'm trying to figure out if I missed anything when compiling the kernel on KDE Neon the first time, as Ubuntu Noble's still buggy.

Anyway, thank you so much. Maybe not totally usable, but this gives me hope, in the future with 6.7 stable, I'll be able to use Linux again. You're really amazing, man.

@fernandosang
Copy link

Also, just checked and audio plays at 1.5x or 1.75x lmao
Bluetooth also stops working suddenly, but I think that's related to the Ubuntu unstable version I'm running. Anyway xD

@codepayne
Copy link
Owner

codepayne commented Dec 3, 2023

I have done everything that is written here, but on Ubuntu 23.10 with kernel 6.7 rc4 the sound still does not appear.... I hope that the solution will be found and the owners of this beautiful laptop will be able to use linux comfortably without unnecessary actions

@Lamafout Just installed ubuntu 23.10 with kernel 6.7rc4.
Sound works ok, if the autosuspend delay is set to -1 and the proper settings are set in alsamixer.
What I did observe is that the alsamixer settings are not persisted after a reboot. Are you sure you have the option CONFIG_SND_SOC_AMD_LEGACY_MACH enabled in kernel config?

@codepayne
Copy link
Owner

Also, just checked and audio plays at 1.5x or 1.75x lmao Bluetooth also stops working suddenly, but I think that's related to the Ubuntu unstable version I'm running. Anyway xD

@fernandosang What do you mean? Is it sped up? Attach the output of sudo dmidecode from your system.

@fernandosang
Copy link

Also, just checked and audio plays at 1.5x or 1.75x lmao Bluetooth also stops working suddenly, but I think that's related to the Ubuntu unstable version I'm running. Anyway xD

@fernandosang What do you mean? Is it sped up? Attach the output of sudo dmidecode from your system.

Exactly. Sped up and the audio quality isn't that good/high volume.

Here's the output:

https://pastebin.com/n6LWyZQ3

@Lamafout
Copy link

Lamafout commented Dec 4, 2023

Update: I tried doing the same thing again, and now I have everything working! Thanks a lot, @codepayne !

@fernandosang
Copy link

Update: I tried doing the same thing again, and now I have everything working! Thanks a lot, @codepayne !

Hey bro, congratulations!
Can I ask what distro, kernel and config you used? Also, what laptop model.

I'm really happy for you guys. I know the pain lol

@TomZanna
Copy link
Author

TomZanna commented Dec 4, 2023

I tried an Arch + linux-git of the AUR today. I didn't notice it yesterday because I was too excited but I can confirm that the sound is sped up, it seems about 1.3x (60 beats in 45 seconds). The test setup was for me to listen to a video at 60 bpm, counting from 0 to 60, while timing it with my phone. I then repeated the same test on Windows, listening to the same video, and it was spot on (60 beats in 60 seconds).

The speaker sound is also loud and clear, yesterday I messed up the headphones knob in alsamixer while plugging and unplugging the jack.

Here is my dmidecode's output: dmidecode.txt

@fernandosang
Copy link

I tried an Arch + linux-git of the AUR today. I didn't notice it yesterday because I was too excited but I can confirm that the sound is sped up, it seems about 1.3x (60 beats in 45 seconds). The test setup was for me to listen to a video at 60 bpm, counting from 0 to 60, while timing it with my phone. I then repeated the same test on Windows, listening to the same video, and it was spot on (60 beats in 60 seconds).

The speaker sound is also loud and clear, yesterday I messed up the headphones knob in alsamixer while plugging and unplugging the jack.

Here is my dmidecode's output: dmidecode.txt

So we have exactly the same laptop; I wonder if it's something related to our configuration, or if it's kernel related.

@codepayne
Copy link
Owner

I tried an Arch + linux-git of the AUR today. I didn't notice it yesterday because I was too excited but I can confirm that the sound is sped up, it seems about 1.3x (60 beats in 45 seconds). The test setup was for me to listen to a video at 60 bpm, counting from 0 to 60, while timing it with my phone. I then repeated the same test on Windows, listening to the same video, and it was spot on (60 beats in 60 seconds).

The speaker sound is also loud and clear, yesterday I messed up the headphones knob in alsamixer while plugging and unplugging the jack.

Here is my dmidecode's output: dmidecode.txt

@TomZanna Can you compile a kernel and deploy it on your system? I'm asking because if we are going to solve this issue I will have to add some debug logs to the kernel and you will have to clone the kernel and test it and give me back the kernel logs.

By the way can you give me also the kernel logs of your current kernel?

@TomZanna
Copy link
Author

TomZanna commented Dec 5, 2023

It would be the first time but I have a lot of free time (from Thursday to Sunday) and online I see that there is plenty of documentation. I also have a couple of friends near home who could help me just in case.
Please note that I cheated yesterday by using the Chaotic AUR repository.

BTW, this is the dmesg's output: dmesg-linux_6-7-rc4.txt

@codepayne
Copy link
Owner

codepayne commented Dec 5, 2023

@TomZanna You can start by installing the kernel from this repo (linux-sound-huawei, follow the wiki), and check if you still have this speed up and attach the kernel logs.

@TomZanna
Copy link
Author

TomZanna commented Dec 7, 2023

I'm back after trying the kernel from this repository. The problem remains but I noticed a couple of things, both with 6.1.3 and 6.7rc.

  • As soon as I open the Gnome settings sound tab the sound slows down to the right speed and when I change the tab (e.g. Energy, Bluetooth, ...) the sound speeds up again.
  • In the 60 beats test when the sound is accelerated it seems to skip because I only hear the end of the beat sometimes.

Below is dmesg, alsa-info and config used for 6.1.3.
dmesg.txt
alsa-info.txt
config.txt

Furthermore, in 6.1.3 alsamixer appears more "complete" with Master's knob and Headphone's switch and obviously no workaround was necessary for the autosuspend regression.

first second
alsamixer-one alsamixer-second

@codepayne
Copy link
Owner

@TomZanna On what distro and version did you test this kernel? I see you are using pipewire, can you tell me which version of pipewire?

@TomZanna
Copy link
Author

TomZanna commented Dec 7, 2023

It is the latest EndeavourOS, an Arch-based distro, with nothing more than Gnome and Firefox.
Pipewire is in version 1.0

@codepayne
Copy link
Owner

@TomZanna I reproduced it on my end, very weird, it's sped up and popping a lot. Might be caused by something on userspace end, because I can't reproduce it with the same kernel on popos. Maybe pipewire related? Will look into it

@DioEgizio
Copy link

@fernandosang I'm not familiar with Fedora distros. You could try to test the latest normal fedora release, and see if there they enable this option. If they do enable then I suppose there is nothing to worry about, when a new fedora release will happen with kernel 6.7 at least, you will have sound working automatically. If they don't enable even in normal versions of Fedora then there are two options:

* Raise a ticket to fedora team to also enable this kernel option in their distro

* Compile the fedora kernel yourself and enable this kernel option

They don't seem to have this enabled even in stable fedora. Maybe someone should report it to them

@andreaconsole
Copy link

andreaconsole commented Dec 15, 2023

Hi @codepayne , I've just installed 6.7rc5 on Ubuntu 23.10 (6.7.0-060700rc5-generic (64-bit); HUAWEI BOM-WXX9 M1010). I took a look at the wiki and at this page to configure alsamixer and run the command you suggested as root (echo -1 > /sys/bus/pci/drivers/snd_acp_pci/0000:03:00.5/power/autosuspend_delay_ms), but the pc is still silent. Any hints?
Attached
dmesg.txt
dmidecode.txt
Screenshot_20231215_155809
Screenshot_20231215_155735
Thanks a lot! Free beer for you when you come to Rome!

@fernandosang
Copy link

Has anyone tried 6.7 rc6? Can't stand Windows anymore lol

@TomZanna
Copy link
Author

TomZanna commented Dec 20, 2023

@fernandosang

Has anyone tried 6.7 rc6?

Nothing has changed. You need to apply the workaround or you can manually patch the kernel by cherry-picking this commit. (https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/commit/?id=c95a2a0be0b1bba2e051faa105c2e0401fc2de33)
Unfortunately the fix will be included from 6.8...

@codepayne
Copy link
Owner

@TomZanna I reproduced it on my end, very weird, it's sped up and popping a lot. Might be caused by something on userspace end, because I can't reproduce it with the same kernel on popos. Maybe pipewire related? Will look into it

@TomZanna can you confirm that on chromium it works ok? Without opening sound settings or any other sound applucations? Can you also test a media application like VLC?

@TomZanna
Copy link
Author

@codepayne Sorry but I just wiped everything to install Fedora and I don't have the audio working. Perhaps @fernandosang might be open to trying.

BTW, do I only need the CONFIG_SND_SOC_AMD_LEGACY_MACH flag or is there something else to enable from menuconfig?

@TomZanna
Copy link
Author

Ok, got the audio working by enabling a few random stuff regarding ES83xx or ACP via menuconfig. Now the idea is to understand what is actually needed and then open a MR to Fedora.

I confirm that Chromium and VLC works flawlessly.

@codepayne
Copy link
Owner

Hi @codepayne , I've just installed 6.7rc5 on Ubuntu 23.10 (6.7.0-060700rc5-generic (64-bit); HUAWEI BOM-WXX9 M1010). I took a look at the wiki and at this page to configure alsamixer and run the command you suggested as root (echo -1 > /sys/bus/pci/drivers/snd_acp_pci/0000:03:00.5/power/autosuspend_delay_ms), but the pc is still silent. Any hints? Attached dmesg.txt dmidecode.txt Screenshot_20231215_155809 Screenshot_20231215_155735 Thanks a lot! Free beer for you when you come to Rome!

@andreaconsole Can you open a new ticket, and attach new logs of dmesg and alsa-info (from a clean startup of the laptop)? Thanks for the free beer 👍

@iTrooz
Copy link

iTrooz commented Dec 24, 2023

Hi, I'm not sure what the state of this issue is, just wanted to say I have a Matebook D16 (Product HVY-WXX9 version M1010) running Archlinux, and I'm ready to test stuff if you want me to (I can compile kernels if needed, but not reinstall the OS)

@TomZanna
Copy link
Author

@codepayne

  • Raise a ticket to fedora team to also enable this kernel option in their distro

@DioEgizio

Maybe someone should report it to them

What a nice christmas gift, my merge request has just been accepted!
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2842

@TomZanna
Copy link
Author

I'm not sure what the status of this issue is

@codepayne Maybe we could close it, add the outcomes to the main README or the wiki, and open new issues to track the missing pieces? Like sped up audio and regression in the ACP controller

@ZaiiiRan
Copy link

Hello everyone, there is a problem. I did everything according to the instructions on the wiki and in this discussion. As a result: Alsamixer sees the sound card, but there are no working configurations in Pulseaudio. I can also say that my microphone does not work, only the speakers are silent. I am attaching all the screenshots. I am hope for your help)
Screenshot from 2023-12-27 19-52-08
Screenshot from 2023-12-27 19-52-34

@codepayne
Copy link
Owner

I'm not sure what the status of this issue is

@codepayne Maybe we could close it, add the outcomes to the main README or the wiki, and open new issues to track the missing pieces? Like sped up audio and regression in the ACP controller

I have nothing against it, if you would like open two new issues, and we will close this issue.
By the way I have created a bug ticket for pipewire: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3744

@codepayne
Copy link
Owner

Will be tracked in #29

@codepayne codepayne closed this as not planned Won't fix, can't repro, duplicate, stale Jan 5, 2024
@codepayne
Copy link
Owner

@TomZanna
The sped-up problem has been fixed.
https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3744

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants