summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDaisuke Nojiri <dnojiri@chromium.org>2018-03-05 09:49:40 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-03-07 22:26:17 +0000
commit6d66a9cc7651a7ff6387f574c1d684ca05d7398a (patch)
treecf8542ac7aac61530afecbc5161a660ccf335ccf /include
parentce08db589ad87d10794cb7d93ed4decc5c01c8cf (diff)
downloadchrome-ec-6d66a9cc7651a7ff6387f574c1d684ca05d7398a.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 Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/949382 Reviewed-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 7f4018c41f875c7fbdff03ee4a489753d541b0a9) Change-Id: Iff17573f110e07e88d097dd848cf91ee98b83176 Reviewed-on: https://chromium-review.googlesource.com/953791 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Trybot-Ready: Furquan Shaikh <furquan@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/fan.h24
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