summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-10-29 13:05:11 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-30 21:51:50 +0000
commitc7b930606b479d4747da224f6cf62fd8061e6af0 (patch)
tree71df4cab99a9598d429a3409f8416ec9490e9283 /include
parent1d0102ae2cccdb4e798c196b0e6445c167efe4b6 (diff)
downloadchrome-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 'include')
-rw-r--r--include/config.h2
-rw-r--r--include/fan.h32
2 files changed, 31 insertions, 3 deletions
diff --git a/include/config.h b/include/config.h
index a82af12158..6df1558e19 100644
--- a/include/config.h
+++ b/include/config.h
@@ -351,7 +351,7 @@
/*
* Replace the default fan mapping with a board-specific function in board.c:
*
- * int pwm_fan_percent_to_rpm(int pct);
+ * int fan_percent_to_rpm(int pct);
*
*/
#undef CONFIG_FAN_RPM_CUSTOM
diff --git a/include/fan.h b/include/fan.h
index 7af956baae..acae150fc0 100644
--- a/include/fan.h
+++ b/include/fan.h
@@ -14,7 +14,7 @@
*
* @param pct Percentage of cooling effort needed (0 - 100)
*/
-void pwm_fan_set_percent_needed(int pct);
+void fan_set_percent_needed(int pct);
/**
* This function translates the percentage of cooling needed into a target RPM.
@@ -24,6 +24,34 @@ void pwm_fan_set_percent_needed(int pct);
* @param pct Percentage of cooling effort needed (always in [0,100])
* Return Target RPM for fan
*/
-int pwm_fan_percent_to_rpm(int pct);
+int fan_percent_to_rpm(int pct);
+
+
+/**
+ * These functions require chip-specific implementations.
+ */
+
+void fan_set_enabled(int ch, int enabled);
+int fan_get_enabled(int ch);
+void fan_set_duty(int ch, int percent);
+int fan_get_duty(int ch);
+void fan_set_rpm_mode(int ch, int rpm_mode);
+int fan_get_rpm_mode(int ch);
+void fan_set_rpm_target(int ch, int rpm);
+int fan_get_rpm_actual(int ch);
+int fan_get_rpm_target(int ch);
+int fan_is_stalled(int ch);
+
+enum fan_status {
+ FAN_STATUS_STOPPED = 0,
+ FAN_STATUS_CHANGING = 1,
+ FAN_STATUS_LOCKED = 2,
+ FAN_STATUS_FRUSTRATED = 3
+};
+enum fan_status fan_get_status(int ch);
+
+/* Maintain target RPM using tach input */
+#define FAN_USE_RPM_MODE (1 << 0)
+void fan_channel_setup(int ch, unsigned int flags);
#endif /* __CROS_EC_FAN_H */