From: mathieu.poirier@linaro.org
To: liviu.dudau@arm.com, sudeep.holla@arm.com, lorenzo.pieralisi@arm.com
Cc: linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org,
patches@linaro.org
Subject: [PATCH 4/9] coresight-tmc: Adding runtime PM awareness
Date: Tue, 6 Jan 2015 09:37:08 -0700 [thread overview]
Message-ID: <1420562233-2015-5-git-send-email-mathieu.poirier@linaro.org> (raw)
In-Reply-To: <1420562233-2015-1-git-send-email-mathieu.poirier@linaro.org>
From: Mathieu Poirier <mathieu.poirier@linaro.org>
Using the runtime API whenever HW access is required. As
such and by associating a coresight component to a power
domain in the device tree, faults associated to accessing
unpowered devices are mitigated.
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
---
drivers/coresight/coresight-tmc.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/coresight/coresight-tmc.c b/drivers/coresight/coresight-tmc.c
index ce2c293f1707..274907717a33 100644
--- a/drivers/coresight/coresight-tmc.c
+++ b/drivers/coresight/coresight-tmc.c
@@ -27,6 +27,7 @@
#include <linux/of.h>
#include <linux/coresight.h>
#include <linux/amba/bus.h>
+#include <linux/pm_runtime.h>
#include "coresight-priv.h"
@@ -249,9 +250,11 @@ static int tmc_enable(struct tmc_drvdata *drvdata, enum tmc_mode mode)
if (ret)
return ret;
+ pm_runtime_get_sync(drvdata->dev);
spin_lock_irqsave(&drvdata->spinlock, flags);
if (drvdata->reading) {
spin_unlock_irqrestore(&drvdata->spinlock, flags);
+ pm_runtime_put_sync(drvdata->dev);
clk_disable_unprepare(drvdata->clk);
return -EBUSY;
}
@@ -385,7 +388,7 @@ static void tmc_disable(struct tmc_drvdata *drvdata, enum tmc_mode mode)
out:
drvdata->enable = false;
spin_unlock_irqrestore(&drvdata->spinlock, flags);
-
+ pm_runtime_put_sync(drvdata->dev);
clk_disable_unprepare(drvdata->clk);
dev_info(drvdata->dev, "TMC disabled\n");
@@ -717,6 +720,9 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id)
if (ret)
goto err_misc_register;
+ pm_runtime_set_suspended(dev);
+ pm_runtime_put_noidle(dev);
+
dev_info(dev, "TMC initialized\n");
return 0;
--
1.9.1
next prev parent reply other threads:[~2015-01-06 16:37 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-06 16:37 [PATCH 0/9] coresight: Add PM runtime awareness mathieu.poirier
2015-01-06 16:37 ` [PATCH 1/9] coresight-etm3x: Adding runtime PM awareness mathieu.poirier
2015-01-06 16:37 ` [PATCH 2/9] coresight-etb: " mathieu.poirier
2015-01-06 16:37 ` [PATCH 3/9] coresight-funnel: " mathieu.poirier
2015-01-06 16:37 ` mathieu.poirier [this message]
2015-01-06 16:37 ` [PATCH 5/9] coresight-tpiu: " mathieu.poirier
2015-01-06 16:37 ` [PATCH 6/9] coresight-etm3x: Fixing suspend/wake modes mathieu.poirier
2015-01-06 16:37 ` [PATCH 7/9] ARM: vexpress/TC2: Add generic power domain awareness to scp driver mathieu.poirier
2015-01-07 11:39 ` Lorenzo Pieralisi
2015-01-09 23:37 ` Mathieu Poirier
2015-01-06 16:37 ` [PATCH 8/9] coresight: Adding DT generic power domain support mathieu.poirier
2015-01-06 16:37 ` [PATCH 9/9] coresight: Documenting reference to generic PD bindings mathieu.poirier
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=1420562233-2015-5-git-send-email-mathieu.poirier@linaro.org \
--to=mathieu.poirier@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liviu.dudau@arm.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=patches@linaro.org \
--cc=sudeep.holla@arm.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;
as well as URLs for NNTP newsgroup(s).