diff options
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r-- | arch/arm/mach-omap2/pm-debug.c | 31 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm34xx.c | 24 |
3 files changed, 56 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c index 982aa67f2685..1b4c1600f8d8 100644 --- a/arch/arm/mach-omap2/pm-debug.c +++ b/arch/arm/mach-omap2/pm-debug.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/clk.h> | 24 | #include <linux/clk.h> |
25 | #include <linux/err.h> | 25 | #include <linux/err.h> |
26 | #include <linux/io.h> | 26 | #include <linux/io.h> |
27 | #include <linux/module.h> | ||
27 | 28 | ||
28 | #include <mach/clock.h> | 29 | #include <mach/clock.h> |
29 | #include <mach/board.h> | 30 | #include <mach/board.h> |
@@ -484,10 +485,28 @@ int pm_dbg_regset_init(int reg_set) | |||
484 | return 0; | 485 | return 0; |
485 | } | 486 | } |
486 | 487 | ||
487 | static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) | 488 | static int pwrdm_suspend_get(void *data, u64 *val) |
489 | { | ||
490 | *val = omap3_pm_get_suspend_state((struct powerdomain *)data); | ||
491 | |||
492 | if (*val >= 0) | ||
493 | return 0; | ||
494 | return *val; | ||
495 | } | ||
496 | |||
497 | static int pwrdm_suspend_set(void *data, u64 val) | ||
498 | { | ||
499 | return omap3_pm_set_suspend_state((struct powerdomain *)data, (int)val); | ||
500 | } | ||
501 | |||
502 | DEFINE_SIMPLE_ATTRIBUTE(pwrdm_suspend_fops, pwrdm_suspend_get, | ||
503 | pwrdm_suspend_set, "%llu\n"); | ||
504 | |||
505 | static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir) | ||
488 | { | 506 | { |
489 | int i; | 507 | int i; |
490 | s64 t; | 508 | s64 t; |
509 | struct dentry *d; | ||
491 | 510 | ||
492 | t = sched_clock(); | 511 | t = sched_clock(); |
493 | 512 | ||
@@ -496,6 +515,14 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) | |||
496 | 515 | ||
497 | pwrdm->timer = t; | 516 | pwrdm->timer = t; |
498 | 517 | ||
518 | if (strncmp(pwrdm->name, "dpll", 4) == 0) | ||
519 | return 0; | ||
520 | |||
521 | d = debugfs_create_dir(pwrdm->name, (struct dentry *)dir); | ||
522 | |||
523 | (void) debugfs_create_file("suspend", S_IRUGO|S_IWUSR, d, | ||
524 | (void *)pwrdm, &pwrdm_suspend_fops); | ||
525 | |||
499 | return 0; | 526 | return 0; |
500 | } | 527 | } |
501 | 528 | ||
@@ -524,7 +551,7 @@ static int __init pm_dbg_init(void) | |||
524 | (void) debugfs_create_file("time", S_IRUGO, | 551 | (void) debugfs_create_file("time", S_IRUGO, |
525 | d, (void *)DEBUG_FILE_TIMERS, &debug_fops); | 552 | d, (void *)DEBUG_FILE_TIMERS, &debug_fops); |
526 | 553 | ||
527 | pwrdm_for_each(pwrdms_setup, NULL); | 554 | pwrdm_for_each(pwrdms_setup, (void *)d); |
528 | 555 | ||
529 | pm_dbg_dir = debugfs_create_dir("registers", d); | 556 | pm_dbg_dir = debugfs_create_dir("registers", d); |
530 | if (IS_ERR(pm_dbg_dir)) | 557 | if (IS_ERR(pm_dbg_dir)) |
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h index 8fa856770188..8400f5768923 100644 --- a/arch/arm/mach-omap2/pm.h +++ b/arch/arm/mach-omap2/pm.h | |||
@@ -13,6 +13,9 @@ | |||
13 | 13 | ||
14 | #include <mach/powerdomain.h> | 14 | #include <mach/powerdomain.h> |
15 | 15 | ||
16 | extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm); | ||
17 | extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state); | ||
18 | |||
16 | #ifdef CONFIG_PM_DEBUG | 19 | #ifdef CONFIG_PM_DEBUG |
17 | extern void omap2_pm_dump(int mode, int resume, unsigned int us); | 20 | extern void omap2_pm_dump(int mode, int resume, unsigned int us); |
18 | extern int omap2_pm_debug; | 21 | extern int omap2_pm_debug; |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 331dfca93ed5..26f2aca9abe8 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -664,6 +664,30 @@ static void __init prcm_setup_regs(void) | |||
664 | omap3_d2d_idle(); | 664 | omap3_d2d_idle(); |
665 | } | 665 | } |
666 | 666 | ||
667 | int omap3_pm_get_suspend_state(struct powerdomain *pwrdm) | ||
668 | { | ||
669 | struct power_state *pwrst; | ||
670 | |||
671 | list_for_each_entry(pwrst, &pwrst_list, node) { | ||
672 | if (pwrst->pwrdm == pwrdm) | ||
673 | return pwrst->next_state; | ||
674 | } | ||
675 | return -EINVAL; | ||
676 | } | ||
677 | |||
678 | int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state) | ||
679 | { | ||
680 | struct power_state *pwrst; | ||
681 | |||
682 | list_for_each_entry(pwrst, &pwrst_list, node) { | ||
683 | if (pwrst->pwrdm == pwrdm) { | ||
684 | pwrst->next_state = state; | ||
685 | return 0; | ||
686 | } | ||
687 | } | ||
688 | return -EINVAL; | ||
689 | } | ||
690 | |||
667 | static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) | 691 | static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) |
668 | { | 692 | { |
669 | struct power_state *pwrst; | 693 | struct power_state *pwrst; |