From: Christian Gmeiner <[email protected]>

The thermal core does not compare a new cooling state with the current
one. The fair_share governor sets the state on every zone update, and
the step_wise and bang_bang governors and sysfs can repeat a state as
well. Return early in this case instead of programming the same clock
again.

Signed-off-by: Christian Gmeiner <[email protected]>
---
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c 
b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
index 2a56bdf2510a..0a28e21feb8b 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_gpu.c
@@ -1786,6 +1786,11 @@ etnaviv_gpu_cooling_set_cur_state(struct 
thermal_cooling_device *cdev,
        struct etnaviv_gpu *gpu = cdev->devdata;
 
        mutex_lock(&gpu->lock);
+       if (state == gpu->freq_scale) {
+               mutex_unlock(&gpu->lock);
+               return 0;
+       }
+
        gpu->freq_scale = state;
        if (!pm_runtime_suspended(gpu->dev))
                etnaviv_gpu_update_clock(gpu);

-- 
2.56.0

Reply via email to