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-lpc: Add suspend/resume support
Date: Sat, 26 Nov 2022 13:34:35 -0000 [thread overview]
Message-ID: <166946967598.4906.8330183421538666371.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20221020073527.541845-5-chenhuacai@loongson.cn>
The following commit has been merged into the irq/irqchip-next branch of irqchip:
Commit-ID: c7c75e32f8a61854c38326aef276e3a58dc7fd08
Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/c7c75e32f8a61854c38326aef276e3a58dc7fd08
Author: Huacai Chen <chenhuacai@loongson.cn>
AuthorDate: Thu, 20 Oct 2022 15:35:27 +08:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Sat, 26 Nov 2022 13:12:13
irqchip/loongson-pch-lpc: Add suspend/resume support
Add suspend/resume support for PCH-LPC 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-5-chenhuacai@loongson.cn
---
drivers/irqchip/irq-loongson-pch-lpc.c | 25 +++++++++++++++++++++++++-
1 file changed, 25 insertions(+)
diff --git a/drivers/irqchip/irq-loongson-pch-lpc.c b/drivers/irqchip/irq-loongson-pch-lpc.c
index bf23249..9b35492 100644
--- a/drivers/irqchip/irq-loongson-pch-lpc.c
+++ b/drivers/irqchip/irq-loongson-pch-lpc.c
@@ -13,6 +13,7 @@
#include <linux/irqchip/chained_irq.h>
#include <linux/irqdomain.h>
#include <linux/kernel.h>
+#include <linux/syscore_ops.h>
/* Registers */
#define LPC_INT_CTL 0x00
@@ -34,6 +35,7 @@ struct pch_lpc {
u32 saved_reg_pol;
};
+static struct pch_lpc *pch_lpc_priv;
struct fwnode_handle *pch_lpc_handle;
static void lpc_irq_ack(struct irq_data *d)
@@ -147,6 +149,26 @@ static int pch_lpc_disabled(struct pch_lpc *priv)
(readl(priv->base + LPC_INT_STS) == 0xffffffff);
}
+static int pch_lpc_suspend(void)
+{
+ pch_lpc_priv->saved_reg_ctl = readl(pch_lpc_priv->base + LPC_INT_CTL);
+ pch_lpc_priv->saved_reg_ena = readl(pch_lpc_priv->base + LPC_INT_ENA);
+ pch_lpc_priv->saved_reg_pol = readl(pch_lpc_priv->base + LPC_INT_POL);
+ return 0;
+}
+
+static void pch_lpc_resume(void)
+{
+ writel(pch_lpc_priv->saved_reg_ctl, pch_lpc_priv->base + LPC_INT_CTL);
+ writel(pch_lpc_priv->saved_reg_ena, pch_lpc_priv->base + LPC_INT_ENA);
+ writel(pch_lpc_priv->saved_reg_pol, pch_lpc_priv->base + LPC_INT_POL);
+}
+
+static struct syscore_ops pch_lpc_syscore_ops = {
+ .suspend = pch_lpc_suspend,
+ .resume = pch_lpc_resume,
+};
+
int __init pch_lpc_acpi_init(struct irq_domain *parent,
struct acpi_madt_lpc_pic *acpi_pchlpc)
{
@@ -191,7 +213,10 @@ int __init pch_lpc_acpi_init(struct irq_domain *parent,
parent_irq = irq_create_fwspec_mapping(&fwspec);
irq_set_chained_handler_and_data(parent_irq, lpc_irq_dispatch, priv);
+ pch_lpc_priv = priv;
pch_lpc_handle = irq_handle;
+ register_syscore_ops(&pch_lpc_syscore_ops);
+
return 0;
free_irq_handle:
prev parent reply other threads:[~2022-11-26 13:34 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: 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-bot for Huacai Chen [this message]
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=166946967598.4906.8330183421538666371.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®