diff options
author | Viresh Kumar <viresh.kumar@linaro.org> | 2021-01-21 11:30:12 +0100 |
---|---|---|
committer | Viresh Kumar <viresh.kumar@linaro.org> | 2021-02-02 05:57:58 +0100 |
commit | f0b88fa45595254fa51427bd8ca321732e2eb73d (patch) | |
tree | d95995c3117f3df50deab28378b364a919001f49 /drivers/opp | |
parent | opp: Split _set_opp() out of dev_pm_opp_set_rate() (diff) | |
download | linux-f0b88fa45595254fa51427bd8ca321732e2eb73d.tar.xz linux-f0b88fa45595254fa51427bd8ca321732e2eb73d.zip |
opp: Allow _set_opp() to work for non-freq devices
The _set_opp() helper will be used for devices which don't change frequency
(like power domains, etc.) later on, prepare for that by not relying on
frequency for making decisions here.
While at it, also update the debug print to contain all relevant
information.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Diffstat (limited to 'drivers/opp')
-rw-r--r-- | drivers/opp/core.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 2c8939d18783..cce1b59d7bca 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -1003,7 +1003,7 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, { struct dev_pm_opp *old_opp; unsigned long old_freq; - int ret; + int scaling_down, ret; if (unlikely(!opp)) return _disable_opp_table(dev, opp_table); @@ -1021,11 +1021,17 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, return 0; } - dev_dbg(dev, "%s: switching OPP: %lu Hz --> %lu Hz\n", __func__, - old_freq, freq); + dev_dbg(dev, "%s: switching OPP: Freq %lu -> %lu Hz, Level %u -> %u, Bw %u -> %u\n", + __func__, old_freq, freq, old_opp->level, opp->level, + old_opp->bandwidth ? old_opp->bandwidth[0].peak : 0, + opp->bandwidth ? opp->bandwidth[0].peak : 0); + + scaling_down = _opp_compare_key(old_opp, opp); + if (scaling_down == -1) + scaling_down = 0; /* Scaling up? Configure required OPPs before frequency */ - if (freq >= old_freq) { + if (!scaling_down) { ret = _set_required_opps(dev, opp_table, opp, true); if (ret) return ret; @@ -1044,7 +1050,7 @@ static int _set_opp(struct device *dev, struct opp_table *opp_table, } /* Scaling down? Configure required OPPs after frequency */ - if (!ret && freq < old_freq) { + if (!ret && scaling_down) { ret = _set_required_opps(dev, opp_table, opp, false); if (ret) dev_err(dev, "Failed to set required opps: %d\n", ret); |