Hello Daniel Kurtz,
I'd like you to do a code review. Please visit
https://review.coreboot.org/23659
to review the following change.
Change subject: drivers/adau7002: Add driver for handling ADAU7002
......................................................................
drivers/adau7002: Add driver for handling ADAU7002
The ADAU7002 is a family of Stereo PDM-to-I2S/TDM conversion ICs from
Analog Devices. On some boards they are a used to convert a PDM audio
data stream from a DMIC to an I2S signal.
Add a driver for populating ACPI table entries for this part.
BUG=b:72121803
TEST=With grunt audio kernel patches, "aplay -l" shows playback devices:
**** List of PLAYBACK Hardware Devices ****
card 0: acpd7219m98357 [acpd7219m98357], device 0: Playback da7219-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 0: acpd7219m98357 [acpd7219m98357], device 2: HiFi Playback HiFi-2 []
Subdevices: 1/1
Subdevice #0: subdevice #0
Change-Id: I2b64c8e1cbc0a68984482a7d496f8c4498cb6cbe
Signed-off-by: Daniel Kurtz <djkurtz(a)chromium.org>
---
A src/drivers/generic/adau7002/Kconfig
A src/drivers/generic/adau7002/Makefile.inc
A src/drivers/generic/adau7002/adau7002.c
A src/drivers/generic/adau7002/chip.h
4 files changed, 83 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/59/23659/1
diff --git a/src/drivers/generic/adau7002/Kconfig b/src/drivers/generic/adau7002/Kconfig
new file mode 100644
index 0000000..b981a30
--- /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 0000000..b2f7dfe
--- /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 0000000..17950f0
--- /dev/null
+++ b/src/drivers/generic/adau7002/adau7002.c
@@ -0,0 +1,76 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 Google Inc.
+ *
+ * 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)
+{
+ struct drivers_generic_adau7002_config *config = dev->chip_info;
+
+ if (!dev->enabled || !config)
+ 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 0000000..809a680
--- /dev/null
+++ b/src/drivers/generic/adau7002/chip.h
@@ -0,0 +1,4 @@
+#include <arch/acpi_device.h>
+
+struct drivers_generic_adau7002_config {
+};
--
To view, visit https://review.coreboot.org/23659
To unsubscribe, or for help writing mail filters, visit https://review.coreboot.org/settings
Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2b64c8e1cbc0a68984482a7d496f8c4498cb6cbe
Gerrit-Change-Number: 23659
Gerrit-PatchSet: 1
Gerrit-Owner: Daniel Kurtz <djkurtz(a)google.com>
Gerrit-Reviewer: Daniel Kurtz <djkurtz(a)chromium.org>