diff options
author | Kevin Hilman <khilman@deeprootsystems.com> | 2010-12-21 21:31:55 -0700 |
---|---|---|
committer | Paul Walmsley <paul@pwsan.com> | 2010-12-21 21:31:55 -0700 |
commit | 7f595674e08b8b4d3faf64a19bccc95445d7ed35 (patch) | |
tree | bbd97c930eb170b877a5d6c35e9bc9ec206a9559 /arch/arm/mach-omap2/powerdomain.c | |
parent | 0a01aa211da8530dc6a3ff3a725f2edd3464c46f (diff) |
OMAP2+: powerdomain: add API to get context loss count
Add new powerdomain API
u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm)
for checking how many times the powerdomain has lost context. The
loss count is the sum of the powerdomain off-mode counter, the
logic off counter and the per-bank memory off counter.
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
[paul@pwsan.com: removed bogus return value on error; improved kerneldoc;
tweaked commit message]
Signed-off-by: Paul Walmsley <paul@pwsan.com>
Diffstat (limited to 'arch/arm/mach-omap2/powerdomain.c')
-rw-r--r-- | arch/arm/mach-omap2/powerdomain.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/arch/arm/mach-omap2/powerdomain.c b/arch/arm/mach-omap2/powerdomain.c index 06ef60eebeb..eaed0df1669 100644 --- a/arch/arm/mach-omap2/powerdomain.c +++ b/arch/arm/mach-omap2/powerdomain.c @@ -909,3 +909,32 @@ int pwrdm_post_transition(void) pwrdm_for_each(_pwrdm_post_transition_cb, NULL); return 0; } + +/** + * pwrdm_get_context_loss_count - get powerdomain's context loss count + * @pwrdm: struct powerdomain * to wait for + * + * Context loss count is the sum of powerdomain off-mode counter, the + * logic off counter and the per-bank memory off counter. Returns 0 + * (and WARNs) upon error, otherwise, returns the context loss count. + */ +u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm) +{ + int i, count; + + if (!pwrdm) { + WARN(1, "powerdomain: %s: pwrdm is null\n", __func__); + return 0; + } + + count = pwrdm->state_counter[PWRDM_POWER_OFF]; + count += pwrdm->ret_logic_off_counter; + + for (i = 0; i < pwrdm->banks; i++) + count += pwrdm->ret_mem_off_counter[i]; + + pr_debug("powerdomain: %s: context loss count = %u\n", + pwrdm->name, count); + + return count; +} |