ARM: OMAP2+: PM: share clkdms_setup() across OMAP2, 3, 4
authorPaul Walmsley <paul@pwsan.com>
Thu, 2 Feb 2012 09:38:50 +0000 (02:38 -0700)
committerKevin Hilman <khilman@ti.com>
Mon, 5 Mar 2012 23:38:02 +0000 (15:38 -0800)
clkdms_setup() is identical across OMAP2, 3, and 4, so share it.

Signed-off-by: Paul Walmsley <paul@pwsan.com>
Tested-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: Rajendra Nayak <rnayak@ti.com>
Tested-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Kevin Hilman <khilman@ti.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 c3fe8ea..f9e8079 100644 (file)
@@ -68,6 +68,16 @@ static void omap2_init_processor_devices(void)
 #define FORCEWAKEUP_SWITCH     0
 #define LOWPOWERSTATE_SWITCH   1
 
+int __init omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused)
+{
+       if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
+               clkdm_allow_idle(clkdm);
+       else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
+                atomic_read(&clkdm->usecount) == 0)
+               clkdm_sleep(clkdm);
+       return 0;
+}
+
 /*
  * This sets pwrdm state (other than mpu & core. Currently only ON &
  * RET are supported.
index b737b11..eef67f6 100644 (file)
@@ -22,6 +22,7 @@ extern int omap3_can_sleep(void);
 extern int omap_set_pwrdm_state(struct powerdomain *pwrdm, u32 state);
 extern int omap3_idle_init(void);
 extern int omap4_idle_init(void);
+extern int omap_pm_clkdms_setup(struct clockdomain *clkdm, void *unused);
 
 #if defined(CONFIG_PM_OPP)
 extern int omap3_opp_init(void);
index 36c587f..c4fdde4 100644 (file)
@@ -283,17 +283,6 @@ static const struct platform_suspend_ops omap_pm_ops = {
 static const struct platform_suspend_ops __initdata omap_pm_ops;
 #endif /* CONFIG_SUSPEND */
 
-/* XXX This function should be shareable between OMAP2xxx and OMAP3 */
-static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
-{
-       if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
-               clkdm_allow_idle(clkdm);
-       else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
-                atomic_read(&clkdm->usecount) == 0)
-               clkdm_sleep(clkdm);
-       return 0;
-}
-
 static void __init prcm_setup_regs(void)
 {
        int i, num_mem_banks;
@@ -335,7 +324,7 @@ static void __init prcm_setup_regs(void)
        clkdm_sleep(gfx_clkdm);
 
        /* Enable hardware-supervised idle for all clkdms */
-       clkdm_for_each(clkdms_setup, NULL);
+       clkdm_for_each(omap_pm_clkdms_setup, NULL);
        clkdm_add_wkdep(mpu_clkdm, wkup_clkdm);
 
        /* REVISIT: Configure number of 32 kHz clock cycles for sys_clk
index 60279b3..5fc1a98 100644 (file)
@@ -736,21 +736,6 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
 }
 
 /*
- * Enable hw supervised mode for all clockdomains if it's
- * supported. Initiate sleep transition for other clockdomains, if
- * they are not used
- */
-static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
-{
-       if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
-               clkdm_allow_idle(clkdm);
-       else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
-                atomic_read(&clkdm->usecount) == 0)
-               clkdm_sleep(clkdm);
-       return 0;
-}
-
-/*
  * Push functions to SRAM
  *
  * The minimum set of functions is pushed to SRAM for execution:
@@ -819,7 +804,7 @@ static int __init omap3_pm_init(void)
                goto err2;
        }
 
-       (void) clkdm_for_each(clkdms_setup, NULL);
+       (void) clkdm_for_each(omap_pm_clkdms_setup, NULL);
 
        mpu_pwrdm = pwrdm_lookup("mpu_pwrdm");
        if (mpu_pwrdm == NULL) {
index c840689..84d52f7 100644 (file)
@@ -120,22 +120,6 @@ static const struct platform_suspend_ops omap_pm_ops = {
 };
 #endif /* CONFIG_SUSPEND */
 
-/*
- * Enable hardware supervised mode for all clockdomains if it's
- * supported. Initiate sleep transition for other clockdomains, if
- * they are not used
- */
-static int __init clkdms_setup(struct clockdomain *clkdm, void *unused)
-{
-       if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO)
-               clkdm_allow_idle(clkdm);
-       else if (clkdm->flags & CLKDM_CAN_FORCE_SLEEP &&
-                       atomic_read(&clkdm->usecount) == 0)
-               clkdm_sleep(clkdm);
-       return 0;
-}
-
-
 static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
 {
        struct power_state *pwrst;
@@ -247,7 +231,7 @@ static int __init omap4_pm_init(void)
                goto err2;
        }
 
-       (void) clkdm_for_each(clkdms_setup, NULL);
+       (void) clkdm_for_each(omap_pm_clkdms_setup, NULL);
 
 #ifdef CONFIG_SUSPEND
        suspend_set_ops(&omap_pm_ops);