You are not logged in.

#1 2025-04-12 13:43:33

acutm
Member
From: Mar del Plata - Argentina
Registered: 2015-05-26
Posts: 24

Kernel Bug? Fixing audio Lenovo Yoga Pro 9i TIAS2781 ALC287 ALC3306

Hi all, this is something I've been dealing with for almost 3 weeks and now I got something functional, no the cleanest way.
First of all. I'm a decent time Linux user but I've never been very deep in technical stuff. So there might be more than one concept/idea that I'm not very knowledgeable.
After my disclaimer, here we go.

I've experienced some audio issues on my Lenovo Yoga Pro 9I where all of the sudden, it would sound weak, like missing bass, or the sound being distorted, metalic.
I pointed at everything: Pipewire, alsa, wireplumber, sof-hda-dsp, snd-hda-intel, pulseaudio, different distro (tried on debian with same result).
After hours of research in forums I came across this one
where a fedora user reported the same issue i was experiencing, except on a different version of computer, his is a Yoga 7

There is a bug reported in bugzilla and after reading that long message chain, I found one of the users that presented a script
claiming that fixed the issue.
I share the script with you that I tweaked slighly to run as automated as I could:

#!/bin/sh
# set -x
# Here is the ic2-xx linked to TIAS2781
output=$(ls -l /sys/bus/i2c/devices/i2c-TIAS2781:00 2>/dev/null)

# if it didn't find anything device related to TIAS2781, exit.
if [ $? -ne 0 ]; then
   # echo "Error: No linked I2C-XX device"
    exit 1
fi

# Extract the linked device to TIAS2781
number=$(echo "$output" | grep -o "i2c-[0-9]\+" | sed 's/i2c-//')

# Which number is linked
if [ -n "$number" ]; then
    function clear_stdin()
(
    old_tty_settings=`stty -g`
    stty -icanon min 0 time 0

    while read none; do :; done

    stty "$old_tty_settings"
)

