cpufreq-dt: Supply power coefficient when registering cooling devices
authorPunit Agrawal <punit.agrawal@arm.com>
Tue, 17 Nov 2015 12:06:22 +0000 (12:06 +0000)
committerAlex Shi <alex.shi@linaro.org>
Fri, 8 Apr 2016 03:46:23 +0000 (11:46 +0800)
Support registering cooling devices with dynamic power coefficient
where provided by the device tree. This allows OF registered cooling
devices driver to be used with the power_allocator thermal governor.

Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Javi Merino <javi.merino@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
(cherry picked from commit f8fa8ae06b8c2c25d81c99766f9226adc5c3e073)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
drivers/cpufreq/cpufreq-dt.c

index 68232fef54c960bd1a9f75005327729b720af8c6..fc61cab001312c5eac03a245fed3ed0706b2b419 100644 (file)
@@ -406,8 +406,13 @@ static void cpufreq_ready(struct cpufreq_policy *policy)
         * thermal DT code takes care of matching them.
         */
        if (of_find_property(np, "#cooling-cells", NULL)) {
-               priv->cdev = of_cpufreq_cooling_register(np,
-                                                        policy->related_cpus);
+               u32 power_coefficient = 0;
+
+               of_property_read_u32(np, "dynamic-power-coefficient",
+                                    &power_coefficient);
+
+               priv->cdev = of_cpufreq_power_cooling_register(np,
+                               policy->related_cpus, power_coefficient, NULL);
                if (IS_ERR(priv->cdev)) {
                        dev_err(priv->cpu_dev,
                                "running cpufreq without cooling device: %ld\n",