diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/falco/board.c | 2 | ||||
-rw-r--r-- | board/host/build.mk | 1 | ||||
-rw-r--r-- | board/host/fan.c | 67 |
3 files changed, 69 insertions, 1 deletions
diff --git a/board/falco/board.c b/board/falco/board.c index 23da16230d..3e8b88da69 100644 --- a/board/falco/board.c +++ b/board/falco/board.c @@ -255,7 +255,7 @@ int board_discharge_on_ac(int enable) * And never turn it off. Bah. That'll do wonders for battery life. */ #ifdef CONFIG_FAN_RPM_CUSTOM -int pwm_fan_percent_to_rpm(int pct) +int fan_percent_to_rpm(int pct) { const int FAN_MAX = 5050; const int FAN_MIN = 2700; diff --git a/board/host/build.mk b/board/host/build.mk index 21e5383d86..4448f4b0b3 100644 --- a/board/host/build.mk +++ b/board/host/build.mk @@ -11,3 +11,4 @@ CHIP:=host board-y=board.o board-$(HAS_TASK_CHIPSET)+=chipset.o board-$(CONFIG_BATTERY_MOCK)+=battery.o charger.o +board-$(CONFIG_FAN)+=fan.o diff --git a/board/host/fan.c b/board/host/fan.c new file mode 100644 index 0000000000..b7a10de05c --- /dev/null +++ b/board/host/fan.c @@ -0,0 +1,67 @@ +/* Copyright (c) 2013 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. + */ + +/* Mocked fan implementation for tests */ + +#include "fan.h" + +static int mock_enabled; +void fan_set_enabled(int ch, int enabled) +{ + mock_enabled = enabled; +} +int fan_get_enabled(int ch) +{ + return mock_enabled; +} + +static int mock_percent; +void fan_set_duty(int ch, int percent) +{ + mock_percent = percent; +} +int fan_get_duty(int ch) +{ + return mock_percent; +} + +static int mock_rpm_mode; +void fan_set_rpm_mode(int ch, int rpm_mode) +{ + mock_rpm_mode = rpm_mode; +} +int fan_get_rpm_mode(int ch) +{ + return mock_rpm_mode; +} + +static int mock_rpm; +void fan_set_rpm_target(int ch, int rpm) +{ + mock_rpm = rpm; +} +int fan_get_rpm_actual(int ch) +{ + return mock_rpm; +} +int fan_get_rpm_target(int ch) +{ + return mock_rpm; +} + +enum fan_status fan_get_status(int ch) +{ + return FAN_STATUS_LOCKED; +} + +int fan_is_stalled(int ch) +{ + return 0; +} + +void fan_channel_setup(int ch, unsigned int flags) +{ + /* nothing to do */ +} |