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

[BUG] Distorted internal speaker sound on sof-rt5682 #5055

Open
micmalti opened this issue Jun 11, 2024 · 6 comments
Open

[BUG] Distorted internal speaker sound on sof-rt5682 #5055

micmalti opened this issue Jun 11, 2024 · 6 comments
Labels
bug Something isn't working Chromebook

Comments

@micmalti
Copy link

Describe the bug
I purchased a Chromebook Plus 515 with a 12th gen Intel CPU (i3-1215u) and decided to flash Coreboot (via MrChromebox's firmware utility) to replace ChromeOS with a Linux distro, more specifically Manjaro. Seeing that the sound card wasn't being detected by the system, I ran this script and got it to work. However, while there aren't sound quality issues when using Bluetooth or jack-connected headphones, audio coming from the internal speakers sounds garbled and choppy.

I'm able to confirm that this bug is experienced by at least one other user, so it probably isn't hardware-related, and it's not OS-related either, being also present on EndeavourOS. Switching from WirePlumber to PulseAudio did not resolve the issue. Using PulseAudio didn't help as well.

To Reproduce
This issue may just be limited to Chromebooks running Linux given their use of I2S codecs as opposed to HDA. For that matter, repeating the steps described above on a Chromebook with an sof-rt5682 sound card to install Linux and enable detection of the card will reproduce the issue.

System information

dmesg.log

Audio:
  Device-1: Intel Alder Lake PCH-P High Definition Audio
    driver: sof-audio-pci-intel-tgl
    alternate: snd_hda_intel,snd_sof_pci_intel_tgl bus-ID: 00:1f.3
    chip-ID: 8086:51c8 class-ID: 0401
  API: ALSA v: k6.8.12-3-MANJARO status: kernel-api with: aoss
    type: oss-emulator tools: alsactl,alsamixer,amixer
  Server-1: PipeWire v: 1.0.7 status: active with: 1: wireplumber
    status: active 2: pw-jack type: plugin tools: pw-cat,pw-cli,wpctl
  Server-2: PulseAudio v: 17.0 status: active with: pulseaudio-alsa
    type: plugin tools: pacat,pactl,pavucontrol

The current kernel parameters in use are:

rw quiet splash udev.log_priority=3 acpi_osi=Linux snd_hda_intel.power_save=0

An attempt was made to also include the firmware log with sof-tools-2024.03-1, yet the package version is seemingly incompatible with the current Linux version, returning an Invalid ldc file signature when executing:
sudo sof-logger -l /sys/kernel/debug/sof/etrace -o sof-logger.log

I'm not sure whether this is relevant, but the information reported by alsamixer doesn't match up with what's reported by the display controls. The following is for the headphone audio (the volume control for the internal speakers is missing):

Image

@micmalti micmalti added the bug Something isn't working label Jun 11, 2024
@plbossart
Copy link
Member

Most likely you have a setup where firmware/topology isn't aligned with UCM.
Exhibit A for this observation is that you are relying on a Chrome version of UCM

bash(f"git clone https://github.com/WeirdTreeThing/chromebook-ucm-conf -b {args.branch_name[0]} /tmp/chromebook-ucm-conf")

but it seems that you are using the public version of the firmware

    if not path_exists("/lib/firmware/intel/sof"):
        print_status("Installing SOF firmware")
        install_package("sof-firmware", "firmware-sof-signed", "alsa-sof-firmware", "sof-firmware", "sof-firmware")

I would either use all the components from Chrome, or all the components from sof-bin/alsa-ucm-conf.

At any rate it's not a firmware issue and it's not clear how to support this configuration.

@plbossart plbossart transferred this issue from thesofproject/sof Jun 12, 2024
@micmalti
Copy link
Author

Hi @plbossart, thank you for replying back. I was told by one of the senior contributors of the Chrultrabook project that, although the UCMs are based off of ChromeOS, they're actually written from scratch.

@micmalti
Copy link
Author

micmalti commented Aug 8, 2024

Hi @plbossart. The issue with the crackling internal audio still persists, even with the latest versions of the SOF firmware and Linux 6.10, though I did resolve the volume control issue by switching to Pipewire. Since our last conversation, I've removed acpi_osi=Linux and snd_hda_intel.power_save=0 and tried to set the dsp_driver=3 option for the snd-intel-dspcfg module. I also noticed that the internal microphone isn't being detected.

I'd greatly appreciate it if you or someone else who's knowledgeable in this area could provide me with some guidance regarding how to analyze these trace logs and hopefully manage to identify what might be the root cause: sof-logger.log

@plbossart
Copy link
Member

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

Please make sure your console log is larger enough for the verbose logs.

@micmalti
Copy link
Author

micmalti commented Aug 8, 2024

Here's the requested info:
sof-logger.log
alsa-info.txt

@plbossart
Copy link
Member

the internal microphone is reported by the kernel with a PCM device

card 0: sofrt5682 [sof-rt5682], device 99: DMIC (*) []

if that's not seen by userspace, the UCM file is broken.

The start of the log is missing, your buffer is too small, but I can already tell you the topology is not right. You cannot use the HotWording/KPB with the publicly released firmware. This is 3rd party stuff that is only distributed by Google.

and then there's a failed IPC

   6.030685] sof-audio-pci-intel-tgl 0000:00:1f.3: ipc tx error for 0x60010000 (msg/reply size: 108/20): -22
[    6.030688] sof-audio-pci-intel-tgl 0000:00:1f.3: HW params ipc failed for stream 2
[    6.030689] sof-audio-pci-intel-tgl 0000:00:1f.3: ASoC: error at snd_soc_pcm_component_hw_params on 0000:00:1f.3: -22

That's probably a bad configuration was well, where you're trying to send information to a non-existing component.

In short, you are in a configuration hole. You probably need to use all the firmware and topology from Google, not the latest sof-bin, and verify that the UCM is aligned with topology.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Chromebook
Projects
None yet
Development

No branches or pull requests

2 participants