mb/google/nissa/var/rull: Configure Acoustic noise mitigation
[coreboot2.git] / src / soc / amd / common / block / acp / acp.c
bloba43792eea7ef03ced2800e20011171667461f530
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <acpi/acpi_device.h>
4 #include <acpi/acpigen.h>
5 #include <amdblocks/acp.h>
6 #include <amdblocks/acpimmio.h>
7 #include <amdblocks/chip.h>
8 #include <device/device.h>
9 #include <device/pci.h>
10 #include <device/pci_ops.h>
11 #include <commonlib/helpers.h>
12 #include "acp_def.h"
14 _Static_assert(!(CONFIG(SOC_AMD_COMMON_BLOCK_ACP_GEN1) && CONFIG(SOC_AMD_COMMON_BLOCK_ACP_GEN2)),
15 "Cannot select both ACP_GEN1 and ACP_GEN2 - check your config");
17 static const char *acp_acpi_name(const struct device *dev)
19 return "ACPD";
22 static void acp_fill_wov_method(const struct device *dev)
24 const struct soc_amd_common_config *cfg = soc_get_common_config();
25 const char *scope = acpi_device_path(dev);
27 if (!cfg->acp_config.dmic_present || !scope)
28 return;
30 /* For ACP DMIC hardware runtime detection on the platform, _WOV method is populated. */
31 acpigen_write_scope(scope); /* Scope */
32 acpigen_write_method("_WOV", 0);
33 acpigen_write_return_integer(1);
34 acpigen_write_method_end();
35 acpigen_write_scope_end();
38 static void acp_fill_ssdt(const struct device *dev)
40 acpi_device_write_pci_dev(dev);
41 acp_fill_wov_method(dev);
44 struct device_operations amd_acp_ops = {
45 .read_resources = pci_dev_read_resources,
46 .set_resources = pci_dev_set_resources,
47 .enable_resources = pci_dev_enable_resources,
48 .init = acp_init,
49 .ops_pci = &pci_dev_ops_pci,
50 .scan_bus = scan_static_bus,
51 .acpi_name = acp_acpi_name,
52 .acpi_fill_ssdt = acp_fill_ssdt,