]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
ARM: OMAP2+: Remove suspend_set_ops from common pm late init
authorDave Gerlach <d-gerlach@ti.com>
Mon, 12 May 2014 18:33:21 +0000 (13:33 -0500)
committerTony Lindgren <tony@atomide.com>
Mon, 19 May 2014 22:31:54 +0000 (15:31 -0700)
In omap2_common_pm_late_init suspend_set_ops was called to set common
suspend handling functions for all omap platforms. This created two
problems. First, these suspend ops were being set for all platforms,
regardless of whether or not suspend support has been integrated so in
the case of AM33XX, suspend to mem was presented as available but
failed every time. Second, some platforms will need to define a
completely separate set of suspend ops, such as AM33XX, due to
differences from previous omap platforms so there is no need to
always set the common omap ops.

This patch moves the suspend_set_ops call from omap2_common_pm_late_init
into a separate function that then gets called in the omap*_pm_init
functions for each platform.

Signed-off-by: Dave Gerlach <d-gerlach@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
arch/arm/mach-omap2/pm.c
arch/arm/mach-omap2/pm.h
arch/arm/mach-omap2/pm24xx.c
arch/arm/mach-omap2/pm34xx.c
arch/arm/mach-omap2/pm44xx.c

index e1b41416fbf1e711cb0653f403144d2665676af0..dd31212d5e20879bc46f783532343af786b0844a 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)
@@ -310,9 +321,5 @@ int __init omap2_common_pm_late_init(void)
        /* cpufreq dummy device instantiation */
        omap_init_cpufreq();
 
-#ifdef CONFIG_SUSPEND
-       suspend_set_ops(&omap_pm_ops);
-#endif
-
        return 0;
 }
index d4d0fce325c7f88ffa594c4d76ce8e69efd77816..e150102d6c06be0d13f8110ced831ce5338e6a24 100644 (file)
@@ -34,7 +34,6 @@ extern void *omap3_secure_ram_storage;
 extern void omap3_pm_off_mode_enable(int);
 extern void omap_sram_idle(void);
 extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused);
-extern int (*omap_pm_suspend)(void);
 
 #if defined(CONFIG_PM_OPP)
 extern int omap3_opp_init(void);
@@ -147,4 +146,11 @@ static inline void omap_pm_get_oscillator(u32 *tstart, u32 *tshut) { *tstart = *
 static inline void omap_pm_setup_sr_i2c_pcb_length(u32 mm) { }
 #endif
 
+#ifdef CONFIG_SUSPEND
+void omap_common_suspend_init(void *pm_suspend);
+#else
+static inline void omap_common_suspend_init(void *pm_suspend)
+{
+}
+#endif /* CONFIG_SUSPEND */
 #endif
index 8c0759496c8d955c307cff12c5b208e5667c8f13..a5ea988ff340a217481289a1e9626949a7c9d2fd 100644 (file)
@@ -229,9 +229,7 @@ static void __init prcm_setup_regs(void)
        clkdm_for_each(omap_pm_clkdms_setup, NULL);
        clkdm_add_wkdep(mpu_clkdm, wkup_clkdm);
 
-#ifdef CONFIG_SUSPEND
-       omap_pm_suspend = omap2_enter_full_retention;
-#endif
+       omap_common_suspend_init(omap2_enter_full_retention);
 
        /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk
         * stabilisation */
index 87099bb6de692771ce7d26a720f0bec5836d6beb..90ea2d3ab4052f0ea6da33fb28891e7d94e27a8e 100644 (file)
@@ -391,7 +391,8 @@ restore:
 
        return ret;
 }
-
+#else
+#define omap3_pm_suspend NULL
 #endif /* CONFIG_SUSPEND */
 
 
@@ -705,9 +706,7 @@ int __init omap3_pm_init(void)
        per_clkdm = clkdm_lookup("per_clkdm");
        wkup_clkdm = clkdm_lookup("wkup_clkdm");
 
-#ifdef CONFIG_SUSPEND
-       omap_pm_suspend = omap3_pm_suspend;
-#endif
+       omap_common_suspend_init(omap3_pm_suspend);
 
        arm_pm_idle = omap3_pm_idle;
        omap3_idle_init();
index eefb30cfcabdae50892872b335d6c47f06f50571..0dda6cf8b85560b72c540fc2d1f39e1e161f7217 100644 (file)
@@ -96,6 +96,8 @@ static int omap4_pm_suspend(void)
 
        return 0;
 }
+#else
+#define omap4_pm_suspend NULL
 #endif /* CONFIG_SUSPEND */
 
 static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
@@ -251,9 +253,7 @@ int __init omap4_pm_init(void)
 
        (void) clkdm_for_each(omap_pm_clkdms_setup, NULL);
 
-#ifdef CONFIG_SUSPEND
-       omap_pm_suspend = omap4_pm_suspend;
-#endif
+       omap_common_suspend_init(omap4_pm_suspend);
 
        /* Overwrite the default cpu_do_idle() */
        arm_pm_idle = omap_default_idle;