devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Kevin Hilman <khilman@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	linux-pm@vger.kernel.org
Cc: Len Brown <len.brown@intel.com>, Pavel Machek <pavel@ucw.cz>,
	Geert Uytterhoeven <geert+renesas@glider.be>,
	Lina Iyer <lina.iyer@linaro.org>,
	Axel Haslam <ahaslam@baylibre.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Jon Hunter <jonathanh@nvidia.com>,
	devicetree@vger.kernel.org
Subject: [PATCH 2/2] PM / Domains: Retrieve PM QoS device latencies from DT
Date: Thu, 31 Mar 2016 15:50:26 +0200	[thread overview]
Message-ID: <1459432226-22562-2-git-send-email-ulf.hansson@linaro.org> (raw)
In-Reply-To: <1459432226-22562-1-git-send-email-ulf.hansson@linaro.org>

For the DT based device attach process, let's parse the device node for
PM QoS latency properties and provide the result as the timing data when
adding a device to its PM domain.

In DT based platforms, this change allows a device to have initial correct
latency values. In the ideal scenario it should mean that the calibration
of these values shouldn't be needed by the genpd governor, but let's leave
that as a future change to consider.

Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/base/power/domain.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 56705b5..f3302a9 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -1790,6 +1790,7 @@ int genpd_dev_pm_attach(struct device *dev)
 {
 	struct of_phandle_args pd_args;
 	struct generic_pm_domain *pd;
+	struct gpd_timing_data td;
 	unsigned int i;
 	int ret;
 
@@ -1824,10 +1825,16 @@ int genpd_dev_pm_attach(struct device *dev)
 		return -EPROBE_DEFER;
 	}
 
+	memset(&td, 0, sizeof(td));
+	of_property_read_u64(dev->of_node, "suspend-latency",
+			&td.suspend_latency_ns);
+	of_property_read_u64(dev->of_node, "resume-latency",
+			&td.resume_latency_ns);
+
 	dev_dbg(dev, "adding to PM domain %s\n", pd->name);
 
 	for (i = 1; i < GENPD_RETRY_MAX_MS; i <<= 1) {
-		ret = pm_genpd_add_device(pd, dev);
+		ret = __pm_genpd_add_device(pd, dev, &td);
 		if (ret != -EAGAIN)
 			break;
 
-- 
1.9.1


  reply	other threads:[~2016-03-31 13:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-31 13:50 [PATCH 1/2] PM / Domains: Define DT bindings for PM QoS device latencies Ulf Hansson
2016-03-31 13:50 ` Ulf Hansson [this message]
2016-04-01 18:44 ` Rob Herring
2016-04-04  9:42   ` Ulf Hansson
2016-04-07 17:57     ` Rob Herring
2016-04-08 11:19       ` Ulf Hansson
2016-04-11 13:29         ` Rob Herring

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=1459432226-22562-2-git-send-email-ulf.hansson@linaro.org \
    --to=ulf.hansson@linaro.org \
    --cc=ahaslam@baylibre.com \
    --cc=devicetree@vger.kernel.org \
    --cc=geert+renesas@glider.be \
    --cc=jonathanh@nvidia.com \
    --cc=khilman@kernel.org \
    --cc=len.brown@intel.com \
    --cc=lina.iyer@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=robh+dt@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 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).