diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 21:00:37 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-19 21:00:37 +0000 |
commit | 94ac2ab3fff96814d7460a27a0e9d004abbd4128 (patch) | |
tree | 9a4eb8cc234b540b0f4b93363109cdd37a20540b /drivers/thermal/thermal_debugfs.c | |
parent | Adding debian version 6.8.12-1. (diff) | |
download | linux-94ac2ab3fff96814d7460a27a0e9d004abbd4128.tar.xz linux-94ac2ab3fff96814d7460a27a0e9d004abbd4128.zip |
Merging upstream version 6.9.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'drivers/thermal/thermal_debugfs.c')
-rw-r--r-- | drivers/thermal/thermal_debugfs.c | 27 |
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c index 403f74d663..5693cc8b23 100644 --- a/drivers/thermal/thermal_debugfs.c +++ b/drivers/thermal/thermal_debugfs.c @@ -435,14 +435,6 @@ void thermal_debug_cdev_state_update(const struct thermal_cooling_device *cdev, } cdev_dbg->current_state = new_state; - - /* - * Create a record for the new state if it is not there, so its - * duration will be printed by cdev_dt_seq_show() as expected if it - * runs before the next state transition. - */ - thermal_debugfs_cdev_record_get(thermal_dbg, cdev_dbg->durations, new_state); - transition = (old_state << 16) | new_state; /* @@ -468,9 +460,8 @@ void thermal_debug_cdev_state_update(const struct thermal_cooling_device *cdev, * Allocates a cooling device object for debug, initializes the * statistics and create the entries in sysfs. * @cdev: a pointer to a cooling device - * @state: current state of the cooling device */ -void thermal_debug_cdev_add(struct thermal_cooling_device *cdev, int state) +void thermal_debug_cdev_add(struct thermal_cooling_device *cdev) { struct thermal_debugfs *thermal_dbg; struct cdev_debugfs *cdev_dbg; @@ -487,16 +478,9 @@ void thermal_debug_cdev_add(struct thermal_cooling_device *cdev, int state) INIT_LIST_HEAD(&cdev_dbg->durations[i]); } - cdev_dbg->current_state = state; + cdev_dbg->current_state = 0; cdev_dbg->timestamp = ktime_get(); - /* - * Create a record for the initial cooling device state, so its - * duration will be printed by cdev_dt_seq_show() as expected if it - * runs before the first state transition. - */ - thermal_debugfs_cdev_record_get(thermal_dbg, cdev_dbg->durations, state); - debugfs_create_file("trans_table", 0400, thermal_dbg->d_top, thermal_dbg, &tt_fops); @@ -571,6 +555,7 @@ void thermal_debug_tz_trip_up(struct thermal_zone_device *tz, struct tz_episode *tze; struct tz_debugfs *tz_dbg; struct thermal_debugfs *thermal_dbg = tz->debugfs; + int temperature = tz->temperature; int trip_id = thermal_zone_trip_id(tz, trip); ktime_t now = ktime_get(); @@ -639,6 +624,12 @@ void thermal_debug_tz_trip_up(struct thermal_zone_device *tz, tze = list_first_entry(&tz_dbg->tz_episodes, struct tz_episode, node); tze->trip_stats[trip_id].timestamp = now; + tze->trip_stats[trip_id].max = max(tze->trip_stats[trip_id].max, temperature); + tze->trip_stats[trip_id].min = min(tze->trip_stats[trip_id].min, temperature); + tze->trip_stats[trip_id].count++; + tze->trip_stats[trip_id].avg = tze->trip_stats[trip_id].avg + + (temperature - tze->trip_stats[trip_id].avg) / + tze->trip_stats[trip_id].count; unlock: mutex_unlock(&thermal_dbg->lock); |