Commit 10b21736 authored by Viresh Kumar's avatar Viresh Kumar

opp: Reuse the enabled flag in !target_freq path

The OPP core needs to track if the resources of devices are
enabled/configured or not, as it disables the resources when target_freq
is set to 0.

Handle that with the new enabled flag and remove otherwise complex
conditional statements.
Tested-by: default avatarRajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
parent 72f80ce4
...@@ -886,22 +886,18 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) ...@@ -886,22 +886,18 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
} }
if (unlikely(!target_freq)) { if (unlikely(!target_freq)) {
ret = 0;
if (!opp_table->enabled)
goto put_opp_table;
/* /*
* Some drivers need to support cases where some platforms may * Some drivers need to support cases where some platforms may
* have OPP table for the device, while others don't and * have OPP table for the device, while others don't and
* opp_set_rate() just needs to behave like clk_set_rate(). * opp_set_rate() just needs to behave like clk_set_rate().
*/ */
if (!_get_opp_count(opp_table)) { if (!_get_opp_count(opp_table))
ret = 0;
goto put_opp_table; goto put_opp_table;
}
if (!opp_table->required_opp_tables && !opp_table->regulators &&
!opp_table->paths) {
dev_err(dev, "target frequency can't be 0\n");
ret = -EINVAL;
goto put_opp_table;
}
ret = _set_opp_bw(opp_table, NULL, dev, true); ret = _set_opp_bw(opp_table, NULL, dev, true);
if (ret) if (ret)
...@@ -931,15 +927,12 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq) ...@@ -931,15 +927,12 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
old_freq = clk_get_rate(clk); old_freq = clk_get_rate(clk);
/* Return early if nothing to do */ /* Return early if nothing to do */
if (old_freq == freq) { if (opp_table->enabled && old_freq == freq) {
if (!opp_table->required_opp_tables && !opp_table->regulators &&
!opp_table->paths) {
dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n", dev_dbg(dev, "%s: old/new frequencies (%lu Hz) are same, nothing to do\n",
__func__, freq); __func__, freq);
ret = 0; ret = 0;
goto put_opp_table; goto put_opp_table;
} }
}
/* /*
* For IO devices which require an OPP on some platforms/SoCs * For IO devices which require an OPP on some platforms/SoCs
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment