thesofproject / linux

Linux kernel source tree
Other
90 stars 129 forks source link

[BUG] No sound after fresh install of voidlinux #5097

Closed lambda2501 closed 2 months ago

lambda2501 commented 3 months ago

Describe the bug No sound at all after a fresh install of VoidLinux, and sof-firmware from xbps repositories.

VoidLinux version : 2024-03-14 Kernel : Linux 6.6.35_1 x86_64 SoF firmware package : sof-firmware-2023.12.1_1 Result of lspci : 0000:00:1f.3 Multimedia audio controller: Intel Corporation Alder Lake Smart Sound Sound Technology Audio Controller (rev 01) Result of aplay -l :

**** Liste des périphériques matériels PLAYBACK ****
carte 0 : sofsoundwire [sof-soundwire], périphérique 2 : Speaker (*) []
   Sous-périphérique : 1/1
   Sous-périphérique #0 : subdevice #0
carte 0 : sofsoundwire [sof-soundwire], périphérique 5 : HDMI 1 (*) []
   Sous-périphérique : 1/1
   Sous-périphérique #0 : subdevice #0
carte 0 : sofsoundwire [sof-soundwire], périphérique 6 : HDMI 2 (*) []
   Sous-périphérique : 1/1
   Sous-périphérique #0 : subdevice #0
carte 0 : sofsoundwire [sof-soundwire], périphérique 7 : HDMI 3 (*) []
   Sous-périphérique : 1/1
   Sous-périphérique #0 : subdevice #0

Result of aplay -L (nothing):

null
   Discard all samples (playback) or generate zero samples (capture)

dmesg output (with grep sof) :

 [    4.333904] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if info 0x040100
 [    4.333944] sof-audio-pci-intel-tgl 0000:00:1f.3: SoundWire enabled on CannonLake+ platform, using SOF driver
 [    4.333974] sof-audio-pci-intel-tgl 0000:00:1f.3: enabling device (0000 -> 0002)
 [    4.334554] sof-audio-pci-intel-tgl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
 [    4.334727] sof-audio-pci-intel-tgl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
 [    4.341580] sof-audio-pci-intel-tgl 0000:00:1f.3: use msi interrupt mode
 [    4.359560] sof-audio-pci-intel-tgl 0000:00:1f.3: DMICs detected in NHLT tables: 0
 [    4.359568] sof-audio-pci-intel-tgl 0000:00:1f.3: hda codecs found, mask 4
 [    4.362027] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
 [    4.362033] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
 [    4.362046] sof-audio-pci-intel-tgl 0000:00:1f.3: unknown sof_ext_man header type 3 size 0x30
 [    4.463629] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware info: version 2:2:0-57864
 [    4.463641] sof-audio-pci-intel-tgl 0000:00:1f.3: Firmware: ABI 3:22:1 Kernel ABI 3:23:0
 [    4.489361] sof-audio-pci-intel-tgl 0000:00:1f.3: Topology: ABI 3:22:1 Kernel ABI 3:23:0
 [    4.489740] sof_sdw sof_sdw: ASoC: Parent card not yet available, widget card binding deferred
 [    4.513034] sof_sdw sof_sdw: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3
 [    4.536795] input: sof-soundwire HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card0/input22
 [    4.536971] input: sof-soundwire HDMI/DP,pcm=6 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card0/input23
 [    4.537123] input: sof-soundwire HDMI/DP,pcm=7 as /devices/pci0000:00/0000:00:1f.3/sof_sdw/sound/card0/input24

To Reproduce Install a fresh voidlinux, update/upgrade distrib, then installing alsa/sof packages :

$ xbps-install -Su
$ xbps-install alsa-tools alsa-utils alsa-firmware sof-firmware

Reproduction Rate In 2 same installation retries, 100%

Expected behavior Get sound from speakers/headphones

Impact Very annoying, obviously

Others I can provide any other information if needed. Just ask.

lgirdwood commented 3 months ago

@lambda2501 do you have a dmesg from your previous Linux install ? it looks like an ingredient is missing that the driver needs to bind all the endpoints. Adding @plbossart @bardliao and @ujfalusi .

lambda2501 commented 3 months ago

I have no previous install. It's a new Dell XPS 13 9315 (2022 I think). It is delivered with Windows that I wiped out. I have another computer, an older XPS 13 with voidlinux too, no problem, but it is dying, that's why I bought a new one. The soundcard is not the same, so I can't relate.

Here is the whole dmesg : https://bpa.st/EBQQ

plbossart commented 3 months ago

please add this file sof-dyndbg.conf.txt as /etc/modprobe.d/sof-dyndbg.conf, reboot and attach the dmesg log and the output of 'alsa-info'.

lambda2501 commented 3 months ago

Here the whole dmesg after a reboot and your file added to modprobe.d directory. https://bpa.st/3KXQ

bardliao commented 3 months ago

@lambda2501 I don't see any issue from the dmesg. What happen if you run aplay -Dhw:0,2 xxx.wav? Can you share the output of alsa-info? BTW. there is no jack device from the dmesg, is it expected?

