From: tip-bot for Javier Martinez Canillas <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org,
tomasz.figa@gmail.com, hpa@zytor.com,
javier.martinez@collabora.co.uk, k.kozlowski@samsung.com,
dianders@chromium.org, kgene@kernel.org, sudeep.holla@arm.com,
mingo@kernel.org, parkch98@gmail.com, peter.chubb@nicta.com.au,
jason@lakedaemon.net, shuahkhan@gmail.com
Subject: [tip:irq/core] irqchip: exynos-combiner: Save IRQ enable set on suspend
Date: Tue, 16 Jun 2015 02:36:53 -0700 [thread overview]
Message-ID: <tip-6fd4899a54a522ccd6a24fea2318d3b515b95945@git.kernel.org> (raw)
In-Reply-To: <1434087795-13990-1-git-send-email-javier.martinez@collabora.co.uk>
Commit-ID: 6fd4899a54a522ccd6a24fea2318d3b515b95945
Gitweb: http://git.kernel.org/tip/6fd4899a54a522ccd6a24fea2318d3b515b95945
Author: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
AuthorDate: Fri, 12 Jun 2015 07:43:15 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Tue, 16 Jun 2015 11:34:41 +0200
irqchip: exynos-combiner: Save IRQ enable set on suspend
The Exynos interrupt combiner IP loses its state when the SoC enters
into a low power state during a Suspend-to-RAM. This means that if a
IRQ is used as a source, the interrupts for the devices are disabled
when the system is resumed from a sleep state so are not triggered.
Save the interrupt enable set register for each combiner group and
restore it after resume to make sure that the interrupts are enabled.
Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Tomasz Figa <tomasz.figa@gmail.com>
Cc: Doug Anderson <dianders@chromium.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: Peter Chubb <peter.chubb@nicta.com.au>
Cc: Shuah Khan <shuahkhan@gmail.com>
Cc: Chanho Park <parkch98@gmail.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Link: http://lkml.kernel.org/r/1434087795-13990-1-git-send-email-javier.martinez@collabora.co.uk
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
drivers/irqchip/exynos-combiner.c | 64 ++++++++++++++++++++++++++++++++++++---
1 file changed, 59 insertions(+), 5 deletions(-)
diff --git a/drivers/irqchip/exynos-combiner.c b/drivers/irqchip/exynos-combiner.c
index a57a3a1..5c82e3b 100644
--- a/drivers/irqchip/exynos-combiner.c
+++ b/drivers/irqchip/exynos-combiner.c
@@ -13,6 +13,7 @@
#include <linux/init.h>
#include <linux/io.h>
#include <linux/slab.h>
+#include <linux/syscore_ops.h>
#include <linux/irqdomain.h>
#include <linux/irqchip/chained_irq.h>
#include <linux/interrupt.h>
@@ -34,9 +35,14 @@ struct combiner_chip_data {
unsigned int irq_mask;
void __iomem *base;
unsigned int parent_irq;
+#ifdef CONFIG_PM
+ u32 pm_save;
+#endif
};
+static struct combiner_chip_data *combiner_data;
static struct irq_domain *combiner_irq_domain;
+static unsigned int max_nr = 20;
static inline void __iomem *combiner_base(struct irq_data *data)
{
@@ -170,12 +176,10 @@ static const struct irq_domain_ops combiner_irq_domain_ops = {
};
static void __init combiner_init(void __iomem *combiner_base,
- struct device_node *np,
- unsigned int max_nr)
+ struct device_node *np)
{
int i, irq;
unsigned int nr_irq;
- struct combiner_chip_data *combiner_data;
nr_irq = max_nr * IRQ_IN_COMBINER;
@@ -201,11 +205,59 @@ static void __init combiner_init(void __iomem *combiner_base,
}
}
+#ifdef CONFIG_PM
+
+/**
+ * combiner_suspend - save interrupt combiner state before suspend
+ *
+ * Save the interrupt enable set register for all combiner groups since
+ * the state is lost when the system enters into a sleep state.
+ *
+ */
+static int combiner_suspend(void)
+{
+ int i;
+
+ for (i = 0; i < max_nr; i++)
+ combiner_data[i].pm_save =
+ __raw_readl(combiner_data[i].base + COMBINER_ENABLE_SET);
+
+ return 0;
+}
+
+/**
+ * combiner_resume - restore interrupt combiner state after resume
+ *
+ * Restore the interrupt enable set register for all combiner groups since
+ * the state is lost when the system enters into a sleep state on suspend.
+ *
+ */
+static void combiner_resume(void)
+{
+ int i;
+
+ for (i = 0; i < max_nr; i++) {
+ __raw_writel(combiner_data[i].irq_mask,
+ combiner_data[i].base + COMBINER_ENABLE_CLEAR);
+ __raw_writel(combiner_data[i].pm_save,
+ combiner_data[i].base + COMBINER_ENABLE_SET);
+ }
+}
+
+#else
+#define combiner_suspend NULL
+#define combiner_resume NULL
+#endif
+
+static struct syscore_ops combiner_syscore_ops = {
+ .suspend = combiner_suspend,
+ .resume = combiner_resume,
+};
+
static int __init combiner_of_init(struct device_node *np,
struct device_node *parent)
{
void __iomem *combiner_base;
- unsigned int max_nr = 20;
combiner_base = of_iomap(np, 0);
if (!combiner_base) {
@@ -219,7 +271,9 @@ static int __init combiner_of_init(struct device_node *np,
__func__, max_nr);
}
- combiner_init(combiner_base, np, max_nr);
+ combiner_init(combiner_base, np);
+
+ register_syscore_ops(&combiner_syscore_ops);
return 0;
}
prev parent reply other threads:[~2015-06-16 9:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-12 5:43 [PATCH v2 1/1] irqchip: exynos-combiner: Save IRQ enable set on suspend Javier Martinez Canillas
2015-06-12 5:57 ` Krzysztof Kozlowski
2015-06-12 10:10 ` Sudeep Holla
2015-06-12 10:42 ` Krzysztof Kozlowski
2015-06-12 10:56 ` Sudeep Holla
2015-06-12 11:27 ` Javier Martinez Canillas
2015-06-12 11:54 ` Sudeep Holla
2015-06-12 12:57 ` Javier Martinez Canillas
2015-06-12 19:36 ` Javier Martinez Canillas
2015-06-12 20:17 ` Doug Anderson
2015-06-15 7:46 ` Javier Martinez Canillas
2015-06-15 9:01 ` Sudeep Holla
2015-06-15 15:00 ` Javier Martinez Canillas
2015-06-15 15:08 ` Sudeep Holla
2015-06-15 15:23 ` Javier Martinez Canillas
2015-06-15 23:57 ` Krzysztof Kozlowski
2015-06-16 3:19 ` Javier Martinez Canillas
2015-06-16 8:21 ` Thomas Gleixner
2015-06-16 12:32 ` Tomasz Figa
2015-06-16 13:11 ` Sudeep Holla
2015-06-15 8:52 ` Sudeep Holla
2015-06-16 9:36 ` tip-bot for Javier Martinez Canillas [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=tip-6fd4899a54a522ccd6a24fea2318d3b515b95945@git.kernel.org \
--to=tipbot@zytor.com \
--cc=dianders@chromium.org \
--cc=hpa@zytor.com \
--cc=jason@lakedaemon.net \
--cc=javier.martinez@collabora.co.uk \
--cc=k.kozlowski@samsung.com \
--cc=kgene@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=parkch98@gmail.com \
--cc=peter.chubb@nicta.com.au \
--cc=shuahkhan@gmail.com \
--cc=sudeep.holla@arm.com \
--cc=tglx@linutronix.de \
--cc=tomasz.figa@gmail.com \
/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