All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajendra Nayak <rnayak@codeaurora.org>
To: linux-arm-msm@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org
Cc: Rajendra Nayak <rnayak@codeaurora.org>
Subject: [RFC/RFT 1/6] PM / clock_ops: Make pm_clk_notify() do nothing in case DT passes power-domains
Date: Thu, 23 Apr 2015 14:15:39 +0530	[thread overview]
Message-ID: <1429778744-13352-2-git-send-email-rnayak@codeaurora.org> (raw)
In-Reply-To: <1429778744-13352-1-git-send-email-rnayak@codeaurora.org>

pm_clk_notify() intends to do nothing if the device is associated
with a pm_domain other than whats stored in pm_clk_notifier_block.
In case of DT though, just checking for an existing dev->pm_domain
is not very useful as dev->pm_domain actually gets populated much later.

Add a check for a 'power-domains' DT property to identify if the
device would be assocaiated with a different power domain at
a later point in time.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
 drivers/base/power/clock_ops.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index 8abea66..6618818 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/pm_runtime.h>
+#include <linux/of.h>
 
 #ifdef CONFIG_PM
 
@@ -323,6 +324,7 @@ int pm_clk_resume(struct device *dev)
  * of PM clocks, depending on @action.
  *
  * If the device's pm_domain field is already populated with a value different
+ * or is expected to be populated with a different value later (in case of DT)
  * from the one stored in the struct pm_clk_notifier_block object, the function
  * does nothing.
  */
