summaryrefslogtreecommitdiff
path: root/common/fan.c
diff options
context:
space:
mode:
Diffstat (limited to 'common/fan.c')
-rw-r--r--common/fan.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/common/fan.c b/common/fan.c
index f3ee013a4c..c91fa1b318 100644
--- a/common/fan.c
+++ b/common/fan.c
@@ -20,6 +20,11 @@
* things manually. */
static int thermal_control_enabled[CONFIG_FANS];
+int is_thermal_control_enabled(int idx)
+{
+ return thermal_control_enabled[idx];
+}
+
#ifdef CONFIG_FAN_UPDATE_PERIOD
/* Should we ignore the fans for a while? */
static int fan_update_counter[CONFIG_FANS];
@@ -72,7 +77,7 @@ test_mockable void fan_set_percent_needed(int fan, int pct)
{
int actual_rpm, new_rpm;
- if (!thermal_control_enabled[fan])
+ if (!is_thermal_control_enabled(fan))
return;
#ifdef CONFIG_FAN_UPDATE_PERIOD
@@ -195,7 +200,7 @@ static int cc_faninfo(int argc, char **argv)
ccprintf("%sMode: %s\n", leader,
fan_get_rpm_mode(FAN_CH(fan)) ? "rpm" : "duty");
ccprintf("%sAuto: %s\n", leader,
- thermal_control_enabled[fan] ? "yes" : "no");
+ is_thermal_control_enabled(fan) ? "yes" : "no");
ccprintf("%sEnable: %s\n", leader,
fan_get_enabled(FAN_CH(fan)) ? "yes" : "no");
is_pgood = is_powered(fan);
@@ -317,7 +322,7 @@ int dptf_get_fan_duty_target(void)
if (fan_count == 0)
return -1;
- if (thermal_control_enabled[fan] || fan_get_rpm_mode(FAN_CH(fan)))
+ if (is_thermal_control_enabled(fan) || fan_get_rpm_mode(FAN_CH(fan)))
return -1;
return fan_get_duty(FAN_CH(fan));
@@ -551,7 +556,7 @@ static void pwm_fan_preserve_state(void)
/* TODO(crosbug.com/p/23530): Still treating all fans as one. */
if (fan_get_enabled(FAN_CH(fan)))
state.flag |= FAN_STATE_FLAG_ENABLED;
- if (thermal_control_enabled[fan])
+ if (is_thermal_control_enabled(fan))
state.flag |= FAN_STATE_FLAG_THERMAL;
state.rpm = fan_get_rpm_target(FAN_CH(fan));