From: Viresh Kumar <viresh.kumar@linaro.org>
To: Rafael Wysocki <rjw@rjwysocki.net>,
ulf.hansson@linaro.org, Viresh Kumar <vireshk@kernel.org>,
Nishanth Menon <nm@ti.com>, Stephen Boyd <sboyd@kernel.org>
Cc: Viresh Kumar <viresh.kumar@linaro.org>,
linux-pm@vger.kernel.org,
Vincent Guittot <vincent.guittot@linaro.org>,
Rajendra Nayak <rnayak@codeaurora.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH 01/10] OPP: Parse OPP table's DT properties from _of_init_opp_table()
Date: Fri, 29 Jun 2018 11:49:31 +0530 [thread overview]
Message-ID: <415e586b2dedcc6f97ee07a76bd54124c4b7e8bb.1530252803.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <cover.1530252803.git.viresh.kumar@linaro.org>
Parse the DT properties present in the OPP table from
_of_init_opp_table(), which is a dedicated routine of DT parsing.
Minor relocation of helpers was required for this.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
drivers/opp/of.c | 77 +++++++++++++++++++++++++++++-------------------
1 file changed, 47 insertions(+), 30 deletions(-)
diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 7af0ddec936b..44a6b81fd228 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -23,6 +23,24 @@
#include "opp.h"
+/*
+ * Returns opp descriptor node for a device node, caller must
+ * do of_node_put().
+ */
+static struct device_node *_opp_of_get_opp_desc_node(struct device_node *np,
+ int index)
+{
+ /* "operating-points-v2" can be an array for power domain providers */
+ return of_parse_phandle(np, "operating-points-v2", index);
+}
+
+/* Returns opp descriptor node for a device, caller must do of_node_put() */
+struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev)
+{
+ return _opp_of_get_opp_desc_node(dev->of_node, 0);
+}
+EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node);
+
static struct opp_table *_managed_opp(const struct device_node *np)
{
struct opp_table *opp_table, *managed_table = NULL;
@@ -54,22 +72,35 @@ static struct opp_table *_managed_opp(const struct device_node *np)
void _of_init_opp_table(struct opp_table *opp_table, struct device *dev)
{
- struct device_node *np;
+ struct device_node *np, *opp_np;
+ u32 val;
/*
* Only required for backward compatibility with v1 bindings, but isn't
* harmful for other cases. And so we do it unconditionally.
*/
np = of_node_get(dev->of_node);
- if (np) {
- u32 val;
-
- if (!of_property_read_u32(np, "clock-latency", &val))
- opp_table->clock_latency_ns_max = val;
- of_property_read_u32(np, "voltage-tolerance",
- &opp_table->voltage_tolerance_v1);
- of_node_put(np);
- }
+ if (!np)
+ return;
+
+ if (!of_property_read_u32(np, "clock-latency", &val))
+ opp_table->clock_latency_ns_max = val;
+ of_property_read_u32(np, "voltage-tolerance",
+ &opp_table->voltage_tolerance_v1);
+
+ /* Get OPP table node */
+ opp_np = _opp_of_get_opp_desc_node(np, 0);
+ of_node_put(np);
+
+ if (!opp_np)
+ return;
+
+ if (of_property_read_bool(opp_np, "opp-shared"))
+ opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED;
+ else
+ opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE;
+
+ of_node_put(opp_np);
}
static bool _opp_is_supported(struct device *dev, struct opp_table *opp_table,
@@ -249,22 +280,6 @@ void dev_pm_opp_of_remove_table(struct device *dev)
}
EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table);
-/* Returns opp descriptor node for a device node, caller must
- * do of_node_put() */
-static struct device_node *_opp_of_get_opp_desc_node(struct device_node *np,
- int index)
-{
- /* "operating-points-v2" can be an array for power domain providers */
- return of_parse_phandle(np, "operating-points-v2", index);
-}
-
-/* Returns opp descriptor node for a device, caller must do of_node_put() */
-struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev)
-{
- return _opp_of_get_opp_desc_node(dev->of_node, 0);
-}
-EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node);
-
/**
* _opp_add_static_v2() - Allocate static OPPs (As per 'v2' DT bindings)
* @opp_table: OPP table
@@ -431,11 +446,13 @@ static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np)
if (pstate_count)
opp_table->genpd_performance_state = true;
+ /*
+ * This is used by _managed_opp() to find OPP tables that are fully
+ * initialized by other devices sharing clock/voltage rails with current
+ * device. And so we can't set this from _of_init_opp_table() as tables
+ * aren't fully initialized at that point.
+ */
opp_table->np = opp_np;
- if (of_property_read_bool(opp_np, "opp-shared"))
- opp_table->shared_opp = OPP_TABLE_ACCESS_SHARED;
- else
- opp_table->shared_opp = OPP_TABLE_ACCESS_EXCLUSIVE;
put_opp_table:
dev_pm_opp_put_opp_table(opp_table);
--
2.18.0.rc1.242.g61856ae69a2c
next prev parent reply other threads:[~2018-06-29 6:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-29 6:19 [PATCH 00/10] OPP: Support multiple power-domains per device Viresh Kumar
2018-06-29 6:19 ` Viresh Kumar [this message]
2018-06-29 6:19 ` [PATCH 02/10] OPP: Identify and mark genpd OPP tables Viresh Kumar
2018-06-29 6:19 ` [PATCH 03/10] OPP: Separate out custom OPP handler specific code Viresh Kumar
2018-06-29 6:19 ` [PATCH 04/10] OPP: Populate required opp tables from "required-opps" property Viresh Kumar
2018-06-29 6:19 ` [PATCH 05/10] OPP: Populate OPPs " Viresh Kumar
2018-06-29 6:19 ` [PATCH 06/10] OPP: Add dev_pm_opp_{set|put}_required_device() helper Viresh Kumar
2018-09-10 14:18 ` Ulf Hansson
2018-06-29 6:19 ` [PATCH 07/10] PM / Domains: Add genpd_opp_to_performance_state() Viresh Kumar
2018-06-29 6:19 ` [PATCH 08/10] OPP: Configure all required OPPs Viresh Kumar
2018-06-29 6:19 ` [PATCH 09/10] OPP: Rename and relocate of_genpd_opp_to_performance_state() Viresh Kumar
2018-06-29 6:19 ` [PATCH 10/10] OPP: Remove of_dev_pm_opp_find_required_opp() Viresh Kumar
2018-06-29 9:06 ` [PATCH 00/10] OPP: Support multiple power-domains per device Rafael J. Wysocki
2018-06-29 9:48 ` Viresh Kumar
2018-07-16 4:32 ` Viresh Kumar
2018-07-16 9:04 ` Ulf Hansson
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=415e586b2dedcc6f97ee07a76bd54124c4b7e8bb.1530252803.git.viresh.kumar@linaro.org \
--to=viresh.kumar@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=nm@ti.com \
--cc=rjw@rjwysocki.net \
--cc=rnayak@codeaurora.org \
--cc=sboyd@kernel.org \
--cc=ulf.hansson@linaro.org \
--cc=vincent.guittot@linaro.org \
--cc=vireshk@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).