From 4ce48b3a37798ad239b30840591ac023b4d811ed Mon Sep 17 00:00:00 2001 From: Karthikeyan Ramasubramanian Date: Thu, 27 May 2021 16:25:28 -0600 Subject: [PATCH] soc/amd/common/acp: Populate _WOV ACPI method In order to support Audio Co-processor (ACP) DMIC hardware runtime detection on the platform, ACPI _WOV method is populated on the concerned ACP device. This method returns the ACPI Integer value as 1 if ACP DMIC exists on the platform. BUG=b:182960979 TEST=Build and boot to OS in guybrush. Ensure that the _WOV ACPI method is populated under the scope of ACP device. Scope (\_SB.PCI0.GP41.ACPD) { Method (_WOV, 0, NotSerialized) { Return (One) } } Change-Id: Ide84f45f5ea2ae42d5efe71ac6d1595886157045 Signed-off-by: Karthikeyan Ramasubramanian Reviewed-on: https://review.coreboot.org/c/coreboot/+/55029 Reviewed-by: Furquan Shaikh Reviewed-by: Raul Rangel Tested-by: build bot (Jenkins) --- src/soc/amd/common/block/acp/acp.c | 24 ++++++++++++++++++- .../amd/common/block/include/amdblocks/acp.h | 7 ++++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/soc/amd/common/block/acp/acp.c b/src/soc/amd/common/block/acp/acp.c index 3cb7c453c8..465a44e2b6 100644 --- a/src/soc/amd/common/block/acp/acp.c +++ b/src/soc/amd/common/block/acp/acp.c @@ -52,6 +52,28 @@ static const char *acp_acpi_name(const struct device *dev) return "ACPD"; } +static void acp_fill_wov_method(const struct device *dev) +{ + const struct soc_amd_common_config *cfg = soc_get_common_config(); + const char *scope = acpi_device_path(dev); + + if (!cfg->acp_config.dmic_present || !scope) + return; + + /* For ACP DMIC hardware runtime detection on the platform, _WOV method is populated. */ + acpigen_write_scope(scope); /* Scope */ + acpigen_write_method("_WOV", 0); + acpigen_write_return_integer(1); + acpigen_write_method_end(); + acpigen_write_scope_end(); +} + +static void acp_fill_ssdt(const struct device *dev) +{ + acpi_device_write_pci_dev(dev); + acp_fill_wov_method(dev); +} + static struct device_operations acp_ops = { .read_resources = pci_dev_read_resources, .set_resources = pci_dev_set_resources, @@ -60,7 +82,7 @@ static struct device_operations acp_ops = { .ops_pci = &pci_dev_ops_pci, .scan_bus = scan_static_bus, .acpi_name = acp_acpi_name, - .acpi_fill_ssdt = acpi_device_write_pci_dev, + .acpi_fill_ssdt = acp_fill_ssdt, }; static const struct pci_driver acp_driver __pci_driver = { diff --git a/src/soc/amd/common/block/include/amdblocks/acp.h b/src/soc/amd/common/block/include/amdblocks/acp.h index 2abc600f28..a4c926d246 100644 --- a/src/soc/amd/common/block/include/amdblocks/acp.h +++ b/src/soc/amd/common/block/include/amdblocks/acp.h @@ -4,6 +4,7 @@ #define AMD_COMMON_ACP_H #include +#include struct acp_config { enum { @@ -19,6 +20,12 @@ struct acp_config { u8 acp_i2s_wake_enable; /* Enable ACP PME (0 = disable, 1 = enable) */ u8 acp_pme_enable; + + /* + * DMIC present (optional) to support ACP DMIC hardware runtime detection on the + * platform. If dmic_present is set to true, it will populate the _WOV ACPI method. + */ + bool dmic_present; }; #endif /* AMD_COMMON_ACP_H */