Bug 216270

Summary: Builtin microphone doesn't work on ASUS Zenbook S 13 OLED 2022 (UM5302TA)
Product: Drivers Reporter: XiaoYan Li (lxy.lixiaoyan)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: RESOLVED CODE_FIX    
Severity: normal CC: iam, itmymaill, lub.the.studio, mario.limonciello, travisghansen
Priority: P1    
Hardware: AMD   
OS: Linux   
Kernel Version: 5.19-rc7 Subsystem:
Regression: No Bisected commit-id:
Attachments: /proc/asound/card1/codec#0
DSDT

Description XiaoYan Li 2022-07-22 17:51:12 UTC
Created attachment 301476 [details]
/proc/asound/card1/codec#0

CPU: AMD Ryzen 6800U
Codec: Realtek ALC294
Comment 1 XiaoYan Li 2022-07-30 15:28:21 UTC
Created attachment 301517 [details]
DSDT
Comment 2 XiaoYan Li 2022-07-30 15:50:27 UTC
$ amixer scontents
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 9215 [14%] [on]
  Front Right: Playback 9215 [14%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 26213 [40%] [on]
  Front Right: Capture 26213 [40%] [on]

The device is found, but it is unable to record any sound.
Comment 3 Mario Limonciello (AMD) 2022-09-13 04:34:29 UTC
If your design has a DMIC connected, the kernel needs to know about it.  Either via an ACPI entryor via a kernel quirk.

Have you tried to add your system to the quirk list in https://github.com/torvalds/linux/blob/master/sound/soc/amd/yc/acp6x-mach.c#L47 to see if that gets things working?
Comment 4 XiaoYan Li 2022-09-13 07:23:01 UTC
It is unsuccessful. I'm unsure if I'm doing it correctly.

diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c
index e0b24e1daef3..5eab3baf3573 100644
--- a/sound/soc/amd/yc/acp6x-mach.c
+++ b/sound/soc/amd/yc/acp6x-mach.c
@@ -171,6 +171,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "21J6"),
                }
        },
+       {
+               .driver_data = &acp6x_card,
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK COMPUTER INC."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "UM5302TA"),
+               }
+       },
        {}
 };

---

Base Board Information
        Manufacturer: ASUSTeK COMPUTER INC.
        Product Name: UM5302TA
Comment 5 XiaoYan Li 2022-09-13 07:27:35 UTC
Edited: I can see "kernel: acp_yc_mach acp_yc_mach.0: Enabling ACP DMIC support via DMI" in dmesg.
Comment 6 Mario Limonciello (AMD) 2022-09-13 20:05:29 UTC
> Edited: I can see "kernel: acp_yc_mach acp_yc_mach.0: Enabling ACP DMIC
> support via DMI" in dmesg.

OK then your quirk "worked", but there must be a different design here in this system.
Comment 7 XiaoYan Li 2022-09-15 02:12:31 UTC
My apologies. It is effective. I chose the incorrect device for capturing previously. (Despite the fact that the volume is quite low)
Comment 8 Mario Limonciello (AMD) 2022-09-15 11:10:21 UTC
Ah glad it works.  Can you submit it to upstream?
Comment 9 Sebastian S. 2022-09-20 08:52:10 UTC
I can confirm that adding an entry to this quirks table for the Lenovo Yoga Slim 7 Pro X fixes the missing microphone. I applied this patch

diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c
index e0b24e1daef3..735acfb23bc4 100644
--- a/sound/soc/amd/yc/acp6x-mach.c
+++ b/sound/soc/amd/yc/acp6x-mach.c
@@ -171,6 +171,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "21J6"),
 		}
 	},
+	{
+		.driver_data = &acp6x_card,
+		.matches = {
+			DMI_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "82"),
+		}
+	},
 	{}
 };
 
---

Where and how should I report this? Is there already a growing patch set somewhere for growing this quirks table?

