diff --git a/drivers/thermal/gov_power_allocator.c b/drivers/thermal/gov_power_allocator.c index ae9042c7f7b0..1f47321ee769 100644 --- a/drivers/thermal/gov_power_allocator.c +++ b/drivers/thermal/gov_power_allocator.c @@ -714,7 +714,8 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) int switch_on_temp, control_temp; struct power_allocator_params *params = tz->governor_data; bool update; - int enable = 1; + bool enable = true; + bool override = false; /* * We get called for every trip point but we only need to do @@ -723,11 +724,22 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) if (trip != params->trip_max_desired_temperature) return 0; - trace_android_vh_enable_thermal_power_throttle(&enable); + /* + * Enable or disable IPA control by temperature and user power budget. + * About enable: + * true: enable IPA control when temperature >= swtich_on_temp. + * false: disable IPA control when temperature < switch_on_temp. + * About override: + * true: power budget is overridden by user power budget. + * false: power budget is not overridden, there's no other thermal + * requirement. + */ + trace_android_vh_enable_thermal_power_throttle(&enable, &override); if (enable) ret = tz->ops->get_trip_temp(tz, params->trip_switch_on, &switch_on_temp); - if (!enable || (!ret && (tz->temperature < switch_on_temp))) { + if (!enable || (!ret && (tz->temperature < switch_on_temp) && + !override)) { update = (tz->last_temperature >= switch_on_temp); tz->passive = 0; reset_pid_controller(params); diff --git a/include/trace/hooks/thermal.h b/include/trace/hooks/thermal.h index 31127ee42718..1539adb571e2 100644 --- a/include/trace/hooks/thermal.h +++ b/include/trace/hooks/thermal.h @@ -27,8 +27,8 @@ DECLARE_HOOK(android_vh_thermal_unregister, TP_ARGS(policy)); DECLARE_HOOK(android_vh_enable_thermal_power_throttle, - TP_PROTO(int *enable), - TP_ARGS(enable)); + TP_PROTO(bool *enable, bool *override), + TP_ARGS(enable, override)); DECLARE_HOOK(android_vh_thermal_power_cap, TP_PROTO(u32 *power_range),