codepayne / linux-sound-huawei

linux kernel for Huawei matebook AMD sound support
Other
87 stars 3 forks source link

No sound on 6.7rc5 and Matebook AMD (HUAWEI BOM-WXX9 M1010) #28

Open andreaconsole opened 8 months ago

andreaconsole commented 8 months ago

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? Thanks a lot! Free beer for you when you come to Rome!

Attached Screenshot_20231215_155809 Screenshot_20231215_155735 dmesg.txt http://alsa-project.org/db/?f=bb9c6b623e1b0015506f194ec7f76783cc7120b0

andreaconsole commented 8 months ago

@codepayne I made a mistake while applying the workaround (wrong command)

edit: no clicks and speed ok on vlc and on youtube (firefox). The headphones do not work, but I will perform further tests to be sure edit2: ok, the problem was with the headphones I tried (they have a four pin jack as they include the microphone). However, headphones and speakers seems both active when the jack is in.

PS: Which was the problem? May I expect to find an usable official kernel in the near future? Can I use the kernel you kindly compiled for me for "production"?

fernandosang commented 8 months ago

@codepayne So I used the latest kernel you shared here and after playing a bit with alsamixer, I got the mic and everything else to work. Basically, everything's fine now. Thanks a lot! There's only one thing I'm struggling with and that's general volume. It's loud and clear enough, but with speakers or headphones, audio below 25% is practically muted. Meaning, 0 to 100 is not 0% to 100%, but more like 25% (0) to 100% (100).

Makes sense? Any idea what to do?

Again, thanks a lot. I'm very happy to be able to finally use linux.

fernandosang commented 8 months ago

