From patchwork Tue Jul 1 14:32:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chander Kashyap X-Patchwork-Id: 4459511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 18209BEEAA for ; Tue, 1 Jul 2014 14:36:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3EF0C2014A for ; Tue, 1 Jul 2014 14:36:47 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4A147203E5 for ; Tue, 1 Jul 2014 14:36:46 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1z8F-000349-Mm; Tue, 01 Jul 2014 14:34:03 +0000 Received: from mail-pa0-x22c.google.com ([2607:f8b0:400e:c03::22c]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1X1z7d-0001xg-Oj for linux-arm-kernel@lists.infradead.org; Tue, 01 Jul 2014 14:33:27 +0000 Received: by mail-pa0-f44.google.com with SMTP id rd3so10722746pab.31 for ; Tue, 01 Jul 2014 07:33:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=BUIyYRVCsI0G//duw/ld3AZGTSQ5306FtGUzOtmAZ14=; b=TofKKcoxq6Wx8TBwnzwcVI2rfTsaqWGtHM6wnmGXmgOIP660+lTUnZvDoXCGNLXOfI GCOcq3vFLsN6WVAo/hZyXPan6Pe2deLFrbOqikS5V6qHFSMK9yKvlKQZTRvCXpErca8j dLk5vw1BT0VP2MghjdizYtccXjlnfPnZ5wwus1UwwUEauGNuBdAJymLEIoOLSTbYY5zh 4LyVngLBBo0wVGJBX5iT4T8vuo7kiAUJ7zgrjcGFAuR2TN/cEF3Hpw0QEnneRSnLEvlK 7nCnG0yYnyZqisz+ybrjKzvYh8ONtuDE7DMHkkdjFt6sOAc2KGN/H82IoUPTLJ/vWON1 R9Ww== X-Received: by 10.68.237.133 with SMTP id vc5mr62785729pbc.92.1404225182907; Tue, 01 Jul 2014 07:33:02 -0700 (PDT) Received: from localhost.localdomain ([14.140.216.146]) by mx.google.com with ESMTPSA id ue3sm33002233pbc.49.2014.07.01.07.32.59 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Jul 2014 07:33:02 -0700 (PDT) From: Chander Kashyap To: linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH 2/2] cpuidle: Exynos: fix cpuidle for all states Date: Tue, 1 Jul 2014 20:02:38 +0530 Message-Id: <1404225158-8453-3-git-send-email-k.chander@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1404225158-8453-1-git-send-email-k.chander@samsung.com> References: <1404225158-8453-1-git-send-email-k.chander@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140701_073325_889981_79D4287D X-CRM114-Status: GOOD ( 17.99 ) X-Spam-Score: 0.0 (/) Cc: Chander Kashyap , kgene.kim@samsung.com, daniel.lezcano@linaro.org, linux-pm@vger.kernel.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pre/post platform specific cpuidle operations are handled by pm_notifier. But these operations are not same for all cpuidle states. Handle this by moving cpuidle specific code from pm_notifier to cpuidle specific function. Signed-off-by: Chander Kashyap --- arch/arm/mach-exynos/common.h | 2 +- arch/arm/mach-exynos/pm.c | 45 ++++++++++---------------------------- drivers/cpuidle/cpuidle-exynos.c | 7 ++++-- 3 files changed, 17 insertions(+), 37 deletions(-) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 1ee9176..7769f58 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -166,7 +166,7 @@ extern int exynos_cpu_power_state(int cpu); extern void exynos_cluster_power_down(int cluster); extern void exynos_cluster_power_up(int cluster); extern int exynos_cluster_power_state(int cluster); -extern void exynos_enter_aftr(void); +extern void exynos_enter_aftr(int entering_idle); extern void s5p_init_cpu(void __iomem *cpuid_addr); extern unsigned int samsung_rev(void); diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index a092cc3..328644f 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -188,14 +188,6 @@ static void exynos_cpu_set_boot_vector(long flags) __raw_writel(flags, EXYNOS_BOOT_VECTOR_FLAG); } -void exynos_enter_aftr(void) -{ - exynos_set_wakeupmask(0x0000ff3e); - exynos_cpu_set_boot_vector(S5P_CHECK_AFTR); - /* Set value of power down register for aftr mode */ - exynos_sys_powerdown_conf(SYS_AFTR); -} - static int exynos_cpu_suspend(unsigned long arg) { #ifdef CONFIG_CACHE_L2X0 @@ -386,40 +378,25 @@ static const struct platform_suspend_ops exynos_suspend_ops = { .valid = suspend_valid_only_mem, }; -static int exynos_cpu_pm_notifier(struct notifier_block *self, - unsigned long cmd, void *v) +void exynos_enter_aftr(int entering_idle) { - int cpu = smp_processor_id(); - - switch (cmd) { - case CPU_PM_ENTER: - if (cpu == 0) - exynos_pm_central_suspend(); - break; - - case CPU_PM_EXIT: - if (cpu == 0) { - if (read_cpuid_part_number() == - ARM_CPU_PART_CORTEX_A9) - scu_enable(S5P_VA_SCU); - exynos_pm_central_resume(); - } - break; + if (entering_idle) { + exynos_set_wakeupmask(0x0000ff3e); + exynos_cpu_set_boot_vector(S5P_CHECK_AFTR); + /* Set value of power down register for aftr mode */ + exynos_sys_powerdown_conf(SYS_AFTR); + exynos_pm_central_suspend(); + } else { + if (scu_a9_has_base()) + scu_enable(S5P_VA_SCU); + exynos_pm_central_resume(); } - - return NOTIFY_OK; } -static struct notifier_block exynos_cpu_pm_notifier_block = { - .notifier_call = exynos_cpu_pm_notifier, -}; - void __init exynos_pm_init(void) { u32 tmp; - cpu_pm_register_notifier(&exynos_cpu_pm_notifier_block); - /* Platform-specific GIC callback */ gic_arch_extn.irq_set_wake = exynos_irq_set_wake; diff --git a/drivers/cpuidle/cpuidle-exynos.c b/drivers/cpuidle/cpuidle-exynos.c index 7c01512..1196ca7 100644 --- a/drivers/cpuidle/cpuidle-exynos.c +++ b/drivers/cpuidle/cpuidle-exynos.c @@ -18,11 +18,10 @@ #include #include -static void (*exynos_enter_aftr)(void); +static void (*exynos_enter_aftr)(int); static int idle_finisher(unsigned long flags) { - exynos_enter_aftr(); cpu_do_idle(); return 1; @@ -32,8 +31,12 @@ static int exynos_enter_core0_aftr(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { + int entering_idle = true; cpu_pm_enter(); + exynos_enter_aftr(entering_idle); cpu_suspend(0, idle_finisher); + entering_idle = false; + exynos_enter_aftr(entering_idle); cpu_pm_exit(); return index;