| #!/bin/sh |
| |
| # Copyright 2020 The Chromium OS Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| TZ_CONF_FILE=/etc/thermal_zone.conf |
| |
| # 'declare' config variables to keep Shellcheck happy |
| THERMAL_ZONES="" |
| THERMAL_GOVERNOR="" |
| |
| if [ ! -e "${TZ_CONF_FILE}" ]; then |
| exit 0 |
| fi |
| |
| # shellcheck source=/dev/null |
| . "${TZ_CONF_FILE}" |
| |
| for tz_path in /sys/class/thermal/thermal_zone*; do |
| tz_name=$(cat "${tz_path}/type"); |
| |
| for z in ${THERMAL_ZONES}; do |
| if [ "${z}" = "${tz_name}" ]; then |
| echo "${THERMAL_GOVERNOR}" > "${tz_path}/policy" |
| fi |
| done |
| done |