Skip to content

Commit

Permalink
thermal: cpuidle: Register cpuidle cooling device
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Lukasz Luba <[email protected]>
Reviewed-by: Amit Kucheria <[email protected]>
Acked-by: Sudeep Holla <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
  • Loading branch information
dlezcano committed May 19, 2020
1 parent dfd0bda commit fc7a3d9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/cpuidle/cpuidle-arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 3 additions & 0 deletions drivers/cpuidle/cpuidle-psci.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit fc7a3d9

Please sign in to comment.