Skip to content

Commit b30f866

Browse files
JianyuWang0623xiaoxiang781216
authored andcommitted
Thermal: Add procfs file nodes
Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
1 parent 520e404 commit b30f866

File tree

6 files changed

+376
-0
lines changed

6 files changed

+376
-0
lines changed

drivers/thermal/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,11 @@ config THERMAL_CDEV_CPUFREQ
3030
---help---
3131
Enable thermal cpufreq cooling device.
3232

33+
config THERMAL_PROCFS
34+
bool "Thermal PROCFS support"
35+
default n
36+
depends on FS_PROCFS
37+
---help---
38+
Enable thermal procfs.
39+
3340
endif # THERMAL

drivers/thermal/Make.defs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ ifeq ($(CONFIG_THERMAL_CDEV_CPUFREQ),y)
3232
CSRCS += thermal_cpufreq_cooling.c
3333
endif
3434

35+
ifeq ($(CONFIG_THERMAL_PROCFS),y)
36+
CSRCS += thermal_procfs.c
37+
endif
38+
3539
DEPPATH += --dep-path thermal
3640
VPATH += thermal
3741

drivers/thermal/thermal_core.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,10 @@ thermal_zone_device_register(FAR const char *name,
741741
device_bind(zdev, cdev);
742742
}
743743

744+
#ifdef CONFIG_THERMAL_PROCFS
745+
thermal_zone_procfs_register(zdev);
746+
#endif
747+
744748
nxmutex_unlock(&g_thermal_lock);
745749

746750
thinfo("Registered zone device %s\n", zdev->name);
@@ -780,6 +784,11 @@ void thermal_zone_device_unregister(FAR struct thermal_zone_device_s *zdev)
780784
}
781785

782786
list_delete(&zdev->node);
787+
788+
#ifdef CONFIG_THERMAL_PROCFS
789+
thermal_zone_procfs_unregister(zdev);
790+
#endif
791+
783792
zone_set_governor(zdev, NULL);
784793
kmm_free(zdev);
785794
nxmutex_unlock(&g_thermal_lock);

drivers/thermal/thermal_core.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,11 @@ int thermal_zone_get_trip_hyst(FAR struct thermal_zone_device_s *zdev,
8282

8383
int thermal_register_step_wise_governor(void);
8484

85+
/* ProcFS */
86+
87+
#ifdef CONFIG_THERMAL_PROCFS
88+
int thermal_zone_procfs_register(FAR struct thermal_zone_device_s *zdev);
89+
void thermal_zone_procfs_unregister(FAR struct thermal_zone_device_s *zdev);
90+
#endif
91+
8592
#endif /* __DRIVERS_THERMAL_THERMAL_CORE_H */

0 commit comments

Comments
 (0)