[PATCH 2/2] OPP: Disallow "opp-hz" property without a corresponding clk

From: Viresh Kumar
Date: Mon Nov 21 2022 - 01:58:32 EST


This removes the special code added by the commit 2083da24eb56 ("OPP:
Allow multiple clocks for a device"), to make it work for Qcom SoC.

In qcom-cpufreq-hw driver, we want to skip clk configuration that
happens via dev_pm_opp_set_opp(), but still want the OPP core to parse
the "opp-hz" property so we can use the freq based OPP helpers.

The DT for Qcom SoCs is fixed now and contain a valid clk entry, and we
no longer need the special handling of the same in the OPP core.

Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
---
drivers/opp/core.c | 14 --------------
drivers/opp/debugfs.c | 2 +-
2 files changed, 1 insertion(+), 15 deletions(-)

diff --git a/drivers/opp/core.c b/drivers/opp/core.c
index e87567dbe99f..b7158d33c13d 100644
--- a/drivers/opp/core.c
+++ b/drivers/opp/core.c
@@ -1384,20 +1384,6 @@ static struct opp_table *_update_opp_table_clk(struct device *dev,
}

if (ret == -ENOENT) {
- /*
- * There are few platforms which don't want the OPP core to
- * manage device's clock settings. In such cases neither the
- * platform provides the clks explicitly to us, nor the DT
- * contains a valid clk entry. The OPP nodes in DT may still
- * contain "opp-hz" property though, which we need to parse and
- * allow the platform to find an OPP based on freq later on.
- *
- * This is a simple solution to take care of such corner cases,
- * i.e. make the clk_count 1, which lets us allocate space for
- * frequency in opp->rates and also parse the entries in DT.
- */
- opp_table->clk_count = 1;
-
dev_dbg(dev, "%s: Couldn't find clock: %d\n", __func__, ret);
return opp_table;
}
diff --git a/drivers/opp/debugfs.c b/drivers/opp/debugfs.c
index 96a30a032c5f..402c507edac7 100644
--- a/drivers/opp/debugfs.c
+++ b/drivers/opp/debugfs.c
@@ -138,7 +138,7 @@ void opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table)
* - For some devices rate isn't available or there are multiple, use
* index instead for them.
*/
- if (likely(opp_table->clk_count == 1 && opp->rates[0]))
+ if (likely(opp_table->clk_count == 1))
id = opp->rates[0];
else
id = _get_opp_count(opp_table);
--
2.31.1.272.g89b43f80a514