From: "irqchip-bot for Huacai Chen" <tip-bot2@linutronix.de>
To: linux-kernel@vger.kernel.org
Cc: Huacai Chen <chenhuacai@loongson.cn>,
Marc Zyngier <maz@kernel.org>,
tglx@linutronix.de
Subject: [irqchip: irq/irqchip-next] irqchip/loongson-pch-pic: Add suspend/resume support
Date: Sat, 26 Nov 2022 13:34:37 -0000 [thread overview]
Message-ID: <166946967714.4906.17115244088149452663.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20221020073527.541845-4-chenhuacai@loongson.cn>
The following commit has been merged into the irq/irqchip-next branch of irqchip:
Commit-ID: 1ed008a2c3310ada91e86bd96b354212a9025a61
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/1ed008a2c3310ada91e86bd96b354212a9025a61
Author: Huacai Chen <chenhuacai@loongson.cn>
AuthorDate: Thu, 20 Oct 2022 15:35:26 +08:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Sat, 26 Nov 2022 13:12:13
irqchip/loongson-pch-pic: Add suspend/resume support
Add suspend/resume support for PCH-PIC 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-4-chenhuacai@loongson.cn
---
drivers/irqchip/irq-loongson-pch-pic.c | 47 +++++++++++++++++++++++++-
1 file changed, 47 insertions(+)
diff --git a/drivers/irqchip/irq-loongson-pch-pic.c b/drivers/irqchip/irq-loongson-pch-pic.c
index a26a3f5..1fd015e 100644
--- a/drivers/irqchip/irq-loongson-pch-pic.c
+++ b/drivers/irqchip/irq-loongson-pch-pic.c
@@ -15,6 +15,7 @@
#include <linux/of_address.h>
#include <linux/of_irq.h>
#include <linux/of_platform.h>
+#include <linux/syscore_ops.h>
/* Registers */
#define PCH_PIC_MASK 0x20
@@ -42,6 +43,9 @@ struct pch_pic {
raw_spinlock_t pic_lock;
u32 vec_count;
u32 gsi_base;
+ u32 saved_vec_en[PIC_REG_COUNT];
+ u32 saved_vec_pol[PIC_REG_COUNT];
+ u32 saved_vec_edge[PIC_REG_COUNT];
};
static struct pch_pic *pch_pic_priv[MAX_IO_PICS];
@@ -145,6 +149,7 @@ static struct irq_chip pch_pic_irq_chip = {
.irq_ack = pch_pic_ack_irq,
.irq_set_affinity = irq_chip_set_affinity_parent,
.irq_set_type = pch_pic_set_type,
+ .flags = IRQCHIP_SKIP_SET_WAKE,
};
static int pch_pic_domain_translate(struct irq_domain *d,
@@ -234,6 +239,46 @@ static void pch_pic_reset(struct pch_pic *priv)
}
}
+static int pch_pic_suspend(void)
+{
+ int i, j;
+
+ for (i = 0; i < nr_pics; i++) {
+ for (j = 0; j < PIC_REG_COUNT; j++) {
+ pch_pic_priv[i]->saved_vec_pol[j] =
+ readl(pch_pic_priv[i]->base + PCH_PIC_POL + 4 * j);
+ pch_pic_priv[i]->saved_vec_edge[j] =
+ readl(pch_pic_priv[i]->base + PCH_PIC_EDGE + 4 * j);
+ pch_pic_priv[i]->saved_vec_en[j] =
+ readl(pch_pic_priv[i]->base + PCH_PIC_MASK + 4 * j);
+ }
+ }
+
+ return 0;
+}
+
+static void pch_pic_resume(void)
+{
+ int i, j;
+
+ for (i = 0; i < nr_pics; i++) {
+ pch_pic_reset(pch_pic_priv[i]);
+ for (j = 0; j < PIC_REG_COUNT; j++) {
+ writel(pch_pic_priv[i]->saved_vec_pol[j],
+ pch_pic_priv[i]->base + PCH_PIC_POL + 4 * j);
+ writel(pch_pic_priv[i]->saved_vec_edge[j],
+ pch_pic_priv[i]->base + PCH_PIC_EDGE + 4 * j);
+ writel(pch_pic_priv[i]->saved_vec_en[j],
+ pch_pic_priv[i]->base + PCH_PIC_MASK + 4 * j);
+ }
+ }
+}
+
+static struct syscore_ops pch_pic_syscore_ops = {
+ .suspend = pch_pic_suspend,
+ .resume = pch_pic_resume,
+};
+
static int pch_pic_init(phys_addr_t addr, unsigned long size, int vec_base,
struct irq_domain *parent_domain, struct fwnode_handle *domain_handle,
u32 gsi_base)
@@ -266,6 +311,8 @@ static int pch_pic_init(phys_addr_t addr, unsigned long size, int vec_base,
pch_pic_handle[nr_pics] = domain_handle;
pch_pic_priv[nr_pics++] = priv;
+ register_syscore_ops(&pch_pic_syscore_ops);
+
return 0;
iounmap_base:
next prev parent reply other threads:[~2022-11-26 13:35 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-20 7:35 [PATCH V2 0/4] irqchip/loongson: Add suspend/resume support for irqchip drivers Huacai Chen
2022-10-20 7:35 ` [PATCH V2 1/4] irqchip/loongson-htvec: Add suspend/resume support Huacai Chen
2022-11-26 13:34 ` [irqchip: irq/irqchip-next] " irqchip-bot for Huacai Chen
2022-10-20 7:35 ` [PATCH V2 2/4] irqchip/loongson-eiointc: " Huacai Chen
2022-11-26 13:34 ` [irqchip: irq/irqchip-next] " irqchip-bot for Huacai Chen
2022-10-20 7:35 ` [PATCH V2 3/4] irqchip/loongson-pch-pic: " Huacai Chen
2022-11-26 13:34 ` irqchip-bot for Huacai Chen [this message]
2022-10-20 7:35 ` [PATCH V2 4/4] irqchip/loongson-pch-lpc: " Huacai Chen
2022-11-26 13:34 ` [irqchip: irq/irqchip-next] " irqchip-bot for Huacai Chen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=166946967714.4906.17115244088149452663.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=chenhuacai@loongson.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®