Re: [PATCH 1/3] OMAP2+: powerdomain: add API to get context loss count

2010-12-21 Thread Paul Walmsley
Hi Kevin

On Fri, 17 Dec 2010, Kevin Hilman wrote:

 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 sum of the powerdomain off-mode counter, the
 logic off counter and the per-bank memory off counter.
 
 Cc: Paul Walmsley p...@pwsan.com
 Signed-off-by: Kevin Hilman khil...@deeprootsystems.com

I've updated this patch to tweak the function's comments and to remove the 
negative return code from a function returning an u32.  Updated patch is 
below.


- Paul

From: Kevin Hilman khil...@deeprootsystems.com
Date: Fri, 17 Dec 2010 17:14:13 -0800
Subject: [PATCH] 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 khil...@deeprootsystems.com
[p...@pwsan.com: removed bogus return value on error; improved kerneldoc;
 tweaked commit message]
Signed-off-by: Paul Walmsley p...@pwsan.com
---
 arch/arm/mach-omap2/powerdomain.c |   29 +
 arch/arm/mach-omap2/powerdomain.h |1 +
 2 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 06ef60ee..eaed0df 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;
+}
diff --git a/arch/arm/mach-omap2/powerdomain.h 
b/arch/arm/mach-omap2/powerdomain.h
index 35b5b48..c66431e 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -211,6 +211,7 @@ int pwrdm_clkdm_state_switch(struct clockdomain *clkdm);
 int pwrdm_pre_transition(void);
 int pwrdm_post_transition(void);
 int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
+u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm);
 
 extern void omap2xxx_powerdomains_init(void);
 extern void omap3xxx_powerdomains_init(void);
-- 
1.7.2.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] OMAP2+: powerdomain: add API to get context loss count

2010-12-21 Thread Paul Walmsley

Hi Kevin

I've queued this series for 2.6.38.  It is the 'omap_pm_a_2.6.38' branch 
on git://git.pwsan.com/linux-2.6.

It's integrated with the other changes I have queued at the 
'integration-2.6.38-20101221-008' tag of 
git://git.pwsan.com/linux-integration - this is based on Tony's new 
omap-for-linus head at b9e7683bbca638967a56e5d7fd4035a947109621.


- Paul
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/3] OMAP2+: powerdomain: add API to get context loss count

2010-12-17 Thread Kevin Hilman
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 sum of the powerdomain off-mode counter, the
logic off counter and the per-bank memory off counter.

Cc: Paul Walmsley p...@pwsan.com
Signed-off-by: Kevin Hilman khil...@deeprootsystems.com
---
 arch/arm/mach-omap2/powerdomain.c |   26 ++
 arch/arm/mach-omap2/powerdomain.h |1 +
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/arch/arm/mach-omap2/powerdomain.c 
b/arch/arm/mach-omap2/powerdomain.c
index 06ef60e..b147a82 100644
--- a/arch/arm/mach-omap2/powerdomain.c
+++ b/arch/arm/mach-omap2/powerdomain.c
@@ -909,3 +909,29 @@ 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 a sum of powerdomain off-mode counter,
+ * the logic off counter and the per-bank memory off counter.
+ */
+u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm)
+{
+   int i, count;
+
+   if (!pwrdm)
+   return -EINVAL;
+
+   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;
+}
diff --git a/arch/arm/mach-omap2/powerdomain.h 
b/arch/arm/mach-omap2/powerdomain.h
index 35b5b48..c66431e 100644
--- a/arch/arm/mach-omap2/powerdomain.h
+++ b/arch/arm/mach-omap2/powerdomain.h
@@ -211,6 +211,7 @@ int pwrdm_clkdm_state_switch(struct clockdomain *clkdm);
 int pwrdm_pre_transition(void);
 int pwrdm_post_transition(void);
 int pwrdm_set_lowpwrstchange(struct powerdomain *pwrdm);
+u32 pwrdm_get_context_loss_count(struct powerdomain *pwrdm);
 
 extern void omap2xxx_powerdomains_init(void);
 extern void omap3xxx_powerdomains_init(void);
-- 
1.7.2.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html