diff options
author | Bill Richardson <wfrichar@chromium.org> | 2013-10-29 13:05:11 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2013-10-30 21:51:50 +0000 |
commit | c7b930606b479d4747da224f6cf62fd8061e6af0 (patch) | |
tree | 71df4cab99a9598d429a3409f8416ec9490e9283 /board | |
parent | 1d0102ae2cccdb4e798c196b0e6445c167efe4b6 (diff) | |
download | chrome-ec-c7b930606b479d4747da224f6cf62fd8061e6af0.tar.gz |
Separate common fan behavior from implementation
This looks like a lot, but it's really just moving the non-board-specific
stuff from chip/lm4/fan.c into common/fan.c, updating the appropriate
headers, and renaming functions to better match the new location.
This is entirely code refactoring and renaming. No new functionality.
BUG=chrome-os-partner:23530
BRANCH=none
TEST=manual
make runtests, build all platforms, build and test on Link.
Change-Id: I7dc03d6732bad83cf838a86600b42a7cff5aa7aa
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/175012
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 */ +} |