summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorHenry Hsu <Henry.Hsu@quantatw.com>2014-02-21 14:29:32 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-03-03 03:38:48 +0000
commit6cde07dff4f351708938fca3ef06ecab5e8f4ad9 (patch)
treec6d134a5a1143e4a9aeef59ff98ad93c14226509 /board
parentf2063ac00cd13d05b992a4cb1791ed3e979e3270 (diff)
downloadchrome-ec-6cde07dff4f351708938fca3ef06ecab5e8f4ad9.tar.gz
Glimmer: Fan table implement.
Glimmer define the thermal table for fan. The table is below: on off RPM 42 35 4000 48 39 4350 63 53 5150 SW Throttling: 65, HW Throttling: 67, EC Shutdown: 69. Where the temperature scale is celsius degree. BUG=chrome-os-partner:25076 BRANCH=glimmer TEST=Use external heater to change the temperature, the fan follows the fan table. Change-Id: I0ed69cdd538e66869c445de0e194fbd1e6eecc22 Signed-off-by: Henry Hsu <Henry.Hsu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/187774 Reviewed-by: Dave Parker <dparker@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/glimmer/board.c52
-rw-r--r--board/glimmer/board.h1
2 files changed, 51 insertions, 2 deletions
diff --git a/board/glimmer/board.c b/board/glimmer/board.c
index 690b1bf7aa..4a9f675ed1 100644
--- a/board/glimmer/board.c
+++ b/board/glimmer/board.c
@@ -11,6 +11,7 @@
#include "charge_state.h"
#include "charger.h"
#include "common.h"
+#include "console.h"
#include "driver/accel_kxcj9.h"
#include "driver/temp_sensor/tmp432.h"
#include "extpower.h"
@@ -37,6 +38,22 @@
#include "uart.h"
#include "util.h"
+#ifdef CONFIG_FAN_RPM_CUSTOM
+struct fan_step {
+ int lv0;
+ int lv1;
+ int lv2;
+ int lv3;
+};
+
+static struct fan_step fan_table = {
+ .lv0 = 0,
+ .lv1 = 4000,
+ .lv2 = 4350,
+ .lv3 = 5150,
+};
+#endif /* CONFIG_FAN_RPM_CUSTOM */
+
/* GPIO signal list. Must match order from enum gpio_signal. */
const struct gpio_info gpio_list[] = {
/* Inputs with interrupt handlers are first for efficiency */
@@ -226,7 +243,7 @@ struct ec_thermal_config thermal_params[] = {
{{0, 0, 0}, 0, 0},
{{0, 0, 0}, 0, 0},
{{0, 0, 0}, 0, 0},
- {{C_TO_K(80), C_TO_K(85), C_TO_K(88)}, C_TO_K(45), C_TO_K(70)},
+ {{C_TO_K(65), C_TO_K(67), C_TO_K(69)}, C_TO_K(20), C_TO_K(70)},
{{0, 0, 0}, 0, 0},
};
BUILD_ASSERT(ARRAY_SIZE(thermal_params) == TEMP_SENSOR_COUNT);
@@ -281,5 +298,36 @@ struct accel_orientation acc_orient = {
},
.hinge_axis = {1, 0, 0},
};
-
#endif /* HAS_TASK_MOTIONSENSE */
+
+#ifdef CONFIG_FAN_RPM_CUSTOM
+int fan_percent_to_rpm(int fan, int pct)
+{
+ int current_rpm_target = fan_get_rpm_target(fans[fan].ch);
+ int new_rpm_target = -1;
+
+ if (pct < 30)
+ new_rpm_target = fan_table.lv0;
+ else if (pct < 38)
+ new_rpm_target = (current_rpm_target > fan_table.lv0) ?
+ fan_table.lv1 : fan_table.lv0;
+ else if (pct < 44)
+ new_rpm_target = current_rpm_target;
+ else if (pct < 56)
+ new_rpm_target = (current_rpm_target > fan_table.lv0) ?
+ current_rpm_target : fan_table.lv1;
+ else if (pct < 66)
+ new_rpm_target = fan_table.lv2;
+ else if (pct < 86)
+ new_rpm_target = (current_rpm_target > fan_table.lv0) ?
+ current_rpm_target : fan_table.lv2;
+ else
+ new_rpm_target = fan_table.lv3;
+
+ if (new_rpm_target != current_rpm_target)
+ cprintf(CC_THERMAL, "[%T Setting fan RPM to %d]\n",
+ new_rpm_target);
+
+ return new_rpm_target;
+}
+#endif /* CONFIG_FAN_RPM_CUSTOM */
diff --git a/board/glimmer/board.h b/board/glimmer/board.h
index 189d3d9f01..a362e6e993 100644
--- a/board/glimmer/board.h
+++ b/board/glimmer/board.h
@@ -28,6 +28,7 @@
#define CONFIG_CMD_GSV
#define CONFIG_EXTPOWER_GPIO
#define CONFIG_FANS 1
+#define CONFIG_FAN_RPM_CUSTOM
#define CONFIG_I2C_PASSTHRU_RESTRICTED
#define CONFIG_KEYBOARD_COL2_INVERTED
#define CONFIG_KEYBOARD_IRQ_GPIO GPIO_KBD_IRQ_L