From patchwork Tue Jan 24 04:37:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob X-Patchwork-Id: 6358 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 3AADE23E0E for ; Tue, 24 Jan 2012 04:37:46 +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 2B075A18798 for ; Tue, 24 Jan 2012 04:37:46 +0000 (UTC) Received: by mail-bk0-f52.google.com with SMTP id r19so3637941bka.11 for ; Mon, 23 Jan 2012 20:37:46 -0800 (PST) Received: by 10.205.130.12 with SMTP id hk12mr4222714bkc.56.1327379865874; Mon, 23 Jan 2012 20:37:45 -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 u28cs90832bks; Mon, 23 Jan 2012 20:37:45 -0800 (PST) Received: by 10.101.137.31 with SMTP id p31mr4602076ann.28.1327379863894; Mon, 23 Jan 2012 20:37:43 -0800 (PST) Received: from mail-gx0-f178.google.com (mail-gx0-f178.google.com [209.85.161.178]) by mx.google.com with ESMTPS id d50si15232131yhh.16.2012.01.23.20.37.42 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 23 Jan 2012 20:37:43 -0800 (PST) Received-SPF: neutral (google.com: 209.85.161.178 is neither permitted nor denied by best guess record for domain of rob.lee@linaro.org) client-ip=209.85.161.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.161.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 ggnp1 with SMTP id p1so1993300ggn.37 for ; Mon, 23 Jan 2012 20:37:42 -0800 (PST) MIME-Version: 1.0 Received: by 10.100.244.7 with SMTP id r7mr4625086anh.10.1327379861787; Mon, 23 Jan 2012 20:37:41 -0800 (PST) Received: from b18647-20 ([23.19.172.97]) by mx.google.com with ESMTPS id h29sm14021831ann.16.2012.01.23.20.37.39 (version=SSLv3 cipher=OTHER); Mon, 23 Jan 2012 20:37:41 -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 2/7] ARM: exynos: Modify to use new common cpuidle code. Date: Mon, 23 Jan 2012 22:37:29 -0600 Message-Id: <1327379854-12403-3-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: ALoCoQnnBwttH3Y+ozR6qnbpc8+cysJnsKCHgoPAfTTHt1XojWCJXh/QDZNU/xImjvOrrY9GnOvw Make necessary changes for consolidation with new common cpuidle code. Signed-off-by: Robert Lee Reviewed-by: Barry Song --- arch/arm/mach-exynos/cpuidle.c | 73 +++------------------------------------ 1 files changed, 6 insertions(+), 67 deletions(-) diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index 4ebb382..baa1178 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -13,80 +13,19 @@ #include #include #include -#include - #include -static int exynos4_enter_idle(struct cpuidle_device *dev, - struct cpuidle_driver *drv, - int index); - -static struct cpuidle_state exynos4_cpuidle_set[] = { - [0] = { - .enter = exynos4_enter_idle, - .exit_latency = 1, - .target_residency = 100000, - .flags = CPUIDLE_FLAG_TIME_VALID, - .name = "IDLE", - .desc = "ARM clock gating(WFI)", - }, -}; - -static DEFINE_PER_CPU(struct cpuidle_device, exynos4_cpuidle_device); - -static struct cpuidle_driver exynos4_idle_driver = { +static struct cpuidle_driver exynos4_idle_driver __initdata = { .name = "exynos4_idle", .owner = THIS_MODULE, + .states[0] = CPUIDLE_ARM_WFI_STATE, + .state_count = 1, }; -static int exynos4_enter_idle(struct cpuidle_device *dev, - struct cpuidle_driver *drv, - int index) -{ - struct timeval before, after; - int idle_time; - - local_irq_disable(); - do_gettimeofday(&before); - - cpu_do_idle(); - - do_gettimeofday(&after); - local_irq_enable(); - idle_time = (after.tv_sec - before.tv_sec) * USEC_PER_SEC + - (after.tv_usec - before.tv_usec); - - dev->last_residency = idle_time; - return index; -} - static int __init exynos4_init_cpuidle(void) { - int i, max_cpuidle_state, cpu_id; - struct cpuidle_device *device; - struct cpuidle_driver *drv = &exynos4_idle_driver; - - /* Setup cpuidle driver */ - drv->state_count = (sizeof(exynos4_cpuidle_set) / - sizeof(struct cpuidle_state)); - max_cpuidle_state = drv->state_count; - for (i = 0; i < max_cpuidle_state; i++) { - memcpy(&drv->states[i], &exynos4_cpuidle_set[i], - sizeof(struct cpuidle_state)); - } - cpuidle_register_driver(&exynos4_idle_driver); - - for_each_cpu(cpu_id, cpu_online_mask) { - device = &per_cpu(exynos4_cpuidle_device, cpu_id); - device->cpu = cpu_id; - - device->state_count = drv->state_count; - - if (cpuidle_register_device(device)) { - printk(KERN_ERR "CPUidle register device failed\n,"); - return -EIO; - } - } - return 0; + return common_cpuidle_init(&exynos4_idle_driver, + true, + NULL); } device_initcall(exynos4_init_cpuidle);