BTW the table contains many entries for vendor LENOVO with specific product name matchers like DMI_MATCH(DMI_PRODUCT_NAME, "21J6"). Wouldn't it be sufficient to compress all these matches into a single line DMI_MATCH(DMI_PRODUCT_NAME, "21"), i.e., only mentioning the first two letters, which seems to be the product line?
Comment 10 Travis Glenn Hansen 2022-09-20 14:18:49 UTC
AMD devs are aware over here: https://bugzilla.kernel.org/show_bug.cgi?id=216299
Comment 11 Duc Anh Le 2023-02-27 18:52:16 UTC
Hello, I have the same problem on my HP OMEN 16 running 6800H.
I tried to add those lines:

{
	.driver_data = &acp6x_card,
	.matches = {
		DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
		DMI_MATCH(DMI_PRODUCT_NAME, "OMEN by HP Gaming Laptop 16-n0xxx"),
	}
},

at the end of the quirks table but then can't start a pull request (it shows "An owner of this repository has limited the ability to open a pull request to users that are collaborators on this repository.")

Can't someone help please?
Comment 12 Mario Limonciello (AMD) 2023-02-27 19:09:45 UTC
Duc Anh Le,

Kernel patches are submitted over plain text email, not pull requests.

Here is the submission guide for patches.
https://www.kernel.org/doc/html/next/process/submitting-patches.html

BTW, look for other keys for your system.  There might be a better one to match than DMI_PRODUCT_NAME.  Maybe DMI_PRODUCT_FAMILY or DMI_BOARD_NAME.
Comment 13 Duc Anh Le 2023-02-27 20:26:23 UTC
Hi Mario Limonciello, thanks for your response.

Follow the guide from your link, I applied this patch and used DMI_BOARD_NAME instead of DMI_PRODUCT_NAME:

diff --git a/sound/soc/amd/yc/acp6x-mach.c b/sound/soc/amd/yc/acp6x-mach.c
index 36314753923b..baad3bce3b7c 100644
--- a/sound/soc/amd/yc/acp6x-mach.c
+++ b/sound/soc/amd/yc/acp6x-mach.c
@@ -255,6 +255,13 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "15NBC1011"),
                }
        },
+       {
+               .driver_data = &acp6x_card,
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "HP"),
+                       DMI_MATCH(DMI_BOARD_NAME, "8A43"),
+               }
+       },
        {}
 };

Hope that the patch will be online soon.
Comment 14 Mario Limonciello (AMD) 2023-02-27 21:20:56 UTC
> Hope that the patch will be online soon.

Would you be able to submit it the ASLA mailing list following that guide?  If you're not comfortable, I can do it for you.
Comment 15 Duc Anh Le 2023-02-27 21:31:33 UTC
> Would you be able to submit it the ASLA mailing list following that guide? 
> If you're not comfortable, I can do it for you.

I have just received the feedback for the patch which I sent. I tried my best but look like I didn't send it in the canonical format. I appreciate very much if you can do it.

Sorry I just have another question, do I need to update the kernel when the patch is online? I'm really a beginner into Linux.
Comment 16 Mario Limonciello (AMD) 2023-02-27 21:55:22 UTC
It looks like it was just included in this commit:
22ce6843abec ("ASoC: amd: yp: Add OMEN by HP Gaming Laptop 16z-n000 to quirks")

It should be part of kernel 6.3.
Comment 17 Duc Anh Le 2023-02-27 22:30:18 UTC
> It looks like it was just included in this commit:
> 22ce6843abec ("ASoC: amd: yp: Add OMEN by HP Gaming Laptop 16z-n000 to
> quirks")
> 
> It should be part of kernel 6.3.

They used DMI_PRODUCT_NAME "16z-n000" when mine is "16-n0xxx". Will it work for me?

Now I understand why you want to use DMI_BOARD_NAME instead of DMI_PRODUCT_NAME.
Comment 18 Mario Limonciello (AMD) 2023-02-27 22:51:34 UTC
It might not.  I suggest you open a thread with the author of that commit and the mailing list to discuss what to do in this case.
Comment 19 Vyacheslav 2023-11-29 19:33:13 UTC
Hi guys, is it still possible to add edits for my laptop? Model: Asus s16x 6800H gen.

dmi output: Base Board Information


	Manufacturer: ASUSTeK COMPUTER INC.

	Product Name: M5602RA