lambda2501 commented 3 months ago

What happen if you run aplay -Dhw:0,2 xxx.wav?

$ aplay -Dhw:0,2 /usr/share/sounds/alsa/Noise.wav gives me : Lecture WAVE '/usr/share/sounds/alsa/Noise.wav' : Signed 16 bit Little Endian, Fréquence 48000 Hz, Mono aplay: set_params:1398: Nombre de canaux non disponible

(Lecture WAVE = Playing WAVE / Nombre de canaux non disponible = Number of canals unavailable)

there is no jack device from the dmesg, is it expected?

There is no physical jack entry, so It's probably the reason ? The XPS 13 9315 (2022) is a notebook with only two USB-C/Thunderbolt 4 ports. I got an adaptater USB-C to jack 3.5 from dell (included).

bardliao commented 3 months ago

What happen if you run aplay -Dhw:0,2 xxx.wav?

$ aplay -Dhw:0,2 /usr/share/sounds/alsa/Noise.wav gives me : Lecture WAVE '/usr/share/sounds/alsa/Noise.wav' : Signed 16 bit Little Endian, Fréquence 48000 Hz, Mono aplay: set_params:1398: Nombre de canaux non disponible

(Lecture WAVE = Playing WAVE / Nombre de canaux non disponible = Number of canals unavailable)

This is because the speaker device can play 2 channel format only. Can you try a 2 channel format wav? You could find one from https://samples-files.com/sample-wav-files/

there is no jack device from the dmesg, is it expected?

There is no physical jack entry, so It's probably the reason ? The XPS 13 9315 (2022) is a notebook with only two USB-C/Thunderbolt 4 ports. I got an adaptater USB-C to jack 3.5 from dell (included).

Yes, then no jack device is expected.

lambda2501 commented 3 months ago

Can you try a 2 channel format wav?

It works ! aplay -Dhw:0,2 sample-file-4.wav Lecture WAVE 'sample-file-4.wav' : Signed 16 bit Little Endian, Fréquence 44100 Hz, Stéréo Avertissement : la fréquence n'est pas précise (demandé = 44100Hz, obtenu = 48000Hz) veuillez essayez le greffon de branchement

But no sound in other applications like mpv or firefox...

bardliao commented 3 months ago

But no sound in other applications like mpv or firefox...

Do you install latest UCM?

lambda2501 commented 3 months ago

From the voidlinux repository I have this package installed : alsa-ucm-conf-1.2.11_1 ALSA Use Case Manager topology configurations Does it is what you're talking about ?

bardliao commented 3 months ago

From the voidlinux repository I have this package installed : alsa-ucm-conf-1.2.11_1 ALSA Use Case Manager topology configurations Does it is what you're talking about ?

Yes. And can you share the output of "alsa-info" command? I would like to check the components string.

lambda2501 commented 3 months ago

alsa-info.txt

lambda2501 commented 2 months ago

@plbossart What does the SDW label means ?

plbossart commented 2 months ago

SoundWire, the interface used on your device.

marc-hb commented 2 months ago

Avertissement : la fréquence n'est pas précise (demandé = 44100Hz, obtenu = 48000Hz) veuillez essayez le greffon de branchement

Please enter unset LANG LC_ALL before running commands. Not all of us understand French :-)

unset LANG LC_ALL affects only the current window.

bardliao commented 2 months ago

alsa-info.txt

Components : 'HDA:8086281c,80860101,00100000 cfg-spk:2 cfg-amp:1 spk:rt1316 mic:rt715-sdca' spk:rt1316 seems to be an issue. It is expected to be spk:rt1316-1. Can you upgrade your kernel?

bardliao commented 2 months ago

alsa-info.txt

Components : 'HDA:8086281c,80860101,00100000 cfg-spk:2 cfg-amp:1 spk:rt1316 mic:rt715-sdca' spk:rt1316 seems to be an issue. It is expected to be spk:rt1316-1. Can you upgrade your kernel?

Sorry, I was wrong. spk:rt1316 should be fine. Can you share the result of "sudo alsaucm reload" command?

lambda2501 commented 2 months ago

@bardliao I had a kernel upgrade this morning, so I'm now: Linux 6.6.40_1 #1 SMP PREEMPT_DYNAMIC Mon Jul 15 20:29:49 UTC 2024 x86_64 GNU/Linux

I have no stdout or stderr after the command sudo alsaucm reload so I attached a new dmesg and alsa-info.sh output : alsa-info.txt dmesg_after_alsaucm_reload.txt

@marc-hb Thanks for the command, I didn't know how to change it for the current shell session only... So here are the result of the previous commands :

$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sofsoundwire [sof-soundwire], device 2: Speaker (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofsoundwire [sof-soundwire], device 5: HDMI 1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofsoundwire [sof-soundwire], device 6: HDMI 2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofsoundwire [sof-soundwire], device 7: HDMI 3 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
$ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)

And the only one producing sound for now:

