From: jean.pihet@newoldbits.com (jean.pihet at newoldbits.com)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/6] OMAP: PM: register to the per-device PM QoS framework
Date: Mon, 12 Dec 2011 17:18:18 +0100 [thread overview]
Message-ID: <1323706701-6627-4-git-send-email-j-pihet@ti.com> (raw)
In-Reply-To: <1323706701-6627-1-git-send-email-j-pihet@ti.com>
From: Jean Pihet <j-pihet@ti.com>
Implement the devices wake-up latency constraints using the global
device PM QoS notification handler which applies the constraints to the
underlying layer by calling the corresponding function at hwmod level.
Tested on OMAP3 Beagleboard and OMAP4 Pandaboard 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/pm.c | 71 +++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 70 insertions(+), 1 deletions(-)
diff --git a/arch/arm/mach-omap2/pm.c b/arch/arm/mach-omap2/pm.c
index 1881fe9..a40d4f3 100644
--- a/arch/arm/mach-omap2/pm.c
+++ b/arch/arm/mach-omap2/pm.c
@@ -11,15 +11,18 @@
#include <linux/kernel.h>
#include <linux/init.h>
+#include <linux/notifier.h>
#include <linux/io.h>
#include <linux/err.h>
#include <linux/opp.h>
+#include <linux/pm_qos.h>
#include <linux/export.h>
#include <plat/omap-pm.h>
#include <plat/omap_device.h>
-#include "common.h"
+#include <plat/omap_hwmod.h>
+#include "common.h"
#include "voltage.h"
#include "powerdomain.h"
#include "clockdomain.h"
@@ -215,12 +218,78 @@ static void __init omap4_init_voltages(void)
omap2_set_init_voltage("iva", "dpll_iva_m5x2_ck", "iva");
}
+/* Interface to the per-device PM QoS framework */
+static int omap2_dev_pm_qos_handler(struct notifier_block *nb,
+ unsigned long new_value,
+ void *req)
+{
+ struct omap_device *od;
+ struct omap_hwmod *oh;
+ struct platform_device *pdev;
+ struct dev_pm_qos_request *dev_pm_qos_req = req;
+
+ pr_debug("OMAP PM constraints: req at 0x%p, new_value=%lu\n",
+ req, new_value);
+
+ /* Look for the platform device for the constraint target device */
+ pdev = to_platform_device(dev_pm_qos_req->dev);
+
+ /* Try to catch non platform devices */
+ if (pdev->name == NULL) {
+ pr_err("%s: Error: platform device for device %s not valid\n",
+ __func__, dev_name(dev_pm_qos_req->dev));
+ return -EINVAL;
+ }
+
+ /* Find the associated omap_device for dev */
+ od = to_omap_device(pdev);
+ if (od == NULL) {
+ pr_err("%s: Error: no omap_device for device %s\n",
+ __func__, dev_name(dev_pm_qos_req->dev));
+ return -EINVAL;
+ }
+
+ /* Check that the omap_device has an unique hwmod entry */
+ if (od->hwmods_cnt != 1) {
+ pr_err("%s: Error: No unique hwmod for device %s\n",
+ __func__, dev_name(dev_pm_qos_req->dev));
+ return -EINVAL;
+ }
+
+ /* Find the primary omap_hwmod for dev */
+ oh = od->hwmods[0];
+
+ pr_debug("OMAP PM constraints: req at 0x%p, dev=0x%p, new_value=%lu\n",
+ req, dev_pm_qos_req->dev, new_value);
+
+ /* Apply the constraint */
+ return omap_hwmod_set_wkup_lat_constraint(oh, dev_pm_qos_req,
+ new_value);
+}
+
+static struct notifier_block omap2_dev_pm_qos_notifier = {
+ .notifier_call = omap2_dev_pm_qos_handler,
+};
+
+static int __init omap2_dev_pm_qos_init(void)
+{
+ int ret;
+
+ ret = dev_pm_qos_add_global_notifier(&omap2_dev_pm_qos_notifier);
+ WARN(ret, KERN_ERR "Cannot add global notifier for dev PM QoS\n");
+
+ return ret;
+}
+
static int __init omap2_common_pm_init(void)
{
if (!of_have_populated_dt())
omap2_init_processor_devices();
omap_pm_if_init();
+ /* Register to the per-device PM QoS framework */
+ omap2_dev_pm_qos_init();
+
return 0;
}
postcore_initcall(omap2_common_pm_init);
--
1.7.5.4
next prev parent reply other threads:[~2011-12-12 16:18 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-12 16:18 [PATCH v5 0/6] PM QoS: implement the OMAP low level constraints management code jean.pihet at newoldbits.com
2011-12-12 16:18 ` [PATCH 1/6] OMAP2+: powerdomain: control power domains next state jean.pihet at newoldbits.com
2011-12-12 16:18 ` [PATCH 2/6] OMAP2+: omap_hwmod: manage the wake-up latency constraints jean.pihet at newoldbits.com
2011-12-13 23:46 ` Kevin Hilman
2011-12-12 16:18 ` jean.pihet at newoldbits.com [this message]
2011-12-12 16:18 ` [PATCH 4/6] OMAP3: cpuidle: next C-state decision depends on the PM QoS MPU and CORE constraints jean.pihet at newoldbits.com
2011-12-13 23:49 ` Kevin Hilman
2011-12-12 16:18 ` [PATCH 5/6] OMAP3: update cpuidle latency and threshold figures jean.pihet at newoldbits.com
2011-12-12 16:18 ` [PATCH 6/6] OMAP3: powerdomain data: add wake-up latency figures jean.pihet at newoldbits.com
2011-12-13 23:53 ` [PATCH v5 0/6] PM QoS: implement the OMAP low level constraints management code Kevin Hilman
2011-12-14 14:55 ` Jean Pihet
-- strict thread matches above, loose matches on Subject: below --
2011-12-14 14:51 [PATCH v6 " jean.pihet at newoldbits.com
2011-12-14 14:51 ` [PATCH 3/6] OMAP: PM: register to the per-device PM QoS framework jean.pihet at newoldbits.com
2011-12-19 21:12 ` Paul Walmsley
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=1323706701-6627-4-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).