All of lore.kernel.org
 help / color / mirror / Atom feed
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-htvec: Add suspend/resume support
Date: Sat, 26 Nov 2022 13:34:39 -0000	[thread overview]
Message-ID: <166946967944.4906.6915919359278946026.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20221020073527.541845-2-chenhuacai@loongson.cn>

The following commit has been merged into the irq/irqchip-next branch of irqchip:

Commit-ID:     1be356c9326d68c9b0161ca004a41f203864d7ee
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/1be356c9326d68c9b0161ca004a41f203864d7ee
Author:        Huacai Chen <chenhuacai@loongson.cn>
AuthorDate:    Thu, 20 Oct 2022 15:35:24 +08:00
Committer:     Marc Zyngier <maz@kernel.org>
CommitterDate: Sat, 26 Nov 2022 13:09:25 

irqchip/loongson-htvec: Add suspend/resume support

Add suspend/resume support for HTVEC 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-2-chenhuacai@loongson.cn
---
 drivers/irqchip/irq-loongson-htvec.c | 27 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+)

diff --git a/drivers/irqchip/irq-loongson-htvec.c b/drivers/irqchip/irq-loongson-htvec.c
index 8b06082..fc8bf1f 100644
--- a/drivers/irqchip/irq-loongson-htvec.c
+++ b/drivers/irqchip/irq-loongson-htvec.c
@@ -16,6 +16,7 @@
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
 #include <linux/of_platform.h>
+#include <linux/syscore_ops.h>
 
 /* Registers */
 #define HTVEC_EN_OFF		0x20
@@ -29,6 +30,7 @@ struct htvec {
 	void __iomem		*base;
 	struct irq_domain	*htvec_domain;
 	raw_spinlock_t		htvec_lock;
+	u32			saved_vec_en[HTVEC_MAX_PARENT_IRQ];
 };
 
 static struct htvec *htvec_priv;
@@ -156,6 +158,29 @@ static void htvec_reset(struct htvec *priv)
 	}
 }
 
+static int htvec_suspend(void)
+{
+	int i;
+
+	for (i = 0; i < htvec_priv->num_parents; i++)
+		htvec_priv->saved_vec_en[i] = readl(htvec_priv->base + HTVEC_EN_OFF + 4 * i);
+
+	return 0;
+}
+
+static void htvec_resume(void)
+{
+	int i;
+
+	for (i = 0; i < htvec_priv->num_parents; i++)
+		writel(htvec_priv->saved_vec_en[i], htvec_priv->base + HTVEC_EN_OFF + 4 * i);
+}
+
+static struct syscore_ops htvec_syscore_ops = {
+	.suspend = htvec_suspend,
+	.resume = htvec_resume,
+};
+
 static int htvec_init(phys_addr_t addr, unsigned long size,
 		int num_parents, int parent_irq[], struct fwnode_handle *domain_handle)
 {
@@ -188,6 +213,8 @@ static int htvec_init(phys_addr_t addr, unsigned long size,
 
 	htvec_priv = priv;
 
+	register_syscore_ops(&htvec_syscore_ops);
+
 	return 0;
 
 iounmap_base:

  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-bot for Huacai Chen [this message]
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: irq/irqchip-next] " irqchip-bot for Huacai Chen
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=166946967944.4906.6915919359278946026.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.