diff mbox series

[v2] thermal: core: add upper and lower limits to power_actor_set_power

Message ID 20201007024332.30322-1-michael.kao@mediatek.com (mailing list archive)
State Accepted, archived
Delegated to: Zhang Rui
Headers show
Series [v2] thermal: core: add upper and lower limits to power_actor_set_power | expand

Commit Message

Michael Kao Oct. 7, 2020, 2:43 a.m. UTC
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>
---
 drivers/thermal/thermal_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lukasz Luba Oct. 7, 2020, 10:55 a.m. UTC | #1
On 10/7/20 3:43 AM, Michael Kao wrote:
> 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>
> ---
>   drivers/thermal/thermal_core.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index 72bf159bcecc..a260e4a575f3 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -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:

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
Tested-by: Lukasz Luba <lukasz.luba@arm.com>

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

Regards,
Lukasz
diff mbox series

Patch

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index 72bf159bcecc..a260e4a575f3 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -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);