Bug 212041

Summary: LG Gram (2021 Tiger Lake) No sound internel speaker
Product: Drivers Reporter: Nelson Jeppesen (linux)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: normal CC: edoubrayrie, eric, jsauer, mail6543210, mangoo, MilesBHuff, parth.mehrotra.cs, ryanmag218, tiwai, wmingcen
Priority: P1    
Hardware: Intel   
OS: Linux   
Kernel Version: 5.11.1 Subsystem:
Regression: No Bisected commit-id:
Attachments: alsa-info.sh` output
My `alsa-info.sh` output

Description Nelson Jeppesen 2021-03-03 20:47:02 UTC
Created attachment 295613 [details]
alsa-info.sh` output

Built-in microphone and headphone/line out jack work but the built-in speaker does not even if it's listed. `alsa-info.sh` output attahed

Checked alsamixer, not muted.

> lspci -v | grep -i aud
> 00:1f.3 Multimedia audio controller: Intel Corporation Tiger Lake-LP Smart
> Sound Technology Audio Controller (rev 20)
>       Kernel driver in use: sof-audio-pci

Laptop: LG Gram 17 (2021) (17Z90P) Tiger Lake 11th GEN Intel CPU 
SOF driver ENABLED

more context https://github.com/thesofproject/linux/issues/2777

> % dmesg|egrep -i "(dsp|sof|snd)"
> [    0.514780] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
> [    0.514780] software IO TLB: mapped [mem
> 0x000000002ef9a000-0x0000000032f9a000] (64MB)
> [    6.170758] snd_hda_intel 0000:00:1f.3: DSP detected with PCI
> class/subclass/prog-if info 0x040100
> [    6.170762] snd_hda_intel 0000:00:1f.3: Digital mics found on Skylake+
> platform, using SOF driver
> [    6.240146] sof-audio-pci 0000:00:1f.3: DSP detected with PCI
> class/subclass/prog-if info 0x040100
> [    6.240151] sof-audio-pci 0000:00:1f.3: Digital mics found on Skylake+
> platform, using SOF driver
> [    6.240164] sof-audio-pci 0000:00:1f.3: enabling device (0000 -> 0002)
> [    6.240299] sof-audio-pci 0000:00:1f.3: DSP detected with PCI
> class/subclass/prog-if 0x040100
> [    7.521268] sof-audio-pci 0000:00:1f.3: bound 0000:00:02.0 (ops
> i915_audio_component_bind_ops [i915])
> [    7.573908] sof-audio-pci 0000:00:1f.3: use msi interrupt mode
> [    7.596903] sof-audio-pci 0000:00:1f.3: hda codecs found, mask 5
> [    7.596906] sof-audio-pci 0000:00:1f.3: using HDA machine driver
> skl_hda_dsp_generic now
> [    7.596911] sof-audio-pci 0000:00:1f.3: DMICs detected in NHLT tables: 2
> [    7.696212] sof-audio-pci 0000:00:1f.3: Firmware info: version 1:6:1-53680
> [    7.696215] sof-audio-pci 0000:00:1f.3: Firmware: ABI 3:17:0 Kernel ABI
> 3:18:0
> [    7.701377] sof-audio-pci 0000:00:1f.3: Topology: ABI 3:17:0 Kernel ABI
> 3:18:0
> [    7.715760] sof-audio-pci 0000:00:1f.3: ASoC: Parent card not yet
> available, widget card binding deferred
> [    7.735862] snd_hda_codec_realtek ehdaudio0D0: autoconfig for ALC298:
> line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
> [    7.735867] snd_hda_codec_realtek ehdaudio0D0:    speaker_outs=0
> (0x0/0x0/0x0/0x0/0x0)
> [    7.735868] snd_hda_codec_realtek ehdaudio0D0:    hp_outs=1
> (0x21/0x0/0x0/0x0/0x0)
> [    7.735870] snd_hda_codec_realtek ehdaudio0D0:    mono: mono_out=0x0
> [    7.735871] snd_hda_codec_realtek ehdaudio0D0:    inputs:
> [    7.735872] snd_hda_codec_realtek ehdaudio0D0:      Mic=0x18
> [    7.776752] snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX
> overwritten
> [    7.776759] snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX
> overwritten
> [    7.776874] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget
> hifi3 overwritten
> [    7.776878] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget
> hifi2 overwritten
> [    7.776882] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget
> hifi1 overwritten
> [    7.776885] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget
> Codec Output Pin1 overwritten
> [    7.776888] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget
> Codec Input Pin1 overwritten
> [    7.776893] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget
> Analog Codec Playback overwritten
> [    7.776897] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget
> Digital Codec Playback overwritten
> [    7.776901] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: sink widget Alt
> Analog Codec Playback overwritten
> [    7.776906] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget
> Analog Codec Capture overwritten
> [    7.776910] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget
> Digital Codec Capture overwritten
> [    7.776915] skl_hda_dsp_generic skl_hda_dsp_generic: ASoC: source widget
> Alt Analog Codec Capture overwritten
> [    7.776922] skl_hda_dsp_generic skl_hda_dsp_generic:
> hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 3
> [    7.776924] skl_hda_dsp_generic skl_hda_dsp_generic:
> hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 4
> [    7.776925] skl_hda_dsp_generic skl_hda_dsp_generic:
> hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 5
> [    7.776926] skl_hda_dsp_generic skl_hda_dsp_generic:
> hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 6
> [    7.776927] skl_hda_dsp_generic skl_hda_dsp_generic:
> hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 7
> [    7.776928] skl_hda_dsp_generic skl_hda_dsp_generic:
> hda_dsp_hdmi_build_controls: no PCM in topology for HDMI converter 8
> [    7.792603] input: sof-hda-dsp Mic as
> /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input11
> [    7.792672] input: sof-hda-dsp Headphone as
> /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input12
> [    7.792751] input: sof-hda-dsp HDMI/DP,pcm=3 as
> /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input13
> [    7.792807] input: sof-hda-dsp HDMI/DP,pcm=4 as
> /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input14
> [    7.792866] input: sof-hda-dsp HDMI/DP,pcm=5 as
> /devices/pci0000:00/0000:00:1f.3/skl_hda_dsp_generic/sound/card0/input15

