From patchwork Wed Mar 4 04:55:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: keita kobayashi X-Patchwork-Id: 5928651 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C42369F318 for ; Wed, 4 Mar 2015 04:56:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EB2C2203F4 for ; Wed, 4 Mar 2015 04:56:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C9B09203F1 for ; Wed, 4 Mar 2015 04:56:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755693AbbCDE4O (ORCPT ); Tue, 3 Mar 2015 23:56:14 -0500 Received: from relmlor3.renesas.com ([210.160.252.173]:29788 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752665AbbCDE4N (ORCPT ); Tue, 3 Mar 2015 23:56:13 -0500 Received: from unknown (HELO relmlir3.idc.renesas.com) ([10.200.68.153]) by relmlie2.idc.renesas.com with ESMTP; 04 Mar 2015 13:56:12 +0900 Received: from relmlac4.idc.renesas.com (relmlac4.idc.renesas.com [10.200.69.24]) by relmlir3.idc.renesas.com (Postfix) with ESMTP id 03EE74B311; Wed, 4 Mar 2015 13:56:13 +0900 (JST) Received: by relmlac4.idc.renesas.com (Postfix, from userid 0) id D7010480A4; Wed, 4 Mar 2015 13:56:12 +0900 (JST) Received: from relmlac4.idc.renesas.com (localhost [127.0.0.1]) by relmlac4.idc.renesas.com (Postfix) with ESMTP id D26A3480A3; Wed, 4 Mar 2015 13:56:12 +0900 (JST) Received: from relmlii1.idc.renesas.com [10.200.68.65] by relmlac4.idc.renesas.com with ESMTP id PAJ27913; Wed, 4 Mar 2015 13:56:12 +0900 X-IronPort-AV: E=Sophos;i="5.09,685,1418050800"; d="scan'208";a="181119562" Received: from mail-sg1lp0091.outbound.protection.outlook.com (HELO APAC01-SG1-obe.outbound.protection.outlook.com) ([207.46.51.91]) by relmlii1.idc.renesas.com with ESMTP/TLS/AES256-SHA; 04 Mar 2015 13:56:12 +0900 Received: from localhost (211.11.155.147) by SG2PR06MB0570.apcprd06.prod.outlook.com (25.161.11.139) with Microsoft SMTP Server (TLS) id 15.1.99.14; Wed, 4 Mar 2015 04:56:10 +0000 From: Keita Kobayashi To: , CC: , , , Keita Kobayashi Subject: [RFC/PATCH 3/6] ARM: shmobile: APMU: Add Core-Standby function for CPUIdle Date: Wed, 4 Mar 2015 13:55:43 +0900 Message-ID: <1425444946-3084-4-git-send-email-keita.kobayashi.ym@renesas.com> X-Mailer: git-send-email 1.9.4.msysgit.2 In-Reply-To: <1425444946-3084-1-git-send-email-keita.kobayashi.ym@renesas.com> References: <1425444946-3084-1-git-send-email-keita.kobayashi.ym@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.147] X-ClientProxiedBy: OS2PR01CA0020.jpnprd01.prod.outlook.com (25.161.74.158) To SG2PR06MB0570.apcprd06.prod.outlook.com (25.161.11.139) Authentication-Results: verge.net.au; dkim=none (message not signed) header.d=none; X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SG2PR06MB0570; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(5005006); SRVR:SG2PR06MB0570; BCL:0; PCL:0; RULEID:; SRVR:SG2PR06MB0570; X-Forefront-PRVS: 0505147DDB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6069001)(6009001)(76506005)(36756003)(229853001)(76176999)(50466002)(50986999)(33646002)(50226001)(47776003)(46102003)(40100003)(19580395003)(48376002)(19580405001)(122386002)(42382002)(78352002)(92566002)(42186005)(66066001)(87976001)(2950100001)(62966003)(77156002); DIR:OUT; SFP:1102; SCL:1; SRVR:SG2PR06MB0570; H:localhost; FPR:; SPF:None; MLV:sfv; LANG:en; X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Mar 2015 04:56:10.3826 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SG2PR06MB0570 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 CPUIdle process in platsmp-apmu code. The shmobile_smp_apmu_enter_cpuidle function will be used by R-Car SoC series. Signed-off-by: Keita Kobayashi --- arch/arm/mach-shmobile/common.h | 4 ++++ arch/arm/mach-shmobile/platsmp-apmu.c | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-shmobile/common.h b/arch/arm/mach-shmobile/common.h index 4adecd4..ea34893 100644 --- a/arch/arm/mach-shmobile/common.h +++ b/arch/arm/mach-shmobile/common.h @@ -24,6 +24,7 @@ extern int shmobile_smp_scu_cpu_kill(unsigned int cpu); struct clk; extern int shmobile_clk_init(void); extern struct platform_suspend_ops shmobile_suspend_ops; +struct cpuidle_device; struct cpuidle_driver; #ifdef CONFIG_SUSPEND @@ -37,6 +38,9 @@ static inline void shmobile_smp_apmu_suspend_init(void) { } #ifdef CONFIG_CPU_IDLE int shmobile_cpuidle_init(void); extern void shmobile_cpuidle_set_driver(struct renesas_cpuidle *drv); +extern int shmobile_smp_apmu_enter_cpuidle(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index); #else static inline int shmobile_cpuidle_init(void) { return 0; } #endif diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c index f483b56..f5c8044 100644 --- a/arch/arm/mach-shmobile/platsmp-apmu.c +++ b/arch/arm/mach-shmobile/platsmp-apmu.c @@ -139,7 +139,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_ARM_RENESAS_CPUIDLE) /* nicked from arch/arm/mach-exynos/hotplug.c */ static inline void cpu_enter_lowpower_a15(void) { @@ -215,7 +216,7 @@ int shmobile_smp_apmu_cpu_kill(unsigned int cpu) } #endif -#if defined(CONFIG_SUSPEND) +#if defined(CONFIG_SUSPEND) || defined(CONFIG_ARM_RENESAS_CPUIDLE) static int shmobile_smp_apmu_do_suspend(unsigned long cpu) { shmobile_smp_hook(cpu, virt_to_phys(cpu_resume), 0); @@ -223,7 +224,9 @@ static int shmobile_smp_apmu_do_suspend(unsigned long 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) { cpu_suspend(smp_processor_id(), shmobile_smp_apmu_do_suspend); @@ -236,3 +239,16 @@ void __init shmobile_smp_apmu_suspend_init(void) shmobile_suspend_ops.enter = shmobile_smp_apmu_enter_suspend; } #endif + +#if defined(CONFIG_ARM_RENESAS_CPUIDLE) +int shmobile_smp_apmu_enter_cpuidle(struct cpuidle_device *dev, + struct cpuidle_driver *drv, int index) +{ + cpu_pm_enter(); + cpu_suspend(smp_processor_id(), shmobile_smp_apmu_do_suspend); + cpu_leave_lowpower(); + cpu_pm_exit(); + + return index; +} +#endif