2 * OMAP3 Power Management Routines
4 * Copyright (C) 2006-2008 Nokia Corporation
5 * Tony Lindgren <tony@atomide.com>
8 * Copyright (C) 2005 Texas Instruments, Inc.
9 * Richard Woodruff <r-woodruff2@ti.com>
11 * Based on pm.c for omap1
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License version 2 as
15 * published by the Free Software Foundation.
19 #include <linux/suspend.h>
20 #include <linux/interrupt.h>
21 #include <linux/module.h>
22 #include <linux/list.h>
23 #include <linux/err.h>
24 #include <linux/gpio.h>
26 #include <mach/sram.h>
27 #include <mach/clockdomain.h>
28 #include <mach/powerdomain.h>
29 #include <mach/control.h>
30 #include <mach/serial.h>
33 #include "cm-regbits-34xx.h"
34 #include "prm-regbits-34xx.h"
40 struct powerdomain
*pwrdm
;
45 struct list_head node
;
48 static LIST_HEAD(pwrst_list
);
50 static void (*_omap_sram_idle
)(u32
*addr
, int save_state
);
52 static struct powerdomain
*mpu_pwrdm
;
55 * PRCM Interrupt Handler Helper Function
57 * The purpose of this function is to clear any wake-up events latched
58 * in the PRCM PM_WKST_x registers. It is possible that a wake-up event
59 * may occur whilst attempting to clear a PM_WKST_x register and thus
60 * set another bit in this register. A while loop is used to ensure
61 * that any peripheral wake-up events occurring while attempting to
62 * clear the PM_WKST_x are detected and cleared.
64 static void prcm_clear_mod_irqs(s16 module
, u8 regs
)
67 u16 wkst_off
= (regs
== 3) ? OMAP3430ES2_PM_WKST3
: PM_WKST1
;
68 u16 fclk_off
= (regs
== 3) ? OMAP3430ES2_CM_FCLKEN3
: CM_FCLKEN1
;
69 u16 iclk_off
= (regs
== 3) ? CM_ICLKEN3
: CM_ICLKEN1
;
70 u16 grpsel_off
= (regs
== 3) ?
71 OMAP3430ES2_PM_MPUGRPSEL3
: OMAP3430_PM_MPUGRPSEL
;
73 wkst
= prm_read_mod_reg(module
, wkst_off
);
74 wkst
&= prm_read_mod_reg(module
, grpsel_off
);
76 iclk
= cm_read_mod_reg(module
, iclk_off
);
77 fclk
= cm_read_mod_reg(module
, fclk_off
);
79 cm_set_mod_reg_bits(wkst
, module
, iclk_off
);
80 cm_set_mod_reg_bits(wkst
, module
, fclk_off
);
81 prm_write_mod_reg(wkst
, module
, wkst_off
);
82 wkst
= prm_read_mod_reg(module
, wkst_off
);
84 cm_write_mod_reg(iclk
, module
, iclk_off
);
85 cm_write_mod_reg(fclk
, module
, fclk_off
);
90 * PRCM Interrupt Handler
92 * The PRM_IRQSTATUS_MPU register indicates if there are any pending
93 * interrupts from the PRCM for the MPU. These bits must be cleared in
94 * order to clear the PRCM interrupt. The PRCM interrupt handler is
95 * implemented to simply clear the PRM_IRQSTATUS_MPU in order to clear
96 * the PRCM interrupt. Please note that bit 0 of the PRM_IRQSTATUS_MPU
97 * register indicates that a wake-up event is pending for the MPU and
98 * this bit can only be cleared if the all the wake-up events latched
99 * in the various PM_WKST_x registers have been cleared. The interrupt
100 * handler is implemented using a do-while loop so that if a wake-up
101 * event occurred during the processing of the prcm interrupt handler
102 * (setting a bit in the corresponding PM_WKST_x register and thus
103 * preventing us from clearing bit 0 of the PRM_IRQSTATUS_MPU register)
104 * this would be handled.
106 static irqreturn_t
prcm_interrupt_handler (int irq
, void *dev_id
)
111 prcm_clear_mod_irqs(WKUP_MOD
, 1);
112 prcm_clear_mod_irqs(CORE_MOD
, 1);
113 prcm_clear_mod_irqs(OMAP3430_PER_MOD
, 1);
114 if (omap_rev() > OMAP3430_REV_ES1_0
) {
115 prcm_clear_mod_irqs(CORE_MOD
, 3);
116 prcm_clear_mod_irqs(OMAP3430ES2_USBHOST_MOD
, 1);
119 irqstatus_mpu
= prm_read_mod_reg(OCP_MOD
,
120 OMAP3_PRM_IRQSTATUS_MPU_OFFSET
);
121 prm_write_mod_reg(irqstatus_mpu
, OCP_MOD
,
122 OMAP3_PRM_IRQSTATUS_MPU_OFFSET
);
124 } while (prm_read_mod_reg(OCP_MOD
, OMAP3_PRM_IRQSTATUS_MPU_OFFSET
));
129 static void omap_sram_idle(void)
131 /* Variable to tell what needs to be saved and restored
132 * in omap_sram_idle*/
133 /* save_state = 0 => Nothing to save and restored */
134 /* save_state = 1 => Only L1 and logic lost */
135 /* save_state = 2 => Only L2 lost */
136 /* save_state = 3 => L1, L2 and logic lost */
137 int save_state
= 0, mpu_next_state
;
139 if (!_omap_sram_idle
)
142 mpu_next_state
= pwrdm_read_next_pwrst(mpu_pwrdm
);
143 switch (mpu_next_state
) {
144 case PWRDM_POWER_RET
:
145 /* No need to save context */
150 printk(KERN_ERR
"Invalid mpu state in sram_idle\n");
153 pwrdm_pre_transition();
155 omap2_gpio_prepare_for_retention();
156 omap_uart_prepare_idle(0);
157 omap_uart_prepare_idle(1);
158 omap_uart_prepare_idle(2);
160 _omap_sram_idle(NULL
, save_state
);
163 omap_uart_resume_idle(2);
164 omap_uart_resume_idle(1);
165 omap_uart_resume_idle(0);
166 omap2_gpio_resume_after_retention();
168 pwrdm_post_transition();
173 * Check if functional clocks are enabled before entering
174 * sleep. This function could be behind CONFIG_PM_DEBUG
175 * when all drivers are configuring their sysconfig registers
176 * properly and using their clocks properly.
178 static int omap3_fclks_active(void)
180 u32 fck_core1
= 0, fck_core3
= 0, fck_sgx
= 0, fck_dss
= 0,
181 fck_cam
= 0, fck_per
= 0, fck_usbhost
= 0;
183 fck_core1
= cm_read_mod_reg(CORE_MOD
,
185 if (omap_rev() > OMAP3430_REV_ES1_0
) {
186 fck_core3
= cm_read_mod_reg(CORE_MOD
,
187 OMAP3430ES2_CM_FCLKEN3
);
188 fck_sgx
= cm_read_mod_reg(OMAP3430ES2_SGX_MOD
,
190 fck_usbhost
= cm_read_mod_reg(OMAP3430ES2_USBHOST_MOD
,
193 fck_sgx
= cm_read_mod_reg(GFX_MOD
,
194 OMAP3430ES2_CM_FCLKEN3
);
195 fck_dss
= cm_read_mod_reg(OMAP3430_DSS_MOD
,
197 fck_cam
= cm_read_mod_reg(OMAP3430_CAM_MOD
,
199 fck_per
= cm_read_mod_reg(OMAP3430_PER_MOD
,
202 /* Ignore UART clocks. These are handled by UART core (serial.c) */
203 fck_core1
&= ~(OMAP3430_EN_UART1
| OMAP3430_EN_UART2
);
204 fck_per
&= ~OMAP3430_EN_UART3
;
206 if (fck_core1
| fck_core3
| fck_sgx
| fck_dss
|
207 fck_cam
| fck_per
| fck_usbhost
)
212 static int omap3_can_sleep(void)
214 if (!omap_uart_can_sleep())
216 if (omap3_fclks_active())
221 /* This sets pwrdm state (other than mpu & core. Currently only ON &
222 * RET are supported. Function is assuming that clkdm doesn't have
223 * hw_sup mode enabled. */
224 static int set_pwrdm_state(struct powerdomain
*pwrdm
, u32 state
)
227 int sleep_switch
= 0;
230 if (pwrdm
== NULL
|| IS_ERR(pwrdm
))
233 while (!(pwrdm
->pwrsts
& (1 << state
))) {
234 if (state
== PWRDM_POWER_OFF
)
239 cur_state
= pwrdm_read_next_pwrst(pwrdm
);
240 if (cur_state
== state
)
243 if (pwrdm_read_pwrst(pwrdm
) < PWRDM_POWER_ON
) {
244 omap2_clkdm_wakeup(pwrdm
->pwrdm_clkdms
[0]);
246 pwrdm_wait_transition(pwrdm
);
249 ret
= pwrdm_set_next_pwrst(pwrdm
, state
);
251 printk(KERN_ERR
"Unable to set state of powerdomain: %s\n",
257 omap2_clkdm_allow_idle(pwrdm
->pwrdm_clkdms
[0]);
258 pwrdm_wait_transition(pwrdm
);
259 pwrdm_state_switch(pwrdm
);
266 static void omap3_pm_idle(void)
271 if (!omap3_can_sleep())
274 if (omap_irq_pending())
284 #ifdef CONFIG_SUSPEND
285 static suspend_state_t suspend_state
;
287 static int omap3_pm_prepare(void)
293 static int omap3_pm_suspend(void)
295 struct power_state
*pwrst
;
298 /* Read current next_pwrsts */
299 list_for_each_entry(pwrst
, &pwrst_list
, node
)
300 pwrst
->saved_state
= pwrdm_read_next_pwrst(pwrst
->pwrdm
);
301 /* Set ones wanted by suspend */
302 list_for_each_entry(pwrst
, &pwrst_list
, node
) {
303 if (set_pwrdm_state(pwrst
->pwrdm
, pwrst
->next_state
))
305 if (pwrdm_clear_all_prev_pwrst(pwrst
->pwrdm
))
309 omap_uart_prepare_suspend();
313 /* Restore next_pwrsts */
314 list_for_each_entry(pwrst
, &pwrst_list
, node
) {
315 state
= pwrdm_read_prev_pwrst(pwrst
->pwrdm
);
316 if (state
> pwrst
->next_state
) {
317 printk(KERN_INFO
"Powerdomain (%s) didn't enter "
319 pwrst
->pwrdm
->name
, pwrst
->next_state
);
322 set_pwrdm_state(pwrst
->pwrdm
, pwrst
->saved_state
);
325 printk(KERN_ERR
"Could not enter target state in pm_suspend\n");
327 printk(KERN_INFO
"Successfully put all powerdomains "
328 "to target state\n");
333 static int omap3_pm_enter(suspend_state_t unused
)
337 switch (suspend_state
) {
338 case PM_SUSPEND_STANDBY
:
340 ret
= omap3_pm_suspend();
349 static void omap3_pm_finish(void)
354 /* Hooks to enable / disable UART interrupts during suspend */
355 static int omap3_pm_begin(suspend_state_t state
)
357 suspend_state
= state
;
358 omap_uart_enable_irqs(0);
362 static void omap3_pm_end(void)
364 suspend_state
= PM_SUSPEND_ON
;
365 omap_uart_enable_irqs(1);
369 static struct platform_suspend_ops omap_pm_ops
= {
370 .begin
= omap3_pm_begin
,
372 .prepare
= omap3_pm_prepare
,
373 .enter
= omap3_pm_enter
,
374 .finish
= omap3_pm_finish
,
375 .valid
= suspend_valid_only_mem
,
377 #endif /* CONFIG_SUSPEND */
381 * omap3_iva_idle(): ensure IVA is in idle so it can be put into
384 * In cases where IVA2 is activated by bootcode, it may prevent
385 * full-chip retention or off-mode because it is not idle. This
386 * function forces the IVA2 into idle state so it can go
387 * into retention/off and thus allow full-chip retention/off.
390 static void __init
omap3_iva_idle(void)
392 /* ensure IVA2 clock is disabled */
393 cm_write_mod_reg(0, OMAP3430_IVA2_MOD
, CM_FCLKEN
);
395 /* if no clock activity, nothing else to do */
396 if (!(cm_read_mod_reg(OMAP3430_IVA2_MOD
, OMAP3430_CM_CLKSTST
) &
397 OMAP3430_CLKACTIVITY_IVA2_MASK
))
401 prm_write_mod_reg(OMAP3430_RST1_IVA2
|
404 OMAP3430_IVA2_MOD
, RM_RSTCTRL
);
406 /* Enable IVA2 clock */
407 cm_write_mod_reg(OMAP3430_CM_FCLKEN_IVA2_EN_IVA2
,
408 OMAP3430_IVA2_MOD
, CM_FCLKEN
);
410 /* Set IVA2 boot mode to 'idle' */
411 omap_ctrl_writel(OMAP3_IVA2_BOOTMOD_IDLE
,
412 OMAP343X_CONTROL_IVA2_BOOTMOD
);
415 prm_write_mod_reg(0, OMAP3430_IVA2_MOD
, RM_RSTCTRL
);
417 /* Disable IVA2 clock */
418 cm_write_mod_reg(0, OMAP3430_IVA2_MOD
, CM_FCLKEN
);
421 prm_write_mod_reg(OMAP3430_RST1_IVA2
|
424 OMAP3430_IVA2_MOD
, RM_RSTCTRL
);
427 static void __init
omap3_d2d_idle(void)
431 /* In a stand alone OMAP3430 where there is not a stacked
432 * modem for the D2D Idle Ack and D2D MStandby must be pulled
433 * high. S CONTROL_PADCONF_SAD2D_IDLEACK and
434 * CONTROL_PADCONF_SAD2D_MSTDBY to have a pull up. */
435 mask
= (1 << 4) | (1 << 3); /* pull-up, enabled */
436 padconf
= omap_ctrl_readw(OMAP3_PADCONF_SAD2D_MSTANDBY
);
438 omap_ctrl_writew(padconf
, OMAP3_PADCONF_SAD2D_MSTANDBY
);
440 padconf
= omap_ctrl_readw(OMAP3_PADCONF_SAD2D_IDLEACK
);
442 omap_ctrl_writew(padconf
, OMAP3_PADCONF_SAD2D_IDLEACK
);
445 prm_write_mod_reg(OMAP3430_RM_RSTCTRL_CORE_MODEM_SW_RSTPWRON
|
446 OMAP3430_RM_RSTCTRL_CORE_MODEM_SW_RST
,
447 CORE_MOD
, RM_RSTCTRL
);
448 prm_write_mod_reg(0, CORE_MOD
, RM_RSTCTRL
);
451 static void __init
prcm_setup_regs(void)
453 /* XXX Reset all wkdeps. This should be done when initializing
455 prm_write_mod_reg(0, OMAP3430_IVA2_MOD
, PM_WKDEP
);
456 prm_write_mod_reg(0, MPU_MOD
, PM_WKDEP
);
457 prm_write_mod_reg(0, OMAP3430_DSS_MOD
, PM_WKDEP
);
458 prm_write_mod_reg(0, OMAP3430_NEON_MOD
, PM_WKDEP
);
459 prm_write_mod_reg(0, OMAP3430_CAM_MOD
, PM_WKDEP
);
460 prm_write_mod_reg(0, OMAP3430_PER_MOD
, PM_WKDEP
);
461 if (omap_rev() > OMAP3430_REV_ES1_0
) {
462 prm_write_mod_reg(0, OMAP3430ES2_SGX_MOD
, PM_WKDEP
);
463 prm_write_mod_reg(0, OMAP3430ES2_USBHOST_MOD
, PM_WKDEP
);
465 prm_write_mod_reg(0, GFX_MOD
, PM_WKDEP
);
468 * Enable interface clock autoidle for all modules.
469 * Note that in the long run this should be done by clockfw
472 OMAP3430_AUTO_MODEM
|
473 OMAP3430ES2_AUTO_MMC3
|
474 OMAP3430ES2_AUTO_ICR
|
476 OMAP3430_AUTO_SHA12
|
480 OMAP3430_AUTO_MSPRO
|
482 OMAP3430_AUTO_MCSPI4
|
483 OMAP3430_AUTO_MCSPI3
|
484 OMAP3430_AUTO_MCSPI2
|
485 OMAP3430_AUTO_MCSPI1
|
489 OMAP3430_AUTO_UART2
|
490 OMAP3430_AUTO_UART1
|
491 OMAP3430_AUTO_GPT11
|
492 OMAP3430_AUTO_GPT10
|
493 OMAP3430_AUTO_MCBSP5
|
494 OMAP3430_AUTO_MCBSP1
|
495 OMAP3430ES1_AUTO_FAC
| /* This is es1 only */
496 OMAP3430_AUTO_MAILBOXES
|
497 OMAP3430_AUTO_OMAPCTRL
|
498 OMAP3430ES1_AUTO_FSHOSTUSB
|
499 OMAP3430_AUTO_HSOTGUSB
|
500 OMAP3430_AUTO_SAD2D
|
502 CORE_MOD
, CM_AUTOIDLE1
);
508 OMAP3430_AUTO_SHA11
|
510 CORE_MOD
, CM_AUTOIDLE2
);
512 if (omap_rev() > OMAP3430_REV_ES1_0
) {
514 OMAP3430_AUTO_MAD2D
|
515 OMAP3430ES2_AUTO_USBTLL
,
516 CORE_MOD
, CM_AUTOIDLE3
);
522 OMAP3430_AUTO_GPIO1
|
523 OMAP3430_AUTO_32KSYNC
|
524 OMAP3430_AUTO_GPT12
|
526 WKUP_MOD
, CM_AUTOIDLE
);
539 OMAP3430_AUTO_GPIO6
|
540 OMAP3430_AUTO_GPIO5
|
541 OMAP3430_AUTO_GPIO4
|
542 OMAP3430_AUTO_GPIO3
|
543 OMAP3430_AUTO_GPIO2
|
545 OMAP3430_AUTO_UART3
|
554 OMAP3430_AUTO_MCBSP4
|
555 OMAP3430_AUTO_MCBSP3
|
556 OMAP3430_AUTO_MCBSP2
,
560 if (omap_rev() > OMAP3430_REV_ES1_0
) {
562 OMAP3430ES2_AUTO_USBHOST
,
563 OMAP3430ES2_USBHOST_MOD
,
568 * Set all plls to autoidle. This is needed until autoidle is
571 cm_write_mod_reg(1 << OMAP3430_AUTO_IVA2_DPLL_SHIFT
,
572 OMAP3430_IVA2_MOD
, CM_AUTOIDLE2
);
573 cm_write_mod_reg(1 << OMAP3430_AUTO_MPU_DPLL_SHIFT
,
576 cm_write_mod_reg((1 << OMAP3430_AUTO_PERIPH_DPLL_SHIFT
) |
577 (1 << OMAP3430_AUTO_CORE_DPLL_SHIFT
),
580 cm_write_mod_reg(1 << OMAP3430ES2_AUTO_PERIPH2_DPLL_SHIFT
,
585 * Enable control of expternal oscillator through
586 * sys_clkreq. In the long run clock framework should
589 prm_rmw_mod_reg_bits(OMAP_AUTOEXTCLKMODE_MASK
,
590 1 << OMAP_AUTOEXTCLKMODE_SHIFT
,
592 OMAP3_PRM_CLKSRC_CTRL_OFFSET
);
594 /* setup wakup source */
595 prm_write_mod_reg(OMAP3430_EN_IO
| OMAP3430_EN_GPIO1
|
596 OMAP3430_EN_GPT1
| OMAP3430_EN_GPT12
,
598 /* No need to write EN_IO, that is always enabled */
599 prm_write_mod_reg(OMAP3430_EN_GPIO1
| OMAP3430_EN_GPT1
|
601 WKUP_MOD
, OMAP3430_PM_MPUGRPSEL
);
602 /* For some reason IO doesn't generate wakeup event even if
603 * it is selected to mpu wakeup goup */
604 prm_write_mod_reg(OMAP3430_IO_EN
| OMAP3430_WKUP_EN
,
605 OCP_MOD
, OMAP3_PRM_IRQENABLE_MPU_OFFSET
);
607 /* Don't attach IVA interrupts */
608 prm_write_mod_reg(0, WKUP_MOD
, OMAP3430_PM_IVAGRPSEL
);
609 prm_write_mod_reg(0, CORE_MOD
, OMAP3430_PM_IVAGRPSEL1
);
610 prm_write_mod_reg(0, CORE_MOD
, OMAP3430ES2_PM_IVAGRPSEL3
);
611 prm_write_mod_reg(0, OMAP3430_PER_MOD
, OMAP3430_PM_IVAGRPSEL
);
613 /* Clear any pending 'reset' flags */
614 prm_write_mod_reg(0xffffffff, MPU_MOD
, RM_RSTST
);
615 prm_write_mod_reg(0xffffffff, CORE_MOD
, RM_RSTST
);
616 prm_write_mod_reg(0xffffffff, OMAP3430_PER_MOD
, RM_RSTST
);
617 prm_write_mod_reg(0xffffffff, OMAP3430_EMU_MOD
, RM_RSTST
);
618 prm_write_mod_reg(0xffffffff, OMAP3430_NEON_MOD
, RM_RSTST
);
619 prm_write_mod_reg(0xffffffff, OMAP3430_DSS_MOD
, RM_RSTST
);
620 prm_write_mod_reg(0xffffffff, OMAP3430ES2_USBHOST_MOD
, RM_RSTST
);
622 /* Clear any pending PRCM interrupts */
623 prm_write_mod_reg(0, OCP_MOD
, OMAP3_PRM_IRQSTATUS_MPU_OFFSET
);
625 /* Don't attach IVA interrupts */
626 prm_write_mod_reg(0, WKUP_MOD
, OMAP3430_PM_IVAGRPSEL
);
627 prm_write_mod_reg(0, CORE_MOD
, OMAP3430_PM_IVAGRPSEL1
);
628 prm_write_mod_reg(0, CORE_MOD
, OMAP3430ES2_PM_IVAGRPSEL3
);
629 prm_write_mod_reg(0, OMAP3430_PER_MOD
, OMAP3430_PM_IVAGRPSEL
);
631 /* Clear any pending 'reset' flags */
632 prm_write_mod_reg(0xffffffff, MPU_MOD
, RM_RSTST
);
633 prm_write_mod_reg(0xffffffff, CORE_MOD
, RM_RSTST
);
634 prm_write_mod_reg(0xffffffff, OMAP3430_PER_MOD
, RM_RSTST
);
635 prm_write_mod_reg(0xffffffff, OMAP3430_EMU_MOD
, RM_RSTST
);
636 prm_write_mod_reg(0xffffffff, OMAP3430_NEON_MOD
, RM_RSTST
);
637 prm_write_mod_reg(0xffffffff, OMAP3430_DSS_MOD
, RM_RSTST
);
638 prm_write_mod_reg(0xffffffff, OMAP3430ES2_USBHOST_MOD
, RM_RSTST
);
640 /* Clear any pending PRCM interrupts */
641 prm_write_mod_reg(0, OCP_MOD
, OMAP3_PRM_IRQSTATUS_MPU_OFFSET
);
647 int omap3_pm_get_suspend_state(struct powerdomain
*pwrdm
)
649 struct power_state
*pwrst
;
651 list_for_each_entry(pwrst
, &pwrst_list
, node
) {
652 if (pwrst
->pwrdm
== pwrdm
)
653 return pwrst
->next_state
;
658 int omap3_pm_set_suspend_state(struct powerdomain
*pwrdm
, int state
)
660 struct power_state
*pwrst
;
662 list_for_each_entry(pwrst
, &pwrst_list
, node
) {
663 if (pwrst
->pwrdm
== pwrdm
) {
664 pwrst
->next_state
= state
;
671 static int __init
pwrdms_setup(struct powerdomain
*pwrdm
, void *unused
)
673 struct power_state
*pwrst
;
678 pwrst
= kmalloc(sizeof(struct power_state
), GFP_ATOMIC
);
681 pwrst
->pwrdm
= pwrdm
;
682 pwrst
->next_state
= PWRDM_POWER_RET
;
683 list_add(&pwrst
->node
, &pwrst_list
);
685 if (pwrdm_has_hdwr_sar(pwrdm
))
686 pwrdm_enable_hdwr_sar(pwrdm
);
688 return set_pwrdm_state(pwrst
->pwrdm
, pwrst
->next_state
);
692 * Enable hw supervised mode for all clockdomains if it's
693 * supported. Initiate sleep transition for other clockdomains, if
696 static int __init
clkdms_setup(struct clockdomain
*clkdm
, void *unused
)
698 if (clkdm
->flags
& CLKDM_CAN_ENABLE_AUTO
)
699 omap2_clkdm_allow_idle(clkdm
);
700 else if (clkdm
->flags
& CLKDM_CAN_FORCE_SLEEP
&&
701 atomic_read(&clkdm
->usecount
) == 0)
702 omap2_clkdm_sleep(clkdm
);
706 static int __init
omap3_pm_init(void)
708 struct power_state
*pwrst
, *tmp
;
711 if (!cpu_is_omap34xx())
714 printk(KERN_ERR
"Power Management for TI OMAP3.\n");
716 /* XXX prcm_setup_regs needs to be before enabling hw
717 * supervised mode for powerdomains */
720 ret
= request_irq(INT_34XX_PRCM_MPU_IRQ
,
721 (irq_handler_t
)prcm_interrupt_handler
,
722 IRQF_DISABLED
, "prcm", NULL
);
724 printk(KERN_ERR
"request_irq failed to register for 0x%x\n",
725 INT_34XX_PRCM_MPU_IRQ
);
729 ret
= pwrdm_for_each(pwrdms_setup
, NULL
);
731 printk(KERN_ERR
"Failed to setup powerdomains\n");
735 (void) clkdm_for_each(clkdms_setup
, NULL
);
737 mpu_pwrdm
= pwrdm_lookup("mpu_pwrdm");
738 if (mpu_pwrdm
== NULL
) {
739 printk(KERN_ERR
"Failed to get mpu_pwrdm\n");
743 _omap_sram_idle
= omap_sram_push(omap34xx_cpu_suspend
,
744 omap34xx_cpu_suspend_sz
);
746 #ifdef CONFIG_SUSPEND
747 suspend_set_ops(&omap_pm_ops
);
748 #endif /* CONFIG_SUSPEND */
750 pm_idle
= omap3_pm_idle
;
755 free_irq(INT_34XX_PRCM_MPU_IRQ
, NULL
);
756 list_for_each_entry_safe(pwrst
, tmp
, &pwrst_list
, node
) {
757 list_del(&pwrst
->node
);
763 late_initcall(omap3_pm_init
);