[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200917060031.6566-1-zhuguangqing83@gmail.com>
Date: Thu, 17 Sep 2020 14:00:31 +0800
From: zhuguangqing83@...il.com
To: amit.kachhap@...il.com, daniel.lezcano@...aro.org,
viresh.kumar@...aro.org, javi.merino@...nel.org,
rui.zhang@...el.com, amitk@...nel.org, zhuguangqing@...omi.com
Cc: linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] thermal/drivers/cpuidle_cooling: Change the set_cur_state function
From: zhuguangqing <zhuguangqing@...omi.com>
In the function cpuidle_cooling_set_cur_state(), if current_state is
not equal to state and both current_state and state are greater than
0(scene 4 as follows), then maybe it should stop->start or restart
idle_inject.
The scenes changed is as follows,
scene current_state state action
1 0 >0 start
2 0 0 do nothing
3 >0 0 stop
4 >0 && !=state >0 stop->start or restart
5 >0 && ==state >0 do nothing
Signed-off-by: zhuguangqing <zhuguangqing@...omi.com>
---
drivers/thermal/cpuidle_cooling.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/thermal/cpuidle_cooling.c b/drivers/thermal/cpuidle_cooling.c
index 78e3e8238116..868919ad3dda 100644
--- a/drivers/thermal/cpuidle_cooling.c
+++ b/drivers/thermal/cpuidle_cooling.c
@@ -113,7 +113,7 @@ static int cpuidle_cooling_get_cur_state(struct thermal_cooling_device *cdev,
/**
* cpuidle_cooling_set_cur_state - Set the current cooling state
* @cdev: the thermal cooling device
- * @state: the target state
+ * @state: the target state, max value is 100
*
* The function checks first if we are initiating the mitigation which
* in turn wakes up all the idle injection tasks belonging to the idle
@@ -130,6 +130,9 @@ static int cpuidle_cooling_set_cur_state(struct thermal_cooling_device *cdev,
unsigned long current_state = idle_cdev->state;
unsigned int runtime_us, idle_duration_us;
+ if (state > 100 || current_state == state)
+ return 0;
+
idle_cdev->state = state;
idle_inject_get_duration(ii_dev, &runtime_us, &idle_duration_us);
@@ -140,8 +143,11 @@ static int cpuidle_cooling_set_cur_state(struct thermal_cooling_device *cdev,
if (current_state == 0 && state > 0) {
idle_inject_start(ii_dev);
- } else if (current_state > 0 && !state) {
+ } else if (current_state > 0 && !state) {
idle_inject_stop(ii_dev);
+ } else {
+ idle_inject_stop(ii_dev);
+ idle_inject_start(ii_dev);
}
return 0;
--
2.17.1
Powered by blists - more mailing lists