linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: jean.pihet@newoldbits.com (Jean Pihet)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/7] OMAP: PM CONSTRAINTS: add a power domains state update function in hwmod
Date: Thu, 10 Mar 2011 18:47:25 +0100	[thread overview]
Message-ID: <1299779247-20511-6-git-send-email-j-pihet@ti.com> (raw)
In-Reply-To: <1299779247-20511-1-git-send-email-j-pihet@ti.com>

Hwmod is queried from the omap device layer to change the power domains
next power state. Hwmod retrieves the correct power domain and if it
exists it calls the corresponding power domain function.

Tested on OMAP3 Beagleboard in RET/OFF using wake-up latency constraints
on MPU, CORE and PER.

Signed-off-by: Jean Pihet <j-pihet@ti.com>
---
 arch/arm/mach-omap2/omap_hwmod.c             |   29 +++++++++++++++++++++++++-
 arch/arm/plat-omap/include/plat/omap_hwmod.h |    1 +
 2 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index cf8cc9b..8caf2c5 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -142,6 +142,7 @@
 #include "powerdomain.h"
 #include <plat/clock.h>
 #include <plat/omap_hwmod.h>
+#include <plat/omap_device.h>
 #include <plat/prcm.h>
 
 #include "cm2xxx_3xxx.h"
@@ -2277,11 +2278,37 @@ ohsps_unlock:
 	return ret;
 }
 
+/*
+ * omap_hwmod_update_power_state - Update the power domain power state of
+ * @oh
+ *
+ * @oh: struct omap_hwmod* to which the requesting device belongs to.
+ * @min_latency: the allowed wake-up latency for the power domain of @oh.
+ *
+ * Finds the power domain next power state that fulfills the constraint.
+ * Applies the constraint to the power domain by calling
+ * pwrdm_wakeuplat_update_pwrst.
+ *
+ * Returns 0 upon success.
+ */
+int omap_hwmod_update_power_state(struct omap_hwmod *oh, long min_latency)
+{
+	struct powerdomain *pwrdm = omap_hwmod_get_pwrdm(oh);
+
+	if (!PTR_ERR(pwrdm)) {
+		pr_err("omap_hwmod: Error: could not find parent "
+			"powerdomain for %s\n", oh->name);
+		return -EINVAL;
+	}
+
+	return pwrdm_wakeuplat_update_pwrst(pwrdm, min_latency);
+}
+
 /**
  * omap_hwmod_get_context_loss_count - get lost context count
  * @oh: struct omap_hwmod *
  *
- * Query the powerdomain of of @oh to get the context loss
+ * Query the powerdomain of @oh to get the context loss
  * count for this device.
  *
  * Returns the context loss count of the powerdomain assocated with @oh
diff --git a/arch/arm/plat-omap/include/plat/omap_hwmod.h b/arch/arm/plat-omap/include/plat/omap_hwmod.h
index 65bcad4..f27110e 100644
--- a/arch/arm/plat-omap/include/plat/omap_hwmod.h
+++ b/arch/arm/plat-omap/include/plat/omap_hwmod.h
@@ -597,6 +597,7 @@ int omap_hwmod_for_each_by_class(const char *classname,
 				 void *user);
 
 int omap_hwmod_set_postsetup_state(struct omap_hwmod *oh, u8 state);
+int omap_hwmod_update_power_state(struct omap_hwmod *oh, long min_latency);
 u32 omap_hwmod_get_context_loss_count(struct omap_hwmod *oh);
 
 /*
-- 
1.7.2.3

  parent reply	other threads:[~2011-03-10 17:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-10 17:47 [PATCH v2 0/7] OMAP: add PM CONSTRAINTS framework Jean Pihet
2011-03-10 17:47 ` [PATCH v2 1/7] OMAP PM: create a PM layer plugin for per-device constraints Jean Pihet
2011-03-10 17:47 ` [PATCH v2 2/7] OMAP: PM CONSTRAINTS: add an enum for the classes of constraint Jean Pihet
2011-03-10 17:47 ` [PATCH v2 3/7] OMAP: PM CONSTRAINTS: implement wake-up latency constraints Jean Pihet
2011-03-17 20:18   ` Kevin Hilman
2011-03-10 17:47 ` [PATCH v2 4/7] OMAP: PM CONSTRAINTS: implement the constraints management code Jean Pihet
2011-03-17 20:36   ` Kevin Hilman
2011-03-18 11:33     ` Jean Pihet
2011-03-18 15:06       ` Kevin Hilman
2011-03-10 17:47 ` Jean Pihet [this message]
2011-03-17 20:42   ` [PATCH v2 5/7] OMAP: PM CONSTRAINTS: add a power domains state update function in hwmod Kevin Hilman
2011-03-10 17:47 ` [PATCH v2 6/7] OMAP: PM CONSTRAINTS: control power domains next state Jean Pihet
2011-03-17 20:58   ` Kevin Hilman
2011-03-10 17:47 ` [PATCH v2 7/7] OMAP: PM CONSTRAINTS: add power domains wake-up latency figures Jean Pihet
2011-03-17 20:59   ` 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=1299779247-20511-6-git-send-email-j-pihet@ti.com \
    --to=jean.pihet@newoldbits.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).