linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: jean.pihet@newoldbits.com
To: linux-omap@vger.kernel.org
Subject: [PATCH 07/13] OMAP2+: PM: move the powerdomains time stats to powerdomain code
Date: Wed, 18 May 2011 19:32:24 +0200	[thread overview]
Message-ID: <1305739950-11695-8-git-send-email-j-pihet@ti.com> (raw)
In-Reply-To: <1305739950-11695-1-git-send-email-j-pihet@ti.com>

From: Jean Pihet <j-pihet@ti.com>

Move the powerdomains time accounting code from in pm-debug to the
powerdomain code. The pm-debug code only displays the information on
request.

This also cleans up the core PM code, in order to allow it to be used
as a module.

Signed-off-by: Jean Pihet <j-pihet@ti.com>
---
 arch/arm/mach-omap2/pm-debug.c    |   26 +-------------------------
 arch/arm/mach-omap2/pm.h          |    2 --
 arch/arm/mach-omap2/powerdomain.c |   25 ++++++++++++++++++++++++-
 arch/arm/mach-omap2/powerdomain.h |    3 +++
 4 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 98cc9ee..0b896d4 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -333,21 +333,6 @@ static const char pwrdm_state_names[][PWRDM_MAX_PWRSTS] = {
 	"ON"
 };
 
-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->state_timer[prev] += 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;
@@ -410,7 +395,7 @@ static int pwrdm_dbg_show_timer(struct powerdomain *pwrdm, void *user)
 	seq_printf(s, "%s (%s)", pwrdm->name,
 		pwrdm_state_names[pwrdm->state]);
 
-	for (i = 0; i < 4; i++)
+	for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
 		seq_printf(s, ",%s:%lld", pwrdm_state_names[i],
 			pwrdm->state_timer[i]);
 
@@ -517,17 +502,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 < 4; i++)
-		pwrdm->state_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 f36f79c..03da7f8 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -76,11 +76,9 @@ extern u32 sleep_while_idle;
 #endif
 
 #if defined(CONFIG_PM_DEBUG) && defined(CONFIG_DEBUG_FS)
-extern void pm_dbg_update_time(struct powerdomain *pwrdm, int prev);
 extern int pm_dbg_regset_save(int reg_set);
 extern int pm_dbg_regset_init(int reg_set);
 #else
-#define pm_dbg_update_time(pwrdm, prev) do {} while (0);
 #define pm_dbg_regset_save(reg_set) do {} while (0);
 #define pm_dbg_regset_init(reg_set) do {} while (0);
 #endif /* CONFIG_PM_DEBUG */
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index 9af0847..93a17c8 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -19,6 +19,7 @@
 #include <linux/list.h>
 #include <linux/errno.h>
 #include <linux/string.h>
+#include <linux/sched.h>
 #include <trace/events/power.h>
 
 #include "cm2xxx_3xxx.h"
@@ -77,6 +78,7 @@ static struct powerdomain *_pwrdm_lookup(const char *name)
 static int _pwrdm_register(struct powerdomain *pwrdm)
 {
 	int i;
+	s64 t;
 
 	if (!pwrdm || !pwrdm->name)
 		return -EINVAL;
@@ -100,6 +102,12 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
 	for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
 		pwrdm->state_counter[i] = 0;
 
+	/* Initialize the powerdomain's state timing stats */
+	t = sched_clock();
+	for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
+		pwrdm->state_timer[i] = 0;
+	pwrdm->timer = t;
+
 	pwrdm->ret_logic_off_counter = 0;
 	for (i = 0; i < pwrdm->banks; i++)
 		pwrdm->ret_mem_off_counter[i] = 0;
@@ -171,7 +179,9 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag)
 	if (state != prev)
 		pwrdm->state_counter[state]++;
 
-	pm_dbg_update_time(pwrdm, prev);
+#ifdef CONFIG_PM_DEBUG
+	pwrdm_update_state_timer(pwrdm, prev);
+#endif
 
 	pwrdm->state = state;
 
