Fix cooling state not decreasing error when the temperature is kept at low trip(stable, not dropping).
Test on "sim:thermal", log is from /proc/thermal/cpu-thermal and see thermal/thermal_dummy.c for trip point details.
e.g. The temperature decreasing from 71 to 65 and then kept.
z:cpu-thermal t:71 t:1 h:16 l:0 c:fan0 s:16|16
a. Without this patch, the cooling state of "fan0" will be kept at 15, even if the temperature is at a lower trip:
z:cpu-thermal t:65 t:1 h:16 l:0 c:fan0 s:15|15
... ...
z:cpu-thermal t:65 t:1 h:16 l:0 c:fan0 s:15|15
b. With this patch, the cooling state of "fan0" was continually decreasing to zero according to current trip point:
z:cpu-thermal t:65 t:1 h:16 l:0 c:fan0 s:15|15
... ...
z:cpu-thermal t:65 t:1 h:16 l:0 c:fan0 s:0|0
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Spliting `THERMAL_NORMAL` to `THERMAL_ACTIVE` and `THERMAL_PASSIVE`,
to support different update intervals for thermal zone.
Active/Passive from [kernel.org](https://www.kernel.org/doc/Documentation/devicetree/bindings/thermal/thermal.txt):
* Cooling device nodes
Cooling devices are nodes providing control on power dissipation. There
are essentially two ways to provide control on power dissipation. First
is by means of regulating device performance, which is known as passive
cooling. A typical passive cooling is a CPU that has dynamic voltage and
frequency scaling (DVFS), and uses lower frequencies as cooling states.
Second is by means of activating devices in order to remove
the dissipated heat, which is known as active cooling, e.g. regulating
fan speeds. In both cases, cooling devices shall have a way to determine
the state of cooling in which the device is.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.
Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
1. cpufreq.h not found if cpufreq is not supported on some branches.
./thermal/thermal_dummy.c:25:10: fatal error: nuttx/cpufreq.h: No such file or directory
25 | #include <nuttx/cpufreq.h>
| ^~~~~~~~~~~~~~~~~
compilation terminated.
2. debug.h is included by including <nuttx/cpufreq.h>, should not.
CC: thermal/thermal_dummy.c thermal/thermal_dummy.c: In function ‘thermal_dummy_init’:
thermal/thermal_dummy.c:338:7: warning: implicit declaration of function ‘therr’ [-Wimplicit-function-declaration]
338 | therr("Register cooling device fan0 failed!\n");
|
https://github.com/apache/nuttx/pull/12824
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
When exec "echo 1 > /proc/thermal/cpu-thermal", procfs get "\n" after "1", treat as disable:
```
#1 0x000000000040f452 in thermal_procfs_write (filep=0x7ffff3d241e8, buffer=0x7ffff3d344fc "\n", buflen=1) at thermal/thermal_procfs.c:179
```
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>