Lisa Nguyen | adf9df9 | 2015-01-25 18:16:45 -0800 | [diff] [blame] | 1 | #!/bin/sh |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 2 | # |
| 3 | # PM-QA validation test suite for the power management on Linux |
| 4 | # |
| 5 | # Copyright (C) 2011, Linaro Limited. |
| 6 | # |
| 7 | # This program is free software; you can redistribute it and/or |
| 8 | # modify it under the terms of the GNU General Public License |
| 9 | # as published by the Free Software Foundation; either version 2 |
| 10 | # of the License, or (at your option) any later version. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program; if not, write to the Free Software |
| 19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA |
| 20 | # |
| 21 | # Contributors: |
| 22 | # Amit Daniel <amit.kachhap@linaro.org> (Samsung Electronics) |
| 23 | # - initial API and implementation |
| 24 | # |
| 25 | |
| 26 | THERMAL_PATH="/sys/devices/virtual/thermal" |
| 27 | MAX_ZONE=0-12 |
| 28 | MAX_CDEV=0-50 |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 29 | scaling_freq_array="scaling_freq" |
| 30 | mode_array="mode_list" |
| 31 | thermal_gov_array="thermal_governor_backup" |
| 32 | thermal_zones=$(ls $THERMAL_PATH | grep "thermal_zone['$MAX_ZONE']") |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 33 | |
| 34 | check_valid_temp() { |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 35 | file=$1 |
| 36 | zone_name=$2 |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 37 | dir=$THERMAL_PATH/$zone_name |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 38 | |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 39 | temp_file=$dir/$file |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 40 | shift 2; |
| 41 | |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 42 | temp_val=$(cat $temp_file) |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 43 | descr="'$zone_name'/'$file' ='$temp_val'" |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 44 | log_begin "checking $descr" |
| 45 | |
hongbo.zhang | 2a303c9 | 2012-11-22 18:20:24 +0800 | [diff] [blame] | 46 | if [ $temp_val -gt 0 ]; then |
Sanjay Singh Rawat | 3ab6406 | 2014-07-08 16:50:56 +0200 | [diff] [blame] | 47 | log_end "Ok" |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 48 | return 0 |
| 49 | fi |
| 50 | |
Sanjay Singh Rawat | 3ab6406 | 2014-07-08 16:50:56 +0200 | [diff] [blame] | 51 | log_end "Err" |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 52 | |
| 53 | return 1 |
| 54 | } |
| 55 | |
| 56 | for_each_thermal_zone() { |
| 57 | |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 58 | thermal_func=$1 |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 59 | shift 1 |
| 60 | |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 61 | for thermal_zone in $thermal_zones; do |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 62 | INC=0 |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 63 | $thermal_func $thermal_zone $@ |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 64 | done |
| 65 | |
| 66 | return 0 |
| 67 | } |
| 68 | |
| 69 | get_total_trip_point_of_zone() { |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 70 | zone=$1 |
| 71 | zone_path=$THERMAL_PATH/$zone |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 72 | count=0 |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 73 | shift 1 |
| 74 | trips=$(ls $zone_path | grep "trip_point_['$MAX_ZONE']_temp") |
Amit Daniel Kachhap | 1fe389c | 2012-04-04 15:14:38 +0530 | [diff] [blame] | 75 | for trip in $trips; do |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 76 | count=$((count + 1)) |
| 77 | done |
| 78 | return $count |
| 79 | } |
| 80 | |
| 81 | for_each_trip_point_of_zone() { |
| 82 | |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 83 | zone_path=$THERMAL_PATH/$1 |
| 84 | count=0 |
| 85 | func=$2 |
| 86 | zone_name=$1 |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 87 | shift 2 |
| 88 | trips=$(ls $zone_path | grep "trip_point_['$MAX_ZONE']_temp") |
| 89 | for trip in $trips; do |
Amit Daniel Kachhap | 1fe389c | 2012-04-04 15:14:38 +0530 | [diff] [blame] | 90 | $func $zone_name $count |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 91 | count=$((count + 1)) |
| 92 | done |
| 93 | return 0 |
| 94 | } |
| 95 | |
| 96 | for_each_binding_of_zone() { |
| 97 | |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 98 | zone_path=$THERMAL_PATH/$1 |
| 99 | count=0 |
| 100 | func=$2 |
| 101 | zone_name=$1 |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 102 | shift 2 |
| 103 | trips=$(ls $zone_path | grep "cdev['$MAX_CDEV']_trip_point") |
| 104 | for trip in $trips; do |
Amit Daniel Kachhap | 1fe389c | 2012-04-04 15:14:38 +0530 | [diff] [blame] | 105 | $func $zone_name $count |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 106 | count=$((count + 1)) |
| 107 | done |
| 108 | |
| 109 | return 0 |
| 110 | |
| 111 | } |
| 112 | |
| 113 | check_valid_binding() { |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 114 | trip_point=$1 |
| 115 | zone_name=$2 |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 116 | dirpath=$THERMAL_PATH/$zone_name |
| 117 | temp_file=$zone_name/$trip_point |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 118 | trip_point_val=$(cat $dirpath/$trip_point) |
Amit Daniel Kachhap | 1fe389c | 2012-04-04 15:14:38 +0530 | [diff] [blame] | 119 | get_total_trip_point_of_zone $zone_name |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 120 | trip_point_max=$? |
| 121 | descr="'$temp_file' valid binding" |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 122 | shift 2 |
| 123 | |
| 124 | log_begin "checking $descr" |
Amit Daniel Kachhap | 23b5694 | 2012-05-05 15:18:29 +0530 | [diff] [blame] | 125 | if [ $trip_point_val -ge $trip_point_max ]; then |
Lisa Nguyen | 01a0286 | 2014-07-21 16:51:43 -0700 | [diff] [blame] | 126 | log_end "Err" |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 127 | return 1 |
| 128 | fi |
| 129 | |
Lisa Nguyen | 01a0286 | 2014-07-21 16:51:43 -0700 | [diff] [blame] | 130 | log_end "Ok" |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 131 | return 0 |
| 132 | } |
| 133 | |
| 134 | validate_trip_bindings() { |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 135 | zone_name=$1 |
| 136 | bind_no=$2 |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 137 | dirpath=$THERMAL_PATH/$zone_name |
| 138 | trip_point=cdev"$bind_no"_trip_point |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 139 | shift 2 |
| 140 | |
| 141 | check_file $trip_point $dirpath || return 1 |
| 142 | check_valid_binding $trip_point $zone_name || return 1 |
| 143 | } |
| 144 | |
| 145 | validate_trip_level() { |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 146 | zone_name=$1 |
| 147 | trip_no=$2 |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 148 | dirpath=$THERMAL_PATH/$zone_name |
| 149 | trip_temp=trip_point_"$trip_no"_temp |
| 150 | trip_type=trip_point_"$trip_no"_type |
Amit Daniel Kachhap | 199ea5d | 2012-03-26 16:07:35 +0530 | [diff] [blame] | 151 | shift 2 |
| 152 | |
| 153 | check_file $trip_temp $dirpath || return 1 |
| 154 | check_file $trip_type $dirpath || return 1 |
| 155 | check_valid_temp $trip_temp $zone_name || return 1 |
| 156 | } |
Amit Daniel Kachhap | 87adb0d | 2012-03-26 16:13:29 +0530 | [diff] [blame] | 157 | |
| 158 | for_each_cooling_device() { |
| 159 | |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 160 | cdev_func=$1 |
Amit Daniel Kachhap | 87adb0d | 2012-03-26 16:13:29 +0530 | [diff] [blame] | 161 | shift 1 |
| 162 | |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 163 | cooling_devices=$(ls $THERMAL_PATH | grep "cooling_device['$MAX_CDEV']") |
| 164 | if [ "$cooling_devices" = "" ]; then |
Sanjay Singh Rawat | 15bcbd5 | 2014-07-07 16:47:12 +0200 | [diff] [blame] | 165 | log_skip "no cooling devices" |
| 166 | return 0 |
| 167 | fi |
Amit Daniel Kachhap | 87adb0d | 2012-03-26 16:13:29 +0530 | [diff] [blame] | 168 | |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 169 | for cooling_device in $cooling_devices; do |
Amit Daniel Kachhap | 87adb0d | 2012-03-26 16:13:29 +0530 | [diff] [blame] | 170 | INC=0 |
Lisa Nguyen | 2d49a68 | 2015-01-26 20:27:48 -0800 | [diff] [blame] | 171 | $cdev_func $cooling_device $@ |
Amit Daniel Kachhap | 87adb0d | 2012-03-26 16:13:29 +0530 | [diff] [blame] | 172 | done |
| 173 | |
| 174 | return 0 |
| 175 | } |
Amit Daniel Kachhap | aa11958 | 2012-03-26 16:52:20 +0530 | [diff] [blame] | 176 | check_scaling_freq() { |
| 177 | |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 178 | before_freq_list=$1 |
| 179 | after_freq_list=$2 |
Amit Daniel Kachhap | aa11958 | 2012-03-26 16:52:20 +0530 | [diff] [blame] | 180 | shift 2 |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 181 | index=0 |
Amit Daniel Kachhap | aa11958 | 2012-03-26 16:52:20 +0530 | [diff] [blame] | 182 | |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 183 | flag=0 |
Lisa Nguyen | 188ca9a | 2014-08-11 12:21:08 -0700 | [diff] [blame] | 184 | for cpu in $cpus; do |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 185 | after_freq=$(eval echo \$$after_freq_list$index) |
| 186 | before_freq=$(eval echo \$$before_freq_list$index) |
| 187 | |
| 188 | if [ $after_freq -ne $before_freq ]; then |
| 189 | flag=1 |
| 190 | fi |
| 191 | |
| 192 | index=$((index + 1)) |
| 193 | done |
| 194 | |
Amit Daniel Kachhap | aa11958 | 2012-03-26 16:52:20 +0530 | [diff] [blame] | 195 | return $flag |
| 196 | } |
| 197 | |
| 198 | store_scaling_maxfreq() { |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 199 | index=0 |
Amit Daniel Kachhap | aa11958 | 2012-03-26 16:52:20 +0530 | [diff] [blame] | 200 | |
Lisa Nguyen | 188ca9a | 2014-08-11 12:21:08 -0700 | [diff] [blame] | 201 | for cpu in $cpus; do |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 202 | scaling_freq_max_value=$(cat $CPU_PATH/$cpu/cpufreq/scaling_max_freq) |
| 203 | eval $scaling_freq_array$index=$scaling_freq_max_value |
| 204 | eval echo $scaling_freq_array$index |
Amit Daniel Kachhap | aa11958 | 2012-03-26 16:52:20 +0530 | [diff] [blame] | 205 | done |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 206 | |
Amit Daniel Kachhap | aa11958 | 2012-03-26 16:52:20 +0530 | [diff] [blame] | 207 | return 0 |
| 208 | } |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 209 | |
| 210 | get_trip_id() { |
| 211 | |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 212 | trip_name=$1 |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 213 | shift 1 |
| 214 | |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 215 | id1=$(echo $trip_name|cut -c12) |
| 216 | id2=$(echo $trip_name|cut -c13) |
Amit Daniel Kachhap | d57a91c | 2012-03-26 17:06:54 +0530 | [diff] [blame] | 217 | if [ $id2 != "_" ]; then |
| 218 | id1=$(($id2 + 10*$id1)) |
| 219 | fi |
| 220 | return $id1 |
| 221 | } |
Amit Daniel Kachhap | 58b807b | 2012-04-04 12:23:08 +0530 | [diff] [blame] | 222 | |
| 223 | disable_all_thermal_zones() { |
| 224 | |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 225 | index=0 |
Amit Daniel Kachhap | 58b807b | 2012-04-04 12:23:08 +0530 | [diff] [blame] | 226 | |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 227 | for thermal_zone in $thermal_zones; do |
| 228 | mode=$(cat $THERMAL_PATH/$thermal_zone/mode) |
| 229 | eval $mode_array$index=$mode |
| 230 | eval export $mode_array$index |
Amit Daniel Kachhap | 58b807b | 2012-04-04 12:23:08 +0530 | [diff] [blame] | 231 | index=$((index + 1)) |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 232 | echo -n "disabled" > $THERMAL_PATH/$thermal_zone/mode |
Amit Daniel Kachhap | 58b807b | 2012-04-04 12:23:08 +0530 | [diff] [blame] | 233 | done |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 234 | |
Amit Daniel Kachhap | 58b807b | 2012-04-04 12:23:08 +0530 | [diff] [blame] | 235 | return 0 |
| 236 | } |
| 237 | |
| 238 | enable_all_thermal_zones() { |
| 239 | |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 240 | index=0 |
Amit Daniel Kachhap | 58b807b | 2012-04-04 12:23:08 +0530 | [diff] [blame] | 241 | |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 242 | for thermal_zone in $thermal_zones; do |
| 243 | mode=$(eval echo \$$mode_array$index) |
| 244 | echo $mode > $THERMAL_PATH/$thermal_zone/mode |
Amit Daniel Kachhap | 58b807b | 2012-04-04 12:23:08 +0530 | [diff] [blame] | 245 | index=$((index + 1)) |
| 246 | done |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 247 | |
Amit Daniel Kachhap | 58b807b | 2012-04-04 12:23:08 +0530 | [diff] [blame] | 248 | return 0 |
| 249 | } |
Hongbo Zhang | 4080751 | 2013-01-09 15:01:11 +0800 | [diff] [blame] | 250 | |
| 251 | GPU_HEAT_BIN=/usr/bin/glmark2 |
| 252 | gpu_pid=0 |
| 253 | |
| 254 | start_glmark2() { |
Hongbo Zhang | 0f6d3c9 | 2013-01-21 16:32:25 +0800 | [diff] [blame] | 255 | if [ -n "$ANDROID" ]; then |
| 256 | am start org.linaro.glmark2/.Glmark2Activity |
| 257 | return |
| 258 | fi |
| 259 | |
Hongbo Zhang | 4080751 | 2013-01-09 15:01:11 +0800 | [diff] [blame] | 260 | if [ -x $GPU_HEAT_BIN ]; then |
| 261 | $GPU_HEAT_BIN & |
| 262 | gpu_pid=$(pidof $GPU_HEAT_BIN) |
| 263 | # Starting X application from serial console needs this |
| 264 | if [ -z "$gpu_pid" ]; then |
| 265 | cp /etc/lightdm/lightdm.conf /etc/lightdm/lightdm.conf.bk |
| 266 | echo "autologin-user=root" >> /etc/lightdm/lightdm.conf |
| 267 | export DISPLAY=localhost:0.0 |
| 268 | restart lightdm |
| 269 | sleep 5 |
| 270 | mv /etc/lightdm/lightdm.conf.bk /etc/lightdm/lightdm.conf |
| 271 | $GPU_HEAT_BIN & |
| 272 | gpu_pid=$(pidof $GPU_HEAT_BIN) |
| 273 | fi |
| 274 | test -z "$gpu_pid" && cpu_pid=0 |
| 275 | echo "start gpu heat binary $gpu_pid" |
| 276 | else |
| 277 | echo "glmark2 not found." 1>&2 |
| 278 | fi |
| 279 | } |
| 280 | |
| 281 | kill_glmark2() { |
Hongbo Zhang | 0f6d3c9 | 2013-01-21 16:32:25 +0800 | [diff] [blame] | 282 | if [ -n "$ANDROID" ]; then |
| 283 | am kill org.linaro.glmark2 |
| 284 | return |
| 285 | fi |
| 286 | |
Sanjay Singh Rawat | c7af87b | 2013-12-15 13:30:37 +0530 | [diff] [blame] | 287 | if [ "$gpu_pid" -ne 0 ]; then |
Hongbo Zhang | 4080751 | 2013-01-09 15:01:11 +0800 | [diff] [blame] | 288 | kill -9 $gpu_pid |
| 289 | fi |
| 290 | } |
Javi Merino | 07b4b6b | 2014-09-23 16:57:45 +0530 | [diff] [blame] | 291 | |
| 292 | set_thermal_governors() { |
| 293 | |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 294 | gov=$1 |
| 295 | index=0 |
Javi Merino | 07b4b6b | 2014-09-23 16:57:45 +0530 | [diff] [blame] | 296 | |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 297 | for thermal_zone in $thermal_zones; do |
| 298 | policy=$(cat $THERMAL_PATH/$thermal_zone/policy) |
| 299 | eval $thermal_gov_array$index=$policy |
| 300 | eval export $thermal_gov_array$index |
Javi Merino | 07b4b6b | 2014-09-23 16:57:45 +0530 | [diff] [blame] | 301 | index=$((index + 1)) |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 302 | echo $gov > $THERMAL_PATH/$thermal_zone/policy |
Javi Merino | 07b4b6b | 2014-09-23 16:57:45 +0530 | [diff] [blame] | 303 | done |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 304 | |
Javi Merino | 07b4b6b | 2014-09-23 16:57:45 +0530 | [diff] [blame] | 305 | return 0 |
| 306 | } |
| 307 | |
| 308 | restore_thermal_governors() { |
| 309 | |
Lisa Nguyen | 4e0b59a | 2015-01-25 17:46:40 -0800 | [diff] [blame] | 310 | index=0 |
Javi Merino | 07b4b6b | 2014-09-23 16:57:45 +0530 | [diff] [blame] | 311 | |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 312 | for thermal_zone in $thermal_zones; do |
| 313 | old_policy=$(eval echo \$$thermal_gov_array$index) |
| 314 | echo $old_policy > $THERMAL_PATH/$thermal_zone/policy |
Javi Merino | 07b4b6b | 2014-09-23 16:57:45 +0530 | [diff] [blame] | 315 | index=$((index + 1)) |
| 316 | done |
Lisa Nguyen | 15e40ff | 2015-02-02 12:30:06 -0800 | [diff] [blame^] | 317 | |
Javi Merino | 07b4b6b | 2014-09-23 16:57:45 +0530 | [diff] [blame] | 318 | return 0 |
| 319 | } |