summaryrefslogtreecommitdiffstats
path: root/drivers/thermal/thermal_debugfs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/thermal/thermal_debugfs.c')
-rw-r--r--drivers/thermal/thermal_debugfs.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/drivers/thermal/thermal_debugfs.c b/drivers/thermal/thermal_debugfs.c
index 403f74d66..5693cc8b2 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);