From patchwork Fri Aug 1 09:48:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: keita kobayashi X-Patchwork-Id: 4662001 Return-Path: X-Original-To: patchwork-linux-sh@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 6BCBE9F319 for ; Fri, 1 Aug 2014 09:48:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8B1432021B for ; Fri, 1 Aug 2014 09:48:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0AAE12020F for ; Fri, 1 Aug 2014 09:48:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753497AbaHAJsj (ORCPT ); Fri, 1 Aug 2014 05:48:39 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:7102 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751858AbaHAJsi (ORCPT ); Fri, 1 Aug 2014 05:48:38 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie2.idc.renesas.com with ESMTP; 01 Aug 2014 18:48:37 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id D9704496CC; Fri, 1 Aug 2014 18:48:37 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id C1CA5480A7; Fri, 1 Aug 2014 18:48:37 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id BD386480A6; Fri, 1 Aug 2014 18:48:37 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id UAM15251; Fri, 1 Aug 2014 18:48:37 +0900 X-IronPort-AV: E=Sophos;i="5.01,778,1399993200"; d="scan'208";a="165945331" Received: from mail-sg1lp0088.outbound.protection.outlook.com (HELO APAC01-SG1-obe.outbound.protection.outlook.com) ([207.46.51.88]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 01 Aug 2014 18:48:37 +0900 Received: from SINPR06MB124.apcprd06.prod.outlook.com (10.242.54.156) by SINPR06MB028.apcprd06.prod.outlook.com (10.242.50.150) with Microsoft SMTP Server (TLS) id 15.0.995.14; Fri, 1 Aug 2014 09:48:35 +0000 Received: from [10.161.20.223] (211.11.155.147) by SINPR06MB124.apcprd06.prod.outlook.com (10.242.54.156) with Microsoft SMTP Server (TLS) id 15.0.995.14; Fri, 1 Aug 2014 09:48:33 +0000 Message-ID: <53DB626E.7070101@renesas.com> Date: Fri, 1 Aug 2014 18:48:30 +0900 From: keita kobayashi User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20120216 Thunderbird/10.0.2 MIME-Version: 1.0 To: , CC: , Magnus Damm , Subject: [PATCH 2/6] ARM: shmobile: APMU: Add CPUIdle function X-Originating-IP: [211.11.155.147] X-ClientProxiedBy: HKXPR06CA015.apcprd06.prod.outlook.com (10.141.129.45) To SINPR06MB124.apcprd06.prod.outlook.com (10.242.54.156) X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-Forefront-PRVS: 029097202E X-Forefront-Antispam-Report: SFV:NSPM; SFS:(6049001)(6009001)(199002)(189002)(65816999)(81542001)(65806001)(23736002)(47776003)(229853001)(95666004)(77096002)(42186005)(87266999)(4396001)(79102001)(87976001)(66066001)(106356001)(107046002)(74502001)(77982001)(59896001)(83506001)(46102001)(74662001)(20776003)(86152002)(54356999)(81342001)(99396002)(36756003)(76482001)(86362001)(50986999)(102836001)(21056001)(33656002)(92726001)(65956001)(64706001)(19580405001)(83322001)(85852003)(101416001)(105586002)(83072002)(80316001)(19580395003)(50466002)(85306004)(80022001)(2004002); DIR:OUT; SFP:; SCL:1; SRVR:SINPR06MB124; H:[10.161.20.223]; FPR:; MLV:sfv; PTR:InfoNoRecords; MX:1; LANG:en; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID: X-OriginatorOrg: renesas.com Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 This patch add support Core-Standby state for CPUIdle. Signed-off-by: Keita Kobayashi --- arch/arm/mach-shmobile/common.h | 1 + arch/arm/mach-shmobile/platsmp-apmu.c | 19 +++++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h index 9805608..adbb422 100644 --- a/arch/arm/mach-shmobile/common.h +++ b/arch/arm/mach-shmobile/common.h @@ -32,6 +32,7 @@ extern void shmobile_handle_irq_intc(struct pt_regs *); extern struct platform_suspend_ops shmobile_suspend_ops; struct cpuidle_driver; extern void shmobile_cpuidle_set_driver(struct cpuidle_driver *drv); +extern void shmobile_smp_apmu_enter_cpuidle(void); #ifdef CONFIG_SUSPEND int shmobile_suspend_init(void); diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c index ad6a383..3bfb1a0 100644 --- a/arch/arm/mach-shmobile/platsmp-apmu.c +++ b/arch/arm/mach-shmobile/platsmp-apmu.c @@ -7,6 +7,7 @@ * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ +#include #include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -148,7 +150,8 @@ int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle) } #endif -#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) +#if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND) || \ +defined(CONFIG_CPU_IDLE) /* nicked from arch/arm/mach-exynos/hotplug.c */ static inline void cpu_enter_lowpower_a15(void) { @@ -224,14 +227,16 @@ int shmobile_smp_apmu_cpu_kill(unsigned int cpu) } #endif -#if defined(CONFIG_SUSPEND) +#if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE) static int shmobile_smp_apmu_do_suspend(unsigned long cpu) { shmobile_smp_apmu_cpu_shutdown(cpu); cpu_do_idle(); /* WFI selects Core Standby */ return 1; } +#endif +#if defined(CONFIG_SUSPEND) static int shmobile_smp_apmu_enter_suspend(suspend_state_t state) { shmobile_smp_hook(smp_processor_id(), virt_to_phys(cpu_resume), 0); @@ -245,3 +250,13 @@ void __init shmobile_smp_apmu_suspend_init(void) shmobile_suspend_ops.enter = shmobile_smp_apmu_enter_suspend; } #endif + +#if defined(CONFIG_CPU_IDLE) +void shmobile_smp_apmu_enter_cpuidle(void) +{ + cpu_pm_enter(); + cpu_suspend(smp_processor_id(), shmobile_smp_apmu_do_suspend); + cpu_leave_lowpower(); + cpu_pm_exit(); +} +#endif