AsahiLinux / asahi-audio

Userspace audio for Asahi Linux
MIT License
130 stars 12 forks source link

Weird Issue with speaker that refuse to activate themselve on boot Macbook Air M1 #29

Closed MadokaIII closed 7 months ago

MadokaIII commented 9 months ago

asahi-diagnose-20240108-095728.txt http://alsa-project.org/db/?f=8a29c8a638e811d0ab526aa19f4fc4b47e09948e

Hey guys I'd like to know if some of you know why the speakers refuse to activate themselves. It's been two weeks I discovered that you activated audio and i never managed to make it work i checked every single issue in here that barely mentioned a similar issue and i never got close to fixing it.

I always got the message "plateform sound : deferred probe pending" I don't remember exactly but i'm sure i saw something similar. AlsaMixer never found a soundcard, i tried modprobing the right stuff since they refused to do it by themselves on boot, looking back to it this was probably stupid and i'm glad i didn't destroy my speakers.

I installed every combinations of Alsa packages, asahi-plateform-metapackage, bankstown, lsp-plugins and asahi-audio etc.. on multiple instances of new installations, I read the doc inside out from both asahi linux feature support and the README here. I can't understand why it won't work. I sure hope I'm not making a fool of myself. Everyone here seemed to have made it work, I thought I could and here we are two weeks later and I finally decided to yield.

I hope you guys can figure it out, cause I have no clue.

Thanks for your help in advance.

MadokaIII commented 8 months ago

Update : Alsa don't seem to detect the sound cards, I've read more on the issue and that's what I think is happening. Since on boot nothing gets updated in /proc/asound/cards where speakersafetyd checks to activate the right card. but the lsmod shows that everything needed for the soundcards is "on". lsmod.txt

karlskewes commented 7 months ago

I run NixOS with https://github.com/tpwrules/nixos-apple-silicon rather than Fedora so slightly different.

We have to provide firmware files (copied out of MacOS by the installer) which get loaded at boot. When I don't provide the firmware files, various devices are not present (e.g: soundcard, wifi, etc). I wonder if something went wrong during the installer phase for you?

What output do you get from dmesg? mine below:

$ dmesg | grep cs42l83
[    1.333922] cs42l83 1-0048: supply VA not found, using dummy regulator
[    1.339842] cs42l83 1-0048: supply VP not found, using dummy regulator
[    1.345527] cs42l83 1-0048: supply VCP not found, using dummy regulator
[    1.348417] cs42l83 1-0048: supply VD_FILT not found, using dummy regulator
[    1.348933] cs42l83 1-0048: supply VL not found, using dummy regulator
[    1.358827] cs42l83 1-0048: Cirrus Logic CS42L83, Revision: B0

For what it's worth I seem to have the sound card present, but my speakers are currently not working (have worked on/off per linked issue).

MadokaIII commented 7 months ago

I've uninstalled asahi linux cause I broke it trying to fix it so I'll get back to you as soon as I've finished installing it. But I remember specifically launching asahi-fwupdate which would've updated the firmware no ? I'm not sure if that's what you mean. Either way, THANK YOU SO MUCH for posting here I love the distro and I'm very sad to not be able use the speakers. Especially since this issue has been gathering dust for so long...

karlskewes commented 7 months ago

You're welcome. Early days, still a few kinks and lots of combinations. Agree it is an amazing project.

I haven't used asahi-fwupdate. Might be a difference between Fedora and NixOS.

MadokaIII commented 7 months ago
daoudlamalmi@fedora:~$ dmesg | grep cs4
[    3.800466] cs42l83 2-0048: supply VA not found, using dummy regulator
[    3.800485] cs42l83 2-0048: supply VP not found, using dummy regulator
[    3.800490] cs42l83 2-0048: supply VCP not found, using dummy regulator
[    3.800494] cs42l83 2-0048: supply VD_FILT not found, using dummy regulator
[    3.800500] cs42l83 2-0048: supply VL not found, using dummy regulator
[    3.812910] cs42l83 2-0048: Failed to read device ID: -6

You are right i got the same thing, my god thank you so much now we can investigate the same issue. Btw i don't know how to make "quotes" from command output if you could tell me (on github i mean)

karlskewes commented 7 months ago

Did you re-install fresh?

Interesting dmesg result. The last line is different:

[ 3.812910] cs42l83 2-0048: Failed to read device ID: -6

Btw i don't know how to make "quotes" from command output if you could tell me (on github i mean)

Here you go :) https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks

MadokaIII commented 7 months ago

