2 * linux/arch/arm/mach-omap2/pm.c
4 * OMAP2 Power Management Routines
6 * Copyright (C) 2006 Nokia Corporation
7 * Tony Lindgren <tony@atomide.com>
9 * Copyright (C) 2005 Texas Instruments, Inc.
10 * Richard Woodruff <r-woodruff2@ti.com>
12 * Based on pm.c for omap1
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation.
20 #include <linux/sched.h>
21 #include <linux/proc_fs.h>
23 #include <linux/interrupt.h>
24 #include <linux/sysfs.h>
25 #include <linux/module.h>
29 #include <asm/atomic.h>
30 #include <asm/mach/time.h>
31 #include <asm/mach/irq.h>
32 #include <asm/mach-types.h>
34 #include <asm/arch/irqs.h>
35 #include <asm/arch/clock.h>
36 #include <asm/arch/sram.h>
37 #include <asm/arch/pm.h>
39 static struct clk *vclk;
40 static void (*omap2_sram_idle)(void);
41 static void (*omap2_sram_suspend)(int dllctrl, int cpu_rev);
42 static void (*saved_idle)(void);
44 void omap2_pm_idle(void)
55 * Since an interrupt may set up a timer, we don't want to
56 * reprogram the hardware timer with interrupts enabled.
57 * Re-enable interrupts only after returning from idle.
59 timer_dyn_reprogram();
66 static int omap2_pm_prepare(suspend_state_t state)
70 /* We cannot sleep in idle until we have resumed */
76 case PM_SUSPEND_STANDBY:
90 static int omap2_pm_enter(suspend_state_t state)
94 case PM_SUSPEND_STANDBY:
96 /* FIXME: Add suspend */
109 static int omap2_pm_finish(suspend_state_t state)
111 pm_idle = saved_idle;
115 static struct pm_ops omap_pm_ops = {
117 .prepare = omap2_pm_prepare,
118 .enter = omap2_pm_enter,
119 .finish = omap2_pm_finish,
122 int __init omap2_pm_init(void)
124 printk("Power Management for TI OMAP.\n");
126 vclk = clk_get(NULL, "virt_prcm_set");
128 printk(KERN_ERR "Could not get PM vclk\n");
133 * We copy the assembler sleep/wakeup routines to SRAM.
134 * These routines need to be in SRAM as that's the only
135 * memory the MPU can see when it wakes up.
137 omap2_sram_idle = omap_sram_push(omap24xx_idle_loop_suspend,
138 omap24xx_idle_loop_suspend_sz);
140 omap2_sram_suspend = omap_sram_push(omap24xx_cpu_suspend,
141 omap24xx_cpu_suspend_sz);
143 pm_set_ops(&omap_pm_ops);
144 pm_idle = omap2_pm_idle;
149 __initcall(omap2_pm_init);