]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/cpufreq/cpufreq-dt.c
cpufreq-dt: pass 'policy->related_cpus' to of_cpufreq_cooling_register()
[karo-tx-linux.git] / drivers / cpufreq / cpufreq-dt.c
index f657c571b18e4e6baaa52250640aac4e1fa26267..7374fc4b6bb3d48b25824b5343278b70490e4889 100644 (file)
@@ -58,6 +58,8 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index)
        old_freq = clk_get_rate(cpu_clk) / 1000;
 
        if (!IS_ERR(cpu_reg)) {
+               unsigned long opp_freq;
+
                rcu_read_lock();
                opp = dev_pm_opp_find_freq_ceil(cpu_dev, &freq_Hz);
                if (IS_ERR(opp)) {
@@ -67,13 +69,16 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index)
                        return PTR_ERR(opp);
                }
                volt = dev_pm_opp_get_voltage(opp);
+               opp_freq = dev_pm_opp_get_freq(opp);
                rcu_read_unlock();
                tol = volt * priv->voltage_tolerance / 100;
                volt_old = regulator_get_voltage(cpu_reg);
+               dev_dbg(cpu_dev, "Found OPP: %ld kHz, %ld uV\n",
+                       opp_freq / 1000, volt);
        }
 
        dev_dbg(cpu_dev, "%u MHz, %ld mV --> %u MHz, %ld mV\n",
-               old_freq / 1000, volt_old ? volt_old / 1000 : -1,
+               old_freq / 1000, (volt_old > 0) ? volt_old / 1000 : -1,
                new_freq / 1000, volt ? volt / 1000 : -1);
 
        /* scaling up?  scale voltage before frequency */
@@ -89,7 +94,7 @@ static int set_target(struct cpufreq_policy *policy, unsigned int index)
        ret = clk_set_rate(cpu_clk, freq_exact);
        if (ret) {
                dev_err(cpu_dev, "failed to set clock rate: %d\n", ret);
-               if (!IS_ERR(cpu_reg))
+               if (!IS_ERR(cpu_reg) && volt_old > 0)
                        regulator_set_voltage_tol(cpu_reg, volt_old, tol);
                return ret;
        }
@@ -269,7 +274,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
         * thermal DT code takes care of matching them.
         */
        if (of_find_property(np, "#cooling-cells", NULL)) {
-               cdev = of_cpufreq_cooling_register(np, cpu_present_mask);
+               cdev = of_cpufreq_cooling_register(np, policy->related_cpus);
                if (IS_ERR(cdev))
                        dev_err(cpu_dev,
                                "running cpufreq without cooling device: %ld\n",