Bug 215632

Summary: No woofers Yoga Slim 7 Carbon Gen 6 (14" AMD) - 14ACN6.
Product: Drivers Reporter: oppsig (toggiworks)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: normal CC: a.milkovsky, belozyorcev, cyberrain, kailang, patches, rene.tailleur, sbinding, shalokshalom, tirithen, tiwai, toggiworks
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.17.0-rc5 Subsystem:
Regression: No Bisected commit-id:
Attachments: Support Patch
dmesg log with patch applied on kernel 6.11.1
Support patch v2
dmesg log with patch V2
acpidump
Support Patch v3
dmesg log patch v3
Debug Enablement Patch
dmesg log patch v3 verbose
dmesg log patch v3 verbose
Debug Enablement Patch v2
dmesg_debug_enablement_patch_v2

Description oppsig 2022-02-22 10:20:06 UTC
I have Yoga Slim 7 Carbon Gen 6 (14" AMD) - 14ACN6.
The laptop has 4 speakers, 2 woofers, and 2 tweeters.
Woofers are not detected it seams, but I have sound from tweeters.
The sound however is very low, thin and tremble.

According to spec laptop has ALC3306 codec, but codec detected is ALC287.

psref: https://psref.lenovo.com/Detail/Yoga/Yoga_Slim_7_Carbon_14ACN6?M=82L0005RMX
alsa-info: http://alsa-project.org/db/?f=3d09e96d79c9c19c6c6b6afdea30bbdf209cf2d0


Just give me a word if you need output from any commands.

Thanks in advance.
Comment 1 durbgork 2022-04-12 17:25:30 UTC
I'm also having this issue. This comment/patch looks to show some promise:
https://bugzilla.kernel.org/show_bug.cgi?id=208555#c547

I tried the patch on 5.17, made no difference.
Comment 2 milkovskyi 2022-04-23 20:26:41 UTC
I have the same issue.

This is my alsa-info output: http://alsa-project.org/db/?f=045c0b1e6b2f41b44c1a3bc145617ce60a6f756a

I am currently trying to play around with the Realtek ALC287 settings, but so far no luck.


P.S. I am documenting Linux support for this laptop here: https://github.com/milkovsky/Linux-on-Lenovo-Slim-7-Carbon-AMD/blob/main/README.md
Comment 3 Sergey Belozyorcev 2022-07-11 21:42:58 UTC
Hi friends! I also have Yoga Slim 7 Carbon Gen 6 (14" AMD).

Do you have any workaround solutions?

I tried 5.17.15 and 5.18.8 kernels. Woofers doen't work :(
Comment 4 milkovskyi 2022-07-12 08:00:52 UTC
my current workaround - external speakers :,(
Comment 5 Sergey Belozyorcev 2022-07-12 08:23:19 UTC
Yeap... I'm too. Very nice laptop with one big trouble on linux - sound :(
Also mic working, but quite (I set 100% of volume).

P.S.
And another problem. Laptop detects mic from my external Monitor (Huawei MateView HSN 28"), but can't capture sound. That problem also on Lenovo ThinkBook 15 G2.
Comment 6 milkovskyi 2022-07-12 08:26:10 UTC
@Sergey let's open a separate issue for the mics? I guess that not all of them are detected as well.
Comment 7 Sergey Belozyorcev 2022-07-12 20:40:20 UTC
@milkovskyi about MICs from my external Huawei MateView monitor... All works. It's my mistake. I connected external speakers to my Huawei MateView. By these reason mic didn't capture sound. I disconnected speakers and now I can capture mic input.
Comment 8 Sergey Belozyorcev 2022-07-12 20:47:35 UTC
About Internal speakers of Yoga Slim 7 Carbon.

I updated BIOS to latest version (H5CN36WW). It didn't help.

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

P.S.
I heared internal speakers in the Windows today ... It's perfect sound. But in the linux is a pain :`(
Comment 9 Sergey Belozyorcev 2022-07-12 20:57:48 UTC
I tried 5.18.11 kernel. Speakers not fixed.
Comment 10 Sergey Belozyorcev 2022-07-15 11:59:52 UTC
Who can try that patch https://bugzilla.kernel.org/show_bug.cgi?id=208555#c645?

Istruction for build kernel with the patch.
https://bugzilla.kernel.org/show_bug.cgi?id=208555#c563
NOTE: 7 step contain typo. "module_install" should be "modules_install"

P.S.
I tried build 5.8.10 with that patch on Ubuntu 22.04 https://bugzilla.kernel.org/show_bug.cgi?id=208555#c649, but it didn't help... Maybe I made a mistake somewhere.
Comment 11 Sergey Belozyorcev 2022-07-16 00:41:44 UTC
I also tried add next line after applied patch

SND_PCI_QUIRK(0x17aa, 0x3856, "Yoga 7 Carbon 14ACN6", ALC287_FIXUP_YOGA9_IAP7_BASS_SPK_PIN)

to sound/pci/hda/patch_realtek.c

After kernel build and install bass not working.

linux-5.18.10/
$ make clean
$ make olddefconfig
$ make -j 16
# make modules_install
# make install

NOTE:
I building kernel from ubuntu with kernel 5.17.0-1012-oem. It's can affect "make olddefconfig"?
Comment 12 tirithen 2022-12-28 09:29:36 UTC
I'm currently using kernel 6.0.12-arch1-1 on my system and still no luck.

Does anyone have an idea of the root cause of the problem? Is is a misconfiguration, bad drivers, or simply some compilation flag that needs to be enabled when building the kernel?
Comment 13 Rene 2023-02-22 06:50:55 UTC
Currently using kernel 6.1.12-arch1-1 and this issue is still present.
Comment 14 Rene 2023-07-31 22:09:28 UTC
A Lenovo Support forum thread has been started for this issue:

https://forums.lenovo.com/t5/Ubuntu/Yoga-Slim-7-Carbon-14ACN6-Linux-Audio/m-p/5158856
Comment 15 oppsig 2024-09-03 12:51:31 UTC
Anyone from Cirrus Logic Audio Codec maintainers that can take a look at this?
Comment 16 Stefan Binding 2024-09-03 14:09:17 UTC
Hi,

Linux support for this laptop is currently in development and will be sent upstream as soon as it has been developed and tested.

Thanks,
Stefan
Comment 17 oppsig 2024-09-03 22:42:24 UTC
Ok, thank you very much Stefan. Let me know if you want me to test any patches!
Comment 18 Stefan Binding 2024-09-30 16:27:51 UTC
Created attachment 306940 [details]
Support Patch

Hi,

I've attached a patch which adds support for this laptop.
This patch contains 4 separate patches squashed into one, for ease of testing, and can be applied onto the mainline v6.11 kernel.

Please test this, and let me know if you have any issues with it, and if it works I can upstream it.

Please note that this does not include the firmware release for this laptop, which  needs to be upstreamed separately. For the moment, I just want to ensure that audio is working with the proposed patch.

Thanks,
Stefan
Comment 19 oppsig 2024-10-01 21:38:05 UTC
Hello Stefan.
I compiled the patch vs 6.11.1.
How should the sound behave different you think compared to current situation without patch.
Or do we first need firmware in order for bass and sound to be working properly?

Any commands you want output out of with patch applied?
Comment 20 oppsig 2024-10-01 21:44:54 UTC
Hello Stefan.
I compiled the patch vs 6.11.1.
How should the sound behave different you think compared to current situation without patch.
Or do we first need firmware in order for bass and sound to be working properly?

Any commands you want output out of with patch applied?
Comment 21 Stefan Binding 2024-10-02 10:06:23 UTC
Hi,

Can you send me a dmesg to start with?

Without specific firmware, the amp should load default firmware, which forces the amp to a low volume.

Do you hear the speakers play any audio?

Thanks,
Stefan
Comment 22 oppsig 2024-10-03 13:25:18 UTC
Created attachment 306954 [details]
dmesg log with patch applied on kernel 6.11.1
Comment 23 oppsig 2024-10-03 13:48:03 UTC
Attached full dmesg log in attachments.
Yes speakers play audio.

Tried to run a dolby atmos youtube test to see if I could hear a big difference with or without patch, can't really tell.
Sound is as you say still low.

I can hear sound when speaker test is running on 5 channels, hard to tell if front and back left/right is coming from same speaker.


❯ speaker-test -t wav -c 5 -l 1

speaker-test 1.2.12

Playback device is default
Stream parameters are 48000Hz, S16_LE, 5 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 26 to 419430
Period size range from 12 to 209715
Periods = 4
was set period_size = 12000
was set buffer_size = 48000
 0 - Front Left
 4 - Front Center
 1 - Front Right
 3 - Rear Right
 2 - Rear Left
Time per period = 6.323674

❯ pactl list sinks                              
Sink #50
	State: SUSPENDED
	Name: alsa_output.pci-0000_04_00.6.HiFi__Speaker__sink
	Description: Family 17h/19h HD Audio Controller Speaker
	Driver: PipeWire
	Sample Specification: s32le 2ch 48000Hz
	Channel Map: front-left,front-right
	Owner Module: 4294967295
	Mute: no
	Volume: front-left: 58968 /  90% / -2.75 dB,   front-right: 58968 /  90% / -2.75 dB
	       balance 0.00
	Base Volume: 65536 / 100% / 0.00 dB
	Monitor Source: alsa_output.pci-0000_04_00.6.HiFi__Speaker__sink.monitor
	Latency: 0 usec, configured 0 usec
	Flags: HARDWARE HW_MUTE_CTRL HW_VOLUME_CTRL DECIBEL_VOLUME LATENCY 
	Properties:
		alsa.card = "1"
		alsa.card_name = "HD-Audio Generic"
		alsa.class = "generic"
		alsa.components = "HDA:10ec0287,17aa3856,00100002"
		alsa.device = "0"
		alsa.driver_name = "snd_hda_intel"
		alsa.id = "Generic_1"
		alsa.long_card_name = "HD-Audio Generic at 0xd03c0000 irq 94"
		alsa.mixer_device = "_ucm0003.hw:Generic_1"
		alsa.mixer_name = "Realtek ALC287"
		alsa.name = "ALC287 Analog"
		alsa.resolution_bits = "16"
		alsa.subclass = "generic-mix"
		alsa.subdevice = "0"
		alsa.subdevice_name = "subdevice #0"
		alsa.sync.id = "00000000:00000000:00000000:00000000"
		api.alsa.card.longname = "HD-Audio Generic at 0xd03c0000 irq 94"
		api.alsa.card.name = "HD-Audio Generic"
		api.alsa.open.ucm = "true"
		api.alsa.path = "hw:Generic_1"
		api.alsa.pcm.card = "1"
		api.alsa.pcm.stream = "playback"
		audio.channels = "2"
		audio.position = "FL,FR"
		card.profile.device = "0"
		device.api = "alsa"
		device.class = "sound"
		device.id = "47"
		device.profile.description = "Speaker"
		device.profile.name = "HiFi: Speaker: sink"
		device.routes = "1"
		factory.name = "api.alsa.pcm.sink"
		media.class = "Audio/Sink"
		device.description = "Family 17h/19h HD Audio Controller"
		node.name = "alsa_output.pci-0000_04_00.6.HiFi__Speaker__sink"
		node.nick = "ALC287 Analog"
		node.pause-on-idle = "false"
		object.path = "alsa:acp:Generic_1:0:playback"
		port.group = "playback"
		priority.driver = "1000"
		priority.session = "1000"
		factory.id = "19"
		clock.quantum-limit = "8192"
		client.id = "41"
		node.driver = "true"
		node.loop.name = "data-loop.0"
		library.name = "audioconvert/libspa-audioconvert"
		object.id = "50"
		object.serial = "50"
		api.acp.auto-port = "false"
		api.alsa.card = "1"
		api.alsa.use-acp = "true"
		api.dbus.ReserveDevice1 = "Audio1"
		api.dbus.ReserveDevice1.Priority = "-20"
		device.bus = "pci"
		device.bus_path = "pci-0000:04:00.6"
		device.enum.api = "udev"
		device.icon_name = "audio-card-analog-pci"
		device.name = "alsa_card.pci-0000_04_00.6"
		device.nick = "HD-Audio Generic"
		device.plugged.usec = "13655140"
		device.product.id = "0x15e3"
		device.product.name = "Family 17h/19h HD Audio Controller"
		device.subsystem = "sound"
		sysfs.path = "/devices/pci0000:00/0000:00:08.1/0000:04:00.6/sound/card1"
		device.vendor.id = "0x1022"
		device.vendor.name = "Advanced Micro Devices, Inc. [AMD]"
		device.string = "1"
	Ports:
		[Out] Speaker: Speaker (type: Speaker, priority: 100, availability unknown)
	Active Port: [Out] Speaker
	Formats:
		pcm
Comment 24 oppsig 2024-10-03 13:53:09 UTC
Just one thing, probably does not matter, but in patch maybe get name of device from product version.
Yoga Slim 7 Carbon 14ACN6.

But I see the patch use right Subsystem Id: 0x17aa3856.


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

Manufacturer:      LENOVO
Product Name:      82L0
Product Version:   Yoga Slim 7 Carbon 14ACN6
Firmware Version:  H5CN31WW
System SKU:        LENOVO_MT_82L0_BU_idea_FM_Yoga Slim 7 Carbon 14ACN6
Board Vendor:      LENOVO
Board Name:        LNVNB161216
Comment 25 Stefan Binding 2024-10-03 15:12:57 UTC
Created attachment 306955 [details]
Support patch v2

Hi,

I noticed an issue with the patch I sent, can you re-test this new one, and send me another dmesg of the result?
Please also let me know if you notice any difference in audio with the new patch.

Thanks,
Stefan
Comment 26 oppsig 2024-10-03 15:24:14 UTC
Ok, no problem, I will report back dmesg in about an hour, just have to recompile.
Comment 27 oppsig 2024-10-03 17:43:15 UTC
Created attachment 306957 [details]
dmesg log with patch V2
Comment 28 oppsig 2024-10-03 17:49:26 UTC
I see two additions with patch V2 when running
sudo dmesg | grep -i audio

[   14.187533] snd_hda_codec_realtek hdaudioC1D0: bound i2c-CLSA0102:00-cs35l41-hda.0 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
[   14.800442] snd_hda_codec_realtek hdaudioC1D0: bound i2c-CLSA0102:00-cs35l41-hda.1 (ops cs35l41_hda_comp_ops [snd_hda_scodec_cs35l41])
Comment 29 Stefan Binding 2024-10-03 18:00:22 UTC
Hi,

I can now see it probing, but there still seems to be an issue, can you sent me an acpi dump of your system:

acpidump > acpidump.out

Thanks,
Stefan
Comment 30 oppsig 2024-10-03 18:22:15 UTC
Created attachment 306958 [details]
acpidump
Comment 31 oppsig 2024-10-03 18:24:56 UTC
Havent had a chance to compare audio yet, but it still works with new patch.
But probably still low, thin and tremble if that makes sense.
Is it best to test with dolby atmos media?
I will compare pre/post patch to see if there is a difference when you are happy with patch.
Comment 32 Stefan Binding 2024-10-04 13:12:52 UTC
Created attachment 306965 [details]
Support Patch v3

Hi,

Looking at the acpidump, there is an additional issue, so I have another patch for you to test. Please send another dmesg.

Thanks,
Stefan
Comment 33 oppsig 2024-10-04 18:10:15 UTC
Hi again, compiling this now stefan. Will probably take 1 hour+.
Which kernel module contains these drivers?
I'm compiling all now so takes a little while.

Oppsig.
Comment 34 oppsig 2024-10-04 19:07:40 UTC
Created attachment 306971 [details]
dmesg log patch v3
Comment 35 oppsig 2024-10-04 19:13:53 UTC
This is compiled vs 6.11.2.
See some errors like this:

[   50.979841] cs35l41-hda i2c-CLSA0102:00-cs35l41-hda.0: Failed waiting for CS35L41_PUP_DONE_MASK: -110
Comment 36 Stefan Binding 2024-10-04 19:48:58 UTC
Hi,

Yes, that is still a problem, I need to have a deeper look.
Unfortunately, I'm away for a couple of weeks, so I'll have to look at it when I get back.

Thanks,
Stefan
Comment 37 oppsig 2024-10-04 19:54:03 UTC
Ok, no problem. Thanks for your help so far though!
I can test later when your back!

Oppsig
Comment 38 Stefan Binding 2024-10-22 16:06:45 UTC
Created attachment 307041 [details]
Debug Enablement Patch

Hi,

Looking at your logs again, I'm not yet sure exactly of the cause of the error.
The error message in question could be caused by the Realtek Codec not supplying the I2S clock to the Amp. I believe this laptop has 4 speakers, 2 of which are attached directly to the Codec, and 2 which are attached to the Amps, supplied with I2S data from the Codec. If I understand correctly, you *are* hearing some audio, even when the cs35l41 driver is not functioning, which leads me to believe the Codec speakers are working.

Its possible that something is required in the Realtek Codec driver to tell the Realtek codec to provide the I2S to the amps.

To start with, I have provided a patch which should add additional debug into the Dmesg logs, can you try this patch, on top of the patch I provided most recently, and send me the full dmesg log?

Thanks,
Stefan
Comment 39 oppsig 2024-10-23 11:05:44 UTC
Yes that is correct, I can hear sound with or without patch enabled, not sure if I am hearing both the codec and amps speakers, or just codec speakers.
Sound is low at 100%, and kinda thin/treamble.

So definitely a big difference to running on Windows.

Anyway, I'm recompiling now on 6.11.5, will report back full dmesg log.

Thanks

--

Oppsig
Comment 40 oppsig 2024-10-23 12:49:38 UTC
Created attachment 307056 [details]
dmesg log patch v3 verbose
Comment 41 oppsig 2024-10-23 12:50:27 UTC
Created attachment 307057 [details]
dmesg log patch v3 verbose
Comment 42 oppsig 2024-10-23 12:54:35 UTC
I see some new error messages so far.

cat dmesg_log_patchv3_verbose | grep -i CLSA0102 

[   14.650216] cs35l41-hda i2c-CLSA0102:00-cs35l41-hda.0: Failed to request 'cirrus/cs35l41-dsp1-spk-prot-17aa3856-l0.wmfw'
[   14.650427] cs35l41-hda i2c-CLSA0102:00-cs35l41-hda.0: Failed to request 'cirrus/cs35l41-dsp1-spk-prot-17aa3856.wmfw'
[   14.650429] cs35l41-hda i2c-CLSA0102:00-cs35l41-hda.0: Falling back to default firmware.
[   14.651546] cs35l41-hda i2c-CLSA0102:00-cs35l41-hda.0: Loading WMFW Firmware: cirrus/cs35l41-dsp1-spk-prot.wmfw
[   14.651549] cs35l41-hda i2c-CLSA0102:00-cs35l41-hda.0: Loading Coefficient File: cirrus/cs35l41-dsp1-spk-prot.bin
[   14.651760] cs35l41-hda i2c-CLSA0102:00-cs35l41-hda.0: Failed to request 'cirrus/cs35l41-dsp1-spk-prot.bincfg'
[   14.651762] cs35l41-hda i2c-CLSA0102:00-cs35l41-hda.0: Missing Tuning Param for file: cirrus/cs35l41-dsp1-spk-prot.bin: -2
Comment 43 oppsig 2024-10-23 12:55:51 UTC
Anyway, just report back if you want me to do additional tests, I've uploaded full dmesg as you requested. thanks a lot! :)
Comment 44 Stefan Binding 2024-10-23 15:44:05 UTC
Created attachment 307058 [details]
Debug Enablement Patch v2

Hi,

Its looking likely that something is missing from the Realtek Codec.
I've attached a new patch to replace the previous one to give some deeper logging.
Please re-test this patch, and send me a new log of the result.

Thanks,
Stefan
Comment 45 oppsig 2024-10-23 18:07:43 UTC
Created attachment 307061 [details]
dmesg_debug_enablement_patch_v2
Comment 46 oppsig 2024-10-23 18:08:14 UTC
Compiled vs 6.11.5.
Comment 47 Stefan Binding 2024-10-24 13:51:02 UTC
Hi,

The new logs indicate that the clock to the Cirrus amps are missing.
The clock is provided by the Realtek Codec, at the point of playback, alongside the other I2S signals.
In most cases, the Realtek Codec does this without having to set anything special, however in some cases, like this one, it needs an additional setting, such as a fixup inside the Realtek driver.
There are examples where such quirks are chained alongside the Cirrus amp quirks, such as the quirk ALC285_FIXUP_SPEAKER2_TO_DAC1, in order to get both codec speakers and amp speakers working.

Unfortunately, we were unable to source this laptop to test this ourselves, so we cannot provide a patch which chains one of these quirks, since this is setting something within the Realtek Codec's driver, and we cannot guarantee that it won't damage your laptop.
Instead, I recommend trying to talk to Realtek to try and get them to tell you which is the appropriate quirk.

Please note, the support patch I provided to you would still be required to get the Cirrus amp to work, in addition to any change to get the Realtek Codec to produce the I2S required by the Cirrus Amp.
If you can find a quirk which provides the I2S to the amp from Realtek, we would be happy to upstream our patches to support this laptop.

Thanks,
Stefan
Comment 48 Matthias Schuster 2024-10-24 14:10:53 UTC
I do have a laptop of this build, that is just lying around.

Purely for the purpose of saving costs on shipment, would I prefer to offer it via VRC or similar, but it could be provided 24/7 this way, in case you guys want to test anything.

I could obviously also assist with it. 

Let me know, if you are interested.
Comment 49 Matthias Schuster 2024-10-24 14:33:03 UTC
Sorry, I misspelled VNC in the last message.

Generally, I am open for remote desktop software. Ideally compatible with Wayland.
Comment 50 oppsig 2024-10-26 14:30:46 UTC
Added some of the people from realtek that has contributed to the patch_realtek.c file in hope that they can help us forward. Please see latest comment from stefan. 
We need clock to the cirrus amps provided by the Realtek Codec!
Comment 51 Jonathan Woithe 2024-10-28 22:55:28 UTC
FYI I don't have the hardware which is the subject of this bug so I am unable to assist.  My work on the Realtek driver is limited to the ALC260 chip in a (now very old but still operational) laptop I have.  Sorry.  I will therefore remove myself from this bug report's CC list.