aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorThara Gopinath <thara@ti.com>2010-02-24 14:05:50 -0500
committerPaul Walmsley <paul@pwsan.com>2010-02-24 14:05:50 -0500
commitcde08f81b1d7952ae00c4be2165da629ef985522 (patch)
treefa2d18f724d441054fdaff01d0a4370868b660f4 /arch
parent4133a44e28cb65c380903ca69806eec039401f46 (diff)
OMAP3 PM: Adding counters for power domain logic off and mem off during retention.
This patch adds counters to keep track of whether the powerdomain logic or software controllable memory banks are turned off when the power domain enters retention. During power domain retention if logic gets turned off, the scenario is known as Open Switch Retention. Also during retention s/w controllable memory banks of a power domain can be chosen to be kept in retention or off. This patch adds one counter per powerdomain to track the power domain logic state during retention. Number of memory bank state counters added depends on the number of software controllable memory banks of the powerdomain. To view these counters do cat ../debug/pm_debug/count Signed-off-by: Thara Gopinath <thara@ti.com> [paul@pwsan.com: conditional expressions simplified; counter increment code moved to its own function] Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-omap2/pm-debug.c5
-rw-r--r--arch/arm/mach-omap2/powerdomain.c25
-rw-r--r--arch/arm/plat-omap/include/plat/powerdomain.h2
3 files changed, 32 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/pm-debug.c b/arch/arm/mach-omap2/pm-debug.c
index 0ce356f351a3..c18f7f2f19bc 100644
--- a/arch/arm/mach-omap2/pm-debug.c
+++ b/arch/arm/mach-omap2/pm-debug.c
@@ -385,6 +385,11 @@ static int pwrdm_dbg_show_counter(struct powerdomain *pwrdm, void *user)
385 seq_printf(s, ",%s:%d", pwrdm_state_names[i], 385 seq_printf(s, ",%s:%d", pwrdm_state_names[i],
386 pwrdm->state_counter[i]); 386 pwrdm->state_counter[i]);
387 387
388 seq_printf(s, ",RET-LOGIC-OFF:%d", pwrdm->ret_logic_off_counter);
389 for (i = 0; i < pwrdm->banks; i++)
390 seq_printf(s, ",RET-MEMBANK%d-OFF:%d", i + 1,
391 pwrdm->ret_mem_off_counter[i]);
392
388 seq_printf(s, "\n"); 393 seq_printf(s, "\n");
389 394
390 return 0; 395 return 0;
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c
index e9eeaa4fbd47..9a0fb385622b 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -125,6 +125,10 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
125 for (i = 0; i < PWRDM_MAX_PWRSTS; i++) 125 for (i = 0; i < PWRDM_MAX_PWRSTS; i++)
126 pwrdm->state_counter[i] = 0; 126 pwrdm->state_counter[i] = 0;
127 127
128 pwrdm->ret_logic_off_counter = 0;
129 for (i = 0; i < pwrdm->banks; i++)
130 pwrdm->ret_mem_off_counter[i] = 0;
131
128 pwrdm_wait_transition(pwrdm); 132 pwrdm_wait_transition(pwrdm);
129 pwrdm->state = pwrdm_read_pwrst(pwrdm); 133 pwrdm->state = pwrdm_read_pwrst(pwrdm);
130 pwrdm->state_counter[pwrdm->state] = 1; 134 pwrdm->state_counter[pwrdm->state] = 1;
@@ -134,6 +138,25 @@ static int _pwrdm_register(struct powerdomain *pwrdm)
134 return 0; 138 return 0;
135} 139}
136 140
141static void _update_logic_membank_counters(struct powerdomain *pwrdm)
142{
143 int i;
144 u8 prev_logic_pwrst, prev_mem_pwrst;
145
146 prev_logic_pwrst = pwrdm_read_prev_logic_pwrst(pwrdm);
147 if ((pwrdm->pwrsts_logic_ret == PWRSTS_OFF_RET) &&
148 (prev_logic_pwrst == PWRDM_POWER_OFF))
149 pwrdm->ret_logic_off_counter++;
150
151 for (i = 0; i < pwrdm->banks; i++) {
152 prev_mem_pwrst = pwrdm_read_prev_mem_pwrst(pwrdm, i);
153
154 if ((pwrdm->pwrsts_mem_ret[i] == PWRSTS_OFF_RET) &&
155 (prev_mem_pwrst == PWRDM_POWER_OFF))
156 pwrdm->ret_mem_off_counter[i]++;
157 }
158}
159
137static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag) 160static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag)
138{ 161{
139 162
@@ -153,6 +176,8 @@ static int _pwrdm_state_switch(struct powerdomain *pwrdm, int flag)
153 prev = pwrdm_read_prev_pwrst(pwrdm); 176 prev = pwrdm_read_prev_pwrst(pwrdm);
154 if (pwrdm->state != prev) 177 if (pwrdm->state != prev)
155 pwrdm->state_counter[prev]++; 178 pwrdm->state_counter[prev]++;
179 if (prev == PWRDM_POWER_RET)
180 _update_logic_membank_counters(pwrdm);
156 break; 181 break;
157 default: 182 default:
158 return -EINVAL; 183 return -EINVAL;
diff --git a/arch/arm/plat-omap/include/plat/powerdomain.h b/arch/arm/plat-omap/include/plat/powerdomain.h
index 6657ff2dfb6e..d82b2c00d4f1 100644
--- a/arch/arm/plat-omap/include/plat/powerdomain.h
+++ b/arch/arm/plat-omap/include/plat/powerdomain.h
@@ -100,6 +100,8 @@ struct powerdomain {
100 struct list_head node; 100 struct list_head node;
101 int state; 101 int state;
102 unsigned state_counter[PWRDM_MAX_PWRSTS]; 102 unsigned state_counter[PWRDM_MAX_PWRSTS];
103 unsigned ret_logic_off_counter;
104 unsigned ret_mem_off_counter[PWRDM_MAX_MEM_BANKS];
103 105
104#ifdef CONFIG_PM_DEBUG 106#ifdef CONFIG_PM_DEBUG
105 s64 timer; 107 s64 timer;