public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Kevin Hilman <khilman@deeprootsystems.com>
To: linux-omap@vger.kernel.org
Cc: Rajendra Nayak <rnayak@ti.com>,
	Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
Subject: [PATCH] OMAP3: PM: move context-loss counting into OMAP PM
Date: Wed,  8 Jul 2009 11:34:25 -0700	[thread overview]
Message-ID: <1247078065-348-1-git-send-email-khilman@deeprootsystems.com> (raw)

From: Rajendra Nayak <rnayak@ti.com>

Drop get_last_off_on_transaction_id() and move functionality
into OMAP PM layer.

For SRF, use omapdev** to get powerdomain state counte
for NOOP, use an increasing counter to ensure context is always restord.

**NOTE: in future PM branch, this omapdev functinality will be replaced
        by omap_hwmod.  Thus, context loss counting will only exist
        for modules with omap_hwmod implementations.

Cc: Peter 'p2' De Schrijver <peter.de-schrijver@nokia.com>
Signed-off-by: Kevin Hilman <khilman@deeprootsystems.com>
---
Applies to current PM branch and pm-2.6.29

 arch/arm/mach-omap2/pm.c          |   16 ----------------
 arch/arm/plat-omap/omap-pm-noop.c |    7 ++++++-
 arch/arm/plat-omap/omap-pm-srf.c  |   11 +++++++++++
 3 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 1192e01..fec7d00 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -31,7 +31,6 @@
 #include <asm/atomic.h>
 
 #include <mach/powerdomain.h>
-#include <mach/omapdev.h>
 #include <mach/resource.h>
 #include <mach/omap34xx.h>
 
@@ -221,21 +220,6 @@ void omap2_allow_sleep(void)
 	BUG_ON(i < 0);
 }
 
-unsigned get_last_off_on_transaction_id(struct device *dev)
-{
-	struct platform_device *pdev = to_platform_device(dev);
-	struct omapdev *odev = omapdev_find_pdev(pdev);
-	struct powerdomain *pwrdm;
-
-	if (odev) {
-		pwrdm = omapdev_get_pwrdm(odev);
-		if (pwrdm)
-			return pwrdm->state_counter[0];
-	}
-
-	return 0;
-}
-
 static int __init omap_pm_init(void)
 {
 	int error = -1;
diff --git a/arch/arm/plat-omap/omap-pm-noop.c b/arch/arm/plat-omap/omap-pm-noop.c
index 4ba261a..07b208b 100644
--- a/arch/arm/plat-omap/omap-pm-noop.c
+++ b/arch/arm/plat-omap/omap-pm-noop.c
@@ -277,6 +277,8 @@ unsigned long omap_pm_cpu_get_freq(void)
 
 int omap_pm_get_dev_context_loss_count(struct device *dev)
 {
+	static u32 counter = 0;
+
 	if (!dev) {
 		WARN_ON(1);
 		return -EINVAL;
@@ -290,7 +292,10 @@ int omap_pm_get_dev_context_loss_count(struct device *dev)
 	 * off counter.
 	 */
 
-	return 0;
+	/* For the noop case, we cannot know the off counter, so
+	 * return an increasing counter which will ensure that
+	 * context is always restored. */
+	return counter++;
 }
 
 /*
diff --git a/arch/arm/plat-omap/omap-pm-srf.c b/arch/arm/plat-omap/omap-pm-srf.c
index 226662d..cac08e4 100644
--- a/arch/arm/plat-omap/omap-pm-srf.c
+++ b/arch/arm/plat-omap/omap-pm-srf.c
@@ -276,6 +276,10 @@ EXPORT_SYMBOL(omap_pm_cpu_get_freq);
 
 int omap_pm_get_dev_context_loss_count(struct device *dev)
 {
+	struct platform_device *pdev;
+	struct omapdev *odev;
+	struct powerdomain *pwrdm;
+
 	if (!dev) {
 		WARN_ON(1);
 		return -EINVAL;
@@ -288,7 +292,14 @@ int omap_pm_get_dev_context_loss_count(struct device *dev)
 	 * Map the device to the powerdomain.  Return the powerdomain
 	 * off counter.
 	 */
+	pdev = to_platform_device(dev);
+	odev = omapdev_find_pdev(pdev);
 
+	if (odev) {
+		pwrdm = omapdev_get_pwrdm(odev);
+		if (pwrdm)
+			return pwrdm->state_counter[0];
+	}
 	return 0;
 }
 
-- 
1.6.3.3


             reply	other threads:[~2009-07-08 18:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-08 18:34 Kevin Hilman [this message]
2009-07-14 19:20 ` [PATCH] OMAP3: PM: move context-loss counting into OMAP PM Madhusudhan
2009-07-14 21:46   ` Kevin Hilman
2009-07-15 15:00   ` Kevin Hilman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1247078065-348-1-git-send-email-khilman@deeprootsystems.com \
    --to=khilman@deeprootsystems.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=peter.de-schrijver@nokia.com \
    --cc=rnayak@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox