diff mbox series

[v2] ASoC: AMD Renoir - add DMI table to avoid the ACP mic probe (broken BIOS)

Message ID 20201208171200.2737620-1-perex@perex.cz (mailing list archive)
State Accepted
Commit 718c406e1ffaca4eac987b957bbb36ce1090797a
Headers show
Series [v2] ASoC: AMD Renoir - add DMI table to avoid the ACP mic probe (broken BIOS) | expand

Commit Message

Jaroslav Kysela Dec. 8, 2020, 5:12 p.m. UTC
Users reported that some Lenovo AMD platforms do not have ACP microphone,
but the BIOS advertises it via ACPI.

This patch create a simple DMI table, where those machines with the broken
BIOS can be added. The DMI description for Lenovo IdeaPad 5 and
IdeaPad Flex 5 devices are added there.

Also describe the dmic_acpi_check kernel module parameter in a more
understandable way.

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1892115
Cc: <stable@kernel.org>
Cc: Vijendar Mukunda <Vijendar.Mukunda@amd.com>
Cc: Mark Brown <broonie@kernel.org>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
 sound/soc/amd/renoir/rn-pci-acp3x.c | 28 +++++++++++++++++++++++-----
 1 file changed, 23 insertions(+), 5 deletions(-)

Comments

Mark Brown Dec. 9, 2020, 3:19 p.m. UTC | #1
On Tue, 8 Dec 2020 18:12:00 +0100, Jaroslav Kysela wrote:
> Users reported that some Lenovo AMD platforms do not have ACP microphone,
> but the BIOS advertises it via ACPI.
> 
> This patch create a simple DMI table, where those machines with the broken
> BIOS can be added. The DMI description for Lenovo IdeaPad 5 and
> IdeaPad Flex 5 devices are added there.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/1] ASoC: AMD Renoir - add DMI table to avoid the ACP mic probe (broken BIOS)
      commit: 718c406e1ffaca4eac987b957bbb36ce1090797a

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Eliot Blennerhassett Dec. 15, 2020, 3:25 a.m. UTC | #2
On 9/12/20 6:12 am, Jaroslav Kysela wrote:
> Users reported that some Lenovo AMD platforms do not have ACP microphone,
> but the BIOS advertises it via ACPI.

Can you briefly explain how to confirm that this specific problem
exists, and what info you would need from me to add a new machine?


I have a Lenovo E14 Gen 2 with AMD that claims to have DMIC but no
evidence of it working.

My workaround so far has been blacklisting the related modules...
blacklist snd-soc-dmic
blacklist snd-acp3x-rn
blacklist snd-acp3x-pdm-dma

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

--
Eliot
Vijendar Mukunda Dec. 17, 2020, 6:22 a.m. UTC | #3
On 15/12/20 8:55 am, Eliot Blennerhassett wrote:
> On 9/12/20 6:12 am, Jaroslav Kysela wrote:
>> Users reported that some Lenovo AMD platforms do not have ACP microphone,
>> but the BIOS advertises it via ACPI.
> 
> Can you briefly explain how to confirm that this specific problem
> exists, and what info you would need from me to add a new machine?

On Renoir APU based platforms, DMIC presence will be detected by _WOV 
method.
If DMIC is connected to APU, _WOV integer will set to 0x01.
This has to be updated correctly from ACPI tables.

On Few machines, It was found that BIOS is not advertising ACPI entries
correctly.
Jaroslav added additional DMI check for the platforms with Broken BIOS.

--
Vijendar
> 
> 
> I have a Lenovo E14 Gen 2 with AMD that claims to have DMIC but no
> evidence of it working.
> 
> My workaround so far has been blacklisting the related modules...
> blacklist snd-soc-dmic
> blacklist snd-acp3x-rn
> blacklist snd-acp3x-pdm-dma
> 
> alsa-info:
> https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Falsa-project.org%2Fdb%2F%3Ff%3D0c4d6f062e6065d47ee944f5953f0aaa328d4b44&amp;data=04%7C01%7CVijendar.Mukunda%40amd.com%7Ce2917dcc2e0846f7b3b908d8a0a915d8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637435995634448015%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C2000&amp;sdata=uqPjeXg6OWt0vXTTUa6R1tewu5QAGoHFkg18ov16mpU%3D&amp;reserved=0
> 
> --
> Eliot
>
diff mbox series

Patch

diff --git a/sound/soc/amd/renoir/rn-pci-acp3x.c b/sound/soc/amd/renoir/rn-pci-acp3x.c
index b943e59fc302..60a3e2f442db 100644
--- a/sound/soc/amd/renoir/rn-pci-acp3x.c
+++ b/sound/soc/amd/renoir/rn-pci-acp3x.c
@@ -6,6 +6,7 @@ 
 
 #include <linux/pci.h>
 #include <linux/acpi.h>
+#include <linux/dmi.h>
 #include <linux/module.h>
 #include <linux/io.h>
 #include <linux/delay.h>
@@ -20,14 +21,13 @@  module_param(acp_power_gating, int, 0644);
 MODULE_PARM_DESC(acp_power_gating, "Enable acp power gating");
 
 /**
- * dmic_acpi_check = -1 - Checks ACPI method to know DMIC hardware status runtime
- *                 = 0 - Skips the DMIC device creation and returns probe failure
- *                 = 1 - Assumes that platform has DMIC support and skips ACPI
- *                       method check
+ * dmic_acpi_check = -1 - Use ACPI/DMI method to detect the DMIC hardware presence at runtime
+ *                 =  0 - Skip the DMIC device creation and return probe failure
+ *                 =  1 - Force DMIC support
  */
 static int dmic_acpi_check = ACP_DMIC_AUTO;
 module_param(dmic_acpi_check, bint, 0644);
-MODULE_PARM_DESC(dmic_acpi_check, "checks Dmic hardware runtime");
+MODULE_PARM_DESC(dmic_acpi_check, "Digital microphone presence (-1=auto, 0=none, 1=force)");
 
 struct acp_dev_data {
 	void __iomem *acp_base;
@@ -163,6 +163,17 @@  static int rn_acp_deinit(void __iomem *acp_base)
 	return 0;
 }
 
+static const struct dmi_system_id rn_acp_quirk_table[] = {
+	{
+		/* Lenovo IdeaPad Flex 5 14ARE05, IdeaPad 5 15ARE05 */
+		.matches = {
+			DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "LENOVO"),
+			DMI_EXACT_MATCH(DMI_BOARD_NAME, "LNVNB161216"),
+		}
+	},
+	{}
+};
+
 static int snd_rn_acp_probe(struct pci_dev *pci,
 			    const struct pci_device_id *pci_id)
 {
@@ -172,6 +183,7 @@  static int snd_rn_acp_probe(struct pci_dev *pci,
 	acpi_handle handle;
 	acpi_integer dmic_status;
 #endif
+	const struct dmi_system_id *dmi_id;
 	unsigned int irqflags;
 	int ret, index;
 	u32 addr;
@@ -232,6 +244,12 @@  static int snd_rn_acp_probe(struct pci_dev *pci,
 			goto de_init;
 		}
 #endif
+		dmi_id = dmi_first_match(rn_acp_quirk_table);
+		if (dmi_id && !dmi_id->driver_data) {
+			dev_info(&pci->dev, "ACPI settings override using DMI (ACP mic is not present)");
+			ret = -ENODEV;
+			goto de_init;
+		}
 	}
 
 	adata->res = devm_kzalloc(&pci->dev,