aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm.c
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@ti.com>2010-09-14 15:34:01 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-09-23 20:14:11 -0400
commiteb6a2c7550560e6619eadb912ea8384ce27964b8 (patch)
treeb8ba9154876a34450d3957828899b53c0543bef1 /arch/arm/mach-omap2/pm.c
parent315e2556f62adb51c40d5422f4134bd3630d8157 (diff)
omap: pm: Move set_pwrdm_state routine to common pm.c
The set_pwrdm_state() is needed on omap4 as well so move this routine to common pm.c file so that it's available for omap3/4 Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-omap2/pm.c')
-rw-r--r--arch/arm/mach-omap2/pm.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index c93921d5cc20..4477d5d7a3b5 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -18,6 +18,9 @@
18#include <plat/omap_device.h> 18#include <plat/omap_device.h>
19#include <plat/common.h> 19#include <plat/common.h>
20 20
21#include <plat/powerdomain.h>
22#include <plat/clockdomain.h>
23
21static struct omap_device_pm_latency *pm_lats; 24static struct omap_device_pm_latency *pm_lats;
22 25
23static struct device *mpu_dev; 26static struct device *mpu_dev;
@@ -83,6 +86,53 @@ static void omap2_init_processor_devices(void)
83 _init_omap_device("l3_main", &l3_dev); 86 _init_omap_device("l3_main", &l3_dev);
84} 87}
85 88
89/*
90 * This sets pwrdm state (other than mpu & core. Currently only ON &
91 * RET are supported. Function is assuming that clkdm doesn't have
92 * hw_sup mode enabled.
93 */
94int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
95{
96 u32 cur_state;
97 int sleep_switch = 0;
98 int ret = 0;
99
100 if (pwrdm == NULL || IS_ERR(pwrdm))
101 return -EINVAL;
102
103 while (!(pwrdm->pwrsts & (1 << state))) {
104 if (state == PWRDM_POWER_OFF)
105 return ret;
106 state--;
107 }
108
109 cur_state = pwrdm_read_next_pwrst(pwrdm);
110 if (cur_state == state)
111 return ret;
112
113 if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
114 omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
115 sleep_switch = 1;
116 pwrdm_wait_transition(pwrdm);
117 }
118
119 ret = pwrdm_set_next_pwrst(pwrdm, state);
120 if (ret) {
121 printk(KERN_ERR "Unable to set state of powerdomain: %s\n",
122 pwrdm->name);
123 goto err;
124 }
125
126 if (sleep_switch) {
127 omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
128 pwrdm_wait_transition(pwrdm);
129 pwrdm_state_switch(pwrdm);
130 }
131
132err:
133 return ret;
134}
135
86static int __init omap2_common_pm_init(void) 136static int __init omap2_common_pm_init(void)
87{ 137{
88 omap2_init_processor_devices(); 138 omap2_init_processor_devices();