| # Copyright 2018 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. |
| |
| description "Workaround for Fizz fan issue" |
| author "chromium-os-dev@chromium.org" |
| |
| start on started boot-services |
| |
| task |
| |
| script |
| fan_info=$(ectool pwmgetfanrpm || :) |
| logger -t "${UPSTART_JOB}" "${fan_info}" |
| if [ "${fan_info}" = "Fan 0 RPM: 0" ]; then |
| # Get the highest value of the 3 thermal sensors on Fizz board. |
| temp=$(ectool temps all | sed -E 's/.*: ([0-9]*).*/\1/g' | sort -nr | head -n1) |
| while [ ${temp} -lt 305 ]; do |
| # In normal use case, it takes about 1 min for the temperature to go up 5 |
| # degrees with fan rpm 0. So 20s shuld be a reasonalbe checking cycle here. |
| sleep 20 |
| temp=$(ectool temps all | sed -E 's/.*: ([0-9]*).*/\1/g' | sort -nr | head -n1) |
| done |
| logger -t "${UPSTART_JOB}" "Set Fan 0 rpm to 2800." |
| ectool pwmsetfanrpm 2800 || : |
| ectool autofanctrl || : |
| sleep 2 |
| fan_info=$(ectool pwmgetfanrpm || :) |
| logger -t "${UPSTART_JOB}" "${fan_info}" |
| fi |
| end script |