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: 4459441 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4D28F9F358 for ; Tue, 1 Jul 2014 14:33:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4FCCC203E5 for ; Tue, 1 Jul 2014 14:33:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 42BF0201F2 for ; Tue, 1 Jul 2014 14:33:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756201AbaGAOdE (ORCPT ); Tue, 1 Jul 2014 10:33:04 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:39192 "EHLO mail-pa0-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755031AbaGAOdD (ORCPT ); Tue, 1 Jul 2014 10:33:03 -0400 Received: by mail-pa0-f54.google.com with SMTP id et14so10709187pad.13 for ; Tue, 01 Jul 2014 07:33:02 -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 Cc: daniel.lezcano@linaro.org, kgene.kim@samsung.com, linux-pm@vger.kernel.org, Chander Kashyap 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> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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;