summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-10-30 10:38:31 -0700
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2013-10-30 23:10:10 +0000
commite48a9d9c2143695cdd7a35ab06d6a6d5820efd9b (patch)
treee7a3a92ac80fadf61dd1b7df16e62c9f48fcd9c0 /include
parent034e96c128d0e1ee7c100c47456c2159a133288c (diff)
downloadchrome-ec-e48a9d9c2143695cdd7a35ab06d6a6d5820efd9b.tar.gz
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 <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/175151
Diffstat (limited to 'include')
-rw-r--r--include/config.h22
-rw-r--r--include/fan.h24
-rw-r--r--include/pwm.h3
3 files changed, 27 insertions, 22 deletions
diff --git a/include/config.h b/include/config.h
index 1d7758d7e1..05f085f180 100644
--- a/include/config.h
+++ b/include/config.h
@@ -332,27 +332,9 @@
/* Number of cooling fans. Undef if none. */
#undef CONFIG_FANS
-/* Fan channel (not PWM channel) for the CPU fan */
-#undef CONFIG_FAN_CH_CPU
-
-/* Name of active high GPIO to control power to the cooling fan */
-#undef CONFIG_FAN_EN_GPIO
-
-/*
- * GPIO which indicates power-good on the fan power rail. If defined, the
- * faninfo console command will display the fan power state.
- */
-#undef CONFIG_FAN_PGOOD_GPIO
-
-/* Fan speeds corresponding to 1% and 100% cooling (0% == off). */
-#undef CONFIG_FAN_RPM_MIN
-#undef CONFIG_FAN_RPM_MAX
-
/*
- * Replace the default fan mapping with a board-specific function in board.c:
- *
- * int fan_percent_to_rpm(int pct);
- *
+ * Replace the default fan_percent_to_rpm() function with a board-specific
+ * implementation in board.c
*/
#undef CONFIG_FAN_RPM_CUSTOM
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 */
/**
diff --git a/include/pwm.h b/include/pwm.h
index cb0f961713..c4ae331b1c 100644
--- a/include/pwm.h
+++ b/include/pwm.h
@@ -6,6 +6,9 @@
#ifndef __CROS_EC_PWM_H
#define __CROS_EC_PWM_H
+/* The values are defined in board.h */
+enum pwm_channel;
+
/**
* Enable/disable a PWM channel.
*/