]> git.karo-electronics.de Git - linux-beck.git/commitdiff
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 c3fe8eada2ccfdb8a1d6514cede585902c5a13ee..f9e807958f3e9940e71c4a7620a583a883e354b2 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 b737b11e4499f37a47176445649ffaa9614b7fcd..eef67f67872e517d45c6aa0c9478af46f9d152d9 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 36c587f4981b0e679cd7acffbeceb0aeeafbab25..c4fdde47742128fb34f0f873fd3adbe9863032b0 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 60279b3502d911c142b32e88cb9ced29ff0646d4..5fc1a987fccc9ec0756d0628eb3e682a5882098e 100644 (file)
@@ -735,21 +735,6 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused)
        return omap_set_pwrdm_state(pwrst->pwrdm, pwrst->next_state);
 }
 
-/*
- * 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
  *
@@ -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 c840689df24ae5256da6e81c4fd232d28fcf6fa2..84d52f729af41ffb25782d5eae177796b77b9a84 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);