Skip to content

Commit

Permalink
thermal: gov_power_allocator: Allow binding without trip points
Browse files Browse the repository at this point in the history
IPA probe function was recently refactored to perform extra error checks
and make sure the thermal zone has trip points necessary for the IPA
operation. With this change, if a thermal zone is probed such that it
has no trip points that IPA can use, IPA will fail and the TZ won't be
created. This is the case if a platform defines a TZ without cooling
devices and only with "hot"/"critical" trip points, often found on some
Qualcomm devices [1].

Documentation across IPA code (notably get_governor_trips() kerneldoc)
suggests that IPA is supposed to handle such TZ even if it won't
actually do anything.

This commit partially reverts the previous change to allow IPA to bind
to such "empty" thermal zones.

Fixes: e83747c ("thermal: gov_power_allocator: Set up trip points earlier")
Link: arch/arm64/boot/dts/qcom/sc7180.dtsi#n4776 # [1]
Signed-off-by: Nikita Travkin <nikita@trvn.ru>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Nikita Travkin authored and Rafael J. Wysocki committed Apr 3, 2024
1 parent 1057c4c commit da78193
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/thermal/gov_power_allocator.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,11 +679,6 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
return -ENOMEM;

get_governor_trips(tz, params);
if (!params->trip_max) {
dev_warn(&tz->device, "power_allocator: missing trip_max\n");
kfree(params);
return -EINVAL;
}

ret = check_power_actors(tz, params);
if (ret < 0) {
Expand Down Expand Up @@ -714,9 +709,10 @@ static int power_allocator_bind(struct thermal_zone_device *tz)
else
params->sustainable_power = tz->tzp->sustainable_power;

estimate_pid_constants(tz, tz->tzp->sustainable_power,
params->trip_switch_on,
params->trip_max->temperature);
if (params->trip_max)
estimate_pid_constants(tz, tz->tzp->sustainable_power,
params->trip_switch_on,
params->trip_max->temperature);

reset_pid_controller(params);

Expand Down

0 comments on commit da78193

Please sign in to comment.