Skip to contentSkip to conversation

thermal: core: add upper and lower limits to power_actor_set_power

PATCH Applied Michael Kao 3 participants 3 messages Oct 7, 2020 – Nov 24, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
 drivers/thermal/thermal_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_core.c +1 -1
index 72bf159bcecc..a260e4a575f3 100644
@@ -674,7 +674,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);
Signature · 1 line
2.18.0
reviewer Reviewed-by Tested-by on v2 1/1
#1 lore raw
Quoted 16 lines · Michael Kao

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.

---
  drivers/thermal/thermal_core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_core.c +0 -0
index 72bf159bcecc..a260e4a575f3 100644

drivers/thermal/thermal_core.c int power_actor_set_power(struct thermal_cooling_device *cdev, · line 680

Quoted 8 lines
drivers/thermal/thermal_core.c +1 -1
@@ -674,7 +674,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);

Please check the patch with scripts/checkpatch.pl before sending. It's again base64 encoded, I was able to apply it on my end with --ignore-whitespace, but still some odd char is there.

If Daniel is OK to fix it when applying to the thermal branch, then:

I would send a few patches on top of this one, to fully support the upper and lower limits in IPA.

Regards,
Lukasz

merge bot Applied
#2 lore raw

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

In reply to Michael Kao
The following commit has been merged into the thermal/next branch of thermal:

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 <[email protected]>
AuthorDate:    Wed, 07 Oct 2020 10:43:32 +08:00
Committer:     Daniel Lezcano <[email protected]>
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.

---
 drivers/thermal/thermal_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/thermal_core.c +1 -1
index c6d74bc..2ea3633 100644
@@ -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);