From patchwork Sun Dec 9 20:03:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Walmsley X-Patchwork-Id: 1854511 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id A6FBADF230 for ; Sun, 9 Dec 2012 20:09:44 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Thn8E-0003Ao-0y; Sun, 09 Dec 2012 20:05:46 +0000 Received: from utopia.booyaka.com ([74.50.51.50]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Thn7b-00035U-H7 for linux-arm-kernel@lists.infradead.org; Sun, 09 Dec 2012 20:05:10 +0000 Received: (qmail 6862 invoked by uid 1019); 9 Dec 2012 20:05:05 -0000 MBOX-Line: From nobody Sun Dec 9 13:03:17 2012 Subject: [PATCH 02/12] ARM: OMAP2+: PM/powerdomain: move the power state time tracking into the powerdomain code To: linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Paul Walmsley Date: Sun, 09 Dec 2012 13:03:17 -0700 Message-ID: <20121209200259.3196.84569.stgit@dusk.lan> In-Reply-To: <20121209200108.3196.12452.stgit@dusk.lan> References: <20121209200108.3196.12452.stgit@dusk.lan> User-Agent: StGit/0.16-37-g27ac3 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121209_150507_912721_033825F0 X-CRM114-Status: GOOD ( 15.33 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Tero Kristo , Kevin Hilman X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Move the power state time tracking code into the powerdomain code. This code accesses internal powerdomain state, so this change will allow us to reduce what is exported from the powerdomain code. Signed-off-by: Paul Walmsley Cc: Tero Kristo Cc: Kevin Hilman --- arch/arm/mach-omap2/pm-debug.c | 24 ------------------------ arch/arm/mach-omap2/pm.h | 6 ------ arch/arm/mach-omap2/powerdomain.c | 22 +++++++++++++++++++++- 3 files changed, 21 insertions(+), 31 deletions(-) diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 03da2e3..80c001a 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c @@ -53,21 +53,6 @@ enum { DEBUG_FILE_TIMERS, }; -void pm_dbg_update_time(struct powerdomain *pwrdm, int prev) -{ - s64 t; - - if (!pm_dbg_init_done) - return ; - - /* Update timer for previous state */ - t = sched_clock(); - - pwrdm->fpwrst_timer[prev - PWRDM_FPWRST_OFFSET] += t - pwrdm->timer; - - pwrdm->timer = t; -} - static int clkdm_dbg_show_counter(struct clockdomain *clkdm, void *user) { struct seq_file *s = (struct seq_file *)user; @@ -197,17 +182,8 @@ DEFINE_SIMPLE_ATTRIBUTE(pwrdm_suspend_fops, pwrdm_suspend_get, static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir) { - int i; - s64 t; struct dentry *d; - t = sched_clock(); - - for (i = 0; i < PWRDM_FPWRSTS_COUNT; i++) - pwrdm->fpwrst_timer[i] = 0; - - pwrdm->timer = t; - if (strncmp(pwrdm->name, "dpll", 4) == 0) return 0; diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index 19ef376..c496f27 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h @@ -59,12 +59,6 @@ extern u32 enable_off_mode; #define enable_off_mode 0 #endif -#if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS) -extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev); -#else -#define pm_dbg_update_time(pwrdm, prev) do {} while (0); -#endif /* CONFIG_PM_DEBUG */ - /* 24xx */ extern void omap24xx_idle_loop_suspend(void); extern unsigned int omap24xx_idle_loop_suspend_sz; diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index b67d721..53bc852 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c @@ -20,6 +20,8 @@ #include #include #include +#include + #include #include "cm2xxx_3xxx.h" @@ -126,6 +128,9 @@ static int _pwrdm_register(struct powerdomain *pwrdm) arch_pwrdm->pwrdm_wait_transition(pwrdm); pwrdm->fpwrst = pwrdm_read_fpwrst(pwrdm); pwrdm->fpwrst_counter[pwrdm->fpwrst - PWRDM_FPWRST_OFFSET] = 1; +#ifdef CONFIG_PM_DEBUG + pwrdm->timer = sched_clock(); +#endif return 0; } @@ -579,6 +584,21 @@ static int _pwrdm_set_mem_retst(struct powerdomain *pwrdm, u8 bank, u8 pwrst) return ret; } +/* XXX prev is wrong type */ +/* XXX is sched_clock() correct to use here? */ +/* Update timer for previous state */ +static void _pwrdm_update_pwrst_time(struct powerdomain *pwrdm, int prev) +{ +#ifdef CONFIG_PM_DEBUG + s64 t; + + t = sched_clock(); + + pwrdm->fpwrst_timer[prev - PWRDM_FPWRST_OFFSET] += t - pwrdm->timer; + + pwrdm->timer = t; +#endif +} /* XXX Caller must hold pwrdm->_lock */ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) @@ -617,7 +637,7 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) if (fpwrst != prev) pwrdm->fpwrst_counter[fpwrst - PWRDM_FPWRST_OFFSET]++; - pm_dbg_update_time(pwrdm, prev); + _pwrdm_update_pwrst_time(pwrdm, prev); pwrdm->fpwrst = fpwrst;