Commit Graph

14 Commits

Author SHA1 Message Date
wangjianyu3 a73ee73c78 Thermal/dummy: Fix depends error
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>
2024-09-23 08:57:29 +08:00
wangjianyu3 efd7e31b3a Thermal/procfs: Remove unnecessary nxmutex_unlock
https://github.com/apache/nuttx/pull/12824
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 88cc4b1120 Thermal/procfs: Disabled immediately after enabling.
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>
2024-09-23 08:57:29 +08:00
wangjianyu3 d5ffed635b Thermal/dummy: Get cpufreq_driver from cpufreq_policy.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 e8758eb974 Thermal/step_wise: Increase cooling state in case of "stable" trend and "hot" trip.
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 68d5516c90 Thermal/dummy: Fix warning
```
CID 1159822: (#1 of 2): 宏将无符号值与 0 做了比较 (NO_EFFECT)
unsigned_compare: 不带符号值的此 greater-than-or-equal-to-zero 比较总是为 true。index >= 0U。
```
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 515c3978dd Thermal: Check trip type in thermal_zone_device_register().
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 f96d3798a1 Thermal: remove assert of thermal_zone_device_update()
Called by both of lpwork and Idle_Task:

[    0.000000] [ 0] [  INFO] [ap] thermal_zone_device_register: Registered zone device cpu-thermal
[    0.000000] [ 0] [ EMERG] [ap] _assert: Current Version: NuttX ap 0.0.0  Dec 11 2023 20:59:20 sim
[    0.000000] [ 0] [ EMERG] [ap] _assert: Assertion failed : at file: thermal/thermal_core.c:820 task: Idle_Task process: Kernel 0x32ade29

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 d43f0272e5 Thermal: Add dummy driver
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 b30f866f80 Thermal: Add procfs file nodes
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 520e4042ce Thermal: Register pm suspend notifier
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 2f285a04f9 Thermal: Support cpufreq cooling device
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 338b5d7415 Thermal: Support step_wise governor
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00
wangjianyu3 d1b87bd021 Add thermal framework
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2024-09-23 08:57:29 +08:00