diff options
Diffstat (limited to 'arch/arm/mach-omap2/pm34xx.c')
-rw-r--r-- | arch/arm/mach-omap2/pm34xx.c | 40 |
1 files changed, 35 insertions, 5 deletions
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index 488d595d8e4b..0ff5a6c53aa0 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -170,6 +170,8 @@ static void omap_sram_idle(void) | |||
170 | printk(KERN_ERR "Invalid mpu state in sram_idle\n"); | 170 | printk(KERN_ERR "Invalid mpu state in sram_idle\n"); |
171 | return; | 171 | return; |
172 | } | 172 | } |
173 | pwrdm_pre_transition(); | ||
174 | |||
173 | omap2_gpio_prepare_for_retention(); | 175 | omap2_gpio_prepare_for_retention(); |
174 | omap_uart_prepare_idle(0); | 176 | omap_uart_prepare_idle(0); |
175 | omap_uart_prepare_idle(1); | 177 | omap_uart_prepare_idle(1); |
@@ -182,6 +184,9 @@ static void omap_sram_idle(void) | |||
182 | omap_uart_resume_idle(1); | 184 | omap_uart_resume_idle(1); |
183 | omap_uart_resume_idle(0); | 185 | omap_uart_resume_idle(0); |
184 | omap2_gpio_resume_after_retention(); | 186 | omap2_gpio_resume_after_retention(); |
187 | |||
188 | pwrdm_post_transition(); | ||
189 | |||
185 | } | 190 | } |
186 | 191 | ||
187 | /* | 192 | /* |
@@ -271,6 +276,7 @@ static int set_pwrdm_state(struct powerdomain *pwrdm, u32 state) | |||
271 | if (sleep_switch) { | 276 | if (sleep_switch) { |
272 | omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]); | 277 | omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]); |
273 | pwrdm_wait_transition(pwrdm); | 278 | pwrdm_wait_transition(pwrdm); |
279 | pwrdm_state_switch(pwrdm); | ||
274 | } | 280 | } |
275 | 281 | ||
276 | err: | 282 | err: |
@@ -658,14 +664,38 @@ static void __init prcm_setup_regs(void) | |||
658 | omap3_d2d_idle(); | 664 | omap3_d2d_idle(); |
659 | } | 665 | } |
660 | 666 | ||
661 | static int __init pwrdms_setup(struct powerdomain *pwrdm) | 667 | int omap3_pm_get_suspend_state(struct powerdomain *pwrdm) |
668 | { | ||
669 | struct power_state *pwrst; | ||
670 | |||
671 | list_for_each_entry(pwrst, &pwrst_list, node) { | ||
672 | if (pwrst->pwrdm == pwrdm) | ||
673 | return pwrst->next_state; | ||
674 | } | ||
675 | return -EINVAL; | ||
676 | } | ||
677 | |||
678 | int omap3_pm_set_suspend_state(struct powerdomain *pwrdm, int state) | ||
679 | { | ||
680 | struct power_state *pwrst; | ||
681 | |||
682 | list_for_each_entry(pwrst, &pwrst_list, node) { | ||
683 | if (pwrst->pwrdm == pwrdm) { | ||
684 | pwrst->next_state = state; | ||
685 | return 0; | ||
686 | } | ||
687 | } | ||
688 | return -EINVAL; | ||
689 | } | ||
690 | |||
691 | static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) | ||
662 | { | 692 | { |
663 | struct power_state *pwrst; | 693 | struct power_state *pwrst; |
664 | 694 | ||
665 | if (!pwrdm->pwrsts) | 695 | if (!pwrdm->pwrsts) |
666 | return 0; | 696 | return 0; |
667 | 697 | ||
668 | pwrst = kmalloc(sizeof(struct power_state), GFP_KERNEL); | 698 | pwrst = kmalloc(sizeof(struct power_state), GFP_ATOMIC); |
669 | if (!pwrst) | 699 | if (!pwrst) |
670 | return -ENOMEM; | 700 | return -ENOMEM; |
671 | pwrst->pwrdm = pwrdm; | 701 | pwrst->pwrdm = pwrdm; |
@@ -683,7 +713,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm) | |||
683 | * supported. Initiate sleep transition for other clockdomains, if | 713 | * supported. Initiate sleep transition for other clockdomains, if |
684 | * they are not used | 714 | * they are not used |
685 | */ | 715 | */ |
686 | static int __init clkdms_setup(struct clockdomain *clkdm) | 716 | static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) |
687 | { | 717 | { |
688 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) | 718 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) |
689 | omap2_clkdm_allow_idle(clkdm); | 719 | omap2_clkdm_allow_idle(clkdm); |
@@ -716,13 +746,13 @@ static int __init omap3_pm_init(void) | |||
716 | goto err1; | 746 | goto err1; |
717 | } | 747 | } |
718 | 748 | ||
719 | ret = pwrdm_for_each(pwrdms_setup); | 749 | ret = pwrdm_for_each(pwrdms_setup, NULL); |
720 | if (ret) { | 750 | if (ret) { |
721 | printk(KERN_ERR "Failed to setup powerdomains\n"); | 751 | printk(KERN_ERR "Failed to setup powerdomains\n"); |
722 | goto err2; | 752 | goto err2; |
723 | } | 753 | } |
724 | 754 | ||
725 | (void) clkdm_for_each(clkdms_setup); | 755 | (void) clkdm_for_each(clkdms_setup, NULL); |
726 | 756 | ||
727 | mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); | 757 | mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); |
728 | if (mpu_pwrdm == NULL) { | 758 | if (mpu_pwrdm == NULL) { |