Bug 203409

Summary: Lenovo YOGA C930-13IKB (ALC298): internal mic and most of surround speakers not working
Product: Drivers Reporter: drsrsprt
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: normal CC: andresdortiz, bizyaev, dl9pf, dober, drsrsprt, email-ext, freedman.joshua, ildella, ivandr, jon.reeve, juliusvonkohout, kernel, kernel, kxra, kylrth, logsysoftware, markpearson, mesasec, nate, oguzyilmaz, pfpschneider, validextrame
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.1.0-rc6 Tree: Mainline
Regression: No
Attachments: alsa-info.txt
`pactl list` output
`fwts --all` results.log

Description drsrsprt 2019-04-24 09:50:09 UTC
Created attachment 282497 [details]
alsa-info.txt

It seems like this device has 5.1 speaker configuration: Front Left, Front Center, Front Left and LFE in soundbar placed in hinge; Rear Left and Rear Right on device bottom. Only Front Left and Front Right speakers are working (tested with 5.1.0-rc6). Remapping pin 0x17 to Dock Headphone enables Front Center (or LFE, not sure) speaker and also makes overall speaker volume higher but headphone jack volume lower so there's a trade in. Randomly messing with pins in hdaanalyzer wont help. I can provide any additional logs on request.
Comment 1 drsrsprt 2019-04-24 09:50:57 UTC
Created attachment 282499 [details]
`pactl list` output
Comment 2 drsrsprt 2019-04-24 10:03:12 UTC
Created attachment 282501 [details]
`fwts --all` results.log
Comment 3 kxra 2019-05-28 21:48:16 UTC
There is also some discussion here about this: https://mailman.alsa-project.org/pipermail/alsa-devel/2018-November/142369.html

I wasn't able to figure out a suitable workaround for the time being, but hopefully someone more knowledgeable can.
Comment 4 mesasec 2019-09-07 10:50:53 UTC
Same problem here with that configuration (ALC298 + Dolby configuration), but with diferrent laptop model, Lenovo S940.

Alsa-info.sh log:

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

Linux lnx 4.19.66-1-MANJARO #1 SMP PREEMPT Fri Aug 9 18:01:53 UTC 2019 x86_64 GNU/Lin

More logs:

00:1f.3 Multimedia audio controller [0401]: Intel Corporation Cannon Point-LP High Definition Audio Controller [8086:9dc8] (rev 30)
card 0: PCH [HDA Intel PCH], device 0: ALC298 Analog [ALC298 Analog]
snd_hda_codec_hdmi     69632  1
snd_sof_intel_hda_common    73728  1 sof_pci_dev
snd_sof_intel_hda      20480  1 snd_sof_intel_hda_common
snd_sof               118784  4 snd_sof_intel_hda_common,snd_sof_intel_byt,snd_sof_intel_ipc,sof_pci_dev
snd_hda_codec_realtek   126976  1
snd_hda_codec_generic    94208  1 snd_hda_codec_realtek
snd_soc_hdac_hda       24576  2 snd_sof_intel_hda_common,snd_soc_skl
ledtrig_audio          16384  2 snd_hda_codec_generic,snd_hda_codec_realtek
snd_hda_ext_core       36864  4 snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_soc_skl,snd_sof_intel_hda
snd_soc_acpi_intel_match    28672  3 snd_sof_intel_hda_common,sof_pci_dev,snd_soc_skl
snd_soc_core          290816  4 snd_sof,snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_soc_skl
snd_hda_intel          49152  8
snd_hda_codec         159744  5 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec_realtek,snd_soc_hdac_hda
snd_hda_core          102400  10 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core,snd_hda_codec,snd_hda_codec_realtek,snd_sof_intel_hda_common,snd_soc_hdac_hda,snd_soc_skl,snd_sof_intel_hda
snd_hwdep              20480  1 snd_hda_codec
snd_pcm               139264  11 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_ext_core,snd_hda_codec,snd_sof,snd_sof_intel_hda_common,snd_soc_core,snd_soc_skl,snd_hda_core,snd_pcm_dmaengine
snd                   110592  25 snd_hda_codec_generic,snd_hda_codec_hdmi,snd_hwdep,snd_hda_intel,snd_hda_codec,snd_hda_codec_realtek,snd_timer,snd_compress,snd_soc_core,snd_pcm

