aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/powerdomain.c
diff options
context:
space:
mode:
authorJean Pihet <jean.pihet@newoldbits.com>2011-03-03 05:25:43 -0500
committerKevin Hilman <khilman@ti.com>2011-03-11 10:21:44 -0500
commit5e7c58dc8d9b7f31d418cf98c6a8cad84b86f510 (patch)
tree76556b2447f39104ac9a56e9d94182d0f6fce6fb /arch/arm/mach-omap2/powerdomain.c
parenta271e58cfbe345f71d39ebbae063ad2d68892470 (diff)
perf: add OMAP support for the new power events
The patch adds the new power management trace points for the OMAP architecture. The trace points are for: - default idle handler. Since the cpuidle framework is instrumented in the generic way there is no need to add trace points in the OMAP specific cpuidle handler; - SoC clocks changes (enable, disable, set_rate), - power domain states: the desired target state and -if different- the actually hit state. Because of the generic nature of the changes, OMAP3 and OMAP4 are supported. Tested on OMAP3 with suspend/resume, cpuidle, basic DVFS. Signed-off-by: Jean Pihet <j-pihet@ti.com> Acked-by: Paul Walmsley <paul@pwsan.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/powerdomain.c')
-rw-r--r--arch/arm/mach-omap2/powerdomain.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index a11be81997c5..49c6513e90d8 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -19,12 +19,15 @@
19#include <linux/list.h> 19#include <linux/list.h>
20#include <linux/errno.h> 20#include <linux/errno.h>
21#include <linux/string.h> 21#include <linux/string.h>
22#include <trace/events/power.h>
23
22#include "cm2xxx_3xxx.h" 24#include "cm2xxx_3xxx.h"
23#include "prcm44xx.h" 25#include "prcm44xx.h"
24#include "cm44xx.h" 26#include "cm44xx.h"
25#include "prm2xxx_3xxx.h" 27#include "prm2xxx_3xxx.h"
26#include "prm44xx.h" 28#include "prm44xx.h"
27 29
30#include <asm/cpu.h>
28#include <plat/cpu.h> 31#include <plat/cpu.h>
29#include "powerdomain.h" 32#include "powerdomain.h"
30#include "clockdomain.h" 33#include "clockdomain.h"
@@ -32,6 +35,8 @@
32 35
33#include "pm.h" 36#include "pm.h"
34 37
38#define PWRDM_TRACE_STATES_FLAG (1<<31)
39
35enum { 40enum {
36 PWRDM_STATE_NOW = 0, 41 PWRDM_STATE_NOW = 0,
37 PWRDM_STATE_PREV, 42 PWRDM_STATE_PREV,
@@ -130,8 +135,7 @@ static void _update_logic_membank_counters(struct powerdomain *pwrdm)
130static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) 135static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag)
131{ 136{
132 137
133 int prev; 138 int prev, state, trace_state = 0;
134 int state;
135 139
136 if (pwrdm == NULL) 140 if (pwrdm == NULL)
137 return -EINVAL; 141 return -EINVAL;
@@ -148,6 +152,17 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag)
148 pwrdm->state_counter[prev]++; 152 pwrdm->state_counter[prev]++;
149 if (prev == PWRDM_POWER_RET) 153 if (prev == PWRDM_POWER_RET)
150 _update_logic_membank_counters(pwrdm); 154 _update_logic_membank_counters(pwrdm);
155 /*
156 * If the power domain did not hit the desired state,
157 * generate a trace event with both the desired and hit states
158 */
159 if (state != prev) {
160 trace_state = (PWRDM_TRACE_STATES_FLAG |
161 ((state & OMAP_POWERSTATE_MASK) << 8) |
162 ((prev & OMAP_POWERSTATE_MASK) << 0));
163 trace_power_domain_target(pwrdm->name, trace_state,
164 smp_processor_id());
165 }
151 break; 166 break;
152 default: 167 default:
153 return -EINVAL; 168 return -EINVAL;
@@ -406,8 +421,13 @@ int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst)
406 pr_debug("powerdomain: setting next powerstate for %s to %0x\n", 421 pr_debug("powerdomain: setting next powerstate for %s to %0x\n",
407 pwrdm->name, pwrst); 422 pwrdm->name, pwrst);
408 423
409 if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) 424 if (arch_pwrdm && arch_pwrdm->pwrdm_set_next_pwrst) {
425 /* Trace the pwrdm desired target state */
426 trace_power_domain_target(pwrdm->name, pwrst,
427 smp_processor_id());
428 /* Program the pwrdm desired target state */
410 ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst); 429 ret = arch_pwrdm->pwrdm_set_next_pwrst(pwrdm, pwrst);
430 }
411 431
412 return ret; 432 return ret;
413} 433}