aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--arch/arm/mach-omap2/clock.c11
-rw-r--r--arch/arm/mach-omap2/pm34xx.c7
-rw-r--r--arch/arm/mach-omap2/powerdomain.c26
3 files changed, 39 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/clock.c b/arch/arm/mach-omap2/clock.c
index 46d03ccc2806..180299e4a838 100644
--- a/arch/arm/mach-omap2/clock.c
+++ b/arch/arm/mach-omap2/clock.c
@@ -22,7 +22,9 @@
22#include <linux/clk.h> 22#include <linux/clk.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/bitops.h> 24#include <linux/bitops.h>
25#include <trace/events/power.h>
25 26
27#include <asm/cpu.h>
26#include <plat/clock.h> 28#include <plat/clock.h>
27#include "clockdomain.h" 29#include "clockdomain.h"
28#include <plat/cpu.h> 30#include <plat/cpu.h>
@@ -261,8 +263,10 @@ void omap2_clk_disable(struct clk *clk)
261 263
262 pr_debug("clock: %s: disabling in hardware\n", clk->name); 264 pr_debug("clock: %s: disabling in hardware\n", clk->name);
263 265
264 if (clk->ops && clk->ops->disable) 266 if (clk->ops && clk->ops->disable) {
267 trace_clock_disable(clk->name, 0, smp_processor_id());
265 clk->ops->disable(clk); 268 clk->ops->disable(clk);
269 }
266 270
267 if (clk->clkdm) 271 if (clk->clkdm)
268 clkdm_clk_disable(clk->clkdm, clk); 272 clkdm_clk_disable(clk->clkdm, clk);
@@ -314,6 +318,7 @@ int omap2_clk_enable(struct clk *clk)
314 } 318 }
315 319
316 if (clk->ops && clk->ops->enable) { 320 if (clk->ops && clk->ops->enable) {
321 trace_clock_enable(clk->name, 1, smp_processor_id());
317 ret = clk->ops->enable(clk); 322 ret = clk->ops->enable(clk);
318 if (ret) { 323 if (ret) {
319 WARN(1, "clock: %s: could not enable: %d\n", 324 WARN(1, "clock: %s: could not enable: %d\n",
@@ -353,8 +358,10 @@ int omap2_clk_set_rate(struct clk *clk, unsigned long rate)
353 pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate); 358 pr_debug("clock: set_rate for clock %s to rate %ld\n", clk->name, rate);
354 359
355 /* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */ 360 /* dpll_ck, core_ck, virt_prcm_set; plus all clksel clocks */
356 if (clk->set_rate) 361 if (clk->set_rate) {
362 trace_clock_set_rate(clk->name, rate, smp_processor_id());
357 ret = clk->set_rate(clk, rate); 363 ret = clk->set_rate(clk, rate);
364 }
358 365
359 return ret; 366 return ret;
360} 367}
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 3d6a00e07a5b..93e78a3dbc17 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -29,6 +29,7 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/slab.h> 30#include <linux/slab.h>
31#include <linux/console.h> 31#include <linux/console.h>
32#include <trace/events/power.h>
32 33
33#include <plat/sram.h> 34#include <plat/sram.h>
34#include "clockdomain.h" 35#include "clockdomain.h"
@@ -519,8 +520,14 @@ static void omap3_pm_idle(void)
519 if (omap_irq_pending() || need_resched()) 520 if (omap_irq_pending() || need_resched())
520 goto out; 521 goto out;
521 522
523 trace_power_start(POWER_CSTATE, 1, smp_processor_id());
524 trace_cpu_idle(1, smp_processor_id());
525
522 omap_sram_idle(); 526 omap_sram_idle();
523 527
528 trace_power_end(smp_processor_id());
529 trace_cpu_idle(PWR_EVENT_EXIT, smp_processor_id());
530
524out: 531out:
525 local_fiq_enable(); 532 local_fiq_enable();
526 local_irq_enable(); 533 local_irq_enable();
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}