diff options
author | Sibi Sankar <sibis@codeaurora.org> | 2020-05-28 00:54:18 +0530 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2020-06-01 13:10:15 +0530 |
commit | 45679f9b508f10c12a1e93cf2bdccbc1c594aa39 (patch) | |
tree | 3916071d1e14957c2b7e7b3cbaf153b316942db9 /drivers | |
parent | b00e667a6d8b2b0f53098ec12ff1ffe7f7c9be20 (diff) | |
download | linux-stable-45679f9b508f10c12a1e93cf2bdccbc1c594aa39.tar.gz linux-stable-45679f9b508f10c12a1e93cf2bdccbc1c594aa39.tar.bz2 linux-stable-45679f9b508f10c12a1e93cf2bdccbc1c594aa39.zip |
opp: Don't parse icc paths unnecessarily
The DT node of the device may contain interconnect paths while the OPP
table doesn't have the bandwidth values. There is no need to parse the
paths in such cases.
Signed-off-by: Sibi Sankar <sibis@codeaurora.org>
Tested-by: Sibi Sankar <sibis@codeaurora.org>
Reviewed-by: Sibi Sankar <sibis@codeaurora.org>
[ Viresh: Support the case of !opp_table and massaged changelog ]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/opp/of.c | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/opp/of.c b/drivers/opp/of.c index 61fce1284f01..9a5873591a40 100644 --- a/drivers/opp/of.c +++ b/drivers/opp/of.c @@ -332,13 +332,56 @@ free_required_opps: return ret; } +static int _bandwidth_supported(struct device *dev, struct opp_table *opp_table) +{ + struct device_node *np, *opp_np; + struct property *prop; + + if (!opp_table) { + np = of_node_get(dev->of_node); + if (!np) + return -ENODEV; + + opp_np = _opp_of_get_opp_desc_node(np, 0); + of_node_put(np); + } else { + opp_np = of_node_get(opp_table->np); + } + + /* Lets not fail in case we are parsing opp-v1 bindings */ + if (!opp_np) + return 0; + + /* Checking only first OPP is sufficient */ + np = of_get_next_available_child(opp_np, NULL); + if (!np) { + dev_err(dev, "OPP table empty\n"); + return -EINVAL; + } + of_node_put(opp_np); + + prop = of_find_property(np, "opp-peak-kBps", NULL); + of_node_put(np); + + if (!prop || !prop->length) + return 0; + + return 1; +} + int dev_pm_opp_of_find_icc_paths(struct device *dev, struct opp_table *opp_table) { struct device_node *np; - int ret = 0, i, count, num_paths; + int ret, i, count, num_paths; struct icc_path **paths; + ret = _bandwidth_supported(dev, opp_table); + if (ret <= 0) + return ret; + + ret = 0; + np = of_node_get(dev->of_node); if (!np) return 0; |