diff --git a/drivers/thermal/samsung/gs_tmu_v2.c b/drivers/thermal/samsung/gs_tmu_v2.c index 04b18d709abe..f4d50ee28cfd 100644 --- a/drivers/thermal/samsung/gs_tmu_v2.c +++ b/drivers/thermal/samsung/gs_tmu_v2.c @@ -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 && @@ -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); } @@ -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; } diff --git a/include/soc/google/gs_tmu.h b/include/soc/google/gs_tmu.h index 051ae5d7db2f..b845bdd64a4a 100644 --- a/include/soc/google/gs_tmu.h +++ b/include/soc/google/gs_tmu.h @@ -12,7 +12,7 @@ #include #include #include - +#include #define MCELSIUS 1000 struct gs_pi_param { @@ -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 {