From: Paul Walmsley Date: Wed, 21 May 2008 00:41:33 +0000 (-0600) Subject: powerdomain: add pwrdm_get_mem_bank_count() X-Git-Tag: v2.6.26-omap1~123^2~52 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=226a3ec07d1a641414b092c97e230bcfaf47c0b5;p=linux-2.6-omap-h63xx.git 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 --- 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);