summaryrefslogtreecommitdiffstats
path: root/drivers/opp
diff options
context:
space:
mode:
authorViresh Kumar <viresh.kumar@linaro.org>2018-06-27 12:59:50 +0200
committerViresh Kumar <viresh.kumar@linaro.org>2018-11-05 03:10:43 +0100
commit4c6a343e57fe241fa30ab31ac4969561272cc6b2 (patch)
tree214b1413c1246e5c66d1c2c2df5aa6130d409847 /drivers/opp
parentOPP: Configure all required OPPs (diff)
downloadlinux-4c6a343e57fe241fa30ab31ac4969561272cc6b2.tar.xz
linux-4c6a343e57fe241fa30ab31ac4969561272cc6b2.zip
OPP: Rename and relocate of_genpd_opp_to_performance_state()
The OPP core already has the performance state values for each of the genpd's OPPs and there is no need to call the genpd callback again to get the performance state for the case where the end device doesn't have an OPP table and has the "required-opps" property directly in its node. This commit renames of_genpd_opp_to_performance_state() as of_get_required_opp_performance_state() and moves it to the OPP core, as it is all about OPP stuff now. Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/opp')
-rw-r--r--drivers/opp/of.c44
1 files changed, 44 insertions, 0 deletions
diff --git a/drivers/opp/of.c b/drivers/opp/of.c
index 4e494720ac25..369d63a58ac4 100644
--- a/drivers/opp/of.c
+++ b/drivers/opp/of.c
@@ -970,6 +970,50 @@ put_cpu_node:
EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_sharing_cpus);
/**
+ * of_get_required_opp_performance_state() - Search for required OPP and return its performance state.
+ * @np: Node that contains the "required-opps" property.
+ * @index: Index of the phandle to parse.
+ *
+ * Returns the performance state of the OPP pointed out by the "required-opps"
+ * property at @index in @np.
+ *
+ * Return: Positive performance state on success, otherwise 0 on errors.
+ */
+unsigned int of_get_required_opp_performance_state(struct device_node *np,
+ int index)
+{
+ struct dev_pm_opp *opp;
+ struct device_node *required_np;
+ struct opp_table *opp_table;
+ unsigned int pstate = 0;
+
+ required_np = of_parse_required_opp(np, index);
+ if (!required_np)
+ return 0;
+
+ opp_table = _find_table_of_opp_np(required_np);
+ if (IS_ERR(opp_table)) {
+ pr_err("%s: Failed to find required OPP table %pOF: %ld\n",
+ __func__, np, PTR_ERR(opp_table));
+ goto put_required_np;
+ }
+
+ opp = _find_opp_of_np(opp_table, required_np);
+ if (opp) {
+ pstate = opp->pstate;
+ dev_pm_opp_put(opp);
+ }
+
+ dev_pm_opp_put_opp_table(opp_table);
+
+put_required_np:
+ of_node_put(required_np);
+
+ return pstate;
+}
+EXPORT_SYMBOL_GPL(of_get_required_opp_performance_state);
+
+/**
* of_dev_pm_opp_find_required_opp() - Search for required OPP.
* @dev: The device whose OPP node is referenced by the 'np' DT node.
* @np: Node that contains the "required-opps" property.