aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/pm34xx.c
diff options
context:
space:
mode:
authorSantosh Shilimkar <santosh.shilimkar@ti.com>2010-09-14 15:34:01 -0400
committerKevin Hilman <khilman@deeprootsystems.com>2010-09-23 20:14:11 -0400
commiteb6a2c7550560e6619eadb912ea8384ce27964b8 (patch)
treeb8ba9154876a34450d3957828899b53c0543bef1 /arch/arm/mach-omap2/pm34xx.c
parent315e2556f62adb51c40d5422f4134bd3630d8157 (diff)
omap: pm: Move set_pwrdm_state routine to common pm.c
The set_pwrdm_state() is needed on omap4 as well so move this routine to common pm.c file so that it's available for omap3/4 Signed-off-by: Rajendra Nayak <rnayak@ti.com> Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch/arm/mach-omap2/pm34xx.c')
-rw-r--r--arch/arm/mach-omap2/pm34xx.c53
1 files changed, 4 insertions, 49 deletions
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c
index bc24fbd2e983..f5f1dbd3c17a 100644
--- a/arch/arm/mach-omap2/pm34xx.c
+++ b/arch/arm/mach-omap2/pm34xx.c
@@ -483,51 +483,6 @@ int omap3_can_sleep(void)
483 return 1; 483 return 1;
484} 484}
485 485
486/* This sets pwrdm state (other than mpu & core. Currently only ON &
487 * RET are supported. Function is assuming that clkdm doesn't have
488 * hw_sup mode enabled. */
489int set_pwrdm_state(struct powerdomain *pwrdm, u32 state)
490{
491 u32 cur_state;
492 int sleep_switch = 0;
493 int ret = 0;
494
495 if (pwrdm == NULL || IS_ERR(pwrdm))
496 return -EINVAL;
497
498 while (!(pwrdm->pwrsts & (1 << state))) {
499 if (state == PWRDM_POWER_OFF)
500 return ret;
501 state--;
502 }
503
504 cur_state = pwrdm_read_next_pwrst(pwrdm);
505 if (cur_state == state)
506 return ret;
507
508 if (pwrdm_read_pwrst(pwrdm) < PWRDM_POWER_ON) {
509 omap2_clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
510 sleep_switch = 1;
511 pwrdm_wait_transition(pwrdm);
512 }
513
514 ret = pwrdm_set_next_pwrst(pwrdm, state);
515 if (ret) {
516 printk(KERN_ERR "Unable to set state of powerdomain: %s\n",
517 pwrdm->name);
518 goto err;
519 }
520
521 if (sleep_switch) {
522 omap2_clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
523 pwrdm_wait_transition(pwrdm);
524 pwrdm_state_switch(pwrdm);
525 }
526
527err:
528 return ret;
529}
530
531static void omap3_pm_idle(void) 486static void omap3_pm_idle(void)
532{ 487{
533 local_irq_disable(); 488 local_irq_disable();
@@ -569,7 +524,7 @@ static int omap3_pm_suspend(void)
569 pwrst->saved_state = pwrdm_read_next_pwrst(pwrst->pwrdm); 524 pwrst->saved_state = pwrdm_read_next_pwrst(pwrst->pwrdm);
570 /* Set ones wanted by suspend */ 525 /* Set ones wanted by suspend */
571 list_for_each_entry(pwrst, &pwrst_list, node) { 526 list_for_each_entry(pwrst, &pwrst_list, node) {
572 if (set_pwrdm_state(pwrst->pwrdm, pwrst->next_state)) 527 if (omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state))
573 goto restore; 528 goto restore;
574 if (pwrdm_clear_all_prev_pwrst(pwrst->pwrdm)) 529 if (pwrdm_clear_all_prev_pwrst(pwrst->pwrdm))
575 goto restore; 530 goto restore;
@@ -590,7 +545,7 @@ restore:
590 pwrst->pwrdm->name, pwrst->next_state); 545 pwrst->pwrdm->name, pwrst->next_state);
591 ret = -1; 546 ret = -1;
592 } 547 }
593 set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state); 548 omap_set_pwrdm_state(pwrst->pwrdm, pwrst->saved_state);
594 } 549 }
595 if (ret) 550 if (ret)
596 printk(KERN_ERR "Could not enter target state in pm_suspend\n"); 551 printk(KERN_ERR "Could not enter target state in pm_suspend\n");
@@ -939,7 +894,7 @@ void omap3_pm_off_mode_enable(int enable)
939 894
940 list_for_each_entry(pwrst, &pwrst_list, node) { 895 list_for_each_entry(pwrst, &pwrst_list, node) {
941 pwrst->next_state = state; 896 pwrst->next_state = state;
942 set_pwrdm_state(pwrst->pwrdm, state); 897 omap_set_pwrdm_state(pwrst->pwrdm, state);
943 } 898 }
944} 899}
945 900
@@ -984,7 +939,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
984 if (pwrdm_has_hdwr_sar(pwrdm)) 939 if (pwrdm_has_hdwr_sar(pwrdm))
985 pwrdm_enable_hdwr_sar(pwrdm); 940 pwrdm_enable_hdwr_sar(pwrdm);
986 941
987 return set_pwrdm_state(pwrst->pwrdm, pwrst->next_state); 942 return omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
988} 943}
989 944
990/* 945/*