aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2014-09-23 16:57:45 +0530
committerSanjay Singh Rawat <sanjay.rawat@linaro.org>2014-09-24 11:10:55 +0530
commit07b4b6b0b1faf0dd3e37d442f2d2867fc85471fe (patch)
treeff997d9bd0472338e8d8de0081329cc40533c0c1
parent9111d1930f02337394cf16e84ad2a27f33607cbb (diff)
thermal: don't allow the thermal governor to change cdev states in thermal_02
When running thermal_02, the thermal governor can decide to change the cooling device state between setting the state and reading the state, so this test may fail. To prevent it, switch all the thermal zones to the user_space thermal governor before running the test. This governor never touches cooling devices. Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: Sanjay Singh Rawat <sanjay.rawat@linaro.org>
-rw-r--r--include/thermal_functions.sh27
-rwxr-xr-xthermal/thermal_02.sh6
2 files changed, 32 insertions, 1 deletions
diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh
index c25e1d8..4fbd4b7 100644
--- a/include/thermal_functions.sh
+++ b/include/thermal_functions.sh
@@ -283,3 +283,30 @@ kill_glmark2() {
kill -9 $gpu_pid
fi
}
+
+set_thermal_governors() {
+
+ local gov=$1
+ local index=0
+ thermal_governor_backup[MAX_ZONE]=
+
+ local th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+ for zone in $th_zones; do
+ thermal_governor_backup[$index]=$(cat $THERMAL_PATH/$zone/policy)
+ index=$((index + 1))
+ echo $gov > $THERMAL_PATH/$zone/policy
+ done
+ return 0
+}
+
+restore_thermal_governors() {
+
+ local index=0
+
+ local th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']")
+ for zone in $th_zones; do
+ echo ${thermal_governor_backup[$index]} > $THERMAL_PATH/$zone/policy
+ index=$((index + 1))
+ done
+ return 0
+}
diff --git a/thermal/thermal_02.sh b/thermal/thermal_02.sh
index 1ff59b2..1f53612 100755
--- a/thermal/thermal_02.sh
+++ b/thermal/thermal_02.sh
@@ -60,7 +60,11 @@ check_cooling_device_states() {
echo $prev_state_val > $dirpath/cur_state
}
-for_each_cooling_device check_cooling_device_attributes
+set_thermal_governors user_space
+for_each_cooling_device check_cooling_device_attributes
for_each_cooling_device check_cooling_device_states
+
+restore_thermal_governors
+
test_status_show