cb-linux / breath

Linux for Chromebooks
https://cb-linux.github.io/breath/
MIT License
301 stars 55 forks source link

No audio on Lenovo 100e (1st gen) #251

Open thunderdiesel opened 2 years ago

thunderdiesel commented 2 years ago

I have a Lenovo 100e, it is an apollo lake device. I downloaded and built commit 0de0690 on crostini. After booting everything seemed to work. I ran the apl-sof-setup-audio and rebooted when it completed. Only the dummy output device is shown and this error message is in dmesg: sof-audio-pci-intel-apl 0000:00:0e.0: warn: FW ABI is more recent than kernel

Here is my alsa info: http://alsa-project.org/db/?f=308cc032c231f3fe8588dd1f573b4a1462b05233

Here is the dmesg: https://pastebin.com/rehQNrmd

And the lsmod: https://pastebin.com/ftz426Gf

MilkyDeveloper commented 2 years ago

I believe this is because of Pipewire. What does:

systemctl mask —user pipewire
systemctl mask —user pipewire.socket

do after a reboot? Any alsa-info changes?

thunderdiesel commented 2 years ago

Still only showing the dummy device in the pulse volume control. The alsa info shows the same card both before and after disabling pipewire:

0 [sofbxtda7219max]: sof-bxtda7219ma - sof-bxtda7219max Google-Coral-rev3

Here is the new alsa-info: http://alsa-project.org/db/?f=14e6d9b9cdc44741c6639641785a67b586fb96c8

MilkyDeveloper commented 2 years ago

From ChromeOS (not Crostini):

sudo rm /var/lib/asound*; alsactl store; sudo cp -v /var/lib/alsa/asound* ~/Downloads

Copy those files from ChromeOS’s downloads folder and put them in /etc/asound.conf in Breath.

thunderdiesel commented 2 years ago

There isn’t an /var/lib/alsa directory on chrome is. It looks like it is using an service in between alsa and the actual hardware. It’s called CRAS, Chromium OS Audio Server. The alsa config just has that in it.

MilkyDeveloper commented 2 years ago

I know about CRAS, but I believe the ALSA state is still saved somewhere within the rootfs. By state, I mean the settings ChromeOS’s working audio has for the mixer.

Does alsactl store have any indication of where the .state or .conf was saved?

Maybe strace/trace (IIRC one of them was on ChromeOS) could help?

royalroot commented 2 years ago

I have the same problem and I tried the above command, but alsactl is not installed. See output below:

chronos@localhost / $ sudo rm /var/lib/asound*; alsactl store; sudo cp -v /var/lib/alsa/asound* ~/Downloads
rm: cannot remove '/var/lib/asound*': No such file or directory
bash: alsactl: command not found
cp: cannot stat '/var/lib/alsa/asound*': No such file or directory

But theres a asound.conf in /etc:

chronos@localhost / $ sudo find / | grep asound.conf
find: '/proc/285/task/285/net': Invalid argument
find: '/proc/285/net': Invalid argument
/etc/asound.conf
chronos@localhost / $ cat /etc/asound.conf 
#Route all audio through the CRAS plugin.
pcm.!default {
        type cras
}
ctl.!default {
        type cras
}

maybe this helps...

thunderdiesel commented 2 years ago

I did find alsactl under /usr/sbin but when you try to store, it gives you an error about /var/lib/alsa not existing.

royalroot commented 2 years ago

I did find alsactl under /usr/sbin but when you try to store, it gives you an error about /var/lib/alsa not existing.

Thank you. This helped me. If you try for example sudo /usr/sbin/alsactl store -f /home/chronos/user/Downloads/asound.conf (-f gives you the optioln to store the file on other location)

thunderdiesel commented 2 years ago

Progress! When I moved over the asound.state file AND disabled pulse audio the sound works. I’m not sure if just disabling pulse would have worked.

In alsa mixer the master volume seems to be stuck at 100% you can move it, although you can move other sliders.

I backed up the old asound.state so I’ll see if that works better volume control wise(if it works at all).

royalroot commented 2 years ago

How do you disabled pulseaudio?

thunderdiesel commented 2 years ago

systemctl —user mask pulseaudio.service systemctl —user mask pulseaudio.socket and reboot. Although you might just be able to ‘stop’ the service without rebooting and have alsa work, I don’t know.

royalroot commented 2 years ago

Thanks. Yes this works without restarting.

For me it works to adjust the master volume with alsamixer.

But why the hell is pulseaudio not working. But it`s kind of okay for now. I rarely have sound enabled and most of the time i use bluetooth.

P.S.: As the sound worked in an earlier build I had the problem to adjust the sound level. The max volume was way to high for the speakers. This can be a side effect of an earlier kernel update... So for now my resume is never touch a running kernel ;)

royalroot commented 2 years ago

It's working now. You have to configure pulseaudio manually to get it running.

First I created a .asoundrc in my home directory (mabye you can use /etc/asound.conf as well i dont know). Replace sofbxtda7219max with the output of cat /proc/asound/cards.

You can reboot and try if it work without configuring the pulseaudio part. Or you go on...

nico@chromebook:~$ cat .asoundrc 
pcm.sofbxtda7219max {
        type hw
        card 0
        device 0
}

ctl.sofbxtda7219max {
        type hw
        card 0
        device 0
}

pcm.pulse {
   type pulse
}
ctl.pulse {
   type pulse
}

Next step (if the above is not working): Add the following lines to /etc/pulse/system.pa

load-module module-alsa-sink device=hw:0
load-module module-alsa-source device=hw:0

Then add this lines to /etc/pulse/default.pa

load-module module-alsa-sink device=hw:0
load-module module-alsa-source device=hw:0

Hope it works for you.

(if you understand german this can help you as well: https://www.linux-bibel-oesterreich.at/viewtopic.php?t=576)

thunderdiesel commented 2 years ago

I got it working with pulse!

The trick was to put in those two lines in the two files in /etc/pulse that @nicro87 mentioned above. I tried the edit to .asoundrc (Actually I put it in /etc/asound.conf) and it make alsa stop detecting the card until I redid the apl-sof-setup-audio.

royalroot commented 2 years ago

I got it working with pulse!

The trick was to put in those two lines in the two files in /etc/pulse that @nicro87 mentioned above. I tried the edit to .asoundrc (Actually I put it in /etc/asound.conf) and it make alsa stop detecting the card until I redid the apl-sof-setup-audio.

oh sorry for pointing you in the wrong direction. for me it worked (with .asoundrc). but later on i figured out that a had to restart pulseaudio after every reboot. i'll try it without .asoundrc. thank you for testing this out.

thunderdiesel commented 2 years ago

No big deal, we were both trying to figure it out. So at least as far as the 1st gen 100e is concerned the steps are (on ubuntu 22.04):

  1. (Maybe) Disable Pipewire: systemctl mask —user pipewire systemctl mask —user pipewire.socket

  2. Move alsa state from ChromeOS to Breath, this will make sound work with ALSA if Pulse is disabled: sudo /usr/sbin/alsactl store -f /home/<whatever>/user/Downloads/asound.conf on ChromeOS Put that file in /var/lib/alsa/asound.state in Breath, might want to backup the existing asound.state first.

  3. Put these in both /etc/pulse/system.pa and /etc/pulse/default.pa and then restart pulse. load-module module-alsa-sink device=hw:0 load-module module-alsa-source device=hw:0

Not sure if I missed anything in those steps.