thesofproject / linux

Linux kernel source tree
Other
88 stars 128 forks source link

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

Open micmalti opened 3 weeks ago

micmalti commented 3 weeks ago

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

plbossart commented 3 weeks ago

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.

micmalti commented 3 weeks ago

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.