aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap1/pm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap1/pm.c')
-rw-r--r--arch/arm/mach-omap1/pm.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/arch/arm/mach-omap1/pm.c b/arch/arm/mach-omap1/pm.c
index 34b4c0044961..dd94567c3628 100644
--- a/arch/arm/mach-omap1/pm.c
+++ b/arch/arm/mach-omap1/pm.c
@@ -71,13 +71,7 @@ static unsigned int mpui7xx_sleep_save[MPUI7XX_SLEEP_SAVE_SIZE];
71static unsigned int mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_SIZE]; 71static unsigned int mpui1510_sleep_save[MPUI1510_SLEEP_SAVE_SIZE];
72static unsigned int mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_SIZE]; 72static unsigned int mpui1610_sleep_save[MPUI1610_SLEEP_SAVE_SIZE];
73 73
74#ifndef CONFIG_OMAP_32K_TIMER 74static unsigned short enable_dyn_sleep;
75
76static unsigned short enable_dyn_sleep = 0;
77
78#else
79
80static unsigned short enable_dyn_sleep = 1;
81 75
82static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr, 76static ssize_t idle_show(struct kobject *kobj, struct kobj_attribute *attr,
83 char *buf) 77 char *buf)
@@ -90,8 +84,9 @@ static ssize_t idle_store(struct kobject *kobj, struct kobj_attribute *attr,
90{ 84{
91 unsigned short value; 85 unsigned short value;
92 if (sscanf(buf, "%hu", &value) != 1 || 86 if (sscanf(buf, "%hu", &value) != 1 ||
93 (value != 0 && value != 1)) { 87 (value != 0 && value != 1) ||
94 printk(KERN_ERR "idle_sleep_store: Invalid value\n"); 88 (value != 0 && !IS_ENABLED(CONFIG_OMAP_32K_TIMER))) {
89 pr_err("idle_sleep_store: Invalid value\n");
95 return -EINVAL; 90 return -EINVAL;
96 } 91 }
97 enable_dyn_sleep = value; 92 enable_dyn_sleep = value;
@@ -101,7 +96,6 @@ static ssize_t idle_store(struct kobject *kobj, struct kobj_attribute *attr,
101static struct kobj_attribute sleep_while_idle_attr = 96static struct kobj_attribute sleep_while_idle_attr =
102 __ATTR(sleep_while_idle, 0644, idle_show, idle_store); 97 __ATTR(sleep_while_idle, 0644, idle_show, idle_store);
103 98
104#endif
105 99
106static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL; 100static void (*omap_sram_suspend)(unsigned long r0, unsigned long r1) = NULL;
107 101
@@ -115,16 +109,11 @@ void omap1_pm_idle(void)
115{ 109{
116 extern __u32 arm_idlect1_mask; 110 extern __u32 arm_idlect1_mask;
117 __u32 use_idlect1 = arm_idlect1_mask; 111 __u32 use_idlect1 = arm_idlect1_mask;
118 int do_sleep = 0;
119 112
120 local_fiq_disable(); 113 local_fiq_disable();
121 114
122#if defined(CONFIG_OMAP_MPU_TIMER) && !defined(CONFIG_OMAP_DM_TIMER) 115#if defined(CONFIG_OMAP_MPU_TIMER) && !defined(CONFIG_OMAP_DM_TIMER)
123#warning Enable 32kHz OS timer in order to allow sleep states in idle
124 use_idlect1 = use_idlect1 & ~(1 << 9); 116 use_idlect1 = use_idlect1 & ~(1 << 9);
125#else
126 if (enable_dyn_sleep)
127 do_sleep = 1;
128#endif 117#endif
129 118
130#ifdef CONFIG_OMAP_DM_TIMER 119#ifdef CONFIG_OMAP_DM_TIMER
@@ -134,10 +123,12 @@ void omap1_pm_idle(void)
134 if (omap_dma_running()) 123 if (omap_dma_running())
135 use_idlect1 &= ~(1 << 6); 124 use_idlect1 &= ~(1 << 6);
136 125
137 /* We should be able to remove the do_sleep variable and multiple 126 /*
127 * We should be able to remove the do_sleep variable and multiple
138 * tests above as soon as drivers, timer and DMA code have been fixed. 128 * tests above as soon as drivers, timer and DMA code have been fixed.
139 * Even the sleep block count should become obsolete. */ 129 * Even the sleep block count should become obsolete.
140 if ((use_idlect1 != ~0) || !do_sleep) { 130 */
131 if ((use_idlect1 != ~0) || !enable_dyn_sleep) {
141 132
142 __u32 saved_idlect1 = omap_readl(ARM_IDLECT1); 133 __u32 saved_idlect1 = omap_readl(ARM_IDLECT1);
143 if (cpu_is_omap15xx()) 134 if (cpu_is_omap15xx())
@@ -635,15 +626,25 @@ static const struct platform_suspend_ops omap_pm_ops = {
635 626
636static int __init omap_pm_init(void) 627static int __init omap_pm_init(void)
637{ 628{
638 629 int error = 0;
639#ifdef CONFIG_OMAP_32K_TIMER
640 int error;
641#endif
642 630
643 if (!cpu_class_is_omap1()) 631 if (!cpu_class_is_omap1())
644 return -ENODEV; 632 return -ENODEV;
645 633
646 printk("Power Management for TI OMAP.\n"); 634 pr_info("Power Management for TI OMAP.\n");
635
636 if (!IS_ENABLED(CONFIG_OMAP_32K_TIMER))
637 pr_info("OMAP1 PM: sleep states in idle disabled due to no 32KiHz timer\n");
638
639 if (!IS_ENABLED(CONFIG_OMAP_DM_TIMER))
640 pr_info("OMAP1 PM: sleep states in idle disabled due to no DMTIMER support\n");
641
642 if (IS_ENABLED(CONFIG_OMAP_32K_TIMER) &&
643 IS_ENABLED(CONFIG_OMAP_DM_TIMER)) {
644 /* OMAP16xx only */
645 pr_info("OMAP1 PM: sleep states in idle enabled\n");
646 enable_dyn_sleep = 1;
647 }
647 648
648 /* 649 /*
649 * We copy the assembler sleep/wakeup routines to SRAM. 650 * We copy the assembler sleep/wakeup routines to SRAM.
@@ -693,17 +694,15 @@ static int __init omap_pm_init(void)
693 omap_pm_init_debugfs(); 694 omap_pm_init_debugfs();
694#endif 695#endif
695 696
696#ifdef CONFIG_OMAP_32K_TIMER
697 error = sysfs_create_file(power_kobj, &sleep_while_idle_attr.attr); 697 error = sysfs_create_file(power_kobj, &sleep_while_idle_attr.attr);
698 if (error) 698 if (error)
699 printk(KERN_ERR "sysfs_create_file failed: %d\n", error); 699 printk(KERN_ERR "sysfs_create_file failed: %d\n", error);
700#endif
701 700
702 if (cpu_is_omap16xx()) { 701 if (cpu_is_omap16xx()) {
703 /* configure LOW_PWR pin */ 702 /* configure LOW_PWR pin */
704 omap_cfg_reg(T20_1610_LOW_PWR); 703 omap_cfg_reg(T20_1610_LOW_PWR);
705 } 704 }
706 705
707 return 0; 706 return error;
708} 707}
709__initcall(omap_pm_init); 708__initcall(omap_pm_init);