SOF driver DISABLED

> % dmesg|egrep -i "(dsp|sof|snd)"
> [    0.512789] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
> [    0.512789] software IO TLB: mapped [mem
> 0x000000002ef9a000-0x0000000032f9a000] (64MB)
> [    6.349708] snd_hda_intel 0000:00:1f.3: enabling device (0000 -> 0002)
> [    7.792623] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops
> i915_audio_component_bind_ops [i915])
> [    7.877472] snd_hda_codec_realtek hdaudioC0D0: autoconfig for ALC298:
> line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
> [    7.877477] snd_hda_codec_realtek hdaudioC0D0:    speaker_outs=0
> (0x0/0x0/0x0/0x0/0x0)
> [    7.877478] snd_hda_codec_realtek hdaudioC0D0:    hp_outs=1
> (0x21/0x0/0x0/0x0/0x0)
> [    7.877479] snd_hda_codec_realtek hdaudioC0D0:    mono: mono_out=0x0
> [    7.877480] snd_hda_codec_realtek hdaudioC0D0:    inputs:
> [    7.877481] snd_hda_codec_realtek hdaudioC0D0:      Mic=0x18
Comment 1 Takashi Iwai 2021-03-08 15:30:16 UTC
It's rather the lack of amp initialization, and it's pretty much vendor-specific.  You have to figure out it by yourself via trial-and-error (or try asking the vendor).
At first, I'd try different model option values.
Comment 2 Mingcen Wei 2021-03-19 08:07:27 UTC
I have exactly the same issue on my 16" LG Gram 2021 laptop (16Z90PE) (11th gen tiger lake).

My distro is Arch (kernel 5.11.7-arch1-1). Before installing "sof-firmware",the sound card wasn't recognized. After installing it, the sound card does be recognized, but there is no sound from the internal speaker when playing audio files or running `speaker-test`, even if the speaker volume bar in KDE Audio Volume bounces as if there was sound coming out.

The internal microphone, headphones, and HDMI output all work fine.
Comment 3 Mingcen Wei 2021-03-19 08:17:24 UTC
Created attachment 295953 [details]
My `alsa-info.sh` output
Comment 4 Mingcen Wei 2021-03-19 08:21:09 UTC
Other people encounter this problem as well.

https://superuser.com/questions/1627065/ubuntu-20-04-lts-no-sound-on-lg-gram-2021-a-lot-of-troubleshooting-attempted
Comment 5 Nelson Jeppesen 2021-03-21 09:19:41 UTC
I've installed Windows on second SSD and rebooted into linux - for some laptops this starts the audio, not the case here

I played around around jack remapping, mostly guessing but without luck, as well as random hda-verb commands

I'm still reading about how this sound system works but I'm struggling to figure out a way to determine the correct way to troubleshoot this issue

