From: Rickard Andersson <rickard.andersson@stericsson.com>
To: rjw@sisk.pl, linux-pm@vger.kernel.org
Cc: daniel.lezcano@linaro.org, hongbo.zhang@linaro.org,
khilman@linaro.org, ulf.hansson@linaro.org,
linus.walleij@stericsson.com, rickard.andersson@stericsson.com
Subject: [RFC PATCH 8/8] ARM: ux500: Add ApSleep state to suspend
Date: Fri, 22 Mar 2013 17:20:12 +0100 [thread overview]
Message-ID: <1363969212-14864-9-git-send-email-rickard.andersson@stericsson.com> (raw)
In-Reply-To: <1363969212-14864-1-git-send-email-rickard.andersson@stericsson.com>
Support for power save state ApSleep is
added to the platform suspend operation
hook.
Signed-off-by: Rickard Andersson <rickard.andersson@stericsson.com>
---
arch/arm/mach-ux500/suspend.c | 57 ++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 56 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-ux500/suspend.c b/arch/arm/mach-ux500/suspend.c
index d1ac203..875a92d 100644
--- a/arch/arm/mach-ux500/suspend.c
+++ b/arch/arm/mach-ux500/suspend.c
@@ -10,11 +10,60 @@
*/
#include <linux/suspend.h>
+#include <linux/pm_domain.h>
+#include <linux/mfd/dbx500-prcmu.h>
+
+static u32 suspend_wakeups;
+static u32 running_wakeups;
+static struct generic_pm_domain *ape_domain;
static int ux500_suspend_enter(suspend_state_t state)
{
+ int ret = 0;
+
+ /* Configure the PRCMU for a sleep wakeup */
+ prcmu_enable_wakeups(suspend_wakeups);
+
+ pm_genpd_notify_power_on_off(ape_domain, false);
+
+ prcmu_gic_decouple();
+
+ /* Copy GIC interrupt settings to PRCMU interrupt settings */
+ prcmu_copy_gic_settings();
+
+ if (prcmu_gic_pending_irq()) {
+ pr_info("suspend/resume: pending interrupt\n");
+
+ /* Recouple GIC with the interrupt bus */
+ prcmu_gic_recouple();
+ ret = -EBUSY;
+ goto exit;
+ }
+
+ if (prcmu_pending_irq()) {
+ pr_info("suspend/resume: pending interrupt prcmu\n");
+
+ /* Recouple GIC with the interrupt bus */
+ prcmu_gic_recouple();
+ ret = -EBUSY;
+ goto exit;
+ }
+
+ prcmu_set_ioforce(true);
+
+ prcmu_set_power_state(PRCMU_AP_SLEEP, false, false);
+
cpu_do_idle();
- return 0;
+
+ pm_genpd_notify_power_on_off(ape_domain, true);
+
+ prcmu_set_ioforce(false);
+
+ exit:
+ /* Configure the prcmu with the wake-ups that cpuidle needs */
+ prcmu_enable_wakeups(running_wakeups);
+
+ return ret;
}
static int ux500_suspend_valid(suspend_state_t state)
@@ -29,6 +78,12 @@ static const struct platform_suspend_ops ux500_suspend_ops = {
static __init int ux500_suspend_init(void)
{
+ suspend_wakeups = PRCMU_WAKEUP(ABB) | PRCMU_WAKEUP(RTC);
+ running_wakeups = (PRCMU_WAKEUP(ARM) | PRCMU_WAKEUP(RTC) |
+ PRCMU_WAKEUP(ABB));
+
+ ape_domain = pm_genpd_lookup_name("APE");
+
suspend_set_ops(&ux500_suspend_ops);
return 0;
}
--
1.8.2
prev parent reply other threads:[~2013-03-22 16:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 16:20 [RFC PATCH 0/8] ux500 suspend-resume Rickard Andersson
2013-03-22 16:20 ` [RFC PATCH 1/8] mfd: db8500: Add IO force function Rickard Andersson
2013-03-22 16:20 ` [RFC PATCH 2/8] ARM: ux500: Add platform suspend ops Rickard Andersson
2013-03-22 16:20 ` [RFC PATCH 3/8] PM / Domains: Add on-off notifiers Rickard Andersson
2013-03-22 16:20 ` [RFC PATCH 4/8] PM / Domains: Lookup domain by name Rickard Andersson
2013-03-22 16:20 ` [RFC PATCH 5/8] ARM: ux500: Create APE generic power domain Rickard Andersson
2013-03-22 16:20 ` [RFC PATCH 6/8] clk: ux500: Add PRCC power management Rickard Andersson
2013-03-22 16:20 ` [RFC PATCH 7/8] ARM: ux500: Create u8500-clk device Rickard Andersson
2013-03-22 16:20 ` Rickard Andersson [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=1363969212-14864-9-git-send-email-rickard.andersson@stericsson.com \
--to=rickard.andersson@stericsson.com \
--cc=daniel.lezcano@linaro.org \
--cc=hongbo.zhang@linaro.org \
--cc=khilman@linaro.org \
--cc=linus.walleij@stericsson.com \
--cc=linux-pm@vger.kernel.org \
--cc=rjw@sisk.pl \
--cc=ulf.hansson@linaro.org \
/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;
as well as URLs for NNTP newsgroup(s).