PM / OPP: Update performance state when freq == old_freq
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 12 Mar 2019 04:57:18 +0000 (10:27 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 19:11:36 +0000 (20:11 +0100)
commit faef080f6db5320011862f7baf1aa66d0851559f upstream.

At boot up, CPUFreq core performs a sanity check to see if the system is
running at a frequency defined in the frequency table of the CPU. If so,
we try to find a valid frequency (lowest frequency greater than the
currently programmed frequency) from the table and set it. When the call
reaches dev_pm_opp_set_rate(), it calls _find_freq_ceil(opp_table,
&old_freq) to find the previously configured OPP and this call also
updates the old_freq. This eventually sets the old_freq == freq (new
target requested by cpufreq core) and we skip updating the performance
state in this case.

Fix this by also updating the performance state when the old_freq ==
freq.

Fixes: ca1b5d77b1c6 ("OPP: Configure all required OPPs")
Cc: v5.0 <stable@vger.kernel.org> # v5.0
Reported-by: Niklas Cassel <niklas.cassel@linaro.org>
Tested-by: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/opp/core.c

index 18f1639dbc4a601d951330ea179335cb704ce660..f5d2fa195f5fd1578d942500b2db26f31b5bc23d 100644 (file)
@@ -743,7 +743,7 @@ int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
                old_freq, freq);
 
        /* Scaling up? Configure required OPPs before frequency */
-       if (freq > old_freq) {
+       if (freq >= old_freq) {
                ret = _set_required_opps(dev, opp_table, opp);
                if (ret)
                        goto put_opp;