@@ -999,3 +1009,16 @@ bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm)
 
 	return 0;
 }
+
+#ifdef CONFIG_PM_DEBUG
+void pwrdm_update_state_timer(struct powerdomain *pwrdm, int prev)
+{
+	s64 t;
+
+	/* Update timer for previous state */
+	t = sched_clock();
+	pwrdm->state_timer[prev] += t - pwrdm->timer;
+	pwrdm->timer = t;
+}
+#endif
+
diff --git a/arch/arm/mach-omap2/powerdomain.h b/arch/arm/mach-omap2/powerdomain.h
index d23d979..abda68d 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -209,6 +209,9 @@ int pwrdm_post_transition(void);
 int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
 u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm);
 bool pwrdm_can_ever_lose_context(struct powerdomain *pwrdm);
+#ifdef CONFIG_PM_DEBUG
+void pwrdm_update_state_timer(struct powerdomain *pwrdm, int prev);
+#endif
 
 extern void omap2xxx_powerdomains_init(void);
 extern void omap3xxx_powerdomains_init(void);
-- 
1.7.4.1


  parent reply	other threads:[~2011-05-18 17:32 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-18 17:32 [RFC/PATCH 00/13] OMAP2+: PM: isolate PM code in modules jean.pihet
2011-05-18 17:32 ` [PATCH 01/13] perf: export power_start and power_end tracepoints jean.pihet
2011-05-18 17:32 ` [PATCH 02/13] OMAP2+: PM: isolate PM code jean.pihet
2011-05-18 17:32 ` [PATCH 03/13] OMAP2+: PM: clean up usage of SRAM functions jean.pihet
2011-05-26 20:34   ` Kevin Hilman
2011-05-18 17:32 ` [PATCH 04/13] OMAP2+: cpuidle: register the board specific C-states table jean.pihet
2011-05-18 17:32 ` [PATCH 05/13] OMAP2+: PM: move common code from pm-debug.c to pm.c jean.pihet
2011-05-18 17:32 ` [PATCH 06/13] OMAP2+: PM: isolate the scratchpad save function from the PM code jean.pihet
2011-05-18 17:32 ` jean.pihet [this message]
2011-05-26 20:45   ` [PATCH 07/13] OMAP2+: PM: move the powerdomains time stats to powerdomain code Kevin Hilman
2011-05-18 17:32 ` [PATCH 08/13] OMAP2+: PM: provide the next timer event API to PM modules jean.pihet
2011-05-19  7:59   ` Santosh Shilimkar
2011-05-19 12:02     ` Jean Pihet
2011-05-26 23:00   ` Kevin Hilman
2011-05-27  7:44     ` Jean Pihet
2011-05-18 17:32 ` [PATCH 09/13] OMAP2+: PM: export suspend_set_ops " jean.pihet
2011-05-26 23:09   ` Kevin Hilman
2011-05-27  7:48     ` Jean Pihet
2011-05-28  0:28       ` Kevin Hilman
2011-05-18 17:32 ` [PATCH 10/13] OMAP3: PM: export the v7_flush_dcache_all API to modules jean.pihet
2011-05-19  8:04   ` Santosh Shilimkar
2011-05-25 12:21     ` Jean Pihet
2011-05-18 17:32 ` [PATCH 11/13] OMAP2+: PM: implement modules insertion and removal code jean.pihet
2011-05-18 17:32 ` [PATCH 12/13] OMAP2+: PM: export functions and variables to PM modules jean.pihet
2011-05-19  8:32   ` Santosh Shilimkar
2011-05-18 17:32 ` [PATCH 13/13] OMAP2+: PM: build PM functionality as modules jean.pihet
2011-05-31  8:02 ` [RFC/PATCH 00/13] OMAP2+: PM: isolate PM code in modules Tony Lindgren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1305739950-11695-8-git-send-email-j-pihet@ti.com \
    --to=jean.pihet@newoldbits.com \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).