From e48a9d9c2143695cdd7a35ab06d6a6d5820efd9b Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Wed, 30 Oct 2013 10:38:31 -0700 Subject: Separate fan_t from pwm_t There is a logical difference between PWM controls for things like backlights and fan controls for actual fans. This change separates them into two different data structures, for better abstraction. BUG=chrome-os-partner:23530 BRANCH=none TEST=manual make runtests, make all boards, test on Link and Falco. Change-Id: Ib63f2d1518fcc2ee367f81bf5d803360c1aa5c76 Signed-off-by: Bill Richardson Reviewed-on: https://chromium-review.googlesource.com/175151 --- include/fan.h | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'include/fan.h') diff --git a/include/fan.h b/include/fan.h index 781bfc9951..4c41f2c175 100644 --- a/include/fan.h +++ b/include/fan.h @@ -8,13 +8,33 @@ #ifndef __CROS_EC_FAN_H #define __CROS_EC_FAN_H +/* Characteristic of each physical fan */ +struct fan_t { + unsigned int flags; + int rpm_min; + int rpm_max; + /* Hardware channel number (the meaning is chip-specific) */ + int ch; + /* Active-high power_good input GPIO, or -1 if none */ + int pgood_gpio; + /* Active-high power_enable output GPIO, or -1 if none */ + int enable_gpio; +}; + +/* Values for the flags field */ +#define FAN_USE_RPM_MODE (1 << 0) + +/* The list of fans is instantiated in board.c. */ +extern const struct fan_t fans[]; + + /** * Set the amount of active cooling needed. The thermal control task will call * this frequently, and the fan control logic will attempt to provide it. * * @param pct Percentage of cooling effort needed (0 - 100) */ -void fan_set_percent_needed(int pct); +void fan_set_percent_needed(int pct); /* HEY: need fan arg */ /** * This function translates the percentage of cooling needed into a target RPM. @@ -24,7 +44,7 @@ void fan_set_percent_needed(int pct); * @param pct Percentage of cooling effort needed (always in [0,100]) * Return Target RPM for fan */ -int fan_percent_to_rpm(int pct); +int fan_percent_to_rpm(int pct); /* HEY: need fan arg */ /** -- cgit v1.2.1