$ aplay -Dhw:0,2 glovebox/sample-file-4.wav
Playing WAVE 'glovebox/sample-file-4.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Warning: rate is not accurate (requested = 44100Hz, got = 48000Hz)
         please, try the plug plugin
bardliao commented 2 months ago

@bardliao I had a kernel upgrade this morning, so I'm now: Linux 6.6.40_1 #1 SMP PREEMPT_DYNAMIC Mon Jul 15 20:29:49 UTC 2024 x86_64 GNU/Linux

I have no stdout or stderr after the command sudo alsaucm reload so I attached a new dmesg and alsa-info.sh output : alsa-info.txt dmesg_after_alsaucm_reload.txt

Hmm, I can't see any issue. @shumingfan any thought?

shumingfan commented 2 months ago

@lambda2501 I checked the alsa-info.txt.

!!Sound Servers on this system
!!----------------------------

No sound servers found.

Why your system doesn't have the sound servers?

plbossart commented 2 months ago

@lambda2501 44.1kHz is not supported, please use 48kHz

speaker-test -Dhw:0,2 -c2 -r48000 -FS16_LE should play noise on your speakers. If you don't have a sound server, then all the UCM configs will not be used. That points to a major gap in your distro.

lambda2501 commented 2 months ago

@plbossart It works also, the previous command had probably automatically switched to 48kHz by itself. Well the sound works with this command too. Do yo think the fact it needs 48kHz and not 41.1kHz could be a source of the problem ? I mean, maybe by default applications try to use 44.1kHz but because it is need possible, there is no sound ?

@shumingfan my previous installed voidlinux on a previous model of XPS 13 worked without any PulseAudio installed. mpv doesn't require PulseAudio to work, same with Firefox or any. So is it really required to use PulseAudio to get sound ? I tried previously to install Pipewire & Wireplumber but it doesn't work neither...

ujfalusi commented 2 months ago

@lambda2501, due to the complex use cases, controls and different PCMs it is generally better to use a sound server, but if you only use a single configuration then you can get away without it. Open two terminal window and run this on one: speaker-test -Dhw:0,2 -c2 -r48000 -FS16_LE -W /usr/share/sounds/alsa/ -t wav On the other one start alsamixer -c0 (-c0 can be omitted) and poke with the available controls. It is likely that the speaker amp is muted or have low volume. All of this would be handled by sound servers via UCM.

If you found the correct control and have audio, save the alsa config to be restored on next boot.

lambda2501 commented 2 months ago

@ujfalusi As tried before, the aplay commands work, and `alsamixer is already unmuted and up for each channel avalaible, as in the picture attached. The problem is that I have no sound from other applications, like mpv (that doesn't require pulseaudio or else) or Firefox. alsamixer

plbossart commented 2 months ago

it's probably because you don't have a mapping from hw: devices to logical ones. aplay -L returns nothing.

I am afraid you are a very quirky setup that requires lots of manual config.

ujfalusi commented 2 months ago

@lambda2501, have you tried mpv --audio-device=alsa/hw:0,2 .... ?

marc-hb commented 2 months ago

It's a new Dell XPS 13 9315 (2022 I think). It is delivered with Windows that I wiped out.

If you want a trouble-free Linux experience, it's best to buy a Linux PC. Even if you switch Linux distribution, at least you have a good, supported starting point.

Now if that same hardware is also sold with Linux then there's a very high chance everything should work (you could still have BIOS differences)

I tried previously to install Pipewire & Wireplumber but it doesn't work neither...

Try disabling these (using runit?) but without uninstalling them. This could help keeping your system configuration more "standard" and not missing any file.

BTW @ujfalusi , @plbossart , could an alsactl init command help? Is this all documented somewhere? https://github.com/thesofproject/sof-test/pull/966/files

I am afraid you are a very quirky setup that requires lots of manual config.

Maybe because of this: https://voidlinux.org/

Unlike trillions of other existing distros, Void is not a modification of an existing distribution. Void's package manager and build system have been written from scratch.

lambda2501 commented 2 months ago

@ujfalusi Thank you so much, I didn't even think about it, I'm so stupid. It works now, even if I have to define Alsa output manually/hardly.

@marc-hb I bought this Dell XPS 13 precisely because it is (as they said) compatible with GNU/Linux (Dell sometimes sell them with Ubuntu pre-installed, but not in my country, even if compatible and with the same configuration...)

After all these tries and retries, I decided to reinstall everything from scratch to see if I missed something, or if a package install had make some troubles. Now, even if I have some warnings from wireplumber/pipewire, it seems to work !

About no sound with Firefox, it's because it doesn't support anymore alsa only since some years now, but Pulse by default. So I remembered that with my old config on my previous laptop, I used apulse to simulate Pulse from Alsa. But I also remembered I had to trick some things but not which one, so Pipewire working (for now) is finally a good thing. Now I have to resolve some other stuffs, like video lagging with mpv (because of HiDPI screen I presume), and fan/temperature control...

Thanks @everyone for your help !

marc-hb commented 2 months ago

You're welcome!