aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm-debug.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/pm-debug.c')
-rw-r--r--arch/arm/mach-omap2/pm-debug.c56
1 files changed, 43 insertions, 13 deletions
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 2fc4d6abbd0a..a0866268aa41 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -26,10 +26,10 @@
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/module.h> 27#include <linux/module.h>
28 28
29#include <mach/clock.h> 29#include <plat/clock.h>
30#include <mach/board.h> 30#include <plat/board.h>
31#include <mach/powerdomain.h> 31#include <plat/powerdomain.h>
32#include <mach/clockdomain.h> 32#include <plat/clockdomain.h>
33 33
34#include "prm.h" 34#include "prm.h"
35#include "cm.h" 35#include "cm.h"
@@ -51,9 +51,8 @@ int omap2_pm_debug;
51 regs[reg_count++].val = __raw_readl(reg) 51 regs[reg_count++].val = __raw_readl(reg)
52#define DUMP_INTC_REG(reg, off) \ 52#define DUMP_INTC_REG(reg, off) \
53 regs[reg_count].name = #reg; \ 53 regs[reg_count].name = #reg; \
54 regs[reg_count++].val = __raw_readl(OMAP2_IO_ADDRESS(0x480fe000 + (off))) 54 regs[reg_count++].val = \
55 55 __raw_readl(OMAP2_L4_IO_ADDRESS(0x480fe000 + (off)))
56static int __init pm_dbg_init(void);
57 56
58void omap2_pm_dump(int mode, int resume, unsigned int us) 57void omap2_pm_dump(int mode, int resume, unsigned int us)
59{ 58{
@@ -166,6 +165,8 @@ struct dentry *pm_dbg_dir;
166 165
167static int pm_dbg_init_done; 166static int pm_dbg_init_done;
168 167
168static int __init pm_dbg_init(void);
169
169enum { 170enum {
170 DEBUG_FILE_COUNTERS = 0, 171 DEBUG_FILE_COUNTERS = 0,
171 DEBUG_FILE_TIMERS, 172 DEBUG_FILE_TIMERS,
@@ -325,7 +326,7 @@ int pm_dbg_regset_save(int reg_set)
325 return 0; 326 return 0;
326} 327}
327 328
328static const char pwrdm_state_names[][4] = { 329static const char pwrdm_state_names[][PWRDM_MAX_PWRSTS] = {
329 "OFF", 330 "OFF",
330 "RET", 331 "RET",
331 "INA", 332 "INA",
@@ -380,7 +381,7 @@ static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void *user)
380 381
381 seq_printf(s, "%s (%s)", pwrdm->name, 382 seq_printf(s, "%s (%s)", pwrdm->name,
382 pwrdm_state_names[pwrdm->state]); 383 pwrdm_state_names[pwrdm->state]);
383 for (i = 0; i < 4; i++) 384 for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
384 seq_printf(s, ",%s:%d", pwrdm_state_names[i], 385 seq_printf(s, ",%s:%d", pwrdm_state_names[i],
385 pwrdm->state_counter[i]); 386 pwrdm->state_counter[i]);
386 387
@@ -487,9 +488,11 @@ int pm_dbg_regset_init(int reg_set)
487 488
488static int pwrdm_suspend_get(void *data, u64 *val) 489static int pwrdm_suspend_get(void *data, u64 *val)
489{ 490{
490 *val = omap3_pm_get_suspend_state((struct powerdomain *)data); 491 int ret;
492 ret = omap3_pm_get_suspend_state((struct powerdomain *)data);
493 *val = ret;
491 494
492 if (*val >= 0) 495 if (ret >= 0)
493 return 0; 496 return 0;
494 return *val; 497 return *val;
495} 498}
@@ -526,6 +529,29 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
526 return 0; 529 return 0;
527} 530}
528 531
532static int option_get(void *data, u64 *val)
533{
534 u32 *option = data;
535
536 *val = *option;
537
538 return 0;
539}
540
541static int option_set(void *data, u64 val)
542{
543 u32 *option = data;
544
545 *option = val;
546
547 if (option == &enable_off_mode)
548 omap3_pm_off_mode_enable(val);
549
550 return 0;
551}
552
553DEFINE_SIMPLE_ATTRIBUTE(pm_dbg_option_fops, option_get, option_set, "%llu\n");
554
529static int __init pm_dbg_init(void) 555static int __init pm_dbg_init(void)
530{ 556{
531 int i; 557 int i;
@@ -568,12 +594,16 @@ static int __init pm_dbg_init(void)
568 594
569 } 595 }
570 596
597 (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUGO, d,
598 &enable_off_mode, &pm_dbg_option_fops);
599 (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUGO, d,
600 &sleep_while_idle, &pm_dbg_option_fops);
601 (void) debugfs_create_file("wakeup_timer_seconds", S_IRUGO | S_IWUGO, d,
602 &wakeup_timer_seconds, &pm_dbg_option_fops);
571 pm_dbg_init_done = 1; 603 pm_dbg_init_done = 1;
572 604
573 return 0; 605 return 0;
574} 606}
575arch_initcall(pm_dbg_init); 607arch_initcall(pm_dbg_init);
576 608
577#else
578void pm_dbg_update_time(struct powerdomain *pwrdm, int prev) {}
579#endif 609#endif