diff --git a/drivers/android/vendor_hooks.c b/drivers/android/vendor_hooks.c index 98a4f3fc8228..e48676990235 100644 --- a/drivers/android/vendor_hooks.c +++ b/drivers/android/vendor_hooks.c @@ -51,6 +51,7 @@ #include #include #include +#include /* * Export tracepoints that act as a bare tracehook (ie: have no trace event @@ -248,3 +249,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sha256); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_expandkey); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_encrypt); EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_aes_decrypt); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_thermal_request_freq); +EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_thermal_target_freq); diff --git a/drivers/thermal/cpufreq_cooling.c b/drivers/thermal/cpufreq_cooling.c index 43b1ae8a7789..af5b957f745b 100644 --- a/drivers/thermal/cpufreq_cooling.c +++ b/drivers/thermal/cpufreq_cooling.c @@ -23,6 +23,7 @@ #include #include +#include /* * Cooling state <-> CPUFreq frequency @@ -218,6 +219,8 @@ static int cpufreq_get_requested_power(struct thermal_cooling_device *cdev, freq = cpufreq_quick_get(policy->cpu); + trace_android_vh_modify_thermal_request_freq(policy, &freq); + if (trace_thermal_power_cpu_get_power_enabled()) { u32 ncpus = cpumask_weight(policy->related_cpus); @@ -317,6 +320,8 @@ static int cpufreq_power2state(struct thermal_cooling_device *cdev, normalised_power = (power * 100) / last_load; target_freq = cpu_power_to_freq(cpufreq_cdev, normalised_power); + trace_android_vh_modify_thermal_target_freq(policy, &target_freq); + *state = get_level(cpufreq_cdev, target_freq); trace_thermal_power_cpu_limit(policy->related_cpus, target_freq, *state, power); diff --git a/include/trace/hooks/thermal.h b/include/trace/hooks/thermal.h new file mode 100644 index 000000000000..e4dbac3bc0d4 --- /dev/null +++ b/include/trace/hooks/thermal.h @@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#undef TRACE_SYSTEM +#define TRACE_SYSTEM thermal + +#define TRACE_INCLUDE_PATH trace/hooks + +#if !defined(_TRACE_HOOK_THERMAL_H) || defined(TRACE_HEADER_MULTI_READ) +#define _TRACE_HOOK_THERMAL_H + +#include +#include +#include + +DECLARE_HOOK(android_vh_modify_thermal_request_freq, + TP_PROTO(struct cpufreq_policy *policy, unsigned long *request_freq), + TP_ARGS(policy, request_freq)); + +DECLARE_HOOK(android_vh_modify_thermal_target_freq, + TP_PROTO(struct cpufreq_policy *policy, unsigned int *target_freq), + TP_ARGS(policy, target_freq)); + +#endif /* _TRACE_HOOK_THERMAL_H */ +/* This part must be outside protection */ +#include