The basic idea is to read some iio temperature sensor (battery
monitor or something else close to the battery) and throttle the CPU
clock (OPPs) so that heat is reduced.
This means adding code to the board file and refer to
\ {
thermal-zones {
battery_thermal: battery_thermal {
polling-delay-passive = <1000>; /* milliseconds */
polling-delay = <1000>; /* milliseconds */
coefficients = <0 20000>;
/* sensor ID */
thermal-sensors = <&some-thermal-sensor 0>;
};
battery_trips: trips {
battery_alert0: cpu_alert {
temperature = <45000>; /* millicelsius */
hysteresis = <2000>; /* millicelsius */
type = "passive";
};
battery_crit: cpu_crit {
temperature = <55000>; /* millicelsius */
hysteresis = <2000>; /* millicelsius */
type = "critical";
};
};
battery_cooling_maps: cooling-maps {
map0 {
trip = <&battery_alert0>;
/* do something e.g. turn off charging or reduce
processor clock */
cooling-device = <&cpu 0 1>;
};
};
};
We may have to map the iio sensor value to the thermal sensors.
Reported by Nikolaus Schaller, Sep 13, 2019