summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorVic (Chun-Ju) Yang <victoryang@chromium.org>2013-11-29 12:20:22 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-12-04 13:34:56 +0000
commit06e60734910d952830c2102cd2ab002ddc99029b (patch)
tree9d1f1ba042987e5d81e26bf8acedbe463c74d282 /board
parent715ad86d43f0695363d3749f2c202f5e3f7e3bd2 (diff)
downloadchrome-ec-06e60734910d952830c2102cd2ab002ddc99029b.tar.gz
mec1322: Fan control driver
This adds the driver for PWM duty cycle based and RPM based fan control. BUG=chrome-os-partner:24107 TEST='fanset 5000' and fan spins up. 'fanset 8000' and fan spins faster. 'fanset 0' and fan stops. 'fanduty 30' and fan spins up. 'fanduty 50' and fan spins faster. 'fanduty 30' and fan slows down. 'fanset 6000' and fan goes to ~6000 RPM. Unplug fan power and see 'fan 0 stalled'. Plug power back and doesn't see stall warning anymore. BRANCH=None Change-Id: Ice3e5c03686cde57894e888e34ae2070c33b4e4d Signed-off-by: Vic (Chun-Ju) Yang <victoryang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/178402
Diffstat (limited to 'board')
-rw-r--r--board/mec1322_evb/board.c15
-rw-r--r--board/mec1322_evb/board.h1
2 files changed, 16 insertions, 0 deletions
diff --git a/board/mec1322_evb/board.c b/board/mec1322_evb/board.c
index d2638056a3..73a2a19bb4 100644
--- a/board/mec1322_evb/board.c
+++ b/board/mec1322_evb/board.c
@@ -4,6 +4,7 @@
*/
/* MEC1322 eval board-specific configuration */
+#include "fan.h"
#include "gpio.h"
#include "registers.h"
#include "util.h"
@@ -23,5 +24,19 @@ BUILD_ASSERT(ARRAY_SIZE(gpio_list) == GPIO_COUNT);
/* Pins with alternate functions */
const struct gpio_alt_func gpio_alt_funcs[] = {
{GPIO_PORT(16), 0x24, 1, MODULE_UART}, /* UART0 */
+ {GPIO_PORT(3), (1 << 4), 3, MODULE_PWM_FAN},
+ {GPIO_PORT(14), (1 << 0), 3, MODULE_PWM_FAN},
};
const int gpio_alt_funcs_count = ARRAY_SIZE(gpio_alt_funcs);
+
+/* Physical fans. These are logically separate from pwm_channels. */
+const struct fan_t fans[] = {
+ {.flags = FAN_USE_RPM_MODE,
+ .rpm_min = 1500,
+ .rpm_max = 8000,
+ .ch = 0,
+ .pgood_gpio = -1,
+ .enable_gpio = -1,
+ },
+};
+BUILD_ASSERT(ARRAY_SIZE(fans) == CONFIG_FANS);
diff --git a/board/mec1322_evb/board.h b/board/mec1322_evb/board.h
index 6d44570dbb..128a66fb17 100644
--- a/board/mec1322_evb/board.h
+++ b/board/mec1322_evb/board.h
@@ -11,6 +11,7 @@
/* Optional features */
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands */
#define CONFIG_WATCHDOG_HELP
+#define CONFIG_FANS 1
/* Modules we want to exclude */
#undef CONFIG_EEPROM