Bug 208555 - No sound from speakers using Realtek ALC287
Summary: No sound from speakers using Realtek ALC287
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Sound(ALSA) (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Jaroslav Kysela
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-14 19:42 UTC by pyronavi
Modified: 2024-10-01 14:36 UTC (History)
152 users (show)

See Also:
Kernel Version: 5.7.9
Subsystem:
Regression: No
Bisected commit-id:


Attachments
Top half of top level audio level (116.08 KB, image/jpeg)
2020-09-13 18:13 UTC, Cameron Berkenpas
Details
bottom half of the top level audio menu (107.18 KB, image/jpeg)
2020-09-13 18:13 UTC, Cameron Berkenpas
Details
Me too, but this may help (645 bytes, text/plain)
2021-03-09 20:38 UTC, Ian
Details
Example of soundcard working in win10 VM via passthrough. Comments include steps. (337.21 KB, image/png)
2021-06-20 21:58 UTC, Cameron Berkenpas
Details
Qemu trace from boot to login screen (218.65 KB, text/plain)
2021-06-20 22:00 UTC, Cameron Berkenpas
Details
Trace of 5 seconds of playing random YouTube video (501.23 KB, text/plain)
2021-06-20 22:02 UTC, Cameron Berkenpas
Details
HUGE progress! (47.78 KB, text/plain)
2021-06-21 14:45 UTC, Cameron Berkenpas
Details
minimum verbs for both speakers working (so far)! (8.63 KB, text/plain)
2021-06-21 15:05 UTC, Cameron Berkenpas
Details
linux-5.12.12-legion-sound-0.0.1.patch (23.65 KB, patch)
2021-06-21 22:40 UTC, Cameron Berkenpas
Details | Diff
linux-5.12.12-legion-sound-0.0.2.patch - headphone fix (23.65 KB, patch)
2021-06-23 01:55 UTC, Cameron Berkenpas
Details | Diff
linux-5.12.12-legion-sound-0.0.3.patch - actual headphone fix (23.93 KB, patch)
2021-06-23 02:07 UTC, Cameron Berkenpas
Details | Diff
linux-5.12.12-legion-sound-0.0.4.patch - updated headphone fix, more models supported (23.95 KB, patch)
2021-06-23 23:15 UTC, Cameron Berkenpas
Details | Diff
legion-alc287-0.0.4.patch - snd-hda patch (8.73 KB, text/plain)
2021-06-24 22:19 UTC, Cameron Berkenpas
Details
verbs-14itl5_14cITL.txt (296 bytes, text/plain)
2021-06-25 15:31 UTC, Cameron Berkenpas
Details
linux-5.12-legion-sound-0.0.5.patch - updated verbs (4.89 KB, patch)
2021-06-25 16:23 UTC, Cameron Berkenpas
Details | Diff
legion-alc287-0.0.5.patch - snd-hda-intel patch (373 bytes, text/plain)
2021-06-25 16:47 UTC, Cameron Berkenpas
Details
yoga7-alc287-0.0.5.patch - snd-hda-intel patch for Yoga 7 models (373 bytes, text/plain)
2021-06-25 16:58 UTC, Cameron Berkenpas
Details
attachment-12135-0.html (2.15 KB, text/html)
2021-06-25 19:53 UTC, Vincent Morel
Details
lenovo-16ACHg6-alsa-info (26.87 KB, text/plain)
2021-06-26 00:04 UTC, Pablitar
Details
linux-5.12-legion-sound-0.0.6.patch - Early Gen2 support (21.37 KB, patch)
2021-06-29 03:53 UTC, Cameron Berkenpas
Details | Diff
trimed-verbs-Lenovo-13s-gen2-itl.txt (6.13 KB, text/plain)
2021-06-29 03:58 UTC, Cameron Berkenpas
Details
Legion 7 2021 16ACHg6 - linux codec dump (13.32 KB, text/plain)
2021-06-29 08:58 UTC, Alex
Details
Legion 7 2021 16ACHg6 - windows speakers on dump (41.54 KB, text/plain)
2021-06-29 08:59 UTC, Alex
Details
Legion 7 2021 16ACHg6 - windows headphones on dump (41.54 KB, text/plain)
2021-06-29 09:00 UTC, Alex
Details
attachment-29004-0.html (1.38 KB, text/html)
2021-06-29 19:05 UTC, Dre
Details
alsa-info-dre-yoga7 (45.21 KB, text/plain)
2021-06-29 21:09 UTC, Dre
Details
linux-5.12-legion-sound-0.0.7.patch (21.60 KB, patch)
2021-06-30 22:07 UTC, Cameron Berkenpas
Details | Diff
linux-5.12-legion-sound-0.0.9.patch - Improved 13s Gen 2 support (6.01 KB, patch)
2021-07-13 04:21 UTC, Cameron Berkenpas
Details | Diff
linux-5.12-legion-sound-0.0.9-001.patch (3.34 KB, patch)
2021-07-13 04:26 UTC, Cameron Berkenpas
Details | Diff
linux-5.12-legion-sound-0.0.9-002.patch (2.79 KB, patch)
2021-07-13 04:26 UTC, Cameron Berkenpas
Details | Diff
linux-5.12-legion-sound-0.0.9-003.patch (2.60 KB, patch)
2021-07-13 04:27 UTC, Cameron Berkenpas
Details | Diff
16achverbs2.txt (19.93 KB, text/plain)
2021-08-13 09:41 UTC, Marcus
Details
16achverbs.txt (3.13 KB, text/plain)
2021-08-13 09:41 UTC, Marcus
Details
16achverbs3.txt (108.38 KB, text/plain)
2021-08-13 09:41 UTC, Marcus
Details
16achverbs4.txt (171.78 KB, text/plain)
2021-08-13 09:41 UTC, Marcus
Details
linux-5.13-legion-yoga-14ITL5-sound-0.0.10-001.patch (2.79 KB, patch)
2021-08-17 17:48 UTC, Cameron Berkenpas
Details | Diff
linux-5.13-legion-yoga-14ITL5-sound-0.0.10-001.patch - correct patch (4.43 KB, patch)
2021-08-17 17:51 UTC, Cameron Berkenpas
Details | Diff
linux-5.13-legion-13s-gen2-sound-0.0.10-002.patch (2.05 KB, patch)
2021-08-17 17:53 UTC, Cameron Berkenpas
Details | Diff
linux-max.patch - Based on the 0.0.10 with fixed Yoga 7i support (4.53 KB, patch)
2021-08-19 14:23 UTC, Cameron Berkenpas
Details | Diff
little modification to the `linux-max.patch` to fix sound for Legion 7i, S740, Yoga 9i (4.82 KB, patch)
2021-08-20 09:17 UTC, Max
Details | Diff
alsa-info.txt from Lenovo A540-24ICB (44.23 KB, text/plain)
2021-08-20 17:06 UTC, Horacio Merovich
Details
linux-5.13-legion-sound-0.0.11-001.patch - 2020 Legion and Yoga 7i support (4.77 KB, patch)
2021-08-22 20:29 UTC, Cameron Berkenpas
Details | Diff
linux-5.13-legion-sound-0.0.11-002.patch - Support for 13s Gen2 and Yoga 7 15ITL5 (2.14 KB, patch)
2021-08-22 20:32 UTC, Cameron Berkenpas
Details | Diff
linux-5.14-legion-sound-0.0.12.patch - 5.14.x support (5.78 KB, patch)
2021-09-12 20:20 UTC, Cameron Berkenpas
Details | Diff
linux-legion-sound-0.0.13.patch (6.62 KB, patch)
2021-09-13 21:37 UTC, Cameron Berkenpas
Details | Diff
linux-13s-gen2-sound-0.0.1.patch (603 bytes, patch)
2021-10-09 21:57 UTC, Cameron Berkenpas
Details | Diff
2021 Lenovo Legion 7i 16ITHg6 DSDT (2.12 MB, text/plain)
2021-11-23 22:33 UTC, Cameron Berkenpas
Details
attachment-32614-0.html (5.91 KB, text/html)
2021-11-27 01:53 UTC, Cameron Berkenpas
Details
attachment-3712-0.html (4.44 KB, text/html)
2021-11-27 19:39 UTC, Cameron Berkenpas
Details
attachment-32437-0.html (1.51 KB, text/html)
2021-12-22 18:18 UTC, David Ober
Details
attachment-14829-0.html (5.17 KB, text/html)
2022-05-18 14:35 UTC, Cameron Berkenpas
Details
attachment-29335-0.html (1.51 KB, text/html)
2022-05-22 13:31 UTC, David Ober
Details
Patch for the ALC287 on the Lenovo Yoga 14IAP7 (5.42 KB, patch)
2022-07-04 07:24 UTC, Philipp Jungkamp
Details | Diff
bottomspeakers-for-14iap7-kernel-518.patch (10.20 KB, text/x-patch)
2022-07-20 07:55 UTC, eruyome
Details
attachment-17412-0.html (1.35 KB, text/html)
2022-07-28 18:37 UTC, cris223
Details
attachment-965-0.html (2.21 KB, text/html)
2022-07-29 01:30 UTC, cris223
Details
attachment-19333-0.html (1.60 KB, text/html)
2022-08-20 19:42 UTC, cris223
Details
attachment-22375-0.html (1.09 KB, text/html)
2022-08-21 13:50 UTC, cris223
Details
attachment-28445-0.html (1.46 KB, text/html)
2022-09-24 01:05 UTC, David Ober
Details
attachment-12523-0.html (4.19 KB, text/html)
2022-09-30 14:12 UTC, Cameron Berkenpas
Details
alsa info for this laptop ( https://psref.lenovo.com/Detail/Legion/Legion_S7_16ARHA7?M=82UG0029SP ) (50.83 KB, text/plain)
2022-10-06 12:01 UTC, toyeisfree
Details
dmesg for Legion S7 16ARHA7-82UG (126.00 KB, text/plain)
2022-10-06 12:05 UTC, toyeisfree
Details
Add Lenovo Y740S audio pci id to quirks list for alc285 (909 bytes, patch)
2022-11-20 14:26 UTC, MarcelS
Details | Diff
attachment-24448-0.html (4.83 KB, text/html)
2023-02-28 20:27 UTC, Cameron Berkenpas
Details
journalctl on a 83BU Yoga Pro 9 14IRP8 (5.80 KB, text/plain)
2023-05-15 12:27 UTC, Thomas Gfeller
Details
attachment-15426-0.html (1.50 KB, text/html)
2023-05-21 00:01 UTC, David Ober
Details
Amps are working on Yoga Pro 9i 2023 (2.00 KB, application/x-shellscript)
2023-08-03 05:37 UTC, Thomas Gfeller
Details
attachment-30610-0.html (1.43 KB, text/html)
2023-09-22 22:47 UTC, David Ober
Details
alsa-info.txt (63.11 KB, text/plain)
2023-12-01 02:02 UTC, Andrew
Details
attachment-13865-0.html (1.43 KB, text/html)
2023-12-27 15:39 UTC, David Ober
Details
attachment-31010-0.html (1.16 KB, text/html)
2024-04-16 05:19 UTC, dreamsyntax
Details
kernel-mute.log (191.20 KB, text/plain)
2024-04-25 19:11 UTC, Cameron Berkenpas
Details
attachment-10825-0.html (1.46 KB, text/html)
2024-04-26 00:01 UTC, David Ober
Details
attachment-8402-0.html (1.46 KB, text/html)
2024-05-18 20:38 UTC, David Ober
Details
alsa-info.txt of Lenovo Legion Pro 7 16ARX8H (AMD Ryzen variant) (57.38 KB, text/plain)
2024-07-06 15:33 UTC, mwohah
Details
attachment-9580-0.html (1.46 KB, text/html)
2024-07-06 15:33 UTC, David Ober
Details

Description pyronavi 2020-07-14 19:42:17 UTC
I get no sound via the speakers of my Lenovo Legion 7i laptop, which alsamixer tells me is using a Realtek ALC287.

I have tried various Linux distros and kernel combinations, including Ubuntu 16.04, 18.04, and 20.04, with both the default and mainline kernels (5.7.x & 5.8.x), and Manjaro with 5.6.x, 5.7.x and 5.8.x kernels.

In each case, I made sure to disable Auto-Mute in alsamixer, and turn all volume levels to maximum. In all cases, I get no sounds from the speakers (running speaker-test, playing music, etc.). I *am* able to get sound via headphones and HDMI (though I believe HDMI is via a different sound card).

Also, I can see that there is some kind of sound activity occurring when I look at pavucontrol (the reddish-orange bar that indicates a sound is playing), but there is no actual sound produced from the speakers.

My alsa-info.sh results (from Manjaro on 5.6.15) are here:

http://alsa-project.org/db/?f=ba86fe76a9d9cf1cced56600edf82eb206a36a72

I am happy to run the script again (or any other tool) from a different distro/kernel combination, please just let me know what would be helpful.
Comment 1 pyronavi 2020-07-18 19:13:51 UTC
Update using more recent kernel:

http://alsa-project.org/db/?f=4272343a3590cc08f192f98113dedfc0418afe52

In order to provide better information, I have run alsa-info.sh from Ubuntu 20.04 running the latest mainline kernel 5.7.9-050709-generic. I have also updated the "Kernel Version" field in this bug report to reflect this.
Comment 2 pyronavi 2020-07-18 20:28:36 UTC
I also tried with kernel 5.8.0-050800rc5-generic. Same result, no sound via speakers.
Comment 3 Guido 2020-07-30 20:58:01 UTC
I can confirm, same thing is happening to me, using manjaro with kernel 5.6.19-2-MANJARO
Comment 4 Cameron Berkenpas 2020-08-07 21:16:58 UTC
Can confirm here with Kubuntu 20.04 with kernel 5.4.0-40-generic and kernel 5.7.14... Sound works through head phones (using either bluetooth or a analog 3.5 mm cable). I did notice that playback via bluetooth stopped once... After putting the laptop to sleep then waking it back up, audio via bluetooth resumed.

I do not know if I am able to get audio via HDMI, I'm unsure how to use that setting (or is an external HDMI monitor needed for that?).
Comment 5 Ryan 2020-08-20 05:54:41 UTC
+1 for this on Manjaro with kernel 5.7.14.
Comment 6 contact 2020-08-31 00:05:23 UTC
Same issue.
I tested Manjaro with kernel 5.8.4.
Also tested Mint 20 with kernel 5.4.0-42, Ubuntu 20.04, Fedora 32 and PopOS.
Working with 3.5mm audio jack, bluetooth and docking station on USB-C.
Comment 7 Cameron Berkenpas 2020-08-31 00:12:46 UTC
Is everyone experiencing this on machines other than the Lenovo Legion 7i? Or is everyone on this same machine so far?
Comment 8 contact 2020-08-31 11:42:29 UTC
Forgot to mentioned it, Legion 7i for me.
Comment 9 Vincent Tavernier 2020-08-31 12:58:36 UTC
Experiencing this issue (no sound on speakers, but headphones and other outputs work fine) on a Legion 7i too on my side, on Fedora 32, kernel 5.8.4-200.fc32.x86_64.
Comment 10 Fab 2020-09-09 13:29:23 UTC
I have the exact same issue on Linux version 5.4.0-47-generic (buildd@lcy01-amd64-014) (gcc version 9.3.0 (Ubuntu 9.3.0-10ubuntu2)), with Lenovo Legion 7 81YT. I tried the same things as everybody else and could not get these speakers to work. I am a bit confused because some specs I found online for the the Legion 7 mention ALC 3306 -https://psref.lenovo.com/syspool/Sys/PDF/Legion/Lenovo_Legion_7_15IMHg05/Lenovo_Legion_7_15IMHg05_Spec.pdf (could not find any driver related to it) Vs ALC 287 identified by alsamixer. Speakers work just fine on Windows 10.
Comment 11 kernel.org 2020-09-13 10:15:01 UTC
(In reply to Cameron from comment #7)
> Is everyone experiencing this on machines other than the Lenovo Legion 7i?
> Or is everyone on this same machine so far?

My issues are also present on Legion 7i (Legion 7-15IMH05 Type 81YT).

Here is my alsa-info: http://alsa-project.org/db/?f=f74d2b20683de3bc0daab8c4740f34a66955ba70

A notable thing is that i *DID* have speaker audio for a couple of weeks (headphones have  always worked), until it suddenly stopped working again. My guess is that there might have been regression due to some package being updated but I could not find any meaningful culprit. 

I can paste the hidden BIOS HD audio settings for this configuration if that's of any use.

Kernel is 5.4.0-47-generic #51-Ubuntu SMP Fri Sep 4 19:50:52 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux

Distributor ID:	Ubuntu
Description:	Ubuntu 20.04.1 LTS
Comment 12 pyronavi 2020-09-13 14:53:28 UTC
(In reply to kernel.org from comment #11)
> (In reply to Cameron from comment #7)
> > Is everyone experiencing this on machines other than the Lenovo Legion 7i?
> > Or is everyone on this same machine so far?
> 
> My issues are also present on Legion 7i (Legion 7-15IMH05 Type 81YT).
> 
> Here is my alsa-info:
> http://alsa-project.org/db/?f=f74d2b20683de3bc0daab8c4740f34a66955ba70
> 
> A notable thing is that i *DID* have speaker audio for a couple of weeks
> (headphones have  always worked), until it suddenly stopped working again.
> My guess is that there might have been regression due to some package being
> updated but I could not find any meaningful culprit. 
> 
> I can paste the hidden BIOS HD audio settings for this configuration if
> that's of any use.
> 
> Kernel is 5.4.0-47-generic #51-Ubuntu SMP Fri Sep 4 19:50:52 UTC 2020 x86_64
> x86_64 x86_64 GNU/Linux
> 
> Distributor ID:       Ubuntu
> Description:  Ubuntu 20.04.1 LTS

Do you have any details for the time period that you did have sound? Was it a fresh install of Ubuntu 20.04.1? Did you allow internet updates during install? If you still have the ISO you used, I'd also like to confirm the hash of the file. If we can reproduce it, we'll be a lot closer to a solution.
Comment 13 pyronavi 2020-09-13 14:54:26 UTC
Also, regarding the advanced BIOS settings, there are several sound modes you switch the laptop into.

I tried a few but didn't get anything to work. I'm not very knowledgeable in this area though.

Accessing advanced BIOS is documented here:

>Advanced BIOS options can be accessed by going into more settings, hold down
>Fn and press each key horizontally from q to p, a to l, then z to m, let go of
>Fn and press F10. Click save changes and reboot into BIOS. Advanced settings
>will now be available.

https://wiki.archlinux.org/index.php/Lenovo_Legion_7i
Comment 14 Cameron Berkenpas 2020-09-13 18:09:44 UTC
For convenience, here's how to navigate to the audio settings under the advanced BIOS settings:
Advanced -> PCH-IO -> HD Audio Configuration

I going to attach pictures showing the top level Audio menu. There's quite a bit more settings under the sub-menus though.

It's worth mentioning that in my experience that many settings available under the advance BIOS settings do not seem to work. I haven't tried any of the audio settings yet (and there are quite a few), but in general many settings probably only apply to certain models of laptop aside from the Legion 7i. Presumably at least some of the audio settings should work though.
Comment 15 Cameron Berkenpas 2020-09-13 18:13:16 UTC
Created attachment 292497 [details]
Top half of top level audio level
Comment 16 Cameron Berkenpas 2020-09-13 18:13:45 UTC
Created attachment 292499 [details]
bottom half of the top level audio menu
Comment 17 Cameron Berkenpas 2020-09-14 19:41:14 UTC
About how long have you had your Legion? I've had mine since August 6th IIRC, and I've always had this problem. Could help narrow down the window.

Could this be possibly related to a BIOS update?

> A notable thing is that i *DID* have speaker audio for a couple of weeks
> (headphones have  always worked), until it suddenly stopped working again.
> My guess is that there might have been regression due to some package being
> updated but I could not find any meaningful culprit.
Comment 18 kernel.org 2020-09-14 20:10:22 UTC
(In reply to Cameron from comment #17)
> About how long have you had your Legion? I've had mine since August 6th
> IIRC, and I've always had this problem. Could help narrow down the window.
> 
> Could this be possibly related to a BIOS update?
> 
> > A notable thing is that i *DID* have speaker audio for a couple of weeks
> > (headphones have  always worked), until it suddenly stopped working again.
> > My guess is that there might have been regression due to some package being
> > updated but I could not find any meaningful culprit.

I got mine in the beginning of August. Updated immediately to 2.02 BIOS.

I had already prepared for not having sound as I had read the Arch Wiki page, and was really struck with a surprise as one day after playing with merely the ubuntu sound settings (fiddling with system sound volume) the speakers suddenly started working. I did not make any notes of the occasion as I assumed there might have been a recent kernel or some other package update, and did not expect any regressions to occur. But they did a couple of weeks later and that's when I found this ticket for ALC287.

What makes tracking this down a bit trickier than just booting with earlier kernel packages is that I have fiddled with both alsa and pulse on the system (e.g. tried different kernel module options for snd-hda-intel) so my working state was never a vanilla install with some updates. I will nevertheless try to get back to a working configuration with some kernel and report back.
Comment 19 Cameron Berkenpas 2020-09-14 20:31:04 UTC
I immediately upgraded to 2.02 as well... But tried reverting to the previous version (2.01 probably?) to test something unrelated. That didn't fix my issues.

Anyway, might be worth looking at /var/log/dpkg.log* to see what had been installed/updated around that time frame. I've skimmed through and so far the only thing that stands out are some pulse audio updates on July 23rd. So unless you don't update frequently, that's probably not it.

> What makes tracking this down a bit trickier than just booting with earlier
> kernel packages is that I have fiddled with both alsa and pulse on the
> system (e.g. tried different kernel module options for snd-hda-intel) so my
> working state was never a vanilla install with some updates. I will
> nevertheless try to get back to a working configuration with some kernel and
> report back.
Comment 20 bno1 2020-09-24 11:43:27 UTC
I'm having the same issue on a Lenovo Legion 7-15IMHg05. I just got it this week (22nd september) and installed Arch Linux on it straight away. I tried fiddling with alsamixer and pavucontrol settings, no change. I tried different kernel packages (linux 5.8.10, linux-lts 5.4.66, linux-xanmod 5.8.10/11), no dice. I did  not update the BIOS yet and the current version is "E9CN32WW(V2.00)", so this probably rules out a BIOS regression.

My alsa-info: http://alsa-project.org/db/?f=60beb004225ca38c49bb6a1495e6cd713a1a4f1e

I did not test the laptop with Windows yet, but I will try to do this soon.
Comment 21 pyronavi 2020-09-26 02:38:45 UTC
Perhaps there is a way to force ALSA to recognize the card as an ALC3306. As Fab mentioned, the specs do seem to indicate that as the sound device.
Comment 22 Cameron Berkenpas 2020-09-26 04:15:05 UTC
Did you find this in the documentation? I haven't found any references 
to ALC3306 on my system

Doing a quick search for ALC3306, the only references that come up are 
for the Lenovo Legion 7 and the Yoga Slim 7.  The ALC3306 seems to be 
pretty uncommon and pretty new.

Doing a bit of research, sounds like audio works on the Yoga Slim 7. 
Possibly a red herring..?

On 9/25/20 7:38 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #21 from pyronavi@gmail.com ---
> Perhaps there is a way to force ALSA to recognize the card as an ALC3306. As
> Fab mentioned, the specs do seem to indicate that as the sound device.
>
Comment 23 pyronavi 2020-09-26 14:43:15 UTC
(In reply to Cameron from comment #22)
> Did you find this in the documentation? I haven't found any references 
> to ALC3306 on my system
> 
> Doing a quick search for ALC3306, the only references that come up are 
> for the Lenovo Legion 7 and the Yoga Slim 7.  The ALC3306 seems to be 
> pretty uncommon and pretty new.
> 
> Doing a bit of research, sounds like audio works on the Yoga Slim 7. 
> Possibly a red herring..?
> 
> On 9/25/20 7:38 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #21 from pyronavi@gmail.com ---
> > Perhaps there is a way to force ALSA to recognize the card as an ALC3306.
> As
> > Fab mentioned, the specs do seem to indicate that as the sound device.
> >

My mistake. I must have seen "Legion 7" and mistaken it for the 7i.

Also, I have just sent an email to the members of the ALSA team. Hopefully someone will reply soon.
Comment 24 bno1 2020-09-26 18:34:46 UTC
> I did not test the laptop with Windows yet, but I will try to do this soon.

Tested now, it works fine on Windows. I also updated the bios to E9CN58WW(V4.03), still doesn't work on Linux.
Comment 25 Cameron Berkenpas 2020-09-26 19:25:47 UTC
I think the 7 and 7i are the same. In the case of the Legion 5/5i, the i 
differentiates between the AMD and Intel versions. However, I believe 
there's still no plans to make an AMD version of the Legion 7.

My point was that sound seems to work on the Yoga 7 under Linux, which 
also has the ALC3306 so maybe it's not related to the ALC3306 codec.

On 9/26/2020 7:43 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> My mistake. I must have seen "Legion 7" and mistaken it for the 7i.
Comment 26 eadali 2020-10-13 08:33:05 UTC
I am having same issue with Lenovo Legion 7. Another friend that use the same laptop also having that problem too. I hope they can fix this issue.
Comment 27 Fodor Zoltan 2020-10-30 18:06:46 UTC
I am also facing same issue on Ubuntu 20.04 with Legion 7i. Never worked on Linux. 

Alsa info http://alsa-project.org/db/?f=286348226d62d73c2aa3987794adfde7ef78095e
Linux archy-Lenovo-Legion-7-15IMHg05 5.9.2-050902-generic #202010290646 SMP Thu Oct 29 11:11:09 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Comment 28 Joe 2020-11-14 20:18:33 UTC
have same problem. yoga 7i.  have tried numerous kernels and distros.
Comment 29 pmensik 2020-11-19 16:35:35 UTC
I can confirm that the same problem is happening on Ubuntu 18.04 with Lenovo Legion 7, I would be really grateful for the fix.
Comment 30 Cameron Berkenpas 2020-11-19 17:41:33 UTC
Kubuntu 20.10 still has the same problem. Both with the vendor kernel, 5.8.18, and through 5.9.9.
Comment 31 Guido 2020-11-23 16:16:13 UTC
Tried on Pop_OS! with kernel 5.8.0 with same result. 
Is there anything we can do to help for this to be prioritized? I really want to get rid of that awful windows partition :/
Comment 32 Gorgo 2020-11-24 12:35:41 UTC
I'm abount to buy a Legion 7 but this problem worries me a bit. Any chance to have audio on Linux?
Comment 33 Cameron Berkenpas 2020-11-24 16:07:06 UTC
(In reply to gorghino from comment #32)
> I'm abount to buy a Legion 7 but this problem worries me a bit. Any chance
> to have audio on Linux?

If Linux is important to you, I would absolutely avoid this laptop. There seems to be zero interest in having this issue fixed I'm afraid.
Comment 34 Gorgo 2020-11-24 16:19:39 UTC
(In reply to Cameron from comment #33)
> (In reply to gorghino from comment #32)
> > I'm abount to buy a Legion 7 but this problem worries me a bit. Any chance
> > to have audio on Linux?
> 
> If Linux is important to you, I would absolutely avoid this laptop. There
> seems to be zero interest in having this issue fixed I'm afraid.

Well, the bug has been assigned to Jaroslav Kysela even if it's still not critical (are we too few?). Did you try to contact him for debugging?
Here(https://unix.stackexchange.com/questions/611530/how-can-i-get-my-unsupported-sound-card-to-work-with-alsa) and here (https://www.alsa-project.org/wiki/Help_To_Debug_Intel_HDA) there are some hints to start debugging the codec. I'd do it myself but I haven't bought it (yet? :D)
Comment 35 Gorgo 2020-11-24 17:46:37 UTC
Plus, are you sure that the Legion 7 15IMHg05 works with ALC287? PSREF from Lenovo website reports ALC3306 that is actually missing in sound/pci/hda/patch_realtek.c
Comment 36 Cameron Berkenpas 2020-11-24 19:49:26 UTC
I came across this today:
https://github.com/alsa-project/alsa-lib/issues/76

The last posts suggests that "amplifier chips for the integrated speakers" might be in use here which need to potentially initialized. That could explain why 3.5mm and bluetooth audio work: They don't need any such initialization.
Comment 37 Gorgo 2020-11-24 23:38:08 UTC
I guess perexg is Jaroslav Kysela though. (His email is perex[at]perex.cz) :)
@perex Any progress so far? I emailed kailang[at]realtek.com who actively commits on the kernel mainline with realtek updates.
Comment 38 blairduncan10 2020-12-15 16:37:50 UTC
Same problem for me on Legion 7i with Manjaro.
Comment 39 darnellkeithj 2020-12-16 01:44:23 UTC
Same here. No Audio from the speakers. I've tried multiple distros and upgrading to the latest 5.10 kernel. I'm using Lenovo Yoga Duet 7i
Comment 40 perish25 2020-12-18 04:46:15 UTC
Same here, Ubuntu 18.04, Lenovo Legion 7i, kernel v5.3, sound chip Realtek ACL287
Comment 41 Max 2020-12-20 19:58:40 UTC
Ubuntu 20.04, Legion 7i, the same issue with no sound from speakers
Comment 42 darnellkeithj 2020-12-20 21:00:44 UTC
I left Ubuntu for ArcoLinux and sound works. I installed their LTS Linux kernel and Intel microcode and sound came out of the left speaker only. Then, Lenovo pushed a firmware update this morning and sound works in both speakers. I don't know why an Arch fresh install works but the "easy windows conversion Linux OS" doesn't.
Comment 43 Jaroslav Kysela 2020-12-20 21:04:51 UTC
Guys, don't spam me (e-mail).

I don't have the detailed information about your hardware and it seems that the hardware vendors are using the amplifier chips for the integrated speakers on recent hardware which must be initialized, too. The linux support depends on the BIOS initialization (if any) at the moment.

The HDA codec setup in first comments for Legion 7i looks fine, but Realtek use many hidden (undocumented) registers to set some configuration parameters and may be some other chips (amplifiers) behind.

Contact Lenovo, if you can, for help (BIOS - Linux support). They are supporting more the non-gaming hardware in Linux (ThinkPad/ThinkStation series).

Also, adding David Ober from Lenovo to Cc.
Comment 44 Cameron Berkenpas 2020-12-20 23:47:14 UTC
(In reply to darnellkeithj from comment #42)
> I left Ubuntu for ArcoLinux and sound works. I installed their LTS Linux
> kernel and Intel microcode and sound came out of the left speaker only.
> Then, Lenovo pushed a firmware update this morning and sound works in both
> speakers. I don't know why an Arch fresh install works but the "easy windows
> conversion Linux OS" doesn't.

I downloaded the latest ISO and running it from USB with the latest BIOS update, sound still doesn't work at all for me. But maybe that's because their live image doesn't have the latest LTS kernel, firmware, microcode, etc?

With the latest BIOS, sound still doesn't for me under Kubuntu 20.10.
Comment 45 Cameron Berkenpas 2020-12-21 00:26:54 UTC
Seems the latest BIOS (E9CN60WW/v4.05) broke sound completely. I couldn't even get audio over my bluetooth speaker. Reverting back fixed it for me, however.
Comment 46 darnellkeithj 2020-12-21 01:50:03 UTC
(In reply to Cameron from comment #44)
> (In reply to darnellkeithj from comment #42)
> > I left Ubuntu for ArcoLinux and sound works. I installed their LTS Linux
> > kernel and Intel microcode and sound came out of the left speaker only.
> > Then, Lenovo pushed a firmware update this morning and sound works in both
> > speakers. I don't know why an Arch fresh install works but the "easy
> windows
> > conversion Linux OS" doesn't.
> 
> I downloaded the latest ISO and running it from USB with the latest BIOS
> update, sound still doesn't work at all for me. But maybe that's because
> their live image doesn't have the latest LTS kernel, firmware, microcode,
> etc?
> 
> With the latest BIOS, sound still doesn't for me under Kubuntu 20.10.

I can confirm that if you "install" or dual boot Arcolinux that sound will work. I just did a reinstall not less than an hour ago. Sound doesn't work from the live USB but will work if you install Arcolinux with the LTS kernel. However, I'm using the Yoga Duet 7i.
Comment 47 darnellkeithj 2020-12-21 01:55:05 UTC
(In reply to darnellkeithj from comment #46)
> (In reply to Cameron from comment #44)
> > (In reply to darnellkeithj from comment #42)
> > > I left Ubuntu for ArcoLinux and sound works. I installed their LTS Linux
> > > kernel and Intel microcode and sound came out of the left speaker only.
> > > Then, Lenovo pushed a firmware update this morning and sound works in
> both
> > > speakers. I don't know why an Arch fresh install works but the "easy
> > windows
> > > conversion Linux OS" doesn't.
> > 
> > I downloaded the latest ISO and running it from USB with the latest BIOS
> > update, sound still doesn't work at all for me. But maybe that's because
> > their live image doesn't have the latest LTS kernel, firmware, microcode,
> > etc?
> > 
> > With the latest BIOS, sound still doesn't for me under Kubuntu 20.10.
> 
> I can confirm that if you "install" or dual boot Arcolinux that sound will
> work. I just did a reinstall not less than an hour ago to make sure. Sound
> doesn't work from the live USB but will work if you install to hardware "with
> the LTS kernel". 
I'm using the Yoga Duet 7i and I don't know what the difference is between the LTS Kernel with Arch and Ubuntu's LTS version - but devs should be able to tell us pretty quickly.
Comment 48 Cameron Berkenpas 2020-12-21 02:08:49 UTC
On a related note, can you share the output of "uname -r"?

On 12/20/20 5:55 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #47 from darnellkeithj@gmail.com ---
> (In reply to darnellkeithj from comment #46)
>> (In reply to Cameron from comment #44)
>>> (In reply to darnellkeithj from comment #42)
>>>> I left Ubuntu for ArcoLinux and sound works. I installed their LTS Linux
>>>> kernel and Intel microcode and sound came out of the left speaker only.
>>>> Then, Lenovo pushed a firmware update this morning and sound works in
>> both
>>>> speakers. I don't know why an Arch fresh install works but the "easy
>>> windows
>>>> conversion Linux OS" doesn't.
>>> I downloaded the latest ISO and running it from USB with the latest BIOS
>>> update, sound still doesn't work at all for me. But maybe that's because
>>> their live image doesn't have the latest LTS kernel, firmware, microcode,
>>> etc?
>>>
>>> With the latest BIOS, sound still doesn't for me under Kubuntu 20.10.
>> I can confirm that if you "install" or dual boot Arcolinux that sound will
>> work. I just did a reinstall not less than an hour ago to make sure. Sound
>> doesn't work from the live USB but will work if you install to hardware
>> "with
>> the LTS kernel".
> I'm using the Yoga Duet 7i and I don't know what the difference is between
> the
> LTS Kernel with Arch and Ubuntu's LTS version - but devs should be able to
> tell
> us pretty quickly.
>
Comment 49 darnellkeithj 2020-12-21 02:19:25 UTC
(In reply to Cameron from comment #48)
> On a related note, can you share the output of "uname -r"?
> 
> On 12/20/20 5:55 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #47 from darnellkeithj@gmail.com ---
> > (In reply to darnellkeithj from comment #46)
> >> (In reply to Cameron from comment #44)
> >>> (In reply to darnellkeithj from comment #42)
> >>>> I left Ubuntu for ArcoLinux and sound works. I installed their LTS Linux
> >>>> kernel and Intel microcode and sound came out of the left speaker only.
> >>>> Then, Lenovo pushed a firmware update this morning and sound works in
> >> both
> >>>> speakers. I don't know why an Arch fresh install works but the "easy
> >>> windows
> >>>> conversion Linux OS" doesn't.
> >>> I downloaded the latest ISO and running it from USB with the latest BIOS
> >>> update, sound still doesn't work at all for me. But maybe that's because
> >>> their live image doesn't have the latest LTS kernel, firmware, microcode,
> >>> etc?
> >>>
> >>> With the latest BIOS, sound still doesn't for me under Kubuntu 20.10.
> >> I can confirm that if you "install" or dual boot Arcolinux that sound will
> >> work. I just did a reinstall not less than an hour ago to make sure. Sound
> >> doesn't work from the live USB but will work if you install to hardware
> >> "with
> >> the LTS kernel".
> > I'm using the Yoga Duet 7i and I don't know what the difference is between
> > the
> > LTS Kernel with Arch and Ubuntu's LTS version - but devs should be able to
> > tell
> > us pretty quickly.
> >

5.4.84-1-lts
Comment 50 Seblint 2020-12-24 07:54:08 UTC
Same thing here on my 2 yo Legion Y730. Sound-wise everything worked fine for 18 month when i was running ubuntu 18.10, then still good on 20.04.1 for a few weeks and about three weeks ago internal speakers stopped working (but sound works fine on headphones or bluetooth).
My kernel is 5.4.0-58 and sound chip Realtek ALC298.
Bios version : 8XCN24WW(V1.07)
Comment 51 David Ober 2020-12-24 08:08:39 UTC
Created attachment 294325 [details]
attachment-14871-0.html

I am on Holiday and will be returning on Jan 4 2021
Comment 52 Brian Long 2020-12-31 14:25:27 UTC
I have had the same problem since I got this laptop in late November.  It is a Yoga 7i.  I am on Ubuntu 20.10 with kernel 5.8.0.29.  I have tried 5.9.10 and 5.9.12 mainline kernels.

Everything appears "normal" except the sound just isn't coming out of the speakers.  It registers the card, shows up in pavucontrol as expected.  The sound output indicator even shows as if audio is playing.

I have dabbled with development of kernel modules in the past, but know nothing about audio codecs.  Let me know if you need any help from someone with the hardware and kernel experience.

It sounds like you may already know the culprit, but that it is not fixable without some specs.
Comment 53 Max 2021-01-06 21:20:39 UTC
Any updates so far?

There are several users who have the laptops with no-speaker-sound and a ready to help with hardware info if needed. Either Lenovo provided laptops for testing or the solution search is stuck

Please provide the approximate ETA
Comment 54 sski 2021-01-08 01:22:56 UTC
Joining the party. Just got Lenovo Legion 7i 15 w/ Realtek ALC287, speakers do not work. Very glad I found this thread -- I have tried so many things at this point.

I'm able to use my headphones at least.

Do we have any solutions ? Or updates?
Comment 55 QuantumTwitch 2021-01-13 01:37:12 UTC
Yay so glad I found this after all the stuff I tried before (documented here: https://forums.fedoraforum.org/showthread.php?325363-Lenovo-Thinkbook-no-sound-over-speakers-with-Fedora-33/page1).

Mine is a Thinkbook 13s with a Tiger Lake chip and High Definition (HD) Audio, Realtek® ALC3306 codec according to the spec sheet (https://psref.lenovo.com/syspool/Sys/PDF/ThinkBook/ThinkBook_13s_G2_ITL/ThinkBook_13s_G2_ITL_Spec.PDF). Same problem the built in speakers have no sound output even though the headphones and HDMI output sound just fine.

I even tried the latest vanilla kernel: 5.11.0-0.rc2.20210108gitf5e6c330254a.119.vanilla.1.fc33.x86_64 but still no sound from the speakers.
Comment 56 darnellkeithj 2021-01-16 01:38:25 UTC
Lastest LTS Kernel 5.4.89 breaks ACL287 on Lenovo Yoga Duet 7i. Until now, the only distro and kernel I've found to work with this model is Arch Linux, ArcoLinux to be specific, and 5.4.88-1-lts. I'm assuming this should also work for Legion 7i too.
Comment 57 Grigory Malivenko 2021-01-17 12:37:00 UTC
The same problem with Lenovo Legion 7 15IMH05 (ALC287). Any updates?
Comment 58 chenyh570 2021-01-18 02:10:01 UTC
Yoga 7i with alc287 audio, Ubuntu 20.04, latest stable kernel 5.10.7, no sound, same problem.
Comment 59 Jason Kukurudziak 2021-01-19 13:56:40 UTC
Same issue, 4 users in our company are getting these, tried Ubuntu and Arch with latest kernel. No joy. We can work around for now.
Comment 60 Thiago T 2021-01-19 21:19:52 UTC
Same issue here.
Ubuntu 20.04 on Legion 7i 15IMH05.
http://alsa-project.org/db/?f=67c03acf4f5a5f3fd4da996c6955f79f0d4734b8
Comment 61 chenyh570 2021-01-21 18:43:10 UTC
Also confirmed that yoga 7i 15inch with ubuntu 20.04 lts, 5.8.0 kernel has no sound as well.
Comment 62 Max 2021-02-03 16:16:16 UTC
Are there any updates? Cause, as I see, the issue appears to be not only 7i Legion notebooks and there are no updates for almost 7 month
Comment 63 chenyh570 2021-02-04 16:25:35 UTC
(In reply to Max from comment #62)
> Are there any updates? Cause, as I see, the issue appears to be not only 7i
> Legion notebooks and there are no updates for almost 7 month

Hi, I an curious too, as these models don't look like some rare model it seems. And I don't know why hasn't there be any solution nor updates yet, sadly alas.
Comment 64 Brian Long 2021-02-04 16:34:02 UTC
I want to reiterate my offer from an earlier comment to assist in any way to fix this.  Even give me hints at what source file and general changes would be required may be enough.  I can check it out and do some trial'n'error.
Comment 65 Jason Kukurudziak 2021-02-04 16:38:40 UTC
Created attachment 295069 [details]
attachment-20930-0.html

I think it was mentioned earlier that the sound chip uses some bits to
enable the amplifier section.  Bluetooth and the headphone jack are
unaffected.  You would have to probe the chip to find what bits have been
turned on in Windows to make the same changes in the linux driver.

On Thu, Feb 4, 2021 at 11:34 AM <bugzilla-daemon@bugzilla.kernel.org> wrote:

> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #64 from Brian Long (brian@yateslong.us) ---
> I want to reiterate my offer from an earlier comment to assist in any way
> to
> fix this.  Even give me hints at what source file and general changes
> would be
> required may be enough.  I can check it out and do some trial'n'error.
>
> --
> You may reply to this email to add a comment.
>
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 66 Thiago T 2021-02-04 17:09:10 UTC
This link (https://www.kernel.org/doc/html/v5.8/sound/alsa-configuration.html#module-snd-hda-inte) says the following:

If the default configuration doesn’t work and one of the above matches with your device, report it together with alsa-info.sh output (with --no-upload option) to kernel bugzilla or alsa-devel ML (see the section Links and Addresses).

Has anyone sent this to the alsa-devel mailing list?
Comment 67 Thiago T 2021-02-04 17:38:11 UTC
There has been some kernel fixes for ALC287 codec and Lenovo in December 2020
(https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c72b9bfe0f914639cc475585f45722a3eb57a56d).


It looks like the author Hui Wang <hui.wang@canonical.com> has experience with HDA codecs:


https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/?qt=author&q=Hui+Wang


Maybe he's the one to help us out investigating this bug.
Comment 68 Brian Long 2021-02-04 18:23:37 UTC
(In reply to TT from comment #67)
> There has been some kernel fixes for ALC287 codec and Lenovo in December 2020
> (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/
> ?id=c72b9bfe0f914639cc475585f45722a3eb57a56d).
> 
> 
> It looks like the author Hui Wang <hui.wang@canonical.com> has experience
> with HDA codecs:
> 
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/
> ?qt=author&q=Hui+Wang
> 
> 
> Maybe he's the one to help us out investigating this bug.

I saw those fixes from Hui back when I was trying out different kernel versions in Dec.  I feel he would ultimately fix this issue in time.  But time has gone on a bit too long.  So I wanted to see if it was more of lacking sample hardware that might be holding it back.

I see that the change is probably just a couple lines in this file: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/sound/pci/hda/patch_realtek.c?h=v5.10.13.

I just need to know the pins/values to try.  There are Thinkpad C940 quirks and the HP ALC287 quirk.  This one is different, but they serve as a good template.  Now, where do I get those pins?  My system is dual boot, so I can go into Windows.  Is there a tool I can run to enumerate possible pins/values?  Or do I reuse ones I am seeing here with subtle logic guesses?
Comment 69 Thiago T 2021-02-04 18:33:24 UTC
So which pins are you specifically talking about?

What about comparing to the Arch Linux configuration?
People mentioned here that the sound works with Arch Linux fresh installation.
Comment 70 Grigory Malivenko 2021-02-06 16:18:45 UTC
(In reply to TT from comment #69)
> So which pins are you specifically talking about?
> 
> What about comparing to the Arch Linux configuration?
> People mentioned here that the sound works with Arch Linux fresh
> installation.

I tried Arch Linux fresh installation + Lenovo Legion 7 15IMH05 and speakers don't work.
Comment 71 darnellkeithj 2021-02-07 18:31:20 UTC
(In reply to Grigory Malivenko from comment #70)
> (In reply to TT from comment #69)
> > So which pins are you specifically talking about?
> > 
> > What about comparing to the Arch Linux configuration?
> > People mentioned here that the sound works with Arch Linux fresh
> > installation.
> 
> I tried Arch Linux fresh installation + Lenovo Legion 7 15IMH05 and speakers
> don't work.

On my system, the Lenovo Yoga Duet 7i, volume doesn't work out of the box. I've not found any arch systems that have sound working out of the box. You must use earlier an earlier LTS kernel "5.4.88-1-lts". Upgrading to 5.4.89-1-lts and newer will break sound again. I'm not sure why this is such a big deal now since I've mentioned this. Devs could just use whatever works in 5.4.88 LTS and add it to newer kernels. Or tell us how to do it and I'll try myself.
Comment 72 Cameron Berkenpas 2021-02-07 20:24:49 UTC
Vanilla 5.4.88 doesn't resolve the issue, at least not for me on Kubuntu 
20.10. Earlier 5.4 kernels that I've tested in the past have not fixed 
the issue.

I'm not really familiar with Arch... but if I can find the Arch patchset 
for 5.4.88, I'll try it out and report back.

On 2/7/21 10:31 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #71 from darnellkeithj@gmail.com ---
> (In reply to Grigory Malivenko from comment #70)
>> (In reply to TT from comment #69)
>>> So which pins are you specifically talking about?
>>>
>>> What about comparing to the Arch Linux configuration?
>>> People mentioned here that the sound works with Arch Linux fresh
>>> installation.
>> I tried Arch Linux fresh installation + Lenovo Legion 7 15IMH05 and speakers
>> don't work.
> On my system, the Lenovo Yoga Duet 7i, volume doesn't work out of the box.
> I've
> not found any arch systems that have sound working out of the box. You must
> use
> earlier an earlier LTS kernel "5.4.88-1-lts". Upgrading to 5.4.89-1-lts and
> newer will break sound again. I'm not sure why this is such a big deal now
> since I've mentioned this. Devs could just use whatever works in 5.4.88 LTS
> and
> add it to newer kernels. Or tell us how to do it and I'll try myself.
>
Comment 73 darnellkeithj 2021-02-07 20:52:14 UTC
(In reply to Cameron from comment #72)
> Vanilla 5.4.88 doesn't resolve the issue, at least not for me on Kubuntu 
> 20.10. Earlier 5.4 kernels that I've tested in the past have not fixed 
> the issue.
> 
> I'm not really familiar with Arch... but if I can find the Arch patchset 
> for 5.4.88, I'll try it out and report back.
> 
> On 2/7/21 10:31 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #71 from darnellkeithj@gmail.com ---
> > (In reply to Grigory Malivenko from comment #70)
> >> (In reply to TT from comment #69)
> >>> So which pins are you specifically talking about?
> >>>
> >>> What about comparing to the Arch Linux configuration?
> >>> People mentioned here that the sound works with Arch Linux fresh
> >>> installation.
> >> I tried Arch Linux fresh installation + Lenovo Legion 7 15IMH05 and
> speakers
> >> don't work.
> > On my system, the Lenovo Yoga Duet 7i, volume doesn't work out of the box.
> > I've
> > not found any arch systems that have sound working out of the box. You must
> > use
> > earlier an earlier LTS kernel "5.4.88-1-lts". Upgrading to 5.4.89-1-lts and
> > newer will break sound again. I'm not sure why this is such a big deal now
> > since I've mentioned this. Devs could just use whatever works in 5.4.88 LTS
> > and
> > add it to newer kernels. Or tell us how to do it and I'll try myself.
> >

Then there must be some other differences with sound for the Legion 7i and the Yoga Duet 7i. Try removing sof-firmware and make sure it isn't muted in pavucontrol
Comment 74 Cameron Berkenpas 2021-02-07 21:20:35 UTC
I used the arch patches and kernel config to build the exact equivalent 
of 5.4.88-1-lts. This did not fix anything as expected as the 3 Arch 
patches were all unrelated to audio/alsa so this is not a surprise (one 
was to the documentation). Of course, I checked pavucontrol, alsamixer, 
etc. Made sure nothing was muted, played with the volumes in case it 
would "unstick" anything.

Either there are some differences between Yoga Duet 7i and the Lenovo 
Legion 7i and/or there's some important userspace differences. I suspect 
the former. But even if the Duet 7i has its sound issues addressed 
first, this could potentially go a long way towards helping to figure 
out what the Legion 7i needs. Can someone with a Duet confirm that 
vanilla 5.4.88 works and 5.4.89 does not? If so, bisecting should narrow 
down the issue.

On 2/7/21 12:52 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #73 from darnellkeithj@gmail.com ---
> (In reply to Cameron from comment #72)
>> Vanilla 5.4.88 doesn't resolve the issue, at least not for me on Kubuntu
>> 20.10. Earlier 5.4 kernels that I've tested in the past have not fixed
>> the issue.
>>
>> I'm not really familiar with Arch... but if I can find the Arch patchset
>> for 5.4.88, I'll try it out and report back.
>>
>> On 2/7/21 10:31 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>
>>> --- Comment #71 from darnellkeithj@gmail.com ---
>>> (In reply to Grigory Malivenko from comment #70)
>>>> (In reply to TT from comment #69)
>>>>> So which pins are you specifically talking about?
>>>>>
>>>>> What about comparing to the Arch Linux configuration?
>>>>> People mentioned here that the sound works with Arch Linux fresh
>>>>> installation.
>>>> I tried Arch Linux fresh installation + Lenovo Legion 7 15IMH05 and
>> speakers
>>>> don't work.
>>> On my system, the Lenovo Yoga Duet 7i, volume doesn't work out of the box.
>>> I've
>>> not found any arch systems that have sound working out of the box. You must
>>> use
>>> earlier an earlier LTS kernel "5.4.88-1-lts". Upgrading to 5.4.89-1-lts and
>>> newer will break sound again. I'm not sure why this is such a big deal now
>>> since I've mentioned this. Devs could just use whatever works in 5.4.88 LTS
>>> and
>>> add it to newer kernels. Or tell us how to do it and I'll try myself.
>>>
> Then there must be some other differences with sound for the Legion 7i and
> the
> Yoga Duet 7i. Try removing sof-firmware and make sure it isn't muted in
> pavucontrol
>
Comment 75 Thiago T 2021-02-07 21:53:43 UTC
What is the codec of the yoga duet 7i?
Is it also Realtek ALC287?

-Thiago

> On Feb 7, 2021, at 3:20 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
> 
> --- Comment #74 from Cameron (cam@neo-zeon.de) ---
> I used the arch patches and kernel config to build the exact equivalent 
> of 5.4.88-1-lts. This did not fix anything as expected as the 3 Arch 
> patches were all unrelated to audio/alsa so this is not a surprise (one 
> was to the documentation). Of course, I checked pavucontrol, alsamixer, 
> etc. Made sure nothing was muted, played with the volumes in case it 
> would "unstick" anything.
> 
> Either there are some differences between Yoga Duet 7i and the Lenovo 
> Legion 7i and/or there's some important userspace differences. I suspect 
> the former. But even if the Duet 7i has its sound issues addressed 
> first, this could potentially go a long way towards helping to figure 
> out what the Legion 7i needs. Can someone with a Duet confirm that 
> vanilla 5.4.88 works and 5.4.89 does not? If so, bisecting should narrow 
> down the issue.
> 
>> On 2/7/21 12:52 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>> 
>> --- Comment #73 from darnellkeithj@gmail.com ---
>> (In reply to Cameron from comment #72)
>>> Vanilla 5.4.88 doesn't resolve the issue, at least not for me on Kubuntu
>>> 20.10. Earlier 5.4 kernels that I've tested in the past have not fixed
>>> the issue.
>>> 
>>> I'm not really familiar with Arch... but if I can find the Arch patchset
>>> for 5.4.88, I'll try it out and report back.
>>> 
>>> On 2/7/21 10:31 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>> 
>>>> --- Comment #71 from darnellkeithj@gmail.com ---
>>>> (In reply to Grigory Malivenko from comment #70)
>>>>> (In reply to TT from comment #69)
>>>>>> So which pins are you specifically talking about?
>>>>>> 
>>>>>> What about comparing to the Arch Linux configuration?
>>>>>> People mentioned here that the sound works with Arch Linux fresh
>>>>>> installation.
>>>>> I tried Arch Linux fresh installation + Lenovo Legion 7 15IMH05 and
>>> speakers
>>>>> don't work.
>>>> On my system, the Lenovo Yoga Duet 7i, volume doesn't work out of the box.
>>>> I've
>>>> not found any arch systems that have sound working out of the box. You
>>>> must
>>>> use
>>>> earlier an earlier LTS kernel "5.4.88-1-lts". Upgrading to 5.4.89-1-lts
>>>> and
>>>> newer will break sound again. I'm not sure why this is such a big deal now
>>>> since I've mentioned this. Devs could just use whatever works in 5.4.88
>>>> LTS
>>>> and
>>>> add it to newer kernels. Or tell us how to do it and I'll try myself.
>>>> 
>> Then there must be some other differences with sound for the Legion 7i and
>> the
>> Yoga Duet 7i. Try removing sof-firmware and make sure it isn't muted in
>> pavucontrol
>> 
> 
> -- 
> You may reply to this email to add a comment.
> 
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 76 juliusvonkohout 2021-02-12 17:42:04 UTC
Sound works partially with updated fedora 33 on Yoga slim 7i 15 (Yoga Slim 7-15ITL05)
https://github.com/alsa-project/alsa-ucm-conf/issues/83
Comment 77 Jim33 2021-02-14 21:27:27 UTC
(In reply to Jaroslav Kysela from comment #43)

> Contact Lenovo, if you can, for help (BIOS - Linux support). They are
> supporting more the non-gaming hardware in Linux (ThinkPad/ThinkStation
> series).

I don't think there is much help to expect from Lenovo. I contacted support and after a detailed email explaining the issue on my dual boot Win/Linux system I got this:

"Thank you for your E-Mail. I will gladly help you.
Our devices are all tested to work with only windows, and no other OS.
If you have any other questions, I will gladly answer them."

Good that he will "gladly help me"...  ;-)

I have a Legion 7i running Ubuntu 20.04 default kernel.
If I would have knew this issue before I would have probably bought another laptop.
Comment 78 darnellkeithj 2021-02-14 22:20:34 UTC
(In reply to Jim33 from comment #77)
> (In reply to Jaroslav Kysela from comment #43)
> 
> > Contact Lenovo, if you can, for help (BIOS - Linux support). They are
> > supporting more the non-gaming hardware in Linux (ThinkPad/ThinkStation
> > series).
> 
> I don't think there is much help to expect from Lenovo. I contacted support
> and after a detailed email explaining the issue on my dual boot Win/Linux
> system I got this:
> 
> "Thank you for your E-Mail. I will gladly help you.
> Our devices are all tested to work with only windows, and no other OS.
> If you have any other questions, I will gladly answer them."
> 
> Good that he will "gladly help me"...  ;-)
> 
> I have a Legion 7i running Ubuntu 20.04 default kernel.
> If I would have knew this issue before I would have probably bought another
> laptop.

There needs to be a push by the linux community and possible litigation to force companies to provide documentation
Comment 79 Cameron Berkenpas 2021-02-14 23:24:57 UTC
Alas, I doubt litigation is on the table.

I also absolutely would not have purchased this laptop had I known sound 
support would have been an issue in Linux (or at least returned it 
within the first 30 days had I known 6 months later this would still be 
ongoing). I received mine back in August... Now I'm starting to eye new 
laptops already because I don't have any sound. However, now I'm also 
concerned that comparatively spec'ed laptops may also have sound issues 
potentially due to amplifier sound chips that could result in the same 
problem.

At some point in the near future, I may resort to purchasing new laptops 
and returning them within 30 days if there are any issues under Linux, 
because I simply can't assume they'll be addressed.

Lenovo not wanting to put any developer time into drivers doesn't 
necessarily mean they're refusing documentation. Perhaps a code bounty 
could work? I'd be willing to donate to that cause.

On 2/14/21 2:20 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #78 from darnellkeithj@gmail.com ---
> (In reply to Jim33 from comment #77)
>> (In reply to Jaroslav Kysela from comment #43)
>>
>>> Contact Lenovo, if you can, for help (BIOS - Linux support). They are
>>> supporting more the non-gaming hardware in Linux (ThinkPad/ThinkStation
>>> series).
>> I don't think there is much help to expect from Lenovo. I contacted support
>> and after a detailed email explaining the issue on my dual boot Win/Linux
>> system I got this:
>>
>> "Thank you for your E-Mail. I will gladly help you.
>> Our devices are all tested to work with only windows, and no other OS.
>> If you have any other questions, I will gladly answer them."
>>
>> Good that he will "gladly help me"...  ;-)
>>
>> I have a Legion 7i running Ubuntu 20.04 default kernel.
>> If I would have knew this issue before I would have probably bought another
>> laptop.
> There needs to be a push by the linux community and possible litigation to
> force companies to provide documentation
>
Comment 80 darnellkeithj 2021-02-14 23:39:35 UTC
(In reply to Cameron from comment #79)
> Alas, I doubt litigation is on the table.
> 
> I also absolutely would not have purchased this laptop had I known sound 
> support would have been an issue in Linux (or at least returned it 
> within the first 30 days had I known 6 months later this would still be 
> ongoing). I received mine back in August... Now I'm starting to eye new 
> laptops already because I don't have any sound. However, now I'm also 
> concerned that comparatively spec'ed laptops may also have sound issues 
> potentially due to amplifier sound chips that could result in the same 
> problem.
> 
> At some point in the near future, I may resort to purchasing new laptops 
> and returning them within 30 days if there are any issues under Linux, 
> because I simply can't assume they'll be addressed.
> 
> Lenovo not wanting to put any developer time into drivers doesn't 
> necessarily mean they're refusing documentation. Perhaps a code bounty 
> could work? I'd be willing to donate to that cause.
> 
> On 2/14/21 2:20 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #78 from darnellkeithj@gmail.com ---
> > (In reply to Jim33 from comment #77)
> >> (In reply to Jaroslav Kysela from comment #43)
> >>
> >>> Contact Lenovo, if you can, for help (BIOS - Linux support). They are
> >>> supporting more the non-gaming hardware in Linux (ThinkPad/ThinkStation
> >>> series).
> >> I don't think there is much help to expect from Lenovo. I contacted
> support
> >> and after a detailed email explaining the issue on my dual boot Win/Linux
> >> system I got this:
> >>
> >> "Thank you for your E-Mail. I will gladly help you.
> >> Our devices are all tested to work with only windows, and no other OS.
> >> If you have any other questions, I will gladly answer them."
> >>
> >> Good that he will "gladly help me"...  ;-)
> >>
> >> I have a Legion 7i running Ubuntu 20.04 default kernel.
> >> If I would have knew this issue before I would have probably bought
> another
> >> laptop.
> > There needs to be a push by the linux community and possible litigation to
> > force companies to provide documentation
> >

Do try to install Archlinux and use the kernel https://gitlab.com/manfromva/manfromva/-/tree/master/Kernels

I have a Duet 7i with the same sound system and I currently have sound. It didn't work for me on endeavoros but works with Arcolinux and Garuda so far.
Comment 81 Thiago T 2021-02-15 15:20:27 UTC
(In reply to darnellkeithj from comment #80)
> (In reply to Cameron from comment #79)
> > Alas, I doubt litigation is on the table.
> > 
> > I also absolutely would not have purchased this laptop had I known sound 
> > support would have been an issue in Linux (or at least returned it 
> > within the first 30 days had I known 6 months later this would still be 
> > ongoing). I received mine back in August... Now I'm starting to eye new 
> > laptops already because I don't have any sound. However, now I'm also 
> > concerned that comparatively spec'ed laptops may also have sound issues 
> > potentially due to amplifier sound chips that could result in the same 
> > problem.
> > 
> > At some point in the near future, I may resort to purchasing new laptops 
> > and returning them within 30 days if there are any issues under Linux, 
> > because I simply can't assume they'll be addressed.
> > 
> > Lenovo not wanting to put any developer time into drivers doesn't 
> > necessarily mean they're refusing documentation. Perhaps a code bounty 
> > could work? I'd be willing to donate to that cause.
> > 
> > On 2/14/21 2:20 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> > >
> > > --- Comment #78 from darnellkeithj@gmail.com ---
> > > (In reply to Jim33 from comment #77)
> > >> (In reply to Jaroslav Kysela from comment #43)
> > >>
> > >>> Contact Lenovo, if you can, for help (BIOS - Linux support). They are
> > >>> supporting more the non-gaming hardware in Linux (ThinkPad/ThinkStation
> > >>> series).
> > >> I don't think there is much help to expect from Lenovo. I contacted
> > support
> > >> and after a detailed email explaining the issue on my dual boot
> Win/Linux
> > >> system I got this:
> > >>
> > >> "Thank you for your E-Mail. I will gladly help you.
> > >> Our devices are all tested to work with only windows, and no other OS.
> > >> If you have any other questions, I will gladly answer them."
> > >>
> > >> Good that he will "gladly help me"...  ;-)
> > >>
> > >> I have a Legion 7i running Ubuntu 20.04 default kernel.
> > >> If I would have knew this issue before I would have probably bought
> > another
> > >> laptop.
> > > There needs to be a push by the linux community and possible litigation
> to
> > > force companies to provide documentation
> > >
> 
> Do try to install Archlinux and use the kernel
> https://gitlab.com/manfromva/manfromva/-/tree/master/Kernels
> 
> I have a Duet 7i with the same sound system and I currently have sound. It
> didn't work for me on endeavoros but works with Arcolinux and Garuda so far.

Do you mind posting the results of alsa-info?
I could not access the kernel link. Is it a private project?
Comment 82 darnellkeithj 2021-02-15 16:08:24 UTC
Try now. I had it on private for some reason. That is the official kernel and headers from arch Linux - arcolinux to be exact. I added them on gitlab because it's difficult to get older arch kernels. It Can be used with any Arch distro but I just ran into a bug where my speakers won't work after I connect Bluetooth headphones with Garuda Linux. I'm installing RebornOS Linux now and will try there. Worked just fine with Arcolinux and several other Arch distros.
Comment 83 darnellkeithj 2021-02-15 18:29:52 UTC
(In reply to TT from comment #81)
> (In reply to darnellkeithj from comment #80)
> > (In reply to Cameron from comment #79)
> > > Alas, I doubt litigation is on the table.
> > > 
> > > I also absolutely would not have purchased this laptop had I known sound 
> > > support would have been an issue in Linux (or at least returned it 
> > > within the first 30 days had I known 6 months later this would still be 
> > > ongoing). I received mine back in August... Now I'm starting to eye new 
> > > laptops already because I don't have any sound. However, now I'm also 
> > > concerned that comparatively spec'ed laptops may also have sound issues 
> > > potentially due to amplifier sound chips that could result in the same 
> > > problem.
> > > 
> > > At some point in the near future, I may resort to purchasing new laptops 
> > > and returning them within 30 days if there are any issues under Linux, 
> > > because I simply can't assume they'll be addressed.
> > > 
> > > Lenovo not wanting to put any developer time into drivers doesn't 
> > > necessarily mean they're refusing documentation. Perhaps a code bounty 
> > > could work? I'd be willing to donate to that cause.
> > > 
> > > On 2/14/21 2:20 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > > > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> > > >
> > > > --- Comment #78 from darnellkeithj@gmail.com ---
> > > > (In reply to Jim33 from comment #77)
> > > >> (In reply to Jaroslav Kysela from comment #43)
> > > >>
> > > >>> Contact Lenovo, if you can, for help (BIOS - Linux support). They are
> > > >>> supporting more the non-gaming hardware in Linux
> (ThinkPad/ThinkStation
> > > >>> series).
> > > >> I don't think there is much help to expect from Lenovo. I contacted
> > > support
> > > >> and after a detailed email explaining the issue on my dual boot
> > Win/Linux
> > > >> system I got this:
> > > >>
> > > >> "Thank you for your E-Mail. I will gladly help you.
> > > >> Our devices are all tested to work with only windows, and no other OS.
> > > >> If you have any other questions, I will gladly answer them."
> > > >>
> > > >> Good that he will "gladly help me"...  ;-)
> > > >>
> > > >> I have a Legion 7i running Ubuntu 20.04 default kernel.
> > > >> If I would have knew this issue before I would have probably bought
> > > another
> > > >> laptop.
> > > > There needs to be a push by the linux community and possible litigation
> > to
> > > > force companies to provide documentation
> > > >
> > 
> > Do try to install Archlinux and use the kernel
> > https://gitlab.com/manfromva/manfromva/-/tree/master/Kernels
> > 
> > I have a Duet 7i with the same sound system and I currently have sound. It
> > didn't work for me on endeavoros but works with Arcolinux and Garuda so
> far.
> 
> Do you mind posting the results of alsa-info?
> I could not access the kernel link. Is it a private project?

RebornOS didn't work for me but it may be to the lxqt version I installed. Manjaro works fine though.

http://alsa-project.org/db/?f=7a8ff2aaf9d780f1c2c68bc129db27a54d9e99d4
Comment 84 gurpreetsinghwalia5 2021-02-17 15:13:34 UTC
I have a lenovo yoga 7i. No sound from the in build speaker in ubuntu 20.10. Is there a solution for this ???
Comment 85 juliusvonkohout 2021-02-17 18:32:49 UTC
(In reply to gurpreetsinghwalia5 from comment #84)
> I have a lenovo yoga 7i. No sound from the in build speaker in ubuntu 20.10.
> Is there a solution for this ???

Yes, install fedora 33 and update everything. Then at least the bottom speakers will work.
Comment 86 gurpreetsinghwalia5 2021-02-17 19:30:06 UTC
(In reply to juliusvonkohout from comment #85)
> (In reply to gurpreetsinghwalia5 from comment #84)
> > I have a lenovo yoga 7i. No sound from the in build speaker in ubuntu
> 20.10.
> > Is there a solution for this ???
> 
> Yes, install fedora 33 and update everything. Then at least the bottom
> speakers will work.

Is there a debian distro that works ??? Need debian for work.
Comment 87 zbeckr 2021-02-17 21:33:41 UTC
(In reply to gurpreetsinghwalia5 from comment #86)
> (In reply to juliusvonkohout from comment #85)
> > (In reply to gurpreetsinghwalia5 from comment #84)
> > > I have a lenovo yoga 7i. No sound from the in build speaker in ubuntu
> > 20.10.
> > > Is there a solution for this ???
> > 
> > Yes, install fedora 33 and update everything. Then at least the bottom
> > speakers will work.
> 
>  there a debian distro that works ??? Need debian for work.

if your using a legion 7 (that's what I have).  My understanding is that there is no kernel support (I could be very wrong about this so anyone feel free to correct me).  I have used a few distros on my laptop and I use arco linux (its not debian I know) on the latest zen kernel.  I still don't have sound out the speakers, but headphones work.  So if you are fine with using headphones, any distro will work
Comment 88 Dan 2021-02-19 22:42:58 UTC
Hello,
I have same issue on my Lenovo-Legion-7-15IMH05.no sound on my speakers but are my analog headphones working... I have I7 10th gen.
Details info:
This script visits the following commands/files to collect diagnostic
information about your ALSA installation and sound related hardware.

  dmesg
  lspci
  aplay
  amixer
  alsactl
  rpm, dpkg
  /proc/asound/
  /sys/class/sound/
  ~/.asoundrc (etc.)

See '/usr/sbin/alsa-info --help' for command line options.

dmesg: read kernel buffer failed: Operation not permitted
Automatically upload ALSA information to www.alsa-project.org? [y/N] : y
Uploading information to www.alsa-project.org ... Done!

Your ALSA information is located at http://alsa-project.org/db/?f=4bde2ad92ca50dd71b38208c0580a40393503a0f
Please inform the person helping you

daniel@pop-os:~$ inxi -fxz
CPU:
Info: 6-Core model: Intel Core i7-10750H bits: 64 type: MT MCP arch: N/A
L2 cache: 12.0 MiB bogomips: 62399
Speed: 900 MHz min/max: 800/2600 MHz Core speeds (MHz): 1: 884 2: 866
3: 899 4: 809 5: 888 6: 885 7: 897 8: 878 9: 894 10: 864 11: 892 12: 897
Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat
arch_capabilities arch_perfmon art avx avx2 bmi1 bmi2 bts clflush
clflushopt cmov constant_tsc cpuid cpuid_fault cx16 cx8 de ds_cpl dtes64
dtherm dts epb ept ept_ad erms est f16c flexpriority flush_l1d fma fpu
fsgsbase fxsr ht hwp hwp_act_window hwp_epp hwp_notify ibpb ibrs
ibrs_enhanced ida intel_pt invpcid invpcid_single lahf_lm lm mca mce
md_clear mmx monitor movbe mpx msr mtrr nonstop_tsc nopl nx ospke pae pat
pbe pcid pclmulqdq pdcm pdpe1gb pebs pge pku pln pni popcnt pse pse36 pts
rdrand rdseed rdtscp rep_good sdbg sep smap smep ss ssbd sse sse2 sse4_1
sse4_2 ssse3 stibp syscall tm tm2 tpr_shadow tsc tsc_adjust
tsc_deadline_timer vme vmx vnmi vpid x2apic xgetbv1 xsave xsavec xsaveopt
xsaves xtopology xtpr
daniel@pop-os:~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC287 Analog [ALC287 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
Subdevices: 1/1
Subdevice #0: subdevice #0
daniel@pop-os:~$

**** List of PLAYBACK Hardware Devices ****
card 0: PCH [HDA Intel PCH], device 0: ALC287 Analog [ALC287 Analog]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 9: HDMI 3 [HDMI 3]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 10: HDMI 4 [HDMI 4]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 11: HDMI 5 [HDMI 5]
Subdevices: 1/1
Subdevice #0: subdevice #0
daniel@pop-os:~$ pacmd list-sinks
1 sink(s) available.
* index: 4
name: <alsa_output.pci-0000_00_1f.3.analog-stereo>
driver: <module-alsa-card.c>
flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY DYNAMIC_LATENCY
state: SUSPENDED
suspend cause: IDLE
priority: 9039
volume: front-left: 35030 / 53% / -16.32 dB, front-right: 35030 / 53% / -16.32 dB
balance 0.00
base volume: 65536 / 100% / 0.00 dB
volume steps: 65537
muted: no
current latency: 0.00 ms
max request: 0 KiB
max rewind: 0 KiB
monitor source: 5
sample spec: s16le 2ch 48000Hz
channel map: front-left,front-right
Stereo
used by: 0
linked by: 0
configured latency: 0.00 ms; range is 0.50 .. 2000.00 ms
card: 1 <alsa_card.pci-0000_00_1f.3>
module: 24
properties:
alsa.resolution_bits = "16"
device.api = "alsa"
device.class = "sound"
alsa.class = "generic"
alsa.subclass = "generic-mix"
alsa.name = "ALC287 Analog"
alsa.id = "ALC287 Analog"
alsa.subdevice = "0"
alsa.subdevice_name = "subdevice #0"
alsa.device = "0"
alsa.card = "0"
alsa.card_name = "HDA Intel PCH"
alsa.long_card_name = "HDA Intel PCH at 0x6014108000 irq 180"
alsa.driver_name = "snd_hda_intel"
device.bus_path = "pci-0000:00:1f.3"
sysfs.path = "/devices/pci0000:00/0000:00:1f.3/sound/card0"
device.bus = "pci"
device.vendor.id = "8086"
device.vendor.name = "Intel Corporation"
device.product.id = "06c8"
device.product.name = "Comet Lake PCH cAVS"
device.form_factor = "internal"
device.string = "front:0"
device.buffering.buffer_size = "384000"
device.buffering.fragment_size = "192000"
device.access_mode = "mmap+timer"
device.profile.name = "analog-stereo"
device.profile.description = "Analog Stereo"
device.description = "Built-in Audio Analog Stereo"
module-udev-detect.discovered = "1"
device.icon_name = "audio-card-pci"
ports:
analog-output-speaker: Speakers (priority 10000, latency offset 0 usec, available: no)
properties:
device.icon_name = "audio-speakers"
analog-output-headphones: Headphones (priority 9900, latency offset 0 usec, available: yes)
properties:
device.icon_name = "audio-headphones"
active port: <analog-output-headphones>
Comment 89 Memin 2021-03-02 14:56:21 UTC
Unfortunately I got the same issue. My headphones work on Ubuntu 20.04 but speakers didn't. In Windows 10 everything with sound is perfect.

OS: Ubuntu 20.04
description: Notebook
    product: 82EH (LENOVO_MT_82EH_BU_idea_FM_C7 15IMH05)
    vendor: LENOVO
    version: Lenovo C7 15IMH05
     *-firmware
          description: BIOS
          vendor: LENOVO
          physical id: 0
          version: E9CN62WW(V4.07)
          date: 01/21/2021
     *-cpu
          description: CPU
          product: Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz
          vendor: Intel Corp.
          physical id: 4
          bus info: cpu@0
          version: Intel(R) Core(TM) i7-10875H CPU @ 2.30GHz
Comment 90 Ian 2021-03-09 20:38:01 UTC
Created attachment 295777 [details]
Me too, but this may help
Comment 91 Jack S 2021-03-10 17:10:43 UTC
I also have this issue on (one version of) the Lenovo Yoga Slim 7 --- this model 82A3005RUK to be precise.  Happy to provide more details if needed.  Is it likely that this will be fixed in the near future?  I have to decide whether to wait or try to return the laptop.
Comment 92 Cameron Berkenpas 2021-03-10 17:49:17 UTC
You typically have 30 days to return a brand new laptop so keep that in 
mind.

If you do end up returning it, please be clear in your communication 
that it's due to the lack of working audio in Linux.  :)

On 3/10/21 9:10 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #91 from Jack S (jack.shotton@gmail.com) ---
> I also have this issue on (one version of) the Lenovo Yoga Slim 7 --- this
> model 82A3005RUK to be precise.  Happy to provide more details if needed.  Is
> it likely that this will be fixed in the near future?  I have to decide
> whether
> to wait or try to return the laptop.
>
Comment 93 Jack S 2021-03-10 17:55:46 UTC
(In reply to Cameron from comment #92)
> You typically have 30 days to return a brand new laptop so keep that in 
> mind.
> 
> If you do end up returning it, please be clear in your communication 
> that it's due to the lack of working audio in Linux.  :)
> 
> On 3/10/21 9:10 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #91 from Jack S (jack.shotton@gmail.com) ---
> > I also have this issue on (one version of) the Lenovo Yoga Slim 7 --- this
> > model 82A3005RUK to be precise.  Happy to provide more details if needed. 
> Is
> > it likely that this will be fixed in the near future?  I have to decide
> > whether
> > to wait or try to return the laptop.
> >

Thank you!  The third answer here: https://askubuntu.com/questions/1253498/no-sound-on-headphones-with-sof-hda-dsp-audio-on-ubuntu-and-variants to add the line

options snd-hda-intel model=auto

to

/etc/modprobe.d/alsa-base.conf

seems to have fixed it, so perhaps this is not the same bug after all (and I get to keep my laptop!).
Comment 94 Jaroslav Kysela 2021-03-10 18:59:42 UTC
(In reply to Jack S from comment #93)

> options snd-hda-intel model=auto

> seems to have fixed it, so perhaps this is not the same bug after all (and I
> get to keep my laptop!).

Something seems broken with the autodetection. Could you attach your 'alsa-info.sh --no-upload' output?
Comment 95 Jack S 2021-03-10 19:15:43 UTC
(In reply to Jaroslav Kysela from comment #94)
> (In reply to Jack S from comment #93)
> 
> > options snd-hda-intel model=auto
> 
> > seems to have fixed it, so perhaps this is not the same bug after all (and
> I
> > get to keep my laptop!).
> 
> Something seems broken with the autodetection. Could you attach your
> 'alsa-info.sh --no-upload' output?

Certainly -- here it is!

upload=true&script=true&cardinfo=
!!################################
!!ALSA Information Script v 0.5.0
!!################################

!!Script ran on: Wed Mar 10 19:14:12 UTC 2021


!!Linux Distribution
!!------------------

Ubuntu 20.10 \n \l DISTRIB_ID=Ubuntu DISTRIB_DESCRIPTION="Ubuntu 20.10" NAME="Ubuntu" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.10" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" UBUNTU_CODENAME=groovy


!!DMI Information
!!---------------

Manufacturer:      LENOVO
Product Name:      82A3
Product Version:   Yoga Slim 7 14ITL05
Firmware Version:  FBCN19WW
System SKU:        LENOVO_MT_82A3_BU_idea_FM_Yoga Slim 7 14ITL05
Board Vendor:      LENOVO
Board Name:        LNVNB161216


!!ACPI Device Status Information
!!---------------

/sys/bus/acpi/devices/ACPI000C:00/status 	 15
/sys/bus/acpi/devices/ACPI000E:00/status 	 15
/sys/bus/acpi/devices/ELAN0000:00/status 	 15
/sys/bus/acpi/devices/IDEA2002:00/status 	 15
/sys/bus/acpi/devices/IDEA2004:00/status 	 15
/sys/bus/acpi/devices/INT33A1:00/status 	 15
/sys/bus/acpi/devices/INT33D5:00/status 	 15
/sys/bus/acpi/devices/INT340E:00/status 	 15
/sys/bus/acpi/devices/INT34C5:00/status 	 15
/sys/bus/acpi/devices/INT3F0D:00/status 	 15
/sys/bus/acpi/devices/INTC1040:00/status 	 15
/sys/bus/acpi/devices/INTC1043:00/status 	 15
/sys/bus/acpi/devices/INTC1043:01/status 	 15
/sys/bus/acpi/devices/INTC6000:00/status 	 15
/sys/bus/acpi/devices/LHK2019:00/status 	 15
/sys/bus/acpi/devices/LNXPOWER:00/status 	 1
/sys/bus/acpi/devices/LNXPOWER:01/status 	 1
/sys/bus/acpi/devices/LNXPOWER:02/status 	 1
/sys/bus/acpi/devices/LNXPOWER:03/status 	 1
/sys/bus/acpi/devices/LNXPOWER:05/status 	 1
/sys/bus/acpi/devices/MSFT0001:00/status 	 15
/sys/bus/acpi/devices/PNP0103:00/status 	 15
/sys/bus/acpi/devices/PNP0C02:02/status 	 11
/sys/bus/acpi/devices/PNP0C02:04/status 	 11
/sys/bus/acpi/devices/PNP0C09:00/status 	 15
/sys/bus/acpi/devices/PNP0C0A:00/status 	 31
/sys/bus/acpi/devices/PRP00001:00/status 	 11
/sys/bus/acpi/devices/PRP00001:01/status 	 11
/sys/bus/acpi/devices/USBC000:00/status 	 15
/sys/bus/acpi/devices/VPC2004:00/status 	 15
/sys/bus/acpi/devices/device:00/status 	 15
/sys/bus/acpi/devices/device:17/status 	 15
/sys/bus/acpi/devices/device:24/status 	 15
/sys/bus/acpi/devices/device:25/status 	 15
/sys/bus/acpi/devices/device:26/status 	 15
/sys/bus/acpi/devices/device:95/status 	 15
/sys/bus/acpi/devices/device:96/status 	 15
/sys/bus/acpi/devices/device:97/status 	 15
/sys/bus/acpi/devices/device:99/status 	 15
/sys/bus/acpi/devices/device:9a/status 	 15
/sys/bus/acpi/devices/device:9b/status 	 15
/sys/bus/acpi/devices/device:a0/status 	 15
/sys/bus/acpi/devices/device:a8/status 	 15
/sys/bus/acpi/devices/device:aa/status 	 15
/sys/bus/acpi/devices/device:ac/status 	 15


!!Kernel Information
!!------------------

Kernel release:    5.8.0-44-generic
Operating System:  GNU/Linux
Architecture:      x86_64
Processor:         x86_64
SMP Enabled:       Yes


!!ALSA Version
!!------------

Driver version:     k5.8.0-44-generic
Library version:    1.2.3.2
Utilities version:  1.2.3


!!Loaded ALSA modules
!!-------------------

snd_soc_skl_hda_dsp (card 0)
snd_usb_audio (card 1)


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

Pulseaudio:
      Installed - Yes (/usr/bin/pulseaudio)
      Running - Yes


!!Soundcards recognised by ALSA
!!-----------------------------

 0 [sofhdadsp      ]: sof-hda-dsp - sof-hda-dsp
                      LENOVO-82A3-YogaSlim714ITL05-LNVNB161216
 1 [Device         ]: USB-Audio - USB Advanced Audio Device
                      C-Media Electronics Inc. USB Advanced Audio Device at usb-0000:00:14.0-3, full 


!!PCI Soundcards installed in the system
!!--------------------------------------

00:1f.3 Multimedia audio controller [0401]: Intel Corporation Tiger Lake-LP Smart Sound Technology Audio Controller [8086:a0c8] (rev 20)
	Subsystem: Lenovo Tiger Lake-LP Smart Sound Technology Audio Controller [17aa:3809]


!!Modprobe options (Sound related)
!!--------------------------------

snd_pcsp: index=-2
snd_usb_audio: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2
snd_atiixp_modem: index=-2
snd_intel8x0m: index=-2
snd_via82xx_modem: index=-2
snd_usb_audio: index=-2
snd_usb_caiaq: index=-2
snd_usb_ua101: index=-2
snd_usb_us122l: index=-2
snd_usb_usx2y: index=-2
snd_cmipci: mpu_port=0x330 fm_port=0x388
snd_pcsp: index=-2
snd_usb_audio: index=-2
snd_hda_intel: model=auto 


!!Loaded sound module options
!!---------------------------

!!Module: snd_soc_skl_hda_dsp
	* : 

!!Module: snd_usb_audio
	autoclock : Y
	delayed_register : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
	device_setup : 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	enable : Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y,Y
	id : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
	ignore_ctl_error : N
	index : -2,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	pid : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
	quirk_alias : (null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null),(null)
	skip_validation : N
	use_vmalloc : Y
	vid : -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1


!!Sysfs card info
!!---------------

!!Card: /sys/class/sound/card0
Driver: /sys/bus/platform/drivers/skl_hda_dsp_generic
Tree:
	/sys/class/sound/card0
	|-- controlC0
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- power
	|   |-- subsystem -> ../../../../../../../class/sound
	|   `-- uevent
	|-- device -> ../../../skl_hda_dsp_generic
	|-- hwC0D0
	|   |-- afg
	|   |-- chip_name
	|   |-- clear
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- driver_pin_configs
	|   |-- hints
	|   |-- init_pin_configs
	|   |-- init_verbs
	|   |-- mfg
	|   |-- modelname
	|   |-- power
	|   |-- power_off_acct
	|   |-- power_on_acct
	|   |-- reconfig
	|   |-- revision_id
	|   |-- subsystem -> ../../../../../../../class/sound
	|   |-- subsystem_id
	|   |-- uevent
	|   |-- user_pin_configs
	|   |-- vendor_id
	|   `-- vendor_name
	|-- hwC0D2
	|   |-- afg
	|   |-- chip_name
	|   |-- clear
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- driver_pin_configs
	|   |-- hints
	|   |-- init_pin_configs
	|   |-- init_verbs
	|   |-- mfg
	|   |-- modelname
	|   |-- power
	|   |-- power_off_acct
	|   |-- power_on_acct
	|   |-- reconfig
	|   |-- revision_id
	|   |-- subsystem -> ../../../../../../../class/sound
	|   |-- subsystem_id
	|   |-- uevent
	|   |-- user_pin_configs
	|   |-- vendor_id
	|   `-- vendor_name
	|-- id
	|-- input43
	|   |-- capabilities
	|   |-- device -> ../../card0
	|   |-- event18
	|   |-- id
	|   |-- modalias
	|   |-- name
	|   |-- phys
	|   |-- power
	|   |-- properties
	|   |-- subsystem -> ../../../../../../../class/input
	|   |-- uevent
	|   `-- uniq
	|-- input44
	|   |-- capabilities
	|   |-- device -> ../../card0
	|   |-- event19
	|   |-- id
	|   |-- modalias
	|   |-- name
	|   |-- phys
	|   |-- power
	|   |-- properties
	|   |-- subsystem -> ../../../../../../../class/input
	|   |-- uevent
	|   `-- uniq
	|-- input45
	|   |-- capabilities
	|   |-- device -> ../../card0
	|   |-- event20
	|   |-- id
	|   |-- modalias
	|   |-- name
	|   |-- phys
	|   |-- power
	|   |-- properties
	|   |-- subsystem -> ../../../../../../../class/input
	|   |-- uevent
	|   `-- uniq
	|-- input46
	|   |-- capabilities
	|   |-- device -> ../../card0
	|   |-- event21
	|   |-- id
	|   |-- modalias
	|   |-- name
	|   |-- phys
	|   |-- power
	|   |-- properties
	|   |-- subsystem -> ../../../../../../../class/input
	|   |-- uevent
	|   `-- uniq
	|-- input47
	|   |-- capabilities
	|   |-- device -> ../../card0
	|   |-- event22
	|   |-- id
	|   |-- modalias
	|   |-- name
	|   |-- phys
	|   |-- power
	|   |-- properties
	|   |-- subsystem -> ../../../../../../../class/input
	|   |-- uevent
	|   `-- uniq
	|-- number
	|-- pcmC0D0c
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../class/sound
	|   `-- uevent
	|-- pcmC0D0p
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../class/sound
	|   `-- uevent
	|-- pcmC0D1c
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../class/sound
	|   `-- uevent
	|-- pcmC0D1p
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../class/sound
	|   `-- uevent
	|-- pcmC0D3p
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../class/sound
	|   `-- uevent
	|-- pcmC0D4p
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../class/sound
	|   `-- uevent
	|-- pcmC0D5p
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../class/sound
	|   `-- uevent
	|-- pcmC0D6c
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../class/sound
	|   `-- uevent
	|-- pcmC0D7c
	|   |-- dev
	|   |-- device -> ../../card0
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../class/sound
	|   `-- uevent
	|-- power
	|   |-- async
	|   |-- autosuspend_delay_ms
	|   |-- control
	|   |-- runtime_active_kids
	|   |-- runtime_active_time
	|   |-- runtime_enabled
	|   |-- runtime_status
	|   |-- runtime_suspended_time
	|   `-- runtime_usage
	|-- subsystem -> ../../../../../../class/sound
	`-- uevent

!!Card: /sys/class/sound/card1
Driver: /sys/bus/usb/drivers/snd-usb-audio
Tree:
	/sys/class/sound/card1
	|-- controlC1
	|   |-- dev
	|   |-- device -> ../../card1
	|   |-- power
	|   |-- subsystem -> ../../../../../../../../../class/sound
	|   `-- uevent
	|-- device -> ../../../3-3:1.0
	|-- id
	|-- number
	|-- pcmC1D0c
	|   |-- dev
	|   |-- device -> ../../card1
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../../../class/sound
	|   `-- uevent
	|-- pcmC1D0p
	|   |-- dev
	|   |-- device -> ../../card1
	|   |-- pcm_class
	|   |-- power
	|   |-- subsystem -> ../../../../../../../../../class/sound
	|   `-- uevent
	|-- power
	|   |-- async
	|   |-- autosuspend_delay_ms
	|   |-- control
	|   |-- runtime_active_kids
	|   |-- runtime_active_time
	|   |-- runtime_enabled
	|   |-- runtime_status
	|   |-- runtime_suspended_time
	|   `-- runtime_usage
	|-- subsystem -> ../../../../../../../../class/sound
	`-- uevent


!!HDA-Intel Codec information
!!---------------------------
--startcollapse--

Codec: Realtek ALC287
Address: 0
AFG Function Id: 0x1 (unsol 1)
Vendor Id: 0x10ec0287
Subsystem Id: 0x17aa3809
Revision Id: 0x100002
No Modem Function Group found
Default PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power states:  D0 D1 D2 D3 D3cold CLKSTOP EPSS
  Power: setting=D0, actual=D0
GPIO: io=5, o=0, i=0, unsolicited=1, wake=0
  IO[0]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[1]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[2]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[3]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
  IO[4]: enable=0, dir=0, wake=0, sticky=0, data=0, unsol=0
Node 0x02 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Speaker Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
  Amp-Out vals:  [0x4f 0x4f]
  Converter: stream=1, channel=0
  PCM:
    rates [0x40]: 48000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x03 [Audio Output] wcaps 0x41d: Stereo Amp-Out
  Control: name="Headphone Playback Volume", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x57, nsteps=0x57, stepsize=0x02, mute=0
  Amp-Out vals:  [0x57 0x57]
  Converter: stream=1, channel=0
  PCM:
    rates [0x40]: 48000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x04 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x05 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x06 [Audio Output] wcaps 0x411: Stereo
  Converter: stream=0, channel=0
  PCM:
    rates [0x40]: 48000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x07 [Audio Input] wcaps 0x10051b: Stereo Amp-In
  Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1
  Amp-In vals:  [0x97 0x97]
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x40]: 48000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x24
Node 0x08 [Audio Input] wcaps 0x10051b: Stereo Amp-In
  Control: name="Capture Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Control: name="Capture Switch", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1
  Amp-In vals:  [0x80 0x80]
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x23
Node 0x09 [Audio Input] wcaps 0x10051b: Stereo Amp-In
  Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1
  Amp-In vals:  [0x97 0x97]
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x560]: 44100 48000 96000 192000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x22
Node 0x0a [Audio Input] wcaps 0x10051b: Stereo Amp-In
  Amp-In caps: ofs=0x17, nsteps=0x3f, stepsize=0x02, mute=1
  Amp-In vals:  [0x97 0x97]
  Converter: stream=0, channel=0
  SDI-Select: 0
  PCM:
    rates [0x40]: 48000
    bits [0xe]: 16 20 24
    formats [0x1]: PCM
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x25
Node 0x0b [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x0c [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x0d [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x0e [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x0f [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x10 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x11 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x12 [Pin Complex] wcaps 0x40040b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00000020: IN
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x13 [Pin Complex] wcaps 0x40040b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00000020: IN
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x14 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Control: name="Speaker Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x00010014: OUT EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x90170110: [Fixed] Speaker at Int N/A
    Conn = Analog, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x02
Node 0x15 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x16 [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x17 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x0000001c: OUT HP Detect
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 4
     0x02* 0x03 0x06 0x08
Node 0x18 [Pin Complex] wcaps 0x40048b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00000024: IN Detect
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x19 [Pin Complex] wcaps 0x40048b: Stereo Amp-In
  Control: name="Mic Boost Volume", index=0, device=0
    ControlAmp: chs=3, dir=In, idx=0, ofs=0
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00003724: IN Detect
    Vref caps: HIZ 50 GRD 80 100
  Pin Default 0x03a11030: [Jack] Mic at Ext Left
    Conn = 1/8, Color = Black
    DefAssociation = 0x3, Sequence = 0x0
  Pin-ctls: 0x24: IN VREF_80
  Unsolicited: tag=02, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x1a [Pin Complex] wcaps 0x40048b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Pincap 0x00003724: IN Detect
    Vref caps: HIZ 50 GRD 80 100
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00: VREF_HIZ
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x1b [Pin Complex] wcaps 0x40058f: Stereo Amp-In Amp-Out
  Amp-In caps: ofs=0x00, nsteps=0x03, stepsize=0x27, mute=0
  Amp-In vals:  [0x00 0x00]
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x00013734: IN OUT EAPD Detect
    Vref caps: HIZ 50 GRD 80 100
  EAPD 0x2: EAPD
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x00: VREF_HIZ
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x02* 0x03
Node 0x1c [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x1d [Pin Complex] wcaps 0x400400: Mono
  Pincap 0x00000020: IN
  Pin Default 0x40471a6d: [N/A] SPDIF Out at Ext N/A
    Conn = Analog, Color = Black
    DefAssociation = 0x6, Sequence = 0xd
  Pin-ctls: 0x20: IN
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x1e [Pin Complex] wcaps 0x400501: Stereo
  Pincap 0x00000010: OUT
  Pin Default 0x411111f0: [N/A] Speaker at Ext Rear
    Conn = 1/8, Color = Black
    DefAssociation = 0xf, Sequence = 0x0
    Misc = NO_PRESENCE
  Pin-ctls: 0x40: OUT
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 1
     0x06
Node 0x1f [Vendor Defined Widget] wcaps 0xf00000: Mono
Node 0x20 [Vendor Defined Widget] wcaps 0xf00040: Mono
  Processing caps: benign=0, ncoeff=142
Node 0x21 [Pin Complex] wcaps 0x40058d: Stereo Amp-Out
  Control: name="Headphone Playback Switch", index=0, device=0
    ControlAmp: chs=3, dir=Out, idx=0, ofs=0
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x80 0x80]
  Pincap 0x0001001c: OUT HP EAPD Detect
  EAPD 0x2: EAPD
  Pin Default 0x03211020: [Jack] HP Out at Ext Left
    Conn = 1/8, Color = Black
    DefAssociation = 0x2, Sequence = 0x0
  Pin-ctls: 0xc0: OUT HP
  Unsolicited: tag=01, enabled=1
  Power states:  D0 D1 D2 D3 EPSS
  Power: setting=D0, actual=D0
  Connection: 2
     0x02 0x03*
Node 0x22 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
  Connection: 5
     0x19 0x1a 0x1b 0x1d 0x13
Node 0x23 [Audio Mixer] wcaps 0x20010b: Stereo Amp-In
  Amp-In caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-In vals:  [0x00 0x00] [0x80 0x80] [0x80 0x80] [0x80 0x80] [0x80 0x80]
  Connection: 5
     0x19 0x1a 0x1b 0x1d 0x12
Node 0x24 [Audio Selector] wcaps 0x300101: Stereo
  Connection: 3
     0x12* 0x13 0x18
Node 0x25 [Audio Selector] wcaps 0x300101: Stereo
  Connection: 2
     0x12* 0x13
Codec: Intel Tigerlake HDMI
Address: 2
AFG Function Id: 0x1 (unsol 0)
Vendor Id: 0x80862812
Subsystem Id: 0x80860101
Revision Id: 0x100000
No Modem Function Group found
Default PCM:
    rates [0x0]:
    bits [0x0]:
    formats [0x0]:
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power states:  D0 D3 CLKSTOP EPSS
  Power: setting=D0, actual=D0, Clock-stop-OK
GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
Node 0x03 [Audio Output] wcaps 0x6611: 8-Channels Digital
  Converter: stream=0, channel=0
  Digital: Enabled KAE
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0x1a]: 16 24 32
    formats [0x5]: PCM AC3
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x04 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
Node 0x05 [Audio Output] wcaps 0x6611: 8-Channels Digital
  Converter: stream=0, channel=0
  Digital: Enabled KAE
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0x1a]: 16 24 32
    formats [0x5]: PCM AC3
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x06 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
Node 0x07 [Audio Output] wcaps 0x6611: 8-Channels Digital
  Converter: stream=0, channel=0
  Digital: Enabled KAE
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0x1a]: 16 24 32
    formats [0x5]: PCM AC3
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x08 [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
Node 0x09 [Audio Output] wcaps 0x6611: 8-Channels Digital
  Converter: stream=0, channel=0
  Digital: Enabled KAE
  Digital category: 0x0
  IEC Coding Type: 0x0
  PCM:
    rates [0x7f0]: 32000 44100 48000 88200 96000 176400 192000
    bits [0x1a]: 16 24 32
    formats [0x5]: PCM AC3
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
Node 0x0a [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
Node 0x0b [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
Node 0x0c [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
Node 0x0d [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
Node 0x0e [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
Node 0x0f [Pin Complex] wcaps 0x40778d: 8-Channels Digital Amp-Out CP
  Amp-Out caps: ofs=0x00, nsteps=0x00, stepsize=0x00, mute=1
  Amp-Out vals:  [0x00 0x00]
  Pincap 0x0b000094: OUT Detect HBR HDMI DP
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x00:
  Unsolicited: tag=00, enabled=0
  Power states:  D0 D3 EPSS
  Power: setting=D0, actual=D0
  Devices: 0
  Connection: 0
--endcollapse--


!!USB Descriptors
!!---------------
--startcollapse--

Bus 003 Device 002: ID 0d8c:016c C-Media Electronics, Inc. USB Advanced Audio Device
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               1.10
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        16
  idVendor           0x0d8c C-Media Electronics, Inc.
  idProduct          0x016c 
  bcdDevice            1.00
  iManufacturer           1 
  iProduct                2 
  iSerial                 0 
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0103
    bNumInterfaces          4
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      1 Control Device
      bInterfaceProtocol      0 
      iInterface              0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      1 (HEADER)
        bcdADC               1.00
        wTotalLength       0x006a
        bInCollection           2
        baInterfaceNr(0)        1
        baInterfaceNr(1)        2
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             1
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                12
        bDescriptorType        36
        bDescriptorSubtype      2 (INPUT_TERMINAL)
        bTerminalID             2
        wTerminalType      0x0201 Microphone
        bAssocTerminal          0
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             6
        wTerminalType      0x0301 Speaker
        bAssocTerminal          0
        bSourceID               9
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 9
        bDescriptorType        36
        bDescriptorSubtype      3 (OUTPUT_TERMINAL)
        bTerminalID             7
        wTerminalType      0x0101 USB Streaming
        bAssocTerminal          0
        bSourceID               8
        iTerminal               0 
      AudioControl Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      5 (SELECTOR_UNIT)
        bUnitID                 8
        bNrInPins               1
        baSourceID(0)          10
        iSelector               0 
      AudioControl Interface Descriptor:
        bLength                13
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                 9
        bSourceID              15
        bControlSize            2
        bmaControls(0)     0x0001
          Mute Control
        bmaControls(1)     0x0002
          Volume Control
        bmaControls(2)     0x0002
          Volume Control
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                10
        bSourceID               2
        bControlSize            1
        bmaControls(0)       0x01
          Mute Control
        bmaControls(1)       0x02
          Volume Control
        bmaControls(2)       0x02
          Volume Control
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                10
        bDescriptorType        36
        bDescriptorSubtype      6 (FEATURE_UNIT)
        bUnitID                13
        bSourceID               2
        bControlSize            1
        bmaControls(0)       0x01
          Mute Control
        bmaControls(1)       0x02
          Volume Control
        bmaControls(2)       0x02
          Volume Control
        iFeature                0 
      AudioControl Interface Descriptor:
        bLength                14
        bDescriptorType        36
        bDescriptorSubtype      4 (MIXER_UNIT)
        bUnitID                15
        bNrInPins               2
        baSourceID(0)           1
        baSourceID(1)          13
        bNrChannels             2
        wChannelConfig     0x0003
          Left Front (L)
          Right Front (R)
        iChannelNames           0 
        bmControls(0)        0x00
        iMixer                  0 
      Warning: Junk at end of descriptor (1 bytes):
        00 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           1
        bDelay                  1 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                14
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            2 Discrete
        tSamFreq[ 0]        44100
        tSamFreq[ 1]        48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes           13
          Transfer Type            Isochronous
          Synch Type               Synchronous
          Usage Type               Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         0 Undefined
          wLockDelay         0x0000
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       0
      bNumEndpoints           0
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        2
      bAlternateSetting       1
      bNumEndpoints           1
      bInterfaceClass         1 Audio
      bInterfaceSubClass      2 Streaming
      bInterfaceProtocol      0 
      iInterface              0 
      AudioStreaming Interface Descriptor:
        bLength                 7
        bDescriptorType        36
        bDescriptorSubtype      1 (AS_GENERAL)
        bTerminalLink           7
        bDelay                  1 frames
        wFormatTag         0x0001 PCM
      AudioStreaming Interface Descriptor:
        bLength                14
        bDescriptorType        36
        bDescriptorSubtype      2 (FORMAT_TYPE)
        bFormatType             1 (FORMAT_TYPE_I)
        bNrChannels             2
        bSubframeSize           2
        bBitResolution         16
        bSamFreqType            2 Discrete
        tSamFreq[ 0]        44100
        tSamFreq[ 1]        48000
      Endpoint Descriptor:
        bLength                 9
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            5
          Transfer Type            Isochronous
          Synch Type               Asynchronous
          Usage Type               Data
        wMaxPacketSize     0x00c8  1x 200 bytes
        bInterval               1
        bRefresh                0
        bSynchAddress           0
        AudioStreaming Endpoint Descriptor:
          bLength                 7
          bDescriptorType        37
          bDescriptorSubtype      1 (EP_GENERAL)
          bmAttributes         0x01
            Sampling Frequency
          bLockDelayUnits         0 Undefined
          wLockDelay         0x0000
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        3
      bAlternateSetting       0
      bNumEndpoints           1
      bInterfaceClass         3 Human Interface Device
      bInterfaceSubClass      0 
      bInterfaceProtocol      0 
      iInterface              0 
        HID Device Descriptor:
          bLength                 9
          bDescriptorType        33
          bcdHID               1.00
          bCountryCode            0 Not supported
          bNumDescriptors         1
          bDescriptorType        34 Report
          wDescriptorLength     104
         Report Descriptors: 
           ** UNAVAILABLE **
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x87  EP 7 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0010  1x 16 bytes
        bInterval               2
--endcollapse--


!!USB Stream information
!!----------------------
--startcollapse--

C-Media Electronics Inc. USB Advanced Audio Device at usb-0000:00:14.0-3, full  : USB Audio

Playback:
  Status: Stop
  Interface 1
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 1 OUT (SYNC)
    Rates: 44100, 48000
    Bits: 16
    Channel map: FL FR

Capture:
  Status: Stop
  Interface 2
    Altset 1
    Format: S16_LE
    Channels: 2
    Endpoint: 2 IN (ASYNC)
    Rates: 44100, 48000
    Bits: 16
    Channel map: FL FR
--endcollapse--


!!USB Mixer information
!!---------------------
--startcollapse--

USB Mixer: usb_id=0x0d8c016c, ctrlif=0, ctlerr=0
Card: C-Media Electronics Inc. USB Advanced Audio Device at usb-0000:00:14.0-3, full 
  Unit: 9
    Control: name="Speaker Playback Volume", index=0
    Info: id=9, control=2, cmask=0x3, channels=2, type="S16"
    Volume: min=-10240, max=0, dBmin=-4000, dBmax=0
  Unit: 9
    Control: name="Speaker Playback Switch", index=0
    Info: id=9, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
    Volume: min=0, max=1, dBmin=0, dBmax=0
  Unit: 10
    Control: name="Mic Capture Volume", index=0
    Info: id=10, control=2, cmask=0x3, channels=2, type="S16"
    Volume: min=0, max=8704, dBmin=0, dBmax=3400
  Unit: 10
    Control: name="Mic Capture Switch", index=0
    Info: id=10, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
    Volume: min=0, max=1, dBmin=0, dBmax=0
  Unit: 13
    Control: name="Mic Playback Volume", index=0
    Info: id=13, control=2, cmask=0x3, channels=2, type="S16"
    Volume: min=-2560, max=5632, dBmin=-1000, dBmax=2200
  Unit: 13
    Control: name="Mic Playback Switch", index=0
    Info: id=13, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
    Volume: min=0, max=1, dBmin=0, dBmax=0
--endcollapse--


!!ALSA Device nodes
!!-----------------

crw-rw----+ 1 root audio 116, 16 Mar 10 17:40 /dev/snd/controlC0
crw-rw----+ 1 root audio 116,  4 Mar 10 17:40 /dev/snd/controlC1
crw-rw----+ 1 root audio 116, 15 Mar 10 17:40 /dev/snd/hwC0D0
crw-rw----+ 1 root audio 116, 14 Mar 10 17:40 /dev/snd/hwC0D2
crw-rw----+ 1 root audio 116,  8 Mar 10 17:40 /dev/snd/pcmC0D0c
crw-rw----+ 1 root audio 116,  7 Mar 10 19:14 /dev/snd/pcmC0D0p
crw-rw----+ 1 root audio 116, 10 Mar 10 17:40 /dev/snd/pcmC0D1c
crw-rw----+ 1 root audio 116,  9 Mar 10 17:40 /dev/snd/pcmC0D1p
crw-rw----+ 1 root audio 116, 11 Mar 10 17:41 /dev/snd/pcmC0D3p
crw-rw----+ 1 root audio 116, 12 Mar 10 17:40 /dev/snd/pcmC0D4p
crw-rw----+ 1 root audio 116, 13 Mar 10 17:40 /dev/snd/pcmC0D5p
crw-rw----+ 1 root audio 116,  5 Mar 10 17:40 /dev/snd/pcmC0D6c
crw-rw----+ 1 root audio 116,  6 Mar 10 17:40 /dev/snd/pcmC0D7c
crw-rw----+ 1 root audio 116,  3 Mar 10 17:41 /dev/snd/pcmC1D0c
crw-rw----+ 1 root audio 116,  2 Mar 10 17:41 /dev/snd/pcmC1D0p
crw-rw----+ 1 root audio 116,  1 Mar 10 17:40 /dev/snd/seq
crw-rw----+ 1 root audio 116, 33 Mar 10 17:40 /dev/snd/timer

/dev/snd/by-id:
total 0
drwxr-xr-x 2 root root  60 Mar 10 17:40 .
drwxr-xr-x 4 root root 420 Mar 10 17:40 ..
lrwxrwxrwx 1 root root  12 Mar 10 17:40 usb-C-Media_Electronics_Inc._USB_Advanced_Audio_Device-00 -> ../controlC1

/dev/snd/by-path:
total 0
drwxr-xr-x 2 root root  80 Mar 10 17:40 .
drwxr-xr-x 4 root root 420 Mar 10 17:40 ..
lrwxrwxrwx 1 root root  12 Mar 10 17:40 pci-0000:00:14.0-usb-0:3:1.0 -> ../controlC1
lrwxrwxrwx 1 root root  12 Mar 10 17:40 pci-0000:00:1f.3-platform-skl_hda_dsp_generic -> ../controlC0


!!Aplay/Arecord output
!!--------------------

APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: sofhdadsp [sof-hda-dsp], device 0: HDA Analog (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 1: HDA Digital (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 3: HDMI1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 4: HDMI2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 5: HDMI3 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Device [USB Advanced Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

ARECORD

**** List of CAPTURE Hardware Devices ****
card 0: sofhdadsp [sof-hda-dsp], device 0: HDA Analog (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 1: HDA Digital (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 6: DMIC48kHz (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: sofhdadsp [sof-hda-dsp], device 7: DMIC16kHz (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Device [USB Advanced Audio Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

!!Amixer output
!!-------------

!!-------Mixer controls for card sofhdadsp

Card hw:0 'sofhdadsp'/'LENOVO-82A3-YogaSlim714ITL05-LNVNB161216'
  Mixer name	: 'Realtek ALC287'
  Components	: 'HDA:80862812,80860101,00100000 HDA:10ec0287,17aa3809,00100002 cfg-dmics:2'
  Controls      : 46
  Simple ctrls  : 18
Simple mixer control 'Master',0
  Capabilities: pvolume pvolume-joined pswitch pswitch-joined
  Playback channels: Mono
  Limits: Playback 0 - 87
  Mono: Playback 87 [100%] [0.00dB] [on]
Simple mixer control 'Headphone',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 87 [100%] [0.00dB] [off]
  Front Right: Playback 87 [100%] [0.00dB] [off]
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 87
  Mono:
  Front Left: Playback 79 [91%] [-6.00dB] [on]
  Front Right: Playback 79 [91%] [-6.00dB] [on]
Simple mixer control 'Mic Boost',0
  Capabilities: volume
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: 0 - 3
  Front Left: 0 [0%] [0.00dB]
  Front Right: 0 [0%] [0.00dB]
Simple mixer control 'IEC958',0
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958',1
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'IEC958',2
  Capabilities: pswitch pswitch-joined
  Playback channels: Mono
  Mono: Playback [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 63
  Front Left: Capture 0 [0%] [-17.25dB] [off]
  Front Right: Capture 0 [0%] [-17.25dB] [off]
Simple mixer control 'Auto-Mute Mode',0
  Capabilities: enum
  Items: 'Disabled' 'Enabled'
  Item0: 'Disabled'
Simple mixer control 'Dmic0',0
  Capabilities: cvolume cswitch
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 70
  Front Left: Capture 50 [71%] [0.00dB] [on]
  Front Right: Capture 50 [71%] [0.00dB] [on]
Simple mixer control 'Dmic1',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 70
  Front Left: Capture 50 [71%] [0.00dB]
  Front Right: Capture 50 [71%] [0.00dB]
Simple mixer control 'PGA1.0 1 Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]
Simple mixer control 'PGA2.0 2 Master',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 80
  Front Left: Capture 50 [62%] [0.00dB]
  Front Right: Capture 50 [62%] [0.00dB]
Simple mixer control 'PGA3.0 3 Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]
Simple mixer control 'PGA4.0 4 Master',0
  Capabilities: cvolume
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 80
  Front Left: Capture 50 [62%] [0.00dB]
  Front Right: Capture 50 [62%] [0.00dB]
Simple mixer control 'PGA7.0 7 Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]
Simple mixer control 'PGA8.0 8 Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]
Simple mixer control 'PGA9.0 9 Master',0
  Capabilities: pvolume
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 32
  Mono:
  Front Left: Playback 32 [100%] [0.00dB]
  Front Right: Playback 32 [100%] [0.00dB]

!!-------Mixer controls for card Device

Card hw:1 'Device'/'C-Media Electronics Inc. USB Advanced Audio Device at usb-0000:00:14.0-3, full '
  Mixer name	: 'USB Mixer'
  Components	: 'USB0d8c:016c'
  Controls      : 9
  Simple ctrls  : 2
Simple mixer control 'Speaker',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 40
  Mono:
  Front Left: Playback 20 [50%] [-20.00dB] [on]
  Front Right: Playback 20 [50%] [-20.00dB] [on]
Simple mixer control 'Mic',0
  Capabilities: pvolume cvolume pswitch pswitch-joined cswitch cswitch-joined
  Playback channels: Front Left - Front Right
  Capture channels: Front Left - Front Right
  Limits: Playback 0 - 32 Capture 0 - 34
  Front Left: Playback 10 [31%] [0.00dB] [off] Capture 34 [100%] [34.00dB] [on]
  Front Right: Playback 10 [31%] [0.00dB] [off] Capture 34 [100%] [34.00dB] [on]


!!Alsactl output
!!--------------

--startcollapse--
state.sofhdadsp {
	control.1 {
		iface MIXER
		name 'Headphone Playback Volume'
		value.0 87
		value.1 87
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 87'
			dbmin -6525
			dbmax 0
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.2 {
		iface MIXER
		name 'Headphone Playback Switch'
		value.0 false
		value.1 false
		comment {
			access 'read write'
			type BOOLEAN
			count 2
		}
	}
	control.3 {
		iface MIXER
		name 'Speaker Playback Volume'
		value.0 79
		value.1 79
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 87'
			dbmin -6525
			dbmax 0
			dbvalue.0 -600
			dbvalue.1 -600
		}
	}
	control.4 {
		iface MIXER
		name 'Speaker Playback Switch'
		value.0 true
		value.1 true
		comment {
			access 'read write'
			type BOOLEAN
			count 2
		}
	}
	control.5 {
		iface MIXER
		name 'Auto-Mute Mode'
		value Disabled
		comment {
			access 'read write'
			type ENUMERATED
			count 1
			item.0 Disabled
			item.1 Enabled
		}
	}
	control.6 {
		iface MIXER
		name 'Capture Volume'
		value.0 0
		value.1 0
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 63'
			dbmin -1725
			dbmax 3000
			dbvalue.0 -1725
			dbvalue.1 -1725
		}
	}
	control.7 {
		iface MIXER
		name 'Capture Switch'
		value.0 false
		value.1 false
		comment {
			access 'read write'
			type BOOLEAN
			count 2
		}
	}
	control.8 {
		iface MIXER
		name 'Mic Boost Volume'
		value.0 0
		value.1 0
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 3'
			dbmin 0
			dbmax 3000
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.9 {
		iface MIXER
		name 'Master Playback Volume'
		value 87
		comment {
			access 'read write'
			type INTEGER
			count 1
			range '0 - 87'
			dbmin -6525
			dbmax 0
			dbvalue.0 0
		}
	}
	control.10 {
		iface MIXER
		name 'Master Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.11 {
		iface CARD
		name 'Mic Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.12 {
		iface CARD
		name 'Headphone Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.13 {
		iface CARD
		name 'Speaker Phantom Jack'
		value true
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.14 {
		iface CARD
		name 'HDMI/DP,pcm=3 Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.15 {
		iface MIXER
		name 'IEC958 Playback Con Mask'
		value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.16 {
		iface MIXER
		name 'IEC958 Playback Pro Mask'
		value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.17 {
		iface MIXER
		name 'IEC958 Playback Default'
		value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access 'read write'
			type IEC958
			count 1
		}
	}
	control.18 {
		iface MIXER
		name 'IEC958 Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.19 {
		iface PCM
		device 3
		name ELD
		value ''
		comment {
			access 'read volatile'
			type BYTES
			count 0
		}
	}
	control.20 {
		iface CARD
		name 'HDMI/DP,pcm=4 Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.21 {
		iface MIXER
		name 'IEC958 Playback Con Mask'
		index 1
		value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.22 {
		iface MIXER
		name 'IEC958 Playback Pro Mask'
		index 1
		value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.23 {
		iface MIXER
		name 'IEC958 Playback Default'
		index 1
		value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access 'read write'
			type IEC958
			count 1
		}
	}
	control.24 {
		iface MIXER
		name 'IEC958 Playback Switch'
		index 1
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.25 {
		iface PCM
		device 4
		name ELD
		value ''
		comment {
			access 'read volatile'
			type BYTES
			count 0
		}
	}
	control.26 {
		iface CARD
		name 'HDMI/DP,pcm=5 Jack'
		value false
		comment {
			access read
			type BOOLEAN
			count 1
		}
	}
	control.27 {
		iface MIXER
		name 'IEC958 Playback Con Mask'
		index 2
		value '0fff000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.28 {
		iface MIXER
		name 'IEC958 Playback Pro Mask'
		index 2
		value '0f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access read
			type IEC958
			count 1
		}
	}
	control.29 {
		iface MIXER
		name 'IEC958 Playback Default'
		index 2
		value '0400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
		comment {
			access 'read write'
			type IEC958
			count 1
		}
	}
	control.30 {
		iface MIXER
		name 'IEC958 Playback Switch'
		index 2
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.31 {
		iface PCM
		device 5
		name ELD
		value ''
		comment {
			access 'read volatile'
			type BYTES
			count 0
		}
	}
	control.32 {
		iface PCM
		device 3
		name 'Playback Channel Map'
		value.0 0
		value.1 0
		value.2 0
		value.3 0
		value.4 0
		value.5 0
		value.6 0
		value.7 0
		comment {
			access 'read write'
			type INTEGER
			count 8
			range '0 - 36'
		}
	}
	control.33 {
		iface PCM
		device 4
		name 'Playback Channel Map'
		value.0 0
		value.1 0
		value.2 0
		value.3 0
		value.4 0
		value.5 0
		value.6 0
		value.7 0
		comment {
			access 'read write'
			type INTEGER
			count 8
			range '0 - 36'
		}
	}
	control.34 {
		iface PCM
		device 5
		name 'Playback Channel Map'
		value.0 0
		value.1 0
		value.2 0
		value.3 0
		value.4 0
		value.5 0
		value.6 0
		value.7 0
		comment {
			access 'read write'
			type INTEGER
			count 8
			range '0 - 36'
		}
	}
	control.35 {
		iface MIXER
		name 'PGA1.0 1 Master Playback Volume'
		value.0 32
		value.1 32
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 32'
			dbmin -9999999
			dbmax 0
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.36 {
		iface MIXER
		name 'PGA2.0 2 Master Capture Volume'
		value.0 50
		value.1 50
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 80'
			dbmin -9999999
			dbmax 3000
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.37 {
		iface MIXER
		name 'PGA3.0 3 Master Playback Volume'
		value.0 32
		value.1 32
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 32'
			dbmin -9999999
			dbmax 0
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.38 {
		iface MIXER
		name 'PGA4.0 4 Master Capture Volume'
		value.0 50
		value.1 50
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 80'
			dbmin -9999999
			dbmax 3000
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.39 {
		iface MIXER
		name 'PGA7.0 7 Master Playback Volume'
		value.0 32
		value.1 32
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 32'
			dbmin -9999999
			dbmax 0
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.40 {
		iface MIXER
		name 'PGA8.0 8 Master Playback Volume'
		value.0 32
		value.1 32
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 32'
			dbmin -9999999
			dbmax 0
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.41 {
		iface MIXER
		name 'PGA9.0 9 Master Playback Volume'
		value.0 32
		value.1 32
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 32'
			dbmin -9999999
			dbmax 0
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.42 {
		iface MIXER
		name 'Dmic0 Capture Volume'
		value.0 50
		value.1 50
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 70'
			dbmin -9999999
			dbmax 2000
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.43 {
		iface MIXER
		name 'Dmic0 Capture Switch'
		value.0 true
		value.1 true
		comment {
			access 'read write'
			type BOOLEAN
			count 2
		}
	}
	control.45 {
		iface MIXER
		name 'Dmic1 Capture Volume'
		value.0 50
		value.1 50
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 70'
			dbmin -9999999
			dbmax 2000
			dbvalue.0 0
			dbvalue.1 0
		}
	}
}
state.Device {
	control.1 {
		iface PCM
		name 'Playback Channel Map'
		value.0 0
		value.1 0
		comment {
			access read
			type INTEGER
			count 2
			range '0 - 36'
		}
	}
	control.2 {
		iface PCM
		name 'Capture Channel Map'
		value.0 0
		value.1 0
		comment {
			access read
			type INTEGER
			count 2
			range '0 - 36'
		}
	}
	control.3 {
		iface MIXER
		name 'Mic Playback Switch'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.4 {
		iface MIXER
		name 'Mic Playback Volume'
		value.0 10
		value.1 10
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 32'
			dbmin -1000
			dbmax 2200
			dbvalue.0 0
			dbvalue.1 0
		}
	}
	control.5 {
		iface MIXER
		name 'Speaker Playback Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.6 {
		iface MIXER
		name 'Speaker Playback Volume'
		value.0 20
		value.1 20
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 40'
			dbmin -4000
			dbmax 0
			dbvalue.0 -2000
			dbvalue.1 -2000
		}
	}
	control.7 {
		iface MIXER
		name 'Mic Capture Switch'
		value true
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
	control.8 {
		iface MIXER
		name 'Mic Capture Volume'
		value.0 34
		value.1 34
		comment {
			access 'read write'
			type INTEGER
			count 2
			range '0 - 34'
			dbmin 0
			dbmax 3400
			dbvalue.0 3400
			dbvalue.1 3400
		}
	}
	control.9 {
		iface CARD
		name 'Keep Interface'
		value false
		comment {
			access 'read write'
			type BOOLEAN
			count 1
		}
	}
}
--endcollapse--


!!All Loaded Modules
!!------------------

ac97_bus
acpi_pad
acpi_tad
acpi_thermal_rel
aesni_intel
af_alg
algif_hash
algif_skcipher
autofs4
bluetooth
bnep
btbcm
btintel
btrtl
btusb
ccm
cec
cfg80211
cmac
coretemp
crc32_pclmul
crct10dif_pclmul
cros_ec
cros_ec_ishtp
cryptd
crypto_simd
drm
drm_kms_helper
ecc
ecdh_generic
efi_pstore
elan_i2c
fb_sys_fops
ghash_clmulni_intel
glue_helper
hid
hid_generic
hid_logitech_dj
hid_logitech_hidpp
hid_multitouch
hid_sensor_als
hid_sensor_custom
hid_sensor_hub
hid_sensor_iio_common
hid_sensor_trigger
i2c_algo_bit
i2c_hid
i2c_i801
i2c_smbus
i915
ideapad_laptop
idma64
industrialio
industrialio_triggered_buffer
input_leds
int3400_thermal
int3403_thermal
int340x_thermal_zone
intel_cstate
intel_hid
intel_ish_ipc
intel_ishtp
intel_ishtp_hid
intel_ishtp_loader
intel_lpss
intel_lpss_pci
intel_powerclamp
intel_rapl_common
intel_rapl_msr
intel_soc_dts_iosf
ip_tables
iwlmvm
iwlwifi
joydev
kfifo_buf
kvm
kvm_intel
ledtrig_audio
libarc4
lp
mac80211
mac_hid
mc
mei
mei_hdcp
mei_me
nls_iso8859_1
nvme
nvme_core
parport
parport_pc
pinctrl_intel
pinctrl_tigerlake
ppdev
processor_thermal_device
rc_core
rfcomm
sch_fq_codel
serio_raw
snd
snd_compress
snd_hda_codec
snd_hda_codec_generic
snd_hda_codec_hdmi
snd_hda_codec_realtek
snd_hda_core
snd_hda_ext_core
snd_hda_intel
snd_hwdep
snd_intel_dspcfg
snd_pcm
snd_pcm_dmaengine
snd_rawmidi
snd_seq
snd_seq_device
snd_seq_midi
snd_seq_midi_event
snd_soc_acpi
snd_soc_acpi_intel_match
snd_soc_core
snd_soc_dmic
snd_soc_hdac_hda
snd_soc_hdac_hdmi
snd_soc_skl_hda_dsp
snd_sof
snd_sof_intel_byt
snd_sof_intel_hda
snd_sof_intel_hda_common
snd_sof_intel_ipc
snd_sof_pci
snd_sof_xtensa_dsp
snd_timer
snd_usb_audio
snd_usbmidi_lib
soundcore
sparse_keymap
syscopyarea
sysfillrect
sysimgblt
thunderbolt
typec
typec_ucsi
ucsi_acpi
usbhid
uvcvideo
video
videobuf2_common
videobuf2_memops
videobuf2_v4l2
videobuf2_vmalloc
videodev
virt_dma
wacom
wmi
wmi_bmof
x86_pkg_temp_thermal
x_tables
xhci_pci
xhci_pci_renesas


!!Sysfs Files
!!-----------

/sys/class/sound/hwC0D0/init_pin_configs:
0x12 0x411111f0
0x13 0x411111f0
0x14 0x90170110
0x17 0x411111f0
0x18 0x411111f0
0x19 0x03a11030
0x1a 0x411111f0
0x1b 0x411111f0
0x1d 0x40471a6d
0x1e 0x411111f0
0x21 0x03211020

/sys/class/sound/hwC0D0/driver_pin_configs:

/sys/class/sound/hwC0D0/user_pin_configs:

/sys/class/sound/hwC0D0/init_verbs:

/sys/class/sound/hwC0D0/hints:

/sys/class/sound/hwC0D2/init_pin_configs:
0x04 0x18560010
0x06 0x18560010
0x08 0x18560010
0x0a 0x18560010
0x0b 0x18560010
0x0c 0x18560010
0x0d 0x18560010
0x0e 0x18560010
0x0f 0x18560010

/sys/class/sound/hwC0D2/driver_pin_configs:

/sys/class/sound/hwC0D2/user_pin_configs:

/sys/class/sound/hwC0D2/init_verbs:

/sys/class/sound/hwC0D2/hints:


!!ALSA/HDA dmesg
!!--------------



!!Packages installed
!!--------------------

ii  alsa-topology-conf                         1.2.3-1                             all          ALSA topology configuration files
ii  alsa-ucm-conf                              1.2.2-1ubuntu5                      all          ALSA Use Case Manager configuration files
ii  alsa-utils                                 1.2.3-1ubuntu1                      amd64        Utilities for configuring and using ALSA
Comment 96 Jack S 2021-03-10 19:17:51 UTC
(In reply to Jack S from comment #95)
> (In reply to Jaroslav Kysela from comment #94)
> > (In reply to Jack S from comment #93)
> > 
> > > options snd-hda-intel model=auto
> > 
> > > seems to have fixed it, so perhaps this is not the same bug after all
> (and
> > I
> > > get to keep my laptop!).
> > 
> > Something seems broken with the autodetection. Could you attach your
> > 'alsa-info.sh --no-upload' output?
> 
> Certainly -- here it is!
> 

PS this is after applying the fix, let me know if you need me to unfix it and do the same.
Comment 97 wave 2021-03-14 13:43:55 UTC
I'm running Arch (5.11.5-arch1-1) on a Lenovo Yoga 7i and I managed to get audio to work with Realtek ALC287 under certain circumstances.

It works only after I suspend to RAM, and it disappears within around 7 seconds of not playing any audio (playing it muted is enough to keep it alive). I also have to start the playback within 7 seconds of resuming from suspend, or alternatively keep it running when suspending.

It does not work after suspending to disk, suspending to idle, or rebooting, but hybrid-sleep works. I did not have to blacklist or otherwise configure related kernel modules in /etc/modprobe.d, but I did have to enable S3 sleep by manipulating the DSDT table following https://wiki.archlinux.org/index.php/DSDT. Now I did not really know what I was doing because the patch in the article did not apply to the table on my system; I only changed a line reading "Name (SS3, Zero)" into "Name (SS3, One)", but it worked.

Incidentally my brightness keys are only recognized when suspending to RAM or disk, so it seems like there is some necessary initialization going on that are only correctly carried out during certain sleep states.

Here is a dmesg log, where I did the following:
start playing some audio (no sound)
# echo s2idle > /sys/power/mem_sleep
# echo mem > /sys/power/state
waking up (no sound)
# echo deep > /sys/power/mem_sleep
# echo mem > /sys/power/state
waking up (audio starts playing)
pausing and resuming after 7 seconds (no sound)

[ 2694.326411] PM: suspend entry (s2idle)
[ 2694.327335] Filesystems sync: 0.000 seconds
[ 2694.328229] Freezing user space processes ... (elapsed 0.001 seconds) done.
[ 2694.330054] OOM killer disabled.
[ 2694.330055] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 2694.331250] printk: Suspending console(s) (use no_console_suspend to debug)
[ 2695.134660] ACPI: EC: interrupt blocked
[ 2697.927155] ACPI: EC: interrupt unblocked
[ 2698.778671] pcieport 10000:e0:1d.0: can't derive routing for PCI INT A
[ 2698.778677] nvme 10000:e1:00.0: PCI INT A: no GSI
[ 2698.784394] nvme nvme0: 8/0/0 default/read/poll queues
[ 2699.383146] OOM killer enabled.
[ 2699.383149] Restarting tasks ... 
[ 2699.384141] mei_hdcp 0000:00:16.0-b638ab7e-94e2-4ea2-a552-d1c54b627f04: bound 0000:00:02.0 (ops i915_hdcp_component_ops [i915])
[ 2699.385242] done.
[ 2699.581393] thermal thermal_zone6: failed to read out thermal zone (-61)
[ 2699.582054] PM: suspend exit
[ 2716.865106] PM: suspend entry (deep)
[ 2716.866184] Filesystems sync: 0.001 seconds
[ 2716.866842] Freezing user space processes ... (elapsed 0.001 seconds) done.
[ 2716.868785] OOM killer disabled.
[ 2716.868786] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 2716.870059] printk: Suspending console(s) (use no_console_suspend to debug)
[ 2717.755405] ACPI: EC: interrupt blocked
[ 2717.793696] ACPI: Preparing to enter system sleep state S3
[ 2717.807740] ACPI: EC: event blocked
[ 2717.807741] ACPI: EC: EC stopped
[ 2717.807742] PM: Saving platform NVS memory
[ 2717.807869] Disabling non-boot CPUs ...
[ 2717.808450] migrate_one_irq: 4 callbacks suppressed
[ 2717.808454] IRQ149: set affinity failed(-22).
[ 2717.809504] smpboot: CPU 1 is now offline
[ 2717.811931] IRQ149: set affinity failed(-22).
[ 2717.812998] smpboot: CPU 2 is now offline
[ 2717.814258] IRQ149: set affinity failed(-22).
[ 2717.815316] smpboot: CPU 3 is now offline
[ 2717.817558] IRQ149: set affinity failed(-22).
[ 2717.818601] smpboot: CPU 4 is now offline
[ 2717.820319] IRQ149: set affinity failed(-22).
[ 2717.821351] smpboot: CPU 5 is now offline
[ 2717.823171] IRQ149: set affinity failed(-22).
[ 2717.824199] smpboot: CPU 6 is now offline
[ 2717.824753] IRQ149: set affinity failed(-22).
[ 2717.825784] smpboot: CPU 7 is now offline
[ 2717.832642] ACPI: Low-level resume complete
[ 2717.832773] ACPI: EC: EC started
[ 2717.832774] PM: Restoring platform NVS memory
[ 2717.833866] Enabling non-boot CPUs ...
[ 2717.833920] x86: Booting SMP configuration:
[ 2717.833921] smpboot: Booting Node 0 Processor 1 APIC 0x2
[ 2717.834897] CPU1 is up
[ 2717.834930] smpboot: Booting Node 0 Processor 2 APIC 0x4
[ 2717.836021] CPU2 is up
[ 2717.836051] smpboot: Booting Node 0 Processor 3 APIC 0x6
[ 2717.837138] CPU3 is up
[ 2717.837169] smpboot: Booting Node 0 Processor 4 APIC 0x1
[ 2717.838265] CPU4 is up
[ 2717.838287] smpboot: Booting Node 0 Processor 5 APIC 0x3
[ 2717.839239] CPU5 is up
[ 2717.839269] smpboot: Booting Node 0 Processor 6 APIC 0x5
[ 2717.840327] CPU6 is up
[ 2717.840348] smpboot: Booting Node 0 Processor 7 APIC 0x7
[ 2717.841434] CPU7 is up
[ 2717.843982] ACPI: Waking up from system sleep state S3
[ 2717.847213] ACPI: EC: interrupt unblocked
[ 2718.095228] ACPI: EC: event unblocked
[ 2718.095906] pcieport 10000:e0:1d.0: can't derive routing for PCI INT A
[ 2718.095911] nvme 10000:e1:00.0: PCI INT A: no GSI
[ 2718.108513] usb usb1: root hub lost power or was reset
[ 2718.108526] usb usb2: root hub lost power or was reset
[ 2718.166723] nvme nvme0: 8/0/0 default/read/poll queues
[ 2718.348451] usb 3-9: reset high-speed USB device number 3 using xhci_hcd
[ 2718.611863] usb 3-10: reset full-speed USB device number 4 using xhci_hcd
[ 2718.660745] ish-hid {33AECD58-B679-4E54-9BD9-A04D34F0C226}: [hid-ish]: enum_devices_done OK, num_hid_devices=2
[ 2718.875230] usb 3-8: reset high-speed USB device number 2 using xhci_hcd
[ 2719.032790] acpi LNXPOWER:06: Turning OFF
[ 2719.034182] OOM killer enabled.
[ 2719.034184] Restarting tasks ... done.
[ 2719.035966] mei_hdcp 0000:00:16.0-b638ab7e-94e2-4ea2-a552-d1c54b627f04: bound 0000:00:02.0 (ops i915_hdcp_component_ops [i915])
[ 2719.036941] thermal thermal_zone6: failed to read out thermal zone (-61)
[ 2719.081890] audit: type=1130 audit(1615728121.246:123): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 2719.131666] PM: suspend exit
[ 2719.132650] Bluetooth: hci0: Bootloader revision 0.4 build 0 week 30 2018
[ 2719.133690] Bluetooth: hci0: Device revision is 2
[ 2719.133696] Bluetooth: hci0: Secure boot is enabled
[ 2719.133698] Bluetooth: hci0: OTP lock is enabled
[ 2719.133700] Bluetooth: hci0: API lock is enabled
[ 2719.133701] Bluetooth: hci0: Debug lock is disabled
[ 2719.133702] Bluetooth: hci0: Minimum firmware build 1 week 10 2014
[ 2719.133986] Bluetooth: hci0: Found device firmware: intel/ibt-19-0-4.sfi
[ 2720.728153] Bluetooth: hci0: Waiting for firmware download to complete
[ 2720.728635] Bluetooth: hci0: Firmware loaded in 1559382 usecs
[ 2720.728662] Bluetooth: hci0: Waiting for device to boot
[ 2720.746620] Bluetooth: hci0: Device booted in 17562 usecs
[ 2720.746648] Bluetooth: hci0: Found Intel DDC parameters: intel/ibt-19-0-4.ddc
[ 2720.748628] Bluetooth: hci0: Applying Intel DDC parameters completed
[ 2720.751627] Bluetooth: hci0: Firmware revision 0.0 build 26 week 3 2021
[ 2724.086521] audit: type=1131 audit(1615728126.250:124): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=systemd-rfkill comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
[ 2750.480471] audit: type=1101 audit(1615728152.643:125): pid=66993 uid=1000 auid=1000 ses=1 msg='op=PAM:accounting grantors=pam_unix,pam_permit,pam_time acct="p" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/5 res=success'
[ 2750.481116] audit: type=1110 audit(1615728152.643:126): pid=66993 uid=1000 auid=1000 ses=1 msg='op=PAM:setcred grantors=pam_faillock,pam_permit,pam_env,pam_faillock acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/5 res=success'
[ 2750.481311] audit: type=1105 audit(1615728152.646:127): pid=66993 uid=1000 auid=1000 ses=1 msg='op=PAM:session_open grantors=pam_limits,pam_unix,pam_permit acct="root" exe="/usr/bin/sudo" hostname=? addr=? terminal=/dev/pts/5 res=success'

alsa-info.sh: http://alsa-project.org/db/?f=301a28d975ddbb2e2ea6631dcf59a236db05467d
Comment 98 Priyaranjan Sharma 2021-04-03 16:01:43 UTC
I don't have any sound on my Lenovo Yoga 7i 15" with Fedora 33. 
Tried Suse, Ubuntu and Mint as well and it is same result.
Comment 99 lauchgott 2021-04-07 19:30:18 UTC
i would like to attach myself to the problem. 

New Lenovo Legion 7, no Sound on Manjaro or Ubuntu, not on Live-USB, not on installed OS. Headphones working perfectly, Speakers giving no sound at all. 
Has there been any kind of solution by now?

I am still in my 30-days trial-period, am very happy with this machine, but do all my development for work on linux. if possible, i would love to avoid sending it back and buy another machine.
Comment 100 wave 2021-04-08 19:31:14 UTC
Did anyone else with the problem try my "workaround" from comment #97? It's actually not too bad, I just suspend whenever I need audio from my speakers and play some music muted in the background in a loop to keep it alive in case playback is interrupted. Not perfect but usable.
Comment 101 Cameron Berkenpas 2021-04-08 20:59:44 UTC
This workaround doesn't work with the Legion 7i, unfortunately.

On 4/8/21 12:31 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #100 from wave (zanto98@yahoo.de) ---
> Did anyone else with the problem try my "workaround" from comment #97? It's
> actually not too bad, I just suspend whenever I need audio from my speakers
> and
> play some music muted in the background in a loop to keep it alive in case
> playback is interrupted. Not perfect but usable.
>
Comment 102 wave 2021-04-09 06:22:12 UTC
(In reply to Cameron from comment #101)
> This workaround doesn't work with the Legion 7i, unfortunately.
> 
> On 4/8/21 12:31 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #100 from wave (zanto98@yahoo.de) ---
> > Did anyone else with the problem try my "workaround" from comment #97? It's
> > actually not too bad, I just suspend whenever I need audio from my speakers
> > and
> > play some music muted in the background in a loop to keep it alive in case
> > playback is interrupted. Not perfect but usable.
> >

But you do get S3 sleep when suspending or managed to activate it?
Comment 103 Cameron Berkenpas 2021-04-09 15:48:04 UTC
Yes:
[122708.265368] ACPI: Preparing to enter system sleep state S3
[122708.333271] ACPI: Waking up from system sleep state S3
Comment 104 chenyh570 2021-04-09 17:57:58 UTC
(In reply to wave from comment #100)
> Did anyone else with the problem try my "workaround" from comment #97? It's
> actually not too bad, I just suspend whenever I need audio from my speakers
> and play some music muted in the background in a loop to keep it alive in
> case playback is interrupted. Not perfect but usable.

I have 14inch yoga 7i, and unfortunately it doesn't work for me. I am running 5.10 kernel
Comment 105 wave 2021-04-10 07:00:45 UTC
(In reply to chenyh570 from comment #104)
> (In reply to wave from comment #100)
> > Did anyone else with the problem try my "workaround" from comment #97? It's
> > actually not too bad, I just suspend whenever I need audio from my speakers
> > and play some music muted in the background in a loop to keep it alive in
> > case playback is interrupted. Not perfect but usable.
> 
> I have 14inch yoga 7i, and unfortunately it doesn't work for me. I am
> running 5.10 kernel

I have the same model and it worked with the same kernel on Arch. Which OS did you try?
Unfortunately kernel 5.11.12 broke my S3 sleep again and my previous fix doesn't work, completely breaking speaker audio for me again.
Comment 106 chenyh570 2021-04-10 15:58:45 UTC
(In reply to wave from comment #105)
> (In reply to chenyh570 from comment #104)
> > (In reply to wave from comment #100)
> > > Did anyone else with the problem try my "workaround" from comment #97?
> It's
> > > actually not too bad, I just suspend whenever I need audio from my
> speakers
> > > and play some music muted in the background in a loop to keep it alive in
> > > case playback is interrupted. Not perfect but usable.
> > 
> > I have 14inch yoga 7i, and unfortunately it doesn't work for me. I am
> > running 5.10 kernel
> 
> I have the same model and it worked with the same kernel on Arch. Which OS
> did you try?
> Unfortunately kernel 5.11.12 broke my S3 sleep again and my previous fix
> doesn't work, completely breaking speaker audio for me again.

I am running Ubuntu 20.04.2LTS, and I rolled back to kernel version 5.10.04 recently from 5.11, as the 5.11.12 made my microphone un-usable.
Comment 107 wave 2021-04-11 07:12:34 UTC
(In reply to chenyh570 from comment #106)
> (In reply to wave from comment #105)
> > (In reply to chenyh570 from comment #104)
> > > (In reply to wave from comment #100)
> > > > Did anyone else with the problem try my "workaround" from comment #97?
> > It's
> > > > actually not too bad, I just suspend whenever I need audio from my
> > speakers
> > > > and play some music muted in the background in a loop to keep it alive
> in
> > > > case playback is interrupted. Not perfect but usable.
> > > 
> > > I have 14inch yoga 7i, and unfortunately it doesn't work for me. I am
> > > running 5.10 kernel
> > 
> > I have the same model and it worked with the same kernel on Arch. Which OS
> > did you try?
> > Unfortunately kernel 5.11.12 broke my S3 sleep again and my previous fix
> > doesn't work, completely breaking speaker audio for me again.
> 
> I am running Ubuntu 20.04.2LTS, and I rolled back to kernel version 5.10.04
> recently from 5.11, as the 5.11.12 made my microphone un-usable.

And what does
cat /sys/power/mem_sleep
say?
Comment 108 chenyh570 2021-04-11 15:31:29 UTC
it saids "[s2idle]"
Comment 109 wave 2021-04-11 15:53:56 UTC
(In reply to chenyh570 from comment #108)
> it saids "[s2idle]"

In this case S3 sleep is deactivated. You could try to follow the section "Manual method" in https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Yoga_(Gen_3)#Enabling_S3_(with_BIOS_version_1.33_and_after), but instead of the patch it says there just replace
   Name (SS3, Zero)
with
   Name (SS3, One)
and in a line at the top like
   DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000002)
you need to increment the last number (change it to 0x00000003 in this case). This is what it took for me to get S3 sleep working, and then right after suspending the speakers work if playback is started within a magical window of a few seconds.
Comment 110 esanchez 2021-04-27 13:22:24 UTC
Hi, 

Same error with Lenovo Yoga 7i 14"intel.
Tested with Ubuntu 20.04LTS and Ubuntu 21.04 and no sound from internal speakers, meanwhile the headphones works perfectly.
Comment 111 David Ober 2021-04-27 13:37:26 UTC
Created attachment 296485 [details]
attachment-29900-0.html

I am on Holiday and will be returning on April 29 2021
Comment 112 Seblint 2021-04-28 07:19:59 UTC
Hi,

I have no idea why or how but internal speakers are working again on my Legion y730. Since i posted here back in december i didn't work on that issue and i realized they were working again only this morning (as my headphones were almost always plugged in) so it might have happened before.

Only things i did this past few weeks that might have helped are : upgrade nvidia drivers, install winetricks, upgrade kernel to 5.8.0-50 generic

If anyone needs more info on my system, i'm happy to help.
Comment 113 Chris 2021-04-28 19:35:21 UTC
Just throwing it out there, issue exists for me on Legion Y740S

OS: Linuxmint 20.1 ulyssa
Kernel: x86_64 Linux 5.4.0-72-generic
UBUNTU_CODENAME=focal

also using ALC287.
Comment 114 bert 2021-04-29 09:53:36 UTC

Bert

I have an error with Lenovo Legion-7 15IM05.

I tried with Ubuntu 21.04, Mint 20.1, Manjaro, EndeavourOS.

No sound from the internal speakers, the headphones works well.

Using ALC287.
Comment 115 Guido 2021-04-30 15:53:21 UTC
It's hard to understand how after almost a year we still don't have support for a high end laptop from a company like lenovo on linux. Especially on something as important as sound.
Comment 116 lazertag 2021-05-03 21:31:56 UTC
Just wanted to join in on the bandwagon here and follow any possible progress.  Look forward to hearing sound from my laptop speakers someday in Ubuntu. ;)

Lenovo Yoga 7-14ITL5 model # 82BH0006US

Like others my headphones via 1/8 jack seem to work fine but not a lick of sound from the built in speakers.  Lots of trying suggestions noted throughout this thread to no avail. Playing sound while selected on speakers it looks like there is activity just no sound of course.

hdaJackRetask seems to not work at all on my unit and hangs quite often where you have to force quit.  I was hopeful trying to use it might find some workaround. Anyway not sure if that says anything about the issue.
Comment 117 geoffrey.vl 2021-05-04 20:14:54 UTC
Same issue occurs on Lenovo Legion 7 16ACHg6 (2021) which is reported to have a Realtek ALC3306 when running Ubuntu 21.04 and upgraded 5.12 kernel.
Note that sound does work through the headphones connector.
Comment 118 Cameron Berkenpas 2021-05-04 20:17:27 UTC
Thanks for the info! I was considering one of these since I want to 
replace this laptop, but was concerned that it would have the same issue.

On 5/4/21 1:14 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> geoffrey.vl@gmail.com changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |geoffrey.vl@gmail.com
>
> --- Comment #117 from geoffrey.vl@gmail.com ---
> Same issue occurs on Lenovo Legion 7 16ACHg6 (2021) which is reported to have
> a
> Realtek ALC3306 when running Ubuntu 21.04 and upgraded 5.12 kernel.
> Note that sound does work through the headphones connector.
>
Comment 119 Vincent Morel 2021-05-06 12:57:08 UTC
Hello!
Just want to add the exact same problem occur on my new Lenovo Think Book 13s Gen 2 i7. I also saw on the internet some people having this problem with HP or Dell, seems related also to the Tiger Lake arch...
Really weird as everythin is working under Windows...
I tried Ubuntu, Ubuntu Studio, Calculate (Gentoo), different kernel...
I'm on Pop Os 

hwinfo --sound
16: PCI 1f.3: 0401 Multimedia audio controller                  
  [Created at pci.386]
  Unique ID: nS1_.Vo0SeQ2FdpF
  SysFS ID: /devices/pci0000:00/0000:00:1f.3
  SysFS BusID: 0000:00:1f.3
  Hardware Class: sound
  Model: "Intel Tiger Lake-LP Smart Sound Technology Audio Controller"
  Vendor: pci 0x8086 "Intel Corporation"
  Device: pci 0xa0c8 "Tiger Lake-LP Smart Sound Technology Audio Controller"
  SubVendor: pci 0x17aa "Lenovo"
  SubDevice: pci 0x3817 
  Revision: 0x20
  Driver: "sof-audio-pci"
  Driver Modules: "snd_sof_pci"
  Memory Range: 0x601d180000-0x601d183fff (rw,non-prefetchable)
  Memory Range: 0x601d000000-0x601d0fffff (rw,non-prefetchable)
  IRQ: 165 (2860 events)
  Module Alias: "pci:v00008086d0000A0C8sv000017AAsd00003817bc04sc01i00"
  Driver Info #0:
    Driver Status: snd_hda_intel is active
    Driver Activation Cmd: "modprobe snd_hda_intel"
  Driver Info #1:
    Driver Status: snd_sof_pci is active
    Driver Activation Cmd: "modprobe snd_sof_pci"
  Config Status: cfg=new, avail=yes, need=no, active=unknown
Comment 120 DavidLenovo 2021-05-07 21:33:20 UTC
Hi !
A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 & 14ITL05 & 15ITL05 & 15ITL5 :)
Sound from speakers works on Ubuntu 20.04.2LTS !!!

(In reply to gurpreetsinghwalia5 from comment #86)
> (In reply to juliusvonkohout from comment #85)
> > (In reply to gurpreetsinghwalia5 from comment #84)
> > > I have a lenovo yoga 7i. No sound from the in build speaker in ubuntu
> > 20.10.
> > > Is there a solution for this ???
> > 
> > Yes, install fedora 33 and update everything. Then at least the bottom
> > speakers will work.
> 
> Is there a debian distro that works ??? Need debian for work.

It work on Ubuntu so will work on Debian.


(In reply to Priyaranjan Sharma from comment #98)
> I don't have any sound on my Lenovo Yoga 7i 15" with Fedora 33. 
> Tried Suse, Ubuntu and Mint as well and it is same result.


(In reply to esanchez from comment #110)
> Hi, 
> 
> Same error with Lenovo Yoga 7i 14"intel.
> Tested with Ubuntu 20.04LTS and Ubuntu 21.04 and no sound from internal
> speakers, meanwhile the headphones works perfectly.



(In reply to chenyh570 from comment #104)
> (In reply to wave from comment #100)
> > Did anyone else with the problem try my "workaround" from comment #97? It's
> > actually not too bad, I just suspend whenever I need audio from my speakers
> > and play some music muted in the background in a loop to keep it alive in
> > case playback is interrupted. Not perfect but usable.
> 
> I have 14inch yoga 7i, and unfortunately it doesn't work for me. I am
> running 5.10 kernel



(In reply to lazertag from comment #116)
> Just wanted to join in on the bandwagon here and follow any possible
> progress.  Look forward to hearing sound from my laptop speakers someday in
> Ubuntu. ;)
> 
> Lenovo Yoga 7-14ITL5 model # 82BH0006US
> 
> Like others my headphones via 1/8 jack seem to work fine but not a lick of
> sound from the built in speakers.  Lots of trying suggestions noted
> throughout this thread to no avail. Playing sound while selected on speakers
> it looks like there is activity just no sound of course.
> 
> hdaJackRetask seems to not work at all on my unit and hangs quite often
> where you have to force quit.  I was hopeful trying to use it might find
> some workaround. Anyway not sure if that says anything about the issue.



The problem is to enable the S3 :
Try : cat /sys/power/mem_sleep
You will have : "S2idle [deep]" 
Try : sudo dmesg |grep ACPI|grep supports
You will have : [    0.195933] ACPI: (supports S0 S3 S4 S5)

If not, you will check how to enable S3 :
==== ENABLE S3 ====
We have to patch the DSDT table
1) Install iasl : 
sudo apt-get install acpica-tools cpio

2) make acpi directory
mkdir acpi

3) Get a dump of ACPI DSDT table: 
sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml

4) Decompile the dump, which will generate a .dsl source based on the .aml ACPI machine language dump : 
iasl -d dsdt.aml

5) Make the patch file
The patch is just for Yoga 7/7i :
nano acpi.patch
--- dsdt.dsl~    2018-04-26 09:35:29.501055509 -0600
+++ dsdt.dsl    2018-04-26 09:36:23.769729028 -0600
@@ -18,7 +18,7 @@
  *     Compiler ID      "INTL"
  *     Compiler Version 0x20210105 (539033861)
  */
-DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000002)
+DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000003)
 {
     External (_GPE.AL6F, MethodObj)    // 0 Arguments
     External (_GPE.P0L6, MethodObj)    // 0 Arguments
@@ -516,7 +516,7 @@

     Name (SS1, Zero)
     Name (SS2, Zero)
-    Name (SS3, Zero)
+    Name (SS3, One)
     Name (SS4, One)
     OperationRegion (GNVS, SystemMemory, 0x45AB8018, 0x0A9B)
     Field (GNVS, AnyAcc, Lock, Preserve)

6) Apply it against dsdt.dsl: patch --verbose < acpi.patch
You will have :
Hunk #1 succeeded at 18 with fuzz 2.
Hunk #2 succeeded at 516.
done
(not sure because I'm already done it) Could anybody confirm the message, please ?

7) Recompile your patched version of the .dsl source : 
iasl -ve -tc dsdt.dsl

8) Create a CPIO archive with the correct structure, which GRUB can load on boot. We name the final image acpi_override and copy it into /boot/ : 
mkdir -p kernel/firmware/acpi
cp dsdt.aml kernel/firmware/acpi
find kernel | cpio -H newc --create > acpi_override
cp acpi_override /boot

9) GRUB needs to boot the kernel with a parameter setting the deep sleep state as default. Edit /etc/default/grub and add the following :
GRUB_CMDLINE_LINUX_DEFAULT="mem_sleep_default=deep"
GRUB_EARLY_INITRD_LINUX_CUSTOM="/boot/acpi_override"

10) Regenerate the GRUB configuration : 
sudo update-grub

If the second line of the previous step does not generate the grub to make the initrd lines look like "initrd /boot/acpi_override" in the beginning, then follow the next steps as normal. If it does generate those lines, skip to step 12. For me on Ubuntu it's not like this.

11) Tell GRUB to load the new DSDT table on boot in its configuration file usually located in /boot/grub/grub.cfg. Find the relevant GRUB menu entry and add the new image /boot/acpi_override to the initrd lines for the images that you want the s3 sleep to work in : 
sudo nano /boot/grub/grub.cfg
initrd /boot/initrd.img-5.11.5-051105-generic 
BECOME :
initrd /boot/acpi_override /boot/initrd.img-5.11.5-051105-generic

Be sure to do it for all kernels !

12) Reboot and enjoy having a laptop running Linux again... close the lid and the battery does not get drained in a few hours, also the battery no longer stays warm in sleep mode. To verify that things are working :
Try : cat /sys/power/mem_sleep
You will have : "S2idle [deep]" 
Try : sudo dmesg |grep ACPI|grep supports
You will have : [    0.195933] ACPI: (supports S0 S3 S4 S5)


After we have to enable sound :
==== ENABLE SOUND ====
For me on Ubuntu 20.04, I have to use kernel 5.11.0 to 5.11.5, 5.11.6 don't work, 5.11.16 don't work to. Anybody say why ?
So I sugest to try with 5.11.5 : https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.11.5/.
After could you try with you kernel, and share your kernel version, please ?

You will don't have dummy out.
For me :
aplay -l
gives :
**** Liste des Périphériques Matériels PLAYBACK ****
carte 0: sofhdadsp [sof-hda-dsp], périphérique 0: HDA Analog (*) []

sudo dmesg | grep -i audio
gives : sof-audio-pci 

If it is ok, just have to :
- play a song on VLC
- suspend to ram
- power on
- the speakers work :)

Like it is say, if you stop for 7 seconds, sound stop working.

Work after many reboot.

Ubuntu 21.04 live USB have jack/headphone work directly, so I think we have just enable the S3 for it.

Working for you ?

Original tutorial : https://wiki.archlinux.org/title/Lenovo_Yoga_7i
French tutorial on Ubuntu 20.04 : https://doc.ubuntu-fr.org/lenovo_yoga_7_7i
Comment 121 juliusvonkohout 2021-05-08 10:31:58 UTC
Does your 14ITL05 even have 5 speakers like the 15ITL05? There are thre above the keyboard and 2 below the palm rest. Do you really know that it applies to it? On the 15ITL05 only the bass speakers above the keyboard are not working.
Comment 122 DavidLenovo 2021-05-08 13:35:17 UTC
Hi,
What is your model please ?

For the Lenovo Support, and for the technical information, the Yoga 7i 14" & 15" are the same (the 15" just have 1 USB more), both have Dolby Atmos with 2 Speakers.

I Think I have make a mistake with the Yoga Slim 7 14ITL05 & 15ITL05 with 3 speakers ("3 haut-parleurs (3 x 2W), Dolby Atmos").
IdeaPad 5 15ITL05 have the same reference, very strange ... with 2 speakers to like the 15ITL5.

This code 14ITL05 or 15ITL05 don't have any result on Lenovo website, but I have see it in my BIOS dump. So I have suppose that is just another reference for the same computer.

So sorry, visibly is not the same, and this number is for 2 different computers :(

My post is for the Yoga 7i 14ITL5 and 15ITL5, but it seem we have the same, or similar BIOS, so the process to enable the S3 can be the same or really similar.

The problem, for me, is to enable the S3, to have sound in any speaker. 
If you don't have sound in all speaker, is more a drivers problem, in my point of view. So this is not a solution for you, sorry.
Or a mixing problem ?
Comment 123 lazertag 2021-05-09 00:04:08 UTC
(In reply to DavidLenovo from comment #120)
> Hi !
> A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 & 14ITL05 &
> 15ITL05 & 15ITL5 :)
> Sound from speakers works on Ubuntu 20.04.2LTS !!!
> 
> (In reply to gurpreetsinghwalia5 from comment #86)
> > (In reply to juliusvonkohout from comment #85)
> > > (In reply to gurpreetsinghwalia5 from comment #84)
> > > > I have a lenovo yoga 7i. No sound from the in build speaker in ubuntu
> > > 20.10.
> > > > Is there a solution for this ???
> > > 
> > > Yes, install fedora 33 and update everything. Then at least the bottom
> > > speakers will work.
> > 
> > Is there a debian distro that works ??? Need debian for work.
> 
> It work on Ubuntu so will work on Debian.
> 
> 
> (In reply to Priyaranjan Sharma from comment #98)
> > I don't have any sound on my Lenovo Yoga 7i 15" with Fedora 33. 
> > Tried Suse, Ubuntu and Mint as well and it is same result.
> 
> 
> (In reply to esanchez from comment #110)
> > Hi, 
> > 
> > Same error with Lenovo Yoga 7i 14"intel.
> > Tested with Ubuntu 20.04LTS and Ubuntu 21.04 and no sound from internal
> > speakers, meanwhile the headphones works perfectly.
> 
> 
> 
> (In reply to chenyh570 from comment #104)
> > (In reply to wave from comment #100)
> > > Did anyone else with the problem try my "workaround" from comment #97?
> It's
> > > actually not too bad, I just suspend whenever I need audio from my
> speakers
> > > and play some music muted in the background in a loop to keep it alive in
> > > case playback is interrupted. Not perfect but usable.
> > 
> > I have 14inch yoga 7i, and unfortunately it doesn't work for me. I am
> > running 5.10 kernel
> 
> 
> 
> (In reply to lazertag from comment #116)
> > Just wanted to join in on the bandwagon here and follow any possible
> > progress.  Look forward to hearing sound from my laptop speakers someday in
> > Ubuntu. ;)
> > 
> > Lenovo Yoga 7-14ITL5 model # 82BH0006US
> > 
> > Like others my headphones via 1/8 jack seem to work fine but not a lick of
> > sound from the built in speakers.  Lots of trying suggestions noted
> > throughout this thread to no avail. Playing sound while selected on
> speakers
> > it looks like there is activity just no sound of course.
> > 
> > hdaJackRetask seems to not work at all on my unit and hangs quite often
> > where you have to force quit.  I was hopeful trying to use it might find
> > some workaround. Anyway not sure if that says anything about the issue.
> 
> 
> 
> The problem is to enable the S3 :
> Try : cat /sys/power/mem_sleep
> You will have : "S2idle [deep]" 
> Try : sudo dmesg |grep ACPI|grep supports
> You will have : [    0.195933] ACPI: (supports S0 S3 S4 S5)
> 
> If not, you will check how to enable S3 :
> ==== ENABLE S3 ====
> We have to patch the DSDT table
> 1) Install iasl : 
> sudo apt-get install acpica-tools cpio
> 
> 2) make acpi directory
> mkdir acpi
> 
> 3) Get a dump of ACPI DSDT table: 
> sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
> 
> 4) Decompile the dump, which will generate a .dsl source based on the .aml
> ACPI machine language dump : 
> iasl -d dsdt.aml
> 
> 5) Make the patch file
> The patch is just for Yoga 7/7i :
> nano acpi.patch
> --- dsdt.dsl~    2018-04-26 09:35:29.501055509 -0600
> +++ dsdt.dsl    2018-04-26 09:36:23.769729028 -0600
> @@ -18,7 +18,7 @@
>   *     Compiler ID      "INTL"
>   *     Compiler Version 0x20210105 (539033861)
>   */
> -DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000002)
> +DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000003)
>  {
>      External (_GPE.AL6F, MethodObj)    // 0 Arguments
>      External (_GPE.P0L6, MethodObj)    // 0 Arguments
> @@ -516,7 +516,7 @@
> 
>      Name (SS1, Zero)
>      Name (SS2, Zero)
> -    Name (SS3, Zero)
> +    Name (SS3, One)
>      Name (SS4, One)
>      OperationRegion (GNVS, SystemMemory, 0x45AB8018, 0x0A9B)
>      Field (GNVS, AnyAcc, Lock, Preserve)
> 
> 6) Apply it against dsdt.dsl: patch --verbose < acpi.patch
> You will have :
> Hunk #1 succeeded at 18 with fuzz 2.
> Hunk #2 succeeded at 516.
> done
> (not sure because I'm already done it) Could anybody confirm the message,
> please ?
> 
> 7) Recompile your patched version of the .dsl source : 
> iasl -ve -tc dsdt.dsl
> 
> 8) Create a CPIO archive with the correct structure, which GRUB can load on
> boot. We name the final image acpi_override and copy it into /boot/ : 
> mkdir -p kernel/firmware/acpi
> cp dsdt.aml kernel/firmware/acpi
> find kernel | cpio -H newc --create > acpi_override
> cp acpi_override /boot
> 
> 9) GRUB needs to boot the kernel with a parameter setting the deep sleep
> state as default. Edit /etc/default/grub and add the following :
> GRUB_CMDLINE_LINUX_DEFAULT="mem_sleep_default=deep"
> GRUB_EARLY_INITRD_LINUX_CUSTOM="/boot/acpi_override"
> 
> 10) Regenerate the GRUB configuration : 
> sudo update-grub
> 
> If the second line of the previous step does not generate the grub to make
> the initrd lines look like "initrd /boot/acpi_override" in the beginning,
> then follow the next steps as normal. If it does generate those lines, skip
> to step 12. For me on Ubuntu it's not like this.
> 
> 11) Tell GRUB to load the new DSDT table on boot in its configuration file
> usually located in /boot/grub/grub.cfg. Find the relevant GRUB menu entry
> and add the new image /boot/acpi_override to the initrd lines for the images
> that you want the s3 sleep to work in : 
> sudo nano /boot/grub/grub.cfg
> initrd /boot/initrd.img-5.11.5-051105-generic 
> BECOME :
> initrd /boot/acpi_override /boot/initrd.img-5.11.5-051105-generic
> 
> Be sure to do it for all kernels !
> 
> 12) Reboot and enjoy having a laptop running Linux again... close the lid
> and the battery does not get drained in a few hours, also the battery no
> longer stays warm in sleep mode. To verify that things are working :
> Try : cat /sys/power/mem_sleep
> You will have : "S2idle [deep]" 
> Try : sudo dmesg |grep ACPI|grep supports
> You will have : [    0.195933] ACPI: (supports S0 S3 S4 S5)
> 
> 
> After we have to enable sound :
> ==== ENABLE SOUND ====
> For me on Ubuntu 20.04, I have to use kernel 5.11.0 to 5.11.5, 5.11.6 don't
> work, 5.11.16 don't work to. Anybody say why ?
> So I sugest to try with 5.11.5 :
> https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.11.5/.
> After could you try with you kernel, and share your kernel version, please ?
> 
> You will don't have dummy out.
> For me :
> aplay -l
> gives :
> **** Liste des Périphériques Matériels PLAYBACK ****
> carte 0: sofhdadsp [sof-hda-dsp], périphérique 0: HDA Analog (*) []
> 
> sudo dmesg | grep -i audio
> gives : sof-audio-pci 
> 
> If it is ok, just have to :
> - play a song on VLC
> - suspend to ram
> - power on
> - the speakers work :)
> 
> Like it is say, if you stop for 7 seconds, sound stop working.
> 
> Work after many reboot.
> 
> Ubuntu 21.04 live USB have jack/headphone work directly, so I think we have
> just enable the S3 for it.
> 
> Working for you ?
> 
> Original tutorial : https://wiki.archlinux.org/title/Lenovo_Yoga_7i
> French tutorial on Ubuntu 20.04 : https://doc.ubuntu-fr.org/lenovo_yoga_7_7i




Questions if you don't mind.


Step #2 you create this acpi dir but then it doesn't appear to get used?  Did you intend for the readers to enter that directory before starting into step 3 so everything is done form it?

Step #6 you have us apply the patch to the dsdt.dsl file.  Does the 'patch' command just somehow know to apply or use that that file or do we have to identify it as a source/target somehow?
Comment 124 lazertag 2021-05-09 00:17:15 UTC
(In reply to lazertag from comment #123)
> (In reply to DavidLenovo from comment #120)
> 
> Questions if you don't mind.
> 
> 
> Step #2 you create this acpi dir but then it doesn't appear to get used? 
> Did you intend for the readers to enter that directory before starting into
> step 3 so everything is done form it?
> 
> Step #6 you have us apply the patch to the dsdt.dsl file.  Does the 'patch'
> command just somehow know to apply or use that that file or do we have to
> identify it as a source/target somehow?

I just noted the answer to my second question, it's part of your patch code. sorry, never mind that one.
Comment 125 Vincent Morel 2021-05-10 12:21:49 UTC
On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
Comment 126 DavidLenovo 2021-05-10 19:01:48 UTC
(In reply to lazertag from comment #123)
> (In reply to DavidLenovo from comment #120)
> > Hi !

> Questions if you don't mind.
> 
> 
> Step #2 you create this acpi dir but then it doesn't appear to get used? 
> Did you intend for the readers to enter that directory before starting into
> step 3 so everything is done form it?
> 
> Step #6 you have us apply the patch to the dsdt.dsl file.  Does the 'patch'
> command just somehow know to apply or use that that file or do we have to
> identify it as a source/target somehow?

Hi,
Sorry, in step #2 after makdir acpi, go in the directory : cd acpi.
You can do it in another directory.
Yes you have to enter in the acpi directory before the step 3.

> I just noted the answer to my second question, it's part of your patch code.
> sorry, never mind that one.

Step #6 : Yes the patch file have the name of the destination file. I have discover the patch command few day ago, and had the same question !
Comment 127 DavidLenovo 2021-05-10 19:19:27 UTC
(In reply to Vincent Morel from comment #125)
> On the 13S Gen 2, there is only 2 speakers, and S3 is activated...

Hi, I have similar result in hwinfo --sound, but it's not exactly the same card.

Your have only 2 speakers working ? Ore no one ?

You have try Ubuntu 20.04 with kernel 5.11.5 ?
Comment 128 chenyh570 2021-05-10 22:41:06 UTC
(In reply to DavidLenovo from comment #120)
> Hi !
> A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 & 14ITL05 &
> 15ITL05 & 15ITL5 :)
> Sound from speakers works on Ubuntu 20.04.2LTS !!!
> 
> (In reply to gurpreetsinghwalia5 from comment #86)
> > (In reply to juliusvonkohout from comment #85)
> > > (In reply to gurpreetsinghwalia5 from comment #84)
> > > > I have a lenovo yoga 7i. No sound from the in build speaker in ubuntu
> > > 20.10.
> > > > Is there a solution for this ???
> > > 
> > > Yes, install fedora 33 and update everything. Then at least the bottom
> > > speakers will work.
> > 
> > Is there a debian distro that works ??? Need debian for work.
> 
> It work on Ubuntu so will work on Debian.
> 
> 
> (In reply to Priyaranjan Sharma from comment #98)
> > I don't have any sound on my Lenovo Yoga 7i 15" with Fedora 33. 
> > Tried Suse, Ubuntu and Mint as well and it is same result.
> 
> 
> (In reply to esanchez from comment #110)
> > Hi, 
> > 
> > Same error with Lenovo Yoga 7i 14"intel.
> > Tested with Ubuntu 20.04LTS and Ubuntu 21.04 and no sound from internal
> > speakers, meanwhile the headphones works perfectly.
> 
> 
> 
> (In reply to chenyh570 from comment #104)
> > (In reply to wave from comment #100)
> > > Did anyone else with the problem try my "workaround" from comment #97?
> It's
> > > actually not too bad, I just suspend whenever I need audio from my
> speakers
> > > and play some music muted in the background in a loop to keep it alive in
> > > case playback is interrupted. Not perfect but usable.
> > 
> > I have 14inch yoga 7i, and unfortunately it doesn't work for me. I am
> > running 5.10 kernel
> 
> 
> 
> (In reply to lazertag from comment #116)
> > Just wanted to join in on the bandwagon here and follow any possible
> > progress.  Look forward to hearing sound from my laptop speakers someday in
> > Ubuntu. ;)
> > 
> > Lenovo Yoga 7-14ITL5 model # 82BH0006US
> > 
> > Like others my headphones via 1/8 jack seem to work fine but not a lick of
> > sound from the built in speakers.  Lots of trying suggestions noted
> > throughout this thread to no avail. Playing sound while selected on
> speakers
> > it looks like there is activity just no sound of course.
> > 
> > hdaJackRetask seems to not work at all on my unit and hangs quite often
> > where you have to force quit.  I was hopeful trying to use it might find
> > some workaround. Anyway not sure if that says anything about the issue.
> 
> 
> 
> The problem is to enable the S3 :
> Try : cat /sys/power/mem_sleep
> You will have : "S2idle [deep]" 
> Try : sudo dmesg |grep ACPI|grep supports
> You will have : [    0.195933] ACPI: (supports S0 S3 S4 S5)
> 
> If not, you will check how to enable S3 :
> ==== ENABLE S3 ====
> We have to patch the DSDT table
> 1) Install iasl : 
> sudo apt-get install acpica-tools cpio
> 
> 2) make acpi directory
> mkdir acpi
> 
> 3) Get a dump of ACPI DSDT table: 
> sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
> 
> 4) Decompile the dump, which will generate a .dsl source based on the .aml
> ACPI machine language dump : 
> iasl -d dsdt.aml
> 
> 5) Make the patch file
> The patch is just for Yoga 7/7i :
> nano acpi.patch
> --- dsdt.dsl~    2018-04-26 09:35:29.501055509 -0600
> +++ dsdt.dsl    2018-04-26 09:36:23.769729028 -0600
> @@ -18,7 +18,7 @@
>   *     Compiler ID      "INTL"
>   *     Compiler Version 0x20210105 (539033861)
>   */
> -DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000002)
> +DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000003)
>  {
>      External (_GPE.AL6F, MethodObj)    // 0 Arguments
>      External (_GPE.P0L6, MethodObj)    // 0 Arguments
> @@ -516,7 +516,7 @@
> 
>      Name (SS1, Zero)
>      Name (SS2, Zero)
> -    Name (SS3, Zero)
> +    Name (SS3, One)
>      Name (SS4, One)
>      OperationRegion (GNVS, SystemMemory, 0x45AB8018, 0x0A9B)
>      Field (GNVS, AnyAcc, Lock, Preserve)
> 
> 6) Apply it against dsdt.dsl: patch --verbose < acpi.patch
> You will have :
> Hunk #1 succeeded at 18 with fuzz 2.
> Hunk #2 succeeded at 516.
> done
> (not sure because I'm already done it) Could anybody confirm the message,
> please ?
> 
> 7) Recompile your patched version of the .dsl source : 
> iasl -ve -tc dsdt.dsl
> 
> 8) Create a CPIO archive with the correct structure, which GRUB can load on
> boot. We name the final image acpi_override and copy it into /boot/ : 
> mkdir -p kernel/firmware/acpi
> cp dsdt.aml kernel/firmware/acpi
> find kernel | cpio -H newc --create > acpi_override
> cp acpi_override /boot
> 
> 9) GRUB needs to boot the kernel with a parameter setting the deep sleep
> state as default. Edit /etc/default/grub and add the following :
> GRUB_CMDLINE_LINUX_DEFAULT="mem_sleep_default=deep"
> GRUB_EARLY_INITRD_LINUX_CUSTOM="/boot/acpi_override"
> 
> 10) Regenerate the GRUB configuration : 
> sudo update-grub
> 
> If the second line of the previous step does not generate the grub to make
> the initrd lines look like "initrd /boot/acpi_override" in the beginning,
> then follow the next steps as normal. If it does generate those lines, skip
> to step 12. For me on Ubuntu it's not like this.
> 
> 11) Tell GRUB to load the new DSDT table on boot in its configuration file
> usually located in /boot/grub/grub.cfg. Find the relevant GRUB menu entry
> and add the new image /boot/acpi_override to the initrd lines for the images
> that you want the s3 sleep to work in : 
> sudo nano /boot/grub/grub.cfg
> initrd /boot/initrd.img-5.11.5-051105-generic 
> BECOME :
> initrd /boot/acpi_override /boot/initrd.img-5.11.5-051105-generic
> 
> Be sure to do it for all kernels !
> 
> 12) Reboot and enjoy having a laptop running Linux again... close the lid
> and the battery does not get drained in a few hours, also the battery no
> longer stays warm in sleep mode. To verify that things are working :
> Try : cat /sys/power/mem_sleep
> You will have : "S2idle [deep]" 
> Try : sudo dmesg |grep ACPI|grep supports
> You will have : [    0.195933] ACPI: (supports S0 S3 S4 S5)
> 
> 
> After we have to enable sound :
> ==== ENABLE SOUND ====
> For me on Ubuntu 20.04, I have to use kernel 5.11.0 to 5.11.5, 5.11.6 don't
> work, 5.11.16 don't work to. Anybody say why ?
> So I sugest to try with 5.11.5 :
> https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.11.5/.
> After could you try with you kernel, and share your kernel version, please ?
> 
> You will don't have dummy out.
> For me :
> aplay -l
> gives :
> **** Liste des Périphériques Matériels PLAYBACK ****
> carte 0: sofhdadsp [sof-hda-dsp], périphérique 0: HDA Analog (*) []
> 
> sudo dmesg | grep -i audio
> gives : sof-audio-pci 
> 
> If it is ok, just have to :
> - play a song on VLC
> - suspend to ram
> - power on
> - the speakers work :)
> 
> Like it is say, if you stop for 7 seconds, sound stop working.
> 
> Work after many reboot.
> 
> Ubuntu 21.04 live USB have jack/headphone work directly, so I think we have
> just enable the S3 for it.
> 
> Working for you ?
> 
> Original tutorial : https://wiki.archlinux.org/title/Lenovo_Yoga_7i
> French tutorial on Ubuntu 20.04 : https://doc.ubuntu-fr.org/lenovo_yoga_7_7i

Wondeful news to me, basically it works. Yet, I was trying to make this as automatic as possible, so I was trying the bash script as descipt in the tutorial. Hower it keeps throwing: tee: /dev/audio: Connection refused to me. Do you know what is this about? Cheers!
Comment 129 chenyh570 2021-05-10 22:41:38 UTC
(In reply to DavidLenovo from comment #120)
> Hi !
> A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 & 14ITL05 &
> 15ITL05 & 15ITL5 :)
> Sound from speakers works on Ubuntu 20.04.2LTS !!!
> 
> (In reply to gurpreetsinghwalia5 from comment #86)
> > (In reply to juliusvonkohout from comment #85)
> > > (In reply to gurpreetsinghwalia5 from comment #84)
> > > > I have a lenovo yoga 7i. No sound from the in build speaker in ubuntu
> > > 20.10.
> > > > Is there a solution for this ???
> > > 
> > > Yes, install fedora 33 and update everything. Then at least the bottom
> > > speakers will work.
> > 
> > Is there a debian distro that works ??? Need debian for work.
> 
> It work on Ubuntu so will work on Debian.
> 
> 
> (In reply to Priyaranjan Sharma from comment #98)
> > I don't have any sound on my Lenovo Yoga 7i 15" with Fedora 33. 
> > Tried Suse, Ubuntu and Mint as well and it is same result.
> 
> 
> (In reply to esanchez from comment #110)
> > Hi, 
> > 
> > Same error with Lenovo Yoga 7i 14"intel.
> > Tested with Ubuntu 20.04LTS and Ubuntu 21.04 and no sound from internal
> > speakers, meanwhile the headphones works perfectly.
> 
> 
> 
> (In reply to chenyh570 from comment #104)
> > (In reply to wave from comment #100)
> > > Did anyone else with the problem try my "workaround" from comment #97?
> It's
> > > actually not too bad, I just suspend whenever I need audio from my
> speakers
> > > and play some music muted in the background in a loop to keep it alive in
> > > case playback is interrupted. Not perfect but usable.
> > 
> > I have 14inch yoga 7i, and unfortunately it doesn't work for me. I am
> > running 5.10 kernel
> 
> 
> 
> (In reply to lazertag from comment #116)
> > Just wanted to join in on the bandwagon here and follow any possible
> > progress.  Look forward to hearing sound from my laptop speakers someday in
> > Ubuntu. ;)
> > 
> > Lenovo Yoga 7-14ITL5 model # 82BH0006US
> > 
> > Like others my headphones via 1/8 jack seem to work fine but not a lick of
> > sound from the built in speakers.  Lots of trying suggestions noted
> > throughout this thread to no avail. Playing sound while selected on
> speakers
> > it looks like there is activity just no sound of course.
> > 
> > hdaJackRetask seems to not work at all on my unit and hangs quite often
> > where you have to force quit.  I was hopeful trying to use it might find
> > some workaround. Anyway not sure if that says anything about the issue.
> 
> 
> 
> The problem is to enable the S3 :
> Try : cat /sys/power/mem_sleep
> You will have : "S2idle [deep]" 
> Try : sudo dmesg |grep ACPI|grep supports
> You will have : [    0.195933] ACPI: (supports S0 S3 S4 S5)
> 
> If not, you will check how to enable S3 :
> ==== ENABLE S3 ====
> We have to patch the DSDT table
> 1) Install iasl : 
> sudo apt-get install acpica-tools cpio
> 
> 2) make acpi directory
> mkdir acpi
> 
> 3) Get a dump of ACPI DSDT table: 
> sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
> 
> 4) Decompile the dump, which will generate a .dsl source based on the .aml
> ACPI machine language dump : 
> iasl -d dsdt.aml
> 
> 5) Make the patch file
> The patch is just for Yoga 7/7i :
> nano acpi.patch
> --- dsdt.dsl~    2018-04-26 09:35:29.501055509 -0600
> +++ dsdt.dsl    2018-04-26 09:36:23.769729028 -0600
> @@ -18,7 +18,7 @@
>   *     Compiler ID      "INTL"
>   *     Compiler Version 0x20210105 (539033861)
>   */
> -DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000002)
> +DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000003)
>  {
>      External (_GPE.AL6F, MethodObj)    // 0 Arguments
>      External (_GPE.P0L6, MethodObj)    // 0 Arguments
> @@ -516,7 +516,7 @@
> 
>      Name (SS1, Zero)
>      Name (SS2, Zero)
> -    Name (SS3, Zero)
> +    Name (SS3, One)
>      Name (SS4, One)
>      OperationRegion (GNVS, SystemMemory, 0x45AB8018, 0x0A9B)
>      Field (GNVS, AnyAcc, Lock, Preserve)
> 
> 6) Apply it against dsdt.dsl: patch --verbose < acpi.patch
> You will have :
> Hunk #1 succeeded at 18 with fuzz 2.
> Hunk #2 succeeded at 516.
> done
> (not sure because I'm already done it) Could anybody confirm the message,
> please ?
> 
> 7) Recompile your patched version of the .dsl source : 
> iasl -ve -tc dsdt.dsl
> 
> 8) Create a CPIO archive with the correct structure, which GRUB can load on
> boot. We name the final image acpi_override and copy it into /boot/ : 
> mkdir -p kernel/firmware/acpi
> cp dsdt.aml kernel/firmware/acpi
> find kernel | cpio -H newc --create > acpi_override
> cp acpi_override /boot
> 
> 9) GRUB needs to boot the kernel with a parameter setting the deep sleep
> state as default. Edit /etc/default/grub and add the following :
> GRUB_CMDLINE_LINUX_DEFAULT="mem_sleep_default=deep"
> GRUB_EARLY_INITRD_LINUX_CUSTOM="/boot/acpi_override"
> 
> 10) Regenerate the GRUB configuration : 
> sudo update-grub
> 
> If the second line of the previous step does not generate the grub to make
> the initrd lines look like "initrd /boot/acpi_override" in the beginning,
> then follow the next steps as normal. If it does generate those lines, skip
> to step 12. For me on Ubuntu it's not like this.
> 
> 11) Tell GRUB to load the new DSDT table on boot in its configuration file
> usually located in /boot/grub/grub.cfg. Find the relevant GRUB menu entry
> and add the new image /boot/acpi_override to the initrd lines for the images
> that you want the s3 sleep to work in : 
> sudo nano /boot/grub/grub.cfg
> initrd /boot/initrd.img-5.11.5-051105-generic 
> BECOME :
> initrd /boot/acpi_override /boot/initrd.img-5.11.5-051105-generic
> 
> Be sure to do it for all kernels !
> 
> 12) Reboot and enjoy having a laptop running Linux again... close the lid
> and the battery does not get drained in a few hours, also the battery no
> longer stays warm in sleep mode. To verify that things are working :
> Try : cat /sys/power/mem_sleep
> You will have : "S2idle [deep]" 
> Try : sudo dmesg |grep ACPI|grep supports
> You will have : [    0.195933] ACPI: (supports S0 S3 S4 S5)
> 
> 
> After we have to enable sound :
> ==== ENABLE SOUND ====
> For me on Ubuntu 20.04, I have to use kernel 5.11.0 to 5.11.5, 5.11.6 don't
> work, 5.11.16 don't work to. Anybody say why ?
> So I sugest to try with 5.11.5 :
> https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.11.5/.
> After could you try with you kernel, and share your kernel version, please ?
> 
> You will don't have dummy out.
> For me :
> aplay -l
> gives :
> **** Liste des Périphériques Matériels PLAYBACK ****
> carte 0: sofhdadsp [sof-hda-dsp], périphérique 0: HDA Analog (*) []
> 
> sudo dmesg | grep -i audio
> gives : sof-audio-pci 
> 
> If it is ok, just have to :
> - play a song on VLC
> - suspend to ram
> - power on
> - the speakers work :)
> 
> Like it is say, if you stop for 7 seconds, sound stop working.
> 
> Work after many reboot.
> 
> Ubuntu 21.04 live USB have jack/headphone work directly, so I think we have
> just enable the S3 for it.
> 
> Working for you ?
> 
> Original tutorial : https://wiki.archlinux.org/title/Lenovo_Yoga_7i
> French tutorial on Ubuntu 20.04 : https://doc.ubuntu-fr.org/lenovo_yoga_7_7i

Wondeful news to me, basically it works. Yet, I was trying to make this as automatic as possible, so I was trying the bash script as descipt in the tutorial. Hower it keeps throwing: tee: /dev/audio: Connection refused to me. Do you know what is this about? Cheers!
Comment 130 Vincent Morel 2021-05-11 00:12:50 UTC
(In reply to DavidLenovo from comment #127)
> (In reply to Vincent Morel from comment #125)
> > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> 
> Hi, I have similar result in hwinfo --sound, but it's not exactly the same
> card.
> 
> Your have only 2 speakers working ? Ore no one ?
> 
> You have try Ubuntu 20.04 with kernel 5.11.5 ?

No speaker working (but headphone, hdmi... are working).

I did not try kernel 5.11.5 (My Pop Os is in 5.11.0 but I remember trying Ubuntu 21.04 and there was no sound also).
Comment 131 wave 2021-05-12 12:37:33 UTC
(In reply to chenyh570 from comment #129)
> (In reply to DavidLenovo from comment #120)
> > Hi !
> > A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 & 14ITL05 &
> > 15ITL05 & 15ITL5 :)
> > Sound from speakers works on Ubuntu 20.04.2LTS !!!
> > 
> > (In reply to gurpreetsinghwalia5 from comment #86)
> > > (In reply to juliusvonkohout from comment #85)
> > > > (In reply to gurpreetsinghwalia5 from comment #84)
> > > > > I have a lenovo yoga 7i. No sound from the in build speaker in ubuntu
> > > > 20.10.
> > > > > Is there a solution for this ???
> > > > 
> > > > Yes, install fedora 33 and update everything. Then at least the bottom
> > > > speakers will work.
> > > 
> > > Is there a debian distro that works ??? Need debian for work.
> > 
> > It work on Ubuntu so will work on Debian.
> > 
> > 
> > (In reply to Priyaranjan Sharma from comment #98)
> > > I don't have any sound on my Lenovo Yoga 7i 15" with Fedora 33. 
> > > Tried Suse, Ubuntu and Mint as well and it is same result.
> > 
> > 
> > (In reply to esanchez from comment #110)
> > > Hi, 
> > > 
> > > Same error with Lenovo Yoga 7i 14"intel.
> > > Tested with Ubuntu 20.04LTS and Ubuntu 21.04 and no sound from internal
> > > speakers, meanwhile the headphones works perfectly.
> > 
> > 
> > 
> > (In reply to chenyh570 from comment #104)
> > > (In reply to wave from comment #100)
> > > > Did anyone else with the problem try my "workaround" from comment #97?
> > It's
> > > > actually not too bad, I just suspend whenever I need audio from my
> > speakers
> > > > and play some music muted in the background in a loop to keep it alive
> in
> > > > case playback is interrupted. Not perfect but usable.
> > > 
> > > I have 14inch yoga 7i, and unfortunately it doesn't work for me. I am
> > > running 5.10 kernel
> > 
> > 
> > 
> > (In reply to lazertag from comment #116)
> > > Just wanted to join in on the bandwagon here and follow any possible
> > > progress.  Look forward to hearing sound from my laptop speakers someday
> in
> > > Ubuntu. ;)
> > > 
> > > Lenovo Yoga 7-14ITL5 model # 82BH0006US
> > > 
> > > Like others my headphones via 1/8 jack seem to work fine but not a lick
> of
> > > sound from the built in speakers.  Lots of trying suggestions noted
> > > throughout this thread to no avail. Playing sound while selected on
> > speakers
> > > it looks like there is activity just no sound of course.
> > > 
> > > hdaJackRetask seems to not work at all on my unit and hangs quite often
> > > where you have to force quit.  I was hopeful trying to use it might find
> > > some workaround. Anyway not sure if that says anything about the issue.
> > 
> > 
> > 
> > The problem is to enable the S3 :
> > Try : cat /sys/power/mem_sleep
> > You will have : "S2idle [deep]" 
> > Try : sudo dmesg |grep ACPI|grep supports
> > You will have : [    0.195933] ACPI: (supports S0 S3 S4 S5)
> > 
> > If not, you will check how to enable S3 :
> > ==== ENABLE S3 ====
> > We have to patch the DSDT table
> > 1) Install iasl : 
> > sudo apt-get install acpica-tools cpio
> > 
> > 2) make acpi directory
> > mkdir acpi
> > 
> > 3) Get a dump of ACPI DSDT table: 
> > sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
> > 
> > 4) Decompile the dump, which will generate a .dsl source based on the .aml
> > ACPI machine language dump : 
> > iasl -d dsdt.aml
> > 
> > 5) Make the patch file
> > The patch is just for Yoga 7/7i :
> > nano acpi.patch
> > --- dsdt.dsl~    2018-04-26 09:35:29.501055509 -0600
> > +++ dsdt.dsl    2018-04-26 09:36:23.769729028 -0600
> > @@ -18,7 +18,7 @@
> >   *     Compiler ID      "INTL"
> >   *     Compiler Version 0x20210105 (539033861)
> >   */
> > -DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000002)
> > +DefinitionBlock ("", "DSDT", 2, "LENOVO", "CB-01   ", 0x00000003)
> >  {
> >      External (_GPE.AL6F, MethodObj)    // 0 Arguments
> >      External (_GPE.P0L6, MethodObj)    // 0 Arguments
> > @@ -516,7 +516,7 @@
> > 
> >      Name (SS1, Zero)
> >      Name (SS2, Zero)
> > -    Name (SS3, Zero)
> > +    Name (SS3, One)
> >      Name (SS4, One)
> >      OperationRegion (GNVS, SystemMemory, 0x45AB8018, 0x0A9B)
> >      Field (GNVS, AnyAcc, Lock, Preserve)
> > 
> > 6) Apply it against dsdt.dsl: patch --verbose < acpi.patch
> > You will have :
> > Hunk #1 succeeded at 18 with fuzz 2.
> > Hunk #2 succeeded at 516.
> > done
> > (not sure because I'm already done it) Could anybody confirm the message,
> > please ?
> > 
> > 7) Recompile your patched version of the .dsl source : 
> > iasl -ve -tc dsdt.dsl
> > 
> > 8) Create a CPIO archive with the correct structure, which GRUB can load on
> > boot. We name the final image acpi_override and copy it into /boot/ : 
> > mkdir -p kernel/firmware/acpi
> > cp dsdt.aml kernel/firmware/acpi
> > find kernel | cpio -H newc --create > acpi_override
> > cp acpi_override /boot
> > 
> > 9) GRUB needs to boot the kernel with a parameter setting the deep sleep
> > state as default. Edit /etc/default/grub and add the following :
> > GRUB_CMDLINE_LINUX_DEFAULT="mem_sleep_default=deep"
> > GRUB_EARLY_INITRD_LINUX_CUSTOM="/boot/acpi_override"
> > 
> > 10) Regenerate the GRUB configuration : 
> > sudo update-grub
> > 
> > If the second line of the previous step does not generate the grub to make
> > the initrd lines look like "initrd /boot/acpi_override" in the beginning,
> > then follow the next steps as normal. If it does generate those lines, skip
> > to step 12. For me on Ubuntu it's not like this.
> > 
> > 11) Tell GRUB to load the new DSDT table on boot in its configuration file
> > usually located in /boot/grub/grub.cfg. Find the relevant GRUB menu entry
> > and add the new image /boot/acpi_override to the initrd lines for the
> images
> > that you want the s3 sleep to work in : 
> > sudo nano /boot/grub/grub.cfg
> > initrd /boot/initrd.img-5.11.5-051105-generic 
> > BECOME :
> > initrd /boot/acpi_override /boot/initrd.img-5.11.5-051105-generic
> > 
> > Be sure to do it for all kernels !
> > 
> > 12) Reboot and enjoy having a laptop running Linux again... close the lid
> > and the battery does not get drained in a few hours, also the battery no
> > longer stays warm in sleep mode. To verify that things are working :
> > Try : cat /sys/power/mem_sleep
> > You will have : "S2idle [deep]" 
> > Try : sudo dmesg |grep ACPI|grep supports
> > You will have : [    0.195933] ACPI: (supports S0 S3 S4 S5)
> > 
> > 
> > After we have to enable sound :
> > ==== ENABLE SOUND ====
> > For me on Ubuntu 20.04, I have to use kernel 5.11.0 to 5.11.5, 5.11.6 don't
> > work, 5.11.16 don't work to. Anybody say why ?
> > So I sugest to try with 5.11.5 :
> > https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.11.5/.
> > After could you try with you kernel, and share your kernel version, please
> ?
> > 
> > You will don't have dummy out.
> > For me :
> > aplay -l
> > gives :
> > **** Liste des Périphériques Matériels PLAYBACK ****
> > carte 0: sofhdadsp [sof-hda-dsp], périphérique 0: HDA Analog (*) []
> > 
> > sudo dmesg | grep -i audio
> > gives : sof-audio-pci 
> > 
> > If it is ok, just have to :
> > - play a song on VLC
> > - suspend to ram
> > - power on
> > - the speakers work :)
> > 
> > Like it is say, if you stop for 7 seconds, sound stop working.
> > 
> > Work after many reboot.
> > 
> > Ubuntu 21.04 live USB have jack/headphone work directly, so I think we have
> > just enable the S3 for it.
> > 
> > Working for you ?
> > 
> > Original tutorial : https://wiki.archlinux.org/title/Lenovo_Yoga_7i
> > French tutorial on Ubuntu 20.04 :
> https://doc.ubuntu-fr.org/lenovo_yoga_7_7i
> 
> Wondeful news to me, basically it works. Yet, I was trying to make this as
> automatic as possible, so I was trying the bash script as descipt in the
> tutorial. Hower it keeps throwing: tee: /dev/audio: Connection refused to
> me. Do you know what is this about? Cheers!

First of all allow me to remark that this is exactly the solution that I talked about in comment #97 and which I tried to explain to you specifically in more detail in comment #107; in fact I wrote the archwiki article referred to in the comment.

Now your problem seems to be related to permissions; perhaps you are running the whole command or padsp as sudo?
Comment 132 Vincent Morel 2021-05-18 17:31:30 UTC
(In reply to DavidLenovo from comment #127)
> (In reply to Vincent Morel from comment #125)
> > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> 
> Hi, I have similar result in hwinfo --sound, but it's not exactly the same
> card.
> 
> Your have only 2 speakers working ? Ore no one ?
> 
> You have try Ubuntu 20.04 with kernel 5.11.5 ?

Just tried with kernel 5.11.5... No luck...

How ACL3306 not recognise, can we find some spec or information about it? Seems Realtek codec information is nowhere to be found... :(
Comment 133 lazertag 2021-05-18 19:39:31 UTC
(In reply to Vincent Morel from comment #132)
> (In reply to DavidLenovo from comment #127)
> > (In reply to Vincent Morel from comment #125)
> > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > 
> > Hi, I have similar result in hwinfo --sound, but it's not exactly the same
> > card.
> > 
> > Your have only 2 speakers working ? Ore no one ?
> > 
> > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> 
> Just tried with kernel 5.11.5... No luck...
> 
> How ACL3306 not recognise, can we find some spec or information about it?
> Seems Realtek codec information is nowhere to be found... :(

My unit is the Yoga 7-14ITL5 laptop (Ideapad) - Machine Type Model: 82BH0006US

It is only a 2 speaker system, right and left.

From a Windows 10 install on my device it is the ALC287.  I see no reference in Windows of ALC3306.

Lasty, sadly, none of the suggestions, be it using Arch or Ubuntu, have worked for myself to get sound from the speakers at any point.
Comment 134 DavidLenovo 2021-05-19 08:11:35 UTC
(In reply to Vincent Morel from comment #130)
> (In reply to DavidLenovo from comment #127)
> > (In reply to Vincent Morel from comment #125)
> > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > 
> > Hi, I have similar result in hwinfo --sound, but it's not exactly the same
> > card.
> > 
> > Your have only 2 speakers working ? Ore no one ?
> > 
> > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> 
> No speaker working (but headphone, hdmi... are working).
> 
> I did not try kernel 5.11.5 (My Pop Os is in 5.11.0 but I remember trying
> Ubuntu 21.04 and there was no sound also).

(In reply to Vincent Morel from comment #132)
> (In reply to DavidLenovo from comment #127)
> > (In reply to Vincent Morel from comment #125)
> > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > 
> > Hi, I have similar result in hwinfo --sound, but it's not exactly the same
> > card.
> > 
> > Your have only 2 speakers working ? Ore no one ?
> > 
> > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> 
> Just tried with kernel 5.11.5... No luck...
> 
> How ACL3306 not recognise, can we find some spec or information about it?
> Seems Realtek codec information is nowhere to be found... :(

Could you recheck, please :
cat /sys/power/mem_sleep

sudo dmesg |grep ACPI|grep supports

Do you have try, to play a long sound with VLC, y choose PulseAudio Server if it is available, on another session I just have sof-hda-dsp Speaker + Headphone (it work on both). If your change the sound output, stop and restart the sound.
Let the sound playing and put in sleep, put the computer on, and the sound work. It lagging for me at the beginning, and after few seconds it is ok.

You have ALC287 or ALC3306 ? You seem to have ALC3306, no ?
Not sure Ubuntu is work well for it.

I think your problem is to enable S3. 
It is probably not the same patch for you with you Lenovo Think Book 13s Gen 2. The patch is for Yoga 7i 14" and 15"

The user Wave could you help me more I think, my knowledge is limited.
Comment 135 DavidLenovo 2021-05-19 08:33:37 UTC
(In reply to wave from comment #131)
> (In reply to chenyh570 from comment #129)
> > (In reply to DavidLenovo from comment #120)
> > > Hi !
> > > A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 & 14ITL05
> &
> > > 15ITL05 & 15ITL5 :)

> 
> First of all allow me to remark that this is exactly the solution that I
> talked about in comment #97 and which I tried to explain to you specifically
> in more detail in comment #107; in fact I wrote the archwiki article
> referred to in the comment.
> 
> Now your problem seems to be related to permissions; perhaps you are running
> the whole command or padsp as sudo?

Sorry :( to don't mention you.
Thanks a lot :), effectively you see the problem firstly and you try to put all of us in the right way.
To be honest my knowledge is to limited to patch me alone. I had need the patch "key in hand", found after (put in my tutorial).
I think other people, need the patch "key in hand", with more simple tutorial.

I think your have lot of skill, and me (and probably other) just want simple solution (and can't do hard modification).

I'm not sure to understand, your are the writer of the tutorial : https://wiki.archlinux.org/title/Lenovo_Yoga_7i ? 

I think we are lot of people, to don't have lot of knowledge, and need very simple procedure. And for me I see lot of people very skilled, like you, to be documentation not enough easy for us. 
This is why I make this tutorial, with almost all commands.
For example the patch for the Yoga 7i (on Arch Wiki), don't have the beginning of the file : 
--- dsdt.dsl~    2018-04-26 09:35:29.501055509 -0600
+++ dsdt.dsl    2018-04-26 09:36:23.769729028 -0600 
So it can't work as is.
I had to take time to understand, and find why it don't work, I never do it before.

Thanks another time :)
Comment 136 wave 2021-05-19 09:26:21 UTC
(In reply to DavidLenovo from comment #135)
> (In reply to wave from comment #131)
> > (In reply to chenyh570 from comment #129)
> > > (In reply to DavidLenovo from comment #120)
> > > > Hi !
> > > > A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 &
> 14ITL05
> > &
> > > > 15ITL05 & 15ITL5 :)
> 
> > 
> > First of all allow me to remark that this is exactly the solution that I
> > talked about in comment #97 and which I tried to explain to you
> specifically
> > in more detail in comment #107; in fact I wrote the archwiki article
> > referred to in the comment.
> > 
> > Now your problem seems to be related to permissions; perhaps you are
> running
> > the whole command or padsp as sudo?
> 
> Sorry :( to don't mention you.
> Thanks a lot :), effectively you see the problem firstly and you try to put
> all of us in the right way.
> To be honest my knowledge is to limited to patch me alone. I had need the
> patch "key in hand", found after (put in my tutorial).
> I think other people, need the patch "key in hand", with more simple
> tutorial.
> 
> I think your have lot of skill, and me (and probably other) just want simple
> solution (and can't do hard modification).
> 
> I'm not sure to understand, your are the writer of the tutorial :
> https://wiki.archlinux.org/title/Lenovo_Yoga_7i ? 
> 
> I think we are lot of people, to don't have lot of knowledge, and need very
> simple procedure. And for me I see lot of people very skilled, like you, to
> be documentation not enough easy for us. 
> This is why I make this tutorial, with almost all commands.
> For example the patch for the Yoga 7i (on Arch Wiki), don't have the
> beginning of the file : 
> --- dsdt.dsl~    2018-04-26 09:35:29.501055509 -0600
> +++ dsdt.dsl    2018-04-26 09:36:23.769729028 -0600 
> So it can't work as is.
> I had to take time to understand, and find why it don't work, I never do it
> before.
> 
> Thanks another time :)

Don't worry, I didn't mean to criticize you at all :)
Quite the contrary, I know that my instructions were very terse (in that I did not duplicate instructions that are available elsewhere, which would be the wrong thing to do on the archwiki anyway), and I'm happy that you went through it, figured it out, and published your findings in an accessible way. You even cited my tutorial from archwiki so everything is perfect.

Thanks also for pointing out that the patch does not quite work with the patch command linked in the article; it works if you put the patch into a file like acpi.patch and then run
patch dsdt.dsl acpi.patch
(specifying both the file to be patched as well as the patch file). But I'll change that in the article. Nice that you figured it out though!
Comment 137 Vincent Morel 2021-05-19 14:03:26 UTC
(In reply to DavidLenovo from comment #134)
> (In reply to Vincent Morel from comment #130)
> > (In reply to DavidLenovo from comment #127)
> > > (In reply to Vincent Morel from comment #125)
> > > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > > 
> > > Hi, I have similar result in hwinfo --sound, but it's not exactly the
> same
> > > card.
> > > 
> > > Your have only 2 speakers working ? Ore no one ?
> > > 
> > > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> > 
> > No speaker working (but headphone, hdmi... are working).
> > 
> > I did not try kernel 5.11.5 (My Pop Os is in 5.11.0 but I remember trying
> > Ubuntu 21.04 and there was no sound also).
> 
> (In reply to Vincent Morel from comment #132)
> > (In reply to DavidLenovo from comment #127)
> > > (In reply to Vincent Morel from comment #125)
> > > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > > 
> > > Hi, I have similar result in hwinfo --sound, but it's not exactly the
> same
> > > card.
> > > 
> > > Your have only 2 speakers working ? Ore no one ?
> > > 
> > > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> > 
> > Just tried with kernel 5.11.5... No luck...
> > 
> > How ACL3306 not recognise, can we find some spec or information about it?
> > Seems Realtek codec information is nowhere to be found... :(
> 
> Could you recheck, please :
> cat /sys/power/mem_sleep
> 
> sudo dmesg |grep ACPI|grep supports
> 
> Do you have try, to play a long sound with VLC, y choose PulseAudio Server
> if it is available, on another session I just have sof-hda-dsp Speaker +
> Headphone (it work on both). If your change the sound output, stop and
> restart the sound.
> Let the sound playing and put in sleep, put the computer on, and the sound
> work. It lagging for me at the beginning, and after few seconds it is ok.
> 
> You have ALC287 or ALC3306 ? You seem to have ALC3306, no ?
> Not sure Ubuntu is work well for it.
> 
> I think your problem is to enable S3. 
> It is probably not the same patch for you with you Lenovo Think Book 13s Gen
> 2. The patch is for Yoga 7i 14" and 15"
> 
> The user Wave could you help me more I think, my knowledge is limited.

Sure thanks, here is my outputs! :)
cat /sys/power/mem_sleep
[s2idle] deep

sudo dmesg |grep ACPI|grep supports
[    0.242864] ACPI: (supports S0 S3 S4 S5)

VLC -> played long song, plugged headphone (sound on headphone works), changing output to speaker, no sound (note that sound meter show sound in preference, but sounds do not output to the speaker).

Put computer into sleep while playing. After resume, still no sound in speaker...

I have ALC3306. The only "not Ubuntu" I tried was Calculate Linux (Gentoo). I use PopOs, tried Ubuntu 21.04 also.

Only informations I found on the web always point back here.

Some infos: https://afterhourscoding.wordpress.com/tag/backlight/
And the kernel part: https://github.com/torvalds/linux/blob/master/sound/pci/hda/patch_realtek.c

At this point I fear it's becoming little too hard for me, but I can still try to do something. 

If I understand well this sentence 'According to Jaroslav Kysela Lenovo is using amplifier chips for the integrated speakers on recent hardware which must be initialized too. Much of that is undocumented.' we have to find a way to initialize the amplifier chip...
Comment 138 DavidLenovo 2021-05-19 14:50:26 UTC
(In reply to Vincent Morel from comment #137)
> (In reply to DavidLenovo from comment #134)
> > (In reply to Vincent Morel from comment #130)
> > > (In reply to DavidLenovo from comment #127)
> > > > (In reply to Vincent Morel from comment #125)
> > > > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > > > 
> > > > Hi, I have similar result in hwinfo --sound, but it's not exactly the
> > same
> > > > card.
> > > > 
> > > > Your have only 2 speakers working ? Ore no one ?
> > > > 
> > > > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> > > 
> > > No speaker working (but headphone, hdmi... are working).
> > > 
> > > I did not try kernel 5.11.5 (My Pop Os is in 5.11.0 but I remember trying
> > > Ubuntu 21.04 and there was no sound also).
> > 
> > (In reply to Vincent Morel from comment #132)
> > > (In reply to DavidLenovo from comment #127)
> > > > (In reply to Vincent Morel from comment #125)
> > > > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > > > 
> > > > Hi, I have similar result in hwinfo --sound, but it's not exactly the
> > same
> > > > card.
> > > > 
> > > > Your have only 2 speakers working ? Ore no one ?
> > > > 
> > > > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> > > 
> > > Just tried with kernel 5.11.5... No luck...
> > > 
> > > How ACL3306 not recognise, can we find some spec or information about it?
> > > Seems Realtek codec information is nowhere to be found... :(
> > 
> > Could you recheck, please :
> > cat /sys/power/mem_sleep
> > 
> > sudo dmesg |grep ACPI|grep supports
> > 
> > Do you have try, to play a long sound with VLC, y choose PulseAudio Server
> > if it is available, on another session I just have sof-hda-dsp Speaker +
> > Headphone (it work on both). If your change the sound output, stop and
> > restart the sound.
> > Let the sound playing and put in sleep, put the computer on, and the sound
> > work. It lagging for me at the beginning, and after few seconds it is ok.
> > 
> > You have ALC287 or ALC3306 ? You seem to have ALC3306, no ?
> > Not sure Ubuntu is work well for it.
> > 
> > I think your problem is to enable S3. 
> > It is probably not the same patch for you with you Lenovo Think Book 13s
> Gen
> > 2. The patch is for Yoga 7i 14" and 15"
> > 
> > The user Wave could you help me more I think, my knowledge is limited.
> 
> Sure thanks, here is my outputs! :)
> cat /sys/power/mem_sleep
> [s2idle] deep
> 
> sudo dmesg |grep ACPI|grep supports
> [    0.242864] ACPI: (supports S0 S3 S4 S5)
> 
> VLC -> played long song, plugged headphone (sound on headphone works),
> changing output to speaker, no sound (note that sound meter show sound in
> preference, but sounds do not output to the speaker).
> 
> Put computer into sleep while playing. After resume, still no sound in
> speaker...
> 
> I have ALC3306. The only "not Ubuntu" I tried was Calculate Linux (Gentoo).
> I use PopOs, tried Ubuntu 21.04 also.
> 
> Only informations I found on the web always point back here.
> 
> Some infos: https://afterhourscoding.wordpress.com/tag/backlight/
> And the kernel part:
> https://github.com/torvalds/linux/blob/master/sound/pci/hda/patch_realtek.c
> 
> At this point I fear it's becoming little too hard for me, but I can still
> try to do something. 
> 
> If I understand well this sentence 'According to Jaroslav Kysela Lenovo is
> using amplifier chips for the integrated speakers on recent hardware which
> must be initialized too. Much of that is undocumented.' we have to find a
> way to initialize the amplifier chip...

I think (I had the same error after new installation) this is your S3, it's available but don't activated : [s2idle]
deep is available but don't selected.
For me in [s2idle], brightness hotkey don't work to even after a suspend to ram.
(just with step 9 and deep, it magically work ;) )

You have to check step 9 :
> 9) GRUB needs to boot the kernel with a parameter setting the deep sleep
> state as default. Edit /etc/default/grub and add the following :

sudo nano /etc/default/grub
find GRUB_CMDLINE_LINUX_DEFAULT=, normaly it already exist, and replace or complete like this :
GRUB_CMDLINE_LINUX_DEFAULT="mem_sleep_default=deep"

It is the same for this line :
> GRUB_EARLY_INITRD_LINUX_CUSTOM="/boot/acpi_override""

Do you have GRUB_CMDLINE_LINUX_DEFAULT="mem_sleep_default=deep".
I think it is this command who force deep instead s2idle.

For me, the think to see, is to enable S3 (the patch and step 11, seem to be ok), just check the 9 !
Comment 139 DavidLenovo 2021-05-19 15:11:33 UTC
Sorry,
I write to quickly.
So you have to found the line : GRUB_CMDLINE_LINUX_DEFAULT=
Replace or complete with : 
GRUB_CMDLINE_LINUX_DEFAULT="mem_sleep_default=deep"

Put GRUB_EARLY_INITRD_LINUX_CUSTOM="/boot/acpi_override"
ERROR in my precedent post juste 1x" not acpi_override"" -> acpi_override", sorry.
This line probably don't exist.

After you have to regenerate grub :
10) Regenerate the GRUB configuration : 
sudo update-grub

recheck the step 11, it could, it would be erase by Grub :
> 11) Tell GRUB to load the new DSDT table on boot in its configuration file
> usually located in /boot/grub/grub.cfg. Find the relevant GRUB menu entry
> and add the new image /boot/acpi_override to the initrd lines for the
> images
> that you want the s3 sleep to work in : 

sudo nano /boot/grub/grub.cfg
or
sudo gedit /boot/grub/grub.cfg
(it could be easier to find initrd part)
replace in the kernel part initrd in the part menuentry (and all submenu) of the file /boot/grub/grub.cfg :

initrd /boot/initrd.img-5.11.5-051105-generic
> BECOME :
initrd /boot/acpi_override /boot/initrd.img-5.11.5-051105-generic

5.11.5-051105 is for the 5.11.5 kernel, you will have other number, you just have to do it for 5.11 kernels.
Comment 140 wave 2021-05-19 15:36:31 UTC
(In reply to Vincent Morel from comment #137)
> (In reply to DavidLenovo from comment #134)
> > (In reply to Vincent Morel from comment #130)
> > > (In reply to DavidLenovo from comment #127)
> > > > (In reply to Vincent Morel from comment #125)
> > > > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > > > 
> > > > Hi, I have similar result in hwinfo --sound, but it's not exactly the
> > same
> > > > card.
> > > > 
> > > > Your have only 2 speakers working ? Ore no one ?
> > > > 
> > > > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> > > 
> > > No speaker working (but headphone, hdmi... are working).
> > > 
> > > I did not try kernel 5.11.5 (My Pop Os is in 5.11.0 but I remember trying
> > > Ubuntu 21.04 and there was no sound also).
> > 
> > (In reply to Vincent Morel from comment #132)
> > > (In reply to DavidLenovo from comment #127)
> > > > (In reply to Vincent Morel from comment #125)
> > > > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > > > 
> > > > Hi, I have similar result in hwinfo --sound, but it's not exactly the
> > same
> > > > card.
> > > > 
> > > > Your have only 2 speakers working ? Ore no one ?
> > > > 
> > > > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> > > 
> > > Just tried with kernel 5.11.5... No luck...
> > > 
> > > How ACL3306 not recognise, can we find some spec or information about it?
> > > Seems Realtek codec information is nowhere to be found... :(
> > 
> > Could you recheck, please :
> > cat /sys/power/mem_sleep
> > 
> > sudo dmesg |grep ACPI|grep supports
> > 
> > Do you have try, to play a long sound with VLC, y choose PulseAudio Server
> > if it is available, on another session I just have sof-hda-dsp Speaker +
> > Headphone (it work on both). If your change the sound output, stop and
> > restart the sound.
> > Let the sound playing and put in sleep, put the computer on, and the sound
> > work. It lagging for me at the beginning, and after few seconds it is ok.
> > 
> > You have ALC287 or ALC3306 ? You seem to have ALC3306, no ?
> > Not sure Ubuntu is work well for it.
> > 
> > I think your problem is to enable S3. 
> > It is probably not the same patch for you with you Lenovo Think Book 13s
> Gen
> > 2. The patch is for Yoga 7i 14" and 15"
> > 
> > The user Wave could you help me more I think, my knowledge is limited.
> 
> Sure thanks, here is my outputs! :)
> cat /sys/power/mem_sleep
> [s2idle] deep
> 
> sudo dmesg |grep ACPI|grep supports
> [    0.242864] ACPI: (supports S0 S3 S4 S5)
> 
> VLC -> played long song, plugged headphone (sound on headphone works),
> changing output to speaker, no sound (note that sound meter show sound in
> preference, but sounds do not output to the speaker).
> 
> Put computer into sleep while playing. After resume, still no sound in
> speaker...
> 
> I have ALC3306. The only "not Ubuntu" I tried was Calculate Linux (Gentoo).
> I use PopOs, tried Ubuntu 21.04 also.
> 
> Only informations I found on the web always point back here.
> 
> Some infos: https://afterhourscoding.wordpress.com/tag/backlight/
> And the kernel part:
> https://github.com/torvalds/linux/blob/master/sound/pci/hda/patch_realtek.c
> 
> At this point I fear it's becoming little too hard for me, but I can still
> try to do something. 
> 
> If I understand well this sentence 'According to Jaroslav Kysela Lenovo is
> using amplifier chips for the integrated speakers on recent hardware which
> must be initialized too. Much of that is undocumented.' we have to find a
> way to initialize the amplifier chip...

For a quick test without having to change your grub config you can also run
echo deep > /sys/power/mem_sleep
as root and then try playing sound and hibernating again.
Comment 141 Vincent Morel 2021-05-19 15:42:14 UTC
(In reply to wave from comment #140)
> (In reply to Vincent Morel from comment #137)
> > (In reply to DavidLenovo from comment #134)
> > > (In reply to Vincent Morel from comment #130)
> > > > (In reply to DavidLenovo from comment #127)
> > > > > (In reply to Vincent Morel from comment #125)
> > > > > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > > > > 
> > > > > Hi, I have similar result in hwinfo --sound, but it's not exactly the
> > > same
> > > > > card.
> > > > > 
> > > > > Your have only 2 speakers working ? Ore no one ?
> > > > > 
> > > > > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> > > > 
> > > > No speaker working (but headphone, hdmi... are working).
> > > > 
> > > > I did not try kernel 5.11.5 (My Pop Os is in 5.11.0 but I remember
> trying
> > > > Ubuntu 21.04 and there was no sound also).
> > > 
> > > (In reply to Vincent Morel from comment #132)
> > > > (In reply to DavidLenovo from comment #127)
> > > > > (In reply to Vincent Morel from comment #125)
> > > > > > On the 13S Gen 2, there is only 2 speakers, and S3 is activated...
> > > > > 
> > > > > Hi, I have similar result in hwinfo --sound, but it's not exactly the
> > > same
> > > > > card.
> > > > > 
> > > > > Your have only 2 speakers working ? Ore no one ?
> > > > > 
> > > > > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> > > > 
> > > > Just tried with kernel 5.11.5... No luck...
> > > > 
> > > > How ACL3306 not recognise, can we find some spec or information about
> it?
> > > > Seems Realtek codec information is nowhere to be found... :(
> > > 
> > > Could you recheck, please :
> > > cat /sys/power/mem_sleep
> > > 
> > > sudo dmesg |grep ACPI|grep supports
> > > 
> > > Do you have try, to play a long sound with VLC, y choose PulseAudio
> Server
> > > if it is available, on another session I just have sof-hda-dsp Speaker +
> > > Headphone (it work on both). If your change the sound output, stop and
> > > restart the sound.
> > > Let the sound playing and put in sleep, put the computer on, and the
> sound
> > > work. It lagging for me at the beginning, and after few seconds it is ok.
> > > 
> > > You have ALC287 or ALC3306 ? You seem to have ALC3306, no ?
> > > Not sure Ubuntu is work well for it.
> > > 
> > > I think your problem is to enable S3. 
> > > It is probably not the same patch for you with you Lenovo Think Book 13s
> > Gen
> > > 2. The patch is for Yoga 7i 14" and 15"
> > > 
> > > The user Wave could you help me more I think, my knowledge is limited.
> > 
> > Sure thanks, here is my outputs! :)
> > cat /sys/power/mem_sleep
> > [s2idle] deep
> > 
> > sudo dmesg |grep ACPI|grep supports
> > [    0.242864] ACPI: (supports S0 S3 S4 S5)
> > 
> > VLC -> played long song, plugged headphone (sound on headphone works),
> > changing output to speaker, no sound (note that sound meter show sound in
> > preference, but sounds do not output to the speaker).
> > 
> > Put computer into sleep while playing. After resume, still no sound in
> > speaker...
> > 
> > I have ALC3306. The only "not Ubuntu" I tried was Calculate Linux (Gentoo).
> > I use PopOs, tried Ubuntu 21.04 also.
> > 
> > Only informations I found on the web always point back here.
> > 
> > Some infos: https://afterhourscoding.wordpress.com/tag/backlight/
> > And the kernel part:
> > https://github.com/torvalds/linux/blob/master/sound/pci/hda/patch_realtek.c
> > 
> > At this point I fear it's becoming little too hard for me, but I can still
> > try to do something. 
> > 
> > If I understand well this sentence 'According to Jaroslav Kysela Lenovo is
> > using amplifier chips for the integrated speakers on recent hardware which
> > must be initialized too. Much of that is undocumented.' we have to find a
> > way to initialize the amplifier chip...
> 
> For a quick test without having to change your grub config you can also run
> echo deep > /sys/power/mem_sleep
> as root and then try playing sound and hibernating again.

Thanks for all those precious infos! Just to make things more complicated, PopOs use systemd-boot and not grub.
Anyway I was able to activate 'deep' sleep with this command:

sudo kernelstub -a "mem_sleep_default=deep"

and after reboot I have:
cat /sys/power/mem_sleep
s2idle [deep]


But my computer is not able to exit from sleep now. It goes into deep sleep (I see the led in sleeping mode) but as soon as I press a key the computer turn off. I have to turn it on and it boots...

I also try to do it by adding mem_sleep_default=deep in /boot/efi/loader/entries/pop_OS-current.conf (that's where you put option in systemd-boot)

Same result... I'll try a totally different distribution when I have time (not ubuntu based) to see if I can do it.
Comment 142 wave 2021-05-19 17:41:21 UTC
(In reply to Vincent Morel from comment #141)
> (In reply to wave from comment #140)
> > (In reply to Vincent Morel from comment #137)
> > > (In reply to DavidLenovo from comment #134)
> > > > (In reply to Vincent Morel from comment #130)
> > > > > (In reply to DavidLenovo from comment #127)
> > > > > > (In reply to Vincent Morel from comment #125)
> > > > > > > On the 13S Gen 2, there is only 2 speakers, and S3 is
> activated...
> > > > > > 
> > > > > > Hi, I have similar result in hwinfo --sound, but it's not exactly
> the
> > > > same
> > > > > > card.
> > > > > > 
> > > > > > Your have only 2 speakers working ? Ore no one ?
> > > > > > 
> > > > > > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> > > > > 
> > > > > No speaker working (but headphone, hdmi... are working).
> > > > > 
> > > > > I did not try kernel 5.11.5 (My Pop Os is in 5.11.0 but I remember
> > trying
> > > > > Ubuntu 21.04 and there was no sound also).
> > > > 
> > > > (In reply to Vincent Morel from comment #132)
> > > > > (In reply to DavidLenovo from comment #127)
> > > > > > (In reply to Vincent Morel from comment #125)
> > > > > > > On the 13S Gen 2, there is only 2 speakers, and S3 is
> activated...
> > > > > > 
> > > > > > Hi, I have similar result in hwinfo --sound, but it's not exactly
> the
> > > > same
> > > > > > card.
> > > > > > 
> > > > > > Your have only 2 speakers working ? Ore no one ?
> > > > > > 
> > > > > > You have try Ubuntu 20.04 with kernel 5.11.5 ?
> > > > > 
> > > > > Just tried with kernel 5.11.5... No luck...
> > > > > 
> > > > > How ACL3306 not recognise, can we find some spec or information about
> > it?
> > > > > Seems Realtek codec information is nowhere to be found... :(
> > > > 
> > > > Could you recheck, please :
> > > > cat /sys/power/mem_sleep
> > > > 
> > > > sudo dmesg |grep ACPI|grep supports
> > > > 
> > > > Do you have try, to play a long sound with VLC, y choose PulseAudio
> > Server
> > > > if it is available, on another session I just have sof-hda-dsp Speaker
> +
> > > > Headphone (it work on both). If your change the sound output, stop and
> > > > restart the sound.
> > > > Let the sound playing and put in sleep, put the computer on, and the
> > sound
> > > > work. It lagging for me at the beginning, and after few seconds it is
> ok.
> > > > 
> > > > You have ALC287 or ALC3306 ? You seem to have ALC3306, no ?
> > > > Not sure Ubuntu is work well for it.
> > > > 
> > > > I think your problem is to enable S3. 
> > > > It is probably not the same patch for you with you Lenovo Think Book
> 13s
> > > Gen
> > > > 2. The patch is for Yoga 7i 14" and 15"
> > > > 
> > > > The user Wave could you help me more I think, my knowledge is limited.
> > > 
> > > Sure thanks, here is my outputs! :)
> > > cat /sys/power/mem_sleep
> > > [s2idle] deep
> > > 
> > > sudo dmesg |grep ACPI|grep supports
> > > [    0.242864] ACPI: (supports S0 S3 S4 S5)
> > > 
> > > VLC -> played long song, plugged headphone (sound on headphone works),
> > > changing output to speaker, no sound (note that sound meter show sound in
> > > preference, but sounds do not output to the speaker).
> > > 
> > > Put computer into sleep while playing. After resume, still no sound in
> > > speaker...
> > > 
> > > I have ALC3306. The only "not Ubuntu" I tried was Calculate Linux
> (Gentoo).
> > > I use PopOs, tried Ubuntu 21.04 also.
> > > 
> > > Only informations I found on the web always point back here.
> > > 
> > > Some infos: https://afterhourscoding.wordpress.com/tag/backlight/
> > > And the kernel part:
> > >
> https://github.com/torvalds/linux/blob/master/sound/pci/hda/patch_realtek.c
> > > 
> > > At this point I fear it's becoming little too hard for me, but I can
> still
> > > try to do something. 
> > > 
> > > If I understand well this sentence 'According to Jaroslav Kysela Lenovo
> is
> > > using amplifier chips for the integrated speakers on recent hardware
> which
> > > must be initialized too. Much of that is undocumented.' we have to find a
> > > way to initialize the amplifier chip...
> > 
> > For a quick test without having to change your grub config you can also run
> > echo deep > /sys/power/mem_sleep
> > as root and then try playing sound and hibernating again.
> 
> Thanks for all those precious infos! Just to make things more complicated,
> PopOs use systemd-boot and not grub.
> Anyway I was able to activate 'deep' sleep with this command:
> 
> sudo kernelstub -a "mem_sleep_default=deep"
> 
> and after reboot I have:
> cat /sys/power/mem_sleep
> s2idle [deep]
> 
> 
> But my computer is not able to exit from sleep now. It goes into deep sleep
> (I see the led in sleeping mode) but as soon as I press a key the computer
> turn off. I have to turn it on and it boots...
> 
> I also try to do it by adding mem_sleep_default=deep in
> /boot/efi/loader/entries/pop_OS-current.conf (that's where you put option in
> systemd-boot)
> 
> Same result... I'll try a totally different distribution when I have time
> (not ubuntu based) to see if I can do it.

Did you have to patch the DSDT table in order to get S3 sleep and if yes did the patch apply cleanly?

Does the problem also occur if you do
systemctl hibernate
explicitly?
Comment 143 DavidLenovo 2021-05-19 19:36:33 UTC
(In reply to wave from comment #136)
> (In reply to DavidLenovo from comment #135)
> > (In reply to wave from comment #131)
> > > (In reply to chenyh570 from comment #129)
> > > > (In reply to DavidLenovo from comment #120)
> > > > > Hi !
> > > > > A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 &
> > 14ITL05
> > > &
> > > > > 15ITL05 & 15ITL5 :)
> > 
> > > 
> > > First of all allow me to remark that this is exactly the solution that I
> > > talked about in comment #97 and which I tried to explain to you
> > specifically
> > > in more detail in comment #107; in fact I wrote the archwiki article
> > > referred to in the comment.
> > > 
> > > Now your problem seems to be related to permissions; perhaps you are
> > running
> > > the whole command or padsp as sudo?
> > 
> > Sorry :( to don't mention you.
> > Thanks a lot :), effectively you see the problem firstly and you try to put
> > all of us in the right way.
> > To be honest my knowledge is to limited to patch me alone. I had need the
> > patch "key in hand", found after (put in my tutorial).
> > I think other people, need the patch "key in hand", with more simple
> > tutorial.
> > 
> > I think your have lot of skill, and me (and probably other) just want
> simple
> > solution (and can't do hard modification).
> > 
> > I'm not sure to understand, your are the writer of the tutorial :
> > https://wiki.archlinux.org/title/Lenovo_Yoga_7i ? 
> > 
> > I think we are lot of people, to don't have lot of knowledge, and need very
> > simple procedure. And for me I see lot of people very skilled, like you, to
> > be documentation not enough easy for us. 
> > This is why I make this tutorial, with almost all commands.
> > For example the patch for the Yoga 7i (on Arch Wiki), don't have the
> > beginning of the file : 
> > --- dsdt.dsl~    2018-04-26 09:35:29.501055509 -0600
> > +++ dsdt.dsl    2018-04-26 09:36:23.769729028 -0600 
> > So it can't work as is.
> > I had to take time to understand, and find why it don't work, I never do it
> > before.
> > 
> > Thanks another time :)
> 
> Don't worry, I didn't mean to criticize you at all :)
> Quite the contrary, I know that my instructions were very terse (in that I
> did not duplicate instructions that are available elsewhere, which would be
> the wrong thing to do on the archwiki anyway), and I'm happy that you went
> through it, figured it out, and published your findings in an accessible
> way. You even cited my tutorial from archwiki so everything is perfect.
> 
> Thanks also for pointing out that the patch does not quite work with the
> patch command linked in the article; it works if you put the patch into a
> file like acpi.patch and then run
> patch dsdt.dsl acpi.patch
> (specifying both the file to be patched as well as the patch file). But I'll
> change that in the article. Nice that you figured it out though!

Ok :)
Thanks for your work, and your wiki page, it's very great to have speakers :)
Thanks for the patch info
Comment 144 DavidLenovo 2021-05-19 19:46:43 UTC
(In reply to Vincent Morel from comment #141)
> Thanks for all those precious infos! Just to make things more complicated,
> PopOs use systemd-boot and not grub.
> Anyway I was able to activate 'deep' sleep with this command:
> 
> sudo kernelstub -a "mem_sleep_default=deep"
> 
> and after reboot I have:
> cat /sys/power/mem_sleep
> s2idle [deep]
> 
> 
> But my computer is not able to exit from sleep now. It goes into deep sleep
> (I see the led in sleeping mode) but as soon as I press a key the computer
> turn off. I have to turn it on and it boots...
> 
> I also try to do it by adding mem_sleep_default=deep in
> /boot/efi/loader/entries/pop_OS-current.conf (that's where you put option in
> systemd-boot)
> 
> Same result... I'll try a totally different distribution when I have time
> (not ubuntu based) to see if I can do it.

(In reply to wave from comment #142)
 
> Did you have to patch the DSDT table in order to get S3 sleep and if yes did
> the patch apply cleanly?
> 
> Does the problem also occur if you do
> systemctl hibernate
> explicitly?

Your sure your have to hibernate ?
For me in S2 or S3 hibernate (suspend to disk) is the same.
But sleeping : suspend to ram, is not the same in S2 and S3.

For me I boot, and I make a sleep (suspend to ram) to enable speaker and brightness hotkeys.

Your tutorial (Wave) have a script with : rtcwake -m mem -s 1 that it is : suspend to memory.

@Vincent Morel : could you try sleep (suspend to ram) (not to disk) ?
Comment 145 wave 2021-05-19 20:48:26 UTC
(In reply to DavidLenovo from comment #144)
> (In reply to Vincent Morel from comment #141)
> > Thanks for all those precious infos! Just to make things more complicated,
> > PopOs use systemd-boot and not grub.
> > Anyway I was able to activate 'deep' sleep with this command:
> > 
> > sudo kernelstub -a "mem_sleep_default=deep"
> > 
> > and after reboot I have:
> > cat /sys/power/mem_sleep
> > s2idle [deep]
> > 
> > 
> > But my computer is not able to exit from sleep now. It goes into deep sleep
> > (I see the led in sleeping mode) but as soon as I press a key the computer
> > turn off. I have to turn it on and it boots...
> > 
> > I also try to do it by adding mem_sleep_default=deep in
> > /boot/efi/loader/entries/pop_OS-current.conf (that's where you put option
> in
> > systemd-boot)
> > 
> > Same result... I'll try a totally different distribution when I have time
> > (not ubuntu based) to see if I can do it.
> 
> (In reply to wave from comment #142)
>  
> > Did you have to patch the DSDT table in order to get S3 sleep and if yes
> did
> > the patch apply cleanly?
> > 
> > Does the problem also occur if you do
> > systemctl hibernate
> > explicitly?
> 
> Your sure your have to hibernate ?
> For me in S2 or S3 hibernate (suspend to disk) is the same.
> But sleeping : suspend to ram, is not the same in S2 and S3.
> 
> For me I boot, and I make a sleep (suspend to ram) to enable speaker and
> brightness hotkeys.
> 
> Your tutorial (Wave) have a script with : rtcwake -m mem -s 1 that it is :
> suspend to memory.
> 
> @Vincent Morel : could you try sleep (suspend to ram) (not to disk) ?

You're right, my bad, sorry. Hibernating takes too much time to wake up, I think that's the reason why it doesn't activate sound (my brightness keys do work after suspend to disk/hibernate). Should do
systemctl suspend
instead, this should trigger S3 sleep.
Comment 146 Vincent Morel 2021-05-19 21:07:22 UTC
(In reply to DavidLenovo from comment #144)
> (In reply to Vincent Morel from comment #141)
> > Thanks for all those precious infos! Just to make things more complicated,
> > PopOs use systemd-boot and not grub.
> > Anyway I was able to activate 'deep' sleep with this command:
> > 
> > sudo kernelstub -a "mem_sleep_default=deep"
> > 
> > and after reboot I have:
> > cat /sys/power/mem_sleep
> > s2idle [deep]
> > 
> > 
> > But my computer is not able to exit from sleep now. It goes into deep sleep
> > (I see the led in sleeping mode) but as soon as I press a key the computer
> > turn off. I have to turn it on and it boots...
> > 
> > I also try to do it by adding mem_sleep_default=deep in
> > /boot/efi/loader/entries/pop_OS-current.conf (that's where you put option
> in
> > systemd-boot)
> > 
> > Same result... I'll try a totally different distribution when I have time
> > (not ubuntu based) to see if I can do it.
> 
> (In reply to wave from comment #142)
>  
> > Did you have to patch the DSDT table in order to get S3 sleep and if yes
> did
> > the patch apply cleanly?
> > 
> > Does the problem also occur if you do
> > systemctl hibernate
> > explicitly?
> 
> Your sure your have to hibernate ?
> For me in S2 or S3 hibernate (suspend to disk) is the same.
> But sleeping : suspend to ram, is not the same in S2 and S3.
> 
> For me I boot, and I make a sleep (suspend to ram) to enable speaker and
> brightness hotkeys.
> 
> Your tutorial (Wave) have a script with : rtcwake -m mem -s 1 that it is :
> suspend to memory.
> 
> @Vincent Morel : could you try sleep (suspend to ram) (not to disk) ?

I tried hibernate and suspend. Hibernate do not allow me to wake the computer, I have to reboot.
Suspend works great but no sound at all.

For the question regarding DSDT, no, I did not have to patch anything to have "deep" activated. 
And my Brightness key work out of the box (as all the special keys, volume, mute, mic mute, plane...).
Comment 147 DavidLenovo 2021-05-19 22:20:08 UTC
(In reply to Vincent Morel from comment #146)
> 
> I tried hibernate and suspend. Hibernate do not allow me to wake the
> computer, I have to reboot.
> Suspend works great but no sound at all.
> 
> For the question regarding DSDT, no, I did not have to patch anything to
> have "deep" activated. 
> And my Brightness key work out of the box (as all the special keys, volume,
> mute, mic mute, plane...).

Ok, thanks. 
As you say, you have the ACL3306 not ALC287, Is it different ?
Do you have try with Windows ? And shutdown totally Windows, I have read a partial shutdown could lock equipment. But I don't know more.
Comment 148 wave 2021-05-19 22:23:18 UTC
(In reply to Vincent Morel from comment #146)
> (In reply to DavidLenovo from comment #144)
> > (In reply to Vincent Morel from comment #141)
> > > Thanks for all those precious infos! Just to make things more
> complicated,
> > > PopOs use systemd-boot and not grub.
> > > Anyway I was able to activate 'deep' sleep with this command:
> > > 
> > > sudo kernelstub -a "mem_sleep_default=deep"
> > > 
> > > and after reboot I have:
> > > cat /sys/power/mem_sleep
> > > s2idle [deep]
> > > 
> > > 
> > > But my computer is not able to exit from sleep now. It goes into deep
> sleep
> > > (I see the led in sleeping mode) but as soon as I press a key the
> computer
> > > turn off. I have to turn it on and it boots...
> > > 
> > > I also try to do it by adding mem_sleep_default=deep in
> > > /boot/efi/loader/entries/pop_OS-current.conf (that's where you put option
> > in
> > > systemd-boot)
> > > 
> > > Same result... I'll try a totally different distribution when I have time
> > > (not ubuntu based) to see if I can do it.
> > 
> > (In reply to wave from comment #142)
> >  
> > > Did you have to patch the DSDT table in order to get S3 sleep and if yes
> > did
> > > the patch apply cleanly?
> > > 
> > > Does the problem also occur if you do
> > > systemctl hibernate
> > > explicitly?
> > 
> > Your sure your have to hibernate ?
> > For me in S2 or S3 hibernate (suspend to disk) is the same.
> > But sleeping : suspend to ram, is not the same in S2 and S3.
> > 
> > For me I boot, and I make a sleep (suspend to ram) to enable speaker and
> > brightness hotkeys.
> > 
> > Your tutorial (Wave) have a script with : rtcwake -m mem -s 1 that it is :
> > suspend to memory.
> > 
> > @Vincent Morel : could you try sleep (suspend to ram) (not to disk) ?
> 
> I tried hibernate and suspend. Hibernate do not allow me to wake the
> computer, I have to reboot.
> Suspend works great but no sound at all.
> 
> For the question regarding DSDT, no, I did not have to patch anything to
> have "deep" activated. 
> And my Brightness key work out of the box (as all the special keys, volume,
> mute, mic mute, plane...).

Okay, well you do have a different sound card after all, so it might be better to open a separate bug report, and maybe also one for the hibernation issue.
Comment 149 Vincent Morel 2021-05-20 13:08:11 UTC
(In reply to wave from comment #148)
> (In reply to Vincent Morel from comment #146)
> > (In reply to DavidLenovo from comment #144)
> > > (In reply to Vincent Morel from comment #141)
> > > > Thanks for all those precious infos! Just to make things more
> > complicated,
> > > > PopOs use systemd-boot and not grub.
> > > > Anyway I was able to activate 'deep' sleep with this command:
> > > > 
> > > > sudo kernelstub -a "mem_sleep_default=deep"
> > > > 
> > > > and after reboot I have:
> > > > cat /sys/power/mem_sleep
> > > > s2idle [deep]
> > > > 
> > > > 
> > > > But my computer is not able to exit from sleep now. It goes into deep
> > sleep
> > > > (I see the led in sleeping mode) but as soon as I press a key the
> > computer
> > > > turn off. I have to turn it on and it boots...
> > > > 
> > > > I also try to do it by adding mem_sleep_default=deep in
> > > > /boot/efi/loader/entries/pop_OS-current.conf (that's where you put
> option
> > > in
> > > > systemd-boot)
> > > > 
> > > > Same result... I'll try a totally different distribution when I have
> time
> > > > (not ubuntu based) to see if I can do it.
> > > 
> > > (In reply to wave from comment #142)
> > >  
> > > > Did you have to patch the DSDT table in order to get S3 sleep and if
> yes
> > > did
> > > > the patch apply cleanly?
> > > > 
> > > > Does the problem also occur if you do
> > > > systemctl hibernate
> > > > explicitly?
> > > 
> > > Your sure your have to hibernate ?
> > > For me in S2 or S3 hibernate (suspend to disk) is the same.
> > > But sleeping : suspend to ram, is not the same in S2 and S3.
> > > 
> > > For me I boot, and I make a sleep (suspend to ram) to enable speaker and
> > > brightness hotkeys.
> > > 
> > > Your tutorial (Wave) have a script with : rtcwake -m mem -s 1 that it is
> :
> > > suspend to memory.
> > > 
> > > @Vincent Morel : could you try sleep (suspend to ram) (not to disk) ?
> > 
> > I tried hibernate and suspend. Hibernate do not allow me to wake the
> > computer, I have to reboot.
> > Suspend works great but no sound at all.
> > 
> > For the question regarding DSDT, no, I did not have to patch anything to
> > have "deep" activated. 
> > And my Brightness key work out of the box (as all the special keys, volume,
> > mute, mic mute, plane...).
> 
> Okay, well you do have a different sound card after all, so it might be
> better to open a separate bug report, and maybe also one for the hibernation
> issue.

Yes, thanks for your support, I will open another bug report. :)
Comment 150 waterproof93 2021-05-20 13:41:23 UTC
(In reply to Vincent Morel from comment #149)
> (In reply to wave from comment #148)
> > (In reply to Vincent Morel from comment #146)
> > > (In reply to DavidLenovo from comment #144)
> > > > (In reply to Vincent Morel from comment #141)
> > > > > Thanks for all those precious infos! Just to make things more
> > > complicated,
> > > > > PopOs use systemd-boot and not grub.
> > > > > Anyway I was able to activate 'deep' sleep with this command:
> > > > > 
> > > > > sudo kernelstub -a "mem_sleep_default=deep"
> > > > > 
> > > > > and after reboot I have:
> > > > > cat /sys/power/mem_sleep
> > > > > s2idle [deep]
> > > > > 
> > > > > 
> > > > > But my computer is not able to exit from sleep now. It goes into deep
> > > sleep
> > > > > (I see the led in sleeping mode) but as soon as I press a key the
> > > computer
> > > > > turn off. I have to turn it on and it boots...
> > > > > 
> > > > > I also try to do it by adding mem_sleep_default=deep in
> > > > > /boot/efi/loader/entries/pop_OS-current.conf (that's where you put
> > option
> > > > in
> > > > > systemd-boot)
> > > > > 
> > > > > Same result... I'll try a totally different distribution when I have
> > time
> > > > > (not ubuntu based) to see if I can do it.
> > > > 
> > > > (In reply to wave from comment #142)
> > > >  
> > > > > Did you have to patch the DSDT table in order to get S3 sleep and if
> > yes
> > > > did
> > > > > the patch apply cleanly?
> > > > > 
> > > > > Does the problem also occur if you do
> > > > > systemctl hibernate
> > > > > explicitly?
> > > > 
> > > > Your sure your have to hibernate ?
> > > > For me in S2 or S3 hibernate (suspend to disk) is the same.
> > > > But sleeping : suspend to ram, is not the same in S2 and S3.
> > > > 
> > > > For me I boot, and I make a sleep (suspend to ram) to enable speaker
> and
> > > > brightness hotkeys.
> > > > 
> > > > Your tutorial (Wave) have a script with : rtcwake -m mem -s 1 that it
> is
> > :
> > > > suspend to memory.
> > > > 
> > > > @Vincent Morel : could you try sleep (suspend to ram) (not to disk) ?
> > > 
> > > I tried hibernate and suspend. Hibernate do not allow me to wake the
> > > computer, I have to reboot.
> > > Suspend works great but no sound at all.
> > > 
> > > For the question regarding DSDT, no, I did not have to patch anything to
> > > have "deep" activated. 
> > > And my Brightness key work out of the box (as all the special keys,
> volume,
> > > mute, mic mute, plane...).
> > 
> > Okay, well you do have a different sound card after all, so it might be
> > better to open a separate bug report, and maybe also one for the
> hibernation
> > issue.
> 
> Yes, thanks for your support, I will open another bug report. :)

I think I have the same issue with the same machine
Thinkbook 13s G2

Let me know when you open a new thread I would like to follow it
Comment 151 Vincent Morel 2021-05-20 13:48:09 UTC
(In reply to waterproof93 from comment #150)

> 
> I think I have the same issue with the same machine
> Thinkbook 13s G2
> 
> Let me know when you open a new thread I would like to follow it

Just opened it :) 
https://bugzilla.kernel.org/show_bug.cgi?id=213159
Comment 152 Thiago T 2021-05-20 15:39:22 UTC
I am also going to join the new thread. 
Despite the alsa-info showing ALC287, I just realized that the Legion 7i 15IMH05 has the Realtek® ALC3306 codec (https://psref.lenovo.com/syspool/Sys/PDF/Legion/Lenovo_Legion_7_15IMH05/Lenovo_Legion_7_15IMH05_Spec.pdf).
I have not seen any mention at the kernel source about the ALC3306.
Comment 153 Dre 2021-05-25 14:01:11 UTC
Just confirming that I was able to follow the tutorial by @wave to get my speakers working.  S3 sleep enabled without a hitch.  I have the Lenovo Yoga 7i 14ITL5.  The only issue I ran into was with the login script, but I'm personally OK with that for now (appears I have a permissions issue).  I'm currently running Manjaro 21.0.5.  I simply have to play some audio, suspend, then wake.  Audio then plays through the speakers immediately after waking, even before I unlock the session.
Just sharing my experience.  Thanks to all who have contributed to the progress being made on this issue!
Comment 154 Dre 2021-05-25 17:03:42 UTC
(In reply to Dre from comment #153)
> Just confirming that I was able to follow the tutorial by @wave to get my
> speakers working.  S3 sleep enabled without a hitch.  I have the Lenovo Yoga
> 7i 14ITL5.  The only issue I ran into was with the login script, but I'm
> personally OK with that for now (appears I have a permissions issue).  I'm
> currently running Manjaro 21.0.5.  I simply have to play some audio,
> suspend, then wake.  Audio then plays through the speakers immediately after
> waking, even before I unlock the session.
> Just sharing my experience.  Thanks to all who have contributed to the
> progress being made on this issue!

This was on LTS Kernel 5.10.36-2
Comment 155 Brian Long 2021-05-25 19:25:37 UTC
(In reply to Dre from comment #153)
> Just confirming that I was able to follow the tutorial by @wave to get my
> speakers working.  S3 sleep enabled without a hitch.  I have the Lenovo Yoga
> 7i 14ITL5.  The only issue I ran into was with the login script, but I'm
> personally OK with that for now (appears I have a permissions issue).  I'm
> currently running Manjaro 21.0.5.  I simply have to play some audio,
> suspend, then wake.  Audio then plays through the speakers immediately after
> waking, even before I unlock the session.
> Just sharing my experience.  Thanks to all who have contributed to the
> progress being made on this issue!

I have the same system and "deep" will not enable.
Comment 156 Dre 2021-05-26 12:39:10 UTC
(In reply to Brian Long from comment #155)
> (In reply to Dre from comment #153)
> > Just confirming that I was able to follow the tutorial by @wave to get my
> > speakers working.  S3 sleep enabled without a hitch.  I have the Lenovo
> Yoga
> > 7i 14ITL5.  The only issue I ran into was with the login script, but I'm
> > personally OK with that for now (appears I have a permissions issue).  I'm
> > currently running Manjaro 21.0.5.  I simply have to play some audio,
> > suspend, then wake.  Audio then plays through the speakers immediately
> after
> > waking, even before I unlock the session.
> > Just sharing my experience.  Thanks to all who have contributed to the
> > progress being made on this issue!
> 
> I have the same system and "deep" will not enable.

I tried the Arch wiki tutorial on Fedora, Fedora Rawhide, and at least one Ubuntu based distro, but to no avail.  It worked only on an Arch based distro for me.  I used the latest Manjaro Gnome with the default LTS kernel.
Comment 157 Niclas 2021-05-29 11:44:35 UTC
No luck here with making the sleep working. 

Anyone know if someone is in contact with the manufacturer?
Comment 158 DavidLenovo 2021-06-02 13:25:19 UTC
(In reply to Brian Long from comment #155)
> (In reply to Dre from comment #153)
> > Just confirming that I was able to follow the tutorial by @wave to get my
> > speakers working.  S3 sleep enabled without a hitch.  I have the Lenovo
> Yoga
> > 7i 14ITL5.  The only issue I ran into was with the login script, but I'm
> > personally OK with that for now (appears I have a permissions issue).  I'm
> > currently running Manjaro 21.0.5.  I simply have to play some audio,
> > suspend, then wake.  Audio then plays through the speakers immediately
> after
> > waking, even before I unlock the session.
> > Just sharing my experience.  Thanks to all who have contributed to the
> > progress being made on this issue!
> 
> I have the same system and "deep" will not enable.

Hi, for you and all people without S3, could you try : 
cat /sys/power/mem_sleep

sudo dmesg |grep ACPI|grep supports

And find  kernel: ACPI: DSDT 0x...(remove by me) ...(remove by me) v02 LENOVO CB-01    00000003 INTL ...)
Do you have 00000002 or 00000003 ?
I think sudo dmesg |grep ACPI|grep DSDT will work 
or just sudo dmesg |grep DSDT

Thanks
(In reply to Niclas from comment #157)
> No luck here with making the sleep working. 
> 
> Anyone know if someone is in contact with the manufacturer?

I contact them, for Lenovo it's not specified it is an Linux laptop, so it is not a problem.
The problem is reported by the person answer me, but we don't have tracking or any-else.

You can check an alternative BIOS, the problem seem to be created by a deactivation of the S3 in the BIOS. We have a limited bios, but people have found in another model, it's just a switch to enable in the dump. www.bios-mods.com can modify your dump to enable this.

Have a good day
Comment 159 Dre 2021-06-02 15:03:31 UTC
(In reply to DavidLenovo from comment #158)
> (In reply to Brian Long from comment #155)
> > (In reply to Dre from comment #153)
> > > Just confirming that I was able to follow the tutorial by @wave to get my
> > > speakers working.  S3 sleep enabled without a hitch.  I have the Lenovo
> > Yoga
> > > 7i 14ITL5.  The only issue I ran into was with the login script, but I'm
> > > personally OK with that for now (appears I have a permissions issue). 
> I'm
> > > currently running Manjaro 21.0.5.  I simply have to play some audio,
> > > suspend, then wake.  Audio then plays through the speakers immediately
> > after
> > > waking, even before I unlock the session.
> > > Just sharing my experience.  Thanks to all who have contributed to the
> > > progress being made on this issue!
> > 
> > I have the same system and "deep" will not enable.
> 
> Hi, for you and all people without S3, could you try : 
> cat /sys/power/mem_sleep
> 
> sudo dmesg |grep ACPI|grep supports
> 
> And find  kernel: ACPI: DSDT 0x...(remove by me) ...(remove by me) v02
> LENOVO CB-01    00000003 INTL ...)
> Do you have 00000002 or 00000003 ?
> I think sudo dmesg |grep ACPI|grep DSDT will work 
> or just sudo dmesg |grep DSDT
> 
> Thanks
> (In reply to Niclas from comment #157)
> > No luck here with making the sleep working. 
> > 
> > Anyone know if someone is in contact with the manufacturer?
> 
> I contact them, for Lenovo it's not specified it is an Linux laptop, so it
> is not a problem.
> The problem is reported by the person answer me, but we don't have tracking
> or any-else.
> 
> You can check an alternative BIOS, the problem seem to be created by a
> deactivation of the S3 in the BIOS. We have a limited bios, but people have
> found in another model, it's just a switch to enable in the dump.
> www.bios-mods.com can modify your dump to enable this.
> 
> Have a good day

I'm having trouble getting the dmesg command to give me anything, but here is what the cat command returns: s2idle [deep]
Comment 160 DavidLenovo 2021-06-02 20:57:16 UTC
(In reply to Dre from comment #159)
> I'm having trouble getting the dmesg command to give me anything, but here
> is what the cat command returns: s2idle [deep]

You have file /var/log/dmesg ?

Your cat /sys/power/mem_sleep
> is what the cat command returns: s2idle [deep]
Is for Arch, or Ubuntu ?
Comment 161 Dre 2021-06-03 14:44:00 UTC
(In reply to DavidLenovo from comment #160)
> (In reply to Dre from comment #159)
> > I'm having trouble getting the dmesg command to give me anything, but here
> > is what the cat command returns: s2idle [deep]
> 
> You have file /var/log/dmesg ?
> 
> Your cat /sys/power/mem_sleep
> > is what the cat command returns: s2idle [deep]
> Is for Arch, or Ubuntu ?

No, I do not have that directory.

That cat output is on Arch.
Comment 162 Dre 2021-06-03 14:45:41 UTC
(In reply to Dre from comment #161)
> (In reply to DavidLenovo from comment #160)
> > (In reply to Dre from comment #159)
> > > I'm having trouble getting the dmesg command to give me anything, but
> here
> > > is what the cat command returns: s2idle [deep]
> > 
> > You have file /var/log/dmesg ?
> > 
> > Your cat /sys/power/mem_sleep
> > > is what the cat command returns: s2idle [deep]
> > Is for Arch, or Ubuntu ?
> 
> No, I do not have that directory.
> 
> That cat output is on Arch.

My fault.  I meant "I do not have that file."
Comment 163 DavidLenovo 2021-06-03 16:35:11 UTC
(In reply to Dre from comment #161)
> (In reply to DavidLenovo from comment #160)
> > (In reply to Dre from comment #159)
> > > I'm having trouble getting the dmesg command to give me anything, but
> here
> > > is what the cat command returns: s2idle [deep]
> > 
> > You have file /var/log/dmesg ?
> > 
> > Your cat /sys/power/mem_sleep
> > > is what the cat command returns: s2idle [deep]
> > Is for Arch, or Ubuntu ?
> 
> No, I do not have that directory.
> 
> That cat output is on Arch.

Thanks, ok, and it work on Arch for you, is it ok ? (And just for Arch)
Comment 164 Dre 2021-06-03 17:42:16 UTC
(In reply to DavidLenovo from comment #163)
> (In reply to Dre from comment #161)
> > (In reply to DavidLenovo from comment #160)
> > > (In reply to Dre from comment #159)
> > > > I'm having trouble getting the dmesg command to give me anything, but
> > here
> > > > is what the cat command returns: s2idle [deep]
> > > 
> > > You have file /var/log/dmesg ?
> > > 
> > > Your cat /sys/power/mem_sleep
> > > > is what the cat command returns: s2idle [deep]
> > > Is for Arch, or Ubuntu ?
> > 
> > No, I do not have that directory.
> > 
> > That cat output is on Arch.
> 
> Thanks, ok, and it work on Arch for you, is it ok ? (And just for Arch)

Yes.  Just on Arch (and I've tried several distro bases).  It's workable.  I just have to boot, play audio, suspend, then wake to get speakers working.
Comment 165 Jenefer 2021-06-05 11:45:00 UTC
I can't believe it's been almost a year without this problem being solved. I tried Ubuntu, PopOs, Fedora, Debian, they all had the same audio problem. I guess I'll just have to get used to headphones now.
Comment 166 DavidLenovo 2021-06-10 20:11:02 UTC
(In reply to Jenefer from comment #165)
> I can't believe it's been almost a year without this problem being solved. I
> tried Ubuntu, PopOs, Fedora, Debian, they all had the same audio problem. I
> guess I'll just have to get used to headphones now.

Hello, what is your computer model ?
The problem is not link to the ALC287, just to enable the S3 in computer.
Comment 167 woody64 2021-06-11 05:52:02 UTC
(In reply to DavidLenovo from comment #120)
> Hi !
> A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 & 14ITL05 &
> 15ITL05 & 15ITL5 :)
> Sound from speakers works on Ubuntu 20.04.2LTS !!!


This method worked pretty well for me (Lenovo Yoga 7i) with kernal 5.8.0-53-generic #60,
After update to 5.8.0-55 the S3 is not visible.

> dmesg | grep ACPI | grep supports
> [    0.174047] ACPI: (supports S0 S4 S5)

when I'm grepping for ACPI I see that the overwriting of the acpi DST table is done very early in the dmesg log, whereas in 0.55 it's done later, maybe that's an hint.

[    0.000000] BIOS-e820: [mem 0x00000000452ff000-0x0000000045b2efff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x0000000045b2f000-0x0000000045bfefff] ACPI data
[    0.000000] efi: ACPI=0x45bfe000 ACPI 2.0=0x45bfe014 TPMFinalLog=0x45ac5000 SMBIOS=0x439e0000 SMBIOS 3.0=0x439de000 ESRT=0x3f65b018 RNG=0x439e1a18 TPMEventLog=0x3a8a6018 
[    0.006300] ACPI: DSDT ACPI table found in initrd [kernel/firmware/acpi/dsdt.aml][0x3ebe2]
Comment 168 Jenefer 2021-06-11 09:18:49 UTC
(In reply to DavidLenovo from comment #166)
> (In reply to Jenefer from comment #165)
> > I can't believe it's been almost a year without this problem being solved.
> I
> > tried Ubuntu, PopOs, Fedora, Debian, they all had the same audio problem. I
> > guess I'll just have to get used to headphones now.
> 
> Hello, what is your computer model ?
> The problem is not link to the ALC287, just to enable the S3 in computer.

My model is lenovo legion 7i 15IMHg05. I'm using Pop OS for now so It does not use grub boatloader. I don't know if I can change the kernel init. Can you explain how to "to enable the S3 in computer." ?
Comment 169 Jenefer 2021-06-11 13:26:40 UTC
(In reply to Jenefer from comment #168)
> (In reply to DavidLenovo from comment #166)
> > (In reply to Jenefer from comment #165)
> > > I can't believe it's been almost a year without this problem being
> solved.
> > I
> > > tried Ubuntu, PopOs, Fedora, Debian, they all had the same audio problem.
> I
> > > guess I'll just have to get used to headphones now.
> > 
> > Hello, what is your computer model ?
> > The problem is not link to the ALC287, just to enable the S3 in computer.
> 
> My model is lenovo legion 7i 15IMHg05. I'm using Pop OS for now so It does
> not use grub boatloader. I don't know if I can change the kernel init. Can
> you explain how to "to enable the S3 in computer." ?

Also, your solution seems to work on yoga models, I didn't see anyone with legion model saying it worked for them. Here are my outputs:

cat /sys/power/mem_sleep
s2idle [deep]

sudo dmesg |grep ACPI|grep supports
[    0.410327] ACPI: (supports S0 S3 S4 S5)

aplay -l
**** List of PLAYBACK Hardware Devices ****
card 1: PCH [HDA Intel PCH], device 0: ALC287 Analog [ALC287 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 9: HDMI 3 [HDMI 3]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 10: HDMI 4 [HDMI 4]
  Subdevices: 1/1
  Subdevice #0: subdevice #0


sudo dmesg | grep -i audio
[    0.205536] ACPI: Added _OSI(Linux-Lenovo-NV-HDMI-Audio)
[    4.131332] snd_hda_intel 0000:00:1f.3: bound 0000:00:02.0 (ops i915_audio_component_bind_ops [i915])
[    4.131548] snd_hda_intel 0000:01:00.1: Handle vga_switcheroo audio client
[    4.185009] snd_hda_codec_realtek hdaudioC1D0: autoconfig for ALC287: line_outs=1 (0x17/0x0/0x0/0x0/0x0) type:speaker
[    4.185013] snd_hda_codec_realtek hdaudioC1D0:    speaker_outs=0 (0x0/0x0/0x0/0x0/0x0)
[    4.185015] snd_hda_codec_realtek hdaudioC1D0:    hp_outs=1 (0x21/0x0/0x0/0x0/0x0)
[    4.185016] snd_hda_codec_realtek hdaudioC1D0:    mono: mono_out=0x0
[    4.185017] snd_hda_codec_realtek hdaudioC1D0:    inputs:
[    4.185019] snd_hda_codec_realtek hdaudioC1D0:      Mic=0x19
[    4.185020] snd_hda_codec_realtek hdaudioC1D0:      Internal Mic=0x12

there is something weird about this last command: the speaker_outs is set to 0

I tried suspending the machine after playing some music but did not get audio after waking
Comment 170 Vincent Morel 2021-06-11 14:08:39 UTC
Are you sure the Legion is ALC287 ?
Seems Linux report an ACL287 but it's in fact ACL3306 !!! 
So having the good codec would be a good starting point...
Comment 171 Jenefer 2021-06-11 14:19:44 UTC
(In reply to Vincent Morel from comment #170)
> Are you sure the Legion is ALC287 ?
> Seems Linux report an ACL287 but it's in fact ACL3306 !!! 
> So having the good codec would be a good starting point...

Well, that's even more complicated. so even the system is reporting the wrong driver ?

Can you guide me to a good solution for this ? I'm just tired of searching the whole web for ACL287 so it turns out to be ACL3306
Comment 172 Jason Kukurudziak 2021-06-11 14:20:34 UTC
I believe that Lenovo sells 2 versions of the Legion. We bought a bunch for the company I work at and it is the ALC287. We ended up giving those to Windows users and bought ones that had Ubuntu pre-installed.

The behaviour of the audio suggests that there maybe an i/o line controlling the amp to the speakers, imho.

Jason




	  Original Message  	


From: bugzilla-daemon@bugzilla.kernel.org
Sent: June 11, 2021 10:08 AM
To: jason349@gmail.com
Subject: [Bug 208555] No sound from speakers using Realtek ALC287


https://bugzilla.kernel.org/show_bug.cgi?id=208555

--- Comment #170 from Vincent Morel (dantahoua@gmail.com) ---
Are you sure the Legion is ALC287 ?
Seems Linux report an ACL287 but it's in fact ACL3306 !!!
So having the good codec would be a good starting point...

--
You may reply to this email to add a comment.

You are receiving this mail because:
You are on the CC list for the bug.
Comment 173 Niclas 2021-06-11 14:53:39 UTC
Could someone try this, just copy and paste into a file, make it executable with chmod +x and run it. It worked for me..

https://pastebin.com/raw/zsXp2vz6

//Niclas
Comment 174 Dre 2021-06-11 16:35:42 UTC
The most recent major Manjaro update broke the fix on my system.  It upgraded my kernel from 5.10.36-2 to 5.10.41-1.  I decided to go ahead and upgrade to 5.13 and follow the tutorial again.  The Arch Wiki fix worked on the experimental kernel.  Once I play audio > suspend > wake the speakers continue to work until I log off.  Even if I stop the audio for any period of time while logged in the speakers still work.
@Niclas , what device are you running that on?
Comment 175 Thiago T 2021-06-11 16:50:56 UTC
(In reply to Niclas from comment #173)
> Could someone try this, just copy and paste into a file, make it executable
> with chmod +x and run it. It worked for me..
> 
> https://pastebin.com/raw/zsXp2vz6
> 
> //Niclas

Niclas, are you on a Legion 7i or Yoga?
Comment 176 woody64 2021-06-11 17:32:38 UTC
(In reply to Dre from comment #174)
> The most recent major Manjaro update broke the fix on my system.  It
> upgraded my kernel from 5.10.36-2 to 5.10.41-1.  I decided to go ahead and
> upgrade to 5.13 and follow the tutorial again.  The Arch Wiki fix worked on
> the experimental kernel.  Once I play audio > suspend > wake the speakers
> continue to work until I log off.  Even if I stop the audio for any period
> of time while logged in the speakers still work.
> @Niclas , what device are you running that on?

So maybe that's caused by the same changes incorporated in my 5.8.0.53-#60 to 5.8.0.55-#62 which happened between 1. June 21 and 11. June 21 breaking the fix.
So hopefully that will disappear onecmore with the next update
Comment 177 dean m 2021-06-12 00:36:42 UTC
(In reply to TT from comment #175)
> (In reply to Niclas from comment #173)
> > Could someone try this, just copy and paste into a file, make it executable
> > with chmod +x and run it. It worked for me..
> > 
> > https://pastebin.com/raw/zsXp2vz6
> > 
> > //Niclas
> 
> Niclas, are you on a Legion 7i or Yoga?

It works! the script works! on my Samsung Galaxy book pro 360, Unbuntu 21.04
Comment 178 Vincent Morel 2021-06-12 01:04:37 UTC
I tried the script on PopOs 21.04 on my Lenovo 13s Gen 2 (ALC3306) but sadly it did not work. The script even removed the working input mic and now I just have dummy output in place of the regular output... :( But it seems we are on the good way! :)
Comment 179 Vincent Morel 2021-06-12 01:05:03 UTC
I tried the script on PopOs 21.04 on my Lenovo 13s Gen 2 (ALC3306) but sadly it did not work. The script even removed the working input mic and now I just have dummy output in place of the regular output... :( But it seems we are on the good way! :)
Comment 180 Thiago T 2021-06-12 01:43:39 UTC
I also tried the script on Ubuntu 20.04 on Legion 7i 15IMH05 and got the same result. It removed the working input mic and just a dummy output showed up.
Niclas, how did you generate that script? It looks like it had a dos format.
Comment 181 Niclas 2021-06-12 06:33:08 UTC
First off, im sorry for the very minimal post with that pastebin. Very bad form and I have no other excuse then being emerged in another project and I had my head up my butt.

So. I have the new Samsung Galaxy Book Pro LTE that just came out and I found this post:

https://forum.manjaro.org/t/howto-set-up-the-audio-card-in-samsung-galaxy-book/37090

I tried that script by chance and it works. Although, it has 361 lines (!) and I havent started to disect it yet. Im not sure all of those is needed, when I run it I can hear that it first starts up the left speaker, then the right. I will take that on later.

But that post also helps out for those that doesnt know how to make the changes permanent. As for you who found that this works for your specific device, you will have noticed that just closing the browser with youtube or killing vlc/aplay or whatever makes the sound disappear again. Running the script once more, will make it work again and so on.

Im still in my other project so im not going to do any work on this one for now for a while yet, but if someone else does, please share here in the thread.

//Niclas
Comment 182 Niclas 2021-06-12 07:21:32 UTC
I forgot, if you do just blindly use that script and decide to also add the systemd services it will actually work and be permanent after a reboot.

//Niclas
Comment 183 Guido 2021-06-12 11:18:41 UTC
tried it on my lenovo 7i and it doesn't work.
Comment 184 DavidLenovo 2021-06-15 08:04:46 UTC
(In reply to Dre from comment #174)
> The most recent major Manjaro update broke the fix on my system.  It
> upgraded my kernel from 5.10.36-2 to 5.10.41-1.  

(In reply to woody64 from comment #167)
> (In reply to DavidLenovo from comment #120)
> > Hi !
> > A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 & 14ITL05 &
> > 15ITL05 & 15ITL5 :)
> > Sound from speakers works on Ubuntu 20.04.2LTS !!!
> 
> 
> This method worked pretty well for me (Lenovo Yoga 7i) with kernal
> 5.8.0-53-generic #60,
> After update to 5.8.0-55 the S3 is not visible.

How it work ? Anyone have to open a ticket, to signal it ?
It the same for the 5.11.5 work and after 5.11.6 and more stop working

Thanks :)
Comment 185 DavidLenovo 2021-06-15 08:10:59 UTC
(In reply to Guido from comment #183)
> tried it on my lenovo 7i and it doesn't work.

On Lenovo Yoga 7i ?


Could you try and report :
cat /sys/power/mem_sleep

sudo dmesg |grep ACPI|grep supports

Thanks in advance
Comment 186 DavidLenovo 2021-06-15 08:12:12 UTC
(In reply to Jenefer from comment #169)
> (In reply to Jenefer from comment #168)
> > (In reply to DavidLenovo from comment #166)
> > > (In reply to Jenefer from comment #165)
> > > > I can't believe it's been almost a year without this problem being
> > solved.
> > > I
> > > > tried Ubuntu, PopOs, Fedora, Debian, they all had the same audio
> problem.
> > I
> > > > guess I'll just have to get used to headphones now.
> > > 
> > > Hello, what is your computer model ?
> > > The problem is not link to the ALC287, just to enable the S3 in computer.
> > 
> > My model is lenovo legion 7i 15IMHg05. I'm using Pop OS for now so It does
> > not use grub boatloader. I don't know if I can change the kernel init. Can
> > you explain how to "to enable the S3 in computer." ?
> 
> Also, your solution seems to work on yoga models, I didn't see anyone with
> legion model saying it worked for them. Here are my outputs:
> 
> cat /sys/power/mem_sleep
> s2idle [deep]
> 
> sudo dmesg |grep ACPI|grep supports
> [    0.410327] ACPI: (supports S0 S3 S4 S5)

> 
> I tried suspending the machine after playing some music but did not get
> audio after waking

Your S3 is already activated : you have [deep] and ACPI : S3 :-)

It is suspend to ram, not to disk, is it that your have test ?


Like Vincent Morel say Are you sure the Legion is ALC287 ?


I have the same dmesg as you, but ehdaudio0D0 not hdaudioC1D0 and 2 line more : 
snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX overwritten
snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX overwritten
Comment 187 DavidLenovo 2021-06-15 08:15:50 UTC
(In reply to Jason Kukurudziak from comment #172)
> I believe that Lenovo sells 2 versions of the Legion. We bought a bunch for
> the company I work at and it is the ALC287. We ended up giving those to
> Windows users and bought ones that had Ubuntu pre-installed.
> 
> The behaviour of the audio suggests that there maybe an i/o line controlling
> the amp to the speakers, imho.
> 
> Jason

You don't have to patch acpi DST table for this model ?
I'm looking for a permanent solution, now the grub-update erase the solution, and we have to edit the grub.cfg, after each update.

Thanks in advance
Comment 188 Jenefer 2021-06-15 09:00:56 UTC
(In reply to DavidLenovo from comment #186)
> (In reply to Jenefer from comment #169)
> > (In reply to Jenefer from comment #168)
> > > (In reply to DavidLenovo from comment #166)
> > > > (In reply to Jenefer from comment #165)
> > > > > I can't believe it's been almost a year without this problem being
> > > solved.
> > > > I
> > > > > tried Ubuntu, PopOs, Fedora, Debian, they all had the same audio
> > problem.
> > > I
> > > > > guess I'll just have to get used to headphones now.
> > > > 
> > > > Hello, what is your computer model ?
> > > > The problem is not link to the ALC287, just to enable the S3 in
> computer.
> > > 
> > > My model is lenovo legion 7i 15IMHg05. I'm using Pop OS for now so It
> does
> > > not use grub boatloader. I don't know if I can change the kernel init.
> Can
> > > you explain how to "to enable the S3 in computer." ?
> > 
> > Also, your solution seems to work on yoga models, I didn't see anyone with
> > legion model saying it worked for them. Here are my outputs:
> > 
> > cat /sys/power/mem_sleep
> > s2idle [deep]
> > 
> > sudo dmesg |grep ACPI|grep supports
> > [    0.410327] ACPI: (supports S0 S3 S4 S5)
> 
> > 
> > I tried suspending the machine after playing some music but did not get
> > audio after waking
> 
> Your S3 is already activated : you have [deep] and ACPI : S3 :-)
> 
> It is suspend to ram, not to disk, is it that your have test ?
> 
> 
> Like Vincent Morel say Are you sure the Legion is ALC287 ?
> 
> 
> I have the same dmesg as you, but ehdaudio0D0 not hdaudioC1D0 and 2 line
> more : 
> snd_hda_codec_realtek ehdaudio0D0: ASoC: sink widget AIF1TX overwritten
> snd_hda_codec_realtek ehdaudio0D0: ASoC: source widget AIF1RX overwritten


on the lenovo spec page: https://psref.lenovo.com/Detail/Legion/Lenovo_Legion_7_15IMHg05?M=81YU0006FR
it clearly says it is ALC3306. so I have first to correct the audio codec, can you help me with that ?
Comment 189 Roland 2021-06-15 19:13:57 UTC
It seems that I'm expiring the same problem on a brand new Dell Latitude 9420 - Headphones works (starting with kernel 5.13-rc5), but speaker does not.

I've tried the S3 patch from comment #120, but iasl failed to rempile it's own decompiled code:

> $ sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
> $ iasl -d  dsdt.aml
>   ... no errors or warnings ...

Now trying to rempile the file with or without any patched applied:

> $ iasl -ve -tc dsdt.aml.dsl
> 
> Intel ACPI Component Architecture
> ASL+ Optimizing Compiler/Disassembler version 20200925
> Copyright (c) 2000 - 2020 Intel Corporation
> 
> dsdt.aml.dsl     89:     External (_SB_.PC00.LPCB.ECDV.CMFC.DLPN, UnknownObj)
> Error    6163 -                                               ^ Object is
> created temporarily in another method and cannot be accessed
> (_SB_.PC00.LPCB.ECDV.CMFC.DLPN)
> 
> dsdt.aml.dsl     90:     External (_SB_.PC00.LPCB.ECDV.CMFC.IDMN, UnknownObj)
> Error    6163 -                                               ^ Object is
> created temporarily in another method and cannot be accessed
> (_SB_.PC00.LPCB.ECDV.CMFC.IDMN)
> 
> dsdt.aml.dsl     91:     External (_SB_.PC00.LPCB.ECDV.CMFC.IDPC, UnknownObj)
> Error    6163 -                                               ^ Object is
> created temporarily in another method and cannot be accessed
> (_SB_.PC00.LPCB.ECDV.CMFC.IDPC)
> 
> ASL Input:     dsdt.aml.dsl - 2613388 bytes  46237 keywords  78191 source
> lines
> Hex Dump:      dsdt.aml.hex - 3421595 bytes
> 
> Compilation failed. 3 Errors, 264 Warnings, 818 Remarks
> No AML files were generated due to compiler error(s)


Does anyone has an idea what causes this problem and how to get this laptop to enable S3 so I can check if this resolves the issue, too?
Comment 190 DavidLenovo 2021-06-15 20:05:21 UTC
(In reply to Jenefer from comment #188)
> (In reply to DavidLenovo from comment #186)

> on the lenovo spec page:
> https://psref.lenovo.com/Detail/Legion/Lenovo_Legion_7_15IMHg05?M=81YU0006FR
> it clearly says it is ALC3306. so I have first to correct the audio codec,
> can you help me with that ?

Hello, I can't sorry, I have the ALC287, but Vincent Morel open a bug for this chipset : https://bugzilla.kernel.org/show_bug.cgi?id=213159

(In reply to Vincent Morel from comment #151)
> (In reply to waterproof93 from comment #150)
> 
> > 
> > I think I have the same issue with the same machine
> > Thinkbook 13s G2
> > 
> > Let me know when you open a new thread I would like to follow it
> 
> Just opened it :) 
> https://bugzilla.kernel.org/show_bug.cgi?id=213159
Comment 191 DavidLenovo 2021-06-15 20:17:58 UTC
(In reply to Roland from comment #189)
> It seems that I'm expiring the same problem on a brand new Dell Latitude
> 9420 - Headphones works (starting with kernel 5.13-rc5), but speaker does
> not.
> 
> I've tried the S3 patch from comment #120, but iasl failed to rempile it's
> own decompiled code:
> 
> > $ sudo cat /sys/firmware/acpi/tables/DSDT > dsdt.aml
> > $ iasl -d  dsdt.aml
> >   ... no errors or warnings ...
> 
> Now trying to rempile the file with or without any patched applied:
> 
> > $ iasl -ve -tc dsdt.aml.dsl
> > 
> > Intel ACPI Component Architecture
> > ASL+ Optimizing Compiler/Disassembler version 20200925
> > Copyright (c) 2000 - 2020 Intel Corporation
> > 
> > dsdt.aml.dsl     89:     External (_SB_.PC00.LPCB.ECDV.CMFC.DLPN,
> UnknownObj)
> > Error    6163 -                                               ^ Object is
> > created temporarily in another method and cannot be accessed
> > (_SB_.PC00.LPCB.ECDV.CMFC.DLPN)
> > 
> > dsdt.aml.dsl     90:     External (_SB_.PC00.LPCB.ECDV.CMFC.IDMN,
> UnknownObj)
> > Error    6163 -                                               ^ Object is
> > created temporarily in another method and cannot be accessed
> > (_SB_.PC00.LPCB.ECDV.CMFC.IDMN)
> > 
> > dsdt.aml.dsl     91:     External (_SB_.PC00.LPCB.ECDV.CMFC.IDPC,
> UnknownObj)
> > Error    6163 -                                               ^ Object is
> > created temporarily in another method and cannot be accessed
> > (_SB_.PC00.LPCB.ECDV.CMFC.IDPC)
> > 
> > ASL Input:     dsdt.aml.dsl - 2613388 bytes  46237 keywords  78191 source
> > lines
> > Hex Dump:      dsdt.aml.hex - 3421595 bytes
> > 
> > Compilation failed. 3 Errors, 264 Warnings, 818 Remarks
> > No AML files were generated due to compiler error(s)
> 
> 
> Does anyone has an idea what causes this problem and how to get this laptop
> to enable S3 so I can check if this resolves the issue, too?


I think it is normal, this patch is for Lenovo Yoga 7i, and it depend on the hardware, so don't have the same :(.

The S3 problem can be resolve by a BIOS option, Lenovo put a locked BIOS so we can't. But if Dell is better on this you could try to find an option S3, or energy, ACPI, it disable for Windows compatibility.

I find this : https://downloads.dell.com/manuals/all-products/esuprt_laptop/esuprt_laptop_latitude/latitude-14-9420-2-in-1-laptop_reference-guide_en-us.pdf
Not sure to understand :(

You have try this 5.11.5 kernel, to be sure, it is not a kernel bug ? 
We don't know the 5.13.x working, @Dre, do you have more information of you version ?

Could you try and report :
cat /sys/power/mem_sleep

sudo dmesg |grep ACPI|grep supports

Thanks in advance
Comment 192 Roland 2021-06-16 08:00:18 UTC
(In reply to DavidLenovo from comment #191)
> I think it is normal, this patch is for Lenovo Yoga 7i, and it depend on the
> hardware, so don't have the same :(.

It's easy to port this patch to Dell, but that's not the point: iasl fails even without applying the patch, which should not happen ;-) But I think I have to ask the iasl people why this fails.

> The S3 problem can be resolve by a BIOS option, Lenovo put a locked BIOS so
> we can't. But if Dell is better on this you could try to find an option S3,
> or energy, ACPI, it disable for Windows compatibility.

It's a similar issue on Dell. S3 in BIOS is enabled, but:

$ cat /sys/power/mem_sleep 
[s2idle]
$ sudo dmesg |grep ACPI|grep supports        
[    0.201665] ACPI: (supports S0 S4 S5)

> You have try this 5.11.5 kernel, to be sure, it is not a kernel bug ? 

Kernel 5.11 is even worse because it doesn't even recognize the sound card. With 5.13rc5 at least the headphone jack and the microphone is working. But basically I think it's either this problem or the problem reported in #213159...
Comment 193 Dre 2021-06-16 18:18:04 UTC
(In reply to DavidLenovo from comment #184)
> (In reply to Dre from comment #174)
> > The most recent major Manjaro update broke the fix on my system.  It
> > upgraded my kernel from 5.10.36-2 to 5.10.41-1.  
> 
> (In reply to woody64 from comment #167)
> > (In reply to DavidLenovo from comment #120)
> > > Hi !
> > > A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 & 14ITL05
> &
> > > 15ITL05 & 15ITL5 :)
> > > Sound from speakers works on Ubuntu 20.04.2LTS !!!
> > 
> > 
> > This method worked pretty well for me (Lenovo Yoga 7i) with kernal
> > 5.8.0-53-generic #60,
> > After update to 5.8.0-55 the S3 is not visible.
> 
> How it work ? Anyone have to open a ticket, to signal it ?
> It the same for the 5.11.5 work and after 5.11.6 and more stop working
> 
> Thanks :)

The fix broke each time I updated the system (which updated the kernel).  I simply ran through the steps and it restored the fix. I'm currently on 5.13.0-1-MANJARO and have deep sleep again after applying the fix.
Comment 194 Cameron Berkenpas 2021-06-18 19:29:52 UTC
It seems someone was able to make progress on a similar issue via PCIE passthrough of their laptop's soundcard:
https://bugzilla.kernel.org/show_bug.cgi?id=207423
https://bbs.archlinux.org/viewtopic.php?id=256009

Yesterday, I tried getting this to work on my 2020 Lenovo Legion 7i. The Windows VM seems to see the device in the device manager (and I see the right numeric PCIE ID under Windows), but beyond that Windows doesn't seem to recognize the device properly (although it does know it's a sound card at least but it isn't able to use it even with the proper drivers installed).

This was my very first experience with the IOMMU stuff. Maybe someone else would have more luck?

Before even attempting this, I set some option in the BIOS (under advanced mode): "Enable VTIO", which I assumed was for VT-d. I haven't confirmed whether or not this was needed, but mentioning it just in case.
Comment 195 Cameron Berkenpas 2021-06-20 21:58:27 UTC
Created attachment 297511 [details]
Example of soundcard working in win10 VM via passthrough. Comments include steps.

Screenshot of example Windows 10 VM working with RealTek sound card passthrough. The exclamation point for the "Intel(R) Smart Sound Technology" (Intel(R) SST) OED device is a red herring and is fine.

Here are my notes to get this physical device running under a Windows 10 VM:

You need to force the device expanded above to use the RealTek driver. I was able to force it by *extracting* rather than installing the sound driver from the Lenovo site. Selecting update driver on the sound device listed under "Sound, video and game controllers", and from there I did:
"Browse my  computer for drivers"
"Let me pick from a list of available drivers on my computer"
"Have Disk"
Browse to: C:\Drivers\Audio\201211706.15485923\Realtek\Codec_8975.1\HDXLVSST.inf
Press Ok
You should see "Realtek High Definition Audio(SST)" as an option. It's the only option for me)
Next
Yes
Restart the VM when prompted
Comment 196 Cameron Berkenpas 2021-06-20 22:00:45 UTC
Created attachment 297513 [details]
Qemu trace from boot to login screen

This is a trace I took via qemu of the soundcard device from boot to the login screen.
Comment 197 Cameron Berkenpas 2021-06-20 22:02:59 UTC
Created attachment 297515 [details]
Trace of 5 seconds of playing random YouTube video

I played a random song on YouTube. This trace starts immediately after the 2020-legion-boot-trace.txt trace. Not sure how helpful it is, but we'll see.
Comment 198 Cameron Berkenpas 2021-06-20 22:15:48 UTC
As my previous posts/attachments imply, I managed to get the sound card working in a Windows 10 VM with PCIE passthrough and I've been able to trace the events.

I was able to get this process working by following these threads, 
As well as reading various wikis:
https://bugzilla.kernel.org/show_bug.cgi?id=207423
https://bbs.archlinux.org/viewtopic.php?id=256009

If anyone is interested in trying this and needs help, I can probably help you get going into the right direction at the very least.

The issue I had previously is that I would say I had to be more "aggressive" in getting Windows to use the correct driver. You'll know it's working when you're able to play audio in your VM and hear it through the laptop's speakers.

Might also be helpful if someone does this on a Yoga Slim. Perhaps there are some differences in the verbs that must be sent out to the sound card.

From here I guess what needs to be done is figure out what from these traces is needed and maybe try to write a script that that calls hda-verb to send the same verbs to the sound card under Linux (don't forget to re-enable the card for use under Linux again if you had PCIE passthrough setup!).

I'll sign up with the ALSA mailing list and give an update on this issue since I suspect there's likely enough here for progress to be made.
Comment 199 woody64 2021-06-21 05:58:01 UTC
 
> The fix broke each time I updated the system (which updated the kernel).  I
> simply ran through the steps and it restored the fix. I'm currently on
> 5.13.0-1-MANJARO and have deep sleep again after applying the fix.

Correct, everytime the grub is updated I need to reconfigure the fix, which works in my case for 5.8.0-53 but not for 5.8.0-55. For the 55 kernel I simply can't enable S3.
Comment 200 woody64 2021-06-21 06:19:18 UTC
(In reply to woody64 from comment #199)
>  
> > The fix broke each time I updated the system (which updated the kernel).  I
> > simply ran through the steps and it restored the fix. I'm currently on
> > 5.13.0-1-MANJARO and have deep sleep again after applying the fix.
> 
> Correct, everytime the grub is updated I need to reconfigure the fix, which
> works in my case for 5.8.0-53 but not for 5.8.0-55. For the 55 kernel I
> simply can't enable S3.

To be more correct, I tried it oncemore and the result is, that with the 55 kernel after applying the patch you can now see:

/sys/firmware/acpi/tables/DSDT1
/sys/firmware/acpi/tables/DSDT2

the DSDT1 holds the original values whereas the DSDT2 holds the new values.
Comment 201 wave 2021-06-21 06:41:53 UTC
(In reply to woody64 from comment #200)
> (In reply to woody64 from comment #199)
> >  
> > > The fix broke each time I updated the system (which updated the kernel). 
> I
> > > simply ran through the steps and it restored the fix. I'm currently on
> > > 5.13.0-1-MANJARO and have deep sleep again after applying the fix.
> > 
> > Correct, everytime the grub is updated I need to reconfigure the fix, which
> > works in my case for 5.8.0-53 but not for 5.8.0-55. For the 55 kernel I
> > simply can't enable S3.
> 
> To be more correct, I tried it oncemore and the result is, that with the 55
> kernel after applying the patch you can now see:
> 
> /sys/firmware/acpi/tables/DSDT1
> /sys/firmware/acpi/tables/DSDT2
> 
> the DSDT1 holds the original values whereas the DSDT2 holds the new values.

Might be relevant: https://bugzilla.kernel.org/show_bug.cgi?id=212643. This was a bug introduced by some commit in the ACPI subsystem, but it is fixed in recent versions of the kernel (somewhere around 5.13). Basically it would depend on what kind of distribution you are on, and whether their kernel is recent enough to have incorporated the fix.
Comment 202 wave 2021-06-21 06:46:32 UTC
(In reply to Roland from comment #192)
> (In reply to DavidLenovo from comment #191)
> > I think it is normal, this patch is for Lenovo Yoga 7i, and it depend on
> the
> > hardware, so don't have the same :(.
> 
> It's easy to port this patch to Dell, but that's not the point: iasl fails
> even without applying the patch, which should not happen ;-) But I think I
> have to ask the iasl people why this fails.
> 
> > The S3 problem can be resolve by a BIOS option, Lenovo put a locked BIOS so
> > we can't. But if Dell is better on this you could try to find an option S3,
> > or energy, ACPI, it disable for Windows compatibility.
> 
> It's a similar issue on Dell. S3 in BIOS is enabled, but:
> 
> $ cat /sys/power/mem_sleep 
> [s2idle]
> $ sudo dmesg |grep ACPI|grep supports        
> [    0.201665] ACPI: (supports S0 S4 S5)
> 
> > You have try this 5.11.5 kernel, to be sure, it is not a kernel bug ? 
> 
> Kernel 5.11 is even worse because it doesn't even recognize the sound card.
> With 5.13rc5 at least the headphone jack and the microphone is working. But
> basically I think it's either this problem or the problem reported in
> #213159...

Yeah it can happen that the DSDT table is basically broken. If you are willing to invest time and patience, you can dig through the ACPI spec https://uefi.org/sites/default/files/resources/ACPI_6_3_final_Jan30.pdf and google the error messages to figure out what you need to do to fix it.
Comment 203 wave 2021-06-21 06:50:55 UTC
(In reply to Cameron from comment #198)
> As my previous posts/attachments imply, I managed to get the sound card
> working in a Windows 10 VM with PCIE passthrough and I've been able to trace
> the events.
> 
> I was able to get this process working by following these threads, 
> As well as reading various wikis:
> https://bugzilla.kernel.org/show_bug.cgi?id=207423
> https://bbs.archlinux.org/viewtopic.php?id=256009
> 
> If anyone is interested in trying this and needs help, I can probably help
> you get going into the right direction at the very least.
> 
> The issue I had previously is that I would say I had to be more "aggressive"
> in getting Windows to use the correct driver. You'll know it's working when
> you're able to play audio in your VM and hear it through the laptop's
> speakers.
> 
> Might also be helpful if someone does this on a Yoga Slim. Perhaps there are
> some differences in the verbs that must be sent out to the sound card.
> 
> From here I guess what needs to be done is figure out what from these traces
> is needed and maybe try to write a script that that calls hda-verb to send
> the same verbs to the sound card under Linux (don't forget to re-enable the
> card for use under Linux again if you had PCIE passthrough setup!).
> 
> I'll sign up with the ALSA mailing list and give an update on this issue
> since I suspect there's likely enough here for progress to be made.

That sounds very promising, thank you very much! I don't currently have time but I'm definitely intrigued to look into this and hopefully finally develop a real fix.
Comment 204 Jaroslav Kysela 2021-06-21 07:06:43 UTC
The correct way to obtain the HDA verb sequence (note that qemu must be patched to analyze the CORB / RIRB memory DMA areas):

  https://github.com/torvalds/linux/commit/26928ca1f06aab4361eb5adbe7ef3b5c82f13cf2
Comment 205 Cameron Berkenpas 2021-06-21 14:45:44 UTC
Created attachment 297545 [details]
HUGE progress!

I reached out to Connor McAdams, the auth of QemuHDADump, about some issues I was having with QemuHDADump, and he directed me to https://github.com/ryanprescott/realtek-verb-tools

This is a pair of scripts meant to work with the JCS fork of Qemu (which is just qemu patched for more output to stdout including CORB info for Intel HDA). That repo for that is here: https://github.com/jcs/qemu

Last night I had found this repo, and I had simply tried to apply a patch from the JCS repo... It didn't work. The fields in the output were all zeros. Don't do that. Just build from the JCS repo directly.

Running qemu binary from the JCS qemu, I was able to extract verbs from the the JCS Qemu output and apply them to the laptop using the realtek-verb-tools scripts.

Applying these verbs initially didn't seem to work... So I tried playing music while applying them and you will get momentary blips of sound (specifically I heard blips of the track I was playing and not random noise)! What's most likely happening is that we need to extract a subset of these verbs for initialization and that some of the other verbs are stopping the sound (perhaps from when I stopped the YouTube video under windows as well as during shutdown).

Don't forget to reboot your machine with pci passthrough otherwise the application of the verbs won't work because your sound card is setup up for well... passthrough. There appears to be a way to disable passthrough for the device without rebooting, but rebooting is faster for at least me.

To provide some more concrete steps as to what I did:
The configure I used for JCS Qemu:
./configure --prefix=/opt/qemu/jcs --enable-kvm --enable-trace-backends=log --target-list=x86_64-softmmu --disable-werror
make -j$(nproc)
make install

How I ran it:
sudo /opt/qemu/jcs/bin/qemu-system-x86_64 -enable-kvm -hda win10.qcow2 -m 8G -smp 4 -vga std -device vfio-pci,host=00:1f.3,multifunction=on,x-no-mmap=true -trace events=events.txt >output.txt

python3 cleanverbs.py output.txt >verbs.txt
# Rebooted without intel_iommu and without vfio-pci.ids
# While playing sound:
sudo python3 applyverbs.py verbs.txt

With the verbs.txt, its likely that anyone on this thread with a Legion (or possibly a Yoga Slim as well) could apply these verbs and figure out what subset is needed. Which would be great because I don't know how much time I'll have now that it's Monday. 

It's worth noting that it's entirely possible that the Slim needs some slightly different initialization.
Comment 206 Cameron Berkenpas 2021-06-21 15:05:14 UTC
Created attachment 297547 [details]
minimum verbs for both speakers working (so far)!

I suspect we can get this shorter. But for now, the attached verbs are the minimum I've found that gives sound from both speakers:
sudo python3 applyverbs.py verbs-working.txt 

In case anyone is curious as to how I'm doing this, I'm using 'head' to try subsets of the verbs to see the results I get:
head -562 verbs.txt > verbs-working.txt
sudo python3 applyverbs.py verbs-working.txt 

With the first 561 verbs, I only get output from one of the speakers. It's possible we can go even lower though, I just don't have the time.

Putting the laptop to sleep and resuming results in non-working speakers. You will need to re-apply these verbs.

It's also possible that if your laptop stays on but is idle that the speakers will go to sleep and will need to be re-initialized in that case too.

I don't know if switching between headphones/bluetooth works yet, because a ways back I setup a combined audio device in my testing, and I don't think I'll have the time before work to figure out how I did it so I can undo it.

I haven't had time to test the mic yet.

Everyone, please test when you have free time. We're almost there!
Comment 207 Thiago T 2021-06-21 15:18:30 UTC
I have very good news!! Thank you very much @Cameron!!!
This file verbs-working.txt worked (apparently) for the two speackers for me on ubuntu 20.04 Legion 7i 15IMH05 kernel 5.8.0-55.
I could even switch back and forth between the bluetooth headphones.
The mic also looks like it is working.
Comment 208 Thiago T 2021-06-21 15:21:34 UTC
For those wanting to test it.
- Download the verbs-working.txt provided on https://bugzilla.kernel.org/show_bug.cgi?id=208555#c206 .
- git clone https://github.com/ryanprescott/realtek-verb-tools
- sudo python3 realtek-verb-tools/applyverbs.py verbs-working.txt
- put some audio to play
Comment 209 Thiago T 2021-06-21 15:27:01 UTC
I am not sure I have sound on both speakers though.
Comment 210 woody64 2021-06-21 16:03:04 UTC
Tried that on a Lenovo Yoga 7i with Ubuntu 20.04LTS:
- Started a Video in the browser
- running the patch as described
- and get a clear Sound on the speakers (as with the S3 patch)

GREAT work ...
Comment 211 woody64 2021-06-21 16:08:55 UTC
It seems similar to the S3 patch that after some seconds of not playing audio the effect disappears. But could be started immedeatly.

Also attaching and deattaching the mic works as expected.

The  Audio test in settings shows correct output with left speaker: "Front left" bt no with the right speaker.
Comment 212 woody64 2021-06-21 16:09:10 UTC
It seems similar to the S3 patch that after some seconds of not playing audio the effect disappears. But could be started immedeatly.

Also attaching and deattaching the mic works as expected.

The  Audio test in settings shows correct output with left speaker: "Front left" bt no with the right speaker.
Comment 213 Niclas 2021-06-21 16:12:25 UTC
(In reply to woody64 from comment #212)
> It seems similar to the S3 patch that after some seconds of not playing
> audio the effect disappears. But could be started immedeatly.
> 
> Also attaching and deattaching the mic works as expected.
> 
> The  Audio test in settings shows correct output with left speaker: "Front
> left" bt no with the right speaker.

As I mentioned above in my last comment, this is fixed by adding a few services to systemd. Follow the link I mention and it will work permanently.

I have the right verbs in a script that just runs the command on each line, instead of a wrapper as mentioned now lately. So keep that in mind when adding the services (what you want to run).

If you just run the script standalone, it will only work (kind of, has a few quirks you can do) "once" and you need to run it everytime before starting an audio source.

//Niclas
Comment 214 Niclas 2021-06-21 16:13:36 UTC
(In reply to Niclas from comment #213)
> (In reply to woody64 from comment #212)
> > It seems similar to the S3 patch that after some seconds of not playing
> > audio the effect disappears. But could be started immedeatly.
> > 
> > Also attaching and deattaching the mic works as expected.
> > 
> > The  Audio test in settings shows correct output with left speaker: "Front
> > left" bt no with the right speaker.
> 
> As I mentioned above in my last comment, this is fixed by adding a few
> services to systemd. Follow the link I mention and it will work permanently.
> 
> I have the right verbs in a script that just runs the command on each line,
> instead of a wrapper as mentioned now lately. So keep that in mind when
> adding the services (what you want to run).
> 
> If you just run the script standalone, it will only work (kind of, has a few
> quirks you can do) "once" and you need to run it everytime before starting
> an audio source.
> 
> //Niclas

This is my last comment with all the info:

https://bugzilla.kernel.org/show_bug.cgi?id=208555#c181
Comment 215 Cameron Berkenpas 2021-06-21 16:18:29 UTC
I should clarify that you only needed to play music while applying the 
original verb.txt as those verbs appeared to start and stop the speakers 
several times.

With verbs-working.txt, it doesn't matter whether or not if you're 
playing any sound during the apply.
Comment 216 Cameron Berkenpas 2021-06-21 16:40:40 UTC
Thanks for sharing, Niclas!

Interesting that the verbs in your sitation were also 361. So I may have 
already found the magic number in just 5 minutes of testing.

On 6/21/21 9:13 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #214 from Niclas (niclas@soderlund.org) ---
> (In reply to Niclas from comment #213)
>> (In reply to woody64 from comment #212)
>>> It seems similar to the S3 patch that after some seconds of not playing
>>> audio the effect disappears. But could be started immedeatly.
>>>
>>> Also attaching and deattaching the mic works as expected.
>>>
>>> The  Audio test in settings shows correct output with left speaker: "Front
>>> left" bt no with the right speaker.
>> As I mentioned above in my last comment, this is fixed by adding a few
>> services to systemd. Follow the link I mention and it will work permanently.
>>
>> I have the right verbs in a script that just runs the command on each line,
>> instead of a wrapper as mentioned now lately. So keep that in mind when
>> adding the services (what you want to run).
>>
>> If you just run the script standalone, it will only work (kind of, has a few
>> quirks you can do) "once" and you need to run it everytime before starting
>> an audio source.
>>
>> //Niclas
> This is my last comment with all the info:
>
> https://bugzilla.kernel.org/show_bug.cgi?id=208555#c181
>
Comment 217 Niclas 2021-06-21 16:44:09 UTC
(In reply to Cameron Berkenpas from comment #216)
> Thanks for sharing, Niclas!
> 
> Interesting that the verbs in your sitation were also 361. So I may have 
> already found the magic number in just 5 minutes of testing.
> 

Yeah, it hardly can be a coincidence right? Well, I have everything working with this quite messy fix for now. And the new sof firmware was relased today, at least for debian. So now Im just waiting for a more complete and true fix to arrive.

And in my case, with a Samsung Galaxy Book Pro, I still havent found a way to get the keyboard brightness adjusted or even turned off. But thats for anoter thread.

//N
Comment 218 woody64 2021-06-21 16:51:12 UTC
(In reply to Cameron Berkenpas from comment #215)
> I should clarify that you only needed to play music while applying the 
> original verb.txt as those verbs appeared to start and stop the speakers 
> several times.
> 
> With verbs-working.txt, it doesn't matter whether or not if you're 
> playing any sound during the apply.

Yes, also the audio/speaker config stays now stable for the last 30 minutes.
Comment 219 Cameron Berkenpas 2021-06-21 16:52:59 UTC
It stays up for a while... However, after over an hour, it stopped 
working for me. I don't know the precise time, I just know it was more 
than 1 hour and less than 2. Re-applying brought sound back of course.

On 6/21/21 9:51 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #218 from woody64 (andreas@mac-au.eu) ---
> (In reply to Cameron Berkenpas from comment #215)
>> I should clarify that you only needed to play music while applying the
>> original verb.txt as those verbs appeared to start and stop the speakers
>> several times.
>>
>> With verbs-working.txt, it doesn't matter whether or not if you're
>> playing any sound during the apply.
> Yes, also the audio/speaker config stays now stable for the last 30 minutes.
>
Comment 220 Thiago T 2021-06-21 17:19:47 UTC
(In reply to Cameron Berkenpas from comment #216)
> Thanks for sharing, Niclas!
> 
> Interesting that the verbs in your sitation were also 361. So I may have 
> already found the magic number in just 5 minutes of testing.
> 
> On 6/21/21 9:13 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #214 from Niclas (niclas@soderlund.org) ---
> > (In reply to Niclas from comment #213)
> >> (In reply to woody64 from comment #212)
> >>> It seems similar to the S3 patch that after some seconds of not playing
> >>> audio the effect disappears. But could be started immedeatly.
> >>>
> >>> Also attaching and deattaching the mic works as expected.
> >>>
> >>> The  Audio test in settings shows correct output with left speaker:
> "Front
> >>> left" bt no with the right speaker.
> >> As I mentioned above in my last comment, this is fixed by adding a few
> >> services to systemd. Follow the link I mention and it will work
> permanently.
> >>
> >> I have the right verbs in a script that just runs the command on each
> line,
> >> instead of a wrapper as mentioned now lately. So keep that in mind when
> >> adding the services (what you want to run).
> >>
> >> If you just run the script standalone, it will only work (kind of, has a
> few
> >> quirks you can do) "once" and you need to run it everytime before starting
> >> an audio source.
> >>
> >> //Niclas
> > This is my last comment with all the info:
> >
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555#c181
> >

Cameron,

the verbs file from Comment 206 has 562 lines. Did you manage to get it down to 361? Is the mic also working?

Thanks
Comment 221 Cameron Berkenpas 2021-06-21 17:21:35 UTC
Whoops, I remembered the size incorrectly.

It seems the mic is working for others.

Definitely not going to be doing much testing today. In addition to it 
being a weekday, I have a Lenovo tech that's expected to be here soon to 
fix an unrelated issue on this laptop.

Has anyone tested a 2021 Legion yet? I'm curious to know if this set of 
verb works.

On 6/21/21 10:19 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #220 from TT (thiagotei@icloud.com) ---
> (In reply to Cameron Berkenpas from comment #216)
>> Thanks for sharing, Niclas!
>>
>> Interesting that the verbs in your sitation were also 361. So I may have
>> already found the magic number in just 5 minutes of testing.
>>
>> On 6/21/21 9:13 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>
>>> --- Comment #214 from Niclas (niclas@soderlund.org) ---
>>> (In reply to Niclas from comment #213)
>>>> (In reply to woody64 from comment #212)
>>>>> It seems similar to the S3 patch that after some seconds of not playing
>>>>> audio the effect disappears. But could be started immedeatly.
>>>>>
>>>>> Also attaching and deattaching the mic works as expected.
>>>>>
>>>>> The  Audio test in settings shows correct output with left speaker:
>> "Front
>>>>> left" bt no with the right speaker.
>>>> As I mentioned above in my last comment, this is fixed by adding a few
>>>> services to systemd. Follow the link I mention and it will work
>> permanently.
>>>> I have the right verbs in a script that just runs the command on each
>> line,
>>>> instead of a wrapper as mentioned now lately. So keep that in mind when
>>>> adding the services (what you want to run).
>>>>
>>>> If you just run the script standalone, it will only work (kind of, has a
>> few
>>>> quirks you can do) "once" and you need to run it everytime before starting
>>>> an audio source.
>>>>
>>>> //Niclas
>>> This is my last comment with all the info:
>>>
>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555#c181
>>>
> Cameron,
>
> the verbs file from Comment 206 has 562 lines. Did you manage to get it down
> to
> 361? Is the mic also working?
>
> Thanks
>
Comment 222 Thiago T 2021-06-21 17:26:02 UTC
(In reply to Cameron Berkenpas from comment #221)
> Whoops, I remembered the size incorrectly.
> 
> It seems the mic is working for others.
> 
> Definitely not going to be doing much testing today. In addition to it 
> being a weekday, I have a Lenovo tech that's expected to be here soon to 
> fix an unrelated issue on this laptop.
> 
> Has anyone tested a 2021 Legion yet? I'm curious to know if this set of 
> verb works.
> 
> On 6/21/21 10:19 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #220 from TT (thiagotei@icloud.com) ---
> > (In reply to Cameron Berkenpas from comment #216)
> >> Thanks for sharing, Niclas!
> >>
> >> Interesting that the verbs in your sitation were also 361. So I may have
> >> already found the magic number in just 5 minutes of testing.
> >>
> >> On 6/21/21 9:13 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> >>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >>>
> >>> --- Comment #214 from Niclas (niclas@soderlund.org) ---
> >>> (In reply to Niclas from comment #213)
> >>>> (In reply to woody64 from comment #212)
> >>>>> It seems similar to the S3 patch that after some seconds of not playing
> >>>>> audio the effect disappears. But could be started immedeatly.
> >>>>>
> >>>>> Also attaching and deattaching the mic works as expected.
> >>>>>
> >>>>> The  Audio test in settings shows correct output with left speaker:
> >> "Front
> >>>>> left" bt no with the right speaker.
> >>>> As I mentioned above in my last comment, this is fixed by adding a few
> >>>> services to systemd. Follow the link I mention and it will work
> >> permanently.
> >>>> I have the right verbs in a script that just runs the command on each
> >> line,
> >>>> instead of a wrapper as mentioned now lately. So keep that in mind when
> >>>> adding the services (what you want to run).
> >>>>
> >>>> If you just run the script standalone, it will only work (kind of, has a
> >> few
> >>>> quirks you can do) "once" and you need to run it everytime before
> starting
> >>>> an audio source.
> >>>>
> >>>> //Niclas
> >>> This is my last comment with all the info:
> >>>
> >>> https://bugzilla.kernel.org/show_bug.cgi?id=208555#c181
> >>>
> > Cameron,
> >
> > the verbs file from Comment 206 has 562 lines. Did you manage to get it
> down
> > to
> > 361? Is the mic also working?
> >
> > Thanks
> >

I've got it down to 317 lines, but at some point I lost my mic. 
Thus, I need to further test it to make sure what screwed up the mic.
Comment 223 Cameron Berkenpas 2021-06-21 17:27:29 UTC
On 6/21/21 10:26 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
> I've got it down to 317 lines, but at some point I lost my mic.
> Thus, I need to further test it to make sure what screwed up the mic.
>

Really appreciate it. Of course please attach the verbs to the bug once 
you've got it narrowed down.

I assume you've already tried 361. :)
Comment 224 Thiago T 2021-06-21 17:38:44 UTC
(In reply to Cameron Berkenpas from comment #223)
> On 6/21/21 10:26 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> > I've got it down to 317 lines, but at some point I lost my mic.
> > Thus, I need to further test it to make sure what screwed up the mic.
> >
> 
> Really appreciate it. Of course please attach the verbs to the bug once 
> you've got it narrowed down.
> 
> I assume you've already tried 361. :)

I didn't pay special attention to the 361, but that is likely the one I will try
next.
Comment 225 Cameron Berkenpas 2021-06-21 18:46:41 UTC
(In reply to Jaroslav Kysela from comment #204)
> The correct way to obtain the HDA verb sequence (note that qemu must be
> patched to analyze the CORB / RIRB memory DMA areas):
> 
>  
> https://github.com/torvalds/linux/commit/
> 26928ca1f06aab4361eb5adbe7ef3b5c82f13cf2

Thanks, this is _very_ helpful! This looks really straightforward to implement.

Now for some newbie questions:

Going through the kernel code, I see that on resume, alc_resume() is called, which will call codec->patch_ops.init(codec), this covers the resume from sleep cases.

What about when the card itself (or its speakers so effectively the card) goes to sleep due to idle? Will the kernel automatically be made aware of this state? If not, how do we go about making it so the kernel is aware that the card will need to be re-inited?

Once the kernel is aware that the card is in a state where it will need to be re-initialized for use, will it call the init callback or is it some other callback?

Under hda_local.h, I see a number of actions are enumerated. Am I correct to assume we only need to cover the INIT case?
/* fixup action definitions */
enum {
        HDA_FIXUP_ACT_PRE_PROBE,
        HDA_FIXUP_ACT_PROBE,
        HDA_FIXUP_ACT_INIT,
        HDA_FIXUP_ACT_BUILD,
        HDA_FIXUP_ACT_FREE,
};

Thanks, again!
Comment 226 woody64 2021-06-21 19:30:17 UTC
(In reply to TT from comment #224)
> (In reply to Cameron Berkenpas from comment #223)
> > On 6/21/21 10:26 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> > > I've got it down to 317 lines, but at some point I lost my mic.
> > > Thus, I need to further test it to make sure what screwed up the mic.
> > >
> > 
> > Really appreciate it. Of course please attach the verbs to the bug once 
> > you've got it narrowed down.
> > 
> > I assume you've already tried 361. :)
> 
> I didn't pay special attention to the 361, but that is likely the one I will
> try
> next.

made a test sequence and audio output is between 300 and 400 (in steps of 8) available from 324 ...
also there are some higher numbers >1000 where my left speaker works.

so I assume there are similar blocks inside which lead to the same result
Comment 227 woody64 2021-06-21 20:15:34 UTC
to be more concrete 91-150 bytes from the beginning and 301-348 make a working sequence after reboot. 
These sequences can be found multiple times in the log, i.e. the on sequence on 889
Comment 228 Jim33 2021-06-21 20:56:07 UTC
Comment #208 works for me on my Legion C7i 82EHCTO1WW (Creator edition, same a the normal but with a better display) on Ubuntu 20.04.02 default kernel. But if I stop playing music 15-20 sec, I need to run the script again. I could leave with running the script once at boot, but having to do it all the time makes the solution more as a workaround, even so it is a progress, yes.

I don't know if it has to do with the S3 stuff as I have not got it completely. I am like this:

cat /sys/power/mem_sleep
s2idle [deep]

sudo dmesg | grep ACPI | grep support
[    0.535533] ACPI: (supports S0 S3 S4 S5)

Which I understood means I am not impacted ?
Comment 229 Cameron Berkenpas 2021-06-21 22:40:58 UTC
Created attachment 297559 [details]
linux-5.12.12-legion-sound-0.0.1.patch

And here's a patch. PLEASE TEST! ...At your own risk.

This is against Linux 5.12.2, but will likely work against many others.

It seems to work even after resuming (but from the kernel code I see that sound cards are re-initialized on resume so no surprises there).

I'm unsure if this will resolve the idle sound issue. If your sound still works after 2 hours, we're good to go.

In my experience, it takes less than 2 hours before the speakers power down, but I don't know how long that is. 2 hours is a pretty safe test.

I'm using the 562 verbs until we can get it narrowed down because we know for certain they work.

I'm not sure what, if any, chain_id should be set for the Legion hence it being commented out and the TODO. However, it seems to be working without it for now.

Also not sure if I'm fully following all the proper conventions, but that can be cleaned up with feedback.

Unless the Yoga has the same vendor/dev ID's, this won't work there. I'll need to get those and add them to the patch. Same for newer Legion models.

Enjoy!
Comment 230 Cameron Berkenpas 2021-06-22 04:32:28 UTC
I've done some testing with the patch. Sound still works after a few hours of activity for me so far.

One big problem I've found is that if I connect head phones and then disconnect, output from the speakers no longer works unless I apply the verbs.

If I connect head phones and never play any sound while they're connected, speaker output will still work. This suggests the hardware turns off the speakers if it detects head phones are the active output, which would make sense.

I spent a long time trying to figure out how to re-initialize the speakers when head phones are unplugged. I couldn't figure out how to do it. Is there anyone who could please provide guidance here?
Comment 231 woody64 2021-06-22 05:58:41 UTC
Status on the Lenovo Yoga 7i:
- only left speakers work with the patch, but it seems to be stable for hours
- I was in the opinion that I can narrow down to some smaller sequences (speakers off, speakers on), but that was partly not reprodcable after reboots. Additionally it turned out that the smaller sequences affects the left speaker only. But i can only hear that after S3 resume since the patch only initial enables the left side.   
- when doing the S3 workaraound both speakers work, but this stops when there's no activity for 10-20 seconds => would be interesting if the driver generates a similar sequence as the patch after resume from S3 ?
- using the patch afterwards, the sound stays on both speakers without audio activity for minutes
Comment 232 Niclas 2021-06-22 06:08:51 UTC
Again, its not a great solution, but what I did was to make a systemd service that has the wants of hibernation and sleep. So when systemd detects that the laptop is woken up from either of those, ie resume, it just runs the script again. 

That fixes the problem superficially and I have constant sound and dont have to think about it. 

Now this is on my Samsung Galaxy Book, so I have both speakers working fine et al. But for now and until a better fix comes along, it makes it seamless.

//N

(In reply to woody64 from comment #231)
> Status on the Lenovo Yoga 7i:
> - only left speakers work with the patch, but it seems to be stable for hours
> - I was in the opinion that I can narrow down to some smaller sequences
> (speakers off, speakers on), but that was partly not reprodcable after
> reboots. Additionally it turned out that the smaller sequences affects the
> left speaker only. But i can only hear that after S3 resume since the patch
> only initial enables the left side.   
> - when doing the S3 workaraound both speakers work, but this stops when
> there's no activity for 10-20 seconds => would be interesting if the driver
> generates a similar sequence as the patch after resume from S3 ?
> - using the patch afterwards, the sound stays on both speakers without audio
> activity for minutes
Comment 233 Niclas 2021-06-22 06:09:06 UTC
Again, its not a great solution, but what I did was to make a systemd service that has the wants of hibernation and sleep. So when systemd detects that the laptop is woken up from either of those, ie resume, it just runs the script again. 

That fixes the problem superficially and I have constant sound and dont have to think about it. 

Now this is on my Samsung Galaxy Book, so I have both speakers working fine et al. But for now and until a better fix comes along, it makes it seamless.

//N

(In reply to woody64 from comment #231)
> Status on the Lenovo Yoga 7i:
> - only left speakers work with the patch, but it seems to be stable for hours
> - I was in the opinion that I can narrow down to some smaller sequences
> (speakers off, speakers on), but that was partly not reprodcable after
> reboots. Additionally it turned out that the smaller sequences affects the
> left speaker only. But i can only hear that after S3 resume since the patch
> only initial enables the left side.   
> - when doing the S3 workaraound both speakers work, but this stops when
> there's no activity for 10-20 seconds => would be interesting if the driver
> generates a similar sequence as the patch after resume from S3 ?
> - using the patch afterwards, the sound stays on both speakers without audio
> activity for minutes
Comment 234 Deni 2021-06-22 06:11:15 UTC
It doesn't work for me.
I have ubuntu with linux kernel 5.11.0-18-generic.

Applying patch returns an error 

patching file legion_15imhg05_speakers.c
can't find file to patch at input line 502

Maybe I did something wrong?
Comment 235 woody64 2021-06-22 06:39:58 UTC
(In reply to Niclas from comment #233)
> Again, its not a great solution, but what I did was to make a systemd
> service that has the wants of hibernation and sleep. So when systemd detects
> that the laptop is woken up from either of those, ie resume, it just runs
> the script again. 

Thanks for that. My summary is mainly ment for the results of Cameron which is a significant step in a patch also for the Yoga 7i ...
Comment 236 Thiago T 2021-06-22 14:42:52 UTC
I experienced the same as Comment #230 and Comment #231 in Ubuntu 20.04.2 kernel 5.8.0-55.

BTW, have you seen this windows program to get the dumps? RtHDDump_V236.zip
It is suggested suggested by Hui Wang that has contributions to the Realtek patches. Sources:
- https://asus-linux.org/blog/sound-2021-01-11/#getting-dumps
- https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1852922
- https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1851518
I have windows installed in another partition and may try it later.
We may have already the coeffs to make it work but this may show something extra.
Comment 237 Jenefer 2021-06-22 14:51:31 UTC
(In reply to TT from comment #208)
> For those wanting to test it.
> - Download the verbs-working.txt provided on
> https://bugzilla.kernel.org/show_bug.cgi?id=208555#c206 .
> - git clone https://github.com/ryanprescott/realtek-verb-tools
> - sudo python3 realtek-verb-tools/applyverbs.py verbs-working.txt
> - put some audio to play

Thank you so much! This worked somehow on my lenovo legion 7i 15IMHg05.
It's not permanent though as audio needs to be played constantly for it to last longer, otherwise it go back after few seconds. I hope that the fix will be patched to the kernel after some fine-tuning as I noticed that applying the verbs the quality of audio is not quite good compared to how it was on windows. But who I am to complain, I'm just happy there is a workaround to use keep me using linux on my machine.

Also it's weird that the fix worked for my laptop even though I have the issue with mis-detected codecs: the specs of my laptop list ALC3306 while alsa reports ALC287.
Comment 238 Cameron Berkenpas 2021-06-22 15:38:15 UTC
Applying the original 562 verbs brings up both speakers though? If so, 
weird that this patch only brings up one.

On 6/21/21 10:58 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #231 from woody64 (andreas@mac-au.eu) ---
> Status on the Lenovo Yoga 7i:
> - only left speakers work with the patch, but it seems to be stable for hours
> - I was in the opinion that I can narrow down to some smaller sequences
> (speakers off, speakers on), but that was partly not reprodcable after
> reboots.
> Additionally it turned out that the smaller sequences affects the left
> speaker
> only. But i can only hear that after S3 resume since the patch only initial
> enables the left side.
> - when doing the S3 workaraound both speakers work, but this stops when
> there's
> no activity for 10-20 seconds => would be interesting if the driver generates
> a
> similar sequence as the patch after resume from S3 ?
> - using the patch afterwards, the sound stays on both speakers without audio
> activity for minutes
>
Comment 239 Cameron Berkenpas 2021-06-22 15:39:18 UTC
Can you provide the command you're running and the error?

On 6/21/21 11:11 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #234 from Deni (deniallugo@gmail.com) ---
> It doesn't work for me.
> I have ubuntu with linux kernel 5.11.0-18-generic.
>
> Applying patch returns an error
>
> patching file legion_15imhg05_speakers.c
> can't find file to patch at input line 502
>
> Maybe I did something wrong?
>
Comment 240 Cameron Berkenpas 2021-06-22 15:40:30 UTC
Please share your results if you try. I probably won't have the time to 
try this for myself for well over a week.

On 6/22/21 7:42 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #236 from TT (thiagotei@icloud.com) ---
> I experienced the same as Comment #230 and Comment #231 in Ubuntu 20.04.2
> kernel 5.8.0-55.
>
> BTW, have you seen this windows program to get the dumps? RtHDDump_V236.zip
> It is suggested suggested by Hui Wang that has contributions to the Realtek
> patches. Sources:
> - https://asus-linux.org/blog/sound-2021-01-11/#getting-dumps
> - https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1852922
> - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1851518
> I have windows installed in another partition and may try it later.
> We may have already the coeffs to make it work but this may show something
> extra.
>
Comment 241 Cameron Berkenpas 2021-06-22 15:44:19 UTC
(In reply to Jenefer from comment #237)
> (In reply to TT from comment #208)
> > For those wanting to test it.
> > - Download the verbs-working.txt provided on
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555#c206 .
> > - git clone https://github.com/ryanprescott/realtek-verb-tools
> > - sudo python3 realtek-verb-tools/applyverbs.py verbs-working.txt
> > - put some audio to play
> 
> Thank you so much! This worked somehow on my lenovo legion 7i 15IMHg05.
> It's not permanent though as audio needs to be played constantly for it to
> last longer, otherwise it go back after few seconds. I hope that the fix
> will be patched to the kernel after some fine-tuning as I noticed that
> applying the verbs the quality of audio is not quite good compared to how it
> was on windows. But who I am to complain, I'm just happy there is a
> workaround to use keep me using linux on my machine.
> 
> Also it's weird that the fix worked for my laptop even though I have the
> issue with mis-detected codecs: the specs of my laptop list ALC3306 while
> alsa reports ALC287.


I haven't had a chance to try comparing the audio quality, but I have wondered if that might be the case... How did you compare? Was it with the same application? Ie, maybe FireFox/Chrome and YouTube?

Is anyone else seeing differences?
Comment 242 Thiago T 2021-06-22 16:06:31 UTC
(In reply to Cameron Berkenpas from comment #241)
> (In reply to Jenefer from comment #237)
> > (In reply to TT from comment #208)
> > > For those wanting to test it.
> > > - Download the verbs-working.txt provided on
> > > https://bugzilla.kernel.org/show_bug.cgi?id=208555#c206 .
> > > - git clone https://github.com/ryanprescott/realtek-verb-tools
> > > - sudo python3 realtek-verb-tools/applyverbs.py verbs-working.txt
> > > - put some audio to play
> > 
> > Thank you so much! This worked somehow on my lenovo legion 7i 15IMHg05.
> > It's not permanent though as audio needs to be played constantly for it to
> > last longer, otherwise it go back after few seconds. I hope that the fix
> > will be patched to the kernel after some fine-tuning as I noticed that
> > applying the verbs the quality of audio is not quite good compared to how
> it
> > was on windows. But who I am to complain, I'm just happy there is a
> > workaround to use keep me using linux on my machine.
> > 
> > Also it's weird that the fix worked for my laptop even though I have the
> > issue with mis-detected codecs: the specs of my laptop list ALC3306 while
> > alsa reports ALC287.
> 
> 
> I haven't had a chance to try comparing the audio quality, but I have
> wondered if that might be the case... How did you compare? Was it with the
> same application? Ie, maybe FireFox/Chrome and YouTube?
> 
> Is anyone else seeing differences?

I've ran firefox with the same youtube video and I also felt the quality is lower on Linux. I don't know how to describe the difference though.
It is not a significant difference for me. 
I am good with the current quality, but there is definitelly something to improve there.
Comment 243 Cameron Berkenpas 2021-06-22 16:10:05 UTC
I just did the same thing, and my reaction is the same. The quality is 
lower under Linux, but it's not a massive difference. Maybe it sounds 
more tinny under Linux?

Not sure what controls that... Maybe coefficients?

I would say the current quality is still a massive step up over having 
had no sound at all.

My current priority is to fix the headphone issues. I want the speakers 
to start working again after unplugging from the headphone jack.


On 6/22/21 9:06 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #242 from TT (thiagotei@icloud.com) ---
> (In reply to Cameron Berkenpas from comment #241)
>> (In reply to Jenefer from comment #237)
>>> (In reply to TT from comment #208)
>>>> For those wanting to test it.
>>>> - Download the verbs-working.txt provided on
>>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555#c206 .
>>>> - git clone https://github.com/ryanprescott/realtek-verb-tools
>>>> - sudo python3 realtek-verb-tools/applyverbs.py verbs-working.txt
>>>> - put some audio to play
>>> Thank you so much! This worked somehow on my lenovo legion 7i 15IMHg05.
>>> It's not permanent though as audio needs to be played constantly for it to
>>> last longer, otherwise it go back after few seconds. I hope that the fix
>>> will be patched to the kernel after some fine-tuning as I noticed that
>>> applying the verbs the quality of audio is not quite good compared to how
>> it
>>> was on windows. But who I am to complain, I'm just happy there is a
>>> workaround to use keep me using linux on my machine.
>>>
>>> Also it's weird that the fix worked for my laptop even though I have the
>>> issue with mis-detected codecs: the specs of my laptop list ALC3306 while
>>> alsa reports ALC287.
>>
>> I haven't had a chance to try comparing the audio quality, but I have
>> wondered if that might be the case... How did you compare? Was it with the
>> same application? Ie, maybe FireFox/Chrome and YouTube?
>>
>> Is anyone else seeing differences?
> I've ran firefox with the same youtube video and I also felt the quality is
> lower on Linux. I don't know how to describe the difference though.
> It is not a significant difference for me.
> I am good with the current quality, but there is definitelly something to
> improve there.
>
Comment 244 Vincent Morel 2021-06-22 16:16:36 UTC
(In reply to Cameron Berkenpas from comment #243)
> I just did the same thing, and my reaction is the same. The quality is 
> lower under Linux, but it's not a massive difference. Maybe it sounds 
> more tinny under Linux?
> 
> Not sure what controls that... Maybe coefficients?
> 
> I would say the current quality is still a massive step up over having 
> had no sound at all.
> 
> My current priority is to fix the headphone issues. I want the speakers 
> to start working again after unplugging from the headphone jack.
> 
> 
> On 6/22/21 9:06 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #242 from TT (thiagotei@icloud.com) ---
> > (In reply to Cameron Berkenpas from comment #241)
> >> (In reply to Jenefer from comment #237)
> >>> (In reply to TT from comment #208)
> >>>> For those wanting to test it.
> >>>> - Download the verbs-working.txt provided on
> >>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555#c206 .
> >>>> - git clone https://github.com/ryanprescott/realtek-verb-tools
> >>>> - sudo python3 realtek-verb-tools/applyverbs.py verbs-working.txt
> >>>> - put some audio to play
> >>> Thank you so much! This worked somehow on my lenovo legion 7i 15IMHg05.
> >>> It's not permanent though as audio needs to be played constantly for it
> to
> >>> last longer, otherwise it go back after few seconds. I hope that the fix
> >>> will be patched to the kernel after some fine-tuning as I noticed that
> >>> applying the verbs the quality of audio is not quite good compared to how
> >> it
> >>> was on windows. But who I am to complain, I'm just happy there is a
> >>> workaround to use keep me using linux on my machine.
> >>>
> >>> Also it's weird that the fix worked for my laptop even though I have the
> >>> issue with mis-detected codecs: the specs of my laptop list ALC3306 while
> >>> alsa reports ALC287.
> >>
> >> I haven't had a chance to try comparing the audio quality, but I have
> >> wondered if that might be the case... How did you compare? Was it with the
> >> same application? Ie, maybe FireFox/Chrome and YouTube?
> >>
> >> Is anyone else seeing differences?
> > I've ran firefox with the same youtube video and I also felt the quality is
> > lower on Linux. I don't know how to describe the difference though.
> > It is not a significant difference for me.
> > I am good with the current quality, but there is definitelly something to
> > improve there.
> >

I guess you already checked, but just be sure there is no "sound enhancement" activated under Windows... On my Lenovo, there is some sound enhancer activated by default in Windows.
Seems we get near to find a solution, I'll have to test on my 13S Gen2 all of this (and I will report back on the ALC3306 thread).
Comment 245 Cameron Berkenpas 2021-06-22 16:20:18 UTC
On 6/22/21 9:16 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
>
> I guess you already checked, but just be sure there is no "sound enhancement"
> activated under Windows... On my Lenovo, there is some sound enhancer
> activated
> by default in Windows.
> Seems we get near to find a solution, I'll have to test on my 13S Gen2 all of
> this (and I will report back on the ALC3306 thread).
>
I didn't know about the enhanced sound. Is that controlled in Lenovo 
Vantage?
Comment 246 Vincent Morel 2021-06-22 16:35:35 UTC
(In reply to Cameron Berkenpas from comment #245)
> On 6/22/21 9:16 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> >
> > I guess you already checked, but just be sure there is no "sound
> enhancement"
> > activated under Windows... On my Lenovo, there is some sound enhancer
> > activated
> > by default in Windows.
> > Seems we get near to find a solution, I'll have to test on my 13S Gen2 all
> of
> > this (and I will report back on the ALC3306 thread).
> >
> I didn't know about the enhanced sound. Is that controlled in Lenovo 
> Vantage?

Yes it's there in Lenovo Vantage (surround stuff, or enhancement, or I can't remember the name).
I always remove those stuff, whatever they call it, because I prefer "natural" sound...
Comment 247 woody64 2021-06-22 22:05:27 UTC
(In reply to TT from comment #236)
> I experienced the same as Comment #230 and Comment #231 in Ubuntu 20.04.2
> kernel 5.8.0-55.
> 
> BTW, have you seen this windows program to get the dumps? RtHDDump_V236.zip
> It is suggested suggested by Hui Wang that has contributions to the Realtek
> patches. Sources:
> - https://asus-linux.org/blog/sound-2021-01-11/#getting-dumps
> - https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1852922
> - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1851518
> I have windows installed in another partition and may try it later.
> We may have already the coeffs to make it work but this may show something
> extra.

I've tried to follow some ideas in the dump. Don't know if that brings anybody further insights.

# 1. enables output of COEF
echo 1 |sudo tee /sys/module/snd_hda_codec/parameters/dump_coef
# shows the result for the ALC287 
cat /proc/asound/card0/codec#0
# thus allowing to dump the different COEF register states after several actions

=> if I'm comparing the output before and after S3 resume, I can't see a significant difference 

# 2. enable hda traces
echo 1 | sudo tee /sys/kernel/debug/tracing/events/hda/enable
# read traces 
sudo cat /sys/kernel/debug/tracing/trace >/tmp/1
#  result in output like:
#  alsa-sink-HDA A-1107    [000] ....  9249.632894: hda_send_cmd: [0000:00:1f.3:0] val=0x00170500
hda-decode-verb 0x00170500
raw value = 0x00170500
cid = 0, nid = 0x01, verb = 0x705, parm = 0x00
raw value: verb = 0x705, parm = 0x0
verbname = set_power_state

My main idea is that there must something happen after a S3 resume which leads to a working speaker config, and it must be in the driver code?

I've tried to catch that and will upload the results soon ...

Additionally looking in the kernel code you see:
- HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269)
- for alc269 you find
- codec->patch_ops.resume = alc269_resume; => special resume handling
- in alc269_resume:
/* on some machine, the BIOS will clear the codec gpio data when enter
 * suspend, and won't restore the data after resume, so we restore it
 * in the driver.
*/

=> would explain, why S3 resume is working
- maybe some additonal toggle_power_output commands are also helpful


Is that something which can be helpful or a complete misleading path?
Comment 248 woody64 2021-06-22 22:11:27 UTC
Some of the tools are coming from
https://kernel.org/doc/html/v4.16/sound/hd-audio/notes.html
Comment 249 Cameron Berkenpas 2021-06-22 23:08:59 UTC
On 6/22/21 3:05 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #247 from woody64 (andreas@mac-au.eu) ---
> (In reply to TT from comment #236)
>> I experienced the same as Comment #230 and Comment #231 in Ubuntu 20.04.2
>> kernel 5.8.0-55.
>>
>> BTW, have you seen this windows program to get the dumps? RtHDDump_V236.zip
>> It is suggested suggested by Hui Wang that has contributions to the Realtek
>> patches. Sources:
>> - https://asus-linux.org/blog/sound-2021-01-11/#getting-dumps
>> - https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1852922
>> - https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1851518
>> I have windows installed in another partition and may try it later.
>> We may have already the coeffs to make it work but this may show something
>> extra.
> I've tried to follow some ideas in the dump. Don't know if that brings
> anybody
> further insights.
How direct can the dumps be translated to verbs? If translating isn't an 
issue (I don't know what the dump output looks like yet but I should 
really look), that should be a sufficient set of verbs to get both 
speakers going in a patch for the Yoga.

Hopefully the dumps are a working alternative to running a Windows VM 
with PCIE passthrough... It's quite a bit of work to setup.

>
> # 1. enables output of COEF
> echo 1 |sudo tee /sys/module/snd_hda_codec/parameters/dump_coef
> # shows the result for the ALC287
> cat /proc/asound/card0/codec#0
> # thus allowing to dump the different COEF register states after several
> actions
>
> => if I'm comparing the output before and after S3 resume, I can't see a
> significant difference
>
> # 2. enable hda traces
> echo 1 | sudo tee /sys/kernel/debug/tracing/events/hda/enable
> # read traces
> sudo cat /sys/kernel/debug/tracing/trace >/tmp/1
> #  result in output like:
> #  alsa-sink-HDA A-1107    [000] ....  9249.632894: hda_send_cmd:
> [0000:00:1f.3:0] val=0x00170500
> hda-decode-verb 0x00170500
> raw value = 0x00170500
> cid = 0, nid = 0x01, verb = 0x705, parm = 0x00
> raw value: verb = 0x705, parm = 0x0
> verbname = set_power_state
I think these traces will very useful. Perhaps I can also use them to 
determine what's going on when I plug headphones into the jack and 
remove them so we can handle that appropriately.
>
> My main idea is that there must something happen after a S3 resume which
> leads
> to a working speaker config, and it must be in the driver code?
>
> I've tried to catch that and will upload the results soon ...
>
> Additionally looking in the kernel code you see:
> - HDA_CODEC_ENTRY(0x10ec0287, "ALC287", patch_alc269)
> - for alc269 you find
> - codec->patch_ops.resume = alc269_resume; => special resume handling
> - in alc269_resume:
> /* on some machine, the BIOS will clear the codec gpio data when enter
>   * suspend, and won't restore the data after resume, so we restore it
>   * in the driver.
> */
>
> => would explain, why S3 resume is working
> - maybe some additonal toggle_power_output commands are also helpful
Well, this is like the other issue with my patch where after unplugging 
headphones, speaker output is gone again and can be restored by either 
applying the verbs or a *resume*.

I did notice that resume seems to call init for the card again (which 
applies to the verbs that are in the patch), but the fact that this 
worked for the Yoga Slim *before* my patch and gets both speakers to 
come up *after* the patch makes me think there might be something in the 
firmware/BIOS. Maybe Lenovo was running into an issue on resume and the 
firmware/BIOS re-initializes the speakers as a workaround? Or maybe it 
is something in the driver? But AFAIK, looking through the kernel code, 
resume just seems to call the init function IIRC.

And maybe this is why S3 has to be enabled by editing the DSDT table; it 
was giving Lenovo some trouble?

>   
>
>
> Is that something which can be helpful or a complete misleading path?
I think all of this is helpful, and I'm very grateful to have another 
pair of eyes on this. Thank you!

On an unrelated note, I sent a message to alsa-devel (I signed up first) 
and so far no bites. However, maybe a lot of them in Europe (I'm in the 
US) and perhaps I'll see some responses by morning..?
Comment 250 Cameron Berkenpas 2021-06-22 23:19:22 UTC
> I've ran firefox with the same youtube video and I also felt the quality is
> lower on Linux. I don't know how to describe the difference though.
> It is not a significant difference for me. 
> I am good with the current quality, but there is definitelly something to
> improve there.

Hmm. The cut off point in verbs-working.txt is almost arbitrary. I started from an arbitrary point in verbs.txt and found the first place from that original starting point that gave me 2 working speakers on my Legion. 

It's possible if we go further down through verbs.txt we get to a point where the audio quality improves I suppose.

I'm keeping my focus on the headphone issue for now before I try anything with the sound quality issue. Hopefully someone else can play with this in the meantime. I don't think there should be any conflict between applying verbs and using the patch. Or at least none that wouldn't exist when not using the patch anyway... :)
Comment 251 Cameron Berkenpas 2021-06-23 01:55:03 UTC
Created attachment 297569 [details]
linux-5.12.12-legion-sound-0.0.2.patch - headphone fix

Headphone issue is fixed.

I believe unmute hooks are called whenever jacks are either plugged or unplugged. We'll probably want only want to send the verbs when we're in the unplugged state. I'll update that at some point before I try for a final patch.

I know I implied I'd work on audio quality next... But how many people would like me to work on getting the Yoga support squared away so it's on par with the Legion support (ie, you get both speakers)? I suspect functionality is more important than what appears to be a smallish loss of quality.

Also, Legion and Yoga owners, please test. Let me know of any issues. In particular, let me know whether or not speaker output still works after plugging in and then unplugging in headphones.
Comment 252 Cameron Berkenpas 2021-06-23 02:07:15 UTC
Created attachment 297571 [details]
linux-5.12.12-legion-sound-0.0.3.patch - actual headphone fix

Whoops, patch 0.0.2 is exactly the same as 0.0.1. Please use this one. Everything else from my previous message still stands.
Comment 253 Cameron Berkenpas 2021-06-23 04:30:15 UTC
Going through the alsa-info results posted in this bug and looking at the subsystem ID's, none of the models are supported by my patch except for the Legion.

For the non-Legion users who have built their kernels with my patch applied, are you sure you aren't still using the S3 and/or the verb workarounds?

In this bug, I've found the following models:
Yoga Slim 7
Yoga 7 14ITL5
Yoga Duet 7
Legion 7

In sound/pci/hda/patch_realtek.c, my patch adds this line:
SND_PCI_QUIRK(0x17aa, 0x3813, "Lenovo Legion 7", ALC287_FIXUP_LEGION_15IMHG05_SPEAKERS),

The ID's for all the other models are different which means these kernel patches should only affect Legion 7's (and possibly only the 2020 model). Therefore the patch is probably doing nothing for you and you likely have one of the other workarounds in place (S3/verbs). But please look into this and update me one way or the other.

Interestingly, there's a quirk that does match the Yoga Duet in patch_realtek.c:
SND_PCI_QUIRK(0x17aa, 0x3818, "Lenovo C940", ALC298_FIXUP_LENOVO_SPK_VOLUME),

But I presume the "Lenovo C940" fix doesn't work for the Duet.

I have enough info from alsa-info for these other non-Legion models to create a patch that will apply to them. If applying verbs-working.txt works for your model, then a patch would work as well (except your speakers presumably wouldn't stop working after a period of time, etc). Just let me know.
Comment 254 Thiago T 2021-06-23 06:10:25 UTC
I've patched kernel 5.8.0-59 for Ubuntu 20.04.2/Legion 7i and everything worked well!
Headphones turn the speakers off when I plug them in and back on when I plug them off.
I had adapt the patch because the kernel version was different than the one in Comment #252 but that was easy.
Comment 255 DavidLenovo 2021-06-23 07:39:38 UTC
(In reply to wave from comment #203)
> (In reply to Cameron from comment #198)
> > As my previous posts/attachments imply, I managed to get the sound card
> > working in a Windows 10 VM with PCIE passthrough and I've been able to
> trace
> > the events.
> > 
> > I was able to get this process working by following these threads, 
> > As well as reading various wikis:
> > https://bugzilla.kernel.org/show_bug.cgi?id=207423
> > https://bbs.archlinux.org/viewtopic.php?id=256009
> > 
> > If anyone is interested in trying this and needs help, I can probably help
> > you get going into the right direction at the very least.
> > 
> > The issue I had previously is that I would say I had to be more
> "aggressive"
> > in getting Windows to use the correct driver. You'll know it's working when
> > you're able to play audio in your VM and hear it through the laptop's
> > speakers.
> > 
> > Might also be helpful if someone does this on a Yoga Slim. Perhaps there
> are
> > some differences in the verbs that must be sent out to the sound card.
> > 
> > From here I guess what needs to be done is figure out what from these
> traces
> > is needed and maybe try to write a script that that calls hda-verb to send
> > the same verbs to the sound card under Linux (don't forget to re-enable the
> > card for use under Linux again if you had PCIE passthrough setup!).
> > 
> > I'll sign up with the ALSA mailing list and give an update on this issue
> > since I suspect there's likely enough here for progress to be made.
> 
> That sounds very promising, thank you very much! I don't currently have time
> but I'm definitely intrigued to look into this and hopefully finally develop
> a real fix.

Thanks you very much, it is the same for me.
Comment 256 DavidLenovo 2021-06-23 07:55:10 UTC
(In reply to Dre from comment #193)
> (In reply to DavidLenovo from comment #184)
> > (In reply to Dre from comment #174)
> > > The most recent major Manjaro update broke the fix on my system.  It
> > > upgraded my kernel from 5.10.36-2 to 5.10.41-1.  
> > 
> > (In reply to woody64 from comment #167)
> > > (In reply to DavidLenovo from comment #120)
> > > > Hi !
> > > > A man have find the solution for the Yoga 7 - Yoga 7i - 14ITL5 &
> 14ITL05
> > &
> > > > 15ITL05 & 15ITL5 :)
> > > > Sound from speakers works on Ubuntu 20.04.2LTS !!!
> > > 
> > > 
> > > This method worked pretty well for me (Lenovo Yoga 7i) with kernal
> > > 5.8.0-53-generic #60,
> > > After update to 5.8.0-55 the S3 is not visible.
> > 
> > How it work ? Anyone have to open a ticket, to signal it ?
> > It the same for the 5.11.5 work and after 5.11.6 and more stop working
> > 
> > Thanks :)
> 
> The fix broke each time I updated the system (which updated the kernel).  I
> simply ran through the steps and it restored the fix. I'm currently on
> 5.13.0-1-MANJARO and have deep sleep again after applying the fix.

Ok thanks :)
Comment 257 DavidLenovo 2021-06-23 07:56:05 UTC
(In reply to Roland from comment #192)
> (In reply to DavidLenovo from comment #191)
> > I think it is normal, this patch is for Lenovo Yoga 7i, and it depend on
> the
> > hardware, so don't have the same :(.
> 
> It's easy to port this patch to Dell, but that's not the point: iasl fails
> even without applying the patch, which should not happen ;-) But I think I
> have to ask the iasl people why this fails.
> 
> > The S3 problem can be resolve by a BIOS option, Lenovo put a locked BIOS so
> > we can't. But if Dell is better on this you could try to find an option S3,
> > or energy, ACPI, it disable for Windows compatibility.
> 
> It's a similar issue on Dell. S3 in BIOS is enabled, but:
> 
> $ cat /sys/power/mem_sleep 
> [s2idle]
> $ sudo dmesg |grep ACPI|grep supports        
> [    0.201665] ACPI: (supports S0 S4 S5)
> 
> > You have try this 5.11.5 kernel, to be sure, it is not a kernel bug ? 
> 
> Kernel 5.11 is even worse because it doesn't even recognize the sound card.
> With 5.13rc5 at least the headphone jack and the microphone is working. But
> basically I think it's either this problem or the problem reported in
> #213159...

You sure it is the ALC287 ?
For me it make no sens the driver work for us and not for you.
In case of your computer recognize the sound card but the speaker don't work, it seem to be logic, but don't recognized, with a working kernel for us, I'm surprised.
For me after 5.11.5 it stop working. I write 5.11.5 cause of that point. Do you have try 5.11.5 or older ?
Comment 258 woody64 2021-06-23 10:47:28 UTC
(In reply to woody64 from comment #176)
> (In reply to Dre from comment #174)
> > The most recent major Manjaro update broke the fix on my system.  It
> > upgraded my kernel from 5.10.36-2 to 5.10.41-1.  I decided to go ahead and
> > upgrade to 5.13 and follow the tutorial again.  The Arch Wiki fix worked on
> > the experimental kernel.  Once I play audio > suspend > wake the speakers
> > continue to work until I log off.  Even if I stop the audio for any period
> > of time while logged in the speakers still work.
> > @Niclas , what device are you running that on?
> 
> So maybe that's caused by the same changes incorporated in my 5.8.0.53-#60
> to 5.8.0.55-#62 which happened between 1. June 21 and 11. June 21 breaking
> the fix.
> So hopefully that will disappear onecmore with the next update

System was updated to 5.8.0-59-generic #66 today and:
- S3 fix is oncemore working as expected (S3 can be enabled in this version onecemore by overwriting tje DSDT table) => both speakers enabled
- also Cameron's workaround (verbs-working.txt) is doing the same job as before => left speaker enable

trying to setup a kernel compilation environment to check also the kernal patch.
Comment 259 Roland 2021-06-23 12:05:56 UTC
(In reply to DavidLenovo from comment #257)

> You sure it is the ALC287 ?

No, I'm not, although the problem sounds quote similar. This may be a coincidence, but I'll keep an eye on this issue.
Comment 260 sycxyc 2021-06-23 13:17:13 UTC
Possibly the minimum verbs of the two speakers working in Yoga 7i

```

// left speaker
0x20 0x500 0x24
0x20 0x400 0x41
// unmute
0x20 0x500 0x26
0x20 0x400 0x2
0x20 0x400 0x0
0x20 0x400 0x0
0x20 0x4b0 0x20
// right speaker (I Guessed 4 times)
0x20 0x500 0x24
0x20 0x400 0x46
// may be necessary
0x20 0x500 0x26
0x20 0x400 0xc
0x20 0x400 0x0
0x20 0x400 0x2a
0x20 0x4b0 0x20
// unmute
0x20 0x500 0x26
0x20 0x400 0x2
0x20 0x400 0x0
0x20 0x400 0x0
0x20 0x4b0 0x20

```
Comment 261 woody64 2021-06-23 13:28:46 UTC
confirmed on Ubuntu 20.04 with kernel 5.8.0-59-generic #66.

First time this "workaround" enables both speakers (so far only left speaker).

Great ....
Comment 262 Cameron Berkenpas 2021-06-23 16:31:58 UTC
sycxyc,

Great work!

Is this work from the verbs I attached to the ticket or did you find these verbs on your own?

Can you give me your alsa-info.sh? You can either post the the output here or upload it and share the URL.

With all this and your verbs, I should be able to update the patch to cover your machine.


On 6/23/21 6:17 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #260 from sycxyc (sycxyc@yandex.com) ---
> Possibly the minimum verbs of the two speakers working in Yoga 7i
>
> ```
>
> // left speaker
> 0x20 0x500 0x24
> 0x20 0x400 0x41
> // unmute
> 0x20 0x500 0x26
> 0x20 0x400 0x2
> 0x20 0x400 0x0
> 0x20 0x400 0x0
> 0x20 0x4b0 0x20
> // right speaker (I Guessed 4 times)
> 0x20 0x500 0x24
> 0x20 0x400 0x46
> // may be necessary
> 0x20 0x500 0x26
> 0x20 0x400 0xc
> 0x20 0x400 0x0
> 0x20 0x400 0x2a
> 0x20 0x4b0 0x20
> // unmute
> 0x20 0x500 0x26
> 0x20 0x400 0x2
> 0x20 0x400 0x0
> 0x20 0x400 0x0
> 0x20 0x4b0 0x20
>
> ```
>
Comment 263 Cameron Berkenpas 2021-06-23 16:58:51 UTC
woody64,

You're on *buntu 20.04, is that right?

Can you please provide your alsa-info to me? Sorry if you've already 
shared it. I searched through your posts in this bug and couldn't find 
it, but there are a lot of comments so it's possible I missed it.

On 6/23/21 6:28 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #261 from woody64 (andreas@mac-au.eu) ---
> confirmed on Ubuntu 20.04 with kernel 5.8.0-59-generic #66.
>
> First time this "workaround" enables both speakers (so far only left
> speaker).
>
> Great ....
>
Comment 264 woody64 2021-06-23 17:08:47 UTC
That's one from the begin of the month:
https://media-cdn.ubuntu-de.org/forum/attachments/23/21/9255949-alsa.txt
Comment 265 Cameron Berkenpas 2021-06-23 17:11:54 UTC
It definitely is. What's missing a sequence of HDA verbs specific to 
your model of laptop to get the speakers going. This probably sets the 
speaker amplifier chips.

Can you share your alsa-info? Skimming through the bug, I wasn't able to 
find for you.

Have you tried the verb work around (without the S3 workaround)? How 
well does that work for you?

On 6/23/21 12:56 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #257 from DavidLenovo (DavidLenovoFr@protonmail.com) ---
> (In reply to Roland from comment #192)
>> (In reply to DavidLenovo from comment #191)
>>> I think it is normal, this patch is for Lenovo Yoga 7i, and it depend on
>> the
>>> hardware, so don't have the same :(.
>> It's easy to port this patch to Dell, but that's not the point: iasl fails
>> even without applying the patch, which should not happen ;-) But I think I
>> have to ask the iasl people why this fails.
>>
>>> The S3 problem can be resolve by a BIOS option, Lenovo put a locked BIOS so
>>> we can't. But if Dell is better on this you could try to find an option S3,
>>> or energy, ACPI, it disable for Windows compatibility.
>> It's a similar issue on Dell. S3 in BIOS is enabled, but:
>>
>> $ cat /sys/power/mem_sleep
>> [s2idle]
>> $ sudo dmesg |grep ACPI|grep supports
>> [    0.201665] ACPI: (supports S0 S4 S5)
>>
>>> You have try this 5.11.5 kernel, to be sure, it is not a kernel bug ?
>> Kernel 5.11 is even worse because it doesn't even recognize the sound card.
>> With 5.13rc5 at least the headphone jack and the microphone is working. But
>> basically I think it's either this problem or the problem reported in
>> #213159...
> You sure it is the ALC287 ?
> For me it make no sens the driver work for us and not for you.
> In case of your computer recognize the sound card but the speaker don't work,
> it seem to be logic, but don't recognized, with a working kernel for us, I'm
> surprised.
> For me after 5.11.5 it stop working. I write 5.11.5 cause of that point. Do
> you
> have try 5.11.5 or older ?
>
Comment 266 sycxyc 2021-06-23 17:31:25 UTC
(In reply to Cameron Berkenpas from comment #262)
> sycxyc,
> 
> Great work!
> 
> Is this work from the verbs I attached to the ticket or did you find these
> verbs on your own?
> 
> Can you give me your alsa-info.sh? You can either post the the output here
> or upload it and share the URL.
> 
> With all this and your verbs, I should be able to update the patch to cover
> your machine.
> 
> 
> On 6/23/21 6:17 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #260 from sycxyc (sycxyc@yandex.com) ---
> > Possibly the minimum verbs of the two speakers working in Yoga 7i
> >
> > ```
> >
> > // left speaker
> > 0x20 0x500 0x24
> > 0x20 0x400 0x41
> > // unmute
> > 0x20 0x500 0x26
> > 0x20 0x400 0x2
> > 0x20 0x400 0x0
> > 0x20 0x400 0x0
> > 0x20 0x4b0 0x20
> > // right speaker (I Guessed 4 times)
> > 0x20 0x500 0x24
> > 0x20 0x400 0x46
> > // may be necessary
> > 0x20 0x500 0x26
> > 0x20 0x400 0xc
> > 0x20 0x400 0x0
> > 0x20 0x400 0x2a
> > 0x20 0x4b0 0x20
> > // unmute
> > 0x20 0x500 0x26
> > 0x20 0x400 0x2
> > 0x20 0x400 0x0
> > 0x20 0x400 0x0
> > 0x20 0x4b0 0x20
> >
> > ```
> >

These verbs are based on your attachment, but the right speaker does not work.
I tried to fix the right speaker issue by changing the following.
```
 0x20 0x500 0x24
-0x20 0x400 0x42
+0x20 0x400 0x46
```
Here's the Alsa-info for my machine. It may be similar to the yoga 7i.

http://alsa-project.org/db/?f=68337a779c3297142b0afb022125fbf32f1a6c17
Comment 267 Cameron Berkenpas 2021-06-23 17:35:45 UTC
The Legion verbs I provided don't enable your right speaker. Got it.

But I'm unclear on your set of verbs. Do YOUR verbs enable your right 
speaker?

Thank you for the alsa-info. You have the same hardware ID's as woody64 
and the same problem with the right speaker. This is progress!

On 6/23/21 10:31 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #266 from sycxyc (sycxyc@yandex.com) ---
> (In reply to Cameron Berkenpas from comment #262)
>> sycxyc,
>>
>> Great work!
>>
>> Is this work from the verbs I attached to the ticket or did you find these
>> verbs on your own?
>>
>> Can you give me your alsa-info.sh? You can either post the the output here
>> or upload it and share the URL.
>>
>> With all this and your verbs, I should be able to update the patch to cover
>> your machine.
>>
>>
>> On 6/23/21 6:17 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>
>>> --- Comment #260 from sycxyc (sycxyc@yandex.com) ---
>>> Possibly the minimum verbs of the two speakers working in Yoga 7i
>>>
>>> ```
>>>
>>> // left speaker
>>> 0x20 0x500 0x24
>>> 0x20 0x400 0x41
>>> // unmute
>>> 0x20 0x500 0x26
>>> 0x20 0x400 0x2
>>> 0x20 0x400 0x0
>>> 0x20 0x400 0x0
>>> 0x20 0x4b0 0x20
>>> // right speaker (I Guessed 4 times)
>>> 0x20 0x500 0x24
>>> 0x20 0x400 0x46
>>> // may be necessary
>>> 0x20 0x500 0x26
>>> 0x20 0x400 0xc
>>> 0x20 0x400 0x0
>>> 0x20 0x400 0x2a
>>> 0x20 0x4b0 0x20
>>> // unmute
>>> 0x20 0x500 0x26
>>> 0x20 0x400 0x2
>>> 0x20 0x400 0x0
>>> 0x20 0x400 0x0
>>> 0x20 0x4b0 0x20
>>>
>>> ```
>>>
> These verbs are based on your attachment, but the right speaker does not
> work.
> I tried to fix the right speaker issue by changing the following.
> ```
>   0x20 0x500 0x24
> -0x20 0x400 0x42
> +0x20 0x400 0x46
> ```
> Here's the Alsa-info for my machine. It may be similar to the yoga 7i.
>
> http://alsa-project.org/db/?f=68337a779c3297142b0afb022125fbf32f1a6c17
>
Comment 268 Cameron Berkenpas 2021-06-23 18:08:35 UTC
DavidLenovo,

Whoops, I misunderstood who you were responding to. But having your 
alsa-info would also help.

Roland,

Can you also share your alsa-info with me? Even if you do have an 
ALC287, it's likely that your Dell requires a different sequence for 
initialization.

On 6/23/21 10:11 AM, Cameron Berkenpas wrote:
> It definitely is. What's missing a sequence of HDA verbs specific to 
> your model of laptop to get the speakers going. This probably sets the 
> speaker amplifier chips.
>
> Can you share your alsa-info? Skimming through the bug, I wasn't able 
> to find for you.
>
> Have you tried the verb work around (without the S3 workaround)? How 
> well does that work for you?
>
> On 6/23/21 12:56 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>
>> --- Comment #257 from DavidLenovo (DavidLenovoFr@protonmail.com) ---
>> (In reply to Roland from comment #192)
>>> (In reply to DavidLenovo from comment #191)
>>>> I think it is normal, this patch is for Lenovo Yoga 7i, and it 
>>>> depend on
>>> the
>>>> hardware, so don't have the same :(.
>>> It's easy to port this patch to Dell, but that's not the point: iasl 
>>> fails
>>> even without applying the patch, which should not happen ;-) But I 
>>> think I
>>> have to ask the iasl people why this fails.
>>>
>>>> The S3 problem can be resolve by a BIOS option, Lenovo put a locked 
>>>> BIOS so
>>>> we can't. But if Dell is better on this you could try to find an 
>>>> option S3,
>>>> or energy, ACPI, it disable for Windows compatibility.
>>> It's a similar issue on Dell. S3 in BIOS is enabled, but:
>>>
>>> $ cat /sys/power/mem_sleep
>>> [s2idle]
>>> $ sudo dmesg |grep ACPI|grep supports
>>> [    0.201665] ACPI: (supports S0 S4 S5)
>>>
>>>> You have try this 5.11.5 kernel, to be sure, it is not a kernel bug ?
>>> Kernel 5.11 is even worse because it doesn't even recognize the 
>>> sound card.
>>> With 5.13rc5 at least the headphone jack and the microphone is 
>>> working. But
>>> basically I think it's either this problem or the problem reported in
>>> #213159...
>> You sure it is the ALC287 ?
>> For me it make no sens the driver work for us and not for you.
>> In case of your computer recognize the sound card but the speaker 
>> don't work,
>> it seem to be logic, but don't recognized, with a working kernel for 
>> us, I'm
>> surprised.
>> For me after 5.11.5 it stop working. I write 5.11.5 cause of that 
>> point. Do you
>> have try 5.11.5 or older ?
>>
>
Comment 269 Cameron Berkenpas 2021-06-23 18:10:04 UTC
On 6/22/21 11:10 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #254 from TT (thiagotei@icloud.com) ---
> I've patched kernel 5.8.0-59 for Ubuntu 20.04.2/Legion 7i and everything
> worked
> well!
> Headphones turn the speakers off when I plug them in and back on when I plug
> them off.
> I had adapt the patch because the kernel version was different than the one
> in
> Comment #252 but that was easy.
>
Thank you for the confirmation!
Comment 270 Alex 2021-06-23 20:50:16 UTC
(In reply to Cameron Berkenpas from comment #221)
 
> Has anyone tested a 2021 Legion yet? I'm curious to know if this set of 
> verb works.

Legion 7 2021 (16achg6) here! (According to specs it's an ALC3306 but according to Alsa it's an ALC287): http://alsa-project.org/db/?f=d3f255a8ac60504ad70c27c5cc36e6e7400eaab3

I'll try and figure out how to apply a kernel patch and see if that helps!
Comment 271 woody64 2021-06-23 21:58:03 UTC
(In reply to Cameron Berkenpas from comment #267)
> The Legion verbs I provided don't enable your right speaker. Got it.
> 
> But I'm unclear on your set of verbs. Do YOUR verbs enable your right 
> speaker?
> 
> Thank you for the alsa-info. You have the same hardware ID's as woody64 
> and the same problem with the right speaker. This is progress!
> 

Yes, the small sequence has worked for me on a Lenovo Yoga 7i without and with S3 workaraund.

When using the S3 workaround without firing further outputs to the audio device and audio is then oncemore lost the verb sequence can be used to restart the Audio for both speakers.
Afterwards the sound stays for a longer period, can't say when the sound disappears.
So it has the same effect in this setup as in the setuo without S3 enabled or with S3 enabled and not used.
Comment 272 Cameron Berkenpas 2021-06-23 22:17:59 UTC
Have you tried the kernel patch (without the verb workaround)? If so, I 
assume it didn't work?

Thank you for the info. I'll add support for this model to the patch 
likely at some point today.

-Cameron

PS: I didn't know for sure these were even out... Each time I've 
checked, the Lenovo site says "coming soon". With the progress I've 
made, I'm strongly considering getting one. Therefore even if my patch 
doesn't have the right verbs for initialization, I'd likely be able to 
add support once I had the hardware.

On 6/23/21 1:50 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #270 from Alex (alex@avsmith.net) ---
> (In reply to Cameron Berkenpas from comment #221)
>
>> Has anyone tested a 2021 Legion yet? I'm curious to know if this set of
>> verb works.
> Legion 7 2021 (16achg6) here! (According to specs it's an ALC3306 but
> according
> to Alsa it's an ALC287):
> http://alsa-project.org/db/?f=d3f255a8ac60504ad70c27c5cc36e6e7400eaab3
>
> I'll try and figure out how to apply a kernel patch and see if that helps!
>
Comment 273 Cameron Berkenpas 2021-06-23 23:15:10 UTC
Created attachment 297583 [details]
linux-5.12.12-legion-sound-0.0.4.patch - updated headphone fix, more models supported

I've updated the headphone fix. The automute_hook wasn't the fix. Simply having an automute_hook defined means snd_hda_gen_update_outputs() is not called. The call to snd_hda_gen_update_outputs() results in do_automute() being called, which shuts down the speakers putting them into a state where they need to be re-initialized. Setting automute_speaker to off avoids do_automute() breaking the speakers and it seems we can trust the hardware to do the right thing.

So please test without any of the other work arounds. Make sure speaker output resumes after unplugging headphones while sound is playing.

The good news is that this patch should now affect more than the original 2020 Legion. Here are the models that can test this patch:
Lenovo Legion 7i
Legion 7 16ACHg6 (2021)
Lenovo Yoga 7 14ITL5
Yoga 14cITL 2021

In the case of the last 2 models, you should only see output from one speaker as the same verbs are being applied as in verbs-working.txt (for now).

In the case of the 16ACHg6, I have no idea what to expect. Depends if the speakers require the same (or very similar) initialization sequence or not.
Comment 274 Cameron Berkenpas 2021-06-24 01:49:42 UTC
(In reply to TT from comment #242)
> (In reply to Cameron Berkenpas from comment #241)
> > (In reply to Jenefer from comment #237)
> > > (In reply to TT from comment #208)
> > > > For those wanting to test it.
> > > > - Download the verbs-working.txt provided on
> > > > https://bugzilla.kernel.org/show_bug.cgi?id=208555#c206 .
> > > > - git clone https://github.com/ryanprescott/realtek-verb-tools
> > > > - sudo python3 realtek-verb-tools/applyverbs.py verbs-working.txt
> > > > - put some audio to play
> > > 
> > > Thank you so much! This worked somehow on my lenovo legion 7i 15IMHg05.
> > > It's not permanent though as audio needs to be played constantly for it
> to
> > > last longer, otherwise it go back after few seconds. I hope that the fix
> > > will be patched to the kernel after some fine-tuning as I noticed that
> > > applying the verbs the quality of audio is not quite good compared to how
> > it
> > > was on windows. But who I am to complain, I'm just happy there is a
> > > workaround to use keep me using linux on my machine.
> > > 
> > > Also it's weird that the fix worked for my laptop even though I have the
> > > issue with mis-detected codecs: the specs of my laptop list ALC3306 while
> > > alsa reports ALC287.
> > 
> > 
> > I haven't had a chance to try comparing the audio quality, but I have
> > wondered if that might be the case... How did you compare? Was it with the
> > same application? Ie, maybe FireFox/Chrome and YouTube?
> > 
> > Is anyone else seeing differences?
> 
> I've ran firefox with the same youtube video and I also felt the quality is
> lower on Linux. I don't know how to describe the difference though.
> It is not a significant difference for me. 
> I am good with the current quality, but there is definitelly something to
> improve there.

(In reply to Vincent Morel from comment #246)
> (In reply to Cameron Berkenpas from comment #245)
> > On 6/22/21 9:16 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> > >
> > >
> > > I guess you already checked, but just be sure there is no "sound
> > enhancement"
> > > activated under Windows... On my Lenovo, there is some sound enhancer
> > > activated
> > > by default in Windows.
> > > Seems we get near to find a solution, I'll have to test on my 13S Gen2
> all
> > of
> > > this (and I will report back on the ALC3306 thread).
> > >
> > I didn't know about the enhanced sound. Is that controlled in Lenovo 
> > Vantage?
> 
> Yes it's there in Lenovo Vantage (surround stuff, or enhancement, or I can't
> remember the name).
> I always remove those stuff, whatever they call it, because I prefer
> "natural" sound...

Vincent Morel,

I don't have a natural setting in my Vantage... But I do have a setting to enable/disable Dolby sound. Disabling it causes the sound under Windows to sound like it does in Linux. Being able to switch back and forth on the fly with the Dolby switch in Vantage under Windows instead of waiting for reboots... The difference is more stark

However, I think I can live with it.

Especially since it looks like there's really nothing more to be done from my side at least:
https://askubuntu.com/questions/984109/dolby-equivalent-for-ubuntu

(although that link has something of a work around... I'd be curious if anyone reported back on the results).

There are likely ways required to enable Dolby in the hardware side that don't involve HDA verbs or there's a proprietary software component. Probably both.

The "good" news for me is that this is one less thing I have to worry about I guess.

Lastly, we probably have some different sound options because we're on different models of laptop. Under Dolby, I have various settings that include gaming, movies, and so on. Maybe "Natural" falls under one of the your sub settings or you have something else entirely. *shrug*

You have a 13S Gen 2, right? Could you provide your alsa-info? I haven't seen one posted for you, but there's a lot of noise (and I've just started keeping track for reference).

Thanks!
Comment 275 crisicola 2021-06-24 02:53:38 UTC
(In reply to Cameron Berkenpas from comment #273)
> Created attachment 297583 [details]
> linux-5.12.12-legion-sound-0.0.4.patch - updated headphone fix, more models
> supported
> 
> I've updated the headphone fix. The automute_hook wasn't the fix. Simply
> having an automute_hook defined means snd_hda_gen_update_outputs() is not
> called. The call to snd_hda_gen_update_outputs() results in do_automute()
> being called, which shuts down the speakers putting them into a state where
> they need to be re-initialized. Setting automute_speaker to off avoids
> do_automute() breaking the speakers and it seems we can trust the hardware
> to do the right thing.
> 
> So please test without any of the other work arounds. Make sure speaker
> output resumes after unplugging headphones while sound is playing.
> 
> The good news is that this patch should now affect more than the original
> 2020 Legion. Here are the models that can test this patch:
> Lenovo Legion 7i
> Legion 7 16ACHg6 (2021)
> Lenovo Yoga 7 14ITL5
> Yoga 14cITL 2021
> 
> In the case of the last 2 models, you should only see output from one
> speaker as the same verbs are being applied as in verbs-working.txt (for
> now).
> 
> In the case of the 16ACHg6, I have no idea what to expect. Depends if the
> speakers require the same (or very similar) initialization sequence or not.

I have a Legion 7 2020 (alsa-info here:http://alsa-project.org/db/?f=c62e1da70c65a4709d137b2a48204cd6ebdeaaa1) and a bit of a Linux newbie. I'm on Pop_OS; would you explain how to apply this patch? My headphone/usb headphones work fine but speakers aren't working.
Comment 276 Cameron Berkenpas 2021-06-24 03:34:01 UTC
You need to pull the kernel source, know how to apply the patch, how to 
configure the kernel, know how to build your kernel, and then to install 
it. If you're new to Linux, this may not be for you.

I'm *really* hesitant to provide some random kernel packages. From a 
security point of view, I would strongly recommend against installing 
packages (especially kernel packages) from some random person's web server.

Hopefully someone following this bug has the time and know-how to setup 
a proper PPA for kernel packages with this patch for *buntu. It would 
help a lot of people, and it'd be nice to have some more feedback too.

On 6/23/21 7:53 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #275 fromcrisicola@yahoo.com  ---
> (In reply to Cameron Berkenpas from comment #273)
>> Created attachment 297583 [details]
>> linux-5.12.12-legion-sound-0.0.4.patch - updated headphone fix, more models
>> supported
>>
>> I've updated the headphone fix. The automute_hook wasn't the fix. Simply
>> having an automute_hook defined means snd_hda_gen_update_outputs() is not
>> called. The call to snd_hda_gen_update_outputs() results in do_automute()
>> being called, which shuts down the speakers putting them into a state where
>> they need to be re-initialized. Setting automute_speaker to off avoids
>> do_automute() breaking the speakers and it seems we can trust the hardware
>> to do the right thing.
>>
>> So please test without any of the other work arounds. Make sure speaker
>> output resumes after unplugging headphones while sound is playing.
>>
>> The good news is that this patch should now affect more than the original
>> 2020 Legion. Here are the models that can test this patch:
>> Lenovo Legion 7i
>> Legion 7 16ACHg6 (2021)
>> Lenovo Yoga 7 14ITL5
>> Yoga 14cITL 2021
>>
>> In the case of the last 2 models, you should only see output from one
>> speaker as the same verbs are being applied as in verbs-working.txt (for
>> now).
>>
>> In the case of the 16ACHg6, I have no idea what to expect. Depends if the
>> speakers require the same (or very similar) initialization sequence or not.
> I have a Legion 7 2020 (alsa-info
> here:http://alsa-project.org/db/?f=c62e1da70c65a4709d137b2a48204cd6ebdeaaa1)
> and a bit of a Linux newbie. I'm on Pop_OS; would you explain how to apply
> this
> patch? My headphone/usb headphones work fine but speakers aren't working.
>
Comment 277 sycxyc 2021-06-24 12:41:29 UTC
Yes, I have all speakers enabled.

Here are more explanations of these verbs.

```
// set left speaker
0x20 0x500 0x24
0x20 0x400 0x41

// set right speaker (Legion 7i)
0x20 0x500 0x24
0x20 0x400 0x42

// set right speaker (Yoga 7i)
0x20 0x500 0x24
0x20 0x400 0x46

// reset settings and inactive speakers
0x20 0x500 0x26
0x20 0x400 0x1
0x20 0x400 0x0
0x20 0x400 0x1
0x20 0x4b0 0x20

// set to left channel
0x20 0x500 0x26
0x20 0x400 0xc
0x20 0x400 0x0
0x20 0x400 0x1a
0x20 0x4b0 0x20

// set to right channel
0x20 0x500 0x26
0x20 0x400 0xc
0x20 0x400 0x0
0x20 0x400 0x2a
0x20 0x4b0 0x20

// set to mono
0x20 0x500 0x26
0x20 0x400 0xc
0x20 0x400 0x0
0x20 0x400 0x3a
0x20 0x4b0 0x20

// activate speaker
0x20 0x500 0x26
0x20 0x400 0x2
0x20 0x400 0x0
0x20 0x400 0x0
0x20 0x4b0 0x20
```

# Example

Set the left speaker to the right channel:

```
// set left speaker
0x20 0x500 0x24
0x20 0x400 0x41

// reset settings and inactive speakers
0x20 0x500 0x26
0x20 0x400 0x1
0x20 0x400 0x0
0x20 0x400 0x1
0x20 0x4b0 0x20

// set to right channel
0x20 0x500 0x26
0x20 0x400 0xc
0x20 0x400 0x0
0x20 0x400 0x2a
0x20 0x4b0 0x20

// activate speaker
0x20 0x500 0x26
0x20 0x400 0x2
0x20 0x400 0x0
0x20 0x400 0x0
0x20 0x4b0 0x20
```


(In reply to Cameron Berkenpas from comment #267)
> The Legion verbs I provided don't enable your right speaker. Got it.
> 
> But I'm unclear on your set of verbs. Do YOUR verbs enable your right 
> speaker?
> 
> Thank you for the alsa-info. You have the same hardware ID's as woody64 
> and the same problem with the right speaker. This is progress!
> 
> On 6/23/21 10:31 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #266 from sycxyc (sycxyc@yandex.com) ---
> > (In reply to Cameron Berkenpas from comment #262)
> >> sycxyc,
> >>
> >> Great work!
> >>
> >> Is this work from the verbs I attached to the ticket or did you find these
> >> verbs on your own?
> >>
> >> Can you give me your alsa-info.sh? You can either post the the output here
> >> or upload it and share the URL.
> >>
> >> With all this and your verbs, I should be able to update the patch to
> cover
> >> your machine.
> >>
> >>
> >> On 6/23/21 6:17 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> >>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >>>
> >>> --- Comment #260 from sycxyc (sycxyc@yandex.com) ---
> >>> Possibly the minimum verbs of the two speakers working in Yoga 7i
> >>>
> >>> ```
> >>>
> >>> // left speaker
> >>> 0x20 0x500 0x24
> >>> 0x20 0x400 0x41
> >>> // unmute
> >>> 0x20 0x500 0x26
> >>> 0x20 0x400 0x2
> >>> 0x20 0x400 0x0
> >>> 0x20 0x400 0x0
> >>> 0x20 0x4b0 0x20
> >>> // right speaker (I Guessed 4 times)
> >>> 0x20 0x500 0x24
> >>> 0x20 0x400 0x46
> >>> // may be necessary
> >>> 0x20 0x500 0x26
> >>> 0x20 0x400 0xc
> >>> 0x20 0x400 0x0
> >>> 0x20 0x400 0x2a
> >>> 0x20 0x4b0 0x20
> >>> // unmute
> >>> 0x20 0x500 0x26
> >>> 0x20 0x400 0x2
> >>> 0x20 0x400 0x0
> >>> 0x20 0x400 0x0
> >>> 0x20 0x4b0 0x20
> >>>
> >>> ```
> >>>
> > These verbs are based on your attachment, but the right speaker does not
> > work.
> > I tried to fix the right speaker issue by changing the following.
> > ```
> >   0x20 0x500 0x24
> > -0x20 0x400 0x42
> > +0x20 0x400 0x46
> > ```
> > Here's the Alsa-info for my machine. It may be similar to the yoga 7i.
> >
> > http://alsa-project.org/db/?f=68337a779c3297142b0afb022125fbf32f1a6c17
> >
Comment 278 Vincent Morel 2021-06-24 16:59:03 UTC
(In reply to Cameron Berkenpas from comment #274)
> (In reply to TT from comment #242)
> > (In reply to Cameron Berkenpas from comment #241)
> > > (In reply to Jenefer from comment #237)
> > > > (In reply to TT from comment #208)
> > > > > For those wanting to test it.
> > > > > - Download the verbs-working.txt provided on
> > > > > https://bugzilla.kernel.org/show_bug.cgi?id=208555#c206 .
> > > > > - git clone https://github.com/ryanprescott/realtek-verb-tools
> > > > > - sudo python3 realtek-verb-tools/applyverbs.py verbs-working.txt
> > > > > - put some audio to play
> > > > 
> > > > Thank you so much! This worked somehow on my lenovo legion 7i 15IMHg05.
> > > > It's not permanent though as audio needs to be played constantly for it
> > to
> > > > last longer, otherwise it go back after few seconds. I hope that the
> fix
> > > > will be patched to the kernel after some fine-tuning as I noticed that
> > > > applying the verbs the quality of audio is not quite good compared to
> how
> > > it
> > > > was on windows. But who I am to complain, I'm just happy there is a
> > > > workaround to use keep me using linux on my machine.
> > > > 
> > > > Also it's weird that the fix worked for my laptop even though I have
> the
> > > > issue with mis-detected codecs: the specs of my laptop list ALC3306
> while
> > > > alsa reports ALC287.
> > > 
> > > 
> > > I haven't had a chance to try comparing the audio quality, but I have
> > > wondered if that might be the case... How did you compare? Was it with
> the
> > > same application? Ie, maybe FireFox/Chrome and YouTube?
> > > 
> > > Is anyone else seeing differences?
> > 
> > I've ran firefox with the same youtube video and I also felt the quality is
> > lower on Linux. I don't know how to describe the difference though.
> > It is not a significant difference for me. 
> > I am good with the current quality, but there is definitelly something to
> > improve there.
> 
> (In reply to Vincent Morel from comment #246)
> > (In reply to Cameron Berkenpas from comment #245)
> > > On 6/22/21 9:16 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > > > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> > > >
> > > >
> > > > I guess you already checked, but just be sure there is no "sound
> > > enhancement"
> > > > activated under Windows... On my Lenovo, there is some sound enhancer
> > > > activated
> > > > by default in Windows.
> > > > Seems we get near to find a solution, I'll have to test on my 13S Gen2
> > all
> > > of
> > > > this (and I will report back on the ALC3306 thread).
> > > >
> > > I didn't know about the enhanced sound. Is that controlled in Lenovo 
> > > Vantage?
> > 
> > Yes it's there in Lenovo Vantage (surround stuff, or enhancement, or I
> can't
> > remember the name).
> > I always remove those stuff, whatever they call it, because I prefer
> > "natural" sound...
> 
> Vincent Morel,
> 
> I don't have a natural setting in my Vantage... But I do have a setting to
> enable/disable Dolby sound. Disabling it causes the sound under Windows to
> sound like it does in Linux. Being able to switch back and forth on the fly
> with the Dolby switch in Vantage under Windows instead of waiting for
> reboots... The difference is more stark
> 
> However, I think I can live with it.
> 
> Especially since it looks like there's really nothing more to be done from
> my side at least:
> https://askubuntu.com/questions/984109/dolby-equivalent-for-ubuntu
> 
> (although that link has something of a work around... I'd be curious if
> anyone reported back on the results).
> 
> There are likely ways required to enable Dolby in the hardware side that
> don't involve HDA verbs or there's a proprietary software component.
> Probably both.
> 
> The "good" news for me is that this is one less thing I have to worry about
> I guess.
> 
> Lastly, we probably have some different sound options because we're on
> different models of laptop. Under Dolby, I have various settings that
> include gaming, movies, and so on. Maybe "Natural" falls under one of the
> your sub settings or you have something else entirely. *shrug*
> 
> You have a 13S Gen 2, right? Could you provide your alsa-info? I haven't
> seen one posted for you, but there's a lot of noise (and I've just started
> keeping track for reference).
> 
> Thanks!

Sorry I did not saw this message. I posted my Alsa info in the bug report I created for ALC3306, but here it is!
http://alsa-project.org/db/?f=1f3e847b60bd38085e39e26d992ea8680dd90869
Comment 279 woody64 2021-06-24 17:09:51 UTC
(In reply to Cameron Berkenpas from comment #276)
> You need to pull the kernel source, know how to apply the patch, how to 
> configure the kernel, know how to build your kernel, and then to install 
> it. If you're new to Linux, this may not be for you.
> 
> I'm *really* hesitant to provide some random kernel packages. From a 
> security point of view, I would strongly recommend against installing 
> packages (especially kernel packages) from some random person's web server.
> 
> Hopefully someone following this bug has the time and know-how to setup 
> a proper PPA for kernel packages with this patch for *buntu. It would 
> help a lot of people, and it'd be nice to have some more feedback too.
> 

At least I was able to backport and test the patch to 5.8.0-59-lowlatency.
And it works.

So far I was not able to use the small version from sycxyc inside the patch. There it has no effect?
But applying from outside via verb results in running both side speakers.
Comment 280 Cameron Berkenpas 2021-06-24 18:07:16 UTC
> At least I was able to backport and test the patch to 5.8.0-59-lowlatency.
> And it works.
>
> So far I was not able to use the small version from sycxyc inside the patch.
> There it has no effect?
> But applying from outside via verb results in running both side speakers.
>
I tried sycxyc's stuff yesterday, but wasn't able to get it to work. I 
haven't tried the updated verbs from this morning yet.

The kernel patch only works for one speaker though, correct?
Comment 281 woody64 2021-06-24 20:53:54 UTC
(In reply to sycxyc from comment #277)
> Yes, I have all speakers enabled.
> 
> Here are more explanations of these verbs.
> 
> 
> // reset settings and inactive speakers
> 0x20 0x500 0x26
> 0x20 0x400 0x1
> 0x20 0x400 0x0
> 0x20 0x400 0x1
> 0x20 0x4b0 0x20
> 

Works for the left speaker on the Yoga.

Do you use any source or do you guess?
Comment 282 Cameron Berkenpas 2021-06-24 22:19:30 UTC
Created attachment 297597 [details]
legion-alc287-0.0.4.patch - snd-hda patch

This is _NOT_ a kernel patch. It's a patch file for snd-hda, and therefore is much easier to try.

*face palm*

I forgot this could be done. This effectively does the same thing as the kernel patch... Except without having to patch, recompile, etc the kernel.

This works for me on the 5.11.0-22-generic vendor kernel for *buntu 21.04 on my 2020 Lenovo Legion. Here's how to utilize it:

1. Download the "legion-alc287-0.0.4.patch" from this bug.

2. Copy it to /lib/firmware/legion-alc287-0.0.4.patch

3. Create/open "/etc/modprobe.d/lenovo-fix.conf" in your favorite text editor. Ie, "sudo nano -w /etc/modprobe.d/lenovo-fix.conf"

4. Set the contents of "/etc/modprobe.d/lenovo-fix.conf" to be following then save and exit:
# Patch file to enable output on speakers.
options snd-hda-intel patch=legion-alc287-0.0.4.patch

5. Reboot

6. Test your sound and report back here with your results.

This patch file should work as well as applying verbs-working.txt or using the kernel patch (provided your model is supported by the patch).

Some more info on snd-hda patch files can be found here for those wanting to experiment:
https://www.kernel.org/doc/html/latest/sound/hd-audio/notes.html
Comment 283 Cameron Berkenpas 2021-06-24 22:25:06 UTC
Forgot to add... If you need to disable this patch, you can simply delete /etc/modprobe.d/lenovo-fix.conf.
Comment 284 woody64 2021-06-25 05:07:05 UTC
(In reply to Cameron Berkenpas from comment #283)
> Forgot to add... If you need to disable this patch, you can simply delete
> /etc/modprobe.d/lenovo-fix.conf.

Do you see any hint in dmesg that the patching is applied?
I have tried it for the Yoga but with no effect (exchanged the deviceid). I see in alsa-info that the hda-intel module is started with patch=... but no further info.
Comment 285 Alex 2021-06-25 08:17:01 UTC
No success here on a Legion 7 2021 (16ACHg6) with either the patch or full verbs list (although the speakers did make a tiny sound when rebooting the machine this time).

Is there anything I can do to figure out which verbs are needed? Perhaps it's something to do with ALC3306 vs. ALC287?

I really appreciate all the work you're doing here Cameron!
Comment 286 Jenefer 2021-06-25 09:48:44 UTC
(In reply to Alex from comment #285)
> No success here on a Legion 7 2021 (16ACHg6) with either the patch or full
> verbs list (although the speakers did make a tiny sound when rebooting the
> machine this time).
> 
> Is there anything I can do to figure out which verbs are needed? Perhaps
> it's something to do with ALC3306 vs. ALC287?
> 
> I really appreciate all the work you're doing here Cameron!

I have a Lenovo legion 7i 2020 and the verbs work for me. The ALC3306 vs. ALC287 should not be an issue: My laptop is listed to have ALC3306 in Lenovo Specs page but Alsa reports it as ALC287. Regardless I have sound now using the fix.
Comment 287 sycxyc 2021-06-25 12:47:10 UTC
(In reply to woody64 from comment #281)
> (In reply to sycxyc from comment #277)
> > Yes, I have all speakers enabled.
> > 
> > Here are more explanations of these verbs.
> > 
> > 
> > // reset settings and inactive speakers
> > 0x20 0x500 0x26
> > 0x20 0x400 0x1
> > 0x20 0x400 0x0
> > 0x20 0x400 0x1
> > 0x20 0x4b0 0x20
> > 
> 
> Works for the left speaker on the Yoga.
> 
> Do you use any source or do you guess?

That's my guess.

The main part of the sequence has been commented.

https://pastebin.com/F3Tzd0Rj
Comment 288 Cameron Berkenpas 2021-06-25 13:37:21 UTC
Hello,

Which fix is working for you?

On 6/25/21 2:48 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #286 from Jenefer (jenefer.marker@protonmail.com) ---
> (In reply to Alex from comment #285)
>> No success here on a Legion 7 2021 (16ACHg6) with either the patch or full
>> verbs list (although the speakers did make a tiny sound when rebooting the
>> machine this time).
>>
>> Is there anything I can do to figure out which verbs are needed? Perhaps
>> it's something to do with ALC3306 vs. ALC287?
>>
>> I really appreciate all the work you're doing here Cameron!
> I have a Lenovo legion 7i 2020 and the verbs work for me. The ALC3306 vs.
> ALC287 should not be an issue: My laptop is listed to have ALC3306 in Lenovo
> Specs page but Alsa reports it as ALC287. Regardless I have sound now using
> the
> fix.
>
Comment 289 Cameron Berkenpas 2021-06-25 14:00:21 UTC
On 6/25/21 1:17 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #285 from Alex (alex@avsmith.net) ---
> No success here on a Legion 7 2021 (16ACHg6) with either the patch or full
> verbs list (although the speakers did make a tiny sound when rebooting the
> machine this time).
>
> Is there anything I can do to figure out which verbs are needed? Perhaps it's
> something to do with ALC3306 vs. ALC287?
When applying the verbs while playing sound, do you hear anything? Maybe 
a very short blip of noise?

So far it sounds like the issue is that the 16ACHg6 requires a different 
list of verbs. However, since you said you've heard noise during start 
up, there might be some slight initialization overlap).

 From my research, it sounds like the 16ACHg6 is the Thai (or perhaps 
South East Asian) version of the 16ACH6. If I end up with a 16ACH6 once 
they come out, I'd be able to (hopefully) figure what verbs are needed 
there myself.

>
> I really appreciate all the work you're doing here Cameron!
>
Thank you!
Comment 290 Vincent Morel 2021-06-25 14:38:41 UTC
Hello, just tried to apply the patch to my 13s Gen2 ITL (ALC3306) and no change despite the fact alsa-info tell me the patch is applied... :(
I should probably try to dump the hda-verb from windows with the small utility I cannot find again (have to search a little)...
Comment 291 Cameron Berkenpas 2021-06-25 14:42:00 UTC
The snd-hda patch just applies the same verbs as the kernel patch. If 
the kernel works, but this does not, then the snd-hda patch has problems 
with non-Legion machines, and you would be the 2nd non-Legion user the 
snd-hda patch does not work for so far.

But then, I don't know if the kernel patch or these verbs work for the 
13s Gen2 ITL at all yet so youre problem is that we don't yet know of a 
sequence compatible with your model yet.

On 6/25/21 7:38 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #290 from Vincent Morel (dantahoua@gmail.com) ---
> Hello, just tried to apply the patch to my 13s Gen2 ITL (ALC3306) and no
> change
> despite the fact alsa-info tell me the patch is applied... :(
> I should probably try to dump the hda-verb from windows with the small
> utility
> I cannot find again (have to search a little)...
>
Comment 292 Cameron Berkenpas 2021-06-25 15:31:44 UTC
Created attachment 297615 [details]
verbs-14itl5_14cITL.txt

These verbs work for the 14itl5 and most likely the 14cITL as well.

Thank you sycxyc for finding all of the compatible verb sequences! How did you do this?! Especially so quickly?

Thank you Woody64 for giving me the precise sequence needed for these models!

_FANTASTIC_ work, guys!
Comment 293 Cameron Berkenpas 2021-06-25 16:23:02 UTC
Created attachment 297617 [details]
linux-5.12-legion-sound-0.0.5.patch - updated verbs

This updated kernel patch for the 5.12.x series includes the updated versions. You should now see full functionality (including both speakers) working on both the 2020 Legion and the Yoga 7.

Regardless of your model, please report back on your experience. Does it work the same as before? Better? Worse?

Also please test with plugging and unplugging your headset multiple times both with and without sound playing and let me know if there are any issues/regressions there.
Comment 294 Cameron Berkenpas 2021-06-25 16:47:01 UTC
Created attachment 297619 [details]
legion-alc287-0.0.5.patch - snd-hda-intel patch

This is another snd-hda-intel patch. _NOT_ a kernel patch.

This works for the Legion. It may work for the Yoga 7 with output from only one speaker. I'll upload a separate snd-hda-intel patch for the Yoga 7.

I've streamlined the instructions slightly:

1. Download the "legion-alc287-0.0.5.patch" from this bug.

2. Copy it to /lib/firmware/legion-alc287.patch. Ie, "sudo cp legion-alc287-0.0.5.patch /lib/firmware/legion-alc287.patch"

3. Create/open "/etc/modprobe.d/lenovo-fix.conf" in your favorite text editor. Ie, "sudo nano -w /etc/modprobe.d/lenovo-fix.conf"

4. Set the contents of "/etc/modprobe.d/lenovo-fix.conf" to be following then save and exit:
# Patch file to enable output on speakers.
options snd-hda-intel patch=legion-alc287.patch

5. Reboot

6. Test your sound and report back here with your results.

NOTE: To disable the patch, remove /etc/modprobe.d/lenovo-fix.conf and reboot.

This patch file should work as well as applying verbs-legion.txt or using the kernel patch (provided your model is supported by the patch).

Some more info on snd-hda patch files can be found here for those wanting to experiment:
https://www.kernel.org/doc/html/latest/sound/hd-audio/notes.html
Comment 295 sycxyc 2021-06-25 16:50:24 UTC
(In reply to Cameron Berkenpas from comment #292)
> Created attachment 297615 [details]
> verbs-14itl5_14cITL.txt
> 
> These verbs work for the 14itl5 and most likely the 14cITL as well.
> 
> Thank you sycxyc for finding all of the compatible verb sequences! How did
> you do this?! Especially so quickly?
> 

I found that enabling auto-mute mode from alsamixer and then disabling it makes the speaker inactive. Using the debug mode of applyverbs.py, I can quickly determine the 5 line sequence that activates the left speaker without restarting or suspending.

verbs-working.txt has two similar sections. The sequence used to activate the left speaker is at the end of the first part. It can be assumed that the later part controls the right speaker. After executing the later part, the first two lines must be executed to activate the left speaker, and it can be determined that the first two lines are used to switch speakers. I tried to modify the right speaker section and successfully activated it.

The sequence of 5 lines to activate the speaker is repeated 2 times in succession and they are probably safe for the separation point.

I modified applyverbs.py so that it skips comments and empty lines, which makes it easier to test and mark up.
Comment 296 Cameron Berkenpas 2021-06-25 16:58:25 UTC
Created attachment 297621 [details]
yoga7-alc287-0.0.5.patch - snd-hda-intel patch for Yoga 7 models

This is another snd-hda-intel patch. _NOT_ a kernel patch.

This works for the Yoga 7. AFAIK, it should cover at least both the Yoga 7 14ITL5 and the 14cITL. I think these are likely Yoga 7 models for different regions.

If yours doesn't work, please let us know what steps you took to try the patch and what specifically doesn't work.

1. Download the "yoga7-alc287-0.0.5.patch" from this bug.

2. Copy it to /lib/firmware/yoga-alc287.patch. Ie, "sudo cp yoga-alc287-0.0.5.patch /lib/firmware/yoga7-alc287.patch"

3. Create/open "/etc/modprobe.d/lenovo-fix.conf" in your favorite text editor. Ie, "sudo nano -w /etc/modprobe.d/lenovo-fix.conf"

4. Set the contents of "/etc/modprobe.d/lenovo-fix.conf" to be following then save and exit:
# Patch file to enable output on speakers.
options snd-hda-intel patch=yoga7-alc287.patch

5. Reboot

6. Test your sound (including with plugging and unplugging headphones while sound is playing) and report back here with your results.

NOTE: To disable the patch, remove /etc/modprobe.d/lenovo-fix.conf and reboot.

This patch file should work as well or better than applying verbs-yoga7.txt or as well as using the kernel patch (provided your model is supported by the patch).

Some more info on snd-hda patch files can be found here for those wanting to experiment:
https://www.kernel.org/doc/html/latest/sound/hd-audio/notes.html
Comment 297 Cameron Berkenpas 2021-06-25 17:09:20 UTC
(In reply to sycxyc from comment #295)
> (In reply to Cameron Berkenpas from comment #292)
I forgot about the debug mode of applyverbs.py.

I was thinking of making the same modifications to applyverbs.py... Can you attach your version to this bug? It might also be worth sharing your changes with the original author too.

Again, great work!
Comment 298 Thiago T 2021-06-25 19:03:05 UTC
(In reply to sycxyc from comment #295)
> (In reply to Cameron Berkenpas from comment #292)
> > Created attachment 297615 [details]
> > verbs-14itl5_14cITL.txt
> > 
> > These verbs work for the 14itl5 and most likely the 14cITL as well.
> > 
> > Thank you sycxyc for finding all of the compatible verb sequences! How did
> > you do this?! Especially so quickly?
> > 
> 
> I found that enabling auto-mute mode from alsamixer and then disabling it
> makes the speaker inactive. Using the debug mode of applyverbs.py, I can
> quickly determine the 5 line sequence that activates the left speaker
> without restarting or suspending.
> 
> verbs-working.txt has two similar sections. The sequence used to activate
> the left speaker is at the end of the first part. It can be assumed that the
> later part controls the right speaker. After executing the later part, the
> first two lines must be executed to activate the left speaker, and it can be
> determined that the first two lines are used to switch speakers. I tried to
> modify the right speaker section and successfully activated it.
> 
> The sequence of 5 lines to activate the speaker is repeated 2 times in
> succession and they are probably safe for the separation point.
> 
> I modified applyverbs.py so that it skips comments and empty lines, which
> makes it easier to test and mark up.

Very good work!
That does not look so trivial though. The verbs-working.txt has more than 500 lines and finding those 5 lines looks not so easy. The debug mode makes it easier to find when to stop but not when the sequence starts.
Y
Comment 299 Vincent Morel 2021-06-25 19:31:09 UTC
I tried to follow the information about installing Qemu (https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-from-a-Windows-sound-driver), but ran into problem and I'm not able to install the driver in windows (I have an error while starting qemu abut my soundcard address 
 -> qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no available reset mechanism.
).
So sadly I'm not able to get the hda_verb output here... :( Would love to help but for today I'm done. Maybe will have time sunday to try something else.
Is there a program I can run into a windows partition to sniff the hda? I'm almost sure I saw something but I cannot remember where...
Comment 300 Thiago T 2021-06-25 19:37:26 UTC
(In reply to Vincent Morel from comment #299)
> I tried to follow the information about installing Qemu
> (https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-
> from-a-Windows-sound-driver), but ran into problem and I'm not able to
> install the driver in windows (I have an error while starting qemu abut my
> soundcard address 
>  -> qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no available
> reset mechanism.
> ).
> So sadly I'm not able to get the hda_verb output here... :( Would love to
> help but for today I'm done. Maybe will have time sunday to try something
> else.
> Is there a program I can run into a windows partition to sniff the hda? I'm
> almost sure I saw something but I cannot remember where...

Are you referring to RtHDDump_V236 binary?
Check Comment #236.
Comment 301 Cameron Berkenpas 2021-06-25 19:46:04 UTC
Created attachment 297623 [details]
attachment-8392-0.html

Yes, it's a known issue that the sound card is non-resettable. The 
really good is is that this generally isn't a problem.

  If through your testing you start having problems, you might need to 
stop/start the VM, and in some cases, fully shut down the machine. I did 
tons of testing, and very rarely did I need to do anything more than 
restart the VM. Only twice did I need to shut off the entire laptop.

Anyway, getting Windows to use the right driver is a bit tricky, but it 
can absolutely be done. I don't have the same machine, but looking at 
your alsa-info, this should mostly work.

I don't have the URL for your laptop, but here's the Lenovo version as 
an example:
https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/legion-series/legion-7-15imhg05/81yu/81yucto1ww/mp1t35d3/downloads/driver-list/

Find the equivalent part of the Lenovo site for your model and then 
download your sound driver.

When opening the driver, choose to extract the driver (it won't hurt if 
you also install it).

Anyway, here are the instructions I posted earlier in this bug:

You need to force the device expanded above to use the RealTek driver. I was able to force it by *extracting* rather than installing the sound driver from the Lenovo site. Selecting update driver on the sound device listed under "Sound, video and game controllers", and from there I did:
"Browse my  computer for drivers"
"Let me pick from a list of available drivers on my computer"
"Have Disk"
Browse to: C:\Drivers\Audio\201211706.15485923\Realtek\Codec_8975.1\HDXLVSST.inf
Press Ok
You should see "Realtek High Definition Audio(SST)" as an option. It's the only option for me)
Next
Yes
Restart the VM when prompted

Hopefully after these steps, you'll see the "Realtek High Definition 
Audio(SST)" device in device manager as your sound card and you'll get 
sound from windows.

By getting a Win10 VM running with the JCS Qemu means you're a good 
chunk of the way done.

-Cameron

PS: I looked into RtHDDump_V236 and I don't think it's anything I needed 
for my particular case. It seems it can be used to figure out what pins 
should be connected to what. We'll see if you need any of that, but not yet.

On 6/25/21 12:31 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #299 from Vincent Morel (dantahoua@gmail.com) ---
> I tried to follow the information about installing Qemu
>
> (https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-from-a-Windows-sound-driver),
> but ran into problem and I'm not able to install the driver in windows (I
> have
> an error while starting qemu abut my soundcard address
>   -> qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no available
> reset mechanism.
> ).
> So sadly I'm not able to get the hda_verb output here... :( Would love to
> help
> but for today I'm done. Maybe will have time sunday to try something else.
> Is there a program I can run into a windows partition to sniff the hda? I'm
> almost sure I saw something but I cannot remember where...
>
Comment 302 Vincent Morel 2021-06-25 19:53:03 UTC
Created attachment 297625 [details]
attachment-12135-0.html

Yes!
I'll force the driver install. Thanks for your support. I have to go now
but sure I will try all of this. On a side note, the Qemu I compile from
the Git do not seems to start, just stuck.
The one from the Ubuntu repo starts with no problem.

Le ven. 25 juin 2021 à 15:37, <bugzilla-daemon@bugzilla.kernel.org> a
écrit :

> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #300 from TT (thiagotei@icloud.com) ---
> (In reply to Vincent Morel from comment #299)
> > I tried to follow the information about installing Qemu
> > (
> https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-
> > from-a-Windows-sound-driver), but ran into problem and I'm not able to
> > install the driver in windows (I have an error while starting qemu abut
> my
> > soundcard address
> >  -> qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no
> available
> > reset mechanism.
> > ).
> > So sadly I'm not able to get the hda_verb output here... :( Would love to
> > help but for today I'm done. Maybe will have time sunday to try something
> > else.
> > Is there a program I can run into a windows partition to sniff the hda?
> I'm
> > almost sure I saw something but I cannot remember where...
>
> Are you referring to RtHDDump_V236 binary?
> Check Comment #236.
>
> --
> You may reply to this email to add a comment.
>
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 303 Cameron Berkenpas 2021-06-25 19:57:11 UTC
What were your ./configure arguments?

Here were mine:
./configure --prefix=/opt/qemu/jcs --enable-kvm 
--enable-trace-backends=log --target-list=x86_64-softmmu

Then I would run it with this script:
#!/bin/bash

_qemu=/opt/qemu/jcs/bin/qemu-system-x86_64

sudo $_qemu -enable-kvm -hda win10.qcow2 -m 8G -smp 4 -vga std \
-device vfio-pci,host=00:1f.3,multifunction=on,x-no-mmap=true \
-trace events=/path/to/events.txt

The contents of events.txt:
-vfio_region_read
vfio_region_write

I'm not sure if the events.txt is needed for JCS Qemu, but they don't 
hurt. :)

Does it always hang? I did notice this version of qemu would often hang 
during OS startup (less than 50% of the time though). Glad to know it 
wasn't just me. :)

On 6/25/21 12:53 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #302 from Vincent Morel (dantahoua@gmail.com) ---
> Yes!
> I'll force the driver install. Thanks for your support. I have to go now
> but sure I will try all of this. On a side note, the Qemu I compile from
> the Git do not seems to start, just stuck.
> The one from the Ubuntu repo starts with no problem.
>
> Le ven. 25 juin 2021 à 15:37, <bugzilla-daemon@bugzilla.kernel.org> a
> écrit :
>
>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>
>> --- Comment #300 from TT (thiagotei@icloud.com) ---
>> (In reply to Vincent Morel from comment #299)
>>> I tried to follow the information about installing Qemu
>>> (
>> https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-
>>> from-a-Windows-sound-driver), but ran into problem and I'm not able to
>>> install the driver in windows (I have an error while starting qemu abut
>> my
>>> soundcard address
>>>   -> qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no
>> available
>>> reset mechanism.
>>> ).
>>> So sadly I'm not able to get the hda_verb output here... :( Would love to
>>> help but for today I'm done. Maybe will have time sunday to try something
>>> else.
>>> Is there a program I can run into a windows partition to sniff the hda?
>> I'm
>>> almost sure I saw something but I cannot remember where...
>> Are you referring to RtHDDump_V236 binary?
>> Check Comment #236.
>>
>> --
>> You may reply to this email to add a comment.
>>
>> You are receiving this mail because:
>> You are on the CC list for the bug.
Comment 304 Pablitar 2021-06-25 23:52:33 UTC
Hey!

I've tested some of these fixes on my Lenovo 16ACHg6 and had no luck.

What I've tested:
- Using the applyverbs.py with verbs-working.txt
- Applying the legion-alc287-0.0.4.patch as per instructions
- Applying the legion-alc287-0.0.5.patch as per instructions

Something that may be important is that this new model is running an AMD processor and the sound controller appears as:

'Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller'

On Alsa Mixer, it says the "Chip" is ALC287 but the "Card" is HD-Audio Generic.

Is that important? I'm bringing this up because the instructions say:

# Patch file to enable output on speakers.
options snd-hda-intel patch=legion-alc287-0.0.4.patch

And the intel part there may be something to change?

But honestly I'm clueless so this may be waaay off.

Thanks in advance!
Comment 305 Cameron Berkenpas 2021-06-25 23:55:08 UTC
You're not the first person to report that these fixes don't work for 
the 2021 Legion.

Can you post your alsa-info?

I'd like to order one as soon as they become available here in the USA, 
but I'm unsure what the availability will be. If I managed to snag one, 
I'll work on getting sound working there too.

On 6/25/21 4:52 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> Pablitar (pablitar@gmail.com) changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |pablitar@gmail.com
>
> --- Comment #304 from Pablitar (pablitar@gmail.com) ---
> Hey!
>
> I've tested some of these fixes on my Lenovo 16ACHg6 and had no luck.
>
> What I've tested:
> - Using the applyverbs.py with verbs-working.txt
> - Applying the legion-alc287-0.0.4.patch as per instructions
> - Applying the legion-alc287-0.0.5.patch as per instructions
>
> Something that may be important is that this new model is running an AMD
> processor and the sound controller appears as:
>
> 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh)
> HD Audio Controller'
>
> On Alsa Mixer, it says the "Chip" is ALC287 but the "Card" is HD-Audio
> Generic.
>
> Is that important? I'm bringing this up because the instructions say:
>
> # Patch file to enable output on speakers.
> options snd-hda-intel patch=legion-alc287-0.0.4.patch
>
> And the intel part there may be something to change?
>
> But honestly I'm clueless so this may be waaay off.
>
> Thanks in advance!
>
Comment 306 Pablitar 2021-06-26 00:04:33 UTC
Created attachment 297629 [details]
lenovo-16ACHg6-alsa-info

Sure, here is my alsa-info. I hope it helps!
Comment 307 Pablitar 2021-06-26 00:06:09 UTC
And thank you so much for what you are doing Cameron!

(In reply to Cameron Berkenpas from comment #305)
> You're not the first person to report that these fixes don't work for 
> the 2021 Legion.
> 
> Can you post your alsa-info?
> 
> I'd like to order one as soon as they become available here in the USA, 
> but I'm unsure what the availability will be. If I managed to snag one, 
> I'll work on getting sound working there too.
> 
> On 6/25/21 4:52 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > Pablitar (pablitar@gmail.com) changed:
> >
> >             What    |Removed                     |Added
> >
> ----------------------------------------------------------------------------
> >                   CC|                            |pablitar@gmail.com
> >
> > --- Comment #304 from Pablitar (pablitar@gmail.com) ---
> > Hey!
> >
> > I've tested some of these fixes on my Lenovo 16ACHg6 and had no luck.
> >
> > What I've tested:
> > - Using the applyverbs.py with verbs-working.txt
> > - Applying the legion-alc287-0.0.4.patch as per instructions
> > - Applying the legion-alc287-0.0.5.patch as per instructions
> >
> > Something that may be important is that this new model is running an AMD
> > processor and the sound controller appears as:
> >
> > 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models
> 10h-1fh)
> > HD Audio Controller'
> >
> > On Alsa Mixer, it says the "Chip" is ALC287 but the "Card" is HD-Audio
> > Generic.
> >
> > Is that important? I'm bringing this up because the instructions say:
> >
> > # Patch file to enable output on speakers.
> > options snd-hda-intel patch=legion-alc287-0.0.4.patch
> >
> > And the intel part there may be something to change?
> >
> > But honestly I'm clueless so this may be waaay off.
> >
> > Thanks in advance!
> >
Comment 308 Dre 2021-06-26 00:55:41 UTC
(In reply to Cameron Berkenpas from comment #296)
> Created attachment 297621 [details]
> yoga7-alc287-0.0.5.patch - snd-hda-intel patch for Yoga 7 models
> 
> This is another snd-hda-intel patch. _NOT_ a kernel patch.
> 
> This works for the Yoga 7. AFAIK, it should cover at least both the Yoga 7
> 14ITL5 and the 14cITL. I think these are likely Yoga 7 models for different
> regions.
> 
> If yours doesn't work, please let us know what steps you took to try the
> patch and what specifically doesn't work.
> 
> 1. Download the "yoga7-alc287-0.0.5.patch" from this bug.
> 
> 2. Copy it to /lib/firmware/yoga-alc287.patch. Ie, "sudo cp
> yoga-alc287-0.0.5.patch /lib/firmware/yoga7-alc287.patch"
> 
> 3. Create/open "/etc/modprobe.d/lenovo-fix.conf" in your favorite text
> editor. Ie, "sudo nano -w /etc/modprobe.d/lenovo-fix.conf"
> 
> 4. Set the contents of "/etc/modprobe.d/lenovo-fix.conf" to be following
> then save and exit:
> # Patch file to enable output on speakers.
> options snd-hda-intel patch=yoga7-alc287.patch
> 
> 5. Reboot
> 
> 6. Test your sound (including with plugging and unplugging headphones while
> sound is playing) and report back here with your results.
> 
> NOTE: To disable the patch, remove /etc/modprobe.d/lenovo-fix.conf and
> reboot.
> 
> This patch file should work as well or better than applying verbs-yoga7.txt
> or as well as using the kernel patch (provided your model is supported by
> the patch).
> 
> Some more info on snd-hda patch files can be found here for those wanting to
> experiment:
> https://www.kernel.org/doc/html/latest/sound/hd-audio/notes.html

I performed the above steps on a Yoga 7 14ITL5 (reporting "Realtek ALC287" from alsa-info) running Elementary OS 6 beta (Ubuntu 20.04 LTS) with kernel 5.8.0-55.  It did not work.  Only speakers do not work.  All other audio (headphones, HDMI, bluetooth) works.
Comment 309 Cameron Berkenpas 2021-06-26 01:06:26 UTC
Woody is reporting the same thing also with 5.8.0. Either The 
snd-hda-intel patches are no good for the Yoga 7 and/or 5.8.0 may not be 
recent enough for some reason.

Woody did say that the kernel patches do work , fortunately.

Is the yoga7-alc287-0.0.5.patch working on anyone's Yoga 7?

On 6/25/21 5:55 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #308 from Dre (dreman_74@hotmail.com) ---
> (In reply to Cameron Berkenpas from comment #296)
>> Created attachment 297621 [details]
>> yoga7-alc287-0.0.5.patch - snd-hda-intel patch for Yoga 7 models
>>
>> This is another snd-hda-intel patch. _NOT_ a kernel patch.
>>
>> This works for the Yoga 7. AFAIK, it should cover at least both the Yoga 7
>> 14ITL5 and the 14cITL. I think these are likely Yoga 7 models for different
>> regions.
>>
>> If yours doesn't work, please let us know what steps you took to try the
>> patch and what specifically doesn't work.
>>
>> 1. Download the "yoga7-alc287-0.0.5.patch" from this bug.
>>
>> 2. Copy it to /lib/firmware/yoga-alc287.patch. Ie, "sudo cp
>> yoga-alc287-0.0.5.patch /lib/firmware/yoga7-alc287.patch"
>>
>> 3. Create/open "/etc/modprobe.d/lenovo-fix.conf" in your favorite text
>> editor. Ie, "sudo nano -w /etc/modprobe.d/lenovo-fix.conf"
>>
>> 4. Set the contents of "/etc/modprobe.d/lenovo-fix.conf" to be following
>> then save and exit:
>> # Patch file to enable output on speakers.
>> options snd-hda-intel patch=yoga7-alc287.patch
>>
>> 5. Reboot
>>
>> 6. Test your sound (including with plugging and unplugging headphones while
>> sound is playing) and report back here with your results.
>>
>> NOTE: To disable the patch, remove /etc/modprobe.d/lenovo-fix.conf and
>> reboot.
>>
>> This patch file should work as well or better than applying verbs-yoga7.txt
>> or as well as using the kernel patch (provided your model is supported by
>> the patch).
>>
>> Some more info on snd-hda patch files can be found here for those wanting to
>> experiment:
>> https://www.kernel.org/doc/html/latest/sound/hd-audio/notes.html
> I performed the above steps on a Yoga 7 14ITL5 (reporting "Realtek ALC287"
> from
> alsa-info) running Elementary OS 6 beta (Ubuntu 20.04 LTS) with kernel
> 5.8.0-55.  It did not work.  Only speakers do not work.  All other audio
> (headphones, HDMI, bluetooth) works.
>
Comment 310 Cameron Berkenpas 2021-06-26 01:24:31 UTC
You're welcome. I understand the frustration!

Can you or anyone else with a Legion 7 16ACHg6 check if your CPU has 
IOMMU support? I'm not able to find an answer to this one way or 
another. If so, likely the same trick can be used to find the codec 
initialization verb sequence.


On 6/25/21 5:06 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #307 from Pablitar (pablitar@gmail.com) ---
> And thank you so much for what you are doing Cameron!
>
> (In reply to Cameron Berkenpas from comment #305)
>> You're not the first person to report that these fixes don't work for
>> the 2021 Legion.
>>
>> Can you post your alsa-info?
>>
>> I'd like to order one as soon as they become available here in the USA,
>> but I'm unsure what the availability will be. If I managed to snag one,
>> I'll work on getting sound working there too.
>>
>> On 6/25/21 4:52 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>
>>> Pablitar (pablitar@gmail.com) changed:
>>>
>>>              What    |Removed                     |Added
>>>
>> ----------------------------------------------------------------------------
>>>                    CC|                            |pablitar@gmail.com
>>>
>>> --- Comment #304 from Pablitar (pablitar@gmail.com) ---
>>> Hey!
>>>
>>> I've tested some of these fixes on my Lenovo 16ACHg6 and had no luck.
>>>
>>> What I've tested:
>>> - Using the applyverbs.py with verbs-working.txt
>>> - Applying the legion-alc287-0.0.4.patch as per instructions
>>> - Applying the legion-alc287-0.0.5.patch as per instructions
>>>
>>> Something that may be important is that this new model is running an AMD
>>> processor and the sound controller appears as:
>>>
>>> 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>> 10h-1fh)
>>> HD Audio Controller'
>>>
>>> On Alsa Mixer, it says the "Chip" is ALC287 but the "Card" is HD-Audio
>>> Generic.
>>>
>>> Is that important? I'm bringing this up because the instructions say:
>>>
>>> # Patch file to enable output on speakers.
>>> options snd-hda-intel patch=legion-alc287-0.0.4.patch
>>>
>>> And the intel part there may be something to change?
>>>
>>> But honestly I'm clueless so this may be waaay off.
>>>
>>> Thanks in advance!
>>>
Comment 311 sycxyc 2021-06-26 01:44:01 UTC
(In reply to Cameron Berkenpas from comment #297)
> (In reply to sycxyc from comment #295)
> > (In reply to Cameron Berkenpas from comment #292)
> I forgot about the debug mode of applyverbs.py.
> 
> I was thinking of making the same modifications to applyverbs.py... Can you
> attach your version to this bug? It might also be worth sharing your changes
> with the original author too.
> 
> Again, great work!

diff --git a/applyverbs.py b/applyverbs.py
index 5296d8d..a372736 100755
--- a/applyverbs.py
+++ b/applyverbs.py
@@ -4,6 +4,8 @@ import sys
 import time
 def validate(verbstring):
     try:
+        if verbstring[:1] in '#/;':
+            return False
         verbsegments = verbstring.split(' ')
         int(verbsegments[0], 16) and int(verbsegments[1], 16) and int(verbsegments[2], 16)
         return verbsegments
@@ -29,6 +31,8 @@ f.close()
 print('Applying verbs...')
 for i in range(0, len(verbsegments)):
     segment = verbsegments[i]
+    if not segment:
+        continue
     args = ['hda-verb', '/dev/snd/hwC0D0', *segment]
     result = subprocess.run(args, stderr=subprocess.DEVNULL, stdout=subprocess.PIPE).stdout.decode('utf-8')
     response = result[8:len(result)-1]


(In reply to TT from comment #298)
> (In reply to sycxyc from comment #295)
> 
> Very good work!
> That does not look so trivial though. The verbs-working.txt has more than
> 500 lines and finding those 5 lines looks not so easy. The debug mode makes
> it easier to find when to stop but not when the sequence starts.
> Y

It only takes 5 backtraces to find the starting line, but the line-by-line test is not safe and may result in the need for a forced reboot
Comment 312 Cameron Berkenpas 2021-06-26 02:11:27 UTC
Maybe try:

dmesg | grep -i iommu

On 6/25/2021 6:24 PM, Cameron Berkenpas wrote:
> You're welcome. I understand the frustration!
>
> Can you or anyone else with a Legion 7 16ACHg6 check if your CPU has 
> IOMMU support? I'm not able to find an answer to this one way or 
> another. If so, likely the same trick can be used to find the codec 
> initialization verb sequence.
>
>
> On 6/25/21 5:06 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>
>> --- Comment #307 from Pablitar (pablitar@gmail.com) ---
>> And thank you so much for what you are doing Cameron!
>>
>> (In reply to Cameron Berkenpas from comment #305)
>>> You're not the first person to report that these fixes don't work for
>>> the 2021 Legion.
>>>
>>> Can you post your alsa-info?
>>>
>>> I'd like to order one as soon as they become available here in the USA,
>>> but I'm unsure what the availability will be. If I managed to snag one,
>>> I'll work on getting sound working there too.
>>>
>>> On 6/25/21 4:52 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>>
>>>> Pablitar (pablitar@gmail.com) changed:
>>>>
>>>>              What    |Removed                     |Added
>>>>
>>>
>>> ---------------------------------------------------------------------------- 
>>>
>>>> CC|                            |pablitar@gmail.com
>>>>
>>>> --- Comment #304 from Pablitar (pablitar@gmail.com) ---
>>>> Hey!
>>>>
>>>> I've tested some of these fixes on my Lenovo 16ACHg6 and had no luck.
>>>>
>>>> What I've tested:
>>>> - Using the applyverbs.py with verbs-working.txt
>>>> - Applying the legion-alc287-0.0.4.patch as per instructions
>>>> - Applying the legion-alc287-0.0.5.patch as per instructions
>>>>
>>>> Something that may be important is that this new model is running 
>>>> an AMD
>>>> processor and the sound controller appears as:
>>>>
>>>> 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>>> 10h-1fh)
>>>> HD Audio Controller'
>>>>
>>>> On Alsa Mixer, it says the "Chip" is ALC287 but the "Card" is HD-Audio
>>>> Generic.
>>>>
>>>> Is that important? I'm bringing this up because the instructions say:
>>>>
>>>> # Patch file to enable output on speakers.
>>>> options snd-hda-intel patch=legion-alc287-0.0.4.patch
>>>>
>>>> And the intel part there may be something to change?
>>>>
>>>> But honestly I'm clueless so this may be waaay off.
>>>>
>>>> Thanks in advance!
>>>>
>
Comment 313 woody64 2021-06-26 02:18:49 UTC
(In reply to Cameron Berkenpas from comment #309)
> Woody is reporting the same thing also with 5.8.0. Either The 
> snd-hda-intel patches are no good for the Yoga 7 and/or 5.8.0 may not be 
> recent enough for some reason.
> 
> Woody did say that the kernel patches do work , fortunately.
> 
> Is the yoga7-alc287-0.0.5.patch working on anyone's Yoga 7?
> 

As far as I have seen, the snd-hda patch does not work on my Ubuntu (!) system. Neither for 5.11 nor for 5.8. 
My understanding is that the firmware patch does not load as expected in Ubuntu 20.04. And it is not due to the laptop model (Yoga).
Maybe Ubuntu has something in between (udev) that needs a different configuration for firmwares to make it work.

What has worked so far (minimum verbs/Cameron - but also very small version from sycxyc) : 
- the kernel patch (5.8.0-59) => pretty sure it will also work with 5.11/5.12
- The applyverbs.py (thx to sycxyc for doing the comment modification, I wanted to do that also ..)
- the S3 resume method
Comment 314 Pablitar 2021-06-26 02:45:04 UTC
Here it is:
[    0.293604] iommu: Default domain type: Translated 
[    0.487357] pci 0000:00:00.2: AMD-Vi: IOMMU performance counters supported
[    0.487484] pci 0000:00:01.0: Adding to iommu group 0
[    0.487493] pci 0000:00:01.1: Adding to iommu group 1
[    0.487500] pci 0000:00:01.2: Adding to iommu group 2
[    0.487511] pci 0000:00:02.0: Adding to iommu group 3
[    0.487518] pci 0000:00:02.1: Adding to iommu group 4
[    0.487526] pci 0000:00:02.2: Adding to iommu group 5
[    0.487538] pci 0000:00:08.0: Adding to iommu group 6
[    0.487544] pci 0000:00:08.1: Adding to iommu group 6
[    0.487550] pci 0000:00:08.2: Adding to iommu group 6
[    0.487560] pci 0000:00:14.0: Adding to iommu group 7
[    0.487566] pci 0000:00:14.3: Adding to iommu group 7
[    0.487587] pci 0000:00:18.0: Adding to iommu group 8
[    0.487593] pci 0000:00:18.1: Adding to iommu group 8
[    0.487599] pci 0000:00:18.2: Adding to iommu group 8
[    0.487606] pci 0000:00:18.3: Adding to iommu group 8
[    0.487612] pci 0000:00:18.4: Adding to iommu group 8
[    0.487618] pci 0000:00:18.5: Adding to iommu group 8
[    0.487624] pci 0000:00:18.6: Adding to iommu group 8
[    0.487629] pci 0000:00:18.7: Adding to iommu group 8
[    0.487640] pci 0000:01:00.0: Adding to iommu group 9
[    0.487648] pci 0000:01:00.1: Adding to iommu group 9
[    0.487656] pci 0000:02:00.0: Adding to iommu group 10
[    0.487664] pci 0000:03:00.0: Adding to iommu group 11
[    0.487671] pci 0000:04:00.0: Adding to iommu group 12
[    0.487685] pci 0000:05:00.0: Adding to iommu group 6
[    0.487688] pci 0000:05:00.2: Adding to iommu group 6
[    0.487693] pci 0000:05:00.3: Adding to iommu group 6
[    0.487696] pci 0000:05:00.4: Adding to iommu group 6
[    0.487700] pci 0000:05:00.6: Adding to iommu group 6
[    0.487703] pci 0000:06:00.0: Adding to iommu group 6
[    0.487707] pci 0000:06:00.1: Adding to iommu group 6
[    0.489073] pci 0000:00:00.2: AMD-Vi: Found IOMMU cap 0x40
[    0.490935] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4 counters/bank).
[    0.535396] AMD-Vi: AMD IOMMUv2 driver by Joerg Roedel <jroedel@suse.de>

Seems it is supported?

(In reply to Cameron Berkenpas from comment #312)
> Maybe try:
> 
> dmesg | grep -i iommu
> 
> On 6/25/2021 6:24 PM, Cameron Berkenpas wrote:
> > You're welcome. I understand the frustration!
> >
> > Can you or anyone else with a Legion 7 16ACHg6 check if your CPU has 
> > IOMMU support? I'm not able to find an answer to this one way or 
> > another. If so, likely the same trick can be used to find the codec 
> > initialization verb sequence.
> >
> >
> > On 6/25/21 5:06 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> >> https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >>
> >> --- Comment #307 from Pablitar (pablitar@gmail.com) ---
> >> And thank you so much for what you are doing Cameron!
> >>
> >> (In reply to Cameron Berkenpas from comment #305)
> >>> You're not the first person to report that these fixes don't work for
> >>> the 2021 Legion.
> >>>
> >>> Can you post your alsa-info?
> >>>
> >>> I'd like to order one as soon as they become available here in the USA,
> >>> but I'm unsure what the availability will be. If I managed to snag one,
> >>> I'll work on getting sound working there too.
> >>>
> >>> On 6/25/21 4:52 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> >>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >>>>
> >>>> Pablitar (pablitar@gmail.com) changed:
> >>>>
> >>>>              What    |Removed                     |Added
> >>>>
> >>>
> >>>
> ---------------------------------------------------------------------------- 
> >>>
> >>>> CC|                            |pablitar@gmail.com
> >>>>
> >>>> --- Comment #304 from Pablitar (pablitar@gmail.com) ---
> >>>> Hey!
> >>>>
> >>>> I've tested some of these fixes on my Lenovo 16ACHg6 and had no luck.
> >>>>
> >>>> What I've tested:
> >>>> - Using the applyverbs.py with verbs-working.txt
> >>>> - Applying the legion-alc287-0.0.4.patch as per instructions
> >>>> - Applying the legion-alc287-0.0.5.patch as per instructions
> >>>>
> >>>> Something that may be important is that this new model is running 
> >>>> an AMD
> >>>> processor and the sound controller appears as:
> >>>>
> >>>> 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models
> >>> 10h-1fh)
> >>>> HD Audio Controller'
> >>>>
> >>>> On Alsa Mixer, it says the "Chip" is ALC287 but the "Card" is HD-Audio
> >>>> Generic.
> >>>>
> >>>> Is that important? I'm bringing this up because the instructions say:
> >>>>
> >>>> # Patch file to enable output on speakers.
> >>>> options snd-hda-intel patch=legion-alc287-0.0.4.patch
> >>>>
> >>>> And the intel part there may be something to change?
> >>>>
> >>>> But honestly I'm clueless so this may be waaay off.
> >>>>
> >>>> Thanks in advance!
> >>>>
> >
Comment 315 Cameron Berkenpas 2021-06-26 02:55:55 UTC
That is a resounding yes! Unsurprisingly for AMD, PCI passthrough is 
available.

Is there anyone with a Legion 7 16ACHg6 who's up to setting up pci 
passthrough for their sound card and compiling JCS's Qemu all to run a 
Windows 10 VM? Someone can either try to do that for themselves or wait 
for me and hope there's sufficient availability.

On 6/25/2021 7:45 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #314 from Pablitar (pablitar@gmail.com) ---
> Here it is:
> [    0.293604] iommu: Default domain type: Translated
> [    0.487357] pci 0000:00:00.2: AMD-Vi: IOMMU performance counters supported
> [    0.487484] pci 0000:00:01.0: Adding to iommu group 0
> [    0.487493] pci 0000:00:01.1: Adding to iommu group 1
> [    0.487500] pci 0000:00:01.2: Adding to iommu group 2
> [    0.487511] pci 0000:00:02.0: Adding to iommu group 3
> [    0.487518] pci 0000:00:02.1: Adding to iommu group 4
> [    0.487526] pci 0000:00:02.2: Adding to iommu group 5
> [    0.487538] pci 0000:00:08.0: Adding to iommu group 6
> [    0.487544] pci 0000:00:08.1: Adding to iommu group 6
> [    0.487550] pci 0000:00:08.2: Adding to iommu group 6
> [    0.487560] pci 0000:00:14.0: Adding to iommu group 7
> [    0.487566] pci 0000:00:14.3: Adding to iommu group 7
> [    0.487587] pci 0000:00:18.0: Adding to iommu group 8
> [    0.487593] pci 0000:00:18.1: Adding to iommu group 8
> [    0.487599] pci 0000:00:18.2: Adding to iommu group 8
> [    0.487606] pci 0000:00:18.3: Adding to iommu group 8
> [    0.487612] pci 0000:00:18.4: Adding to iommu group 8
> [    0.487618] pci 0000:00:18.5: Adding to iommu group 8
> [    0.487624] pci 0000:00:18.6: Adding to iommu group 8
> [    0.487629] pci 0000:00:18.7: Adding to iommu group 8
> [    0.487640] pci 0000:01:00.0: Adding to iommu group 9
> [    0.487648] pci 0000:01:00.1: Adding to iommu group 9
> [    0.487656] pci 0000:02:00.0: Adding to iommu group 10
> [    0.487664] pci 0000:03:00.0: Adding to iommu group 11
> [    0.487671] pci 0000:04:00.0: Adding to iommu group 12
> [    0.487685] pci 0000:05:00.0: Adding to iommu group 6
> [    0.487688] pci 0000:05:00.2: Adding to iommu group 6
> [    0.487693] pci 0000:05:00.3: Adding to iommu group 6
> [    0.487696] pci 0000:05:00.4: Adding to iommu group 6
> [    0.487700] pci 0000:05:00.6: Adding to iommu group 6
> [    0.487703] pci 0000:06:00.0: Adding to iommu group 6
> [    0.487707] pci 0000:06:00.1: Adding to iommu group 6
> [    0.489073] pci 0000:00:00.2: AMD-Vi: Found IOMMU cap 0x40
> [    0.490935] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4
> counters/bank).
> [    0.535396] AMD-Vi: AMD IOMMUv2 driver by Joerg Roedel <jroedel@suse.de>
>
> Seems it is supported?
>
> (In reply to Cameron Berkenpas from comment #312)
>> Maybe try:
>>
>> dmesg | grep -i iommu
>>
>> On 6/25/2021 6:24 PM, Cameron Berkenpas wrote:
>>> You're welcome. I understand the frustration!
>>>
>>> Can you or anyone else with a Legion 7 16ACHg6 check if your CPU has
>>> IOMMU support? I'm not able to find an answer to this one way or
>>> another. If so, likely the same trick can be used to find the codec
>>> initialization verb sequence.
>>>
>>>
>>> On 6/25/21 5:06 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>>
>>>> --- Comment #307 from Pablitar (pablitar@gmail.com) ---
>>>> And thank you so much for what you are doing Cameron!
>>>>
>>>> (In reply to Cameron Berkenpas from comment #305)
>>>>> You're not the first person to report that these fixes don't work for
>>>>> the 2021 Legion.
>>>>>
>>>>> Can you post your alsa-info?
>>>>>
>>>>> I'd like to order one as soon as they become available here in the USA,
>>>>> but I'm unsure what the availability will be. If I managed to snag one,
>>>>> I'll work on getting sound working there too.
>>>>>
>>>>> On 6/25/21 4:52 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>>>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>>>>
>>>>>> Pablitar (pablitar@gmail.com) changed:
>>>>>>
>>>>>>               What    |Removed                     |Added
>>>>>>
>>>>>
>> ----------------------------------------------------------------------------
>>>>>> CC|                            |pablitar@gmail.com
>>>>>>
>>>>>> --- Comment #304 from Pablitar (pablitar@gmail.com) ---
>>>>>> Hey!
>>>>>>
>>>>>> I've tested some of these fixes on my Lenovo 16ACHg6 and had no luck.
>>>>>>
>>>>>> What I've tested:
>>>>>> - Using the applyverbs.py with verbs-working.txt
>>>>>> - Applying the legion-alc287-0.0.4.patch as per instructions
>>>>>> - Applying the legion-alc287-0.0.5.patch as per instructions
>>>>>>
>>>>>> Something that may be important is that this new model is running
>>>>>> an AMD
>>>>>> processor and the sound controller appears as:
>>>>>>
>>>>>> 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>>>>> 10h-1fh)
>>>>>> HD Audio Controller'
>>>>>>
>>>>>> On Alsa Mixer, it says the "Chip" is ALC287 but the "Card" is HD-Audio
>>>>>> Generic.
>>>>>>
>>>>>> Is that important? I'm bringing this up because the instructions say:
>>>>>>
>>>>>> # Patch file to enable output on speakers.
>>>>>> options snd-hda-intel patch=legion-alc287-0.0.4.patch
>>>>>>
>>>>>> And the intel part there may be something to change?
>>>>>>
>>>>>> But honestly I'm clueless so this may be waaay off.
>>>>>>
>>>>>> Thanks in advance!
>>>>>>
Comment 316 Pablitar 2021-06-26 03:04:20 UTC
I'll see if I have the time. And if I can hahaha.

Is there a clear list of instructions in this thread? I'm lost in all the messages.

I can read the thread trying to compile what to do. But if someone could point me where to look, maybe that can save me an hour or two.

(In reply to Cameron Berkenpas from comment #315)
> That is a resounding yes! Unsurprisingly for AMD, PCI passthrough is 
> available.
> 
> Is there anyone with a Legion 7 16ACHg6 who's up to setting up pci 
> passthrough for their sound card and compiling JCS's Qemu all to run a 
> Windows 10 VM? Someone can either try to do that for themselves or wait 
> for me and hope there's sufficient availability.
> 
> On 6/25/2021 7:45 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #314 from Pablitar (pablitar@gmail.com) ---
> > Here it is:
> > [    0.293604] iommu: Default domain type: Translated
> > [    0.487357] pci 0000:00:00.2: AMD-Vi: IOMMU performance counters
> supported
> > [    0.487484] pci 0000:00:01.0: Adding to iommu group 0
> > [    0.487493] pci 0000:00:01.1: Adding to iommu group 1
> > [    0.487500] pci 0000:00:01.2: Adding to iommu group 2
> > [    0.487511] pci 0000:00:02.0: Adding to iommu group 3
> > [    0.487518] pci 0000:00:02.1: Adding to iommu group 4
> > [    0.487526] pci 0000:00:02.2: Adding to iommu group 5
> > [    0.487538] pci 0000:00:08.0: Adding to iommu group 6
> > [    0.487544] pci 0000:00:08.1: Adding to iommu group 6
> > [    0.487550] pci 0000:00:08.2: Adding to iommu group 6
> > [    0.487560] pci 0000:00:14.0: Adding to iommu group 7
> > [    0.487566] pci 0000:00:14.3: Adding to iommu group 7
> > [    0.487587] pci 0000:00:18.0: Adding to iommu group 8
> > [    0.487593] pci 0000:00:18.1: Adding to iommu group 8
> > [    0.487599] pci 0000:00:18.2: Adding to iommu group 8
> > [    0.487606] pci 0000:00:18.3: Adding to iommu group 8
> > [    0.487612] pci 0000:00:18.4: Adding to iommu group 8
> > [    0.487618] pci 0000:00:18.5: Adding to iommu group 8
> > [    0.487624] pci 0000:00:18.6: Adding to iommu group 8
> > [    0.487629] pci 0000:00:18.7: Adding to iommu group 8
> > [    0.487640] pci 0000:01:00.0: Adding to iommu group 9
> > [    0.487648] pci 0000:01:00.1: Adding to iommu group 9
> > [    0.487656] pci 0000:02:00.0: Adding to iommu group 10
> > [    0.487664] pci 0000:03:00.0: Adding to iommu group 11
> > [    0.487671] pci 0000:04:00.0: Adding to iommu group 12
> > [    0.487685] pci 0000:05:00.0: Adding to iommu group 6
> > [    0.487688] pci 0000:05:00.2: Adding to iommu group 6
> > [    0.487693] pci 0000:05:00.3: Adding to iommu group 6
> > [    0.487696] pci 0000:05:00.4: Adding to iommu group 6
> > [    0.487700] pci 0000:05:00.6: Adding to iommu group 6
> > [    0.487703] pci 0000:06:00.0: Adding to iommu group 6
> > [    0.487707] pci 0000:06:00.1: Adding to iommu group 6
> > [    0.489073] pci 0000:00:00.2: AMD-Vi: Found IOMMU cap 0x40
> > [    0.490935] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4
> > counters/bank).
> > [    0.535396] AMD-Vi: AMD IOMMUv2 driver by Joerg Roedel <jroedel@suse.de>
> >
> > Seems it is supported?
> >
> > (In reply to Cameron Berkenpas from comment #312)
> >> Maybe try:
> >>
> >> dmesg | grep -i iommu
> >>
> >> On 6/25/2021 6:24 PM, Cameron Berkenpas wrote:
> >>> You're welcome. I understand the frustration!
> >>>
> >>> Can you or anyone else with a Legion 7 16ACHg6 check if your CPU has
> >>> IOMMU support? I'm not able to find an answer to this one way or
> >>> another. If so, likely the same trick can be used to find the codec
> >>> initialization verb sequence.
> >>>
> >>>
> >>> On 6/25/21 5:06 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> >>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >>>>
> >>>> --- Comment #307 from Pablitar (pablitar@gmail.com) ---
> >>>> And thank you so much for what you are doing Cameron!
> >>>>
> >>>> (In reply to Cameron Berkenpas from comment #305)
> >>>>> You're not the first person to report that these fixes don't work for
> >>>>> the 2021 Legion.
> >>>>>
> >>>>> Can you post your alsa-info?
> >>>>>
> >>>>> I'd like to order one as soon as they become available here in the USA,
> >>>>> but I'm unsure what the availability will be. If I managed to snag one,
> >>>>> I'll work on getting sound working there too.
> >>>>>
> >>>>> On 6/25/21 4:52 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> >>>>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >>>>>>
> >>>>>> Pablitar (pablitar@gmail.com) changed:
> >>>>>>
> >>>>>>               What    |Removed                     |Added
> >>>>>>
> >>>>>
> >>
> ----------------------------------------------------------------------------
> >>>>>> CC|                            |pablitar@gmail.com
> >>>>>>
> >>>>>> --- Comment #304 from Pablitar (pablitar@gmail.com) ---
> >>>>>> Hey!
> >>>>>>
> >>>>>> I've tested some of these fixes on my Lenovo 16ACHg6 and had no luck.
> >>>>>>
> >>>>>> What I've tested:
> >>>>>> - Using the applyverbs.py with verbs-working.txt
> >>>>>> - Applying the legion-alc287-0.0.4.patch as per instructions
> >>>>>> - Applying the legion-alc287-0.0.5.patch as per instructions
> >>>>>>
> >>>>>> Something that may be important is that this new model is running
> >>>>>> an AMD
> >>>>>> processor and the sound controller appears as:
> >>>>>>
> >>>>>> 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models
> >>>>> 10h-1fh)
> >>>>>> HD Audio Controller'
> >>>>>>
> >>>>>> On Alsa Mixer, it says the "Chip" is ALC287 but the "Card" is HD-Audio
> >>>>>> Generic.
> >>>>>>
> >>>>>> Is that important? I'm bringing this up because the instructions say:
> >>>>>>
> >>>>>> # Patch file to enable output on speakers.
> >>>>>> options snd-hda-intel patch=legion-alc287-0.0.4.patch
> >>>>>>
> >>>>>> And the intel part there may be something to change?
> >>>>>>
> >>>>>> But honestly I'm clueless so this may be waaay off.
> >>>>>>
> >>>>>> Thanks in advance!
> >>>>>>
Comment 317 Cameron Berkenpas 2021-06-26 03:32:02 UTC
I posted some instructions, but I've lost them in the thread too. :p

I used this document to setup the PCI passthrough:
https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF

PCIE devices are in groups, and ALL of the devices in a group must be 
setup for passthrough together. However, I found I only needed to tell 
qemu about the sound card.

On my 2020 Legion 7i, the sound card is in a group with 3 other devices. 
Fortunately, it didn't cause me any issues to set them all up for 
passthrough as none were vital to running the system. This will probably 
be the case for you, but we'll see.

The article provides a script that lists all the PCI groups and their 
associated devices that is really helpful:
https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF#Ensuring_that_the_groups_are_valid

Here's part of the output of the script showing the sound card and the 
group that it's in as well as the other devices in that group:
IOMMU Group 14:
         00:1f.0 ISA bridge [0601]: Intel Corporation Comet Lake LPC 
Controller [8086:068d]
         00:1f.3 Audio device [0403]: Intel Corporation Comet Lake PCH 
cAVS [8086:06c8]
         00:1f.4 SMBus [0c05]: Intel Corporation Comet Lake PCH SMBus 
Controller [8086:06a3]
         00:1f.5 Serial bus controller [0c80]: Intel Corporation Comet 
Lake PCH SPI Controller [8086:06a4]

Here's JCS's Qemu. JCS just made some changes that added logging to pick 
out HDA verbs.
https://github.com/jcs/qemu

You'll need to make sure you have the build dependencies for qemu.

Here's what I used for configure:
./configure --prefix=/opt/qemu/jcs --enable-kvm 
--enable-trace-backends=log --target-list=x86_64-softmmu

You can change the prefix to whatever you personally prefer of course.

 From there follow up with the usual "make && make install"

If you get this far, I can provide more guidance on where to go. Vincent 
Morel has started working on the same thing, but with an entirely 
different model of Lenovo laptop.

If you have trouble, also feel free to reach out for help.

Here's one my last posts to Vincent. It has some instructions on how I 
got the correct driver working with the passed through sound card in the 
Windows 10 vm:
https://bugzilla.kernel.org/show_bug.cgi?id=208555#c301

Of course those driver instructions are for my Intel based 2020 Legion 
7. You may have different paths and you may need to try several 
different drivers in the archive before one works. In my case, it was 
the very last driver that ended up working for me.

A heads up that I'm going to have poor availability this weekend. I'll 
be able to still to respond to emails at least, but my responses will be 
slower and less frequent.

On 6/25/21 8:04 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #316 from Pablitar (pablitar@gmail.com) ---
> I'll see if I have the time. And if I can hahaha.
>
> Is there a clear list of instructions in this thread? I'm lost in all the
> messages.
>
> I can read the thread trying to compile what to do. But if someone could
> point
> me where to look, maybe that can save me an hour or two.
>
> (In reply to Cameron Berkenpas from comment #315)
>> That is a resounding yes! Unsurprisingly for AMD, PCI passthrough is
>> available.
>>
>> Is there anyone with a Legion 7 16ACHg6 who's up to setting up pci
>> passthrough for their sound card and compiling JCS's Qemu all to run a
>> Windows 10 VM? Someone can either try to do that for themselves or wait
>> for me and hope there's sufficient availability.
>>
>> On 6/25/2021 7:45 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>
>>> --- Comment #314 from Pablitar (pablitar@gmail.com) ---
>>> Here it is:
>>> [    0.293604] iommu: Default domain type: Translated
>>> [    0.487357] pci 0000:00:00.2: AMD-Vi: IOMMU performance counters
>> supported
>>> [    0.487484] pci 0000:00:01.0: Adding to iommu group 0
>>> [    0.487493] pci 0000:00:01.1: Adding to iommu group 1
>>> [    0.487500] pci 0000:00:01.2: Adding to iommu group 2
>>> [    0.487511] pci 0000:00:02.0: Adding to iommu group 3
>>> [    0.487518] pci 0000:00:02.1: Adding to iommu group 4
>>> [    0.487526] pci 0000:00:02.2: Adding to iommu group 5
>>> [    0.487538] pci 0000:00:08.0: Adding to iommu group 6
>>> [    0.487544] pci 0000:00:08.1: Adding to iommu group 6
>>> [    0.487550] pci 0000:00:08.2: Adding to iommu group 6
>>> [    0.487560] pci 0000:00:14.0: Adding to iommu group 7
>>> [    0.487566] pci 0000:00:14.3: Adding to iommu group 7
>>> [    0.487587] pci 0000:00:18.0: Adding to iommu group 8
>>> [    0.487593] pci 0000:00:18.1: Adding to iommu group 8
>>> [    0.487599] pci 0000:00:18.2: Adding to iommu group 8
>>> [    0.487606] pci 0000:00:18.3: Adding to iommu group 8
>>> [    0.487612] pci 0000:00:18.4: Adding to iommu group 8
>>> [    0.487618] pci 0000:00:18.5: Adding to iommu group 8
>>> [    0.487624] pci 0000:00:18.6: Adding to iommu group 8
>>> [    0.487629] pci 0000:00:18.7: Adding to iommu group 8
>>> [    0.487640] pci 0000:01:00.0: Adding to iommu group 9
>>> [    0.487648] pci 0000:01:00.1: Adding to iommu group 9
>>> [    0.487656] pci 0000:02:00.0: Adding to iommu group 10
>>> [    0.487664] pci 0000:03:00.0: Adding to iommu group 11
>>> [    0.487671] pci 0000:04:00.0: Adding to iommu group 12
>>> [    0.487685] pci 0000:05:00.0: Adding to iommu group 6
>>> [    0.487688] pci 0000:05:00.2: Adding to iommu group 6
>>> [    0.487693] pci 0000:05:00.3: Adding to iommu group 6
>>> [    0.487696] pci 0000:05:00.4: Adding to iommu group 6
>>> [    0.487700] pci 0000:05:00.6: Adding to iommu group 6
>>> [    0.487703] pci 0000:06:00.0: Adding to iommu group 6
>>> [    0.487707] pci 0000:06:00.1: Adding to iommu group 6
>>> [    0.489073] pci 0000:00:00.2: AMD-Vi: Found IOMMU cap 0x40
>>> [    0.490935] perf/amd_iommu: Detected AMD IOMMU #0 (2 banks, 4
>>> counters/bank).
>>> [    0.535396] AMD-Vi: AMD IOMMUv2 driver by Joerg Roedel <jroedel@suse.de>
>>>
>>> Seems it is supported?
>>>
>>> (In reply to Cameron Berkenpas from comment #312)
>>>> Maybe try:
>>>>
>>>> dmesg | grep -i iommu
>>>>
>>>> On 6/25/2021 6:24 PM, Cameron Berkenpas wrote:
>>>>> You're welcome. I understand the frustration!
>>>>>
>>>>> Can you or anyone else with a Legion 7 16ACHg6 check if your CPU has
>>>>> IOMMU support? I'm not able to find an answer to this one way or
>>>>> another. If so, likely the same trick can be used to find the codec
>>>>> initialization verb sequence.
>>>>>
>>>>>
>>>>> On 6/25/21 5:06 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>>>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>>>>
>>>>>> --- Comment #307 from Pablitar (pablitar@gmail.com) ---
>>>>>> And thank you so much for what you are doing Cameron!
>>>>>>
>>>>>> (In reply to Cameron Berkenpas from comment #305)
>>>>>>> You're not the first person to report that these fixes don't work for
>>>>>>> the 2021 Legion.
>>>>>>>
>>>>>>> Can you post your alsa-info?
>>>>>>>
>>>>>>> I'd like to order one as soon as they become available here in the USA,
>>>>>>> but I'm unsure what the availability will be. If I managed to snag one,
>>>>>>> I'll work on getting sound working there too.
>>>>>>>
>>>>>>> On 6/25/21 4:52 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>>>>>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>>>>>>
>>>>>>>> Pablitar (pablitar@gmail.com) changed:
>>>>>>>>
>>>>>>>>                What    |Removed                     |Added
>>>>>>>>
>> ----------------------------------------------------------------------------
>>>>>>>> CC|                            |pablitar@gmail.com
>>>>>>>>
>>>>>>>> --- Comment #304 from Pablitar (pablitar@gmail.com) ---
>>>>>>>> Hey!
>>>>>>>>
>>>>>>>> I've tested some of these fixes on my Lenovo 16ACHg6 and had no luck.
>>>>>>>>
>>>>>>>> What I've tested:
>>>>>>>> - Using the applyverbs.py with verbs-working.txt
>>>>>>>> - Applying the legion-alc287-0.0.4.patch as per instructions
>>>>>>>> - Applying the legion-alc287-0.0.5.patch as per instructions
>>>>>>>>
>>>>>>>> Something that may be important is that this new model is running
>>>>>>>> an AMD
>>>>>>>> processor and the sound controller appears as:
>>>>>>>>
>>>>>>>> 'Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models
>>>>>>> 10h-1fh)
>>>>>>>> HD Audio Controller'
>>>>>>>>
>>>>>>>> On Alsa Mixer, it says the "Chip" is ALC287 but the "Card" is HD-Audio
>>>>>>>> Generic.
>>>>>>>>
>>>>>>>> Is that important? I'm bringing this up because the instructions say:
>>>>>>>>
>>>>>>>> # Patch file to enable output on speakers.
>>>>>>>> options snd-hda-intel patch=legion-alc287-0.0.4.patch
>>>>>>>>
>>>>>>>> And the intel part there may be something to change?
>>>>>>>>
>>>>>>>> But honestly I'm clueless so this may be waaay off.
>>>>>>>>
>>>>>>>> Thanks in advance!
>>>>>>>>
Comment 318 woody64 2021-06-26 06:15:07 UTC
Finally I have also a running patch kernel for 5.11.0-22-lowlatency on my Ubuntu 20.04 Lenovo Yoga 7i.

Could not use the diff file directly but copied parts of the diff code directly in the source.
Comment 319 Vincent Morel 2021-06-26 14:24:08 UTC
(In reply to Cameron Berkenpas from comment #301)
> Created attachment 297623 [details]
> attachment-8392-0.html
> 
> Yes, it's a known issue that the sound card is non-resettable. The 
> really good is is that this generally isn't a problem.
> 
>   If through your testing you start having problems, you might need to 
> stop/start the VM, and in some cases, fully shut down the machine. I did 
> tons of testing, and very rarely did I need to do anything more than 
> restart the VM. Only twice did I need to shut off the entire laptop.
> 
> Anyway, getting Windows to use the right driver is a bit tricky, but it 
> can absolutely be done. I don't have the same machine, but looking at 
> your alsa-info, this should mostly work.
> 
> I don't have the URL for your laptop, but here's the Lenovo version as 
> an example:
> https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/legion-
> series/legion-7-15imhg05/81yu/81yucto1ww/mp1t35d3/downloads/driver-list/
> 
> Find the equivalent part of the Lenovo site for your model and then 
> download your sound driver.
> 
> When opening the driver, choose to extract the driver (it won't hurt if 
> you also install it).
> 
> Anyway, here are the instructions I posted earlier in this bug:
> 
> You need to force the device expanded above to use the RealTek driver. I was
> able to force it by *extracting* rather than installing the sound driver
> from the Lenovo site. Selecting update driver on the sound device listed
> under "Sound, video and game controllers", and from there I did:
> "Browse my  computer for drivers"
> "Let me pick from a list of available drivers on my computer"
> "Have Disk"
> Browse to:
> C:\Drivers\Audio\201211706.15485923\Realtek\Codec_8975.1\HDXLVSST.inf
> Press Ok
> You should see "Realtek High Definition Audio(SST)" as an option. It's the
> only option for me)
> Next
> Yes
> Restart the VM when prompted
> 
> Hopefully after these steps, you'll see the "Realtek High Definition 
> Audio(SST)" device in device manager as your sound card and you'll get 
> sound from windows.
> 
> By getting a Win10 VM running with the JCS Qemu means you're a good 
> chunk of the way done.
> 
> -Cameron
> 
> PS: I looked into RtHDDump_V236 and I don't think it's anything I needed 
> for my particular case. It seems it can be used to figure out what pins 
> should be connected to what. We'll see if you need any of that, but not yet.
> 
> On 6/25/21 12:31 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #299 from Vincent Morel (dantahoua@gmail.com) ---
> > I tried to follow the information about installing Qemu
> >
> >
> (https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-from-a-Windows-sound-driver),
> > but ran into problem and I'm not able to install the driver in windows (I
> > have
> > an error while starting qemu abut my soundcard address
> >   -> qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no
> available
> > reset mechanism.
> > ).
> > So sadly I'm not able to get the hda_verb output here... :( Would love to
> > help
> > but for today I'm done. Maybe will have time sunday to try something else.
> > Is there a program I can run into a windows partition to sniff the hda? I'm
> > almost sure I saw something but I cannot remember where...
> >

Pffff, tried everything.
-I re-compiled the Qemu with the sme configure arguments as you
-Then started the VM, try witth th 0000 in front of the audio adress (0000:00:1f.3 vs 00:1f.3), same.
Always have qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no available reset mechanism.
And I am not able to install the driver, I even went the "browse" way (where funily windows show you A:/ by default!)...The driver for my 13s gen2 ITL seems to be 9030.
And yes befor e strating Qemu I did:
sudo ./vfio-bind.sh 0000:00:1f.0 0000:00:1f.3 0000:00:1f.4 0000:00:1f.5
(My sundcard seems to have those other address added, do I have to pass them to qemu also?)...
Comment 320 Cameron Berkenpas 2021-06-26 15:13:14 UTC
> Pffff, tried everything.
> -I re-compiled the Qemu with the sme configure arguments as you
> -Then started the VM, try witth th 0000 in front of the audio adress
> (0000:00:1f.3 vs 00:1f.3), same.
> Always have qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no
> available reset mechanism.
> And I am not able to install the driver, I even went the "browse" way (where
> funily windows show you A:/ by default!)...The driver for my 13s gen2 ITL
> seems
> to be 9030.
> And yes befor e strating Qemu I did:
> sudo ./vfio-bind.sh 0000:00:1f.0 0000:00:1f.3 0000:00:1f.4 0000:00:1f.5
> (My sundcard seems to have those other address added, do I have to pass them
> to
> qemu also?)...
>
>

Can you share the output of this script on your system?
https://wiki.archlinux.org/title/PCI_passthrough_via_OVMF#Ensuring_that_the_groups_are_valid

What is the command line your kernel is starting with?
cat /proc/cmdline

Do you know if you're seeing the sound card show up in device manager 
but as the incorrect device?

Ignore the "Cannot reset device" message. It's likely not a problem for 
your sound card. I get the same message. The good news is that likely 
you are successfully passing the device to qemu, but the above will help 
me confirm that.

Where did you download the driver from?
Comment 321 Vincent Morel 2021-06-26 15:33:25 UTC
(In reply to Cameron Berkenpas from comment #320)
> > Pffff, tried everything.
> > -I re-compiled the Qemu with the sme configure arguments as you
> > -Then started the VM, try witth th 0000 in front of the audio adress
> > (0000:00:1f.3 vs 00:1f.3), same.
> > Always have qemu-system-x86_64: vfio: Cannot reset device 0000:00:1f.3, no
> > available reset mechanism.
> > And I am not able to install the driver, I even went the "browse" way
> (where
> > funily windows show you A:/ by default!)...The driver for my 13s gen2 ITL
> > seems
> > to be 9030.
> > And yes befor e strating Qemu I did:
> > sudo ./vfio-bind.sh 0000:00:1f.0 0000:00:1f.3 0000:00:1f.4 0000:00:1f.5
> > (My sundcard seems to have those other address added, do I have to pass
> them
> > to
> > qemu also?)...
> >
> >
> 
> Can you share the output of this script on your system?
> https://wiki.archlinux.org/title/
> PCI_passthrough_via_OVMF#Ensuring_that_the_groups_are_valid
> 
> What is the command line your kernel is starting with?
> cat /proc/cmdline
> 
> Do you know if you're seeing the sound card show up in device manager 
> but as the incorrect device?
> 
> Ignore the "Cannot reset device" message. It's likely not a problem for 
> your sound card. I get the same message. The good news is that likely 
> you are successfully passing the device to qemu, but the above will help 
> me confirm that.
> 
> Where did you download the driver from?

Yeah, here is the results:

-Result from script:
./test.sh 
IOMMU Group 0:
	00:00.0 Host bridge [0600]: Intel Corporation 11th Gen Core Processor Host Bridge/DRAM Registers [8086:9a14] (rev 01)
IOMMU Group 1:
	00:02.0 VGA compatible controller [0300]: Intel Corporation UHD Graphics [8086:9a49] (rev 01)
IOMMU Group 2:
	00:04.0 Signal processing controller [1180]: Intel Corporation Device [8086:9a03] (rev 01)
IOMMU Group 3:
	00:06.0 PCI bridge [0604]: Intel Corporation 11th Gen Core Processor PCIe Controller [8086:9a09] (rev 01)
IOMMU Group 4:
	00:07.0 PCI bridge [0604]: Intel Corporation Tiger Lake-LP Thunderbolt PCI Express Root Port #2 [8086:9a27] (rev 01)
IOMMU Group 5:
	00:08.0 System peripheral [0880]: Intel Corporation Device [8086:9a11] (rev 01)
IOMMU Group 6:
	00:0d.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP Thunderbolt USB Controller [8086:9a13] (rev 01)
	00:0d.3 USB controller [0c03]: Intel Corporation Tiger Lake-LP Thunderbolt NHI #1 [8086:9a1d] (rev 01)
IOMMU Group 7:
	00:14.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP USB 3.2 Gen 2x1 xHCI Host Controller [8086:a0ed] (rev 20)
	00:14.2 RAM memory [0500]: Intel Corporation Tiger Lake-LP Shared SRAM [8086:a0ef] (rev 20)
IOMMU Group 8:
	00:14.3 Network controller [0280]: Intel Corporation Wi-Fi 6 AX201 [8086:a0f0] (rev 20)
IOMMU Group 9:
	00:15.0 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP Serial IO I2C Controller #0 [8086:a0e8] (rev 20)
IOMMU Group 10:
	00:16.0 Communication controller [0780]: Intel Corporation Tiger Lake-LP Management Engine Interface [8086:a0e0] (rev 20)
IOMMU Group 11:
	00:1f.0 ISA bridge [0601]: Intel Corporation Tiger Lake-LP LPC Controller [8086:a082] (rev 20)
	00:1f.3 Multimedia audio controller [0401]: Intel Corporation Tiger Lake-LP Smart Sound Technology Audio Controller [8086:a0c8] (rev 20)
	00:1f.4 SMBus [0c05]: Intel Corporation Tiger Lake-LP SMBus Controller [8086:a0a3] (rev 20)
	00:1f.5 Serial bus controller [0c80]: Intel Corporation Tiger Lake-LP SPI Controller [8086:a0a4] (rev 20)
IOMMU Group 12:
	01:00.0 Non-Volatile memory controller [0108]: Samsung Electronics Co Ltd Device [144d:a809]

-cat /proc/cmdline
initrd=\EFI\Pop_OS-b0da9465-3702-45ac-91d3-7ca24016e875\initrd.img root=UUID=b0da9465-3702-45ac-91d3-7ca24016e875 ro quiet loglevel=0 systemd.show_status=false splash pci-stub.ids=8086:a0c8 iommu=pt intel_iommu=on

-The audio controller seems to appear in "Other devices->Multimedia Audio Controller" with the small sign on it telling me there is a problem (driver) with it. I checked other device to see if there is something odd but all other stuff seems legit in Device Manager...

-Downloaded the driver from Lenovo website and double check it is the good one (there is so much similar name in Lenovo website...). 13S Gen2 ITL 
https://support.lenovo.com/us/en/downloads/ds546687-realtek-audio-driver-for-windows-10-64-bit-thinkbook-13s-g2-itl-thinkbook-14s-g2-itl
Comment 322 Cameron Berkenpas 2021-06-26 15:42:07 UTC
Things are not quite right. You do seem to have the right sound device 
picked out, but you need to pass all the devices.

Here's  your relevant IO group:
IOMMU Group 11:
         00:1f.0 ISA bridge [0601]: Intel Corporation Tiger Lake-LP LPC 
Controller [8086:a082] (rev 20)
         00:1f.3 Multimedia audio controller [0401]: Intel Corporation 
Tiger Lake-LP Smart Sound Technology Audio Controller [8086:a0c8] (rev 20)
         00:1f.4 SMBus [0c05]: Intel Corporation Tiger Lake-LP SMBus 
Controller [8086:a0a3] (rev 20)
         00:1f.5 Serial bus controller [0c80]: Intel Corporation Tiger 
Lake-LP SPI Controller [8086:a0a4] (rev 20)

Your kernel command only lists your sound card. It should all of the 
devices in this group.

For example, I have:
vfio-pci.ids=8086:068d,8086:06c8,8086:06a3,8086:06a4

Yours needs to be:
vfio-pci.ids=8086:a082,8086:a0c8,8086:a0a3,8086:a0a4

In my experimentation in getting this to work, I also did not set 
"iommu=pt". You might try removing that as well.

> Yeah, here is the results:
>
> -Result from script:
> ./test.sh
> IOMMU Group 0:
>          00:00.0 Host bridge [0600]: Intel Corporation 11th Gen Core
>          Processor
> Host Bridge/DRAM Registers [8086:9a14] (rev 01)
> IOMMU Group 1:
>          00:02.0 VGA compatible controller [0300]: Intel Corporation UHD
> Graphics [8086:9a49] (rev 01)
> IOMMU Group 2:
>          00:04.0 Signal processing controller [1180]: Intel Corporation
>          Device
> [8086:9a03] (rev 01)
> IOMMU Group 3:
>          00:06.0 PCI bridge [0604]: Intel Corporation 11th Gen Core Processor
> PCIe Controller [8086:9a09] (rev 01)
> IOMMU Group 4:
>          00:07.0 PCI bridge [0604]: Intel Corporation Tiger Lake-LP
>          Thunderbolt
> PCI Express Root Port #2 [8086:9a27] (rev 01)
> IOMMU Group 5:
>          00:08.0 System peripheral [0880]: Intel Corporation Device
>          [8086:9a11]
> (rev 01)
> IOMMU Group 6:
>          00:0d.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP
> Thunderbolt USB Controller [8086:9a13] (rev 01)
>          00:0d.3 USB controller [0c03]: Intel Corporation Tiger Lake-LP
> Thunderbolt NHI #1 [8086:9a1d] (rev 01)
> IOMMU Group 7:
>          00:14.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP USB
>          3.2
> Gen 2x1 xHCI Host Controller [8086:a0ed] (rev 20)
>          00:14.2 RAM memory [0500]: Intel Corporation Tiger Lake-LP Shared
>          SRAM
> [8086:a0ef] (rev 20)
> IOMMU Group 8:
>          00:14.3 Network controller [0280]: Intel Corporation Wi-Fi 6 AX201
> [8086:a0f0] (rev 20)
> IOMMU Group 9:
>          00:15.0 Serial bus controller [0c80]: Intel Corporation Tiger
>          Lake-LP
> Serial IO I2C Controller #0 [8086:a0e8] (rev 20)
> IOMMU Group 10:
>          00:16.0 Communication controller [0780]: Intel Corporation Tiger
> Lake-LP Management Engine Interface [8086:a0e0] (rev 20)
> IOMMU Group 11:
>          00:1f.0 ISA bridge [0601]: Intel Corporation Tiger Lake-LP LPC
> Controller [8086:a082] (rev 20)
>          00:1f.3 Multimedia audio controller [0401]: Intel Corporation Tiger
> Lake-LP Smart Sound Technology Audio Controller [8086:a0c8] (rev 20)
>          00:1f.4 SMBus [0c05]: Intel Corporation Tiger Lake-LP SMBus
>          Controller
> [8086:a0a3] (rev 20)
>          00:1f.5 Serial bus controller [0c80]: Intel Corporation Tiger
>          Lake-LP
> SPI Controller [8086:a0a4] (rev 20)
> IOMMU Group 12:
>          01:00.0 Non-Volatile memory controller [0108]: Samsung Electronics
>          Co
> Ltd Device [144d:a809]
>
> -cat /proc/cmdline
> initrd=\EFI\Pop_OS-b0da9465-3702-45ac-91d3-7ca24016e875\initrd.img
> root=UUID=b0da9465-3702-45ac-91d3-7ca24016e875 ro quiet loglevel=0
> systemd.show_status=false splash pci-stub.ids=8086:a0c8 iommu=pt
> intel_iommu=on
>
> -The audio controller seems to appear in "Other devices->Multimedia Audio
> Controller" with the small sign on it telling me there is a problem (driver)
> with it. I checked other device to see if there is something odd but all
> other
> stuff seems legit in Device Manager...
>
> -Downloaded the driver from Lenovo website and double check it is the good
> one
> (there is so much similar name in Lenovo website...). 13S Gen2 ITL
>
> https://support.lenovo.com/us/en/downloads/ds546687-realtek-audio-driver-for-windows-10-64-bit-thinkbook-13s-g2-itl-thinkbook-14s-g2-itl
>
Comment 323 Thomas Stenhouse-Pyne 2021-06-26 15:50:51 UTC
Hi all,

Just jumping on to say that, like darnellkeithj@gmail.com, I have a Duet 7i. They seem to have gone quiet recently so I thought I'd pipe up after this flurry of activity with the verbs. Unfortunately applying the 'verbs-working.txt' using the python script has not worked for me. I'm now following the qemu guide to try to determine the verbs, so will report back when I have something.
Comment 324 Vincent Morel 2021-06-26 16:46:19 UTC
Ok,
updated the kernel param, now I have
initrd=\EFI\Pop_OS-b0da9465-3702-45ac-91d3-7ca24016e875\initrd.img root=UUID=b0da9465-3702-45ac-91d3-7ca24016e875 ro quiet loglevel=0 systemd.show_status=false splash pci-stub.ids=8086:a082,8086:a0c8,8086:a0a3,8086:a0a4 intel_iommu=on

Try with or without "iommu=pt"

Still no luck, no hcnag ein the VM.
Note that since I added those 3 more adress from the group to the param, my audio show only "dummy" output in control panel of Linux.

My VM start command is:
#!/bin/bash

_qemu=/opt/qemu/jcs/bin/qemu-system-x86_64

sudo qemu-system-x86_64 -L ~/windows_vm/qemu/pc-bios -enable-kvm -hda win10.img -m 4G -smp 4 -vga std -device vfio-pci,host=0000:00:1f.3,multifunction=on,x-no-mmap=true -trace events=./events.txt -monitor stdio

(In reply to Cameron Berkenpas from comment #322)
> Things are not quite right. You do seem to have the right sound device 
> picked out, but you need to pass all the devices.
> 
> Here's  your relevant IO group:
> IOMMU Group 11:
>          00:1f.0 ISA bridge [0601]: Intel Corporation Tiger Lake-LP LPC 
> Controller [8086:a082] (rev 20)
>          00:1f.3 Multimedia audio controller [0401]: Intel Corporation 
> Tiger Lake-LP Smart Sound Technology Audio Controller [8086:a0c8] (rev 20)
>          00:1f.4 SMBus [0c05]: Intel Corporation Tiger Lake-LP SMBus 
> Controller [8086:a0a3] (rev 20)
>          00:1f.5 Serial bus controller [0c80]: Intel Corporation Tiger 
> Lake-LP SPI Controller [8086:a0a4] (rev 20)
> 
> Your kernel command only lists your sound card. It should all of the 
> devices in this group.
> 
> For example, I have:
> vfio-pci.ids=8086:068d,8086:06c8,8086:06a3,8086:06a4
> 
> Yours needs to be:
> vfio-pci.ids=8086:a082,8086:a0c8,8086:a0a3,8086:a0a4
> 
> In my experimentation in getting this to work, I also did not set 
> "iommu=pt". You might try removing that as well.
> 
> > Yeah, here is the results:
> >
> > -Result from script:
> > ./test.sh
> > IOMMU Group 0:
> >          00:00.0 Host bridge [0600]: Intel Corporation 11th Gen Core
> >          Processor
> > Host Bridge/DRAM Registers [8086:9a14] (rev 01)
> > IOMMU Group 1:
> >          00:02.0 VGA compatible controller [0300]: Intel Corporation UHD
> > Graphics [8086:9a49] (rev 01)
> > IOMMU Group 2:
> >          00:04.0 Signal processing controller [1180]: Intel Corporation
> >          Device
> > [8086:9a03] (rev 01)
> > IOMMU Group 3:
> >          00:06.0 PCI bridge [0604]: Intel Corporation 11th Gen Core
> Processor
> > PCIe Controller [8086:9a09] (rev 01)
> > IOMMU Group 4:
> >          00:07.0 PCI bridge [0604]: Intel Corporation Tiger Lake-LP
> >          Thunderbolt
> > PCI Express Root Port #2 [8086:9a27] (rev 01)
> > IOMMU Group 5:
> >          00:08.0 System peripheral [0880]: Intel Corporation Device
> >          [8086:9a11]
> > (rev 01)
> > IOMMU Group 6:
> >          00:0d.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP
> > Thunderbolt USB Controller [8086:9a13] (rev 01)
> >          00:0d.3 USB controller [0c03]: Intel Corporation Tiger Lake-LP
> > Thunderbolt NHI #1 [8086:9a1d] (rev 01)
> > IOMMU Group 7:
> >          00:14.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP USB
> >          3.2
> > Gen 2x1 xHCI Host Controller [8086:a0ed] (rev 20)
> >          00:14.2 RAM memory [0500]: Intel Corporation Tiger Lake-LP Shared
> >          SRAM
> > [8086:a0ef] (rev 20)
> > IOMMU Group 8:
> >          00:14.3 Network controller [0280]: Intel Corporation Wi-Fi 6 AX201
> > [8086:a0f0] (rev 20)
> > IOMMU Group 9:
> >          00:15.0 Serial bus controller [0c80]: Intel Corporation Tiger
> >          Lake-LP
> > Serial IO I2C Controller #0 [8086:a0e8] (rev 20)
> > IOMMU Group 10:
> >          00:16.0 Communication controller [0780]: Intel Corporation Tiger
> > Lake-LP Management Engine Interface [8086:a0e0] (rev 20)
> > IOMMU Group 11:
> >          00:1f.0 ISA bridge [0601]: Intel Corporation Tiger Lake-LP LPC
> > Controller [8086:a082] (rev 20)
> >          00:1f.3 Multimedia audio controller [0401]: Intel Corporation
> Tiger
> > Lake-LP Smart Sound Technology Audio Controller [8086:a0c8] (rev 20)
> >          00:1f.4 SMBus [0c05]: Intel Corporation Tiger Lake-LP SMBus
> >          Controller
> > [8086:a0a3] (rev 20)
> >          00:1f.5 Serial bus controller [0c80]: Intel Corporation Tiger
> >          Lake-LP
> > SPI Controller [8086:a0a4] (rev 20)
> > IOMMU Group 12:
> >          01:00.0 Non-Volatile memory controller [0108]: Samsung Electronics
> >          Co
> > Ltd Device [144d:a809]
> >
> > -cat /proc/cmdline
> > initrd=\EFI\Pop_OS-b0da9465-3702-45ac-91d3-7ca24016e875\initrd.img
> > root=UUID=b0da9465-3702-45ac-91d3-7ca24016e875 ro quiet loglevel=0
> > systemd.show_status=false splash pci-stub.ids=8086:a0c8 iommu=pt
> > intel_iommu=on
> >
> > -The audio controller seems to appear in "Other devices->Multimedia Audio
> > Controller" with the small sign on it telling me there is a problem
> (driver)
> > with it. I checked other device to see if there is something odd but all
> > other
> > stuff seems legit in Device Manager...
> >
> > -Downloaded the driver from Lenovo website and double check it is the good
> > one
> > (there is so much similar name in Lenovo website...). 13S Gen2 ITL
> >
> >
> https://support.lenovo.com/us/en/downloads/ds546687-realtek-audio-driver-for-windows-10-64-bit-thinkbook-13s-g2-itl-thinkbook-14s-g2-itl
> >
Comment 325 Cameron Berkenpas 2021-06-26 16:53:32 UTC
bugzilla-daemon@bugzilla.kernel.org to BCC so we can avoid spamming with 
trouble shooting. When we resolve this, we can share our findings.

(also check your spam folder for messages directly from me).

Linux should only have the dummy device as device is no longer available 
to the host OS. That's good!

What do you see under system devices?
http://vasteel.neo-zeon.de/~hiryu/287/win10-vm.png

Anything relating to sound like mine?

On 6/26/21 9:46 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #324 from Vincent Morel (dantahoua@gmail.com) ---
> Ok,
> updated the kernel param, now I have
> initrd=\EFI\Pop_OS-b0da9465-3702-45ac-91d3-7ca24016e875\initrd.img
> root=UUID=b0da9465-3702-45ac-91d3-7ca24016e875 ro quiet loglevel=0
> systemd.show_status=false splash
> pci-stub.ids=8086:a082,8086:a0c8,8086:a0a3,8086:a0a4 intel_iommu=on
>
> Try with or without "iommu=pt"
>
> Still no luck, no hcnag ein the VM.
> Note that since I added those 3 more adress from the group to the param, my
> audio show only "dummy" output in control panel of Linux.
>
> My VM start command is:
> #!/bin/bash
>
> _qemu=/opt/qemu/jcs/bin/qemu-system-x86_64
>
> sudo qemu-system-x86_64 -L ~/windows_vm/qemu/pc-bios -enable-kvm -hda
> win10.img
> -m 4G -smp 4 -vga std -device
> vfio-pci,host=0000:00:1f.3,multifunction=on,x-no-mmap=true -trace
> events=./events.txt -monitor stdio
>
> (In reply to Cameron Berkenpas from comment #322)
>> Things are not quite right. You do seem to have the right sound device
>> picked out, but you need to pass all the devices.
>>
>> Here's  your relevant IO group:
>> IOMMU Group 11:
>>           00:1f.0 ISA bridge [0601]: Intel Corporation Tiger Lake-LP LPC
>> Controller [8086:a082] (rev 20)
>>           00:1f.3 Multimedia audio controller [0401]: Intel Corporation
>> Tiger Lake-LP Smart Sound Technology Audio Controller [8086:a0c8] (rev 20)
>>           00:1f.4 SMBus [0c05]: Intel Corporation Tiger Lake-LP SMBus
>> Controller [8086:a0a3] (rev 20)
>>           00:1f.5 Serial bus controller [0c80]: Intel Corporation Tiger
>> Lake-LP SPI Controller [8086:a0a4] (rev 20)
>>
>> Your kernel command only lists your sound card. It should all of the
>> devices in this group.
>>
>> For example, I have:
>> vfio-pci.ids=8086:068d,8086:06c8,8086:06a3,8086:06a4
>>
>> Yours needs to be:
>> vfio-pci.ids=8086:a082,8086:a0c8,8086:a0a3,8086:a0a4
>>
>> In my experimentation in getting this to work, I also did not set
>> "iommu=pt". You might try removing that as well.
>>
>>> Yeah, here is the results:
>>>
>>> -Result from script:
>>> ./test.sh
>>> IOMMU Group 0:
>>>           00:00.0 Host bridge [0600]: Intel Corporation 11th Gen Core
>>>           Processor
>>> Host Bridge/DRAM Registers [8086:9a14] (rev 01)
>>> IOMMU Group 1:
>>>           00:02.0 VGA compatible controller [0300]: Intel Corporation UHD
>>> Graphics [8086:9a49] (rev 01)
>>> IOMMU Group 2:
>>>           00:04.0 Signal processing controller [1180]: Intel Corporation
>>>           Device
>>> [8086:9a03] (rev 01)
>>> IOMMU Group 3:
>>>           00:06.0 PCI bridge [0604]: Intel Corporation 11th Gen Core
>> Processor
>>> PCIe Controller [8086:9a09] (rev 01)
>>> IOMMU Group 4:
>>>           00:07.0 PCI bridge [0604]: Intel Corporation Tiger Lake-LP
>>>           Thunderbolt
>>> PCI Express Root Port #2 [8086:9a27] (rev 01)
>>> IOMMU Group 5:
>>>           00:08.0 System peripheral [0880]: Intel Corporation Device
>>>           [8086:9a11]
>>> (rev 01)
>>> IOMMU Group 6:
>>>           00:0d.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP
>>> Thunderbolt USB Controller [8086:9a13] (rev 01)
>>>           00:0d.3 USB controller [0c03]: Intel Corporation Tiger Lake-LP
>>> Thunderbolt NHI #1 [8086:9a1d] (rev 01)
>>> IOMMU Group 7:
>>>           00:14.0 USB controller [0c03]: Intel Corporation Tiger Lake-LP
>>>           USB
>>>           3.2
>>> Gen 2x1 xHCI Host Controller [8086:a0ed] (rev 20)
>>>           00:14.2 RAM memory [0500]: Intel Corporation Tiger Lake-LP Shared
>>>           SRAM
>>> [8086:a0ef] (rev 20)
>>> IOMMU Group 8:
>>>           00:14.3 Network controller [0280]: Intel Corporation Wi-Fi 6
>>>           AX201
>>> [8086:a0f0] (rev 20)
>>> IOMMU Group 9:
>>>           00:15.0 Serial bus controller [0c80]: Intel Corporation Tiger
>>>           Lake-LP
>>> Serial IO I2C Controller #0 [8086:a0e8] (rev 20)
>>> IOMMU Group 10:
>>>           00:16.0 Communication controller [0780]: Intel Corporation Tiger
>>> Lake-LP Management Engine Interface [8086:a0e0] (rev 20)
>>> IOMMU Group 11:
>>>           00:1f.0 ISA bridge [0601]: Intel Corporation Tiger Lake-LP LPC
>>> Controller [8086:a082] (rev 20)
>>>           00:1f.3 Multimedia audio controller [0401]: Intel Corporation
>> Tiger
>>> Lake-LP Smart Sound Technology Audio Controller [8086:a0c8] (rev 20)
>>>           00:1f.4 SMBus [0c05]: Intel Corporation Tiger Lake-LP SMBus
>>>           Controller
>>> [8086:a0a3] (rev 20)
>>>           00:1f.5 Serial bus controller [0c80]: Intel Corporation Tiger
>>>           Lake-LP
>>> SPI Controller [8086:a0a4] (rev 20)
>>> IOMMU Group 12:
>>>           01:00.0 Non-Volatile memory controller [0108]: Samsung
>>>           Electronics
>>>           Co
>>> Ltd Device [144d:a809]
>>>
>>> -cat /proc/cmdline
>>> initrd=\EFI\Pop_OS-b0da9465-3702-45ac-91d3-7ca24016e875\initrd.img
>>> root=UUID=b0da9465-3702-45ac-91d3-7ca24016e875 ro quiet loglevel=0
>>> systemd.show_status=false splash pci-stub.ids=8086:a0c8 iommu=pt
>>> intel_iommu=on
>>>
>>> -The audio controller seems to appear in "Other devices->Multimedia Audio
>>> Controller" with the small sign on it telling me there is a problem
>> (driver)
>>> with it. I checked other device to see if there is something odd but all
>>> other
>>> stuff seems legit in Device Manager...
>>>
>>> -Downloaded the driver from Lenovo website and double check it is the good
>>> one
>>> (there is so much similar name in Lenovo website...). 13S Gen2 ITL
>>>
>>>
>>
>> https://support.lenovo.com/us/en/downloads/ds546687-realtek-audio-driver-for-windows-10-64-bit-thinkbook-13s-g2-itl-thinkbook-14s-g2-itl
Comment 326 Thiago T 2021-06-28 20:27:39 UTC
I have created the repo https://github.com/thiagotei/linux-realtek-alc287 to try to consolidate information posted here.
Any help is welcome to fill the gaps.
Comment 327 Cameron Berkenpas 2021-06-29 03:53:25 UTC
Created attachment 297647 [details]
linux-5.12-legion-sound-0.0.6.patch - Early Gen2 support

No Legion changes.

For the Yoga 7, automute_speaker is no longer disabled. This is needed for the Legion, but not for the Gen2. I want to see if it's needed for the Yoga 7.

Early Gen2 support. Confirmed working for Vince Morel who is also working on getting those verbs trimmed down. :)

Yoga 7 users, PLEASE test and see if you still have speaker output after unplugging headphones while playing sound.
Comment 328 Cameron Berkenpas 2021-06-29 03:58:51 UTC
Created attachment 297649 [details]
trimed-verbs-Lenovo-13s-gen2-itl.txt

For the 0.0.6 patch, support was specifically added for the 13s Gen2 ITL. I Should have been more clear.

Anyhow, these are the verbs from Vince Morel. Thank you for expending the time and effort to setup PCI passthrough, build/run JCS Qemu, and fight with Windows to get the correct sound drivers working!

Perhaps some other 13s Gen2 users are out there who can take some time to look at these verbs and help narrow them down to what's needed.
Comment 329 Alex 2021-06-29 08:58:18 UTC
Created attachment 297653 [details]
Legion 7 2021 16ACHg6 - linux codec dump
Comment 330 Alex 2021-06-29 08:59:32 UTC
Created attachment 297655 [details]
Legion 7 2021 16ACHg6 - windows speakers on dump
Comment 331 Alex 2021-06-29 09:00:05 UTC
Created attachment 297657 [details]
Legion 7 2021 16ACHg6 - windows headphones on dump
Comment 332 Alex 2021-06-29 09:01:12 UTC
Still working on the Legion 7 2021 16ACHg6 here... I've been fiddling around but no luck getting the speakers working.

Add some windows dumps if that helps anyone!
Comment 333 Dre 2021-06-29 14:06:25 UTC
Created attachment 297663 [details]
attachment-15688-0.html

I tried applying the new linux-5.12-legion-sound-0.0.6 patch to the 
Yoga 7 to no avail.  I do not have speaker output after unplugging 
headphones.  The S3 patch still works.

On Tue, Jun 29 2021 at 03:58:51 AM +0000, 
bugzilla-daemon@bugzilla.kernel.org wrote:
>
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D208555&data=04%7C01%7C%7C91bf8eb61d9f490f266d08d93ab236a8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637605359353072439%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kzmyxY2jimcuGL2CpuyoEhiAH4BEXown7FX2A6oYevI%3D&reserved=0>
> 
> --- Comment #328 from Cameron Berkenpas (cam@neo-zeon.de 
> <mailto:cam@neo-zeon.de>) ---
> Created attachment 297649 [details]
>   --> 
>
> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fattachment.cgi%3Fid%3D297649%26action%3Dedit&data=04%7C01%7C%7C91bf8eb61d9f490f266d08d93ab236a8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637605359353072439%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TMAYUU8eHgFrbut3M7kvsfZGleXkZwVt8aMGtJ4Am%2Fw%3D&reserved=0>
> trimed-verbs-Lenovo-13s-gen2-itl.txt
> 
> For the 0.0.6 patch, support was specifically added for the 13s Gen2 
> ITL. I
> Should have been more clear.
> 
> Anyhow, these are the verbs from Vince Morel. Thank you for expending 
> the time
> and effort to setup PCI passthrough, build/run JCS Qemu, and fight 
> with Windows
> to get the correct sound drivers working!
> 
> Perhaps some other 13s Gen2 users are out there who can take some 
> time to look
> at these verbs and help narrow them down to what's needed.
> 
> --
> You may reply to this email to add a comment.
> 
> You are receiving this mail because:
> You are on the CC list for the bug.
Comment 334 Cameron Berkenpas 2021-06-29 14:55:31 UTC
Do you have speaker output before plugging in the headphones?

On 6/29/21 7:06 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #333 from Dre (dreman_74@hotmail.com) ---
> I tried applying the new linux-5.12-legion-sound-0.0.6 patch to the
> Yoga 7 to no avail.  I do not have speaker output after unplugging
> headphones.  The S3 patch still works.
>
> On Tue, Jun 29 2021 at 03:58:51 AM +0000,
> bugzilla-daemon@bugzilla.kernel.org wrote:
>>
>> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fshow_bug.cgi%3Fid%3D208555&data=04%7C01%7C%7C91bf8eb61d9f490f266d08d93ab236a8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637605359353072439%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=kzmyxY2jimcuGL2CpuyoEhiAH4BEXown7FX2A6oYevI%3D&reserved=0>
>>
>> --- Comment #328 from Cameron Berkenpas (cam@neo-zeon.de
>> <mailto:cam@neo-zeon.de>) ---
>> Created attachment 297649 [details]
>>    -->
>>
>>
>> <https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.kernel.org%2Fattachment.cgi%3Fid%3D297649%26action%3Dedit&data=04%7C01%7C%7C91bf8eb61d9f490f266d08d93ab236a8%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637605359353072439%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=TMAYUU8eHgFrbut3M7kvsfZGleXkZwVt8aMGtJ4Am%2Fw%3D&reserved=0>
>> trimed-verbs-Lenovo-13s-gen2-itl.txt
>>
>> For the 0.0.6 patch, support was specifically added for the 13s Gen2
>> ITL. I
>> Should have been more clear.
>>
>> Anyhow, these are the verbs from Vince Morel. Thank you for expending
>> the time
>> and effort to setup PCI passthrough, build/run JCS Qemu, and fight
>> with Windows
>> to get the correct sound drivers working!
>>
>> Perhaps some other 13s Gen2 users are out there who can take some
>> time to look
>> at these verbs and help narrow them down to what's needed.
>>
>> --
>> You may reply to this email to add a comment.
>>
>> You are receiving this mail because:
>> You are on the CC list for the bug.
Comment 338 woody64 2021-06-30 05:43:11 UTC
(In reply to Dre from comment #335)
> Created attachment 297665 [details]
> attachment-29004-0.html
> 
> No.  No speaker output before plugging in the headphones.
> 

On my Yoga the patch works also after headphones in/out.

Are you sure your new module is installed correctly?

Maybe place a

> printk(KERN_ALERT "ALS287 PATCH\n");

inside the alc287_fixup_legion_yoga7_speakers function and check afterwards via
dmesg.
Comment 339 Cameron Berkenpas 2021-06-30 22:07:06 UTC
Created attachment 297677 [details]
linux-5.12-legion-sound-0.0.7.patch

Now that it's time to start moving away from just trying to get things working to having something that might actually be accepted into kernel, I'm changing how we're handling the verbs. In order to (hopefully) follow convention, I'm using the HDA_FIXUP_VERBS method to pass the verbs instead of manually calling a function to send them.

2020 Legion, 13s Gen2, and Yoga 7 are still the only supported models. I don't expect any issues, but please report any that come up.

In other news, I'm working on some documentation for the linux-realtek-alc287 GitHub project that I will hopefully have completed by this week so that others can try to reproduce this process and get sound out of their laptops. Thank you, Thiago!
Comment 340 Dre 2021-06-30 23:41:58 UTC
(In reply to woody64 from comment #338)
> (In reply to Dre from comment #335)
> > Created attachment 297665 [details]
> > attachment-29004-0.html
> > 
> > No.  No speaker output before plugging in the headphones.
> > 
> 
> On my Yoga the patch works also after headphones in/out.
> 
> Are you sure your new module is installed correctly?
> 
> Maybe place a
> 
> > printk(KERN_ALERT "ALS287 PATCH\n");
> 
> inside the alc287_fixup_legion_yoga7_speakers function and check afterwards
> via
> dmesg.

Perhaps it is not installed correctly.  How are you applying the patch?
Comment 341 Cameron Berkenpas 2021-07-01 00:23:39 UTC
cd linux-5.12.14/
patch -p1 < /path/to/file.patch

On 6/30/21 4:41 PM, bugzilla-daemon@bugzilla.kernel.org wrote:Perhaps it 
is not installed correctly. How are you applying the patch?
Comment 342 Ganesh Kadam 2021-07-02 13:25:10 UTC
Hi, 

I am using Fedora35 rawhide, with latest kernel post update:
~~~
 gkadam  ~  uname --all
Linux tesla 5.13.0-0.rc6.45.fc35.x86_64 #1 SMP Mon Jun 14 13:44:07 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
~~~

I am also not able to hear sound post update. 


Here is the issue:
~~~
systemctl status alsa-state.service 
● alsa-state.service - Manage Sound Card State (restore and store)
     Loaded: loaded (/usr/lib/systemd/system/alsa-state.service; static)
     Active: active (running) since Fri 2021-07-02 18:37:11 IST; 13min ago
   Main PID: 1349 (alsactl)
      Tasks: 1 (limit: 23786)
     Memory: 404.0K
        CPU: 13ms
     CGroup: /system.slice/alsa-state.service
             └─1349 /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main rdaemon

Jul 02 18:37:11 tesla systemd[1]: Started Manage Sound Card State (restore and store).
Jul 02 18:37:11 tesla alsactl[1349]: alsactl 1.2.5.1 daemon started
Jul 02 18:37:11 tesla alsactl[1349]: alsa-lib parser.c:242:(error_node) UCM is not supported for this HDA model (HDA Intel PCH at 0xf1240000 irq 131)
Jul 02 18:37:11 tesla alsactl[1349]: alsa-lib main.c:1405:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -6
Jul 02 18:37:11 tesla alsactl[1349]: alsa-lib main.c:1405:(snd_use_case_mgr_open) error: failed to import hw:1 use case configuration -2

~~~


My sound card is not working properly after updating the system to the latest version. 

Any pointers/suggestions are appreciated.

Br,
Ganesh Kadam
Comment 343 David Ober 2021-07-02 13:38:06 UTC
Created attachment 297691 [details]
attachment-10777-0.html

I am on Holiday and will be returning on July 06 2021
Comment 344 Cameron Berkenpas 2021-07-02 14:57:11 UTC
> 
> 
> My sound card is not working properly after updating the system to the
> latest version. 
> 
> Any pointers/suggestions are appreciated.

Ganesh,

Thank you for your feedback. Can you share your alsa-info?

When you say post update, do you mean applying the latest patch attached to this bug report or are you referring to the latest kernel update for Fedora Rawhide?
Comment 345 waterproof93 2021-07-02 20:35:44 UTC
(In reply to Cameron Berkenpas from comment #339)
> Created attachment 297677 [details]
> linux-5.12-legion-sound-0.0.7.patch
> 
> Now that it's time to start moving away from just trying to get things
> working to having something that might actually be accepted into kernel, I'm
> changing how we're handling the verbs. In order to (hopefully) follow
> convention, I'm using the HDA_FIXUP_VERBS method to pass the verbs instead
> of manually calling a function to send them.
> 
> 2020 Legion, 13s Gen2, and Yoga 7 are still the only supported models. I
> don't expect any issues, but please report any that come up.
> 
> In other news, I'm working on some documentation for the
> linux-realtek-alc287 GitHub project that I will hopefully have completed by
> this week so that others can try to reproduce this process and get sound out
> of their laptops. Thank you, Thiago!

13s Gen2 here, I'm trying to apply this patch with this command:

patch -p1 < linux-5.12-legion-sound-0.0.7.patch

and getting this error :

patching file sound/pci/hda/legion_15imhg05_speakers.c
can't find file to patch at input line 506
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
|index e46e43dac6bf..d9fa4e4ceb5b 100644
|--- a/sound/pci/hda/patch_realtek.c
|+++ b/sound/pci/hda/patch_realtek.c
--------------------------
File to patch: 
Skip this patch? [y] n
File to patch: 
Skip this patch? [y] 
Skipping patch.
4 out of 4 hunks ignored
Comment 346 Cameron Berkenpas 2021-07-02 20:36:39 UTC
What directory/folder are you running this command in?

On 7/2/21 1:35 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> waterproof93@outlook.com changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |waterproof93@outlook.com
>
> --- Comment #345 from waterproof93@outlook.com ---
> (In reply to Cameron Berkenpas from comment #339)
>> Created attachment 297677 [details]
>> linux-5.12-legion-sound-0.0.7.patch
>>
>> Now that it's time to start moving away from just trying to get things
>> working to having something that might actually be accepted into kernel, I'm
>> changing how we're handling the verbs. In order to (hopefully) follow
>> convention, I'm using the HDA_FIXUP_VERBS method to pass the verbs instead
>> of manually calling a function to send them.
>>
>> 2020 Legion, 13s Gen2, and Yoga 7 are still the only supported models. I
>> don't expect any issues, but please report any that come up.
>>
>> In other news, I'm working on some documentation for the
>> linux-realtek-alc287 GitHub project that I will hopefully have completed by
>> this week so that others can try to reproduce this process and get sound out
>> of their laptops. Thank you, Thiago!
> 13s Gen2 here, I'm trying to apply this patch with this command:
>
> patch -p1 < linux-5.12-legion-sound-0.0.7.patch
>
> and getting this error :
>
> patching file sound/pci/hda/legion_15imhg05_speakers.c
> can't find file to patch at input line 506
> Perhaps you used the wrong -p or --strip option?
> The text leading up to this was:
> --------------------------
> |diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> |index e46e43dac6bf..d9fa4e4ceb5b 100644
> |--- a/sound/pci/hda/patch_realtek.c
> |+++ b/sound/pci/hda/patch_realtek.c
> --------------------------
> File to patch:
> Skip this patch? [y] n
> File to patch:
> Skip this patch? [y]
> Skipping patch.
> 4 out of 4 hunks ignored
>
Comment 347 waterproof93 2021-07-02 20:41:07 UTC
(In reply to Cameron Berkenpas from comment #346)
> What directory/folder are you running this command in?
> 
> On 7/2/21 1:35 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > waterproof93@outlook.com changed:
> >
> >             What    |Removed                     |Added
> >
> ----------------------------------------------------------------------------
> >                   CC|                            |waterproof93@outlook.com
> >
> > --- Comment #345 from waterproof93@outlook.com ---
> > (In reply to Cameron Berkenpas from comment #339)
> >> Created attachment 297677 [details]
> >> linux-5.12-legion-sound-0.0.7.patch
> >>
> >> Now that it's time to start moving away from just trying to get things
> >> working to having something that might actually be accepted into kernel,
> I'm
> >> changing how we're handling the verbs. In order to (hopefully) follow
> >> convention, I'm using the HDA_FIXUP_VERBS method to pass the verbs instead
> >> of manually calling a function to send them.
> >>
> >> 2020 Legion, 13s Gen2, and Yoga 7 are still the only supported models. I
> >> don't expect any issues, but please report any that come up.
> >>
> >> In other news, I'm working on some documentation for the
> >> linux-realtek-alc287 GitHub project that I will hopefully have completed
> by
> >> this week so that others can try to reproduce this process and get sound
> out
> >> of their laptops. Thank you, Thiago!
> > 13s Gen2 here, I'm trying to apply this patch with this command:
> >
> > patch -p1 < linux-5.12-legion-sound-0.0.7.patch
> >
> > and getting this error :
> >
> > patching file sound/pci/hda/legion_15imhg05_speakers.c
> > can't find file to patch at input line 506
> > Perhaps you used the wrong -p or --strip option?
> > The text leading up to this was:
> > --------------------------
> > |diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> > |index e46e43dac6bf..d9fa4e4ceb5b 100644
> > |--- a/sound/pci/hda/patch_realtek.c
> > |+++ b/sound/pci/hda/patch_realtek.c
> > --------------------------
> > File to patch:
> > Skip this patch? [y] n
> > File to patch:
> > Skip this patch? [y]
> > Skipping patch.
> > 4 out of 4 hunks ignored
> >

right... probably the wrong one ! (~/Downloads)
Kindly, how do I run this command ?
Comment 348 Cameron Berkenpas 2021-07-02 21:21:48 UTC
> right... probably the wrong one ! (~/Downloads)
> Kindly, how do I run this command ?
>
This is a patch to be applied against the source of a 5.12.x kernel. You 
would then need to compile, install, and boot to this kernel.

There are likely instructions on the net to help you do this with your 
distribution. However, if this is something you're not comfortable with, 
I'd suggest waiting these fixes to eventually make it into the kernel.

In the meantime, there is a temporary work around with applying the 
verbs (you'd want the vebs for your model of laptop). There are caveats 
with the "applying the verbs" method that are discussed in the bug.
Comment 349 Ganesh Kadam 2021-07-03 13:39:57 UTC
Hi Cameron, 

(In reply to Cameron Berkenpas from comment #344)
> > 
> > 
> > My sound card is not working properly after updating the system to the
> > latest version. 
> > 
> > Any pointers/suggestions are appreciated.
> 
> Ganesh,
> 
> Thank you for your feedback. Can you share your alsa-info?
> 
> When you say post update, do you mean applying the latest patch attached to
> this bug report or are you referring to the latest kernel update for Fedora
> Rawhide?

I just performed, a regular system update, using dnf update command, and after all the packages were installed, I reboot the system, since then my sound cards are not being detected. 

Here is the alsa-info:
~~~
http://alsa-project.org/db/?f=06e581149a25224e881b43b0b72f6439d13cde3a
~~~

BR,
Ganesh Kadam
Comment 350 Cameron Berkenpas 2021-07-03 15:28:16 UTC
Your laptop has an  ALC293 and was originally working. This bug is for 
Lenovo laptops with ALC287's whose sound never worked, and therefore 
these issues are unrelated.

Sounds like you need to file a bug report with Fedora.

On 7/3/21 6:39 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #349 from Ganesh Kadam (meganeshkadam@gmail.com) ---
> Hi Cameron,
>
> (In reply to Cameron Berkenpas from comment #344)
>>>
>>> My sound card is not working properly after updating the system to the
>>> latest version.
>>>
>>> Any pointers/suggestions are appreciated.
>> Ganesh,
>>
>> Thank you for your feedback. Can you share your alsa-info?
>>
>> When you say post update, do you mean applying the latest patch attached to
>> this bug report or are you referring to the latest kernel update for Fedora
>> Rawhide?
> I just performed, a regular system update, using dnf update command, and
> after
> all the packages were installed, I reboot the system, since then my sound
> cards
> are not being detected.
>
> Here is the alsa-info:
> ~~~
> http://alsa-project.org/db/?f=06e581149a25224e881b43b0b72f6439d13cde3a
> ~~~
>
> BR,
> Ganesh Kadam
>
Comment 351 Roland 2021-07-03 18:18:33 UTC
(In reply to Roland from comment #259)
> (In reply to DavidLenovo from comment #257)
> 
> > You sure it is the ALC287 ?
> 
> No, I'm not, although the problem sounds quote similar. This may be a
> coincidence, but I'll keep an eye on this issue.

David, it's the ACL711. I didn't find any bug reports regarding this chipset, nevertheless I assume that the problem might be similar to the ACL287 reported here, since the symptoms are the same. Sadly, the verbs from this report don't work for me, so they might be different to the ACL711. I fear I have to patch qemu and try to find working verbs for my system on my own :-(
Comment 352 waterproof93 2021-07-04 14:19:17 UTC
> This is a patch to be applied against the source of a 5.12.x kernel. You 
> would then need to compile, install, and boot to this kernel.
> 
> There are likely instructions on the net to help you do this with your 
> distribution. However, if this is something you're not comfortable with, 
> I'd suggest waiting these fixes to eventually make it into the kernel.
> 
> In the meantime, there is a temporary work around with applying the 
> verbs (you'd want the vebs for your model of laptop). There are caveats 
> with the "applying the verbs" method that are discussed in the bug.

Thank you for those instructions.
I was able to get the sound working on my 13s gen2 ! I'm using Fedora 34 and applied the patch to kernel 5.12.14.

I'm finding the sound quality to not be as good as it is on windows oem install.
Also the volume controls are overshooting which makes it hard to control. 
Are there any improvements that can be made ?

The sound cuts off before reaching the lowest volume on the volume control. Is there a way to adjust the scale ?
Comment 353 Cameron Berkenpas 2021-07-04 15:43:55 UTC
The 13s verbs aren't in a good state and are in no condition to attempt 
any sort of inclusion into the kernel IMO. You're going to have to 
experiment with applying the 13s verbs in debug mode. Look for sycxyc's 
posts for some potential insights into this.

As far as the quality, this may be due to the verbs needing to be 
cleaned up, the more advanced audio features of your laptop not being 
supported by Linux, or some combination of both. For example, in the 
case of the 2020 Legion, I've found that audio quality between Linux and 
Windows is about equal if you disable Dolby audio in Windows. Dolby 
isn't supported Linux AFAIK at this time.

On 7/4/21 7:19 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #352 from waterproof93@outlook.com ---
>> This is a patch to be applied against the source of a 5.12.x kernel. You
>> would then need to compile, install, and boot to this kernel.
>>
>> There are likely instructions on the net to help you do this with your
>> distribution. However, if this is something you're not comfortable with,
>> I'd suggest waiting these fixes to eventually make it into the kernel.
>>
>> In the meantime, there is a temporary work around with applying the
>> verbs (you'd want the vebs for your model of laptop). There are caveats
>> with the "applying the verbs" method that are discussed in the bug.
> Thank you for those instructions.
> I was able to get the sound working on my 13s gen2 ! I'm using Fedora 34 and
> applied the patch to kernel 5.12.14.
>
> I'm finding the sound quality to not be as good as it is on windows oem
> install.
> Also the volume controls are overshooting which makes it hard to control.
> Are there any improvements that can be made ?
>
> The sound cuts off before reaching the lowest volume on the volume control.
> Is
> there a way to adjust the scale ?
>
Comment 354 Roland 2021-07-04 15:45:24 UTC
(In reply to Roland from comment #351)

I've failed to get the sound card running in the windows guest and created a separate report for the ACL711 in bug #213641
Comment 355 Cameron Berkenpas 2021-07-04 15:46:55 UTC
It can be a lot of effort figuring out how to force Windows to use the 
correct drivers for the device. Unfortunately at this stage, there is no 
fixed set of steps since it seems to at least partially vary between 
laptop models.

On 7/4/21 8:45 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #354 from Roland (kernel@tmp.dau-sicher.de) ---
> (In reply to Roland from comment #351)
>
> I've failed to get the sound card running in the windows guest and created a
> separate report for the ACL711 in bug #213641
>
Comment 356 Ganesh Kadam 2021-07-04 19:13:28 UTC
Hi Cameron,

Thanks for the inputs so far.

> >>
> >> Thank you for your feedback. Can you share your alsa-info?
> >>
> >> When you say post update, do you mean applying the latest patch attached
> to
> >> this bug report or are you referring to the latest kernel update for
> Fedora
> >> Rawhide?
> > I just performed, a regular system update, using dnf update command, and
> > after
> > all the packages were installed, I reboot the system, since then my sound
> > cards
> > are not being detected.
> >
> > Here is the alsa-info:
> > ~~~
> > http://alsa-project.org/db/?f=06e581149a25224e881b43b0b72f6439d13cde3a
> > ~~~
> 

I performed another system update, and later on, reboot my system, now the sound cards are working perfectly fine. 

This behaviour I observed was on the below kernel version:
~~~
kernel-core-5.13.0-0.rc5.20210611git929d931f2b40.42.fc35.x86_64
~~~

Now, I have this version, which resolved the issue:
~~~
kernel-core-5.14.0-0.rc0.20210701gitdbe69e433722.6.fc35.x86_64
~~~



BR,
Ganesh Kadam
Comment 357 Cameron Berkenpas 2021-07-13 04:21:57 UTC
Created attachment 297807 [details]
linux-5.12-legion-sound-0.0.9.patch - Improved 13s Gen 2 support

Big thanks for Vince Morel for providing cleaned up verbs for initialization on the 13s Gen2. We're down from around 400 to just 14!

13s Gen2 users, please test. Please ensure that audio still works after unplugging headphones and report on quality as well. When comparing audio quality, please disable any advanced audio features (such as Dolby) under Vantage as such features are unlikely to be supported under Linux anyway (Dolby is unsupported for example).

Now for some bad news. Between my job and family, I really don't have time to keep trying to figure out how to get this work into the kernel especially when I don't even get any responses back at all. Probably tonight, I'll re-share this patch as a patchset of 3 in case anyone else wants to give it a shot, but I really just don't have the time anymore.

And for good news, I'll likely have a 2021 Lenovo Legion at some point in August (the order has been placed since early July, but who knows when I'll actually receive it due to all the supply issues). Once I have that, I'll do this one more time and try to get sound working there as well.

Once I can start the process with the 2021 Legion, I'll finish up the documentation work that I have in the pipeline. I'll document the process as I go through it again to make sure all is complete.
Comment 358 Cameron Berkenpas 2021-07-13 04:26:05 UTC
Created attachment 297809 [details]
linux-5.12-legion-sound-0.0.9-001.patch

First patch in the series. Adds 2020 Lenovo Legion support.
Comment 359 Cameron Berkenpas 2021-07-13 04:26:41 UTC
Created attachment 297811 [details]
linux-5.12-legion-sound-0.0.9-002.patch

This adds Yoga 7 support.
Comment 360 Cameron Berkenpas 2021-07-13 04:27:35 UTC
Created attachment 297813 [details]
linux-5.12-legion-sound-0.0.9-003.patch

This patch adds 13s Gen2 support.

Applying the following patches:
linux-5.12-legion-sound-0.0.9-001.patch
linux-5.12-legion-sound-0.0.9-002.patch
linux-5.12-legion-sound-0.0.9-003.patch

Is exactly the same as only applying:
linux-5.12-legion-sound-0.0.9.patch
Comment 361 waterproof93 2021-07-13 17:16:49 UTC
Just installed the latest patch for 13SGen2.

Firstly, applying the patch linux-5.12-legion-sound-0.0.9-003.patch leads to some errors :

patch -p1 < linux-5.12-legion-sound-0.0.9-003.patch 

patching file sound/pci/hda/patch_realtek.c
Hunk #1 succeeded at 6352 with fuzz 2 (offset -6 lines).
Hunk #2 FAILED at 6573.
Hunk #3 succeeded at 8145 with fuzz 2 (offset -27 lines).
Hunk #4 FAILED at 8558.
2 out of 4 hunks FAILED -- saving rejects to file sound/pci/hda/patch_realtek.c.rej
patching file sound/pci/hda/thinkbook_13s_gen2_itl_coefs.c

So I directly applied linux-5.12-legion-sound-0.0.9.patch and was able to compile and install with no error.

The speaker sound is definitely better, the overshoot on the volume control is manageable.
Its hard to compare to windows because of Dolby, but its close.

The sound works after unplugging headphones (tried it multiple times).
The headphone sound still has some cracking noise and the bug on the volume control reappears (at least from what I tested). The sound on headphone is still pretty good.

I noticed a bug, rebooting the computer with an HDMI cable plugged in removes completely the sound card. This bug was also present in version 0.0.7 of the patch.
Comment 362 Cameron Berkenpas 2021-07-13 17:19:12 UTC
What is the volume overshoot you're talking about? Probably missing the 
verbs to set something up there.

Same goes for the HDMI probably... I hadn't thought to test even my 
laptop against HDMI as I never use it and don't really have a convenient 
way to test.

Not sure what the problem with the patches is... I tried all 3 in order 
last night and they were fine.

On 7/13/21 10:16 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #361 from waterproof93@outlook.com ---
> Just installed the latest patch for 13SGen2.
>
> Firstly, applying the patch linux-5.12-legion-sound-0.0.9-003.patch leads to
> some errors :
>
> patch -p1 < linux-5.12-legion-sound-0.0.9-003.patch
>
> patching file sound/pci/hda/patch_realtek.c
> Hunk #1 succeeded at 6352 with fuzz 2 (offset -6 lines).
> Hunk #2 FAILED at 6573.
> Hunk #3 succeeded at 8145 with fuzz 2 (offset -27 lines).
> Hunk #4 FAILED at 8558.
> 2 out of 4 hunks FAILED -- saving rejects to file
> sound/pci/hda/patch_realtek.c.rej
> patching file sound/pci/hda/thinkbook_13s_gen2_itl_coefs.c
>
> So I directly applied linux-5.12-legion-sound-0.0.9.patch and was able to
> compile and install with no error.
>
> The speaker sound is definitely better, the overshoot on the volume control
> is
> manageable.
> Its hard to compare to windows because of Dolby, but its close.
>
> The sound works after unplugging headphones (tried it multiple times).
> The headphone sound still has some cracking noise and the bug on the volume
> control reappears (at least from what I tested). The sound on headphone is
> still pretty good.
>
> I noticed a bug, rebooting the computer with an HDMI cable plugged in removes
> completely the sound card. This bug was also present in version 0.0.7 of the
> patch.
>
Comment 363 Vincent Morel 2021-07-13 17:34:03 UTC
(In reply to waterproof93 from comment #361)
> Just installed the latest patch for 13SGen2.
> 
> Firstly, applying the patch linux-5.12-legion-sound-0.0.9-003.patch leads to
> some errors :
> 
> patch -p1 < linux-5.12-legion-sound-0.0.9-003.patch 
> 
> patching file sound/pci/hda/patch_realtek.c
> Hunk #1 succeeded at 6352 with fuzz 2 (offset -6 lines).
> Hunk #2 FAILED at 6573.
> Hunk #3 succeeded at 8145 with fuzz 2 (offset -27 lines).
> Hunk #4 FAILED at 8558.
> 2 out of 4 hunks FAILED -- saving rejects to file
> sound/pci/hda/patch_realtek.c.rej
> patching file sound/pci/hda/thinkbook_13s_gen2_itl_coefs.c
> 
> So I directly applied linux-5.12-legion-sound-0.0.9.patch and was able to
> compile and install with no error.
> 
> The speaker sound is definitely better, the overshoot on the volume control
> is manageable.
> Its hard to compare to windows because of Dolby, but its close.
> 
> The sound works after unplugging headphones (tried it multiple times).
> The headphone sound still has some cracking noise and the bug on the volume
> control reappears (at least from what I tested). The sound on headphone is
> still pretty good.
> 
> I noticed a bug, rebooting the computer with an HDMI cable plugged in
> removes completely the sound card. This bug was also present in version
> 0.0.7 of the patch.

I think HDMI should not rely to those verb, probably another bug here. :) I will test it with hdmi, I admit I did not test hdmi connection (but I can with my 27" monitor)...
Comment 364 Cameron Berkenpas 2021-07-13 17:53:38 UTC
But the HDMI issue wasn't in 0.0.8? Probably some re-initialization is 
missing with only these verbs.


On 7/13/21 10:34 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #363 from Vincent Morel (dantahoua@gmail.com) ---
> (In reply to waterproof93 from comment #361)
>> Just installed the latest patch for 13SGen2.
>>
>> Firstly, applying the patch linux-5.12-legion-sound-0.0.9-003.patch leads to
>> some errors :
>>
>> patch -p1 < linux-5.12-legion-sound-0.0.9-003.patch
>>
>> patching file sound/pci/hda/patch_realtek.c
>> Hunk #1 succeeded at 6352 with fuzz 2 (offset -6 lines).
>> Hunk #2 FAILED at 6573.
>> Hunk #3 succeeded at 8145 with fuzz 2 (offset -27 lines).
>> Hunk #4 FAILED at 8558.
>> 2 out of 4 hunks FAILED -- saving rejects to file
>> sound/pci/hda/patch_realtek.c.rej
>> patching file sound/pci/hda/thinkbook_13s_gen2_itl_coefs.c
>>
>> So I directly applied linux-5.12-legion-sound-0.0.9.patch and was able to
>> compile and install with no error.
>>
>> The speaker sound is definitely better, the overshoot on the volume control
>> is manageable.
>> Its hard to compare to windows because of Dolby, but its close.
>>
>> The sound works after unplugging headphones (tried it multiple times).
>> The headphone sound still has some cracking noise and the bug on the volume
>> control reappears (at least from what I tested). The sound on headphone is
>> still pretty good.
>>
>> I noticed a bug, rebooting the computer with an HDMI cable plugged in
>> removes completely the sound card. This bug was also present in version
>> 0.0.7 of the patch.
> I think HDMI should not rely to those verb, probably another bug here. :) I
> will test it with hdmi, I admit I did not test hdmi connection (but I can
> with
> my 27" monitor)...
>
Comment 365 waterproof93 2021-07-13 17:59:47 UTC
(In reply to Cameron Berkenpas from comment #362)
> What is the volume overshoot you're talking about? Probably missing the 
> verbs to set something up there.
> 
> Same goes for the HDMI probably... I hadn't thought to test even my 
> laptop against HDMI as I never use it and don't really have a convenient 
> way to test.
> 
> Not sure what the problem with the patches is... I tried all 3 in order 
> last night and they were fine.

Basically the bug is when you try to change volume (increase or decrease) rapidly after about the third tap, the volume goes directly to the max (or min depending on the direction).

Therefore, it's hard to get to the volume that you want.

This seems to only happen using the laptop keyboard. 
With my mechanical keyboard plugged in I can change the volume without hiccups.

I don't know also about the patch issue. 
I'm patching against the same kernel (5.12.14) every time.

(In reply to Cameron Berkenpas from comment #364)
> But the HDMI issue wasn't in 0.0.8? Probably some re-initialization is 
> missing with only these verbs.

I never tested 0.0.8, so this bug probably applies to it also.
Comment 366 Cameron Berkenpas 2021-07-13 18:01:52 UTC
What about when you change the volume using a software slider, does it 
happen then?

I remember some of the verbs for the Legion/Yoga were related to volume 
control. Maybe this is what they were for?

On 7/13/21 10:59 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #365 from waterproof93@outlook.com ---
> (In reply to Cameron Berkenpas from comment #362)
>> What is the volume overshoot you're talking about? Probably missing the
>> verbs to set something up there.
>>
>> Same goes for the HDMI probably... I hadn't thought to test even my
>> laptop against HDMI as I never use it and don't really have a convenient
>> way to test.
>>
>> Not sure what the problem with the patches is... I tried all 3 in order
>> last night and they were fine.
> Basically the bug is when you try to change volume (increase or decrease)
> rapidly after about the third tap, the volume goes directly to the max (or
> min
> depending on the direction).
>
> Therefore, it's hard to get to the volume that you want.
>
> This seems to only happen using the laptop keyboard.
> With my mechanical keyboard plugged in I can change the volume without
> hiccups.
>
> I don't know also about the patch issue.
> I'm patching against the same kernel (5.12.14) every time.
>
> (In reply to Cameron Berkenpas from comment #364)
>> But the HDMI issue wasn't in 0.0.8? Probably some re-initialization is
>> missing with only these verbs.
> I never tested 0.0.8, so this bug probably applies to it also.
>
Comment 367 waterproof93 2021-07-13 18:07:00 UTC
(In reply to Cameron Berkenpas from comment #366)
> What about when you change the volume using a software slider, does it 
> happen then?
> 
> I remember some of the verbs for the Legion/Yoga were related to volume 
> control. Maybe this is what they were for?

I'm not sure what you mean about a software slider.
There is no issue when sliding the volume using the gnome panel for example.
It's smooth, every increment on the volume works and I can stop anywhere on the slider.
Comment 368 Cameron Berkenpas 2021-07-13 18:33:42 UTC
Sliding the volume control in the Gnome Panel is exactly what I mean. 
Thanks for letting me know.

On 7/13/21 11:07 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #367 from waterproof93@outlook.com ---
> (In reply to Cameron Berkenpas from comment #366)
>> What about when you change the volume using a software slider, does it
>> happen then?
>>
>> I remember some of the verbs for the Legion/Yoga were related to volume
>> control. Maybe this is what they were for?
> I'm not sure what you mean about a software slider.
> There is no issue when sliding the volume using the gnome panel for example.
> It's smooth, every increment on the volume works and I can stop anywhere on
> the
> slider.
>
Comment 369 tate.austin 2021-07-23 00:36:37 UTC
I've created a post Lenovo's forums for this issue, I hope someone at Lenovo with answers sees this:

https://forums.lenovo.com/t5/Gaming-Laptops/Lenovo-Legion-7-s-speaker-configuration-doesn-t-seem-to-be-supported-under-linux/m-p/5089952
Comment 370 Dre 2021-07-25 02:51:39 UTC
Just FYI, the S3 Sleep fix in the Arch Wiki for the Yoga 7i appears to no longer work.
Comment 371 Marcus 2021-07-26 17:09:13 UTC
Some update on de Legion 7 16ACHg6 (AMD Ryzen 5000), I finally got the QEMU VM working, the IOMMU groups were really bad grouped for the sound card. But started and got the HDA verbs. But still no sound, in the VM is also no sound. The Cirrus Logic amplifier needs to be initialized on this board. Got the driver but the VM doesn't pick it up. After some searching in the drivers it seems that this chip is controlled by I2C/GPIO through ACPI. 

Decoded the DSDT table in ACPI and found the following:
   Scope (_SB.I2CD)
    {
        Device (SPKR)
        {
            Name (_HID, "CLSA0100")  // _HID: Hardware ID
            Name (_UID, One)  // _UID: Unique ID
            Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource Settings
            {
                Name (RBUF, ResourceTemplate ()
                {
                    I2cSerialBusV2 (0x0040, ControllerInitiated, 0x000F4240,
                        AddressingMode7Bit, "\\_SB.I2CD",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    I2cSerialBusV2 (0x0041, ControllerInitiated, 0x000F4240,
                        AddressingMode7Bit, "\\_SB.I2CD",
                        0x00, ResourceConsumer, , Exclusive,
                        )
                    GpioIo (Exclusive, PullDown, 0x0000, 0x0000, IoRestrictionOutputOnly,
                        "\\_SB.GPIO", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0006
                        }
                    GpioIo (Shared, PullUp, 0x0064, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPIO", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0054
                        }
                    GpioIo (Exclusive, PullUp, 0x0000, 0x0000, IoRestrictionInputOnly,
                        "\\_SB.GPIO", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0091
                        }
                    GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
                        "\\_SB.GPIO", 0x00, ResourceConsumer, ,
                        )
                        {   // Pin list
                            0x0054
                        }
                })
                Return (RBUF) /* \_SB_.I2CD.SPKR._CRS.RBUF */
            }

            Method (_STA, 0, NotSerialized)  // _STA: Status
            {
                If ((MCSK == 0x04))
                {
                    Return (0x0F)
                }
                Else
                {
                    Return (Zero)
                }
            }

            Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
            {
            }
        }
    }


Is there anyone that can help me from here on? Now I've no idea what to do, how to set the GPIO pins of this device from linux, maybe that works. There are also some init sequences and blobs from the Cirrus Logic drivers. Or can this be debugged from Windows in any way?
Comment 372 Cameron Berkenpas 2021-07-26 17:21:00 UTC
It seems everyone who's done this so far (including myself) had to 
really work at getting Windows to use the correct driver for the device. 
Likely, you'll have to do the same.

I had to go into the device manager and figure out how get things 
working. I have some notes in this bug in what I had to do, others had 
to do similar steps but not exactly the same.

Under my branch, I have notes on the steps I was able to use for the 
2020 Legion:
https://github.com/thiagotei/linux-realtek-alc287/tree/cameron/lenovo-legion

Take a look at the "Getting sound working under Windows" section.

I haven't worked on my branch for a while because I'm waiting to repeat 
this process again once I have my 2021 Legion. Unfortunately, I am 
likely cancelling my 2021 Legion order soon as they've pushed the ship 
date out to many months (*after* customer service confirmed I'd have it 
in August or September) . I'm just waiting to hear back for confirmation 
on the new shipping date from Lenovo's customer service.

On 7/26/21 10:09 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> Marcus (kernel@m.vb1.nl) changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |kernel@m.vb1.nl
>
> --- Comment #371 from Marcus (kernel@m.vb1.nl) ---
> Some update on de Legion 7 16ACHg6 (AMD Ryzen 5000), I finally got the QEMU
> VM
> working, the IOMMU groups were really bad grouped for the sound card. But
> started and got the HDA verbs. But still no sound, in the VM is also no
> sound.
> The Cirrus Logic amplifier needs to be initialized on this board. Got the
> driver but the VM doesn't pick it up. After some searching in the drivers it
> seems that this chip is controlled by I2C/GPIO through ACPI.
>
> Decoded the DSDT table in ACPI and found the following:
>     Scope (_SB.I2CD)
>      {
>          Device (SPKR)
>          {
>              Name (_HID, "CLSA0100")  // _HID: Hardware ID
>              Name (_UID, One)  // _UID: Unique ID
>              Method (_CRS, 0, NotSerialized)  // _CRS: Current Resource
>              Settings
>              {
>                  Name (RBUF, ResourceTemplate ()
>                  {
>                      I2cSerialBusV2 (0x0040, ControllerInitiated, 0x000F4240,
>                          AddressingMode7Bit, "\\_SB.I2CD",
>                          0x00, ResourceConsumer, , Exclusive,
>                          )
>                      I2cSerialBusV2 (0x0041, ControllerInitiated, 0x000F4240,
>                          AddressingMode7Bit, "\\_SB.I2CD",
>                          0x00, ResourceConsumer, , Exclusive,
>                          )
>                      GpioIo (Exclusive, PullDown, 0x0000, 0x0000,
> IoRestrictionOutputOnly,
>                          "\\_SB.GPIO", 0x00, ResourceConsumer, ,
>                          )
>                          {   // Pin list
>                              0x0006
>                          }
>                      GpioIo (Shared, PullUp, 0x0064, 0x0000,
> IoRestrictionInputOnly,
>                          "\\_SB.GPIO", 0x00, ResourceConsumer, ,
>                          )
>                          {   // Pin list
>                              0x0054
>                          }
>                      GpioIo (Exclusive, PullUp, 0x0000, 0x0000,
> IoRestrictionInputOnly,
>                          "\\_SB.GPIO", 0x00, ResourceConsumer, ,
>                          )
>                          {   // Pin list
>                              0x0091
>                          }
>                      GpioInt (Edge, ActiveBoth, Shared, PullUp, 0x0064,
>                          "\\_SB.GPIO", 0x00, ResourceConsumer, ,
>                          )
>                          {   // Pin list
>                              0x0054
>                          }
>                  })
>                  Return (RBUF) /* \_SB_.I2CD.SPKR._CRS.RBUF */
>              }
>
>              Method (_STA, 0, NotSerialized)  // _STA: Status
>              {
>                  If ((MCSK == 0x04))
>                  {
>                      Return (0x0F)
>                  }
>                  Else
>                  {
>                      Return (Zero)
>                  }
>              }
>
>              Method (_DIS, 0, NotSerialized)  // _DIS: Disable Device
>              {
>              }
>          }
>      }
>
>
> Is there anyone that can help me from here on? Now I've no idea what to do,
> how
> to set the GPIO pins of this device from linux, maybe that works. There are
> also some init sequences and blobs from the Cirrus Logic drivers. Or can this
> be debugged from Windows in any way?
>
Comment 373 Marcus 2021-07-26 18:00:27 UTC
Hi Cameron,

I already did that step to make sure that the Lenovo drivers are used. I just reinstalled the drivers but still no sound from the VM. I also really hope that is just a driver issue in Windows so that this can be fixed sort of soon. 

I already start JCS QEMU as mentioned on your link. I've only one warning on startup is that the device cannot be reset, I've no idea if that is the culprit at the moment.
Comment 374 Cameron Berkenpas 2021-07-26 20:13:18 UTC
The device cannot reset isn't a problem. Occasionally, when 
experimenting with verbs, you can wedge the sound card hard enough that 
even restarting your laptop won't cause it to recover. You'll have to 
fully power the laptop off and then power it back on before it will work 
again. I suspect this is due to the device not being able to reset, but 
even in my tons of testing, this happened only a few times.

On 7/26/21 11:00 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #373 from Marcus (kernel@m.vb1.nl) ---
> Hi Cameron,
>
> I already did that step to make sure that the Lenovo drivers are used. I just
> reinstalled the drivers but still no sound from the VM. I also really hope
> that
> is just a driver issue in Windows so that this can be fixed sort of soon.
>
> I already start JCS QEMU as mentioned on your link. I've only one warning on
> startup is that the device cannot be reset, I've no idea if that is the
> culprit
> at the moment.
>
Comment 375 darnellkeithj 2021-08-04 23:01:20 UTC
Thought i'd reinstall linux to see if there were any changes with this Yoga Duet 7i. Still no sound with the newer kernels but 5.4.88-1-lts with Arch "Arco"linux does works every time. Microphone does not work. Why it works in 5.488-1-lts and not newer is beyond me. Why devs haven't compared the two and fixed it is also puzzling.
Comment 376 Cameron Berkenpas 2021-08-07 05:49:06 UTC
Updates:
Both of the 2021 Legion's (the AMD based Legion 7 16ACHg6 and the Intel based Legion 7i 16ITHg6) have sound issues under Linux.

Sound doesn't work at all under the AMD based 16ACHg6, and sound partially works under the Intel based 16ITHg6.

In the case of the Intel based 16ITHg6, sound works until you suspend to memory. Plugging in and removing headphones doesn't affect speaker output (so far). Probably the BIOS initializes the amp at book, but not at resume. For now, I'm using hibernate instead of suspending to memory.

Both laptops appear to have Cirrus Logic CS35L51 amplifier chips. There is presently no Linux support for this chip, and no publicly available datasheets as of yet. However, a driver is currently in the works for the CS35L41:
https://www.spinics.net/lists/alsa-devel/msg129286.html

So maybe we'll eventually see support for the CS35L51.

This means the audio output issues with the 2021 Legion lines are unrelated to this bug or at least the ongoing work that has occurred under this bug. I will eventually update the document to reflect the state of audio are the 2021 Legion's and what we present know here:
https://github.com/thiagotei/linux-realtek-alc287

Huge thanks to Marcus Aram who discovered the amplifier chip and its model and has been working towards getting this resolved.
Comment 377 Gene 2021-08-11 04:59:37 UTC
I just want to thank you all for the work on this issue. I have a Lenovo 7i and am eagerly awaiting this fix to be accepted into the kernel so I can use Linux as my main.
Comment 378 Cameron Berkenpas 2021-08-11 17:35:14 UTC
Unfortunately, that's not going to happen. I tried to post my patches, 
and I never received even any sort of feedback. I've dedicated about as 
much time to this as I'm able to at this point, so unless it's something 
that only requires a modicum of time, there's not much else I'm able to do.

On 8/10/21 9:59 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> Gene (unmotivatedgene+kernel@gmail.com) changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |unmotivatedgene+kernel@gmai
>                     |                            |l.com
>
> --- Comment #377 from Gene (unmotivatedgene+kernel@gmail.com) ---
> I just want to thank you all for the work on this issue. I have a Lenovo 7i
> and
> am eagerly awaiting this fix to be accepted into the kernel so I can use
> Linux
> as my main.
>
Comment 379 Takashi Iwai 2021-08-12 06:12:25 UTC
(In reply to Cameron Berkenpas from comment #378)
> Unfortunately, that's not going to happen. I tried to post my patches, 
> and I never received even any sort of feedback.

You overlooked my comment..?
https://lore.kernel.org/alsa-devel/s5hy2ah5dkb.wl-tiwai@suse.de/
Comment 380 Cameron Berkenpas 2021-08-12 16:06:13 UTC
Hi Takashi Iwai,

I never received your comment! I even tried to follow up at one point to see if I just wasn't getting the email so not sure how I missed this. I'll try to work on the patch this weekend.

One question: I don't see "AC_VERB_SET_COEF" defined anywhere. Did you mean "AC_VERB_SET_COEF_INDEX"?

Thank you!!
Comment 381 Takashi Iwai 2021-08-12 16:43:33 UTC
Sorry, it was a typo of AC_VERB_SET_PROC_COEF.

In short, { 0x4XX, 0xYY } is equivalent with { AC_VERB_SET_PROC_COEF, 0xXXYY }
and { 0x5XX, 0xYY } is a combo of { AC_VERB_SET_COEF_INDEX, 0xXXYY }
Comment 382 Marcus 2021-08-13 09:41:00 UTC
Created attachment 298307 [details]
16achverbs2.txt

For what is worth, here eare the verbs. These are from 16ACHg6 Legion 7 2021. 
Got them from running a Windows VM with IOMMU PCI passthrough.

These only trigger the RGB lightning on the keyboard if you select the light 
modus that responds to sound.

Hope that some can get some stuff working on this machine.
Comment 383 Marcus 2021-08-13 09:41:05 UTC
Created attachment 298309 [details]
16achverbs.txt
Comment 384 Marcus 2021-08-13 09:41:05 UTC
Created attachment 298311 [details]
16achverbs3.txt
Comment 385 Marcus 2021-08-13 09:41:05 UTC
Created attachment 298313 [details]
16achverbs4.txt
Comment 386 Cameron Berkenpas 2021-08-17 17:48:32 UTC
Created attachment 298337 [details]
linux-5.13-legion-yoga-14ITL5-sound-0.0.10-001.patch

linux-5.13-legion-yoga-14ITL5-sound-0.0.10-001.patch

Adds speaker output for the 2020 Legion and the Yoga 7i. This is based against the Linux 5.13 series and incorporates Takashi's suggestions.

It compiles, but I haven't been able to test this. I might be able to get ahold of the old 2020 Legion for testing later this week (I'm not on the 2021 Legion 7i).

Please test and please test with headphone removal on the 2020 Legion.
Comment 387 Cameron Berkenpas 2021-08-17 17:51:46 UTC
Created attachment 298339 [details]
linux-5.13-legion-yoga-14ITL5-sound-0.0.10-001.patch - correct patch

Mistakenly attached an older patch previously. This is the correct patch.

Adds speaker output for the 2020 Legion and the Yoga 7i. This is based against the Linux 5.13 series and incorporates Takashi's suggestions.

It compiles, but I haven't been able to test this. I might be able to get ahold of the old 2020 Legion for testing later this week (I'm not on the 2021 Legion 7i).

Please test and please test with headphone removal on the 2020 Legion as I'm unable to for the time being.
Comment 388 Cameron Berkenpas 2021-08-17 17:53:19 UTC
Created attachment 298341 [details]
linux-5.13-legion-13s-gen2-sound-0.0.10-002.patch

Adds speaker output for the 13s gen2. This is based against the Linux 5.13 series and incorporates Takashi's suggestions.

This is still in a separate patch as it seems volume control (using keyboard shortcuts I think..?) are a bit wonky so unsure if this will eventually be included if this remains unchanged.
Comment 389 Max 2021-08-18 02:05:19 UTC
I have tested the patch from comment 387 on a humble Yoga 7 14TL5 (not Legion, BIOS version F5CN40WW & F5CN49WW) and I get sound out of the right speaker only (thank you!). I have also tried plugging and unplugging a jack and that switches correctly back and forth between headphones and speaker(s).



(In reply to Cameron Berkenpas from comment #387)
> Created attachment 298339 [details]
> linux-5.13-legion-yoga-14ITL5-sound-0.0.10-001.patch - correct patch
> 
> Mistakenly attached an older patch previously. This is the correct patch.
> 
> Adds speaker output for the 2020 Legion and the Yoga 7i. This is based
> against the Linux 5.13 series and incorporates Takashi's suggestions.
> 
> It compiles, but I haven't been able to test this. I might be able to get
> ahold of the old 2020 Legion for testing later this week (I'm not on the
> 2021 Legion 7i).
> 
> Please test and please test with headphone removal on the 2020 Legion as I'm
> unable to for the time being.
Comment 390 Cameron Berkenpas 2021-08-19 14:23:55 UTC
Created attachment 298363 [details]
linux-max.patch - Based on the 0.0.10 with fixed Yoga 7i support

Max was able to get both speakers working again. Here is his patch.

I was able to test the 0.0.10 patch on the 2020 Legion, and both speakers work. Not sure why 0.0.10 broke right speaker output on the Yoga when sound initialization is so similar between the 2 modals... 

When I have some time, I will try some of Max's changes against the Legion.
Comment 391 sycxyc 2021-08-19 15:18:02 UTC
It looks like this patch will set both speakers to the right channel.

(In reply to Cameron Berkenpas from comment #390)
> Created attachment 298363 [details]
> linux-max.patch - Based on the 0.0.10 with fixed Yoga 7i support
> 
> Max was able to get both speakers working again. Here is his patch.
> 
> I was able to test the 0.0.10 patch on the 2020 Legion, and both speakers
> work. Not sure why 0.0.10 broke right speaker output on the Yoga when sound
> initialization is so similar between the 2 modals... 
> 
> When I have some time, I will try some of Max's changes against the Legion.


This may be helpful to you.
https://gist.github.com/184de8b8a860a2b17a497ab82863c37d

(In reply to Max from comment #389)
> I have tested the patch from comment 387 on a humble Yoga 7 14TL5 (not
> Legion, BIOS version F5CN40WW & F5CN49WW) and I get sound out of the right
> speaker only (thank you!). I have also tried plugging and unplugging a jack
> and that switches correctly back and forth between headphones and speaker(s).
Comment 392 Max 2021-08-19 16:22:33 UTC
sycxyc: (In reply to sycxyc from comment #391)
> It looks like this patch will set both speakers to the right channel.
[...]

I can assure you that both speakers are working independently with the patch (I tested it on the hardware with `speaker-test -c2`). But I also see why you say that. According to your gist document it should have been 0x1a in line line 8223 of attachment 298363 [details], right?
Comment 393 Cameron Berkenpas 2021-08-19 16:30:04 UTC
sycxyc,

Did you try patch 0.0.10? I converted the "0x20, 0x4b0, 0x20" lines to "0x20, AC_VERB_SET_PROC_COEF, 0xb020" and this seemed to break right speaker output on the Yoga 7i.

Strangely, this didn't cause problems for the Legion, but I still want to try some of Max's changes to see if there are any differences.


On 8/19/21 9:22 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #392 from Max (accounts@wireme.de) ---
> sycxyc: (In reply to sycxyc from comment #391)
>> It looks like this patch will set both speakers to the right channel.
> [...]
>
> I can assure you that both speakers are working independently with the patch
> (I
> tested it on the hardware with `speaker-test -c2`). But I also see why you
> say
> that. According to your gist document it should have been 0x1a in line line
> 8223 of attachment 298363 [details], right?
>
Comment 394 sycxyc 2021-08-19 17:22:07 UTC
Right. When using the verbs in the patch on my hardware, both speakers only have sound when `speaker-test -c2` tests "Front Right".

(In reply to Max from comment #392)
> I can assure you that both speakers are working independently with the patch
> (I tested it on the hardware with `speaker-test -c2`). But I also see why
> you say that. According to your gist document it should have been 0x1a in
> line line 8223 of attachment 298363 [details], right?



I replace "0x20 0x4b0 0x20" with "0x20 0x400 0xb020" and there seems to be no problem. (I only used applyverbs.py to test it.)

(In reply to Cameron Berkenpas from comment #393)
> sycxyc,
> 
> Did you try patch 0.0.10? I converted the "0x20, 0x4b0, 0x20" lines to
> "0x20, AC_VERB_SET_PROC_COEF, 0xb020" and this seemed to break right speaker
> output on the Yoga 7i.
Comment 395 lazertag 2021-08-19 19:45:07 UTC
On a Yoga 7-14ITL5 Ideapad (82BH) here.  The patches in this thread are for this device too?

Installed a clean ubuntu 21.04 and dist-upgrade.  I then tried using the 'linux-max.patch' based on comment 282.  That is correct in how to use this patch or is this a kernel patch?  If it is just a sound patch, I had no change at all as to speakers working. no sound at all from them.

thanks for all the work you all are doing to try and get these devices properly working.
Comment 396 Cameron Berkenpas 2021-08-19 20:01:46 UTC
No, you need to apply this patch against kernel source and compile your 
own kernel. Once the last issues are ironed out, I'll work on getting 
the patches merged.

On 8/19/2021 12:45 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> lazertag@gmail.com changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |lazertag@gmail.com
>
> --- Comment #395 from lazertag@gmail.com ---
> On a Yoga 7-14ITL5 Ideapad (82BH) here.  The patches in this thread are for
> this device too?
>
> Installed a clean ubuntu 21.04 and dist-upgrade.  I then tried using the
> 'linux-max.patch' based on comment 282.  That is correct in how to use this
> patch or is this a kernel patch?  If it is just a sound patch, I had no
> change
> at all as to speakers working. no sound at all from them.
>
> thanks for all the work you all are doing to try and get these devices
> properly
> working.
>
Comment 397 Max 2021-08-20 09:17:54 UTC
Created attachment 298379 [details]
little modification to the `linux-max.patch` to fix sound for Legion 7i, S740, Yoga 9i

Beware of a misunderstanding. With patch 0.0.10 alias `linux-5.13-legion-yoga-14ITL5-sound-0.0.10-001.patch - correct patch` only the right speaker was working for me, the left one did not on the `Yoga 7 14ITL5`, which is how my model is called according to the back plate. It also has stickers on it, calling it a `YOGA 7i`.

I restructured the patch code a little and there was this comment `set right speaker Yoga 7i.`, but that was not sitting in the middle of the code block: The code block for the left speaker was shorter, so that I compared line by line what was missing and finally copied the difference from the right speaker to the left. I compiled the kernel with that and tested it on my hardware and it works - on a Yoga 7i that is.

The gist document from @sycxyc gives me a better understanding of what the code does and by the looks of it: `set the speaker` and `activate speaker` for both channels. But there are twopossibilities to `set the speaker` in the document and one is dedicated to the Yoga 7i only. Both possibilities are implemented in the patch in the same code block, so that changes for one model can influence another and I made a mistake, which could be a problem with other models: The attachment 298363 [details], line 8223 should have been `0x1a` instead of `0x2a` to select the correct speaker before activating a speaker.

Attached is a patch called `linux-max-untested.patch` with the little change I mentioned. It should fix problem with other models and it should still work with the Yoga 7i. However it is untested, because I currently have no time to compile the kernel again.

Have fun and good luck.
Comment 398 Gene 2021-08-20 15:21:44 UTC
Hey Max, I think you forgot to edit the patch file fully. It would not apply until i edited it from:

Change line 36
@@ -8182,6 +8199,73 @@ static const struct hda_fixup alc269_fixups[] = {
To
@@ -8182,6 +8199,82 @@ static const struct hda_fixup alc269_fixups[] = {

Attempting compilation now.

(In reply to Max from comment #397)
> Created attachment 298379 [details]
> little modification to the `linux-max.patch` to fix sound for Legion 7i,
> S740, Yoga 9i
> 
> Beware of a misunderstanding. With patch 0.0.10 alias
> `linux-5.13-legion-yoga-14ITL5-sound-0.0.10-001.patch - correct patch` only
> the right speaker was working for me, the left one did not on the `Yoga 7
> 14ITL5`, which is how my model is called according to the back plate. It
> also has stickers on it, calling it a `YOGA 7i`.
> 
> I restructured the patch code a little and there was this comment `set right
> speaker Yoga 7i.`, but that was not sitting in the middle of the code block:
> The code block for the left speaker was shorter, so that I compared line by
> line what was missing and finally copied the difference from the right
> speaker to the left. I compiled the kernel with that and tested it on my
> hardware and it works - on a Yoga 7i that is.
> 
> The gist document from @sycxyc gives me a better understanding of what the
> code does and by the looks of it: `set the speaker` and `activate speaker`
> for both channels. But there are twopossibilities to `set the speaker` in
> the document and one is dedicated to the Yoga 7i only. Both possibilities
> are implemented in the patch in the same code block, so that changes for one
> model can influence another and I made a mistake, which could be a problem
> with other models: The attachment 298363 [details], line 8223 should have
> been `0x1a` instead of `0x2a` to select the correct speaker before
> activating a speaker.
> 
> Attached is a patch called `linux-max-untested.patch` with the little change
> I mentioned. It should fix problem with other models and it should still
> work with the Yoga 7i. However it is untested, because I currently have no
> time to compile the kernel again.
> 
> Have fun and good luck.
Comment 399 Horacio Merovich 2021-08-20 17:04:41 UTC
Hi 

I installed Ubuntu 20.04 on my Lenovo AIO A540 24ICB and my internal speakers doesnt sound.

I get sound using ext speakers connected to the audio jack .

I think that the problem si very similar to the problmes described here on other Lenovo machines but after reading the information here I am not sure which patch can I try.

Please can you help me to find which patch can I try?

I am attaching the alsa-info.txt form my machine.

Best regards and thanks in advance for your help

Horacio Merovich
Comment 400 Horacio Merovich 2021-08-20 17:05:04 UTC
Hi 

I installed Ubuntu 20.04 on my Lenovo AIO A540 24ICB and my internal speakers doesnt sound.

I get sound using ext speakers connected to the audio jack .

I think that the problem si very similar to the problmes described here on other Lenovo machines but after reading the information here I am not sure which patch can I try.

Please can you help me to find which patch can I try?

I am attaching the alsa-info.txt form my machine.

Best regards and thanks in advance for your help

Horacio Merovich
Comment 401 Horacio Merovich 2021-08-20 17:06:35 UTC
Created attachment 298397 [details]
alsa-info.txt from Lenovo A540-24ICB
Comment 402 Cameron Berkenpas 2021-08-20 18:03:20 UTC
On 8/19/21 10:22 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
>
> I replace "0x20 0x4b0 0x20" with "0x20 0x400 0xb020" and there seems to be no
> problem. (I only used applyverbs.py to test it.)
>
Are you already patching the kernel? Perhaps the right speaker is 
already initialized and that's why it's working
Comment 403 Gene 2021-08-20 20:26:30 UTC
I got the linux-max-untested.patch edited to be valid and then compiled. The speakers work with their correct channels. Wired headphones work as expected and sound switches back to the speakers after unplugging them.

Lenovo 7i (Lenovo 14ITL5)

( my trackpad and touchscreen don't but that is likely just on me not knowing how to compile a kernel properly )


(In reply to Gene from comment #398)
> Hey Max, I think you forgot to edit the patch file fully. It would not apply
> until i edited it from:
> 
> Change line 36
> @@ -8182,6 +8199,73 @@ static const struct hda_fixup alc269_fixups[] = {
> To
> @@ -8182,6 +8199,82 @@ static const struct hda_fixup alc269_fixups[] = {
> 
> Attempting compilation now.
> 
> (In reply to Max from comment #397)
> > Created attachment 298379 [details]
> > little modification to the `linux-max.patch` to fix sound for Legion 7i,
> > S740, Yoga 9i
> > 
...
Comment 404 Jakub Przystasz 2021-08-20 21:36:21 UTC
(In reply to Gene from comment #403)
> I got the linux-max-untested.patch edited to be valid and then compiled. The
> speakers work with their correct channels. Wired headphones work as expected
> and sound switches back to the speakers after unplugging them.
> 
> Lenovo 7i (Lenovo 14ITL5)
> 
> ( my trackpad and touchscreen don't but that is likely just on me not
> knowing how to compile a kernel properly )
> 
> 
> (In reply to Gene from comment #398)
> > Hey Max, I think you forgot to edit the patch file fully. It would not
> apply
> > until i edited it from:
> > 
> > Change line 36
> > @@ -8182,6 +8199,73 @@ static const struct hda_fixup alc269_fixups[] = {
> > To
> > @@ -8182,6 +8199,82 @@ static const struct hda_fixup alc269_fixups[] = {
> > 
> > Attempting compilation now.
> > 
> > (In reply to Max from comment #397)
> > > Created attachment 298379 [details]
> > > little modification to the `linux-max.patch` to fix sound for Legion 7i,
> > > S740, Yoga 9i
> > > 
> ...

I did the same(i suppose) as You, but I don't have sound on my Yoga 7 (15ITL5).
Could you tell me how did you build your kernel?
Comment 405 sycxyc 2021-08-21 07:40:39 UTC
I recompiled snd-hda-codec-realtek.ko using attachment 298363 [details]. When I reboot the Yoga7i both speakers work fine as @Max described. But alfter S3 sleep wake up both speakers become right channel.

I changed `0x2a` to `0x1a` in line 8223 and updated snd-hda-codec-realtek.ko and then both speakers have the correct channel after S3 sleep wakeup.

I assume that the channel will be reset after boot, and the speakers will be conditionally activated after S3 sleep wakeup.

(In reply to Cameron Berkenpas from comment #402)
> On 8/19/21 10:22 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> Are you already patching the kernel? Perhaps the right speaker is 
> already initialized and that's why it's working
Comment 406 Chris 2021-08-21 10:26:26 UTC
Can somebody please explain to someone who doesn't understand the first thing about C and other low-level things what the status of this is. If it's more or less fixed, how do I use a .patch file?

(looking for an explanation suitable for a web developer not a grandma please ^_^)
Comment 407 woody64 2021-08-21 11:31:31 UTC
(In reply to Chris from comment #406)
> Can somebody please explain to someone who doesn't understand the first
> thing about C and other low-level things what the status of this is. If it's
> more or less fixed, how do I use a .patch file?
> 
> (looking for an explanation suitable for a web developer not a grandma
> please ^_^)

Unfortunately it's still on the low level and will find it's way in the standard kernel hopefully.
I have no insight on that yet, but am using one adapted C level patch suitable for my kernels.

If you want to step in and use the available patching offer you need to get familiar with: installing kernel headers and sources, install toolchain, compile kernel and kernel modules, apply patch to kernel module files, install changes modules and test and verify the result.
And that's mainly on C development level ...

One path of source for that maybe:
https://yoursunny.com/t/2018/one-kernel-module/
(but it depends highly on your linux system)

If you are not familiar with that keep your fingers away .... (it will cost some time and can't be explained in detail here since the guys working on that level spend much of their valueable time in solving the issues). 

Alternatively you can try one of the offered hda-verb solutions. Maybe start reading with:
https://bugzilla.kernel.org/show_bug.cgi?id=208555#c241
(but you need to figure out what verb sequence is suitable for your system)
Comment 408 Chris 2021-08-21 12:02:58 UTC
(In reply to woody64 from comment #407)
> (In reply to Chris from comment #406)
> > Can somebody please explain to someone who doesn't understand the first
> > thing about C and other low-level things what the status of this is. If
> it's
> > more or less fixed, how do I use a .patch file?
> > 
> > (looking for an explanation suitable for a web developer not a grandma
> > please ^_^)
> 
> Unfortunately it's still on the low level and will find it's way in the
> standard kernel hopefully.
> I have no insight on that yet, but am using one adapted C level patch
> suitable for my kernels.
> 
> If you want to step in and use the available patching offer you need to get
> familiar with: installing kernel headers and sources, install toolchain,
> compile kernel and kernel modules, apply patch to kernel module files,
> install changes modules and test and verify the result.
> And that's mainly on C development level ...
> 
> One path of source for that maybe:
> https://yoursunny.com/t/2018/one-kernel-module/
> (but it depends highly on your linux system)
> 
> If you are not familiar with that keep your fingers away .... (it will cost
> some time and can't be explained in detail here since the guys working on
> that level spend much of their valueable time in solving the issues). 
> 
> Alternatively you can try one of the offered hda-verb solutions. Maybe start
> reading with:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555#c241
> (but you need to figure out what verb sequence is suitable for your system)

Thank you so much for your detailed response :) that all seems a bit beyond me. Was hoping it would just be a few lines in the terminal to make use of the work here. What's the "standard kernel"? Is that the core that all Linux distros build on top of? If that's the case I suppose it'll be a few years before people like me can use fully-functioning Linux on their computers T_T
Comment 409 woody64 2021-08-21 12:53:12 UTC
(In reply to Chris from comment #408)
> (In reply to woody64 from comment #407)
> 
> Thank you so much for your detailed response :) that all seems a bit beyond
> me. Was hoping it would just be a few lines in the terminal to make use of
> the work here. What's the "standard kernel"? Is that the core that all Linux


As said you can give the applyverbs (1-liner) a try (not checking what hw you are on and which verbs maybe suitable for you):

applyverbs:
https://github.com/ryanprescott/realtek-verb-tools
huge verb list (starting point): 
https://bugzilla.kernel.org/attachment.cgi?id=297545

shell> sudo python3 realtek-verb-tools/applyverbs.py verbs-working.txt

> distros build on top of? If that's the case I suppose it'll be a few years
> before people like me can use fully-functioning Linux on their computers T_T

Mainly yes, and if it's in then we have a goog chance that it will work for a lot of models in the future.
Here we are deep in kernel stuff and I doubt that you ever have done that under windows but you are nevertheless using it:)
Comment 410 Cameron Berkenpas 2021-08-21 20:45:40 UTC
Are you sure 8,223 is the right line? I don't see 0x2a, I see:
{0x20, AC_VERB_SET_COEF_INDEX, 0x26 },

Maybe you mean 8,221:
{0x20, AC_VERB_SET_PROC_COEF, 0x2a },

Or maybe you're not patching against against 5.13 like I am. :)

On 8/21/21 12:40 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #405 from sycxyc (sycxyc+kernel@yandex.com) ---
> I recompiled snd-hda-codec-realtek.ko using attachment 298363 [details]. When
> I
> reboot the Yoga7i both speakers work fine as @Max described. But alfter S3
> sleep wake up both speakers become right channel.
>
> I changed `0x2a` to `0x1a` in line 8223 and updated snd-hda-codec-realtek.ko
> and then both speakers have the correct channel after S3 sleep wakeup.
>
> I assume that the channel will be reset after boot, and the speakers will be
> conditionally activated after S3 sleep wakeup.
>
> (In reply to Cameron Berkenpas from comment #402)
>> On 8/19/21 10:22 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
>> Are you already patching the kernel? Perhaps the right speaker is
>> already initialized and that's why it's working
Comment 411 sycxyc 2021-08-22 00:13:43 UTC
I patched linux-source-5.10 and line 8223 is referenced here.

https://bugzilla.kernel.org/attachment.cgi?id=298363&action=diff

(In reply to Cameron Berkenpas from comment #410)
> Are you sure 8,223 is the right line? I don't see 0x2a, I see:
> {0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
> 
> Maybe you mean 8,221:
> {0x20, AC_VERB_SET_PROC_COEF, 0x2a },
> 
> Or maybe you're not patching against against 5.13 like I am. :)
Comment 412 Jakub Przystasz 2021-08-22 09:30:51 UTC
(In reply to Max from comment #397)
> Created attachment 298379 [details]
> little modification to the `linux-max.patch` to fix sound for Legion 7i,
> S740, Yoga 9i
> 
> Beware of a misunderstanding. With patch 0.0.10 alias
> `linux-5.13-legion-yoga-14ITL5-sound-0.0.10-001.patch - correct patch` only
> the right speaker was working for me, the left one did not on the `Yoga 7
> 14ITL5`, which is how my model is called according to the back plate. It
> also has stickers on it, calling it a `YOGA 7i`.
> 
> I restructured the patch code a little and there was this comment `set right
> speaker Yoga 7i.`, but that was not sitting in the middle of the code block:
> The code block for the left speaker was shorter, so that I compared line by
> line what was missing and finally copied the difference from the right
> speaker to the left. I compiled the kernel with that and tested it on my
> hardware and it works - on a Yoga 7i that is.
> 
> The gist document from @sycxyc gives me a better understanding of what the
> code does and by the looks of it: `set the speaker` and `activate speaker`
> for both channels. But there are twopossibilities to `set the speaker` in
> the document and one is dedicated to the Yoga 7i only. Both possibilities
> are implemented in the patch in the same code block, so that changes for one
> model can influence another and I made a mistake, which could be a problem
> with other models: The attachment 298363 [details], line 8223 should have
> been `0x1a` instead of `0x2a` to select the correct speaker before
> activating a speaker.
> 
> Attached is a patch called `linux-max-untested.patch` with the little change
> I mentioned. It should fix problem with other models and it should still
> work with the Yoga 7i. However it is untested, because I currently have no
> time to compile the kernel again.
> 
> Have fun and good luck.

I've tested your patch on 15ITL5, at first try nothing happened after reboot.
To make it working on Yoga 7i 15ITl5 i had to add: 
+	SND_PCI_QUIRK(0x17aa, 0x3853, "Lenovo Yoga 7 15ITL5", ALC287_FIXUP_YOGA7_14ITL_SPEAKERS),
Comment 413 waterproof93 2021-08-22 17:54:45 UTC
(In reply to Cameron Berkenpas from comment #388)
> Created attachment 298341 [details]
> linux-5.13-legion-13s-gen2-sound-0.0.10-002.patch
> 
> Adds speaker output for the 13s gen2. This is based against the Linux 5.13
> series and incorporates Takashi's suggestions.
> 
> This is still in a separate patch as it seems volume control (using keyboard
> shortcuts I think..?) are a bit wonky so unsure if this will eventually be
> included if this remains unchanged.

So regarding the volume control, I applied the patch 0.0.9 to kernel 5.13.5 and now the control seems to be working just fine !
I think this is a success.

I did had some error while applying the patch and at the end of the compilation but when I rebooted on the kernel everything is working good.
Comment 414 Cameron Berkenpas 2021-08-22 20:29:18 UTC
Created attachment 298425 [details]
linux-5.13-legion-sound-0.0.11-001.patch - 2020 Legion and Yoga 7i support

Legion and Yoga verbs updated based on Max's and sycxyc's feedback work.
Comment 415 Cameron Berkenpas 2021-08-22 20:32:41 UTC
Created attachment 298427 [details]
linux-5.13-legion-sound-0.0.11-002.patch - Support for 13s Gen2 and Yoga 7 15ITL5

If folks can confirm there's no volume weirdness with the 13s Gen2 laptops with volume control and if Yoga 7 15ITL5 support is confirmed working, I think we can merge the 2 small patches together to make one slightly less small patch.

IIRC, I think around 2 people complained about weirdness with the volume on the 13s Gen2... But if it's working for someone else, maybe there's a distro specific bug?
Comment 416 Jakub Przystasz 2021-08-22 21:08:06 UTC
I can confirm that, after my little addition, everything works(on Yoga 7i 15ITL5). Both channels are correcly set up, and volume control is ok.
If it concerns, i have tested patches on Ubuntu 21.04, Kernel 5.13.12

TY for all contributors <3
Comment 417 Jakub Przystasz 2021-08-22 21:08:25 UTC
I can confirm that, after my little addition, everything works(on Yoga 7i 15ITL5). Both channels are correcly set up, and volume control is ok.
If it concerns, i have tested patches on Ubuntu 21.04, Kernel 5.13.12

TY for all contributors <3
Comment 418 René Knipschild 2021-08-25 19:25:42 UTC
This problem seems to affect HP SPECTRE x360 15-eb0675ng, too. This device has a Realtek ALC285 (sof-hda-dsp) sound card. Audio is working via line/headphone output, only. While a headphone is not connected, PulseAudio recognizes that nothing is plugged in, and when it's connected, it says headphone output. Alsamixer also confirms muting and unmuting of the integrated speakers, as well.
Sound is working perfect via line/headphone out, but speakers don't work.

We are sure that an integrated mini amp behind the sound card has to be triggered via special registers, too. We can confirm that it works under Windows, same thing as mentioned above.

You may want to apply your linux-5.13-legion-sound-0.0.11-002.patch for this device, as well. The diff looks like it would only take effect on the special Lenovo laptop, so I thought it would be a good idea to inform you about it. Maybe the patch would work 1:1 on the HP laptop, too.

If you need more information, I would like to support you as best as I can.
Comment 419 Roland 2021-08-26 09:33:49 UTC
(In reply to René Knipschild from comment #418)
> This problem seems to affect HP SPECTRE x360 15-eb0675ng, too. This device
> has a Realtek ALC285 (sof-hda-dsp) sound card. Audio is working via
> line/headphone output, only. 

It seems that quite a number of models of this generation are affected, see also bug #213641 and the comments on other models in this thread. Perhaps a much more fundamental change is needed here, rather than looking at each variation individually?
Comment 420 Sl1979 2021-08-30 15:29:35 UTC
(In reply to Niclas from comment #157)
> No luck here with making the sleep working. 
> 
> Anyone know if someone is in contact with the manufacturer?

Hi Niclas
I have also  galaxy book pro 13.3 LTE.
THANKS for the sound fix.
Did you get sleep / suspend to work? Been struggling with that for days now.
Got ubuntu 21.04.

/Sl
Comment 421 Giorgi 2021-08-31 16:22:07 UTC
hello,

running Fedora 34, 5.13.12 on thinkpad X1 Nano.
Speakers only work when i put "options snd-intel-dspcfg dsp_driver=1" in modprobe.
I could not make Microphone work in any way.

detected card is ALC287 should be ALC3306 according to https://psref.lenovo.com/syspool/Sys/PDF/ThinkPad/ThinkPad_X1_Nano_Gen_1/ThinkPad_X1_Nano_Gen_1_Spec.PDF


tried both pipewire and pulseaudio.

which patch should i try ? 


Thanks,
Comment 422 Jakub Przystasz 2021-09-08 14:47:30 UTC
What needs to be done, to add these patches to next release of kernel?
Comment 423 Cameron Berkenpas 2021-09-08 16:43:51 UTC
Mainly I need to follow up with Takashi's suggestions here:
https://lore.kernel.org/alsa-devel/s5hy2ah5dkb.wl-tiwai@suse.de/

I just haven't had any free time as of late. I *might* be able to work 
on it this weekend.

On 9/8/21 7:47 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #422 from Jakub Przystasz (jakub.przystasz@gmail.com) ---
> What needs to be done, to add these patches to next release of kernel?
>
Comment 424 mba 2021-09-10 20:08:46 UTC
Hello.. I've recently got a legion 7 16achg6, trying to fix the speakers so if you'd like me to test something then let me know.

Also, does the kernel patches work for the 16achg6? Or not?
Comment 425 Cameron Berkenpas 2021-09-10 20:10:14 UTC
On 9/10/21 1:08 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> mba (mba380@outlook.com) changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |mba380@outlook.com
>
> --- Comment #424 from mba (mba380@outlook.com) ---
> Hello.. I've recently got a legion 7 16achg6, trying to fix the speakers so
> if
> you'd like me to test something then let me know.
>
> Also, does the kernel patches work for the 16achg6? Or not?
>
Unfortunately, hey do not work and will not ever work. The 16achg6's 
sound issue is an entirely separate.

Hopefully we'll get a driver out of Cirrus Logic for this.
Comment 426 mba 2021-09-10 20:15:17 UTC
(In reply to Cameron Berkenpas from comment #425)

Oh... well that's a bummer. Do you think there's a possibility of us getting a driver update or will we just be ignored? Do they care about these issues?

> On 9/10/21 1:08 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > mba (mba380@outlook.com) changed:
> >
> >             What    |Removed                     |Added
> >
> ----------------------------------------------------------------------------
> >                   CC|                            |mba380@outlook.com
> >
> > --- Comment #424 from mba (mba380@outlook.com) ---
> > Hello.. I've recently got a legion 7 16achg6, trying to fix the speakers so
> > if
> > you'd like me to test something then let me know.
> >
> > Also, does the kernel patches work for the 16achg6? Or not?
> >
> Unfortunately, hey do not work and will not ever work. The 16achg6's 
> sound issue is an entirely separate.
> 
> Hopefully we'll get a driver out of Cirrus Logic for this.
Comment 427 Cameron Berkenpas 2021-09-12 20:20:35 UTC
Created attachment 298759 [details]
linux-5.14-legion-sound-0.0.12.patch - 5.14.x support

0.0.12 patch is the 11 patches combined into a single patch since everything appears to be good, and updated for Linux 5.14.3. The 0.0.11 patches don't apply to 5.14.x (or at least not 5.14.3).

I'm getting to the point where I'm going to try and submit this for inclusion in the kernel again, so let me know if there are issues.
Comment 428 Cameron Berkenpas 2021-09-13 17:40:37 UTC
Progress has been made on getting the patch accepted:
https://mailman.alsa-project.org/pipermail/alsa-devel/2021-September/189649.html

I'll post an updated patch based on Takashi's feedback today or tomorrow probably.

I'd like to give credit to those who helped. I *think* I need full names in order to do it. So if I don't have your full name and you want to be included, please let me know (you can email me directly for that if you like). So far I have in no particular order:

Vincent Morel <dantahoua _at_ gmail.com>
andreas _@_ mac-au.eu (need your full name)
sycxyc+kernel _at_ yandex.com (need your full name)
Max Christian Pohle <max _at_ entwicklerseite.de>

I don't think that's exhaustive. If I missed you on the list, it's because I'm generally a pretty busy person so please reach out (either on here or email me directly if you prefer) if you want to be included.

If I already have your full name on the above let list, let me know if you don't want to be included. 

For users whose names I'm still missing, you won't be included unless I hear from you (or someone credibly lets me know the full names aren't needed).
Comment 429 Cameron Berkenpas 2021-09-13 21:37:37 UTC
Created attachment 298789 [details]
linux-legion-sound-0.0.13.patch

auto mute is now properly disabled as per Takashi's suggestion.

This patch is against the latest Linus tree, but applies against 5.14.3 just fine.

This patch includes the presumptive commit message and credit given to various people.

Going through the Linux commit log, it seems full names and email addresses aren't needed, so I have a thank you list in the patch with the following:
Andreas Holzer, Vincent Morel, sycxyc, Max Christian Pohle

If you want to be mentioned (or if you know of someone who you think that should be included), please let me know!

Here's a link to the patch submission:
https://mailman.alsa-project.org/pipermail/alsa-devel/2021-September/189698.html
Comment 430 Vincent Morel 2021-09-14 20:23:25 UTC
Not commented for a while, but thanks everyone! :) Hope this patch gets in the Kernel. :)
Comment 431 Andreas 2021-09-16 16:19:31 UTC
Hello!

Which method/patch in this long list fixed your sound issue on the Galaxy Book? I have the 12 LTE and are looking for a solution too. :)

Kind regards,
Andreas
Comment 432 Cameron Berkenpas 2021-09-16 17:38:04 UTC
Unfortunately, your model of laptop is not supported by any of the 
patches here.

On 9/16/21 9:19 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> Andreas (ate@muenster.de) changed:
>
>             What    |Removed                     |Added
> ----------------------------------------------------------------------------
>                   CC|                            |ate@muenster.de
>
> --- Comment #431 from Andreas (ate@muenster.de) ---
> Hello!
>
> Which method/patch in this long list fixed your sound issue on the Galaxy
> Book?
> I have the 12 LTE and are looking for a solution too. :)
>
> Kind regards,
> Andreas
>
Comment 433 Andreas 2021-09-17 13:48:03 UTC
(In reply to Cameron Berkenpas from comment #432)
> Unfortunately, your model of laptop is not supported by any of the 
> patches here.
> 
> On 9/16/21 9:19 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > Andreas (ate@muenster.de) changed:
> >
> >             What    |Removed                     |Added
> >
> ----------------------------------------------------------------------------
> >                   CC|                            |ate@muenster.de
> >
> > --- Comment #431 from Andreas (ate@muenster.de) ---
> > Hello!
> >
> > Which method/patch in this long list fixed your sound issue on the Galaxy
> > Book?
> > I have the 12 LTE and are looking for a solution too. :)
> >
> > Kind regards,
> > Andreas
> >

Hey Cameron,

thanks for your answer! The citation of the method would have been helpful despite the fact that I won't find a direct fix for my device.

Cheers,
Andreas
Comment 434 Cameron Berkenpas 2021-09-17 14:29:26 UTC
This is a work in progress. I haven't had the time to clean up and 
correct the work I have in a branch.
https://github.com/thiagotei/linux-realtek-alc287

You can also search around for how to use JCS' Qemu.

This bug itself has most of the information on this approach.

Getting the hardware to work under the Windows VM may or may not be 
difficult. On the 2020 Legion 7i, it took a fair amount of effort. On my 
current 2021 Lenovo Legion 7i, Windows immediately recognized the 
correct driver for the sound card.

Of course, this method may not work at all on your laptop. For example, 
on both the AMD and Intel versions of the 2021 Legion, the method 
doesn't work as the amp is a separate device on the i2c bus and 
therefore isn't initialized by HDA verbs.

I don't know of any methods to capture communication over the i2c bus, 
and I don't really have the time anymore to try even if I did.

On 9/17/21 6:48 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #433 from Andreas (ate@muenster.de) ---
> (In reply to Cameron Berkenpas from comment #432)
>> Unfortunately, your model of laptop is not supported by any of the
>> patches here.
>>
>> On 9/16/21 9:19 AM, bugzilla-daemon@bugzilla.kernel.org wrote:
>>> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>>>
>>> Andreas (ate@muenster.de) changed:
>>>
>>>              What    |Removed                     |Added
>>>
>> ----------------------------------------------------------------------------
>>>                    CC|                            |ate@muenster.de
>>>
>>> --- Comment #431 from Andreas (ate@muenster.de) ---
>>> Hello!
>>>
>>> Which method/patch in this long list fixed your sound issue on the Galaxy
>>> Book?
>>> I have the 12 LTE and are looking for a solution too. :)
>>>
>>> Kind regards,
>>> Andreas
>>>
> Hey Cameron,
>
> thanks for your answer! The citation of the method would have been helpful
> despite the fact that I won't find a direct fix for my device.
>
> Cheers,
> Andreas
>
Comment 435 Vincent Morel 2021-10-05 03:56:11 UTC
Hello! Just want to say that I had to re-install my system. 
So I patched kernel 5.14.3 with the latest patch and sadly I have no sound.
Note that if I apply my verb, sound is working, so the verbs still good.
I tried to replace in the 13S Gen2 part of the patch the "0xb020" address back to "0x20" just in case, but no more luck...
Could it be verbs from other soundcard in the patch? Can anyone with a Lenovo 13s Gen2 could try to patch a kernel with this patch?
Comment 436 Cameron Berkenpas 2021-10-05 15:27:26 UTC
Was the latest patch tested on your previous install?

This is very unfortunate as this patch appears that it just made it into 
Linux stable.

On 10/4/21 8:56 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #435 from Vincent Morel (dantahoua@gmail.com) ---
> Hello! Just want to say that I had to re-install my system.
> So I patched kernel 5.14.3 with the latest patch and sadly I have no sound.
> Note that if I apply my verb, sound is working, so the verbs still good.
> I tried to replace in the 13S Gen2 part of the patch the "0xb020" address
> back
> to "0x20" just in case, but no more luck...
> Could it be verbs from other soundcard in the patch? Can anyone with a Lenovo
> 13s Gen2 could try to patch a kernel with this patch?
>
Comment 437 Vincent Morel 2021-10-05 19:06:49 UTC
(In reply to Cameron Berkenpas from comment #436)
> Was the latest patch tested on your previous install?
> 
> This is very unfortunate as this patch appears that it just made it into 
> Linux stable.
> 
> On 10/4/21 8:56 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #435 from Vincent Morel (dantahoua@gmail.com) ---
> > Hello! Just want to say that I had to re-install my system.
> > So I patched kernel 5.14.3 with the latest patch and sadly I have no sound.
> > Note that if I apply my verb, sound is working, so the verbs still good.
> > I tried to replace in the 13S Gen2 part of the patch the "0xb020" address
> > back
> > to "0x20" just in case, but no more luck...
> > Could it be verbs from other soundcard in the patch? Can anyone with a
> Lenovo
> > 13s Gen2 could try to patch a kernel with this patch?
> >

Aaaarrrg, I was overloaded and cannot make some test... I made some test yesterday, tried to compile 5.14.3 two time (after tweaking the patch file) but did not have any good result. Maybe I could try with another kernel or maybe it's a problem on my side when compiling but I doubt as it worked with my old 5.12.3 kernel (but it was the old patch with just the verb for the 13s). I will download the other patch version just to try and see, just a little time consuming to wait the kernel to be compiled each time! :)
Comment 438 Vincent Morel 2021-10-05 21:09:00 UTC
(In reply to Cameron Berkenpas from comment #436)
> Was the latest patch tested on your previous install?
> 
> This is very unfortunate as this patch appears that it just made it into 
> Linux stable.
> 
> On 10/4/21 8:56 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=208555
> >
> > --- Comment #435 from Vincent Morel (dantahoua@gmail.com) ---
> > Hello! Just want to say that I had to re-install my system.
> > So I patched kernel 5.14.3 with the latest patch and sadly I have no sound.
> > Note that if I apply my verb, sound is working, so the verbs still good.
> > I tried to replace in the 13S Gen2 part of the patch the "0xb020" address
> > back
> > to "0x20" just in case, but no more luck...
> > Could it be verbs from other soundcard in the patch? Can anyone with a
> Lenovo
> > 13s Gen2 could try to patch a kernel with this patch?
> >

Just an update. I compiled the 5.14.3 kernel with the last patch BUT I replaced all the "verb" in the 13S section with the one in the .009 patch (the one with 0x20,0x4b0,0x20) and it's working!!! So it seems replacing "0x20,ac_verb_set_proc_coef, 0xb020" with "0x20,0x4b0,0x20" made the patch works for the 13s... Weird...
That's the only thing I changed in the patch file...
Comment 439 Cameron Berkenpas 2021-10-06 00:42:19 UTC
Well, a patch won't be accepted with the verbs like that.

Maybe you can try something else and/or someone else has some insight on 
this. I have no way to test this on my end.

On 10/5/2021 2:09 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> Just an update. I compiled the 5.14.3 kernel with the last patch BUT I
> replaced
> all the "verb" in the 13S section with the one in the .009 patch (the one
> with
> 0x20,0x4b0,0x20) and it's working!!! So it seems replacing
> "0x20,ac_verb_set_proc_coef, 0xb020" with "0x20,0x4b0,0x20" made the patch
> works for the 13s... Weird...
> That's the only thing I changed in the patch file...
Comment 440 Vincent Morel 2021-10-06 00:56:38 UTC
(In reply to Takashi Iwai from comment #381)
> Sorry, it was a typo of AC_VERB_SET_PROC_COEF.
> 
> In short, { 0x4XX, 0xYY } is equivalent with { AC_VERB_SET_PROC_COEF, 0xXXYY
> }
> and { 0x5XX, 0xYY } is a combo of { AC_VERB_SET_COEF_INDEX, 0xXXYY }

Maybe Takashi Iwai could enlight us on this issue? I'll make some other test and research...
Comment 441 Takashi Iwai 2021-10-06 06:09:30 UTC
Both must be identical from the code perspective.

But, looking at the verb sequence there, I doubt whether the 0xb020 call is really correct.  If it follows the similar pattern as others, it should be rather setting the COEF index 0x26 instead, i.e.:

--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -8345,7 +8345,7 @@ static const struct hda_fixup alc269_fixups[] = {
 		.v.verbs = (const struct hda_verb[]) {
 			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
-			{ 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
+			{ 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
 			{ 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
Comment 442 Vincent Morel 2021-10-06 19:27:37 UTC
(In reply to Takashi Iwai from comment #441)
> Both must be identical from the code perspective.
> 
> But, looking at the verb sequence there, I doubt whether the 0xb020 call is
> really correct.  If it follows the similar pattern as others, it should be
> rather setting the COEF index 0x26 instead, i.e.:
> 
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -8345,7 +8345,7 @@ static const struct hda_fixup alc269_fixups[] = {
>               .v.verbs = (const struct hda_verb[]) {
>                       { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
>                       { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
> -                     { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
> +                     { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
>                       { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
>                       { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
>                       { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },

That make sense! I translated this into simple verb to test on a config with no sound and it works.
Just compiled a new kernel with the update and it works also! 

Thanks Takashi Iwai! Is this update will be be pushed to the next kernel?
Comment 443 Cameron Berkenpas 2021-10-06 19:33:16 UTC
Nope.

I'm going to have to generate a patch from this and submit it to 
alsa-devel. Since it seems the previous patch is in, this will just be a 
one line fix.

I might have time this weekend.

On 10/6/21 12:27 PM, bugzilla-daemon@bugzilla.kernel.org wrote:
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
>
> --- Comment #442 from Vincent Morel (dantahoua@gmail.com) ---
> (In reply to Takashi Iwai from comment #441)
>> Both must be identical from the code perspective.
>>
>> But, looking at the verb sequence there, I doubt whether the 0xb020 call is
>> really correct.  If it follows the similar pattern as others, it should be
>> rather setting the COEF index 0x26 instead, i.e.:
>>
>> --- a/sound/pci/hda/patch_realtek.c
>> +++ b/sound/pci/hda/patch_realtek.c
>> @@ -8345,7 +8345,7 @@ static const struct hda_fixup alc269_fixups[] = {
>>                .v.verbs = (const struct hda_verb[]) {
>>                        { 0x20, AC_VERB_SET_COEF_INDEX, 0x24 },
>>                        { 0x20, AC_VERB_SET_PROC_COEF, 0x41 },
>> -                     { 0x20, AC_VERB_SET_PROC_COEF, 0xb020 },
>> +                     { 0x20, AC_VERB_SET_COEF_INDEX, 0x26 },
>>                        { 0x20, AC_VERB_SET_PROC_COEF, 0x2 },
>>                        { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
>>                        { 0x20, AC_VERB_SET_PROC_COEF, 0x0 },
> That make sense! I translated this into simple verb to test on a config with
> no
> sound and it works.
> Just compiled a new kernel with the update and it works also!
>
> Thanks Takashi Iwai! Is this update will be be pushed to the next kernel?
>
Comment 444 Cameron Berkenpas 2021-10-09 21:57:03 UTC
Created attachment 299155 [details]
linux-13s-gen2-sound-0.0.1.patch

This should fix sound on the Lenovo 13s gen2. 

I know it's a single line change, but let's have confirmation before I submit another patch.

This is against the latest Torvald's tree, but applies against 5.14.11 with a minor offset.

Vince, it seems you're the only one on this bug who can test. Can you let us know? Anyone else's results are also welcome of course!
Comment 445 Vincent Morel 2021-10-10 02:48:59 UTC
(In reply to Cameron Berkenpas from comment #444)
> Created attachment 299155 [details]
> linux-13s-gen2-sound-0.0.1.patch
> 
> This should fix sound on the Lenovo 13s gen2. 
> 
> I know it's a single line change, but let's have confirmation before I
> submit another patch.
> 
> This is against the latest Torvald's tree, but applies against 5.14.11 with
> a minor offset.
> 
> Vince, it seems you're the only one on this bug who can test. Can you let us
> know? Anyone else's results are also welcome of course!

Gonna check it monday. :) Should work as this is exactly what I did before compiling the kernel...
Comment 446 waterproof93 2021-10-10 16:47:58 UTC
(In reply to Cameron Berkenpas from comment #444)
> Created attachment 299155 [details]
> linux-13s-gen2-sound-0.0.1.patch
> 
> This should fix sound on the Lenovo 13s gen2. 
> 
> I know it's a single line change, but let's have confirmation before I
> submit another patch.
> 
> This is against the latest Torvald's tree, but applies against 5.14.11 with
> a minor offset.
> 
> Vince, it seems you're the only