Bug 213159

Summary: No sound from speakers using Realtek ALC3306
Product: Drivers Reporter: Vincent Morel (dantahoua)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: normal CC: caleb.i.m.vincent, dreamsyntax, gmiramir, hujq, kernel_org.20.elbenfreund, Michael.Kellen, mustapha.hadeed, mysubstmp, niclas, pablitar, patches, pkx616, shalokshalom, waterproof93, xpressrazor
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.11.5 Subsystem:
Regression: No Bisected commit-id:
Attachments: attachment-28390-0.html

Description Vincent Morel 2021-05-20 13:43:53 UTC
There is no sound in speaker on my computer.
It's a Lenovo 13s Gen2 ITL, with 2 speaker using ALC3306 codec.

-Speakers works great in windows 10.

-In Linux (note that I use PopOs but I tested with lot of different distro and kernel up to 5.12 in Garuda linux).

-Headphone works perfectly
-Speakers do not work, but system play audio and report no problem. Even the meters show some sound in Gnome sound speaker test. Still no sound from the speaker.

-System even recognise the audio output (Speaker - Tiger Lake-LP Smart Sound Technology Audio Controller)

-I already tried stuff from bug report 208555, but it seems it is not related here to the ACPI.

-Speaker is the only thing not working in Linux, everything else works great.

-From what I read online, and from the nature of the problem, it seems this codec use an amplification part, and this amplification part seems to be off.
We have to find a way to turn it on!!!
It's like plugin a guitar in an amp but not finding the power button! :o 

-OR maybe a "pinning" problem like there: https://askubuntu.com/questions/1263178/20-04-no-speaker-audio-on-hp-spectre-x360-2020-15t-eb000

-I do not see any ALC3305 in this https://github.com/torvalds/linux/blob/master/sound/pci/hda/patch_realtek.c

-aplay -l
**** Liste des Périphériques Matériels PLAYBACK ****
carte 0: sofhdadsp [sof-hda-dsp], périphérique 0: HDA Analog (*) []
  Sous-périphériques: 0/1
  Sous-périphérique #0: subdevice #0
carte 0: sofhdadsp [sof-hda-dsp], périphérique 1: HDA Digital (*) []
  Sous-périphériques: 1/1
  Sous-périphérique #0: subdevice #0
carte 0: sofhdadsp [sof-hda-dsp], périphérique 3: HDMI1 (*) []
  Sous-périphériques: 1/1
  Sous-périphérique #0: subdevice #0
carte 0: sofhdadsp [sof-hda-dsp], périphérique 4: HDMI2 (*) []
  Sous-périphériques: 1/1
  Sous-périphérique #0: subdevice #0
carte 0: sofhdadsp [sof-hda-dsp], périphérique 5: HDMI3 (*) []
  Sous-périphériques: 1/1
  Sous-périphérique #0: subdevice #0