if [ $# -ne 1 ];
then
	#echo Kindly specify the i2c bus number. The default i2c bus number is 3.
	#echo It can be any between 1 and 21.
	#echo Command as following:
	#echo $0 i2c-bus-number
        #mine is 17
	i2c_bus=$number
else
	i2c_bus=$1
fi

#echo i2c bus is $i2c_bus
i2c_addr=(0x3f 0x38)

count=0
for value in ${i2c_addr[@]};
do
val=$((${count} % 2))
i2cset -f -y $i2c_bus $value 0x00 0x00
i2cset -f -y $i2c_bus $value 0x7f 0x00
i2cset -f -y $i2c_bus $value 0x01 0x01
i2cset -f -y $i2c_bus $value 0x0e 0xc4
i2cset -f -y $i2c_bus $value 0x0f 0x40
i2cset -f -y $i2c_bus $value 0x5c 0xd9
i2cset -f -y $i2c_bus $value 0x60 0x10
if [ $val -eq 0 ];
then
	i2cset -f -y $i2c_bus $value 0x0a 0x1e
else
	i2cset -f -y $i2c_bus $value 0x0a 0x2e
fi
i2cset -f -y $i2c_bus $value 0x0d 0x01
i2cset -f -y $i2c_bus $value 0x16 0x40
i2cset -f -y $i2c_bus $value 0x00 0x01
i2cset -f -y $i2c_bus $value 0x17 0xc8
i2cset -f -y $i2c_bus $value 0x00 0x04
i2cset -f -y $i2c_bus $value 0x30 0x00
i2cset -f -y $i2c_bus $value 0x31 0x00
i2cset -f -y $i2c_bus $value 0x32 0x00
i2cset -f -y $i2c_bus $value 0x33 0x01

i2cset -f -y $i2c_bus $value 0x00 0x08
i2cset -f -y $i2c_bus $value 0x18 0x00
i2cset -f -y $i2c_bus $value 0x19 0x00
i2cset -f -y $i2c_bus $value 0x1a 0x00
i2cset -f -y $i2c_bus $value 0x1b 0x00
i2cset -f -y $i2c_bus $value 0x28 0x40
i2cset -f -y $i2c_bus $value 0x29 0x00
i2cset -f -y $i2c_bus $value 0x2a 0x00
i2cset -f -y $i2c_bus $value 0x2b 0x00

i2cset -f -y $i2c_bus $value 0x00 0x0a
i2cset -f -y $i2c_bus $value 0x48 0x00
i2cset -f -y $i2c_bus $value 0x49 0x00
i2cset -f -y $i2c_bus $value 0x4a 0x00
i2cset -f -y $i2c_bus $value 0x4b 0x00
i2cset -f -y $i2c_bus $value 0x58 0x40
i2cset -f -y $i2c_bus $value 0x59 0x00
i2cset -f -y $i2c_bus $value 0x5a 0x00
i2cset -f -y $i2c_bus $value 0x5b 0x00

i2cset -f -y $i2c_bus $value 0x00 0x00
i2cset -f -y $i2c_bus $value 0x02 0x00
count=$((${count} + 1))
done;
#else
#   echo "No linked devices i2c-XX"
fi

After I got this script working fine, I created a systemd service to execute everytime the output of "pw-cli" on my audio card goes from "suspended" or "idle" to "run" (meaning, everytime the system is quiet and I play some audio).

Now. This may not be the best way to do it, running a script in loop to fix something everytime it breaks, but at least it gets my audio going.

I'm not sure if I should report this as another bug, and where should I report it. BugZilla shows "RESOLVED CODE_FIX". But on 6.12.22-1-lts and 6.14.1 it is clearly not applied.

There are a lot of things in the background that I do not understand yet.
I think the responsible is the codec. for some reason, both Arch and Debian
are using ALC287 Codec, but from the spec sheet of my laptop, it is equiped
with "High Definition (HD) Audio, Realtek® ALC3306 codec"

sudo lspci -v | grep -i audio
00:1f.3 Multimedia audio controller: Intel Corporation Meteor Lake-P HD Audio Controller (rev 20)
 sudo dmesg | grep -i "snd\|sof\|hda\|audio\|dsp"
[    0.055632] software IO TLB: area num 32.
[    0.663662] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    0.663663] software IO TLB: mapped [mem 0x00000000563b8000-0x000000005a3b8000] (64MB)
[    1.410654] pci 0000:01:00.0: optimus capabilities: enabled, status dynamic power, hda bios codec supported
[    4.005264] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    4.092196] sof-audio-pci-intel-mtl 0000:00:1f.3: Digital mics found on Skylake+ platform, using SOF driver
[    4.093017] sof-audio-pci-intel-mtl 0000:00:1f.3: enabling device (0000 -> 0002)
[    4.094193] sof-audio-pci-intel-mtl 0000:00:1f.3: DSP detected with PCI class/subclass/prog-if 0x040100
[    4.094981] sof-audio-pci-intel-mtl 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    4.102541] sof-audio-pci-intel-mtl 0000:00:1f.3: use msi interrupt mode
[    4.126357] sof-audio-pci-intel-mtl 0000:00:1f.3: hda codecs found, mask 5
[    4.127396] sof-audio-pci-intel-mtl 0000:00:1f.3: using HDA machine driver skl_hda_dsp_generic now
[    4.128190] sof-audio-pci-intel-mtl 0000:00:1f.3: NHLT device BT(0) detected, ssp_mask 0x4
[    4.128967] sof-audio-pci-intel-mtl 0000:00:1f.3: BT link detected in NHLT tables: 0x4
[    4.129692] sof-audio-pci-intel-mtl 0000:00:1f.3: DMICs detected in NHLT tables: 4
[    4.133234] sof-audio-pci-intel-mtl 0000:00:1f.3: Firmware paths/files for ipc type 1:
[    4.133941] sof-audio-pci-intel-mtl 0000:00:1f.3:  Firmware file:     intel/sof-ipc4/mtl/sof-mtl.ri
[    4.134650] sof-audio-pci-intel-mtl 0000:00:1f.3:  Firmware lib path: intel/sof-ipc4-lib/mtl
[    4.135356] sof-audio-pci-intel-mtl 0000:00:1f.3:  Topology file:     intel/sof-ace-tplg/sof-hda-generic-4ch.tplg
[    4.136566] sof-audio-pci-intel-mtl 0000:00:1f.3: Loaded firmware library: ADSPFW, version: 2.12.0.1
[    4.259857] sof-audio-pci-intel-mtl 0000:00:1f.3: Booted firmware version: 2.12.0.1
[    4.267984] sof-audio-pci-intel-mtl 0000:00:1f.3: Topology: ABI 3:29:1 Kernel ABI 3:23:1
[    4.268723] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: Parent card not yet available, widget card binding deferred
[    4.289465] snd_hda_codec_realtek ehdaudio0D0: bound i2c-TIAS2781:00 (ops tas2781_hda_comp_ops [snd_hda_scodec_tas2781_i2c])
[    4.291206] snd_hda_codec_realtek ehdaudio0D0: autoconfig for ALC287: line_outs=2 (0x14/0x17/0x0/0x0/0x0) type:speaker
[    4.291842] snd_hda_codec_realtek ehdaudio0D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    4.292501] snd_hda_codec_realtek ehdaudio0D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[    4.293968] snd_hda_codec_realtek ehdaudio0D0:    mono: mono_out=0x0
[    4.295583] snd_hda_codec_realtek ehdaudio0D0:    inputs:
[    4.298005] snd_hda_codec_realtek ehdaudio0D0:      Mic=0x19
[    4.337787] skl_hda_dsp_generic skl_hda_dsp_generic: hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3
[    4.356130] input: sof-hda-dsp Mic as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input24
[    4.358653] input: sof-hda-dsp Headphone as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input25
[    4.360529] input: sof-hda-dsp HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input26
[    4.362697] input: sof-hda-dsp HDMI/DP,pcm=4 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input27
[    4.363470] input: sof-hda-dsp HDMI/DP,pcm=5 as /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input28

I'm happy to report a bug and explain to whoever is in charge, present logs, etc. I just don't know if it is indeed a kernel issue, or some other program or driver.

Offline

Board footer

Powered by FluxBB