From patchwork Thu Mar 28 16:11:34 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Andersson X-Patchwork-Id: 2357881 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 1E1C3DF2A1 for ; Thu, 28 Mar 2013 16:20:20 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ULFWD-000812-Px; Thu, 28 Mar 2013 16:17:37 +0000 Received: from eu1sys200aog122.obsmtp.com ([207.126.144.153]) by merlin.infradead.org with smtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ULFQw-0005oT-Sg for linux-arm-kernel@lists.infradead.org; Thu, 28 Mar 2013 16:12:21 +0000 Received: from beta.dmz-us.st.com ([167.4.1.35]) (using TLSv1) by eu1sys200aob122.postini.com ([207.126.147.11]) with SMTP ID DSNKUVRr1K89EP/QzTYoua2k7FlBSg1ZYKAR@postini.com; Thu, 28 Mar 2013 16:12:10 UTC Received: from zeta.dmz-us.st.com (ns4.st.com [167.4.16.71]) by beta.dmz-us.st.com (STMicroelectronics) with ESMTP id E449247; Thu, 28 Mar 2013 16:11:03 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-us.st.com (STMicroelectronics) with ESMTP id 361E662; Thu, 28 Mar 2013 09:39:37 +0000 (GMT) Received: from exdcvycastm022.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm022", Issuer "exdcvycastm022" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 855A1A8074; Thu, 28 Mar 2013 17:11:48 +0100 (CET) Received: from steludxu2826.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.30) with Microsoft SMTP Server (TLS) id 8.3.279.5; Thu, 28 Mar 2013 17:11:54 +0100 From: Rickard Andersson To: , , Subject: [PATCH V2 08/12] ARM: ux500: Add ApSleep state to suspend Date: Thu, 28 Mar 2013 17:11:34 +0100 Message-ID: <1364487098-10319-9-git-send-email-rickard.andersson@stericsson.com> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1364487098-10319-1-git-send-email-rickard.andersson@stericsson.com> References: <1364487098-10319-1-git-send-email-rickard.andersson@stericsson.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130328_121211_216356_9D1C2E91 X-CRM114-Status: GOOD ( 15.77 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: hongbo.zhang@linaro.org, ulf.hansson@linaro.org, khilman@linaro.org, linus.walleij@stericsson.com, daniel.lezcano@linaro.org, rickard.andersson@stericsson.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Support for power save state ApSleep is added to the platform suspend operation hook. Signed-off-by: Rickard Andersson --- 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 +#include +#include + +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; }