diff options
author | Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com> | 2008-10-15 11:13:47 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2009-09-02 18:08:23 -0400 |
commit | a23456e9b02b3fae0fc78cb33fad69803a50e5bc (patch) | |
tree | d74c8b6ed9600bc605fcd74ac4f3dfd5f6a52910 /arch | |
parent | fe617af716bc09cbbdd11ad820d5818017a9f481 (diff) |
OMAP: PM: Add closures to clkdm_for_each and pwrdm_for_each.
Add some infrastructure to easily iterate over clock and power
domains.
Signed-off-by: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap2/clockdomain.c | 5 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm24xx.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-omap2/pm34xx.c | 8 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/clockdomain.h | 3 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/mach/powerdomain.h | 3 |
5 files changed, 13 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/clockdomain.c b/arch/arm/mach-omap2/clockdomain.c index 5b0b90b76e13..4ef7b4f5474e 100644 --- a/arch/arm/mach-omap2/clockdomain.c +++ b/arch/arm/mach-omap2/clockdomain.c | |||
@@ -299,7 +299,8 @@ struct clockdomain *clkdm_lookup(const char *name) | |||
299 | * anything else to indicate failure; or -EINVAL if the function pointer | 299 | * anything else to indicate failure; or -EINVAL if the function pointer |
300 | * is null. | 300 | * is null. |
301 | */ | 301 | */ |
302 | int clkdm_for_each(int (*fn)(struct clockdomain *clkdm)) | 302 | int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user), |
303 | void *user) | ||
303 | { | 304 | { |
304 | struct clockdomain *clkdm; | 305 | struct clockdomain *clkdm; |
305 | int ret = 0; | 306 | int ret = 0; |
@@ -309,7 +310,7 @@ int clkdm_for_each(int (*fn)(struct clockdomain *clkdm)) | |||
309 | 310 | ||
310 | mutex_lock(&clkdm_mutex); | 311 | mutex_lock(&clkdm_mutex); |
311 | list_for_each_entry(clkdm, &clkdm_list, node) { | 312 | list_for_each_entry(clkdm, &clkdm_list, node) { |
312 | ret = (*fn)(clkdm); | 313 | ret = (*fn)(clkdm, user); |
313 | if (ret) | 314 | if (ret) |
314 | break; | 315 | break; |
315 | } | 316 | } |
diff --git a/arch/arm/mach-omap2/pm24xx.c b/arch/arm/mach-omap2/pm24xx.c index 528dbdc26e23..bff5c4e89742 100644 --- a/arch/arm/mach-omap2/pm24xx.c +++ b/arch/arm/mach-omap2/pm24xx.c | |||
@@ -333,7 +333,7 @@ static struct platform_suspend_ops omap_pm_ops = { | |||
333 | .valid = suspend_valid_only_mem, | 333 | .valid = suspend_valid_only_mem, |
334 | }; | 334 | }; |
335 | 335 | ||
336 | static int _pm_clkdm_enable_hwsup(struct clockdomain *clkdm) | 336 | static int _pm_clkdm_enable_hwsup(struct clockdomain *clkdm, void *unused) |
337 | { | 337 | { |
338 | omap2_clkdm_allow_idle(clkdm); | 338 | omap2_clkdm_allow_idle(clkdm); |
339 | return 0; | 339 | return 0; |
@@ -385,7 +385,7 @@ static void __init prcm_setup_regs(void) | |||
385 | omap2_clkdm_sleep(gfx_clkdm); | 385 | omap2_clkdm_sleep(gfx_clkdm); |
386 | 386 | ||
387 | /* Enable clockdomain hardware-supervised control for all clkdms */ | 387 | /* Enable clockdomain hardware-supervised control for all clkdms */ |
388 | clkdm_for_each(_pm_clkdm_enable_hwsup); | 388 | clkdm_for_each(_pm_clkdm_enable_hwsup, NULL); |
389 | 389 | ||
390 | /* Enable clock autoidle for all domains */ | 390 | /* Enable clock autoidle for all domains */ |
391 | cm_write_mod_reg(OMAP24XX_AUTO_CAM | | 391 | cm_write_mod_reg(OMAP24XX_AUTO_CAM | |
diff --git a/arch/arm/mach-omap2/pm34xx.c b/arch/arm/mach-omap2/pm34xx.c index f1976242f997..331dfca93ed5 100644 --- a/arch/arm/mach-omap2/pm34xx.c +++ b/arch/arm/mach-omap2/pm34xx.c | |||
@@ -664,7 +664,7 @@ static void __init prcm_setup_regs(void) | |||
664 | omap3_d2d_idle(); | 664 | omap3_d2d_idle(); |
665 | } | 665 | } |
666 | 666 | ||
667 | static int __init pwrdms_setup(struct powerdomain *pwrdm) | 667 | static int __init pwrdms_setup(struct powerdomain *pwrdm, void *unused) |
668 | { | 668 | { |
669 | struct power_state *pwrst; | 669 | struct power_state *pwrst; |
670 | 670 | ||
@@ -689,7 +689,7 @@ static int __init pwrdms_setup(struct powerdomain *pwrdm) | |||
689 | * supported. Initiate sleep transition for other clockdomains, if | 689 | * supported. Initiate sleep transition for other clockdomains, if |
690 | * they are not used | 690 | * they are not used |
691 | */ | 691 | */ |
692 | static int __init clkdms_setup(struct clockdomain *clkdm) | 692 | static int __init clkdms_setup(struct clockdomain *clkdm, void *unused) |
693 | { | 693 | { |
694 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) | 694 | if (clkdm->flags & CLKDM_CAN_ENABLE_AUTO) |
695 | omap2_clkdm_allow_idle(clkdm); | 695 | omap2_clkdm_allow_idle(clkdm); |
@@ -722,13 +722,13 @@ static int __init omap3_pm_init(void) | |||
722 | goto err1; | 722 | goto err1; |
723 | } | 723 | } |
724 | 724 | ||
725 | ret = pwrdm_for_each(pwrdms_setup); | 725 | ret = pwrdm_for_each(pwrdms_setup, NULL); |
726 | if (ret) { | 726 | if (ret) { |
727 | printk(KERN_ERR "Failed to setup powerdomains\n"); | 727 | printk(KERN_ERR "Failed to setup powerdomains\n"); |
728 | goto err2; | 728 | goto err2; |
729 | } | 729 | } |
730 | 730 | ||
731 | (void) clkdm_for_each(clkdms_setup); | 731 | (void) clkdm_for_each(clkdms_setup, NULL); |
732 | 732 | ||
733 | mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); | 733 | mpu_pwrdm = pwrdm_lookup("mpu_pwrdm"); |
734 | if (mpu_pwrdm == NULL) { | 734 | if (mpu_pwrdm == NULL) { |
diff --git a/arch/arm/plat-omap/include/mach/clockdomain.h b/arch/arm/plat-omap/include/mach/clockdomain.h index b9d0dd2da89b..99ebd886f134 100644 --- a/arch/arm/plat-omap/include/mach/clockdomain.h +++ b/arch/arm/plat-omap/include/mach/clockdomain.h | |||
@@ -95,7 +95,8 @@ int clkdm_register(struct clockdomain *clkdm); | |||
95 | int clkdm_unregister(struct clockdomain *clkdm); | 95 | int clkdm_unregister(struct clockdomain *clkdm); |
96 | struct clockdomain *clkdm_lookup(const char *name); | 96 | struct clockdomain *clkdm_lookup(const char *name); |
97 | 97 | ||
98 | int clkdm_for_each(int (*fn)(struct clockdomain *clkdm)); | 98 | int clkdm_for_each(int (*fn)(struct clockdomain *clkdm, void *user), |
99 | void *user); | ||
99 | struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm); | 100 | struct powerdomain *clkdm_get_pwrdm(struct clockdomain *clkdm); |
100 | 101 | ||
101 | void omap2_clkdm_allow_idle(struct clockdomain *clkdm); | 102 | void omap2_clkdm_allow_idle(struct clockdomain *clkdm); |
diff --git a/arch/arm/plat-omap/include/mach/powerdomain.h b/arch/arm/plat-omap/include/mach/powerdomain.h index 52663fc549d2..de03f3dbbf3d 100644 --- a/arch/arm/plat-omap/include/mach/powerdomain.h +++ b/arch/arm/plat-omap/include/mach/powerdomain.h | |||
@@ -128,7 +128,8 @@ int pwrdm_register(struct powerdomain *pwrdm); | |||
128 | int pwrdm_unregister(struct powerdomain *pwrdm); | 128 | int pwrdm_unregister(struct powerdomain *pwrdm); |
129 | struct powerdomain *pwrdm_lookup(const char *name); | 129 | struct powerdomain *pwrdm_lookup(const char *name); |
130 | 130 | ||
131 | int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm)); | 131 | int pwrdm_for_each(int (*fn)(struct powerdomain *pwrdm, void *user), |
132 | void *user); | ||
132 | 133 | ||
133 | int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm); | 134 | int pwrdm_add_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm); |
134 | int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm); | 135 | int pwrdm_del_clkdm(struct powerdomain *pwrdm, struct clockdomain *clkdm); |