Commit 41ddbcc6 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki

thermal: gov_power_allocator: Use .manage() callback instead of .throttle()

The Power Allocator governor really only wants to be called once per
thermal zone update and it does a special check to skip the extra,
from its perspective, invocations of the .throttle() callback.

Make it use .manage() instead of .throttle().
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
parent 976f4413
...@@ -395,7 +395,7 @@ static void divvy_up_power(struct power_actor *power, int num_actors, ...@@ -395,7 +395,7 @@ static void divvy_up_power(struct power_actor *power, int num_actors,
} }
} }
static int allocate_power(struct thermal_zone_device *tz, int control_temp) static void allocate_power(struct thermal_zone_device *tz, int control_temp)
{ {
struct power_allocator_params *params = tz->governor_data; struct power_allocator_params *params = tz->governor_data;
unsigned int num_actors = params->num_actors; unsigned int num_actors = params->num_actors;
...@@ -410,7 +410,7 @@ static int allocate_power(struct thermal_zone_device *tz, int control_temp) ...@@ -410,7 +410,7 @@ static int allocate_power(struct thermal_zone_device *tz, int control_temp)
int i = 0, ret; int i = 0, ret;
if (!num_actors) if (!num_actors)
return -ENODEV; return;
/* Clean all buffers for new power estimations */ /* Clean all buffers for new power estimations */
memset(power, 0, params->buffer_size); memset(power, 0, params->buffer_size);
...@@ -471,8 +471,6 @@ static int allocate_power(struct thermal_zone_device *tz, int control_temp) ...@@ -471,8 +471,6 @@ static int allocate_power(struct thermal_zone_device *tz, int control_temp)
num_actors, power_range, num_actors, power_range,
max_allocatable_power, tz->temperature, max_allocatable_power, tz->temperature,
control_temp - tz->temperature); control_temp - tz->temperature);
return 0;
} }
/** /**
...@@ -745,40 +743,32 @@ static void power_allocator_unbind(struct thermal_zone_device *tz) ...@@ -745,40 +743,32 @@ static void power_allocator_unbind(struct thermal_zone_device *tz)
tz->governor_data = NULL; tz->governor_data = NULL;
} }
static int power_allocator_throttle(struct thermal_zone_device *tz, static void power_allocator_manage(struct thermal_zone_device *tz)
const struct thermal_trip *trip)
{ {
struct power_allocator_params *params = tz->governor_data; struct power_allocator_params *params = tz->governor_data;
const struct thermal_trip *trip = params->trip_switch_on;
bool update; bool update;
lockdep_assert_held(&tz->lock); lockdep_assert_held(&tz->lock);
/*
* We get called for every trip point but we only need to do
* our calculations once
*/
if (trip != params->trip_max)
return 0;
trip = params->trip_switch_on;
if (trip && tz->temperature < trip->temperature) { if (trip && tz->temperature < trip->temperature) {
update = tz->passive; update = tz->passive;
tz->passive = 0; tz->passive = 0;
reset_pid_controller(params); reset_pid_controller(params);
allow_maximum_power(tz, update); allow_maximum_power(tz, update);
return 0; return;
} }
tz->passive = 1; tz->passive = 1;
return allocate_power(tz, params->trip_max->temperature); allocate_power(tz, params->trip_max->temperature);
} }
static struct thermal_governor thermal_gov_power_allocator = { static struct thermal_governor thermal_gov_power_allocator = {
.name = "power_allocator", .name = "power_allocator",
.bind_to_tz = power_allocator_bind, .bind_to_tz = power_allocator_bind,
.unbind_from_tz = power_allocator_unbind, .unbind_from_tz = power_allocator_unbind,
.throttle = power_allocator_throttle, .manage = power_allocator_manage,
.update_tz = power_allocator_update_tz, .update_tz = power_allocator_update_tz,
}; };
THERMAL_GOVERNOR_DECLARE(thermal_gov_power_allocator); THERMAL_GOVERNOR_DECLARE(thermal_gov_power_allocator);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment