mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
ANDROID: thermal: Add hook to enable/disable thermal power throttle
By default, thermal power throttle is always enable, but sometimes it need to be disabled for a period of time, so add it to meet platform thermal requirement. Bug: 209386157 Signed-off-by: Jeson Gao <jeson.gao@unisoc.com> Change-Id: If9c53a9669eec8e2821d837cfa3c660a9cfbf934
This commit is contained in:
@@ -377,3 +377,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_sound_usb_support_cpu_suspend);
|
||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_snd_compr_use_pause_in_drain);
|
||||
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_enable_thermal_power_throttle);
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
|
||||
#define CREATE_TRACE_POINTS
|
||||
#include <trace/events/thermal_power_allocator.h>
|
||||
#undef CREATE_TRACE_POINTS
|
||||
#include <trace/hooks/thermal.h>
|
||||
|
||||
#include "thermal_core.h"
|
||||
|
||||
@@ -607,6 +609,7 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip)
|
||||
int ret;
|
||||
int switch_on_temp, control_temp;
|
||||
struct power_allocator_params *params = tz->governor_data;
|
||||
int enable = 1;
|
||||
|
||||
/*
|
||||
* We get called for every trip point but we only need to do
|
||||
@@ -615,9 +618,11 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip)
|
||||
if (trip != params->trip_max_desired_temperature)
|
||||
return 0;
|
||||
|
||||
ret = tz->ops->get_trip_temp(tz, params->trip_switch_on,
|
||||
&switch_on_temp);
|
||||
if (!ret && (tz->temperature < switch_on_temp)) {
|
||||
trace_android_vh_enable_thermal_power_throttle(&enable);
|
||||
if (enable)
|
||||
ret = tz->ops->get_trip_temp(tz, params->trip_switch_on,
|
||||
&switch_on_temp);
|
||||
if (!enable || (!ret && (tz->temperature < switch_on_temp))) {
|
||||
tz->passive = 0;
|
||||
reset_pid_controller(params);
|
||||
allow_maximum_power(tz);
|
||||
|
||||
@@ -27,6 +27,10 @@ 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_enable_thermal_power_throttle,
|
||||
TP_PROTO(int *enable),
|
||||
TP_ARGS(enable));
|
||||
|
||||
#endif /* _TRACE_HOOK_THERMAL_H */
|
||||
/* This part must be outside protection */
|
||||
#include <trace/define_trace.h>
|
||||
|
||||
Reference in New Issue
Block a user