summaryrefslogtreecommitdiff
path: root/include/acpi
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-07 13:11:57 -0600
committerBin Meng <bmeng.cn@gmail.com>2020-07-17 14:32:24 +0800
commit235723466628c32e30685363377e416696318e84 (patch)
tree352647edf82dab916aa65253cdc3187f07de9800 /include/acpi
parent0e5a0a00d6e44dc0c7e1466ceb3e452b43ceeb1b (diff)
acpi: Support writing a GPIO
Allowing writing out a reference to a GPIO within the ACPI output. This can be used by ACPI code to access a GPIO at runtime. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/acpi')
-rw-r--r--include/acpi/acpi_dp.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/acpi/acpi_dp.h b/include/acpi/acpi_dp.h
index a82330856a..b89e0b8c49 100644
--- a/include/acpi/acpi_dp.h
+++ b/include/acpi/acpi_dp.h
@@ -11,6 +11,8 @@
struct acpi_ctx;
+#include <acpi/acpi_device.h>
+
/*
* Writing Device Properties objects via _DSD
*
@@ -204,6 +206,24 @@ struct acpi_dp *acpi_dp_add_child(struct acpi_dp *dp, const char *name,
struct acpi_dp *child);
/**
+ * acpi_dp_add_gpio() - Add a GPIO to a list of Device Properties
+ *
+ * A new node is added to the end of the property list of @dp, with the
+ * GPIO properties added to the the new node
+ *
+ * @dp: Table to add this property to
+ * @name: Name of property
+ * @ref: Reference to device with a _CRS containing GpioIO or GpioInt
+ * @index: Index of the GPIO resource in _CRS starting from zero
+ * @pin: Pin in the GPIO resource, typically zero
+ * @polarity: GPIO polarity. Note that ACPI_IRQ_ACTIVE_BOTH is not supported
+ * @return pointer to new node, or NULL if out of memory
+ */
+struct acpi_dp *acpi_dp_add_gpio(struct acpi_dp *dp, const char *name,
+ const char *ref, int index, int pin,
+ enum acpi_irq_polarity polarity);
+
+/**
* acpi_dp_write() - Write Device Property hierarchy and clean up resources
*
* This writes the table using acpigen and then frees it