From patchwork Mon Feb 27 04:47:37 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob X-Patchwork-Id: 6942 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 7905D23E01 for ; Mon, 27 Feb 2012 04:48:04 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 3B0F4A185EF for ; Mon, 27 Feb 2012 04:48:04 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id z7so7824105iab.11 for ; Sun, 26 Feb 2012 20:48:04 -0800 (PST) Received: from mr.google.com ([10.50.168.74]) by 10.50.168.74 with SMTP id zu10mr12056646igb.26.1330318084079 (num_hops = 1); Sun, 26 Feb 2012 20:48:04 -0800 (PST) Received: by 10.50.168.74 with SMTP id zu10mr9789723igb.26.1330318084023; Sun, 26 Feb 2012 20:48:04 -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.231.11.10 with SMTP id r10csp57807ibr; Sun, 26 Feb 2012 20:48:03 -0800 (PST) Received: by 10.236.189.5 with SMTP id b5mr14050892yhn.93.1330318083146; Sun, 26 Feb 2012 20:48:03 -0800 (PST) Received: from mail-yx0-f178.google.com (mail-yx0-f178.google.com [209.85.213.178]) by mx.google.com with ESMTPS id z9si13980598yhn.40.2012.02.26.20.48.03 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 26 Feb 2012 20:48:03 -0800 (PST) Received-SPF: neutral (google.com: 209.85.213.178 is neither permitted nor denied by best guess record for domain of rob.lee@linaro.org) client-ip=209.85.213.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.213.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-yx0-f178.google.com with SMTP id m12so2125038yen.37 for ; Sun, 26 Feb 2012 20:48:03 -0800 (PST) Received-SPF: pass (google.com: domain of rob.lee@linaro.org designates 10.236.79.193 as permitted sender) client-ip=10.236.79.193; Received: from mr.google.com ([10.236.79.193]) by 10.236.79.193 with SMTP id i41mr18706805yhe.16.1330318083005 (num_hops = 1); Sun, 26 Feb 2012 20:48:03 -0800 (PST) MIME-Version: 1.0 Received: by 10.236.79.193 with SMTP id i41mr13974720yhe.16.1330318080416; Sun, 26 Feb 2012 20:48:00 -0800 (PST) Received: from b18647-20 ([67.23.168.6]) by mx.google.com with ESMTPS id w44sm35245363yhk.17.2012.02.26.20.47.57 (version=SSLv3 cipher=OTHER); Sun, 26 Feb 2012 20:47:59 -0800 (PST) From: Robert Lee To: len.brown@intel.com, khilman@ti.com Cc: robherring2@gmail.com, Baohua.Song@csr.com, amit.kucheria@linaro.org, nicolas.ferre@atmel.com, linux@maxim.org.za, kgene.kim@samsung.com, amit.kachhap@linaro.org, magnus.damm@gmail.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, linaro-dev@lists.linaro.org, patches@linaro.org, deepthi@linux.vnet.ibm.com, broonie@opensource.wolfsonmicro.com, nicolas.pitre@linaro.org, linux@arm.linux.org.uk, jean.pihet@newoldbits.com Subject: [PATCH v5 3/9] ARM: omap: Consolidate OMAP3 cpuidle time keeping and irq enable Date: Sun, 26 Feb 2012 22:47:37 -0600 Message-Id: <1330318063-25460-4-git-send-email-rob.lee@linaro.org> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1330318063-25460-1-git-send-email-rob.lee@linaro.org> References: <1330318063-25460-1-git-send-email-rob.lee@linaro.org> X-Gm-Message-State: ALoCoQk2BVUM+wrCkag6duIL6cASF9sv6N8XK/UR6y8l71i05ckG6+XD4i9zX8iwgIfsQDA+vKOT Use core cpuidle timekeeping and irqen wrapper and remove that handling from this code. Signed-off-by: Robert Lee --- arch/arm/mach-omap2/cpuidle34xx.c | 43 +++++++++++++++--------------------- 1 files changed, 18 insertions(+), 25 deletions(-) diff --git a/arch/arm/mach-omap2/cpuidle34xx.c b/arch/arm/mach-omap2/cpuidle34xx.c index 464cffd..1f6123f 100644 --- a/arch/arm/mach-omap2/cpuidle34xx.c +++ b/arch/arm/mach-omap2/cpuidle34xx.c @@ -87,29 +87,14 @@ static int _cpuidle_deny_idle(struct powerdomain *pwrdm, return 0; } -/** - * omap3_enter_idle - Programs OMAP3 to enter the specified state - * @dev: cpuidle device - * @drv: cpuidle driver - * @index: the index of state to be entered - * - * Called from the CPUidle framework to program the device to the - * specified target state selected by the governor. - */ -static int omap3_enter_idle(struct cpuidle_device *dev, +static inline int __omap3_enter_idle(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { struct omap3_idle_statedata *cx = cpuidle_get_statedata(&dev->states_usage[index]); - struct timespec ts_preidle, ts_postidle, ts_idle; u32 mpu_state = cx->mpu_state, core_state = cx->core_state; - int idle_time; - /* Used to keep track of the total time in idle */ - getnstimeofday(&ts_preidle); - - local_irq_disable(); local_fiq_disable(); pwrdm_set_next_pwrst(mpu_pd, mpu_state); @@ -148,22 +133,29 @@ static int omap3_enter_idle(struct cpuidle_device *dev, } return_sleep_time: - getnstimeofday(&ts_postidle); - ts_idle = timespec_sub(ts_postidle, ts_preidle); - local_irq_enable(); local_fiq_enable(); - idle_time = ts_idle.tv_nsec / NSEC_PER_USEC + ts_idle.tv_sec * \ - USEC_PER_SEC; - - /* Update cpuidle counters */ - dev->last_residency = idle_time; - return index; } /** + * omap3_enter_idle - Programs OMAP3 to enter the specified state + * @dev: cpuidle device + * @drv: cpuidle driver + * @index: the index of state to be entered + * + * Called from the CPUidle framework to program the device to the + * specified target state selected by the governor. + */ +static int omap3_enter_idle(struct cpuidle_device *dev, + struct cpuidle_driver *drv, + int index) +{ + return cpuidle_wrap_enter(dev, drv, index, __omap3_enter_idle); +} + +/** * next_valid_state - Find next valid C-state * @dev: cpuidle device * @drv: cpuidle driver @@ -295,6 +287,7 @@ static int omap3_enter_idle_bm(struct cpuidle_device *dev, new_state_idx = next_valid_state(dev, drv, index); select_state: + ret = omap3_enter_idle(dev, drv, new_state_idx); /* Restore original PER state if it was modified */