diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2016-01-12 05:01:12 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2016-01-12 05:01:12 -0500 |
commit | 1f16f116b01c110db20ab808562c8b8bc3ee3d6e (patch) | |
tree | 44db563f64cf5f8d62af8f99a61e2b248c44ea3a /drivers/thermal/power_allocator.c | |
parent | 03724ac3d48f8f0e3caf1d30fa134f8fd96c94e2 (diff) | |
parent | f9eccf24615672896dc13251410c3f2f33a14f95 (diff) |
Merge branches 'clockevents/4.4-fixes' and 'clockevents/4.5-fixes' of http://git.linaro.org/people/daniel.lezcano/linux into timers/urgent
Pull in fixes from Daniel Lezcano:
- Fix the vt8500 timer leading to a system lock up when dealing with too
small delta (Roman Volkov)
- Select the CLKSRC_MMIO when the fsl_ftm_timer is enabled with COMPILE_TEST
(Daniel Lezcano)
- Prevent to compile timers using the 'iomem' API when the architecture has
not HAS_IOMEM set (Richard Weinberger)
Diffstat (limited to 'drivers/thermal/power_allocator.c')
-rw-r--r-- | drivers/thermal/power_allocator.c | 24 |
1 files changed, 7 insertions, 17 deletions
diff --git a/drivers/thermal/power_allocator.c b/drivers/thermal/power_allocator.c index f0fbea386869..1246aa6fcab0 100644 --- a/drivers/thermal/power_allocator.c +++ b/drivers/thermal/power_allocator.c | |||
@@ -174,7 +174,6 @@ static void estimate_pid_constants(struct thermal_zone_device *tz, | |||
174 | /** | 174 | /** |
175 | * pid_controller() - PID controller | 175 | * pid_controller() - PID controller |
176 | * @tz: thermal zone we are operating in | 176 | * @tz: thermal zone we are operating in |
177 | * @current_temp: the current temperature in millicelsius | ||
178 | * @control_temp: the target temperature in millicelsius | 177 | * @control_temp: the target temperature in millicelsius |
179 | * @max_allocatable_power: maximum allocatable power for this thermal zone | 178 | * @max_allocatable_power: maximum allocatable power for this thermal zone |
180 | * | 179 | * |
@@ -191,7 +190,6 @@ static void estimate_pid_constants(struct thermal_zone_device *tz, | |||
191 | * Return: The power budget for the next period. | 190 | * Return: The power budget for the next period. |
192 | */ | 191 | */ |
193 | static u32 pid_controller(struct thermal_zone_device *tz, | 192 | static u32 pid_controller(struct thermal_zone_device *tz, |
194 | int current_temp, | ||
195 | int control_temp, | 193 | int control_temp, |
196 | u32 max_allocatable_power) | 194 | u32 max_allocatable_power) |
197 | { | 195 | { |
@@ -211,7 +209,7 @@ static u32 pid_controller(struct thermal_zone_device *tz, | |||
211 | true); | 209 | true); |
212 | } | 210 | } |
213 | 211 | ||
214 | err = control_temp - current_temp; | 212 | err = control_temp - tz->temperature; |
215 | err = int_to_frac(err); | 213 | err = int_to_frac(err); |
216 | 214 | ||
217 | /* Calculate the proportional term */ | 215 | /* Calculate the proportional term */ |
@@ -332,7 +330,6 @@ static void divvy_up_power(u32 *req_power, u32 *max_power, int num_actors, | |||
332 | } | 330 | } |
333 | 331 | ||
334 | static int allocate_power(struct thermal_zone_device *tz, | 332 | static int allocate_power(struct thermal_zone_device *tz, |
335 | int current_temp, | ||
336 | int control_temp) | 333 | int control_temp) |
337 | { | 334 | { |
338 | struct thermal_instance *instance; | 335 | struct thermal_instance *instance; |
@@ -418,8 +415,7 @@ static int allocate_power(struct thermal_zone_device *tz, | |||
418 | i++; | 415 | i++; |
419 | } | 416 | } |
420 | 417 | ||
421 | power_range = pid_controller(tz, current_temp, control_temp, | 418 | power_range = pid_controller(tz, control_temp, max_allocatable_power); |
422 | max_allocatable_power); | ||
423 | 419 | ||
424 | divvy_up_power(weighted_req_power, max_power, num_actors, | 420 | divvy_up_power(weighted_req_power, max_power, num_actors, |
425 | total_weighted_req_power, power_range, granted_power, | 421 | total_weighted_req_power, power_range, granted_power, |
@@ -444,8 +440,8 @@ static int allocate_power(struct thermal_zone_device *tz, | |||
444 | trace_thermal_power_allocator(tz, req_power, total_req_power, | 440 | trace_thermal_power_allocator(tz, req_power, total_req_power, |
445 | granted_power, total_granted_power, | 441 | granted_power, total_granted_power, |
446 | num_actors, power_range, | 442 | num_actors, power_range, |
447 | max_allocatable_power, current_temp, | 443 | max_allocatable_power, tz->temperature, |
448 | control_temp - current_temp); | 444 | control_temp - tz->temperature); |
449 | 445 | ||
450 | kfree(req_power); | 446 | kfree(req_power); |
451 | unlock: | 447 | unlock: |
@@ -612,7 +608,7 @@ static void power_allocator_unbind(struct thermal_zone_device *tz) | |||
612 | static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) | 608 | static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) |
613 | { | 609 | { |
614 | int ret; | 610 | int ret; |
615 | int switch_on_temp, control_temp, current_temp; | 611 | int switch_on_temp, control_temp; |
616 | struct power_allocator_params *params = tz->governor_data; | 612 | struct power_allocator_params *params = tz->governor_data; |
617 | 613 | ||
618 | /* | 614 | /* |
@@ -622,15 +618,9 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) | |||
622 | if (trip != params->trip_max_desired_temperature) | 618 | if (trip != params->trip_max_desired_temperature) |
623 | return 0; | 619 | return 0; |
624 | 620 | ||
625 | ret = thermal_zone_get_temp(tz, ¤t_temp); | ||
626 | if (ret) { | ||
627 | dev_warn(&tz->device, "Failed to get temperature: %d\n", ret); | ||
628 | return ret; | ||
629 | } | ||
630 | |||
631 | ret = tz->ops->get_trip_temp(tz, params->trip_switch_on, | 621 | ret = tz->ops->get_trip_temp(tz, params->trip_switch_on, |
632 | &switch_on_temp); | 622 | &switch_on_temp); |
633 | if (!ret && (current_temp < switch_on_temp)) { | 623 | if (!ret && (tz->temperature < switch_on_temp)) { |
634 | tz->passive = 0; | 624 | tz->passive = 0; |
635 | reset_pid_controller(params); | 625 | reset_pid_controller(params); |
636 | allow_maximum_power(tz); | 626 | allow_maximum_power(tz); |
@@ -648,7 +638,7 @@ static int power_allocator_throttle(struct thermal_zone_device *tz, int trip) | |||
648 | return ret; | 638 | return ret; |
649 | } | 639 | } |
650 | 640 | ||
651 | return allocate_power(tz, current_temp, control_temp); | 641 | return allocate_power(tz, control_temp); |
652 | } | 642 | } |
653 | 643 | ||
654 | static struct thermal_governor thermal_gov_power_allocator = { | 644 | static struct thermal_governor thermal_gov_power_allocator = { |