Any ideas to solve this problem? Regards
Comment 5 Daniele Dellafiore 2019-10-20 20:13:27 UTC
Same issue on a Lenovo Yoga S940, kernel 5.3.0-18-generic x86_64
Mic not working
Audio works but clearly not properly, volume is very low and feels like low-frequencies are not reproduced, as in "no subwoofer". 

alsa-info -> http://alsa-project.org/db/?f=c74f7b1c3e266514faac4f90ec2f893a3bec1f98
Comment 6 A 2019-11-19 22:12:49 UTC
Same issue on Lenovo Yoga C940, Ubuntu 19.10, kernel 5.3.0-23-generic x86_64. Mic not working, audio not working properly with missing speakers.

Alsa info -> http://alsa-project.org/db/?f=863a8059dba17f148fb2d3b5b1705d29bc900218
Comment 7 Peter F. Patel-Schneider 2019-11-19 22:49:57 UTC
I have the same problem.
If someone tells me how to elicit the correct settings under Windows I can get them and try them out in Linux.
If someone tells me what possible settings might work under Linux (or tells me how to figure out what settings might work) I can try to find the right settings.
Comment 8 Jaroslav Kysela 2019-12-11 16:21:55 UTC
It seems that there are some I2S amplifiers on the path to speakers and the BIOS has only limited initialization. I will try to gather information for C930 from Lenovo, too.
Comment 9 Kyle Roth 2019-12-21 04:17:17 UTC
I've got the same problem on a C940 with 5.4.3-050403-generic. Let me know if I can be of any help with details.
Comment 10 Kyle Roth 2019-12-21 04:20:38 UTC
I was able to get sound working by adding `snd_hda_intel.dmic_detect=0` to grub command line, but still no microphone.
Comment 11 Jonathan Reeve 2020-02-26 16:21:20 UTC
This issue persists for me, on a C930 with 5.4.21. Adding `snd_hda_intel.dmic_detect=0` has no effect for me: there is sound, but only from the two front speakers. The rest of the speakers don't work. 

Here's my alsa info, if it helps: http://alsa-project.org/db/?f=ab906a5a6eeeddc4926a6ad543c2d42d7a21ecdf

Let me know if there's a way I can help debug this.
Comment 12 Jonathan Reeve 2020-04-15 20:07:38 UTC
This issue persists even after the latest (March 2020) BIOS update from Lenovo. I posted about this here on the Lenovo forums: 

https://forums.lenovo.com/t5/Lenovo-Yoga-Series-Notebooks/After-latest-BIOS-update-audio-not-working-on-Yoga-C930/m-p/5009564

Is our only hope getting the Lenovo BIOS devs to release a fix? Can we fix this in the BIOS ourselves? 

I rate the probability of ever hearing from Lenovo about this at around 0%.
Comment 13 Daniele Dellafiore 2020-05-27 06:34:37 UTC
With all kernel versions shipped with Ubuntu 20.04 up to 5.4.0-29 but excluding 5.4.0-31, sound and mic work without problems on Lenovo S940 with Intel 10th gen.

The latest upgrade which is 5.4.0-31 breaks not only the mic but also the sound.
Comment 14 Josh 2021-02-14 23:23:42 UTC
Yoga c930 Ubuntu20.10 and kernel 5.10.16
Microphone still doesn't work
Speakers are ok but not great.

The mic should work, but it doesn't, please fix mic.
Comment 15 ais 2021-02-15 19:25:52 UTC
In this thread there is some encouraging move on the DMIC issue
https://bugzilla.kernel.org/show_bug.cgi?id=201251
I have applied the suggested patch but no successful. The issue as far as i understand that all work on fixing is doing on the SOF driver, which is not working itself on C930 model, only HDA is working, but path is not for HDA. Some endless loop ((
Comment 16 Peter F. Patel-Schneider 2021-02-15 19:33:52 UTC
The mic problem should be addressed by upgrades to the sof drivers.  You may have to get some sort of quirk added for the C930.

The speaker problem is very likely an amp that is not turned on.  See https://bugzilla.kernel.org/show_bug.cgi?id=205755 for more information and a partial fix for 14" C940s.  The BIOS upgrade doesn't work for C930s.  See the referenced thread on the Lenovo site.
Comment 17 ais 2021-03-20 08:24:22 UTC
I just checked the solution from this thread https://bugzilla.kernel.org/show_bug.cgi?id=201251 and it worked for DMIC, it appeared.
So what was needed in my case is
options snd_pcm max_alloc_per_card=41943040
I tried in ArchLinux 5.11.7.
Only issue is that  the recording level too quiet and in fact is non operational ), but i think it is a great step forward any case. It is the first time when i saw microphone in Linux settings on my Lenovo Yoga C930 )
You should use no snd_intel_dspcfg dsp_driver options or use only
options snd_intel_dspcfg dsp_driver=2
Would be great to find solution to fix the level of recording now.
Comment 18 Josh 2021-05-21 16:06:48 UTC
Two years and this is still a problem.
Yoga c930, running ubuntu 21.04 and 5.12.5

