From ce7ceff8c8c041aee181cec2824c29cba0f70b85 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) (cherry picked from commit 97a290b0e570b6c096985cc631840e5df7ba85c4) --- drivers/android/vendor_hooks.c | 1 + drivers/thermal/gov_power_allocator.c | 3 +++ include/trace/hooks/thermal.h | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index aa108c53e286..ccb64d09f380 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -271,3 +271,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_del_ref); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thermal_register); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thermal_unregister); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_get_thermal_zone_device); +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 2d1aeaba38a8..5471c9091f5f 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -14,6 +14,8 @@ #define CREATE_TRACE_POINTS #include +#undef CREATE_TRACE_POINTS +#include #include "thermal_core.h" @@ -462,6 +464,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 5e525ef0df7b..dd42f1d6766a 100644 --- a/include/trace/hooks/thermal.h +++ b/include/trace/hooks/thermal.h @@ -44,6 +44,10 @@ DECLARE_HOOK(android_vh_get_thermal_zone_device, TP_PROTO(struct thermal_zone_device *tz), TP_ARGS(tz)); +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