All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajendra Nayak <rnayak@codeaurora.org>
To: andy.gross@linaro.org, robh@kernel.org, viresh.kumar@linaro.org,
	sboyd@kernel.org, ulf.hansson@linaro.org,
	collinsd@codeaurora.org, mka@chromium.org
Cc: devicetree@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Rajendra Nayak <rnayak@codeaurora.org>
Subject: [PATCH v7 08/10] PM / Domains: Add a simple_opp_to_performance_state() helper
Date: Wed, 12 Dec 2018 14:51:29 +0530	[thread overview]
Message-ID: <20181212092131.13046-9-rnayak@codeaurora.org> (raw)
In-Reply-To: <20181212092131.13046-1-rnayak@codeaurora.org>

Now that we have atleast 2 genpd providers, both using a simple
routine to read a performance state value from device tree and
return it, in order to implement the .opp_to_performance_state
callback, add a simple_opp_to_performance_state() helper to do
it, so it can be resued across all such genpd providers which
just need to read the value from DT.

Suggested-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
Reviewed-by: Stephen Boyd <swboyd@chromium.org>
---
 drivers/base/power/domain.c | 17 +++++++++++++++++
 include/linux/pm_domain.h   |  9 +++++++++
 2 files changed, 26 insertions(+)

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index 8e554e6a82a2..193872afbe20 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2520,6 +2520,23 @@ int of_genpd_parse_idle_states(struct device_node *dn,
 }
 EXPORT_SYMBOL_GPL(of_genpd_parse_idle_states);
 
+unsigned int simple_opp_to_performance_state(struct generic_pm_domain *genpd,
+					     struct dev_pm_opp *opp,
+					     const char *name)
+{
+	struct device_node *np;
+	unsigned int perf_state = 0;
+
+	np = dev_pm_opp_get_of_node(opp);
+	if (of_property_read_u32(np, name, &perf_state))
+		pr_err("%s: missing %s property\n", __func__, name);
+
+	of_node_put(np);
+
+	return perf_state;
+}
+EXPORT_SYMBOL_GPL(simple_opp_to_performance_state);
+
 /**
  * pm_genpd_opp_to_performance_state - Gets performance state of the genpd from its OPP node.
  *
diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
index 642036952553..7e5777b081ee 100644
--- a/include/linux/pm_domain.h
+++ b/include/linux/pm_domain.h
@@ -260,6 +260,9 @@ int of_genpd_parse_idle_states(struct device_node *dn,
 			       struct genpd_power_state **states, int *n);
 unsigned int pm_genpd_opp_to_performance_state(struct device *genpd_dev,
 					       struct dev_pm_opp *opp);
+unsigned int simple_opp_to_performance_state(struct  generic_pm_domain *genpd,
+					     struct dev_pm_opp *opp,
+					     const char *name);
 
 int genpd_dev_pm_attach(struct device *dev);
 struct device *genpd_dev_pm_attach_by_id(struct device *dev,
@@ -306,6 +309,12 @@ pm_genpd_opp_to_performance_state(struct device *genpd_dev,
 	return 0;
 }
 
+unsigned int simple_opp_to_performance_state(struct generic_pm_domain *genpd,
+					     struct dev_pm_opp *opp,
+					     const char *name)
+{
+	return 0;
+}
 static inline int genpd_dev_pm_attach(struct device *dev)
 {
 	return 0;
-- 
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation

  parent reply	other threads:[~2018-12-12  9:21 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-12  9:21 [PATCH v7 00/10] Add power domain driver for corners on msm8996/sdm845 Rajendra Nayak
2018-12-12  9:21 ` [PATCH v7 01/10] dt-bindings: opp: Introduce qcom-opp bindings Rajendra Nayak
2018-12-12  9:21 ` [PATCH v7 02/10] dt-bindings: power: Add qcom rpm power domain driver bindings Rajendra Nayak
2018-12-17 21:08   ` Rob Herring
2018-12-12  9:21 ` [PATCH v7 03/10] soc: qcom: rpmpd: Add a Power domain driver to model corners Rajendra Nayak
2018-12-12  9:21 ` [PATCH v7 04/10] soc: qcom: rpmpd: Add support for get/set performance state Rajendra Nayak
2018-12-12 18:24   ` Stephen Boyd
2018-12-12 18:24     ` Stephen Boyd
2018-12-12  9:21 ` [PATCH v7 05/10] arm64: dts: msm8996: Add rpmpd device node Rajendra Nayak
2018-12-12  9:21 ` [PATCH v7 06/10] soc: qcom: rpmhpd: Add RPMh power domain driver Rajendra Nayak
2018-12-12 18:25   ` Stephen Boyd
2018-12-12 18:25     ` Stephen Boyd
2018-12-12  9:21 ` [PATCH v7 07/10] arm64: dts: sdm845: Add rpmh powercontroller node Rajendra Nayak
2018-12-12  9:21 ` Rajendra Nayak [this message]
2018-12-12  9:21 ` [PATCH v7 09/10] soc: qcom: rpmpd: Use simple_opp_to_performance_state() helper Rajendra Nayak
2018-12-12  9:21 ` [PATCH v7 10/10] soc: qcom: rpmhpd: Mark mx as a parent for cx Rajendra Nayak
2018-12-12 18:25   ` Stephen Boyd
2018-12-12 18:25     ` Stephen Boyd
2018-12-13  4:16 ` [PATCH v7 00/10] Add power domain driver for corners on msm8996/sdm845 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=20181212092131.13046-9-rnayak@codeaurora.org \
    --to=rnayak@codeaurora.org \
    --cc=andy.gross@linaro.org \
    --cc=collinsd@codeaurora.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mka@chromium.org \
    --cc=robh@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=ulf.hansson@linaro.org \
    --cc=viresh.kumar@linaro.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.