Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel...
[deliverable/linux.git] / arch / arm / mach-omap2 / pm.c
index f4b3143a8b1d23f104419181c0d266b07e31ad78..dec553349ae2db5d59c3a9cfaf51c0277abeab57 100644 (file)
@@ -32,8 +32,6 @@
 #include "pm.h"
 #include "twl-common.h"
 
-static struct omap_device_pm_latency *pm_lats;
-
 /*
  * omap_pm_suspend: points to a function that does the SoC-specific
  * suspend work
@@ -82,7 +80,7 @@ static int __init _init_omap_device(char *name)
                 __func__, name))
                return -ENODEV;
 
-       pdev = omap_device_build(oh->name, 0, oh, NULL, 0, pm_lats, 0, false);
+       pdev = omap_device_build(oh->name, 0, oh, NULL, 0);
        if (WARN(IS_ERR(pdev), "%s: could not build omap_device for %s\n",
                 __func__, name))
                return -ENODEV;
@@ -108,79 +106,18 @@ static void __init omap2_init_processor_devices(void)
        }
 }
 
-/* Types of sleep_switch used in omap_set_pwrdm_state */
-#define FORCEWAKEUP_SWITCH     0
-#define LOWPOWERSTATE_SWITCH   1
-
 int __init omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused)
 {
+       /* XXX The usecount test is racy */
        if ((clkdm->flags & CLKDM_CAN_ENABLE_AUTO) &&
            !(clkdm->flags & CLKDM_MISSING_IDLE_REPORTING))
                clkdm_allow_idle(clkdm);
        else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
-                atomic_read(&clkdm->usecount) == 0)
+                clkdm->usecount == 0)
                clkdm_sleep(clkdm);
        return 0;
 }
 
-/*
- * This sets pwrdm state (other than mpu & core. Currently only ON &
- * RET are supported.
- */
-int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 pwrst)
-{
-       u8 curr_pwrst, next_pwrst;
-       int sleep_switch = -1, ret = 0, hwsup = 0;
-
-       if (!pwrdm || IS_ERR(pwrdm))
-               return -EINVAL;
-
-       while (!(pwrdm->pwrsts & (1 << pwrst))) {
-               if (pwrst == PWRDM_POWER_OFF)
-                       return ret;
-               pwrst--;
-       }
-
-       next_pwrst = pwrdm_read_next_pwrst(pwrdm);
-       if (next_pwrst == pwrst)
-               return ret;
-
-       curr_pwrst = pwrdm_read_pwrst(pwrdm);
-       if (curr_pwrst < PWRDM_POWER_ON) {
-               if ((curr_pwrst > pwrst) &&
-                       (pwrdm->flags & PWRDM_HAS_LOWPOWERSTATECHANGE)) {
-                       sleep_switch = LOWPOWERSTATE_SWITCH;
-               } else {
-                       hwsup = clkdm_in_hwsup(pwrdm->pwrdm_clkdms[0]);
-                       clkdm_wakeup(pwrdm->pwrdm_clkdms[0]);
-                       sleep_switch = FORCEWAKEUP_SWITCH;
-               }
-       }
-
-       ret = pwrdm_set_next_pwrst(pwrdm, pwrst);
-       if (ret)
-               pr_err("%s: unable to set power state of powerdomain: %s\n",
-                      __func__, pwrdm->name);
-
-       switch (sleep_switch) {
-       case FORCEWAKEUP_SWITCH:
-               if (hwsup)
-                       clkdm_allow_idle(pwrdm->pwrdm_clkdms[0]);
-               else
-                       clkdm_sleep(pwrdm->pwrdm_clkdms[0]);
-               break;
-       case LOWPOWERSTATE_SWITCH:
-               pwrdm_set_lowpwrstchange(pwrdm);
-               pwrdm_wait_transition(pwrdm);
-               pwrdm_state_switch(pwrdm);
-               break;
-       }
-
-       return ret;
-}
-
-
-
 /*
  * This API is to be called during init to set the various voltage
  * domains to the voltage as per the opp table. Typically we boot up
@@ -281,7 +218,7 @@ static int omap_pm_enter(suspend_state_t suspend_state)
 
 static int omap_pm_begin(suspend_state_t state)
 {
-       disable_hlt();
+       cpu_idle_poll_ctrl(true);
        if (cpu_is_omap34xx())
                omap_prcm_irq_prepare();
        return 0;
@@ -289,8 +226,7 @@ static int omap_pm_begin(suspend_state_t state)
 
 static void omap_pm_end(void)
 {
-       enable_hlt();
-       return;
+       cpu_idle_poll_ctrl(false);
 }
 
 static void omap_pm_finish(void)
@@ -336,7 +272,7 @@ static int __init omap2_common_pm_init(void)
 
        return 0;
 }
-postcore_initcall(omap2_common_pm_init);
+omap_postcore_initcall(omap2_common_pm_init);
 
 int __init omap2_common_pm_late_init(void)
 {
@@ -345,19 +281,19 @@ int __init omap2_common_pm_late_init(void)
         * a completely different mechanism.
         * Disable this part if a DT blob is available.
         */
-       if (of_have_populated_dt())
-               return 0;
+       if (!of_have_populated_dt()) {
 
-       /* Init the voltage layer */
-       omap_pmic_late_init();
-       omap_voltage_late_init();
+               /* Init the voltage layer */
+               omap_pmic_late_init();
+               omap_voltage_late_init();
 
-       /* Initialize the voltages */
-       omap3_init_voltages();
-       omap4_init_voltages();
+               /* Initialize the voltages */
+               omap3_init_voltages();
+               omap4_init_voltages();
 
-       /* Smartreflex device init */
-       omap_devinit_smartreflex();
+               /* Smartreflex device init */
+               omap_devinit_smartreflex();
+       }
 
 #ifdef CONFIG_SUSPEND
        suspend_set_ops(&omap_pm_ops);
This page took 0.03217 seconds and 5 git commands to generate.