ANDROID: thermal: Add a vendor hook for thermal throttle update

Commit 602c233f65 added a conditional for
ops->get_trip_temp(). In the original code,
ops->get_trip_temp() is called unconditionally. So delete
the conditional to fix it. At the same time, modify the
comment of enable. Actually, IPA is always enable, but
sometimes it needs to be disabled for a while. Making
'enable' true or false, IPA can be enabled or disabled by
user requirement.

When the 'override' turns to false from true and current
temperature is below the switch_on_temp(means 'update' is
false), the cooling device state has not changed, also
the power could not be updated to the maximum power. So
add a vendor hook to renew the 'update' value, so that the
cooling device can be updated.

Fixes: 602c233f65 ("ANDROID: thermal: Add a flag for vendor hook enable_thermal_power_throttle")
Bug: 271370056
Signed-off-by: Di Shen <di.shen@unisoc.com>
Change-Id: I43191926f8da9016fe76d7cb78639b1cbd89c53e
This commit is contained in:
Di Shen
2023-03-02 14:37:39 +08:00
parent e013dc7081
commit 683fe954dc
3 changed files with 10 additions and 5 deletions

View File

@@ -313,6 +313,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_thermal_unregister);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rproc_recovery_set);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_disable_thermal_cooling_stats);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_enable_thermal_power_throttle);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_modify_thermal_throttle_update);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_init);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_wake);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_rwsem_write_finished);

View File

@@ -725,22 +725,22 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip)
return 0;
/*
* Enable or disable IPA control by temperature and user power budget.
* Control the IPA by user.
* About enable:
* true: enable IPA control when temperature >= swtich_on_temp.
* false: disable IPA control when temperature < switch_on_temp.
* true: enable IPA control.
* false: disable IPA control.
* 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,
ret = tz->ops->get_trip_temp(tz, params->trip_switch_on,
&switch_on_temp);
if (!enable || (!ret && (tz->temperature < switch_on_temp) &&
!override)) {
update = (tz->last_temperature >= switch_on_temp);
trace_android_vh_modify_thermal_throttle_update(tz, &update);
tz->passive = 0;
reset_pid_controller(params);
allow_maximum_power(tz, update);

View File

@@ -38,6 +38,10 @@ DECLARE_HOOK(android_vh_enable_thermal_power_throttle,
TP_PROTO(bool *enable, bool *override),
TP_ARGS(enable, override));
DECLARE_HOOK(android_vh_modify_thermal_throttle_update,
TP_PROTO(struct thermal_zone_device *tz, bool *update),
TP_ARGS(tz, update));
DECLARE_HOOK(android_vh_thermal_power_cap,
TP_PROTO(u32 *power_range),
TP_ARGS(power_range));