Bug 1228269 - Internal microphone not working on Lenovo Thinkpad E16 Gen 2 (Model 21M5)
Summary: Internal microphone not working on Lenovo Thinkpad E16 Gen 2 (Model 21M5)
Status: NEW
Alias: None
Product: openSUSE Distribution
Classification: openSUSE
Component: Sound (show other bugs)
Version: Leap 15.6
Hardware: x86-64 Other
: P5 - None : Normal (vote)
Target Milestone: ---
Assignee: Takashi Iwai
QA Contact: E-mail List
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-07-24 09:15 UTC by tigerlily
Modified: 2024-07-26 16:56 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---
tiwai: needinfo? (helen)


Attachments
Output of arecord --list-devices (295 bytes, text/plain)
2024-07-24 09:15 UTC, tigerlily
Details
Output of lspci -vk (19.06 KB, text/plain)
2024-07-24 09:18 UTC, tigerlily
Details
Output of lsmod (9.81 KB, text/plain)
2024-07-24 09:18 UTC, tigerlily
Details
alsa-info (43.21 KB, text/plain)
2024-07-24 09:20 UTC, tigerlily
Details
Output of inxi -Axxx (931 bytes, text/plain)
2024-07-24 09:21 UTC, tigerlily
Details
Output of dmesg shortly after boot (135.91 KB, text/plain)
2024-07-24 09:23 UTC, tigerlily
Details
Output of hwinfo (2.16 MB, text/plain)
2024-07-24 09:24 UTC, tigerlily
Details
Output of alsa-info with kernel 6.10.0-lp155.4.gcee765e-default running (43.21 KB, text/plain)
2024-07-24 16:13 UTC, tigerlily
Details
Output of hwinfo with kernel 6.10.0-lp155.4.gcee765e-default running (2.19 MB, text/plain)
2024-07-24 16:14 UTC, tigerlily
Details
Output of with kernel 6.10.0-lp155.4.gcee765e-default running (135.76 KB, text/plain)
2024-07-24 16:14 UTC, tigerlily
Details
Workaround for noise at shutdown (3.96 KB, patch)
2024-07-25 14:56 UTC, Takashi Iwai
Details | Diff
Workaround for noise at shutdown (3.32 KB, patch)
2024-07-26 11:31 UTC, Takashi Iwai
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description tigerlily 2024-07-24 09:15:50 UTC
Created attachment 876227 [details]
Output of arecord --list-devices

Running Leap 15.6 as distributed, apart from the kernel parameter trace_clock=local. Leap 15.6 is up-to-date. Kernel release is 6.4.0-150600.23.14-default.

My machine is a new Lenovo Thinkpad E16 Gen 2 (model 21M5) laptop with an AMD Rembrandt Radeon High Definition Audio card. The Thinkpad
BIOS version is R2KET24W v1.07 (which it was shipped with), although v1.06 is the latest BIOS version showing for my model on Lenovo's support page : 
https://pcsupport.lenovo.com/gb/en/products/laptops-and-netbooks/thinkpad-edge-laptops/thinkpad-e16-gen-2-type-21m5-21m6/21m5/21m5cto1ww/pf51p4m9/downloads/driver-list/component?name=BIOS%2FUEFI&id=5AC6A815-321D-440E-8833-B07A93E0428C

The laptop has a function button (F4) to turn the microphone on and off - I have tried in Linux both with it on and off and no joy. The function button lights up or the light turns off when pressed. There is a toggle setting in the BIOS settings where you can set it so that the microphone function is operated with either (F4) or (Fn + F4).

Both sound input and output work fine in Windows 11, either with or without a headphone plugged in. I did have to enable the internal microphone in Windows Control Panel -Hardware and Sound - Device Manager - Sound, video and Game Controllers - AMD High Definition Audio Device - Properties - Driver before I could get it to work.

In Leap 15.6, if I plug a headphone in, both input and output sound work. If no headphone is plugged in, the internal speakers work, but the internal microphone doesn't. KDE Audio Settings shows AMD Rembrandt Radeon High Definition Audio under "Inactive Cards", with Profile "Off" and no other profile options to choose.

