diff options
author | Steven Miao <realmz6@gmail.com> | 2012-05-17 05:29:54 -0400 |
---|---|---|
committer | Bob Liu <lliubbo@gmail.com> | 2012-05-21 02:54:50 -0400 |
commit | 0fbd88ca20a68a633b565e1f5ba18ca64afb0c78 (patch) | |
tree | 0c97e9c20a71ba20750f4e51d8e0e4a07e845ddd /arch/blackfin/mach-bf609 | |
parent | 7c141c1c5c148419eef8972688e86e2e3115ea13 (diff) |
blackfin: bf60x: add wakeup source select
Support select the wakeup source for power management on bf60x.
Signed-off-by: Steven Miao <realmz6@gmail.com>
Signed-off-by: Bob Liu <lliubbo@gmail.com>
Diffstat (limited to 'arch/blackfin/mach-bf609')
-rw-r--r-- | arch/blackfin/mach-bf609/pm.c | 83 |
1 files changed, 62 insertions, 21 deletions
diff --git a/arch/blackfin/mach-bf609/pm.c b/arch/blackfin/mach-bf609/pm.c index bbc5a79b5e22..79cdf41096c2 100644 --- a/arch/blackfin/mach-bf609/pm.c +++ b/arch/blackfin/mach-bf609/pm.c | |||
@@ -212,6 +212,65 @@ void bfin_hibernate(unsigned long mask) | |||
212 | void bf609_cpu_pm_enter(suspend_state_t state) | 212 | void bf609_cpu_pm_enter(suspend_state_t state) |
213 | { | 213 | { |
214 | int error; | 214 | int error; |
215 | unsigned long wakeup = 0; | ||
216 | unsigned long wakeup_pol = 0; | ||
217 | |||
218 | #ifdef CONFIG_PM_BFIN_WAKE_PA15 | ||
219 | wakeup |= PA15WE; | ||
220 | # if CONFIG_PM_BFIN_WAKE_PA15_POL | ||
221 | wakeup_pol |= PA15WE; | ||
222 | # endif | ||
223 | #endif | ||
224 | |||
225 | #ifdef CONFIG_PM_BFIN_WAKE_PB15 | ||
226 | wakeup |= PB15WE; | ||
227 | # if CONFIG_PM_BFIN_WAKE_PA15_POL | ||
228 | wakeup_pol |= PB15WE; | ||
229 | # endif | ||
230 | #endif | ||
231 | |||
232 | #ifdef CONFIG_PM_BFIN_WAKE_PC15 | ||
233 | wakeup |= PC15WE; | ||
234 | # if CONFIG_PM_BFIN_WAKE_PC15_POL | ||
235 | wakeup_pol |= PC15WE; | ||
236 | # endif | ||
237 | #endif | ||
238 | |||
239 | #ifdef CONFIG_PM_BFIN_WAKE_PD06 | ||
240 | wakeup |= PD06WE; | ||
241 | # if CONFIG_PM_BFIN_WAKE_PD06_POL | ||
242 | wakeup_pol |= PD06WE; | ||
243 | # endif | ||
244 | #endif | ||
245 | |||
246 | #ifdef CONFIG_PM_BFIN_WAKE_PE12 | ||
247 | wakeup |= PE12WE; | ||
248 | # if CONFIG_PM_BFIN_WAKE_PE12_POL | ||
249 | wakeup_pol |= PE12WE; | ||
250 | # endif | ||
251 | #endif | ||
252 | |||
253 | #ifdef CONFIG_PM_BFIN_WAKE_PG04 | ||
254 | wakeup |= PG04WE; | ||
255 | # if CONFIG_PM_BFIN_WAKE_PG04_POL | ||
256 | wakeup_pol |= PG04WE; | ||
257 | # endif | ||
258 | #endif | ||
259 | |||
260 | #ifdef CONFIG_PM_BFIN_WAKE_PG13 | ||
261 | wakeup |= PG13WE; | ||
262 | # if CONFIG_PM_BFIN_WAKE_PG13_POL | ||
263 | wakeup_pol |= PG13WE; | ||
264 | # endif | ||
265 | #endif | ||
266 | |||
267 | #ifdef CONFIG_PM_BFIN_WAKE_USB | ||
268 | wakeup |= USBWE; | ||
269 | # if CONFIG_PM_BFIN_WAKE_USB_POL | ||
270 | wakeup_pol |= USBWE; | ||
271 | # endif | ||
272 | #endif | ||
273 | |||
215 | error = irq_set_irq_wake(255, 1); | 274 | error = irq_set_irq_wake(255, 1); |
216 | if(error < 0) | 275 | if(error < 0) |
217 | printk(KERN_DEBUG "Unable to get irq wake\n"); | 276 | printk(KERN_DEBUG "Unable to get irq wake\n"); |
@@ -220,9 +279,9 @@ void bf609_cpu_pm_enter(suspend_state_t state) | |||
220 | printk(KERN_DEBUG "Unable to get irq wake\n"); | 279 | printk(KERN_DEBUG "Unable to get irq wake\n"); |
221 | 280 | ||
222 | if (state == PM_SUSPEND_STANDBY) | 281 | if (state == PM_SUSPEND_STANDBY) |
223 | bfin_deepsleep(0xffff); | 282 | bfin_deepsleep(wakeup); |
224 | else { | 283 | else { |
225 | bfin_hibernate(0xffff); | 284 | bfin_hibernate(wakeup); |
226 | } | 285 | } |
227 | } | 286 | } |
228 | 287 | ||
@@ -263,26 +322,8 @@ static int __init bf609_init_pm(void) | |||
263 | { | 322 | { |
264 | int irq; | 323 | int irq; |
265 | int error; | 324 | int error; |
266 | error = gpio_request(GPIO_PG4, "gpiopg4"); | ||
267 | if (error < 0) { | ||
268 | printk(KERN_DEBUG "failed to request GPIO %d, error %d\n", | ||
269 | GPIO_PG4, error); | ||
270 | } | ||
271 | |||
272 | irq = gpio_to_irq(GPIO_PG4); | ||
273 | if (irq < 0) { | ||
274 | error = irq; | ||
275 | printk(KERN_DEBUG "Unable to get irq number for GPIO %d, error %d\n", | ||
276 | GPIO_PG4, error); | ||
277 | } | ||
278 | |||
279 | printk(KERN_DEBUG "%s gpio %d irq %d\n", __func__, GPIO_PG4, irq); | ||
280 | |||
281 | error = request_irq(irq, test_isr, IRQF_TRIGGER_FALLING | IRQF_NO_SUSPEND, "gpiopg4", NULL); | ||
282 | if(error < 0) | ||
283 | printk(KERN_DEBUG "Unable to get irq\n"); | ||
284 | 325 | ||
285 | #if 1 | 326 | #if CONFIG_PM_BFIN_WAKE_PE12 |
286 | irq = gpio_to_irq(GPIO_PE12); | 327 | irq = gpio_to_irq(GPIO_PE12); |
287 | if (irq < 0) { | 328 | if (irq < 0) { |
288 | error = irq; | 329 | error = irq; |