diff options
author | Amit Daniel Kachhap <amit.kachhap@linaro.org> | 2012-04-04 12:23:08 +0530 |
---|---|---|
committer | zhanghongbo <hongbo.zhang@stericsson.com> | 2012-05-09 15:33:10 +0800 |
commit | 58b807b70ca6b685e7ed800a2a3ec6350040d459 (patch) | |
tree | 7a6a7e85c2809ba5762bfc1435919d59f47b06b7 | |
parent | 1fe389c9e757f16b02e80c3a6dd2d2a32e3d59cc (diff) |
Disable all thermal zones before verifying cpufreq cooling devices
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
-rw-r--r-- | include/thermal_functions.sh | 26 | ||||
-rwxr-xr-x | thermal/thermal_05.sh | 6 |
2 files changed, 28 insertions, 4 deletions
diff --git a/include/thermal_functions.sh b/include/thermal_functions.sh index ae6c9c0..692529c 100644 --- a/include/thermal_functions.sh +++ b/include/thermal_functions.sh @@ -212,3 +212,29 @@ get_trip_id() { fi return $id1 } + +disable_all_thermal_zones() { + + mode_list= + local index=0 + + local th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']") + for zone in $th_zones; do + mode_list[$index]=$(cat $THERMAL_PATH/$zone/mode) + index=$((index + 1)) + echo -n "disabled" > $THERMAL_PATH/$zone/mode + done + return 0 +} + +enable_all_thermal_zones() { + + local index=0 + + local th_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']") + for zone in $th_zones; do + echo $mode_list[$index] > $THERMAL_PATH/$zone/mode + index=$((index + 1)) + done + return 0 +} diff --git a/thermal/thermal_05.sh b/thermal/thermal_05.sh index 901fea1..e7e2710 100755 --- a/thermal/thermal_05.sh +++ b/thermal/thermal_05.sh @@ -33,7 +33,6 @@ verify_cpufreq_cooling_device_action() { local cdev_name=$1 shift 1 - local tzonepath=$THERMAL_PATH/thermal_zone0 local cpufreq_cdev=$(cat $dirpath/type) cat $dirpath/type | grep cpufreq if [ $? -ne 0 ] ; then @@ -42,8 +41,7 @@ verify_cpufreq_cooling_device_action() { local max_state=$(cat $dirpath/max_state) local prev_state_val=$(cat $dirpath/cur_state) - local prev_mode_val=$(cat $tzonepath/mode) - echo -n disabled > $tzonepath/mode + disable_all_thermal_zones local count=1 local before_scale_max=0 @@ -70,7 +68,7 @@ verify_cpufreq_cooling_device_action() { count=$((count+1)) done - echo $prev_mode_val > $tzonepath/mode + enable_all_thermal_zones echo $prev_state_val > $dirpath/cur_state } for_each_cooling_device verify_cpufreq_cooling_device_action |