From 97a290b0e570b6c096985cc631840e5df7ba85c4 Mon Sep 17 00:00:00 2001 From: Jeson Gao Date: Tue, 21 Dec 2021 16:32:42 +0800 Subject: [PATCH] ANDROID: thermal: Add vendor hook to check power range For SoC's skin temperature, we have to use more stringent temperature control to make IPA can monitor and mitigate temperature control earlier and faster, so add it to meet platform thermal requirement. Bug: 211564753 Signed-off-by: Jeson Gao Signed-off-by: Di Shen Change-Id: Iaef87287eef93d6fdbc3c58c93f70c1525e38296 (cherry picked from commit 6709f523251f77dc1e9ea643668c630db1f7db80) --- drivers/android/vendor_hooks.c | 1 + drivers/thermal/gov_power_allocator.c | 1 + include/trace/hooks/thermal.h | 3 +++ 3 files changed, 5 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index de470f7bc97c..862b855f9d70 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -262,3 +262,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_init); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_finished); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alter_rwsem_list_add); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thermal_power_cap); diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c index d19d20fbd70a..ae9042c7f7b0 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -470,6 +470,7 @@ static int allocate_power(struct thermal_zone_device *tz, } power_range = pid_controller(tz, control_temp, max_allocatable_power); + trace_android_vh_thermal_power_cap(&power_range); divvy_up_power(weighted_req_power, max_power, num_actors, total_weighted_req_power, power_range, granted_power, diff --git a/include/trace/hooks/thermal.h b/include/trace/hooks/thermal.h index 2f2c62f0dc3c..9112f9453d62 100644 --- a/include/trace/hooks/thermal.h +++ b/include/trace/hooks/thermal.h @@ -23,6 +23,9 @@ DECLARE_HOOK(android_vh_enable_thermal_power_throttle, TP_PROTO(int *enable), TP_ARGS(enable)); +DECLARE_HOOK(android_vh_thermal_power_cap, + TP_PROTO(u32 *power_range), + TP_ARGS(power_range)); #endif /* _TRACE_HOOK_THERMAL_H */ /* This part must be outside protection */ #include