summaryrefslogtreecommitdiff
path: root/src/superio/nuvoton/npcd378/superio.c
diff options
context:
space:
mode:
authorPatrick Rudolph <patrick.rudolph@9elements.com>2018-07-17 11:41:10 +0200
committerPatrick Georgi <pgeorgi@google.com>2018-07-24 11:50:52 +0000
commit9ae150a59121a95d11bba208a66d203bfe45c6d2 (patch)
tree14a356f02e7f7999927ff26a3ebc309381fc007e /src/superio/nuvoton/npcd378/superio.c
parent999094378261691f66eedd42a1d631ffb24702d3 (diff)
superio/nuvoton/npcd378: Add ACPI code for S3 resume
Configure SuperIO on shutdown to keep devices enabled, set green LED to fading on sleep and normal on wake. Add SSDT to write LDN4 IOBASE addresses stored in devicetree.cb. Tested on HP8200: * Wakes from power button or USB keyboard. * LED is fading Change-Id: I2035249a39616aa2d87bd93f9e49c70d231546cc Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Reviewed-on: https://review.coreboot.org/27510 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Felix Held <felix-coreboot@felixheld.de>
Diffstat (limited to 'src/superio/nuvoton/npcd378/superio.c')
-rw-r--r--src/superio/nuvoton/npcd378/superio.c53
1 files changed, 53 insertions, 0 deletions
diff --git a/src/superio/nuvoton/npcd378/superio.c b/src/superio/nuvoton/npcd378/superio.c
index e80d083bb2..1802193033 100644
--- a/src/superio/nuvoton/npcd378/superio.c
+++ b/src/superio/nuvoton/npcd378/superio.c
@@ -25,6 +25,8 @@
#include <pc80/keyboard.h>
#include <stdlib.h>
#include <superio/conf_mode.h>
+#include <arch/acpi.h>
+#include <arch/acpigen.h>
#include "npcd378.h"
@@ -101,6 +103,53 @@ static void npcd378_init(struct device *dev)
}
}
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+static void npcd378_ssdt(struct device *dev)
+{
+ struct resource *res;
+
+ const char *scope = acpi_device_path(dev);
+ if (!scope) {
+ printk(BIOS_ERR, "%s: Missing ACPI scope\n", dev_path(dev));
+ return;
+ }
+
+ switch (dev->path.pnp.device) {
+ case NPCD378_PWR: {
+ res = find_resource(dev, PNP_IDX_IO0);
+ if (!res || !res->base) {
+ printk(BIOS_ERR, "NPCD378: LDN%u IOBASE not set.\n",
+ NPCD378_PWR);
+ break;
+ }
+
+ acpigen_write_scope(scope);
+ acpigen_write_name_integer("SWB", res->base);
+ acpigen_write_name_integer("SWL", res->size);
+ acpigen_pop_len(); /* pop scope */
+
+ res = find_resource(dev, PNP_IDX_IO1);
+ if (!res || !res->base) {
+ printk(BIOS_ERR, "NPCD378: LDN%u IOBASE2 not set.\n",
+ NPCD378_PWR);
+ break;
+ }
+
+ acpigen_write_scope(scope);
+ acpigen_write_name_integer("RNB", res->base);
+ acpigen_write_name_integer("RNL", res->size);
+ acpigen_pop_len(); /* pop scope */
+ break;
+ }
+ }
+}
+
+static const char *npcd378_acpi_name(const struct device *dev)
+{
+ return "SIO0";
+}
+#endif
+
static struct device_operations ops = {
.read_resources = pnp_read_resources,
.set_resources = pnp_set_resources,
@@ -108,6 +157,10 @@ static struct device_operations ops = {
.enable = pnp_alt_enable,
.init = npcd378_init,
.ops_pnp_mode = &pnp_conf_mode_8787_aa,
+#if IS_ENABLED(CONFIG_HAVE_ACPI_TABLES)
+ .acpi_fill_ssdt_generator = npcd378_ssdt,
+ .acpi_name = npcd378_acpi_name,
+#endif
};
static struct pnp_info pnp_dev_info[] = {