-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 (1184 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


And finally here is the alsa-info.sh result:
http://alsa-project.org/db/?f=1f3e847b60bd38085e39e26d992ea8680dd90869
Comment 1 Thiago T 2021-05-20 16:13:33 UTC
Have you tried the pinning?
It looks like that is the way to go...
Comment 2 waterproof93 2021-05-20 18:05:42 UTC
Not OP here, I have the same issue on the same laptop.

I tried to do the pinning.
Installed the topology from here :
git clone -b stable-v1.6 https://github.com/thesofproject/sof-bin.git

and executed those four commands:

sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR 0x01
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x01
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x01
sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x00

Still no sound.

I do have a device named: /dev/snd/hwC0D0
I'm using latest Manjaro Gnome (easier to switch kernel if required)
Comment 3 Vincent Morel 2021-05-20 18:09:51 UTC
(In reply to waterproof93 from comment #2)
> Not OP here, I have the same issue on the same laptop.
> 
> I tried to do the pinning.
> Installed the topology from here :
> git clone -b stable-v1.6 https://github.com/thesofproject/sof-bin.git
> 
> and executed those four commands:
> 
> sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DIR 0x01
> sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_MASK 0x01
> sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x01
> sudo hda-verb /dev/snd/hwC0D0 0x01 SET_GPIO_DATA 0x00
> 
> Still no sound.
> 
> I do have a device named: /dev/snd/hwC0D0
> I'm using latest Manjaro Gnome (easier to switch kernel if required)

Also tried that as you did with no luck... At the same time do we enter the address value (0x01)?
Good idea to have a distro with easy kernel change, will do the same on another partition with garuda.

If only we could have some information from Realtek or if we could analyse the windows driver... :/
Comment 4 Thiago T 2021-05-20 19:31:19 UTC
I have also tried setting the pins but it did not work.
Here is my alsa-info (http://alsa-project.org/db/?f=99bdfb38a179a377b2a9d0b6a767d3fc2a83fea9)
Comment 5 Pablitar 2021-05-27 03:31:44 UTC
Hello!

Same issue here.

Would it be of any use to contact Realtek requesting a datasheet or something like that?

I actually don't really know what is needed and don't know if they'll likely respond, but they do have contact email for technical support: pctech@realtek.com
Comment 6 Vincent Morel 2021-05-27 12:49:07 UTC
(In reply to Pablitar from comment #5)
> Hello!
> 
> Same issue here.
> 
> Would it be of any use to contact Realtek requesting a datasheet or
> something like that?
> 
> I actually don't really know what is needed and don't know if they'll likely
> respond, but they do have contact email for technical support:
> pctech@realtek.com

Yes, exactly what I was thinking, I tried almost everything and now there is nothing more I can do. Lenovo do not care in my case, Alsa seems to be dead...
I have no more idea. So contacting them seems the only solution.
I cannot beleive this problem will not arise in a greater level, there will be more and more Laptop using ALC3306 (but still not so much people using Linux... ).
Comment 7 waterproof93 2021-05-27 23:28:43 UTC
I read on another thread (for an ideapad I think) that soft rebooting from windows when dual booting makes the speaker start working.

I tried this approach but not only was the speaker not working but also the earphones weren't working. However, there was an acute sound coming off the earphones.

This happened with sof-firmware and with intel hdi.

I found that interesting so I'm posting this here in case someone makes sense of that.
Comment 8 Niclas 2021-05-29 11:43:32 UTC
Do we know if someone have tried to contact the manufacturer?
Comment 9 Vincent Morel 2021-05-29 13:57:10 UTC
(In reply to Niclas from comment #8)
> Do we know if someone have tried to contact the manufacturer?

I do not know.
I openened a bug report on Alsa github, would be great if other people add there case to this bu report...
https://github.com/alsa-project/alsa-lib/issues/139
Comment 10 Thiago T 2021-06-21 14:20:18 UTC
This looks very promising https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-from-a-Windows-sound-driver . Not sure when, but I will try this as soon as I can.
I've got this from a post (https://bugzilla.kernel.org/show_bug.cgi?id=208555#c204) in the ALC297 thread.
Comment 11 Thiago T 2021-06-21 15:29:28 UTC
The sound is working for me (not sure if it is in both speakers)!
I am running Ubuntu 20.04 Legion 7i 15IMH05 kernel 5.8.0-55.
Follow the instructions here: https://bugzilla.kernel.org/show_bug.cgi?id=208555#c208
Comment 12 Vincent Morel 2021-06-30 12:02:40 UTC
After spending some time and getting help from Cameron on this thread https://bugzilla.kernel.org/show_bug.cgi?id=208555
I manage to get the good Verbs for the Lenovo 13s gen2 ITL and now it's working. :)
I'll trime down the verb as soon as I have a little more time. Check the other thread to get the kernel patch and the verb file.
Comment 13 Przemyslaw Kulczycki 2022-01-16 00:06:28 UTC
(In reply to Vincent Morel from comment #12)
> After spending some time and getting help from Cameron on this thread
> https://bugzilla.kernel.org/show_bug.cgi?id=208555
> I manage to get the good Verbs for the Lenovo 13s gen2 ITL and now it's
> working. :)
> I'll trime down the verb as soon as I have a little more time. Check the
> other thread to get the kernel patch and the verb file.

Any luck with this one?
Looks like I'm also affected.
I have a Legion 7 16ACHg6 which I'm testing under Ubuntu 20.04.3 LTS LiveUSB, and the biggest issue so far is that there is no sound out of the built-in speakers. Headphones are working fine though.
05:00.6 Audio device: Advanced Micro Devices, Inc. [AMD] Family 17h (Models 10h-1fh) HD Audio Controller
Comment 14 XpressRzr 2024-06-08 14:22:37 UTC
I am also affected by this issue. I have Lenovo Legion 9 (Gen 9) 16IRX9. In the spec sheet it say Audio Chip is High Definition (HD) Audio, Realtek ALC3306 codec. 

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 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

It shows ALC287 above, but from the spec the codec is ALC3306. I also checked https://github.com/torvalds/linux/blob/master/sound/pci/hda/patch_realtek.c and there is still no entry for ALC 3306. I also see entry for individual laptop names added to an enum  with entry such as 

ALC882_FIXUP_ABIT_AW9D_MAX,
ALC882_FIXUP_LENOVO_Y530

Does this laptop model also needed to be added somewhere or once ALC3306 gets added to above file, it will start working ? Since the computer shows ALC287 however the spec shows ALC3306, I am not sure what's the correct approach to get this fixed. Also ALC3306 does not seem to be too new at this point.

I am using Manjaro and have tried 6.9.2 and 6.10rc1-2 kernel as well.
Comment 15 dreamsyntax 2024-06-23 01:08:44 UTC
> I am using Manjaro and have tried 6.9.2 and 6.10rc1-2 kernel as well.


I suspect your hardware has the issue as my "Legion Pro 7 16IRX8H / 82QW / the Gen 8 2023 model.

Try running this script as root (or use sudo) and try every bus number from 0 to 50 until it succeeds.
https://bugzilla.kernel.org/show_bug.cgi?id=208555#c872

Alternatively, try linux-kernel 6.7.9, or if its inconvenient to build the kernel yourself, there is 6.7.0.6.realtime1-4-rt in the arch extra repo. This kernel does not have the regression introduced after 6.7.9.
Unfortunately the 6.6 LTS kernel had the regression backported to it.
Comment 16 XpressRzr 2024-07-20 12:41:34 UTC
(In reply to dreamsyntax from comment #15)
> > I am using Manjaro and have tried 6.9.2 and 6.10rc1-2 kernel as well.
> 
> 
> I suspect your hardware has the issue as my "Legion Pro 7 16IRX8H / 82QW /
> the Gen 8 2023 model.
> 
> Try running this script as root (or use sudo) and try every bus number from
> 0 to 50 until it succeeds.
> https://bugzilla.kernel.org/show_bug.cgi?id=208555#c872
> 
> Alternatively, try linux-kernel 6.7.9, or if its inconvenient to build the
> kernel yourself, there is 6.7.0.6.realtime1-4-rt in the arch extra repo.
> This kernel does not have the regression introduced after 6.7.9.
> Unfortunately the 6.6 LTS kernel had the regression backported to it.

Wow, I did not think the script would actually work. I tried all the bus numbers and on 14 it suddenly started playing audio from the speakers (although it seems to be playing only on the left side). However, it's at least better than not having the audio at all.

Thank you.
Comment 17 dreamsyntax 2024-07-20 17:38:41 UTC
Created attachment 306592 [details]
attachment-28390-0.html

> only playing on the left speaker

Hi, re-run the script multiple times to make it work with both speakers.

Its obnoxious but it works.

In day to day use, I have to run the script any time audio sources are muted on my system (play back in a video is paused, an emulator is state frozen, etc). Again, this is a regression introduced after 6.7.9, including the LTS kernels as  the bug was backported.

I suggest having an alias that runs the script for easy re-execution. I would not recommend a cronjob re-running the script every N secons. Doing so results in the noticeable "drops" whenever the device speakers are reset.

I'm going to start digging through commits as its been months and it seems no one else is going to try to find the commit that broke this for our devices. Probably because this issue is nested / intermingled with so many other devices and the same PCIE is not making things easier.