I am attaching some diagnostic outputs. Happy to send more diagnostics if wanted.
Comment 1 tigerlily 2024-07-24 09:18:20 UTC
Created attachment 876228 [details]
Output of lspci -vk
Comment 2 tigerlily 2024-07-24 09:18:50 UTC
Created attachment 876229 [details]
Output of lsmod
Comment 3 tigerlily 2024-07-24 09:20:38 UTC
Created attachment 876230 [details]
alsa-info
Comment 4 tigerlily 2024-07-24 09:21:35 UTC
Created attachment 876231 [details]
Output of inxi -Axxx
Comment 5 tigerlily 2024-07-24 09:23:27 UTC
Created attachment 876232 [details]
Output of dmesg shortly after boot
Comment 6 tigerlily 2024-07-24 09:24:01 UTC
Created attachment 876233 [details]
Output of hwinfo
Comment 7 Takashi Iwai 2024-07-24 12:43:45 UTC
(In reply to tigerlily from comment #0)
> In Leap 15.6, if I plug a headphone in, both input and output sound work. If
> no headphone is plugged in, the internal speakers work, but the internal
> microphone doesn't. 

What does the above mean exactly (about the headphone plugged in)?
Does the "internal" mic work when you plug the headphone?  Or you're testing the (external) headset mic?
Comment 8 tigerlily 2024-07-24 13:25:07 UTC
(In reply to Takashi Iwai from comment #7)
> (In reply to tigerlily from comment #0)
> > In Leap 15.6, if I plug a headphone in, both input and output sound work. If
> > no headphone is plugged in, the internal speakers work, but the internal
> > microphone doesn't. 
> 
> What does the above mean exactly (about the headphone plugged in)?
> Does the "internal" mic work when you plug the headphone?  Or you're testing
> the (external) headset mic?

Apologies if I was unclear. Testing with aplay and arecord, if I plug a headphone in, the headphone records and plays (and there is no sound from the internal speakers). If there is no headphone plugged in, the internal speakers play but the internal microphone doesn't record, whether the light on the keyboard F4 button is illuminated or not.
Comment 9 Takashi Iwai 2024-07-24 14:12:28 UTC
(In reply to tigerlily from comment #8)
> (In reply to Takashi Iwai from comment #7)
> > (In reply to tigerlily from comment #0)
> > > In Leap 15.6, if I plug a headphone in, both input and output sound work. If
> > > no headphone is plugged in, the internal speakers work, but the internal
> > > microphone doesn't. 
> > 
> > What does the above mean exactly (about the headphone plugged in)?
> > Does the "internal" mic work when you plug the headphone?  Or you're testing
> > the (external) headset mic?
> 
> Apologies if I was unclear. Testing with aplay and arecord, if I plug a
> headphone in, the headphone records and plays (and there is no sound from
> the internal speakers).

Do you mean a "headset", right?  That is, a mic is on the headphone.  (In theory, you can record even directly from a headphone, by re-configuring the pin direction, but I don't think you did that :)

> If there is no headphone plugged in, the internal
> speakers play but the internal microphone doesn't record, whether the light
> on the keyboard F4 button is illuminated or not.

That's no wonder.  At least BIOS doesn't specify any built-in microphone as the HD-audio pin configuration, hence there is only a single input source, and that's likely a headset mic.

On many AMD machines, there is a dedicated digital mic device.  But strangely it's not found on your machine, judging from alsa-info.sh output.

To be sure, could you install 6.10.x kernel from OBS Kernel:stable:Backport repo, and test with that?  Please give alsa-info.sh, dmesg and hwinfo outputs from that.
Comment 10 Takashi Iwai 2024-07-24 15:25:44 UTC
(In reply to Takashi Iwai from comment #9)
> On many AMD machines, there is a dedicated digital mic device.  But
> strangely it's not found on your machine, judging from alsa-info.sh output.

Correction: the driver has been loaded (snd_pci_acp6x), but there is no sound card probed, by some reason.

> To be sure, could you install 6.10.x kernel from OBS Kernel:stable:Backport
> repo, and test with that?  Please give alsa-info.sh, dmesg and hwinfo
> outputs from that.

... so please try the above.  If it's still a problem with 6.10.x kernel, we need to ping AMD devs.  OTOH, if it works, I can try backporting the fix.
Comment 11 Takashi Iwai 2024-07-24 15:41:03 UTC
I'm building a test kernel with a quirk addition for your device.  If 6.10.x kernel still doesn't work, please try later the kernel in OBS home:tiwai:bsc1228269 repo, which will be available (once after the build finishes) at:
  http://download.opensuse.org/repositories/home:/tiwai:/bsc1228269/pool/

Oh, BTW, 6.10.x kernel in OBS Kernel:stable:Backport repo is available at:
  http://download.opensuse.org/repositories/Kernel:/stable:/Backport/standard/
Comment 12 tigerlily 2024-07-24 16:13:25 UTC
Created attachment 876239 [details]
Output of alsa-info with kernel 6.10.0-lp155.4.gcee765e-default running
Comment 13 tigerlily 2024-07-24 16:14:19 UTC
Created attachment 876240 [details]
Output of hwinfo with kernel 6.10.0-lp155.4.gcee765e-default running
Comment 14 tigerlily 2024-07-24 16:14:45 UTC
Created attachment 876241 [details]
Output of with kernel 6.10.0-lp155.4.gcee765e-default running
Comment 15 tigerlily 2024-07-24 16:27:43 UTC
(In reply to Takashi Iwai from comment #10)
> (In reply to Takashi Iwai from comment #9)
> > On many AMD machines, there is a dedicated digital mic device.  But
> > strangely it's not found on your machine, judging from alsa-info.sh output.
> 
> Correction: the driver has been loaded (snd_pci_acp6x), but there is no
> sound card probed, by some reason.
> 
> > To be sure, could you install 6.10.x kernel from OBS Kernel:stable:Backport
> > repo, and test with that?  Please give alsa-info.sh, dmesg and hwinfo
> > outputs from that.
> 
> ... so please try the above.  If it's still a problem with 6.10.x kernel, we
> need to ping AMD devs.  OTOH, if it works, I can try backporting the fix.

I tried with kernel 6.10.0-lp155.4.gcee765e-default but the internal microphone still didn't work. KDE Audio Settings only showed speakers, no Inactive Cards. I have attached alsa-info.sh, dmesg and hwinfo outputs. Although pressing F4 on the keyboard made the key light up, pressing it again didn't turn the light off.

And yes, it was a headset, not a headphone :-)

Will try your special kernel next.
Comment 16 tigerlily 2024-07-24 19:48:48 UTC
(In reply to Takashi Iwai from comment #11)
> I'm building a test kernel with a quirk addition for your device.  If 6.10.x
> kernel still doesn't work, please try later the kernel in OBS
> home:tiwai:bsc1228269 repo, which will be available (once after the build
> finishes) at:
>   http://download.opensuse.org/repositories/home:/tiwai:/bsc1228269/pool/
> 
> Oh, BTW, 6.10.x kernel in OBS Kernel:stable:Backport repo is available at:
>  
> http://download.opensuse.org/repositories/Kernel:/stable:/Backport/standard/

That made a huge difference. Running kernel 6.4.0-150600.1.gccaea45-default, all seems to be working ! I spent quite a lot of time testing sound, but I couldn't find anything that didn't work.
Comment 17 tigerlily 2024-07-24 22:55:59 UTC
I do notice one slight thing with the kernel 6.4.0-150600.1.gccaea45-default, which is that there is an audible blip on shutdown, just before a Lenovo splash screen with the openSUSE logo at the bottom displays.
Comment 18 Takashi Iwai 2024-07-25 08:01:59 UTC
Good to hear that the quirk works.  I submitted the fix patch to the upstream now.  I'm going to backport it to Leap 15.6 and TW kernels later.

About the noise at shutdown: does it happen if you mute the speaker volume before shutdown, too?
Comment 19 tigerlily 2024-07-25 09:24:00 UTC
(In reply to Takashi Iwai from comment #18)
> Good to hear that the quirk works.  I submitted the fix patch to the
> upstream now.  I'm going to backport it to Leap 15.6 and TW kernels later.
> 
> About the noise at shutdown: does it happen if you mute the speaker volume
> before shutdown, too?

No, I don't hear any blip if the speaker is muted before shutdown.

I have noticed, though, that if I record something through the internal mic and then play that recording back through the internal speakers, there is an audible blip at the start and end of the recording. If I play some pre-existing audio file, there are no blips. That makes me think the internal mic is recording a blip at the start and end of the recording.
Comment 20 Takashi Iwai 2024-07-25 14:56:20 UTC
OK, the click noise at shutdown could be worked around by implementing the forcible mute at shutdown.

I prepared a test patch, and am now building a test kernel at OBS home:tiwai:bsc1228269-2 repo.  The kernel package will be available later at
  http://download.opensuse.org/repositories/home:/tiwai:/bsc1228269-2/pool/
Please give it a try later.

FWIW, the upstream submission of the fix for the mic was
  https://lore.kernel.org/20240725065442.9293-1-tiwai@suse.de
It's already included in SLE15-SP6 git branch for Leap 15.6 update.
Comment 21 Takashi Iwai 2024-07-25 14:56:52 UTC
Created attachment 876269 [details]
Workaround for noise at shutdown
Comment 22 tigerlily 2024-07-26 08:17:22 UTC
(In reply to Takashi Iwai from comment #21)
> Created attachment 876269 [details]
> Workaround for noise at shutdown

I tried the kernel from http://download.opensuse.org/repositories/home:/tiwai:/bsc1228269-2/pool/, and with this kernel :

The audible blip at shutdown has disappeared.
Recordings made with the internal microphone have an audible blip at the start, but not at the end.
Recordings made with the headset also have an audible blip at the start, but not at the end.
Comment 23 Takashi Iwai 2024-07-26 11:29:56 UTC
The noise at recording is a bug in the ASoC AMD driver.  We need to ping AMD guys.

I reorganized the fix patch for the speaker noise, and yet another test kernel is being built in OBS home:tiwai:bsc1228269-3 repo.
A package will be available later at
  http://download.opensuse.org/repositories/home:/tiwai:/bsc1228269-3/pool/
Please give it a try later again.  Once after confirming this kernel works, I'll submit it to the upstream and backport to Leap 15.6 kernel for the next update.
Comment 24 Takashi Iwai 2024-07-26 11:31:37 UTC
Created attachment 876289 [details]
Workaround for noise at shutdown
Comment 25 tigerlily 2024-07-26 14:12:25 UTC
(In reply to Takashi Iwai from comment #23)
> The noise at recording is a bug in the ASoC AMD driver.  We need to ping AMD
> guys.
> 
> I reorganized the fix patch for the speaker noise, and yet another test
> kernel is being built in OBS home:tiwai:bsc1228269-3 repo.
> A package will be available later at
>   http://download.opensuse.org/repositories/home:/tiwai:/bsc1228269-3/pool/
> Please give it a try later again.  Once after confirming this kernel works,
> I'll submit it to the upstream and backport to Leap 15.6 kernel for the next
> update.

With kernel 6.4.0-150600.1.gdc73025-default:

The headset mic did not record any audible blips, but the internal mic seemed to record an audible blip at both the beginning and end of the recording.

Shutdown was silent.

All else seemed fine, although I did think it was strange that you can select a profile "Play HiFi quality Music (Headphones, Mic1, Mic2)" when no headset or headphone is plugged in. Not sure if that is expected behaviour.
Comment 26 Takashi Iwai 2024-07-26 16:08:44 UTC
Thanks for confirmation.  So it indicates that the remaining click noise bug is specific to ASoC AMD driver.

I submitted the fix patches for the shutdown noise to the upstream, and backported to SLE15-SP6 git branch now.
Comment 27 tigerlily 2024-07-26 16:56:51 UTC
(In reply to Takashi Iwai from comment #26)
> Thanks for confirmation.  So it indicates that the remaining click noise bug
> is specific to ASoC AMD driver.
> 
> I submitted the fix patches for the shutdown noise to the upstream, and
> backported to SLE15-SP6 git branch now.

Many thanks for your help