diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2018-03-05 09:49:40 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-03-06 09:59:21 -0800 |
commit | 7f4018c41f875c7fbdff03ee4a489753d541b0a9 (patch) | |
tree | cf8542ac7aac61530afecbc5161a660ccf335ccf /include/fan.h | |
parent | 9ea3cbecb8d3fca58baf4aff8d7e97480fe25860 (diff) | |
download | chrome-ec-7f4018c41f875c7fbdff03ee4a489753d541b0a9.tar.gz |
fan: Allow board to configure fans at run time
This patch splits struct fan_t into two parts: base configuration
and RPM configuration. RPMs are expected to be different from
model to model while a base configuration is most likely shared.
BUG=b:73720175
BRANCH=none
TEST=make buildall
Change-Id: Iff17573f110e07e88d097dd848cf91ee98b83176
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/949382
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/fan.h')
-rw-r--r-- | include/fan.h | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/include/fan.h b/include/fan.h index bd94ba8bd1..86c2822f80 100644 --- a/include/fan.h +++ b/include/fan.h @@ -8,13 +8,8 @@ #ifndef __CROS_EC_FAN_H #define __CROS_EC_FAN_H -/* Characteristic of each physical fan */ -struct fan_t { +struct fan_conf { unsigned int flags; - /* rpm_min is to keep turning. rpm_start is to begin turning */ - int rpm_min; - int rpm_start; - int rpm_max; /* Hardware channel number (the meaning is chip-specific) */ int ch; /* Active-high power_good input GPIO, or -1 if none */ @@ -23,6 +18,19 @@ struct fan_t { int enable_gpio; }; +struct fan_rpm { + /* rpm_min is to keep turning. rpm_start is to begin turning */ + int rpm_min; + int rpm_start; + int rpm_max; +}; + +/* Characteristic of each physical fan */ +struct fan_t { + const struct fan_conf *conf; + const struct fan_rpm *rpm; +}; + /* Values for .flags field */ /* Enable automatic RPM control using tach input */ #define FAN_USE_RPM_MODE (1 << 0) @@ -30,8 +38,10 @@ struct fan_t { #define FAN_USE_FAST_START (1 << 1) /* The list of fans is instantiated in board.c. */ -extern const struct fan_t fans[]; +extern struct fan_t fans[]; +/* For convenience */ +#define FAN_CH(fan) fans[fan].conf->ch /** * Set the amount of active cooling needed. The thermal control task will call |