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>
Change-Id: I9c6bc88f348f252c428560427bd8bca91092edfa
This commit is contained in:
Jeson Gao
2022-04-07 19:49:31 +08:00
committed by Todd Kjos
parent 3b928fe250
commit fbe6f8708d
3 changed files with 15 additions and 1 deletions

View File

@@ -261,6 +261,8 @@ 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);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thermal_register);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thermal_unregister);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rproc_recovery_set);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_power_throttle);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_init);

View File

@@ -31,6 +31,7 @@
#include <linux/tick.h>
#include <trace/events/power.h>
#include <trace/hooks/cpufreq.h>
#include <trace/hooks/thermal.h>
static LIST_HEAD(cpufreq_policy_list);
@@ -1530,8 +1531,10 @@ static int cpufreq_online(unsigned int cpu)
kobject_uevent(&policy->kobj, KOBJ_ADD);
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");
@@ -1626,6 +1629,7 @@ static int cpufreq_offline(unsigned int cpu)
if (cpufreq_thermal_control_enabled(cpufreq_driver)) {
cpufreq_cooling_unregister(policy->cdev);
trace_android_vh_thermal_unregister(policy);
policy->cdev = NULL;
}

View File

@@ -18,6 +18,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));
DECLARE_HOOK(android_vh_enable_thermal_power_throttle,
TP_PROTO(int *enable),
TP_ARGS(enable));