@@ -332,7 +334,7 @@ static int pm_clk_notify(struct notifier_block *nb,
 	struct pm_clk_notifier_block *clknb;
 	struct device *dev = data;
 	char **con_id;
-	int error;
+	int error, sz;
 
 	dev_dbg(dev, "%s() %ld\n", __func__, action);
 
@@ -343,6 +345,10 @@ static int pm_clk_notify(struct notifier_block *nb,
 		if (dev->pm_domain)
 			break;
 
+		/* With DT dev->pm_domain hookup happens later */
+		if (of_find_property(dev->of_node, "power-domains", &sz))
+			break;
+
 		error = pm_clk_create(dev);
 		if (error)
 			break;
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

WARNING: multiple messages have this Message-ID (diff)
From: rnayak@codeaurora.org (Rajendra Nayak)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/RFT 1/6] PM / clock_ops: Make pm_clk_notify() do nothing in case DT passes power-domains
Date: Thu, 23 Apr 2015 14:15:39 +0530	[thread overview]
Message-ID: <1429778744-13352-2-git-send-email-rnayak@codeaurora.org> (raw)
In-Reply-To: <1429778744-13352-1-git-send-email-rnayak@codeaurora.org>

pm_clk_notify() intends to do nothing if the device is associated
with a pm_domain other than whats stored in pm_clk_notifier_block.
In case of DT though, just checking for an existing dev->pm_domain
is not very useful as dev->pm_domain actually gets populated much later.

Add a check for a 'power-domains' DT property to identify if the
device would be assocaiated with a different power domain at
a later point in time.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
 drivers/base/power/clock_ops.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/clock_ops.c b/drivers/base/power/clock_ops.c
index 8abea66..6618818 100644
--- a/drivers/base/power/clock_ops.c
+++ b/drivers/base/power/clock_ops.c
@@ -16,6 +16,7 @@
 #include <linux/slab.h>
 #include <linux/err.h>
 #include <linux/pm_runtime.h>
+#include <linux/of.h>
 
 #ifdef CONFIG_PM
 
@@ -323,6 +324,7 @@ int pm_clk_resume(struct device *dev)
  * of PM clocks, depending on @action.
  *
  * If the device's pm_domain field is already populated with a value different
+ * or is expected to be populated with a different value later (in case of DT)
  * from the one stored in the struct pm_clk_notifier_block object, the function
  * does nothing.
  */
@@ -332,7 +334,7 @@ static int pm_clk_notify(struct notifier_block *nb,
 	struct pm_clk_notifier_block *clknb;
 	struct device *dev = data;
 	char **con_id;
-	int error;
+	int error, sz;
 
 	dev_dbg(dev, "%s() %ld\n", __func__, action);
 
@@ -343,6 +345,10 @@ static int pm_clk_notify(struct notifier_block *nb,
 		if (dev->pm_domain)
 			break;
 
+		/* With DT dev->pm_domain hookup happens later */
+		if (of_find_property(dev->of_node, "power-domains", &sz))
+			break;
+
 		error = pm_clk_create(dev);
 		if (error)
 			break;
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

  reply	other threads:[~2015-04-23  8:45 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-23  8:45 [RFC/RFT 0/6] qcom: Add runtime PM support Rajendra Nayak
2015-04-23  8:45 ` Rajendra Nayak
2015-04-23  8:45 ` Rajendra Nayak [this message]
2015-04-23  8:45   ` [RFC/RFT 1/6] PM / clock_ops: Make pm_clk_notify() do nothing in case DT passes power-domains Rajendra Nayak
2015-04-23  8:45 ` [RFC/RFT 2/6] clk: qcom: Add runtime support to handle clocks using PM clocks Rajendra Nayak
2015-04-23  8:45   ` Rajendra Nayak
2015-04-24 10:03   ` Ulf Hansson
2015-04-24 10:03     ` Ulf Hansson
2015-04-24 10:58     ` Rajendra Nayak
2015-04-24 10:58       ` Rajendra Nayak
2015-04-26  8:49       ` Geert Uytterhoeven
2015-04-26  8:49         ` Geert Uytterhoeven
2015-04-27 20:02         ` Kevin Hilman
2015-04-27 20:02           ` Kevin Hilman
2015-04-28  2:52           ` Rajendra Nayak
2015-04-28  2:52             ` Rajendra Nayak
2015-04-28  7:25             ` Geert Uytterhoeven
2015-04-28  7:25               ` Geert Uytterhoeven
2015-04-29  9:49               ` Rajendra Nayak
2015-04-29  9:49                 ` Rajendra Nayak
2015-04-29 11:30                 ` Geert Uytterhoeven
2015-04-29 11:30                   ` Geert Uytterhoeven
2015-04-29 12:31                   ` Ulf Hansson
2015-04-29 12:31                     ` Ulf Hansson
2015-04-29 13:08                     ` Geert Uytterhoeven
2015-04-29 13:08                       ` Geert Uytterhoeven
2015-04-30  6:21                       ` Ulf Hansson
2015-04-30  6:21                         ` Ulf Hansson
2015-04-30  9:02                         ` Ulf Hansson
2015-04-30  9:02                           ` Ulf Hansson
2015-04-27  7:08       ` Ulf Hansson
2015-04-27  7:08         ` Ulf Hansson
2015-04-23  8:45 ` [RFC/RFT 3/6] serial: msm: convert driver to use runtime PM apis Rajendra Nayak
2015-04-23  8:45   ` Rajendra Nayak
2015-04-29  0:16   ` Stephen Boyd
2015-04-29  0:16     ` Stephen Boyd
2015-04-29  3:15     ` Rajendra Nayak
2015-04-29  3:15       ` Rajendra Nayak
2015-04-23  8:45 ` [RFC/RFT 4/6] mmc: sdhci-msm: " Rajendra Nayak
2015-04-23  8:45   ` Rajendra Nayak
2015-04-23 13:21   ` Ulf Hansson
2015-04-23 13:21     ` Ulf Hansson
2015-04-23 13:42     ` Rajendra Nayak
2015-04-23 13:42       ` Rajendra Nayak
2015-04-23 21:15       ` Kevin Hilman
2015-04-23 21:15         ` Kevin Hilman
2015-04-24  0:45         ` Rajendra Nayak
2015-04-24  0:45           ` Rajendra Nayak
2015-04-23 13:43     ` Rajendra Nayak
2015-04-23 13:43       ` Rajendra Nayak
2015-04-23  8:45 ` [RFC/RFT 5/6] i2c: qup: Get rid of clock handling as its done using runtime callbacks Rajendra Nayak
2015-04-23  8:45   ` Rajendra Nayak
2015-04-23 21:16   ` Kevin Hilman
2015-04-23 21:16     ` Kevin Hilman
2015-04-24  2:32     ` Rajendra Nayak
2015-04-24  2:32       ` Rajendra Nayak
2015-04-25  7:01   ` Ivan T. Ivanov
2015-04-25  7:01     ` Ivan T. Ivanov
2015-04-27  2:36     ` Rajendra Nayak
2015-04-27  2:36       ` Rajendra Nayak
2015-04-23  8:45 ` [RFC/RFT 6/6] spi: " Rajendra Nayak
2015-04-23  8:45   ` Rajendra Nayak

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=1429778744-13352-2-git-send-email-rnayak@codeaurora.org \
    --to=rnayak@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-pm@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.