aboutsummaryrefslogtreecommitdiff
path: root/src/ec/lenovo/h8/ssdt.c
diff options
context:
space:
mode:
authorPatrick Rudolph <siro@das-labor.org>2017-11-14 19:00:20 +0100
committerPatrick Georgi <pgeorgi@google.com>2018-07-09 09:19:59 +0000
commitf1114d891865e70ae1f2ba58844fec11d055ae3a (patch)
tree93d58cca13f40c9ee0edee69ebd7b7c3fa62dede /src/ec/lenovo/h8/ssdt.c
parent01d2e46ddb9e17bda911ccce97bfef8ad77b1cbc (diff)
ec/lenovo/h8/acpi: Add BDC interface
* Add SSDT generator to add dynamic ACPI code. * Implement GBDC and SBDC for thinkpad_acpi kernel module. Required for BDC power control from userspace. Tested on Lenovo T430: The bluetooth module is detected and can be powercycled using network manager. Change-Id: Ida825196650966194a883945896a038b0790fe45 Signed-off-by: Patrick Rudolph <siro@das-labor.org> Reviewed-on: https://review.coreboot.org/20985 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Alexander Couzens <lynxis@fe80.eu> Reviewed-by: Patrick Georgi <pgeorgi@google.com>
Diffstat (limited to 'src/ec/lenovo/h8/ssdt.c')
-rw-r--r--src/ec/lenovo/h8/ssdt.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/ec/lenovo/h8/ssdt.c b/src/ec/lenovo/h8/ssdt.c
new file mode 100644
index 0000000000..35570b0b72
--- /dev/null
+++ b/src/ec/lenovo/h8/ssdt.c
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2017 Patrick Rudolph <siro@das-labor.org>
+ *
+ * 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 <console/console.h>
+#include <arch/acpigen.h>
+#include <string.h>
+
+#include "h8.h"
+#include "chip.h"
+
+static char *h8_dsdt_scope(struct device *dev, const char *scope)
+{
+ static char buf[DEVICE_PATH_MAX] = {};
+ const char *path = acpi_device_path(dev);
+
+ memset(buf, 0, sizeof(buf));
+ snprintf(buf, sizeof(buf) - 1, "%s.%s", path, scope);
+
+ return buf;
+}
+
+/*
+ * Generates EC SSDT.
+ */
+void h8_ssdt_generator(struct device *dev)
+{
+ if (!acpi_device_path(dev))
+ return;
+
+ printk(BIOS_INFO, "ACPI: * H8\n");
+
+ /* Scope HKEY */
+ acpigen_write_scope(h8_dsdt_scope(dev, "HKEY"));
+
+ /* Used by thinkpad_acpi */
+ acpigen_write_name_byte("HBDC", h8_has_bdc(dev) ? ONE_OP : ZERO_OP);
+
+ acpigen_pop_len(); /* Scope HKEY */
+}