From 226a3ec07d1a641414b092c97e230bcfaf47c0b5 Mon Sep 17 00:00:00 2001 From: Paul Walmsley Date: Tue, 20 May 2008 18:41:33 -0600 Subject: [PATCH] powerdomain: add pwrdm_get_mem_bank_count() Add a function pwrdm_get_mem_bank_count() to the powerdomain code to return the number of memory banks contained inside an OMAP powerdomain. This will be used by the PM code to configure the memory bank retention state. Signed-off-by: Paul Walmsley Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/powerdomain.c | 14 ++++++++++++++ include/asm-arm/arch-omap/powerdomain.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 94b16d00a8b..3a8dae0791b 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c @@ -588,6 +588,20 @@ int pwrdm_read_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2) (1 << pwrdm2->dep_bit)); } +/** + * pwrdm_get_mem_bank_count - get number of memory banks in this powerdomain + * @pwrdm: struct powerdomain * + * + * Return the number of controllable memory banks in powerdomain pwrdm, + * starting with 1. Returns -EINVAL if the powerdomain pointer is null. + */ +int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm) +{ + if (!pwrdm) + return -EINVAL; + + return pwrdm->banks; +} /** * pwrdm_set_next_pwrst - set next powerdomain power state diff --git a/include/asm-arm/arch-omap/powerdomain.h b/include/asm-arm/arch-omap/powerdomain.h index 40a054d2af4..39b7df6a6cd 100644 --- a/include/asm-arm/arch-omap/powerdomain.h +++ b/include/asm-arm/arch-omap/powerdomain.h @@ -134,6 +134,8 @@ int pwrdm_add_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2); int pwrdm_del_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2); int pwrdm_read_sleepdep(struct powerdomain *pwrdm1, struct powerdomain *pwrdm2); +int pwrdm_get_mem_bank_count(struct powerdomain *pwrdm); + int pwrdm_set_next_pwrst(struct powerdomain *pwrdm, u8 pwrst); int pwrdm_read_next_pwrst(struct powerdomain *pwrdm); int pwrdm_read_pwrst(struct powerdomain *pwrdm); -- 2.41.1