I saw a different bug report about using qemu to log hda-verbs, but I've not had time to dig into this, yet
Comment 6 Ryan Maguire 2021-03-24 19:34:07 UTC
(In reply to Mingcen Wei from comment #4)
> Other people encounter this problem as well.
> 
> https://superuser.com/questions/1627065/ubuntu-20-04-lts-no-sound-on-lg-gram-
> 2021-a-lot-of-troubleshooting-attempted

Thank you for adding this here (it is my post). Someone brought this bug report to my attention so I will be on the lookout for workarounds/bug fixes. I will post anything that solves the issue on the thread so others can find it easier.
Comment 7 Mehrotra 2021-05-18 03:03:54 UTC
Encountering this as well, happy to provide debugging info.

Looks like it could be a more general problem?

Similar deal with the new HP Spectre Bug 196147 / Bug 210633.

Found this while generally searching for Tiger Lake issues: https://bugzilla.kernel.org/buglist.cgi?quicksearch=tiger"
Comment 8 Tomasz Chmielewski 2023-05-17 14:43:53 UTC
Also no sound on LG Gram 17Z90R (17 inch from year 2023, 13th Gen Intel(R) Core(TM) i7-1360P).
Comment 9 eric 2023-06-02 12:50:12 UTC
Same issue with LG Gram 17Z90R-A.ADB9U1 tested with debian 6.1.0-9 and torvalds/linux.git 6.4.0-rc4 with same result, no sound from internal speakers but sound from headphones is working.

echo 1 | sudo tee /sys/module/snd_hda_codec/parameters/dump_coef
cat /proc/asound/card0/codec#0 >dump_coef.txt

I've dumped HDA verbs on Windows with RtHDDump_V236.zip and compared with Linux.
On Linux, dumped HDA verbs are the same booting cold or booting warm after using Windows.
The internal speakers don't remain initialized after using Windows and restarting into Linux.

I've made first try attempt at bash script to adjusts the verbs to blindly match Windows without success enabling the internal speakers.

function Coeff() { sudo hda-verb /dev/snd/hwC0D0 0x20 SET_COEF_INDEX $1; sudo hda-verb /dev/snd/hwC0D0 0x20 SET_PROC_COEF $2; }
Coeff 0x03 0x0042
Coeff 0x05 0x2be0
Coeff 0x08 0x0fcf
Coeff 0x0f 0x0062
Coeff 0x10 0x1ba1
Coeff 0x22 0x0039
Coeff 0x23 0x23ff
Coeff 0x25 0x0001
Coeff 0x26 0xb001
Coeff 0x28 0x0042
Coeff 0x29 0x0800
Coeff 0x2a 0x0d80
Coeff 0x2b 0x0cd0
Coeff 0x2e 0x0252
Coeff 0x31 0x4000
Coeff 0x51 0xa03f
Coeff 0x55 0xc301
Coeff 0x5b 0x4301
Coeff 0x7f 0xf1c8
Coeff 0x86 0x000f
sudo hda-verb /dev/snd/hwC0D0 0x21 SET_CONNECT_SEL 1
sudo hda-verb /dev/snd/hwC0D0 0x23 SET_CONNECT_SEL 2

I will probably investigate more in the future.
Comment 10 Tomasz Chmielewski 2023-07-10 21:10:04 UTC
I've tried kernels 6.4.2 and 6.5-rc1 (on 17Z90R-G.AD7BY) - still no sound from internal speakers.

@eric Were you able to make any more progress with hda-verb?
Comment 11 eric 2023-07-10 23:18:03 UTC
(In reply to Tomasz Chmielewski from comment #10)
> @eric Were you able to make any more progress with hda-verb?

@Tomasz, sorry no progress. I'll update this thread and publish a solution if I ever find one.

Next step would be: https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-from-a-Windows-sound-driver
Comment 12 Jeff Sauer 2023-09-12 21:56:54 UTC
My machine (2023 LG Gram 16 2-in-1 notebook, "16T90R-K.ADB9U1 Type1Version", core i7-1360p) has identical built-in speaker issue as listed in this ticket... 3.5mm headset audio works fine.

As was suggested for a next step on this ticket, I carefully followed the steps listed at:

https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-from-a-Windows-sound-driver

Used a Win11 VM, passed the audio device through, installed the Windows sound driver in the VM... and was able to hear sound from the Win11 VM on my 2023 LG Gram 16 2-in-1 laptop.  So that was good news.  The VM was generating sound to the pass-through audio device and to the built-in speakers.

However, I was unable to capture any CORB buffer dumps from qemu... and hence was not able to capture any hda verbs that the VM was using to initialize the speakers.

I do see vfio_region_writes being captured:

vfio_region_write  (0000:00:1f.3:region0+0x38, 0x0, 4)
vfio_region_write  (0000:00:1f.3:region0+0x804, 0x40000000, 4)
vfio_region_write  (0000:00:1f.3:region0+0x804, 0xc0000000, 4)
vfio_region_write  (0000:00:1f.3:region0+0x20, 0x80000000, 4)
vfio_region_write  (0000:00:1f.3:region0+0x20, 0xc0000000, 4)
vfio_region_write  (0000:00:1f.3:region0+0x804, 0xc0000000, 4)
vfio_region_write  (0000:00:1f.3:region0+0x92, 0x11, 2)
vfio_region_write  (0000:00:1f.3:region0+0x804, 0xc0000001, 4)
vfio_region_write  (0000:00:1f.3:region0+0x98, 0x2b1fe000, 4)
vfio_region_write  (0000:00:1f.3:region0+0x9c, 0x1, 4)

but nothing that the realtek verb tools or that QemuHDADump will recognize or do anything with.

The QemuHDADump utility also had these steps listed, very similar to the link used above:

https://github.com/Conmanx360/QemuHDADump/wiki/Setup-and-usage-of-the-program

Any thoughts?
Comment 13 Jeff Sauer 2023-09-14 16:25:15 UTC
OK, I was able to get sound working! I had to modify qemu to capture the hda-verb info being sent from the Win11 VM.  Only one file (hw/vfio/common.c) needs to be modified.  Once that was done, used the realtek verb tools to narrow down the captured verbs to the verbs needed to initialize the speakers (basically, the first 2380 verbs captured).

I guess it could be narrowed down even more?

For now, as part of my login script, I simply use the realtek verb tools to apply the verbs. I've created a public repo to hold my scripts, steps, etc. at:

https://github.com/jeffsauer/lggram2023speakerfix

Regards.
Comment 14 edoubrayrie 2023-09-18 23:41:17 UTC
I confirm #13 fixes the issue for me as well, immediately, on the exact same model as Jeff. (Thanks!)

For some reason, it is not the same verbs as on some other non-convertible 2023 models despite identical specs. Those seems to accept another set of patches by joshuagrisham, according to https://forums.fedoraforum.org/showthread.php?331130-Fixing-ALC298-audio (*maybe* related to Bug 207423 and fixed upstream with the alc298-samsung-amp patch)

To be clear:

16T90R-K.ADB9U1 -> Jeff's verbs
17Z90R-K.ADS9U1 -> joshuagrisham's verbs
16Z90R-A -> joshuagrisham's verbs

...to be confirmed -- my intuition would be that the difference would nvidia (...-K) vs intel-only (...-A) but it does match the 2nd report.

I'm not an expert but I think what could help is if people with various models (eg Tomasz and Eric from #8 and #9), can try the following instructions 
and report which ones work and their model variant (sudo dmidecode -s system-product-name).

(1) Jeff's verbs above -- I have repackaged them to simplify the procedure:
sudo apt install -y alsa-tools
wget https://gist.githubusercontent.com/eddy-geek/ef86267fbec87479aba905302909921a/raw/ -O necessary-verbs.sh
chmod +x necessary-verbs.sh
sudo ./necessary-verbs.sh
(should work immediately but not survive reboots)

(2) joshua's verbs for samsung
sudo apt install -y alsa-tools
wget https://github.com/joshuagrisham/galaxy-book2-pro-linux/raw/main/sound/necessary-verbs.sh
chmod +x necessary-verbs.sh
sudo ./necessary-verbs.sh
(should work immediately but not survive reboots)

(3) and alternatively, the upstream fix for samsung:
sudo tee /etc/modprobe.d/audio-fix-alc298--samsung-headphone.conf <<< 'options snd-hda-intel model=alc298-samsung-amp'
(should work permanently after after reboot)
Comment 15 Tomasz Chmielewski 2023-09-20 19:38:31 UTC
https://raw.githubusercontent.com/joshuagrisham/galaxy-book2-pro-linux/main/sound/necessary-verbs.sh - this one fixed the issue for me, thanks!

I'm running 17Z90R-G.AD7BY, it is intel-only, no nvidia.
Comment 16 eric 2023-09-21 20:18:02 UTC
I can confirm that for LG Gram 17Z90R-A.ADB9U1 (2) joshuagrisham verbs works. Thanks!
Comment 17 Miles B Huff 2024-03-22 15:26:22 UTC
edoubrayrie, I have a 17Z90R-K.ADS9U1, but it actually does not have NVIDIA -- so I don't think that's what "-K" means.  

As well:  Neither joshuagrisham's verbs nor Jeff's verbs seem to be working for me;  and the same for `options snd-hda-intel model=alc298-samsung-amp`.  :\
Comment 18 Miles B Huff 2024-04-01 04:23:57 UTC
I got it to work with joshuagrisham's verbs!  It turns out my issue was that, even though I had `sof-firmware` installed and loaded, the requisite SOF module was not actually being used.  

I needed to create `/etc/modprobe.d/sof.conf`, and add `options snd slots=snd_soc_skl_hda_dsp` to it.  
I also, for good measure, added `snd-hda-intel` to `/etc/modprobe.d/blacklist.conf`.
(Tips found at https://forum.manjaro.org/t/howto-set-up-the-audio-card-in-samsung-galaxy-book/37090)