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@chromium.org> Reviewed-on: https://review.coreboot.org/23659 Reviewed-by: Martin Roth <martinroth@google.com> Tested-by: Martin Roth <martinroth@google.com>
This commit is contained in:
parent
76e9d6b1ac
commit
53b62130c9
|
@ -0,0 +1,2 @@
|
|||
config DRIVERS_GENERIC_ADAU7002
|
||||
bool
|
|
@ -0,0 +1 @@
|
|||
ramstage-$(CONFIG_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
|
||||
};
|
|
@ -0,0 +1,4 @@
|
|||
#include <arch/acpi_device.h>
|
||||
|
||||
struct drivers_generic_adau7002_config {
|
||||
};
|
Loading…
Reference in New Issue