Merge tag 'qcom-soc-for-3.16-2' of git://git.kernel.org/pub/scm/linux/kernel/git...
[pandora-kernel.git] / arch / arm / mach-omap2 / pm.c
index e1b4141..828aee9 100644 (file)
 #include "pm.h"
 #include "twl-common.h"
 
+#ifdef CONFIG_SUSPEND
 /*
  * omap_pm_suspend: points to a function that does the SoC-specific
  * suspend work
  */
-int (*omap_pm_suspend)(void);
+static int (*omap_pm_suspend)(void);
+#endif
 
 #ifdef CONFIG_PM
 /**
@@ -243,6 +245,15 @@ static const struct platform_suspend_ops omap_pm_ops = {
        .valid          = suspend_valid_only_mem,
 };
 
+/**
+ * omap_common_suspend_init - Set common suspend routines for OMAP SoCs
+ * @pm_suspend: function pointer to SoC specific suspend function
+ */
+void omap_common_suspend_init(void *pm_suspend)
+{
+       omap_pm_suspend = pm_suspend;
+       suspend_set_ops(&omap_pm_ops);
+}
 #endif /* CONFIG_SUSPEND */
 
 static void __init omap3_init_voltages(void)
@@ -287,32 +298,24 @@ omap_postcore_initcall(omap2_common_pm_init);
 
 int __init omap2_common_pm_late_init(void)
 {
-       /*
-        * In the case of DT, the PMIC and SR initialization will be done using
-        * a completely different mechanism.
-        * Disable this part if a DT blob is available.
-        */
-       if (!of_have_populated_dt()) {
-
-               /* Init the voltage layer */
-               omap_pmic_late_init();
-               omap_voltage_late_init();
+       if (of_have_populated_dt()) {
+               omap3_twl_init();
+               omap4_twl_init();
+       }
 
-               /* Initialize the voltages */
-               omap3_init_voltages();
-               omap4_init_voltages();
+       /* Init the voltage layer */
+       omap_pmic_late_init();
+       omap_voltage_late_init();
 
-               /* Smartreflex device init */
-               omap_devinit_smartreflex();
+       /* Initialize the voltages */
+       omap3_init_voltages();
+       omap4_init_voltages();
 
-       }
+       /* Smartreflex device init */
+       omap_devinit_smartreflex();
 
        /* cpufreq dummy device instantiation */
        omap_init_cpufreq();
 
-#ifdef CONFIG_SUSPEND
-       suspend_set_ops(&omap_pm_ops);
-#endif
-
        return 0;
 }