From patchwork Fri Mar 22 16:20:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rickard Andersson X-Patchwork-Id: 2321741 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 401CCE016C for ; Fri, 22 Mar 2013 16:41:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161057Ab3CVQlc (ORCPT ); Fri, 22 Mar 2013 12:41:32 -0400 Received: from eu1sys200aog115.obsmtp.com ([207.126.144.139]:51954 "EHLO eu1sys200aog115.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1161013Ab3CVQla (ORCPT ); Fri, 22 Mar 2013 12:41:30 -0400 Received: from beta.dmz-eu.st.com ([164.129.1.35]) (using TLSv1) by eu1sys200aob115.postini.com ([207.126.147.11]) with SMTP ID DSNKUUyJuGpKPjrP3YPofOTVdGPOfVp/lm2j@postini.com; Fri, 22 Mar 2013 16:41:29 UTC Received: from zeta.dmz-eu.st.com (zeta.dmz-eu.st.com [164.129.230.9]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id E52E0209; Fri, 22 Mar 2013 16:20:24 +0000 (GMT) Received: from relay2.stm.gmessaging.net (unknown [10.230.100.18]) by zeta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 9FCB652E5; Fri, 22 Mar 2013 16:20:24 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay2.stm.gmessaging.net (Postfix) with ESMTPS id 2E8AAA8065; Fri, 22 Mar 2013 17:20:18 +0100 (CET) Received: from steludxu2826.lud.stericsson.com (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.279.5; Fri, 22 Mar 2013 17:20:24 +0100 From: Rickard Andersson To: , Cc: , , , , , Subject: [RFC PATCH 8/8] ARM: ux500: Add ApSleep state to suspend Date: Fri, 22 Mar 2013 17:20:12 +0100 Message-ID: <1363969212-14864-9-git-send-email-rickard.andersson@stericsson.com> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1363969212-14864-1-git-send-email-rickard.andersson@stericsson.com> References: <1363969212-14864-1-git-send-email-rickard.andersson@stericsson.com> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.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; }