summaryrefslogtreecommitdiff
path: root/src/drivers/generic/adau7002
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/generic/adau7002')
-rw-r--r--src/drivers/generic/adau7002/Kconfig2
-rw-r--r--src/drivers/generic/adau7002/Makefile.inc1
-rw-r--r--src/drivers/generic/adau7002/adau7002.c74
-rw-r--r--src/drivers/generic/adau7002/chip.h4
4 files changed, 81 insertions, 0 deletions
diff --git a/src/drivers/generic/adau7002/Kconfig b/src/drivers/generic/adau7002/Kconfig
new file mode 100644
index 0000000000..b981a3065b
--- /dev/null
+++ b/src/drivers/generic/adau7002/Kconfig
@@ -0,0 +1,2 @@
+config DRIVERS_GENERIC_ADAU7002
+ bool
diff --git a/src/drivers/generic/adau7002/Makefile.inc b/src/drivers/generic/adau7002/Makefile.inc
new file mode 100644
index 0000000000..b2f7dfef52
--- /dev/null
+++ b/src/drivers/generic/adau7002/Makefile.inc
@@ -0,0 +1 @@
+ramstage-$(CONFIG_DRIVERS_GENERIC_ADAU7002) += adau7002.c
diff --git a/src/drivers/generic/adau7002/adau7002.c b/src/drivers/generic/adau7002/adau7002.c
new file mode 100644
index 0000000000..d21d513c59
--- /dev/null
+++ b/src/drivers/generic/adau7002/adau7002.c
@@ -0,0 +1,74 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 Google LLC
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <arch/acpi_device.h>
+#include <arch/acpigen.h>
+#include <console/console.h>
+#include <device/device.h>
+#include <device/path.h>
+#include <stdint.h>
+#include <string.h>
+#include "chip.h"
+
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+
+#define ADAU7002_ACPI_NAME "ADAU"
+#define ADAU7002_ACPI_HID "ADAU7002"
+
+static void adau7002_fill_ssdt(struct device *dev)
+{
+ if (!dev->enabled)
+ return;
+
+ /* Device */
+ acpigen_write_scope(acpi_device_scope(dev));
+ acpigen_write_device(acpi_device_name(dev));
+ acpigen_write_name_string("_HID", ADAU7002_ACPI_HID);
+ acpigen_write_name_integer("_UID", 0);
+ acpigen_write_name_string("_DDN", dev->chip_ops->name);
+ acpigen_write_STA(ACPI_STATUS_DEVICE_ALL_ON);
+
+ acpigen_pop_len(); /* Device */
+ acpigen_pop_len(); /* Scope */
+
+ printk(BIOS_INFO, "%s: %s\n", acpi_device_path(dev),
+ dev->chip_ops->name);
+}
+
+static const char *adau7002_acpi_name(const struct device *dev)
+{
+ return ADAU7002_ACPI_NAME;
+}
+#endif
+
+static struct device_operations adau7002_ops = {
+ .read_resources = DEVICE_NOOP,
+ .set_resources = DEVICE_NOOP,
+ .enable_resources = DEVICE_NOOP,
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+ .acpi_name = &adau7002_acpi_name,
+ .acpi_fill_ssdt_generator = &adau7002_fill_ssdt,
+#endif
+};
+
+static void adau7002_enable(struct device *dev)
+{
+ dev->ops = &adau7002_ops;
+}
+
+struct chip_operations drivers_generic_adau7002_ops = {
+ CHIP_NAME("Analog Digital DMIC")
+ .enable_dev = &adau7002_enable
+};
diff --git a/src/drivers/generic/adau7002/chip.h b/src/drivers/generic/adau7002/chip.h
new file mode 100644
index 0000000000..809a680dee
--- /dev/null
+++ b/src/drivers/generic/adau7002/chip.h
@@ -0,0 +1,4 @@
+#include <arch/acpi_device.h>
+
+struct drivers_generic_adau7002_config {
+};