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 <kramasub@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/55029
Reviewed-by: Furquan Shaikh <furquan@google.com>
Reviewed-by: Raul Rangel <rrangel@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Karthikeyan Ramasubramanian 2021-05-27 16:25:28 -06:00 committed by Raul Rangel
parent 6662fe60e1
commit 4ce48b3a37
2 changed files with 30 additions and 1 deletions

View File

@ -52,6 +52,28 @@ static const char *acp_acpi_name(const struct device *dev)
return "ACPD"; 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 = { static struct device_operations acp_ops = {
.read_resources = pci_dev_read_resources, .read_resources = pci_dev_read_resources,
.set_resources = pci_dev_set_resources, .set_resources = pci_dev_set_resources,
@ -60,7 +82,7 @@ static struct device_operations acp_ops = {
.ops_pci = &pci_dev_ops_pci, .ops_pci = &pci_dev_ops_pci,
.scan_bus = scan_static_bus, .scan_bus = scan_static_bus,
.acpi_name = acp_acpi_name, .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 = { static const struct pci_driver acp_driver __pci_driver = {

View File

@ -4,6 +4,7 @@
#define AMD_COMMON_ACP_H #define AMD_COMMON_ACP_H
#include <stdint.h> #include <stdint.h>
#include <types.h>
struct acp_config { struct acp_config {
enum { enum {
@ -19,6 +20,12 @@ struct acp_config {
u8 acp_i2s_wake_enable; u8 acp_i2s_wake_enable;
/* Enable ACP PME (0 = disable, 1 = enable) */ /* Enable ACP PME (0 = disable, 1 = enable) */
u8 acp_pme_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 */ #endif /* AMD_COMMON_ACP_H */