Yes, this is from the first boot right after a clean reinstall. Also, yes this isn't the same issue, I was so excited I forgot to actually check if it was the same. Any Idea on what to do next ?

MadokaIII commented 7 months ago

Ok, I did some research on the chip (more like googled it) and I'm even more confused now, like it's a chip (if I understood correctly) linked to the handling of jack audio. Why would this affect my speakers ? Also, I'm wondering how it's even possible for the chip to be missing some firmware files (due to the installation failing by your speculations) ? Meanwhile I've been installing and wiping my mac for weeks on end and it never worked I went as far as to wipe my SSD and reinstall MacOs and even diagnose the whole PC with Apple Scanner in the (sort of) UEFI. Your message leaves me with even more confusion than before thought I'm glad you found the actual error message. Again thanks for your help. But I'm starting to get this uneasy feeling that we'll need Chadmed or Marcan to fix this xD. PS : Thinking about it now I think (again spit-balling here) that it would make sense for the driver to see the missing firmware from one chip and instead of risking to explode the speakers, it would refuse to go further in the activation process. Which again makes sense, this computer is expensive enough.

karlskewes commented 7 months ago

I don't really know. When you plug headphones into the 3.5mm jack, a working setup will show plug/unplug events in dmesg. Plugging in headphones also switches output from speaker to headphones, and vice versa when unplug. I don't know how this actually works in hardware/software, but I believe that is the link between the two.

When I get time I'll try asking in the IRC channels too: https://asahilinux.org/community/

MadokaIII commented 7 months ago

Hey, First, I'd like to apologize for disappearing like that, but in the meantime I just did what you asked I plugged in a wired headset and nothing literally nothing happens... This is weird I didn't even know my jack audio was broken. I tried to boot with the jack plugged in but it's the exact same messages. My theory : the cs42l83 chip is just missing the firmware which locks jack and by cascading it also locks speakersafety as alsa needs the log "plateform sound : 'card name' detected" but since cs42l83 is broken the alsa driver refuses to wake up giving us "deferred probe pending" which means no sound card detected which means speakersafetyd will never wake up without failing to read a soundcard. This would explain sort of everything and give a clear path to "fix" it (again all this info is just a newbie speculating it wil probably be way harder to acually find out what's going on i'm not denying the hardwork that'll have to be done behind the scenes) This would explain why the bluetooth has no issues as well the firmware for the sound is in my headset. I really hope this helps you guys @chadmed . I truly think we found the root cause. In hope of hearing from you guys soon, keep up the good work your dedication to this project is amazing.

MadokaIII commented 7 months ago

And of course, if you need me to test new things don't hesitate to ask, I'm here for it, I'm sort of finishing up a bachelor's degree in computer science and I plan on specializing in systems programming. So yeah, if you need specific logs or for me to tinker with files just ask I'll be glad I helped you guys fix this for everyone.

MadokaIII commented 7 months ago

Nevermind I was wrong, my chip "cs42l83" is most likely dead I never use jack on my MacBook on MacOs cause I don't like having a cable but hey what do you know it wasn't working for the longest time apparently. And since I never use it, I would've never known.... I'm getting back to you guys after checking in with the customer service dw I won't be ruined I had taken the Apple Care +.

MadokaIII commented 7 months ago

They confirmed that the chip is dead. I'll be receiving the mac with the parts swapped Tuesday, I'll keep you guys in touch and if it's fixed after that I'll close this issue. Thanks for the help. I'd like to point out that perhaps ALSA shouldn't just refuse to detect a sound card if the jack chip ain't detected like macos does this seemlessly I'm not sure why asahi wouldn't.

chadmed commented 7 months ago

If the headset codec is dead, it's probably causing a probing failure in the macaudio driver as the "sound card" is in extremely simplified terms a virtual device that pulls together the various hardware components required for sound output.

I don't think it's something we're looking to change any time soon.

MadokaIII commented 7 months ago

And it's done, it was a harware issue (more like a skill issue on MacOs' part for literally never notifying me of this even after a diagnosis...). To whomever that will eventually get the same issue as me, I must tell you this : "You never blame the hardware until you can't blame anything else". The chip was apparently dead they swapped it out, so there's no fix.

$ dmesg | grep sound
[    4.263050] input: MacBook Air J313 Headphone Jack as /devices/platform/sound/sound/card0/input3
[    5.187247] snd-soc-macaudio sound: Speaker volumes unlocked

I found this in my kernel log and the speakers sound so good so yeah everything works. I'd like to thank the Asahi Team for their hard work, the quality is truly here. And thank you @karlskewes for reviving the issue with your comment, you put me on the right track.