summaryrefslogtreecommitdiff
path: root/drivers/misc/irq_sandbox.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2020-07-07 22:11:41 +0300
committerBin Meng <bmeng.cn@gmail.com>2020-07-17 09:32:24 +0300
commitf4955137f5f15e615376cf38559414a9b53e3d55 (patch)
tree699167d9e3cc6cae0fae4a0ddeb4b335c05786aa /drivers/misc/irq_sandbox.c
parent2715b3623c08bf1ad2dfe6076ad86c24e3138016 (diff)
downloadu-boot-f4955137f5f15e615376cf38559414a9b53e3d55.tar.xz
irq: Add a method to convert an interrupt to ACPI
When generating ACPI tables we need to convert IRQs in U-Boot to the ACPI structures required by ACPI. This is a SoC-specific conversion and cannot be handled by generic code, so add a new IRQ method to do the conversion. 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 'drivers/misc/irq_sandbox.c')
-rw-r--r--drivers/misc/irq_sandbox.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/misc/irq_sandbox.c b/drivers/misc/irq_sandbox.c
index 54bc47c8d8..a2511b32fc 100644
--- a/drivers/misc/irq_sandbox.c
+++ b/drivers/misc/irq_sandbox.c
@@ -8,6 +8,7 @@
#include <common.h>
#include <dm.h>
#include <irq.h>
+#include <acpi/acpi_device.h>
#include <asm/test.h>
/**
@@ -73,6 +74,18 @@ static int sandbox_irq_of_xlate(struct irq *irq,
return 0;
}
+static __maybe_unused int sandbox_get_acpi(const struct irq *irq,
+ struct acpi_irq *acpi_irq)
+{
+ acpi_irq->pin = irq->id;
+ acpi_irq->mode = ACPI_IRQ_LEVEL_TRIGGERED;
+ acpi_irq->polarity = ACPI_IRQ_ACTIVE_HIGH;
+ acpi_irq->shared = ACPI_IRQ_SHARED;
+ acpi_irq->wake = ACPI_IRQ_WAKE;
+
+ return 0;
+}
+
static const struct irq_ops sandbox_irq_ops = {
.route_pmc_gpio_gpe = sandbox_route_pmc_gpio_gpe,
.set_polarity = sandbox_set_polarity,
@@ -80,6 +93,9 @@ static const struct irq_ops sandbox_irq_ops = {
.restore_polarities = sandbox_restore_polarities,
.read_and_clear = sandbox_irq_read_and_clear,
.of_xlate = sandbox_irq_of_xlate,
+#if CONFIG_IS_ENABLED(ACPIGEN)
+ .get_acpi = sandbox_get_acpi,
+#endif
};
static const struct udevice_id sandbox_irq_ids[] = {