Microphone works in Win10, not in Linux.  Speakers have issues also.
Comment 19 Jaroslav Kysela 2021-05-21 18:41:35 UTC
Adding Lenovo contacts to Cc...
Comment 20 Peter F. Patel-Schneider 2021-05-21 18:53:28 UTC
The problem is that the BIOS doesn't activate the amplifiers on the bottom of the body.   Someone sent in an unofficial BIOS for the C940 that fixes the problem for the C940 only.  See https://bugzilla.kernel.org/show_bug.cgi?id=205755

There is a related problem with the 9i that has a proposed fix that appears to work.   See https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1926165  This fix may not be enough for the C930 and C940 but it might be possible to get a fix for them that doesn't require a non-official BIOS.

By the way, I don't think that any of these laptops have five-channel sound.   There is the soundbar with two or three speakers and the two lower-range (I hesitate to call them bass) speakers on the bottom of the laptop.  I don't expect that sound under Linux is as good as sound under Windows as I believe Windows has a Dolby ATMOS sound driver for these laptops that probably does some special equalization.

The microphone should work in modern kernels.  I'm running Fedora 5.11.20 but I think the microphone was fine throughout the 5.10 kernel and maybe even earlier.
Comment 21 Jaroslav Kysela 2021-05-21 19:19:01 UTC
In other words: We don't have enough information to support this hw (speakers). If vendor is not willing to add support to BIOS or give us necessary information to add the proper initialization for the I2C amplifiers to the driver, the only way is the reverse engineering (grab the initialization HDA verbs in qemu or so). The another problem is that the I2C master block in the Realtek codecs is not documented. Those registers are hidden as the vendor specific coefficient registers.

For the mic volume - you may try to play with PGA / Dmic volume controls in the native ALSA mixer application (like alsamixer). But it should work with latest pulseaudio / UCM configuration.
Comment 22 Peter F. Patel-Schneider 2021-05-21 19:29:26 UTC
Agreed.  I have no idea how the fix for the 9i speakers was engineered.  It is in the form of a bunch of modifications to the 0x20 widget of the card using hda-verb.
Comment 23 Jaroslav Kysela 2021-05-21 19:43:53 UTC
Example "black magic" initialization of speakers for Lenovo Ideapad S740:

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=26928ca1f06aab4361eb5adbe7ef3b5c82f13cf2
Comment 24 Mark Pearson 2021-05-21 20:00:56 UTC
We confirmed a while back with the BIOS team that they weren't going to be able to do the changes needed on this platform unfortunately. Sorry

We weren't able to get any details on the initialization verbs either (tried). Are we able to reverse engineer it as was done on the S740. I believe the person who did that published the steps they followed...I thought I had them stashed somewhere, but can't find them right now :(
Comment 25 David Ober 2021-05-21 20:01:18 UTC
Created attachment 296927 [details]
attachment-21708-0.html

I am on Holiday and will be returning on June 01 2021
Comment 26 Jaroslav Kysela 2021-05-21 20:12:09 UTC
The qemu information (link) is in the commit I mentioned in comment#23 :

  https://github.com/ryanprescott/realtek-verb-tools/wiki/How-to-sniff-verbs-from-a-Windows-sound-driver
Comment 27 João Pacheco 2021-07-19 19:28:01 UTC
I have followed the tutorial on sniffing verbs from a virtual machine and have managed to get a windows virtual machine outputting to all speakers, however running the dumped verbs don't output to the bottom speakers still.

I don't know much about audio drivers and such, so if anyone wants to try running the verbs I got from that tutorial and the unprocessed QEMU output, feel free to look them up in this github repo: https://github.com/joao99pacheco/c930-audio-verbs