From e54def4ad8144ab15f826416e2e0f290ef1901b4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 19 Jun 2024 23:00:30 +0200 Subject: Adding upstream version 6.9.2. Signed-off-by: Daniel Baumann --- drivers/thermal/thermal_debugfs.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'drivers/thermal/thermal_debugfs.c') 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); -- cgit v1.2.3