diff options
Diffstat (limited to 'arch/arm/mach-omap2/pm.c')
-rw-r--r-- | arch/arm/mach-omap2/pm.c | 69 |
1 files changed, 3 insertions, 66 deletions
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c index 9c65eddd97cc..cd6682df5625 100644 --- a/arch/arm/mach-omap2/pm.c +++ b/arch/arm/mach-omap2/pm.c | |||
@@ -32,8 +32,6 @@ | |||
32 | #include "pm.h" | 32 | #include "pm.h" |
33 | #include "twl-common.h" | 33 | #include "twl-common.h" |
34 | 34 | ||
35 | static struct omap_device_pm_latency *pm_lats; | ||
36 | |||
37 | /* | 35 | /* |
38 | * omap_pm_suspend: points to a function that does the SoC-specific | 36 | * omap_pm_suspend: points to a function that does the SoC-specific |
39 | * suspend work | 37 | * suspend work |
@@ -82,7 +80,7 @@ static int __init _init_omap_device(char *name) | |||
82 | __func__, name)) | 80 | __func__, name)) |
83 | return -ENODEV; | 81 | return -ENODEV; |
84 | 82 | ||
85 | pdev = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false); | 83 | pdev = omap_device_build(oh->name, 0, oh, NULL, 0); |
86 | if (WARN(IS_ERR(pdev), "%s: could not build omap_device for %s\n", | 84 | if (WARN(IS_ERR(pdev), "%s: could not build omap_device for %s\n", |
87 | __func__, name)) | 85 | __func__, name)) |
88 | return -ENODEV; | 86 | return -ENODEV; |
@@ -108,80 +106,19 @@ static void __init omap2_init_processor_devices(void) | |||
108 | } | 106 | } |
109 | } | 107 | } |
110 | 108 | ||
111 | /* Types of sleep_switch used in omap_set_pwrdm_state */ | ||
112 | #define FORCEWAKEUP_SWITCH 0 | ||
113 | #define LOWPOWERSTATE_SWITCH 1 | ||
114 | |||
115 | int __init omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused) | 109 | int __init omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused) |
116 | { | 110 | { |
111 | /* XXX The usecount test is racy */ | ||
117 | if ((clkdm->flags & CLKDM_CAN_ENABLE_AUTO) && | 112 | if ((clkdm->flags & CLKDM_CAN_ENABLE_AUTO) && |
118 | !(clkdm->flags & CLKDM_MISSING_IDLE_REPORTING)) | 113 | !(clkdm->flags & CLKDM_MISSING_IDLE_REPORTING)) |
119 | clkdm_allow_idle(clkdm); | 114 | clkdm_allow_idle(clkdm); |
120 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && | 115 | else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP && |
121 | atomic_read(&clkdm->usecount) == 0) | 116 | clkdm->usecount == 0) |
122 | clkdm_sleep(clkdm); | 117 | clkdm_sleep(clkdm); |
123 | return 0; | 118 | return 0; |
124 | } | 119 | } |
125 | 120 | ||
126 | /* | 121 | /* |
127 | * This sets pwrdm state (other than mpu & core. Currently only ON & | ||
128 | * RET are supported. | ||
129 | */ | ||
130 | int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 pwrst) | ||
131 | { | ||
132 | u8 curr_pwrst, next_pwrst; | ||
133 | int sleep_switch = -1, ret = 0, hwsup = 0; | ||
134 | |||
135 | if (!pwrdm || IS_ERR(pwrdm)) | ||
136 | return -EINVAL; | ||
137 | |||
138 | while (!(pwrdm->pwrsts & (1 << pwrst))) { | ||
139 | if (pwrst == PWRDM_POWER_OFF) | ||
140 | return ret; | ||
141 | pwrst--; | ||
142 | } | ||
143 | |||
144 | next_pwrst = pwrdm_read_next_pwrst(pwrdm); | ||
145 | if (next_pwrst == pwrst) | ||
146 | return ret; | ||
147 | |||
148 | curr_pwrst = pwrdm_read_pwrst(pwrdm); | ||
149 | if (curr_pwrst < PWRDM_POWER_ON) { | ||
150 | if ((curr_pwrst > pwrst) && | ||
151 | (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) { | ||
152 | sleep_switch = LOWPOWERSTATE_SWITCH; | ||
153 | } else { | ||
154 | hwsup = clkdm_in_hwsup(pwrdm->pwrdm_clkdms[0]); | ||
155 | clkdm_wakeup(pwrdm->pwrdm_clkdms[0]); | ||
156 | sleep_switch = FORCEWAKEUP_SWITCH; | ||
157 | } | ||
158 | } | ||
159 | |||
160 | ret = pwrdm_set_next_pwrst(pwrdm, pwrst); | ||
161 | if (ret) | ||
162 | pr_err("%s: unable to set power state of powerdomain: %s\n", | ||
163 | __func__, pwrdm->name); | ||
164 | |||
165 | switch (sleep_switch) { | ||
166 | case FORCEWAKEUP_SWITCH: | ||
167 | if (hwsup) | ||
168 | clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]); | ||
169 | else | ||
170 | clkdm_sleep(pwrdm->pwrdm_clkdms[0]); | ||
171 | break; | ||
172 | case LOWPOWERSTATE_SWITCH: | ||
173 | pwrdm_set_lowpwrstchange(pwrdm); | ||
174 | pwrdm_wait_transition(pwrdm); | ||
175 | pwrdm_state_switch(pwrdm); | ||
176 | break; | ||
177 | } | ||
178 | |||
179 | return ret; | ||
180 | } | ||
181 | |||
182 | |||
183 | |||
184 | /* | ||
185 | * This API is to be called during init to set the various voltage | 122 | * This API is to be called during init to set the various voltage |
186 | * domains to the voltage as per the opp table. Typically we boot up | 123 | * domains to the voltage as per the opp table. Typically we boot up |
187 | * at the nominal voltage. So this function finds out the rate of | 124 | * at the nominal voltage. So this function finds out the rate of |