aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm24xx.c
diff options
context:
space:
mode:
authorPaul Walmsley <paul@pwsan.com>2012-02-02 04:30:50 -0500
committerKevin Hilman <khilman@ti.com>2012-03-05 19:01:19 -0500
commit1416408d31236dc2a80d269aa23ffa93aa01e833 (patch)
treefb77d8bad2e21597ed5d0b34fdd040044999e2c2 /arch/arm/mach-omap2/pm24xx.c
parentb7c39a3f59ae55aa49ebf670e9329bc7da6d3c65 (diff)
ARM: OMAP2+: PM: share some suspend-related functions across OMAP2, 3, 4
The platform_suspend_ops can be shared across OMAP2, 3, and 4, along with all of the functions referenced in that structure. This patch shares them. It also removes the suspend_state file-scoped variable in the OMAP2 and 3 PM code; it does not appear to be actually needed by anything. Signed-off-by: Paul Walmsley <paul@pwsan.com> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com> Cc: Rajendra Nayak <rnayak@ti.com> Reviewed-by: Kevin Hilman <khilman@ti.com> [khilman@ti.com: minor rework needed due to rebase/merge with conflicting changes] Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/pm24xx.c')
-rw-r--r--arch/arm/mach-omap2/pm24xx.c62
1 files changed, 7 insertions, 55 deletions
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c
index c4fdde477421..5ca45ca76946 100644
--- a/arch/arm/mach-omap2/pm24xx.c
+++ b/arch/arm/mach-omap2/pm24xx.c
@@ -52,19 +52,6 @@
52#include "powerdomain.h" 52#include "powerdomain.h"
53#include "clockdomain.h" 53#include "clockdomain.h"
54 54
55#ifdef CONFIG_SUSPEND
56static suspend_state_t suspend_state = PM_SUSPEND_ON;
57static inline bool is_suspending(void)
58{
59 return (suspend_state != PM_SUSPEND_ON);
60}
61#else
62static inline bool is_suspending(void)
63{
64 return false;
65}
66#endif
67
68static void (*omap2_sram_idle)(void); 55static void (*omap2_sram_idle)(void);
69static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl, 56static void (*omap2_sram_suspend)(u32 dllctrl, void __iomem *sdrc_dlla_ctrl,
70 void __iomem *sdrc_power); 57 void __iomem *sdrc_power);
@@ -84,7 +71,7 @@ static int omap2_fclks_active(void)
84 return (f1 | f2) ? 1 : 0; 71 return (f1 | f2) ? 1 : 0;
85} 72}
86 73
87static void omap2_enter_full_retention(void) 74static int omap2_enter_full_retention(void)
88{ 75{
89 u32 l; 76 u32 l;
90 77
@@ -147,6 +134,8 @@ no_sleep:
147 134
148 /* Mask future PRCM-to-MPU interrupts */ 135 /* Mask future PRCM-to-MPU interrupts */
149 omap2_prm_write_mod_reg(0x0, OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET); 136 omap2_prm_write_mod_reg(0x0, OCP_MOD, OMAP2_PRCM_IRQSTATUS_MPU_OFFSET);
137
138 return 0;
150} 139}
151 140
152static int omap2_i2c_active(void) 141static int omap2_i2c_active(void)
@@ -243,46 +232,6 @@ out:
243 local_fiq_enable(); 232 local_fiq_enable();
244} 233}
245 234
246#ifdef CONFIG_SUSPEND
247static int omap2_pm_begin(suspend_state_t state)
248{
249 disable_hlt();
250 suspend_state = state;
251 return 0;
252}
253
254static int omap2_pm_enter(suspend_state_t state)
255{
256 int ret = 0;
257
258 switch (state) {
259 case PM_SUSPEND_STANDBY:
260 case PM_SUSPEND_MEM:
261 omap2_enter_full_retention();
262 break;
263 default:
264 ret = -EINVAL;
265 }
266
267 return ret;
268}
269
270static void omap2_pm_end(void)
271{
272 suspend_state = PM_SUSPEND_ON;
273 enable_hlt();
274}
275
276static const struct platform_suspend_ops omap_pm_ops = {
277 .begin = omap2_pm_begin,
278 .enter = omap2_pm_enter,
279 .end = omap2_pm_end,
280 .valid = suspend_valid_only_mem,
281};
282#else
283static const struct platform_suspend_ops __initdata omap_pm_ops;
284#endif /* CONFIG_SUSPEND */
285
286static void __init prcm_setup_regs(void) 235static void __init prcm_setup_regs(void)
287{ 236{
288 int i, num_mem_banks; 237 int i, num_mem_banks;
@@ -327,6 +276,10 @@ static void __init prcm_setup_regs(void)
327 clkdm_for_each(omap_pm_clkdms_setup, NULL); 276 clkdm_for_each(omap_pm_clkdms_setup, NULL);
328 clkdm_add_wkdep(mpu_clkdm, wkup_clkdm); 277 clkdm_add_wkdep(mpu_clkdm, wkup_clkdm);
329 278
279#ifdef CONFIG_SUSPEND
280 omap_pm_suspend = omap2_enter_full_retention;
281#endif
282
330 /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk 283 /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk
331 * stabilisation */ 284 * stabilisation */
332 omap2_prm_write_mod_reg(15 << OMAP_SETUP_TIME_SHIFT, OMAP24XX_GR_MOD, 285 omap2_prm_write_mod_reg(15 << OMAP_SETUP_TIME_SHIFT, OMAP24XX_GR_MOD,
@@ -427,7 +380,6 @@ static int __init omap2_pm_init(void)
427 omap24xx_cpu_suspend_sz); 380 omap24xx_cpu_suspend_sz);
428 } 381 }
429 382
430 suspend_set_ops(&omap_pm_ops);
431 arm_pm_idle = omap2_pm_idle; 383 arm_pm_idle = omap2_pm_idle;
432 384
433 return 0; 385 return 0;