From: linus.walleij@linaro.org (Linus Walleij)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 06/13] coresight: funnel: let runtime PM handle core clock
Date: Fri, 17 Apr 2015 10:58:53 +0200 [thread overview]
Message-ID: <1429261140-13910-7-git-send-email-linus.walleij@linaro.org> (raw)
In-Reply-To: <1429261140-13910-1-git-send-email-linus.walleij@linaro.org>
This uses runtime PM to manage the PCLK ("amba_pclk") instead
of screwing around with the framework by going in and taking
a copy from the amba device. The amba bus core will uprepare
and disable the clock when the device is unused when
CONFIG_PM is selected, else the clock will be always on.
Prior to this patch, as the AMBA primecell bus code enables
the PCLK, it would be left on after probe as
clk_disable_unprepare() was not called. Now the runtime PM
callbacks will make sure the PCLK is properly disabled
after probe.
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
drivers/coresight/coresight-funnel.c | 24 +++++++-----------------
1 file changed, 7 insertions(+), 17 deletions(-)
diff --git a/drivers/coresight/coresight-funnel.c b/drivers/coresight/coresight-funnel.c
index 3db36f70b666..330de2c88759 100644
--- a/drivers/coresight/coresight-funnel.c
+++ b/drivers/coresight/coresight-funnel.c
@@ -18,7 +18,7 @@
#include <linux/err.h>
#include <linux/fs.h>
#include <linux/slab.h>
-#include <linux/clk.h>
+#include <linux/pm_runtime.h>
#include <linux/coresight.h>
#include <linux/amba/bus.h>
@@ -36,14 +36,12 @@
* @base: memory mapped base address for this component.
* @dev: the device entity associated to this component.
* @csdev: component vitals needed by the framework.
- * @clk: the clock this component is associated to.
* @priority: port selection order.
*/
struct funnel_drvdata {
void __iomem *base;
struct device *dev;
struct coresight_device *csdev;
- struct clk *clk;
unsigned long priority;
};
@@ -67,12 +65,8 @@ static int funnel_enable(struct coresight_device *csdev, int inport,
int outport)
{
struct funnel_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
- int ret;
-
- ret = clk_prepare_enable(drvdata->clk);
- if (ret)
- return ret;
+ pm_runtime_get_sync(drvdata->dev);
funnel_enable_hw(drvdata, inport);
dev_info(drvdata->dev, "FUNNEL inport %d enabled\n", inport);
@@ -98,8 +92,7 @@ static void funnel_disable(struct coresight_device *csdev, int inport,
struct funnel_drvdata *drvdata = dev_get_drvdata(csdev->dev.parent);
funnel_disable_hw(drvdata, inport);
-
- clk_disable_unprepare(drvdata->clk);
+ pm_runtime_put(drvdata->dev);
dev_info(drvdata->dev, "FUNNEL inport %d disabled\n", inport);
}
@@ -153,16 +146,14 @@ static u32 get_funnel_ctrl_hw(struct funnel_drvdata *drvdata)
static ssize_t funnel_ctrl_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
- int ret;
u32 val;
struct funnel_drvdata *drvdata = dev_get_drvdata(dev->parent);
- ret = clk_prepare_enable(drvdata->clk);
- if (ret)
- return ret;
+ pm_runtime_get_sync(drvdata->dev);
val = get_funnel_ctrl_hw(drvdata);
- clk_disable_unprepare(drvdata->clk);
+
+ pm_runtime_put(drvdata->dev);
return sprintf(buf, "%#x\n", val);
}
@@ -205,8 +196,7 @@ static int funnel_probe(struct amba_device *adev, const struct amba_id *id)
return PTR_ERR(base);
drvdata->base = base;
-
- drvdata->clk = adev->pclk;
+ pm_runtime_put(&adev->dev);
desc = devm_kzalloc(dev, sizeof(*desc), GFP_KERNEL);
if (!desc)
--
1.9.3
next prev parent reply other threads:[~2015-04-17 8:58 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 8:58 [PATCH 00/13] Enable CoreSight for the Ux500 Linus Walleij
2015-04-17 8:58 ` [PATCH 01/13] coresight: etm: print what version of ETM/PTM is detected Linus Walleij
2015-04-17 8:58 ` [PATCH 02/13] coresight: support the TPIU version found in Ux500 Linus Walleij
2015-04-17 8:58 ` [PATCH 03/13] coresight: etm: let runtime PM handle core clock Linus Walleij
2015-04-17 9:06 ` Ulf Hansson
2015-04-17 8:58 ` [PATCH 04/13] coresight: tpiu: " Linus Walleij
2015-04-17 9:07 ` Ulf Hansson
2015-04-17 8:58 ` [PATCH 05/13] coresight: etb: " Linus Walleij
2015-04-17 9:08 ` Ulf Hansson
2015-04-17 8:58 ` Linus Walleij [this message]
2015-04-17 9:09 ` [PATCH 06/13] coresight: funnel: " Ulf Hansson
2015-04-17 8:58 ` [PATCH 07/13] coresight: tmc: " Linus Walleij
2015-04-17 9:10 ` Ulf Hansson
2015-04-17 8:58 ` [PATCH 08/13] coresight: etm: retrieve and handle atclk Linus Walleij
2015-04-17 9:18 ` Ulf Hansson
2015-04-17 8:58 ` [PATCH 09/13] coresight: tpiu: " Linus Walleij
2015-04-17 9:20 ` Ulf Hansson
2015-04-17 8:58 ` [PATCH 10/13] coresight: etb: " Linus Walleij
2015-04-17 9:21 ` Ulf Hansson
2015-04-17 8:58 ` [PATCH 11/13] coresight: funnel: " Linus Walleij
2015-04-17 9:21 ` Ulf Hansson
2015-04-17 8:58 ` [PATCH 12/13] coresight: replicator: " Linus Walleij
2015-04-17 9:31 ` Ulf Hansson
2015-04-17 8:59 ` [PATCH 13/13] ARM: ux500: add CoreSight blocks to DTS file Linus Walleij
2015-04-17 15:41 ` Mathieu Poirier
2015-04-17 15:53 ` [PATCH 00/13] Enable CoreSight for the Ux500 Mathieu Poirier
2015-04-24 14:53 ` Ivan T. Ivanov
2015-04-24 15:31 ` Ulf Hansson
2015-04-24 19:40 ` Ivan T. Ivanov
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=1429261140-13910-7-git-send-email-linus.walleij@linaro.org \
--to=linus.walleij@linaro.org \
--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).