summaryrefslogtreecommitdiff
path: root/include/acpi
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-07 22:11:47 +0300
committerBin Meng <bmeng.cn@gmail.com>2020-07-17 09:32:24 +0300
commit4ebc940b39b6a43de9d1fa74653321cd6fdb4d3a (patch)
tree879e368605d9dae2a7cf4ba960711554c9b28eba /include/acpi
parenta9e0a077df5509c3d4b49e745c746c38a4f9a7a1 (diff)
downloadu-boot-4ebc940b39b6a43de9d1fa74653321cd6fdb4d3a.tar.xz
acpi: Support generation of a GPIO/irq for a device
Some devices use interrupts but some use GPIOs. Since these are fully specified in the device tree we can automatically produce the correct ACPI descriptor for a device. Add a function to handle this. 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_device.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/acpi/acpi_device.h b/include/acpi/acpi_device.h
index 002e835644..67a242eb75 100644
--- a/include/acpi/acpi_device.h
+++ b/include/acpi/acpi_device.h
@@ -255,4 +255,19 @@ int acpi_device_write_gpio(struct acpi_ctx *ctx, const struct acpi_gpio *gpio);
int acpi_device_write_gpio_desc(struct acpi_ctx *ctx,
const struct gpio_desc *desc);
+/**
+ * acpi_device_write_interrupt_or_gpio() - Write interrupt or GPIO to ACPI
+ *
+ * This reads an interrupt from the device tree "interrupts-extended" property,
+ * if available. If not it reads the first GPIO with the name @prop.
+ *
+ * If an interrupt is found, an ACPI interrupt descriptor is written to the ACPI
+ * output. If not, but if a GPIO is found, a GPIO descriptor is written.
+ *
+ * @return irq or GPIO pin number if OK, -ve if neither an interrupt nor a GPIO
+ * could be found, or some other error occurred
+ */
+int acpi_device_write_interrupt_or_gpio(struct acpi_ctx *ctx,
+ struct udevice *dev, const char *prop);
+
#endif