diff mbox series

[thermal:,thermal/next] thermal: core: Add upper and lower limits to power_actor_set_power

Message ID 160621060566.11115.363303793358263038.tip-bot2@tip-bot2
State New
Headers show
Series [thermal:,thermal/next] thermal: core: Add upper and lower limits to power_actor_set_power | expand

Commit Message

thermal-bot for Julien Panis Nov. 24, 2020, 9:36 a.m. UTC
The following commit has been merged into the thermal/next branch of thermal:

Commit-ID:     4ab17ed1318609da5c36cb7e427a1d24e52a7d6f
Gitweb:        https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git//4ab17ed1318609da5c36cb7e427a1d24e52a7d6f
Author:        Michael Kao <michael.kao@mediatek.com>
AuthorDate:    Wed, 07 Oct 2020 10:43:32 +08:00
Committer:     Daniel Lezcano <daniel.lezcano@linaro.org>
CommitterDate: Mon, 26 Oct 2020 19:46:35 +01:00

thermal: core: Add upper and lower limits to power_actor_set_power

The upper and lower limits of thermal throttle state in the
DT do not apply to the Intelligent Power Allocation (IPA) governor.
Add the clamping for cooling device upper and lower limits in the
power_actor_set_power() used by IPA.

Signed-off-by: Michael Kao <michael.kao@mediatek.com>
Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Tested-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20201007024332.30322-1-michael.kao@mediatek.com
---
 drivers/thermal/thermal_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index c6d74bc..2ea3633 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -672,7 +672,7 @@  int power_actor_set_power(struct thermal_cooling_device *cdev,
 	if (ret)
 		return ret;
 
-	instance->target = state;
+	instance->target = clamp_val(state, instance->lower, instance->upper);
 	mutex_lock(&cdev->lock);
 	cdev->updated = false;
 	mutex_unlock(&cdev->lock);