aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2
diff options
context:
space:
mode:
authorKevin Hilman <khilman@deeprootsystems.com>2009-10-06 17:25:09 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2009-11-11 17:42:27 -0500
commitc40552bc82166adb21a1a7fcb1dc4e76352b1b79 (patch)
tree3625838f286478e88ccc3a3be09b1c330149106c /arch/arm/mach-omap2
parent89139dce8a0060d97a46cebde570a8f55c314712 (diff)
OMAP3: PM debug: allow runtime toggle of PM features
Allow enable/disable of low-power states during idle. To enable low-power idle: echo 1 > /debug/pm_debug/sleep_while_idle to disable: echo 0 > /debug/pm_debug/sleep_while_idle Also allow enable/disable of OFF-mode. To enable: echo 1 > /debug/pm_debug/enable_off_mode to disable: echo 0 > /debug/pm_debug/enable_off_mode Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-omap2')
-rw-r--r--arch/arm/mach-omap2/pm-debug.c27
-rw-r--r--arch/arm/mach-omap2/pm.h4
-rw-r--r--arch/arm/mach-omap2/pm34xx.c22
-rw-r--r--arch/arm/mach-omap2/serial.c2
4 files changed, 53 insertions, 2 deletions
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 7eb2c12c8b7c..1725da3f4e18 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -527,6 +527,29 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *dir)
527 return 0; 527 return 0;
528} 528}
529 529
530static int option_get(void *data, u64 *val)
531{
532 u32 *option = data;
533
534 *val = *option;
535
536 return 0;
537}
538
539static int option_set(void *data, u64 val)
540{
541 u32 *option = data;
542
543 *option = val;
544
545 if (option == &enable_off_mode)
546 omap3_pm_off_mode_enable(val);
547
548 return 0;
549}
550
551DEFINE_SIMPLE_ATTRIBUTE(pm_dbg_option_fops, option_get, option_set, "%llu\n");
552
530static int __init pm_dbg_init(void) 553static int __init pm_dbg_init(void)
531{ 554{
532 int i; 555 int i;
@@ -569,6 +592,10 @@ static int __init pm_dbg_init(void)
569 592
570 } 593 }
571 594
595 (void) debugfs_create_file("enable_off_mode", S_IRUGO | S_IWUGO, d,
596 &enable_off_mode, &pm_dbg_option_fops);
597 (void) debugfs_create_file("sleep_while_idle", S_IRUGO | S_IWUGO, d,
598 &sleep_while_idle, &pm_dbg_option_fops);
572 pm_dbg_init_done = 1; 599 pm_dbg_init_done = 1;
573 600
574 return 0; 601 return 0;
diff --git a/arch/arm/mach-omap2/pm.h b/arch/arm/mach-omap2/pm.h
index 45cafac716d1..9582793ce82d 100644
--- a/arch/arm/mach-omap2/pm.h
+++ b/arch/arm/mach-omap2/pm.h
@@ -13,7 +13,11 @@
13 13
14#include <plat/powerdomain.h> 14#include <plat/powerdomain.h>
15 15
16extern u32 enable_off_mode;
17extern u32 sleep_while_idle;
18
16extern void *omap3_secure_ram_storage; 19extern void *omap3_secure_ram_storage;
20extern void omap3_pm_off_mode_enable(int);
17 21
18extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm); 22extern int omap3_pm_get_suspend_state(struct powerdomain *pwrdm);
19extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state); 23extern int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state);
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index 90d1dc5884ef..ade2e4a6bb7d 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -25,6 +25,7 @@
25#include <linux/list.h> 25#include <linux/list.h>
26#include <linux/err.h> 26#include <linux/err.h>
27#include <linux/gpio.h> 27#include <linux/gpio.h>
28#include <linux/clk.h>
28 29
29#include <plat/sram.h> 30#include <plat/sram.h>
30#include <plat/clockdomain.h> 31#include <plat/clockdomain.h>
@@ -57,6 +58,9 @@
57#define OMAP343X_TABLE_VALUE_OFFSET 0x30 58#define OMAP343X_TABLE_VALUE_OFFSET 0x30
58#define OMAP343X_CONTROL_REG_VALUE_OFFSET 0x32 59#define OMAP343X_CONTROL_REG_VALUE_OFFSET 0x32
59 60
61u32 enable_off_mode;
62u32 sleep_while_idle;
63
60struct power_state { 64struct power_state {
61 struct powerdomain *pwrdm; 65 struct powerdomain *pwrdm;
62 u32 next_state; 66 u32 next_state;
@@ -456,6 +460,8 @@ static int omap3_fclks_active(void)
456 460
457static int omap3_can_sleep(void) 461static int omap3_can_sleep(void)
458{ 462{
463 if (!sleep_while_idle)
464 return 0;
459 if (!omap_uart_can_sleep()) 465 if (!omap_uart_can_sleep())
460 return 0; 466 return 0;
461 if (omap3_fclks_active()) 467 if (omap3_fclks_active())
@@ -900,6 +906,22 @@ static void __init prcm_setup_regs(void)
900 omap3_d2d_idle(); 906 omap3_d2d_idle();
901} 907}
902 908
909void omap3_pm_off_mode_enable(int enable)
910{
911 struct power_state *pwrst;
912 u32 state;
913
914 if (enable)
915 state = PWRDM_POWER_OFF;
916 else
917 state = PWRDM_POWER_RET;
918
919 list_for_each_entry(pwrst, &pwrst_list, node) {
920 pwrst->next_state = state;
921 set_pwrdm_state(pwrst->pwrdm, state);
922 }
923}
924
903int omap3_pm_get_suspend_state(struct powerdomain *pwrdm) 925int omap3_pm_get_suspend_state(struct powerdomain *pwrdm)
904{ 926{
905 struct power_state *pwrst; 927 struct power_state *pwrst;
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
index a5aecffe03ff..72df1b188135 100644
--- a/arch/arm/mach-omap2/serial.c
+++ b/arch/arm/mach-omap2/serial.c
@@ -155,8 +155,6 @@ static inline void __init omap_uart_reset(struct omap_uart_state *uart)
155 155
156#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3) 156#if defined(CONFIG_PM) && defined(CONFIG_ARCH_OMAP3)
157 157
158static int enable_off_mode; /* to be removed by full off-mode patches */
159
160static void omap_uart_save_context(struct omap_uart_state *uart) 158static void omap_uart_save_context(struct omap_uart_state *uart)
161{ 159{
162 u16 lcr = 0; 160 u16 lcr = 0;