diff options
Diffstat (limited to 'arch/arm/mach-omap2/pm24xx.c')
-rw-r--r-- | arch/arm/mach-omap2/pm24xx.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index c85923e56b85..aaeea49b9bdd 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -53,6 +53,19 @@ | |||
53 | #include <plat/powerdomain.h> | 53 | #include <plat/powerdomain.h> |
54 | #include <plat/clockdomain.h> | 54 | #include <plat/clockdomain.h> |
55 | 55 | ||
56 | #ifdef CONFIG_SUSPEND | ||
57 | static suspend_state_t suspend_state = PM_SUSPEND_ON; | ||
58 | static inline bool is_suspending(void) | ||
59 | { | ||
60 | return (suspend_state != PM_SUSPEND_ON); | ||
61 | } | ||
62 | #else | ||
63 | static inline bool is_suspending(void) | ||
64 | { | ||
65 | return false; | ||
66 | } | ||
67 | #endif | ||
68 | |||
56 | static void (*omap2_sram_idle)(void); | 69 | static void (*omap2_sram_idle)(void); |
57 | static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl, | 70 | static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl, |
58 | void __iomem *sdrc_power); | 71 | void __iomem *sdrc_power); |
@@ -120,8 +133,9 @@ static void omap2_enter_full_retention(void) | |||
120 | goto no_sleep; | 133 | goto no_sleep; |
121 | 134 | ||
122 | /* Block console output in case it is on one of the OMAP UARTs */ | 135 | /* Block console output in case it is on one of the OMAP UARTs */ |
123 | if (try_acquire_console_sem()) | 136 | if (!is_suspending()) |
124 | goto no_sleep; | 137 | if (try_acquire_console_sem()) |
138 | goto no_sleep; | ||
125 | 139 | ||
126 | omap_uart_prepare_idle(0); | 140 | omap_uart_prepare_idle(0); |
127 | omap_uart_prepare_idle(1); | 141 | omap_uart_prepare_idle(1); |
@@ -136,7 +150,8 @@ static void omap2_enter_full_retention(void) | |||
136 | omap_uart_resume_idle(1); | 150 | omap_uart_resume_idle(1); |
137 | omap_uart_resume_idle(0); | 151 | omap_uart_resume_idle(0); |
138 | 152 | ||
139 | release_console_sem(); | 153 | if (!is_suspending()) |
154 | release_console_sem(); | ||
140 | 155 | ||
141 | no_sleep: | 156 | no_sleep: |
142 | if (omap2_pm_debug) { | 157 | if (omap2_pm_debug) { |
@@ -284,6 +299,12 @@ out: | |||
284 | local_irq_enable(); | 299 | local_irq_enable(); |
285 | } | 300 | } |
286 | 301 | ||
302 | static int omap2_pm_begin(suspend_state_t state) | ||
303 | { | ||
304 | suspend_state = state; | ||
305 | return 0; | ||
306 | } | ||
307 | |||
287 | static int omap2_pm_prepare(void) | 308 | static int omap2_pm_prepare(void) |
288 | { | 309 | { |
289 | /* We cannot sleep in idle until we have resumed */ | 310 | /* We cannot sleep in idle until we have resumed */ |
@@ -333,10 +354,17 @@ static void omap2_pm_finish(void) | |||
333 | enable_hlt(); | 354 | enable_hlt(); |
334 | } | 355 | } |
335 | 356 | ||
357 | static void omap2_pm_end(void) | ||
358 | { | ||
359 | suspend_state = PM_SUSPEND_ON; | ||
360 | } | ||
361 | |||
336 | static struct platform_suspend_ops omap_pm_ops = { | 362 | static struct platform_suspend_ops omap_pm_ops = { |
363 | .begin = omap2_pm_begin, | ||
337 | .prepare = omap2_pm_prepare, | 364 | .prepare = omap2_pm_prepare, |
338 | .enter = omap2_pm_enter, | 365 | .enter = omap2_pm_enter, |
339 | .finish = omap2_pm_finish, | 366 | .finish = omap2_pm_finish, |
367 | .end = omap2_pm_end, | ||
340 | .valid = suspend_valid_only_mem, | 368 | .valid = suspend_valid_only_mem, |
341 | }; | 369 | }; |
342 | 370 | ||