lol pop noises are back :(

saber716rus commented 8 months ago

A new output device is available now, and it works!!! This is the configuration that works: Screenshot_20240104_231145

Pavucontrol: Screenshot_20240104_225943 Screenshot_20240104_230143 Screenshot_20240104_230218 Screenshot_20240104_230306

Play it back, what did you do? The kernel has been updated, the workaround is also normal.

andreaconsole commented 8 months ago

Ask @codepayne , not me. I just installed the custom modified kernel (derived from rc8) he kindly compiled for me. I thank him from the bottom of my heart for the harsh commitment he took in investigating my particular issue.

saber716rus commented 8 months ago

Ask @codepayne , not me. I just installed the custom modified kernel (derived from rc8) he kindly compiled for me. I thank him from the bottom of my heart for the harsh commitment he took in investigating my particular issue.

Understood. @codepayne What changes did you make to the kernel?

fernandosang commented 8 months ago

Can I please get some help with the pop noises? It's driving me crazy and I have no idea how to approach it.

I think the kernel compiled by codepayne for andreaconsole fixed it for me, but then I screwed something up by changing to 6.7rc8 generic. I did this because the kernel compiled by codepayne didn't have linux-headers so I couldn't install the virtual camera driver stuff to set up OBS.

@codepayne how can I get linux-headers for that kernel? Please. Or what do you recommend I do?

andreaconsole commented 8 months ago

I tried a different pair of earphones, this time one with a three pin jack. When I put the connector all in, the video enters an endless play-stop loop. If I take the connector a little out, I get audio both from the speakers and the earphones. Has anyone ever experienced similar issues?

codepayne commented 8 months ago

@andreaconsole

edit: no clicks and speed ok on vlc and on youtube (firefox). The headphones do not work, but I will perform further tests to be sure edit2: ok, the problem was with the headphones I tried (they have a four pin jack as they include the microphone). However, headphones and speakers seems both active when the jack is in.

Headphones should work, you have to always use the "Play and record HiFi quality Music" configuration in Configuration tab in pavucontrol. Also the internal mic and the mic from a Headphone should also work. Please test and tell me if the speakers/headphones and internal/headphone mic work.

PS: Which was the problem? May I expect to find an usable official kernel in the near future? Can I use the kernel you kindly compiled for me for "production"?

The issue is in the codec driver and the fix needs to be sent to upstream kernel. Eventually it will reach all kernels and distros, can't say when that will happen.

All laptops with this DMI info are affected: HUAWEI BOM-WXX9 M1010 This specific model has a 48Mhz crystal oscillator tied to the ES8336 codec, which is unusual and different to all other models that have a 12.288Mhz crystal.

The kernel I provided is filled with debug info and probably has worse performance than a normal one. I will provide a normal one with all debug stuff disabled.

andreaconsole commented 8 months ago

The microphones work, both the internal one and the one from the headphone. But no sound from the headphone (when full plugged in, as it should be), even if they are properly recognized as connected. Additionally, if I take out and back in the jack during video reproduction, I get the weird start/pause loop I mentioned above image

codepayne commented 8 months ago

@andreaconsole @saber716rus

So the final steps to get everything almost working are:

Install the last kernel I provided here https://github.com/codepayne/linux-sound-huawei/issues/28#issuecomment-1877799093

If you have already my custom kernel installed, uninstall it:

sudo apt remove linux-image-6.7.0-rc8-alsa-debug

Install the latest kernel:

sudo dpkg -i linux-image-6.7.0-rc8-alsa-debug_6.7.0-rc8-29_amd64.deb

Disable auto-suspend of the device, follow instructions here: https://github.com/codepayne/linux-sound-huawei/issues/26#issuecomment-1837502247

Install alsa-ucm stuff, follow instructions here: https://github.com/codepayne/linux-sound-huawei/issues/28#issuecomment-1872557880 and https://github.com/codepayne/linux-sound-huawei/issues/28#issuecomment-1872562505

Make sure to enable pipewire and wireplumber and disable pipewire logs by commenting out log.level = 5, more details here: https://github.com/codepayne/linux-sound-huawei/issues/28#issuecomment-1872571237

Uninstall my custom alsa lib if you ever installed it, and disable debug logs, more info here: https://github.com/codepayne/linux-sound-huawei/issues/28#issuecomment-1873489056

codepayne commented 8 months ago

The microphones work, both the internal one and the one from the headphone. But no sound from the headphone (when full plugged in, as it should be), even if they are properly recognized as connected image

@andreaconsole As I said use the "Play and record HiFi quality Music" profile, do not use the Pro Audio one ever.

andreaconsole commented 8 months ago

Look at the second row, the one enabled

codepayne commented 8 months ago

sorry, just noticed that pro audio is only enabled for hdmi output.

fernandosang commented 8 months ago

Can I please get some help with the pop noises? It's driving me crazy and I have no idea how to approach it.

I think the kernel compiled by codepayne for andreaconsole fixed it for me, but then I screwed something up by changing to 6.7rc8 generic. I did this because the kernel compiled by codepayne didn't have linux-headers so I couldn't install the virtual camera driver stuff to set up OBS.

@codepayne how can I get linux-headers for that kernel? Please. Or what do you recommend I do?

@codepayne Bro, please stop ignoring me lol

codepayne commented 8 months ago

I don't know what to say, look at the alsamixer knobs, work with some of the knobs, one of them should enable headphones. You could also restore alsa knobs to default, maybe you disabled something important:

alsaucm -c acp3x-es83xx reload && sudo alsactl restore -P && alsactl init
systemctl --user --now restart pipewire.service pipewire.socket pipewire-pulse.service pipewire-pulse.socket wireplumber.service
fernandosang commented 8 months ago

I don't know what to say, look at the alsamixer knobs, work with some of the knobs, one of them should enable headphones. You could also restore alsa knobs to default, maybe you disabled something important:

alsaucm -c acp3x-es83xx reload && sudo alsactl restore -P && alsactl init
systemctl --user --now restart pipewire.service pipewire.socket pipewire-pulse.service pipewire-pulse.socket wireplumber.service

How do I get the linux-headers for the kernel you compiled? I need them so I can enable virtual camera stuff.

codepayne commented 8 months ago

Can I please get some help with the pop noises? It's driving me crazy and I have no idea how to approach it. I think the kernel compiled by codepayne for andreaconsole fixed it for me, but then I screwed something up by changing to 6.7rc8 generic. I did this because the kernel compiled by codepayne didn't have linux-headers so I couldn't install the virtual camera driver stuff to set up OBS. @codepayne how can I get linux-headers for that kernel? Please. Or what do you recommend I do?

@codepayne Bro, please stop ignoring me lol

I'm not ignoring you, I don't have the time to work on everything, I do have a job, family and errands to run. Your problem is not related to this issue. This kernel doesn't fix anything for you, since you have a different model and already have sound. You can use the normal rc kernels.

The sped-up and popping is caused by pipewire. To fix this you need to use an older pipewire version or build pipewire yourself and revert a certain commit and install your self built pipewire on your system. More details here: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3744

Also install the alsa-ucm stuff I mentioned earlier.

saber716rus commented 8 months ago

@andreaconsole @saber716rus

So the final steps to get everything almost working are:

Install the last kernel I provided here #28 (comment)

If you have already my custom kernel installed, uninstall it:

sudo apt remove linux-image-6.7.0-rc8-alsa-debug

Install the latest kernel:

sudo dpkg -i linux-image-6.7.0-rc8-alsa-debug_6.7.0-rc8-29_amd64.deb

Disable auto-suspend of the device, follow instructions here: #26 (comment)

Install alsa-ucm stuff, follow instructions here: #28 (comment) and #28 (comment)

Make sure to enable pipewire and wireplumber and disable pipewire logs by commenting out log.level = 5, more details here: #28 (comment)

Uninstall my custom alsa lib if you ever installed it, and disable debug logs, more info here: #28 (comment)

I've already figured it out, done it, and checked it out. I noticed a large delay when changing the volume level in the settings and its sound level from the speakers.

andreaconsole commented 8 months ago

I don't know what to say, look at the alsamixer knobs, work with some of the knobs, one of them should enable headphones. You could also restore alsa knobs to default, maybe you disabled something important:

alsaucm -c acp3x-es83xx reload && sudo alsactl restore -P && alsactl init
systemctl --user --now restart pipewire.service pipewire.socket pipewire-pulse.service pipewire-pulse.socket wireplumber.service

Yes, this makes sense. Do you confirm that, to set the right configuration, I can restore default and the follow these instructions from your wiki?

In the playback tab change to maximum value the following knobs: Master, Headphone Mixer, DAC

Enable the following knobs: Left Headphone Mixer Left DAC, Right Headphone Mixer Right DAC After doing these changes you should be hearing the sound.

If you want to have the headset microphone work, you have to change once the settings in alsamixer in the capture tab to maximum value: Headphone Mixer, ADC

fernandosang commented 8 months ago

Can I please get some help with the pop noises? It's driving me crazy and I have no idea how to approach it. I think the kernel compiled by codepayne for andreaconsole fixed it for me, but then I screwed something up by changing to 6.7rc8 generic. I did this because the kernel compiled by codepayne didn't have linux-headers so I couldn't install the virtual camera driver stuff to set up OBS. @codepayne how can I get linux-headers for that kernel? Please. Or what do you recommend I do?

@codepayne Bro, please stop ignoring me lol

I'm not ignoring you, I don't have the time to work on everything, I do have a job, family and errands to run. Your problem is not related to this issue. This kernel doesn't fix anything for you, since you have a different model and already have sound. You can use the normal rc kernels.

The sped-up and popping is caused by pipewire. To fix this you need to use an older pipewire version or build pipewire yourself and revert a certain commit and install your self built pipewire on your system. More details here: https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/3744

Also install the alsa-ucm stuff I mentioned earlier.

Sorry, I didn't mean that in a bad way. I was just joking.

I already followed all steps mentioned here. And as I said, I got it working just fine, but when I started messing up with the headers stuff, it broke again. I even have alsa-ucm stuff installed. The only issue now is the pop sounds; audio isn't sped up or anything.

I'll make a fresh install and see if it works again. Sorry to bother and thank you for your work.

codepayne commented 8 months ago

@andreaconsole @saber716rus So the final steps to get everything almost working are: Install the last kernel I provided here #28 (comment) If you have already my custom kernel installed, uninstall it:

sudo apt remove linux-image-6.7.0-rc8-alsa-debug

Install the latest kernel:

sudo dpkg -i linux-image-6.7.0-rc8-alsa-debug_6.7.0-rc8-29_amd64.deb

Disable auto-suspend of the device, follow instructions here: #26 (comment) Install alsa-ucm stuff, follow instructions here: #28 (comment) and #28 (comment) Make sure to enable pipewire and wireplumber and disable pipewire logs by commenting out log.level = 5, more details here: #28 (comment) Uninstall my custom alsa lib if you ever installed it, and disable debug logs, more info here: #28 (comment)

I've already figured it out, done it, and checked it out. I noticed a large delay when changing the volume level in the settings and its sound level from the speakers.

Might be caused by the kernel debug stuff slowing down the system, or pipewire logs slowing pipewire down. Check that you have disabled all logs and wait for the normal kernel.

codepayne commented 8 months ago

I don't know what to say, look at the alsamixer knobs, work with some of the knobs, one of them should enable headphones. You could also restore alsa knobs to default, maybe you disabled something important:

alsaucm -c acp3x-es83xx reload && sudo alsactl restore -P && alsactl init
systemctl --user --now restart pipewire.service pipewire.socket pipewire-pulse.service pipewire-pulse.socket wireplumber.service

Yes, this makes sense. Do you confirm that, to set the right configuration, I can restore default and the follow these instructions from your wiki?

In the playback tab change to maximum value the following knobs: Master, Headphone Mixer, DAC

Enable the following knobs: Left Headphone Mixer Left DAC, Right Headphone Mixer Right DAC After doing these changes you should be hearing the sound.

If you want to have the headset microphone work, you have to change once the settings in alsamixer in the capture tab to maximum value: Headphone Mixer, ADC

You don't need to mess with alsamixer directly anymore if you have alsa-ucm isntalled, just resetting to default should set everything to the right settings.

codepayne commented 8 months ago

I already followed all steps mentioned here. And as I said, I got it working just fine, but when I started messing up with the headers stuff, it broke again. I even have alsa-ucm stuff installed. The only issue now is the pop sounds; audio isn't sped up or anything.

I only ever noticed popping in conjunction with the sped-up, and you previously mentioned that you had sound sped-up. If that is not the case, open a separate ticket for your problem, and add some logs from the kernel, alsactl info, dmidecode, pipewire version, distro version and we will see.

andreaconsole commented 8 months ago

ok, I tried resetting to default but headphones are still silent. This is alsamixer with headphones plugged in: image image

codepayne commented 8 months ago

@andreaconsole I prepared the final kernel and headers deb packages here. Can you test them and see if it works?

https://filebin.net/yx8ox5kucy8danwx

6ca9defb296eef338aba6444f80ff0c2a0aadb460ca43ab672bbdd73fcbb2be720c281f3b407c31165e8236427e74503fdc28dc4e1ac024053a5d604faa74751  kernel-codec-fix.zip
saber716rus commented 8 months ago

@andreaconsole I prepared the final kernel and headers deb packages here. Can you test them and see if it works?

https://filebin.net/yx8ox5kucy8danwx

6ca9defb296eef338aba6444f80ff0c2a0aadb460ca43ab672bbdd73fcbb2be720c281f3b407c31165e8236427e74503fdc28dc4e1ac024053a5d604faa74751  kernel-codec-fix.zip

hi. What changes did you make to the original kernel to build your own?

andreaconsole commented 8 months ago

Hi @codepayne , I am using the new kernel now. The audio is perfect (no noticeable pops or delays during normal operations; some pops on stat-up). The test kernel had a minor issue with the volume setting (the output lagged a little behind when adjusting the volume) which seems now fixed. I may assume it was related to the time spent to collect logs. The earphones are still silent whatever I do with alsamixer and the system mixer, which is not a big issue for me (I have an external audio card I can use with earphones). I'll never thank you enough.

DioEgizio commented 8 months ago

for the upstreaming part, is there hope to bring the fix to 6.7.x or do we have to wait for the next kernel major version?

codepayne commented 7 months ago

@saber716rus Do headphones don't work for you also as they don't work for @andreaconsole ?

codepayne commented 7 months ago

for the upstreaming part, is there hope to bring the fix to 6.7.x or do we have to wait for the next kernel major version?

I don't know, probably it won't be picked up for 6.7. But this only affects a certain line of laptops, HUAWEI BOM-WXX9 M1010.

saber716rus commented 7 months ago

for the upstreaming part, is there hope to bring the fix to 6.7.x or do we have to wait for the next kernel major version?

I don't know, probably it won't be picked up for 6.7. But this only affects a certain line of laptops, HUAWEI BOM-WXX9 M1010.

@codepayne Still, I wonder what you were doing with the core? What other parameters did you collect? Can you provide a patch?

DioEgizio commented 7 months ago

for the upstreaming part, is there hope to bring the fix to 6.7.x or do we have to wait for the next kernel major version?

I don't know, probably it won't be picked up for 6.7. But this only affects a certain line of laptops, HUAWEI BOM-WXX9 M1010.

I still hope it can be upstreamed soon or at least a patch cuz I would want my audio to work but I'm on fedora and you only provided a deb for ubuntu

saber716rus commented 7 months ago

for the upstreaming part, is there hope to bring the fix to 6.7.x or do we have to wait for the next kernel major version?

I don't know, probably it won't be picked up for 6.7. But this only affects a certain line of laptops, HUAWEI BOM-WXX9 M1010.

I still hope it can be upstreamed soon or at least a patch cuz I would want my audio to work but I'm on fedora and you only provided a deb for ubuntu

in the near future, it is unlikely to expect a patch in the lts core. And I asked @codepayne. what changes did I make to the core to make the sound work on my hardware.

codepayne commented 7 months ago

treamed soon or at least a patch cuz I would want my audio to work but I'm on fedora and you only provided a deb for ubuntu

Here is the patch: patch.zip

DioEgizio commented 7 months ago

treamed soon or at least a patch cuz I would want my audio to work but I'm on fedora and you only provided a deb for ubuntu

Here is the patch: patch.zip

tysm, I compiled a custom fedora kernel based on the 6.7 kernel with that patch and now audio works

DioEgizio commented 7 months ago

i can confirm headphones don't work for me either. It's not a big deal for me since i use bluetooth earphones but still

hakanrw commented 7 months ago

Mr. Postevca, I thank you once again, from the bottom of my heart, for your valuable contribution to the linux kernel.

Since last year, I have been using the custom kernel compiled from the source at branch bom-wxx9-mclk (I have a HUAWEI BOM-WXX9 device), and it worked with no issues for a long time, until some later pipewire version introduced a sound glitching bug

The older kernel that sound worked was 6.1.3 and getting outdated, so I checked your repository again to see if there were any updates. To my surprise, there is a lot of news. I am happy that your changes are making it to the upstream kernel.

I followed the steps provided in this thread.

At first, pavucontrol showed dummy output, so i installed your alsa zip and moved /ucm and /ucm2 to /usr/share/alsa. After this step, pavucontrol showed an output device like normal.

image

However, there was still no sound. I inspected @andreaconsole's pipewire output and we both had the following line: spa.alsa: Broken configuration: no configurations available: Invalid argument

For the rest of the thread, I and andreaconsole had the exact same issues and I followed his steps. Next step for me is obtaining/compiling the newer kernel with your patch. I am confident it will work.

I will provide updates after I am done with replacing the kernel. Thank you for your extremely valuable effort and contribution. I wish you great health for you and your family in 2024.

codepayne commented 7 months ago

@hakanrw Hello, The output device you see is not the internal sound card. You have to to see something like ACP or Audio Processor, check the screenshots in this thread. It seems that the driver didn't load for you.

codepayne commented 7 months ago

i can confirm headphones don't work for me either. It's not a big deal for me since i use bluetooth earphones but still

Weird, regarding the jack operation there shouldn't be anything different between these laptop models. On my laptop it works ok. Will have to think about it.

hakanrw commented 7 months ago

@hakanrw Hello, The output device you see is not the internal sound card. You have to to see something like ACP or Audio Processor, check the screenshots in this thread. It seems that the driver didn't load for you.

That is interesting, I can see the driver on alsamixer, it also shows ACP/ACP3X Audio Coprocessor on input devices tab.

saber716rus commented 7 months ago

@codepayne Greetings. On alt linux p10 (stable repository), the sound works on the 6.1.74 kernel. it turns out very interesting. the sound is not distorted and everything is fine. alsa-info.log https://packages.altlinux.org/ru/sisyphus/srpms/kernel-image-un-def/ saber716rus@taiwan7messy ~> rpm -qa | grep alsa alsa-plugins-pulse-1.2.7.1-alt1.x86_64 alsa-ucm-conf-1.2.8-alt8.noarch alsa-topology-conf-1.2.5.1-alt1.noarch libalsa-1.2.8-alt1.x86_64 firmware-alsa-sof-2.2.5-alt1.noarch alsa-set-initial-options-1.3-alt1.noarch alsa-utils-1.2.8-alt1.x86_64 saber716rus@taiwan7messy ~>

codepayne commented 7 months ago

@saber716rus

Ok, so what is the question?

saber716rus commented 7 months ago

@saber716rus

Ok, so what is the question?

I decided to see what the alt linux command did that works on kernel 6.1. I thought maybe you'd be interested too.

DioEgizio commented 7 months ago

any updates on upstreaming this patch?

viniciusym commented 7 months ago

Hi @codepayne, I installed the patch you provided and followed the instructions you gave. The speakers work fine, but headphones only work when the plug is halfway in, and the speakers work simultaneously with headphones. When the plug is properly connected, the speakers are muted, as they should be, but I get no sound from the headphones. Thanks in advance for your assistance!

codepayne commented 6 months ago

@viniciusym what model do you have?

codepayne commented 6 months ago

any updates on upstreaming this patch?

No, not upstreamed yet.

j24u commented 6 months ago

@andreaconsole I prepared the final kernel and headers deb packages here. Can you test them and see if it works?

https://filebin.net/yx8ox5kucy8danwx

6ca9defb296eef338aba6444f80ff0c2a0aadb460ca43ab672bbdd73fcbb2be720c281f3b407c31165e8236427e74503fdc28dc4e1ac024053a5d604faa74751  kernel-codec-fix.zip

Hi @codepayne, can you provide a link of the kernel and headers deb again becuase the link has expired.

viniciusym commented 6 months ago

@viniciusym what model do you have?

Product Name: BOM-WXX9
Version: M1010