thermal: cpuidle: Register cpuidle cooling device
authorDaniel Lezcano <daniel.lezcano@linaro.org>
Wed, 29 Apr 2020 10:36:42 +0000 (12:36 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 19 May 2020 10:58:07 +0000 (12:58 +0200)
The cpuidle driver can be used as a cooling device by injecting idle
cycles.

When the property is set, register the cpuidle driver with the idle
state node pointer as a cooling device. The thermal framework will do
the association automatically with the thermal zone via the
cooling-device defined in the device tree cooling-maps section.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Link: https://lore.kernel.org/r/20200429103644.5492-4-daniel.lezcano@linaro.org
drivers/cpuidle/cpuidle-arm.c
drivers/cpuidle/cpuidle-psci.c

index 9e5156d..8c75892 100644 (file)
@@ -8,6 +8,7 @@
 
 #define pr_fmt(fmt) "CPUidle arm: " fmt
 
+#include <linux/cpu_cooling.h>
 #include <linux/cpuidle.h>
 #include <linux/cpumask.h>
 #include <linux/cpu_pm.h>
@@ -124,6 +125,8 @@ static int __init arm_idle_init_cpu(int cpu)
        if (ret)
                goto out_kfree_drv;
 
+       cpuidle_cooling_register(drv);
+
        return 0;
 
 out_kfree_drv:
index bae9140..1f38e0d 100644 (file)
@@ -9,6 +9,7 @@
 #define pr_fmt(fmt) "CPUidle PSCI: " fmt
 
 #include <linux/cpuhotplug.h>
+#include <linux/cpu_cooling.h>
 #include <linux/cpuidle.h>
 #include <linux/cpumask.h>
 #include <linux/cpu_pm.h>
@@ -313,6 +314,8 @@ static int __init psci_idle_init_cpu(int cpu)
        if (ret)
                goto out_kfree_drv;
 
+       cpuidle_cooling_register(drv);
+
        return 0;
 
 out_kfree_drv: