ANDROID: thermal: Add hook for cpufreq thermal

Add hook to get cpufreq policy data after registering and unregistering
cpufreq thermal for platform thermal requirement.

Bug: 228423762

Signed-off-by: Jeson Gao <jeson.gao@unisoc.com>
Signed-off-by: Di Shen <di.shen@unisoc.com>
Change-Id: I9c6bc88f348f252c428560427bd8bca91092edfa
(cherry picked from commit fbe6f8708d4f26ec2f73544786bbec3cb0ba53cc)
This commit is contained in:
Jeson Gao 2022-04-07 19:49:31 +08:00 committed by Todd Kjos
parent 78fe8913d1
commit 1fe511720a
3 changed files with 15 additions and 1 deletions

View file

@ -268,3 +268,5 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_thermal_target_freq);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_proc_transaction);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_new_ref);
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);

View file

@ -32,6 +32,7 @@
#include <linux/units.h>
#include <trace/events/power.h>
#include <trace/hooks/cpufreq.h>
#include <trace/hooks/thermal.h>
static LIST_HEAD(cpufreq_policy_list);
@ -1537,8 +1538,10 @@ static int cpufreq_online(unsigned int cpu)
if (cpufreq_driver->ready)
cpufreq_driver->ready(policy);
if (cpufreq_thermal_control_enabled(cpufreq_driver))
if (cpufreq_thermal_control_enabled(cpufreq_driver)) {
policy->cdev = of_cpufreq_cooling_register(policy);
trace_android_vh_thermal_register(policy);
}
pr_debug("initialization complete\n");
@ -1623,6 +1626,7 @@ static void __cpufreq_offline(unsigned int cpu, struct cpufreq_policy *policy)
if (cpufreq_thermal_control_enabled(cpufreq_driver)) {
cpufreq_cooling_unregister(policy->cdev);
trace_android_vh_thermal_unregister(policy);
policy->cdev = NULL;
}

View file

@ -32,6 +32,14 @@ DECLARE_HOOK(android_vh_modify_thermal_target_freq,
TP_PROTO(struct cpufreq_policy *policy, unsigned int *target_freq),
TP_ARGS(policy, target_freq));
DECLARE_HOOK(android_vh_thermal_register,
TP_PROTO(struct cpufreq_policy *policy),
TP_ARGS(policy));
DECLARE_HOOK(android_vh_thermal_unregister,
TP_PROTO(struct cpufreq_policy *policy),
TP_ARGS(policy));
#endif /* _TRACE_HOOK_THERMAL_H */
/* This part must be outside protection */
#include <trace/define_trace.h>