Skip to content

Commit

Permalink
drivers: thermal: tmu: collect temperature residency stats
Browse files Browse the repository at this point in the history
Bug: 246799997
Test: Tested stats collected from tmu driver on P22 device
Signed-off-by: Ziyi Cui <[email protected]>
Change-Id: I5f1465cdc840a38faebedf737d31677047aa1d9a
  • Loading branch information
Ziyi Cui authored and weivincewang committed Nov 22, 2022
1 parent 18285ae commit f2ae646
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
7 changes: 7 additions & 0 deletions drivers/thermal/samsung/gs_tmu_v2.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,8 @@ static int gs_get_temp(void *p, int *temp)
}

data->temperature = *temp / 1000;
if (data->tr_handle >= 0)
temp_residency_stats_update(data->tr_handle, data->temperature);

if (data->has_dfs_support &&
thermal_dfs_throttle_cb &&
Expand Down Expand Up @@ -3359,6 +3361,9 @@ static int gs_tmu_probe(struct platform_device *pdev)

thermal_zone_device_enable(data->tzd);

data->tr_handle = register_temp_residency_stats(data->tzd->type);
if (data->tr_handle < 0)
dev_err(&pdev->dev, "failed to get a handle\n");
if (list_is_singular(&dtm_dev_list)) {
register_pm_notifier(&gs_tmu_pm_nb);
}
Expand Down Expand Up @@ -3401,6 +3406,8 @@ static int gs_tmu_remove(struct platform_device *pdev)
}
mutex_unlock(&data->lock);

unregister_temp_residency_stats(data->tr_handle);

return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion include/soc/google/gs_tmu.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <uapi/linux/thermal.h>
#include <soc/google/exynos_pm_qos.h>
#include <soc/google/exynos-cpuhp.h>

#include <soc/google/thermal_metrics.h>
#define MCELSIUS 1000

struct gs_pi_param {
Expand Down Expand Up @@ -125,6 +125,7 @@ struct gs_tmu_data {
void *hardlimit_stats;
atomic64_t trip_counter[TRIP_LEVEL_NUM];
bool has_dfs_support;
tr_handle tr_handle;
};

enum throttling_stats_type {
Expand Down

0 comments on commit f2ae646

Please sign in to comment.