summaryrefslogtreecommitdiffstats
path: root/drivers/irqchip/irq-loongson-eiointc.c
diff options
context:
space:
mode:
authorHuacai Chen <chenhuacai@loongson.cn>2022-10-20 15:35:25 +0800
committerMarc Zyngier <maz@kernel.org>2022-11-26 13:12:12 +0000
commita90335c2dfb4ffe572816f77a3c4f2d1d388d724 (patch)
treee3bfec36cd07549017475549b1af0a2ee7501e8c /drivers/irqchip/irq-loongson-eiointc.c
parent1be356c9326d68c9b0161ca004a41f203864d7ee (diff)
downloadlinux-a90335c2dfb4ffe572816f77a3c4f2d1d388d724.tar.bz2
irqchip/loongson-eiointc: Add suspend/resume support
Add suspend/resume support for EIOINTC irqchip, which is needed for upcoming suspend/hibernation. Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20221020073527.541845-3-chenhuacai@loongson.cn
Diffstat (limited to 'drivers/irqchip/irq-loongson-eiointc.c')
-rw-r--r--drivers/irqchip/irq-loongson-eiointc.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/drivers/irqchip/irq-loongson-eiointc.c b/drivers/irqchip/irq-loongson-eiointc.c
index 16e9af8d8b1e..5cf4b800e499 100644
--- a/drivers/irqchip/irq-loongson-eiointc.c
+++ b/drivers/irqchip/irq-loongson-eiointc.c
@@ -17,6 +17,7 @@
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
+#include <linux/syscore_ops.h>
#define EIOINTC_REG_NODEMAP 0x14a0
#define EIOINTC_REG_IPMAP 0x14c0
@@ -301,6 +302,37 @@ static struct irq_domain *acpi_get_vec_parent(int node, struct acpi_vector_group
return NULL;
}
+static int eiointc_suspend(void)
+{
+ return 0;
+}
+
+static void eiointc_resume(void)
+{
+ int i, j;
+ struct irq_desc *desc;
+ struct irq_data *irq_data;
+
+ eiointc_router_init(0);
+
+ for (i = 0; i < nr_pics; i++) {
+ for (j = 0; j < VEC_COUNT; j++) {
+ desc = irq_resolve_mapping(eiointc_priv[i]->eiointc_domain, j);
+ if (desc && desc->handle_irq && desc->handle_irq != handle_bad_irq) {
+ raw_spin_lock(&desc->lock);
+ irq_data = &desc->irq_data;
+ eiointc_set_irq_affinity(irq_data, irq_data->common->affinity, 0);
+ raw_spin_unlock(&desc->lock);
+ }
+ }
+ }
+}
+
+static struct syscore_ops eiointc_syscore_ops = {
+ .suspend = eiointc_suspend,
+ .resume = eiointc_resume,
+};
+
static int __init
pch_pic_parse_madt(union acpi_subtable_headers *header,
const unsigned long end)
@@ -380,6 +412,7 @@ int __init eiointc_acpi_init(struct irq_domain *parent,
parent_irq = irq_create_mapping(parent, acpi_eiointc->cascade);
irq_set_chained_handler_and_data(parent_irq, eiointc_irq_dispatch, priv);
+ register_syscore_ops(&eiointc_syscore_ops);
cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_LOONGARCH_STARTING,
"irqchip/loongarch/intc:starting",
eiointc_router_init, NULL);