From patchwork Tue Jan 24 04:37:30 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob X-Patchwork-Id: 6359 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id A2C3623E0E for ; Tue, 24 Jan 2012 04:37:48 +0000 (UTC) Received: from mail-bk0-f52.google.com (mail-bk0-f52.google.com [209.85.214.52]) by fiordland.canonical.com (Postfix) with ESMTP id 93060A180D2 for ; Tue, 24 Jan 2012 04:37:48 +0000 (UTC) Received: by mail-bk0-f52.google.com with SMTP id r19so3637941bka.11 for ; Mon, 23 Jan 2012 20:37:48 -0800 (PST) Received: by 10.205.120.17 with SMTP id fw17mr4204112bkc.74.1327379868393; Mon, 23 Jan 2012 20:37:48 -0800 (PST) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.204.130.220 with SMTP id u28cs90833bks; Mon, 23 Jan 2012 20:37:48 -0800 (PST) Received: by 10.101.131.12 with SMTP id i12mr4712669ann.7.1327379866238; Mon, 23 Jan 2012 20:37:46 -0800 (PST) Received: from mail-gy0-f178.google.com (mail-gy0-f178.google.com [209.85.160.178]) by mx.google.com with ESMTPS id o43si15223260yhk.10.2012.01.23.20.37.44 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jan 2012 20:37:46 -0800 (PST) Received-SPF: neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of rob.lee@linaro.org) client-ip=209.85.160.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.160.178 is neither permitted nor denied by best guess record for domain of rob.lee@linaro.org) smtp.mail=rob.lee@linaro.org Received: by mail-gy0-f178.google.com with SMTP id g14so880286ghb.37 for ; Mon, 23 Jan 2012 20:37:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.156.67 with SMTP id l43mr15625393yhk.73.1327379864572; Mon, 23 Jan 2012 20:37:44 -0800 (PST) Received: from b18647-20 ([23.19.172.97]) by mx.google.com with ESMTPS id h29sm14021831ann.16.2012.01.23.20.37.42 (version=SSLv3 cipher=OTHER); Mon, 23 Jan 2012 20:37:44 -0800 (PST) From: Robert Lee To: len.brown@intel.com, linux-pm@vger.kernel.org, s.hauer@pengutronix.de, amit.kucheria@linaro.org Cc: linux@arm.linux.org.uk, shawn.guo@freescale.com, nicolas.ferre@atmel.com, linux@maxim.org.za, kgene.kim@samsung.com, amit.kachhap@linaro.org, magnus.damm@gmail.com, khilman@ti.com, nsekhar@ti.com, daniel.lezcano@linaro.org, mturquette@linaro.org, vincent.guittot@linaro.org, arnd.bergmann@linaro.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, deepthi@linux.vnet.ibm.com, broonie@opensource.wolfsonmicro.com, nicolas.pitre@linaro.org, robherring2@gmail.com Subject: [PATCH v3 3/7] ARM: shmobile: Modify to use new common cpuidle code. Date: Mon, 23 Jan 2012 22:37:30 -0600 Message-Id: <1327379854-12403-4-git-send-email-rob.lee@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1327379854-12403-1-git-send-email-rob.lee@linaro.org> References: <1327379854-12403-1-git-send-email-rob.lee@linaro.org> X-Gm-Message-State: ALoCoQlK6p7Z/bloD1uMI5wbrdpgHoxwc39ClpUb+Q4yxWW3OKpFwKjl5siQA09F/oFTSj1tHG3F Make necessary changes for consolidation with new common cpuidle code. Signed-off-by: Robert Lee --- arch/arm/mach-shmobile/cpuidle.c | 51 ++++++------------------------------- 1 files changed, 9 insertions(+), 42 deletions(-) diff --git a/arch/arm/mach-shmobile/cpuidle.c b/arch/arm/mach-shmobile/cpuidle.c index 1b23342..2a4eaef 100644 --- a/arch/arm/mach-shmobile/cpuidle.c +++ b/arch/arm/mach-shmobile/cpuidle.c @@ -16,71 +16,38 @@ #include #include -static void shmobile_enter_wfi(void) -{ - cpu_do_idle(); -} - -void (*shmobile_cpuidle_modes[CPUIDLE_STATE_MAX])(void) = { - shmobile_enter_wfi, /* regular sleep mode */ -}; +void (*shmobile_cpuidle_modes[CPUIDLE_STATE_MAX])(void); static int shmobile_cpuidle_enter(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { - ktime_t before, after; - - before = ktime_get(); - - local_irq_disable(); - local_fiq_disable(); - shmobile_cpuidle_modes[index](); - local_irq_enable(); - local_fiq_enable(); - - after = ktime_get(); - dev->last_residency = ktime_to_ns(ktime_sub(after, before)) >> 10; - return index; } -static struct cpuidle_device shmobile_cpuidle_dev; -static struct cpuidle_driver shmobile_cpuidle_driver = { +static struct cpuidle_driver shmobile_cpuidle_driver __initdata = { .name = "shmobile_cpuidle", .owner = THIS_MODULE, - .states[0] = { - .name = "C1", - .desc = "WFI", - .exit_latency = 1, - .target_residency = 1 * 2, - .flags = CPUIDLE_FLAG_TIME_VALID, - }, - .safe_state_index = 0, /* C1 */ + .states[0] = CPUIDLE_ARM_WFI_STATE, + .safe_state_index = 0, .state_count = 1, }; void (*shmobile_cpuidle_setup)(struct cpuidle_driver *drv); -static int shmobile_cpuidle_init(void) +static int __init shmobile_cpuidle_init(void) { - struct cpuidle_device *dev = &shmobile_cpuidle_dev; - struct cpuidle_driver *drv = &shmobile_cpuidle_driver; int i; + struct cpuidle_driver *drv = &shmobile_cpuidle_driver; - for (i = 0; i < CPUIDLE_STATE_MAX; i++) + for (i = drv->state_count; i < CPUIDLE_STATE_MAX; i++) drv->states[i].enter = shmobile_cpuidle_enter; if (shmobile_cpuidle_setup) - shmobile_cpuidle_setup(drv); - - cpuidle_register_driver(drv); - - dev->state_count = drv->state_count; - cpuidle_register_device(dev); + shmobile_cpuidle_setup(&shmobile_cpuidle_driver); - return 0; + return common_cpuidle_init(&shmobile_cpuidle_driver, true, NULL); } late_initcall(shmobile_cpuidle_init);