This updates cpufreq-dt driver to read clock sharing information from new OPP
bindings. And then initialize OPPs for CPUs with help of new bindings.

Signed-off-by: Viresh Kumar <[email protected]>
---
 drivers/cpufreq/cpufreq-dt.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c
index bab67db54b7e..6f307897e17a 100644
--- a/drivers/cpufreq/cpufreq-dt.c
+++ b/drivers/cpufreq/cpufreq-dt.c
@@ -208,8 +208,14 @@ static int cpufreq_init(struct cpufreq_policy *policy)
                goto out_put_reg_clk;
        }
 
+       pd = cpufreq_get_driver_data();
+       if (!pd || !pd->independent_clocks) {
+               if (of_get_cpus_sharing_opps(cpu_dev, policy->cpus))
+                       cpumask_setall(policy->cpus);
+       }
+
        /* OPPs might be populated at runtime, don't check for error here */
-       of_init_opp_table(cpu_dev);
+       of_cpumask_init_opp_table(policy->cpus);
 
        /*
         * But we need OPP table to function so if it is not there let's
@@ -293,10 +299,6 @@ static int cpufreq_init(struct cpufreq_policy *policy)
 
        policy->cpuinfo.transition_latency = transition_latency;
 
-       pd = cpufreq_get_driver_data();
-       if (!pd || !pd->independent_clocks)
-               cpumask_setall(policy->cpus);
-
        of_node_put(np);
 
        return 0;
@@ -306,7 +308,7 @@ static int cpufreq_init(struct cpufreq_policy *policy)
 out_free_priv:
        kfree(priv);
 out_free_opp:
-       of_free_opp_table(cpu_dev);
+       of_cpumask_free_opp_table(policy->cpus);
        of_node_put(np);
 out_put_reg_clk:
        clk_put(cpu_clk);
@@ -322,7 +324,7 @@ static int cpufreq_exit(struct cpufreq_policy *policy)
 
        cpufreq_cooling_unregister(priv->cdev);
        dev_pm_opp_free_cpufreq_table(priv->cpu_dev, &policy->freq_table);
-       of_free_opp_table(priv->cpu_dev);
+       of_cpumask_free_opp_table(policy->related_cpus);
        clk_put(policy->clk);
        if (!IS_ERR(priv->cpu_reg))
                regulator_put(priv->cpu_reg);
-- 
2.3.0.rc0.44.ga94655d

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to