summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Richardson <wfrichar@chromium.org>2013-08-08 16:07:04 -0700
committerBill Richardson <wfrichar@chromium.org>2013-08-09 09:21:30 -0700
commit14463a22e1f78c4641571c64856ec111194067ad (patch)
treeb3688ca67bae1b8f379d2d0f3ed0059919810ec7
parent9392398bb78f7b266bcddc6c551a5268170ea056 (diff)
downloadchrome-ec-14463a22e1f78c4641571c64856ec111194067ad.tar.gz
Falco: set fan/thermal steps (BRANCH ONLY)
NOTE: This CL is for the branch only. It does NOT go into ToT. This sets the thermal steps and fan speeds as requested: Step Fan RPM trigger point (CPU Tj) unit K / 'C Step 1 2700 under 333K / 60'C Step 2 3000 333K / 60'C Step 3 3300 338K / 65'C Step 4 3600 343K / 70'C Step 5 3900 348K / 75'C Step 6 4200 353K / 80'C Step 7 4500 358K / 85'C Step 8 5000 363K / 90'C This also sets the CPU hot points to the following: 373K / 100C => assert PROCHOT 378K / 105C => give the CPU three second to cool off, then shutdown 383K / 110C => shutdown immediately BUG=chrome-os-partner:20805 BRANCH=falco,peppy ONLY! Not ToT! TEST=manual To test, I replaced the existing temp_sensor_read() function in common/temp_sensor.c with this: static int mock_temp; int temp_sensor_read(enum temp_sensor_id id, int *temp_ptr) { if (mock_temp >= 999) return EC_ERROR_UNKNOWN; if (mock_temp == 0) return EC_ERROR_NOT_POWERED; *temp_ptr = mock_temp; return EC_SUCCESS; } static int command_faketemp(int argc, char **argv) { if (argc < 2) return EC_ERROR_PARAM_COUNT; mock_temp = strtoi(argv[1], 0, 10); ccprintf("temp set to %dK\n", mock_temp); return EC_SUCCESS; } DECLARE_CONSOLE_COMMAND(faketemp, command_faketemp, "TEMP", "Enable thermal fan control", "0 = off, -1 = error, >0 = degrees K"); From the EC console, I could manually set the temps and watch the fan speed change. It followed the correct steps. Change-Id: I9b4b52e622de104ea98528387c359d0f05747426 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://gerrit.chromium.org/gerrit/65261 Reviewed-by: Duncan Laurie <dlaurie@chromium.org> Reviewed-by: Puneet Kumar <puneetster@chromium.org> Reviewed-by: Randall Spangler <rspangler@chromium.org>
-rw-r--r--common/thermal.c42
-rw-r--r--include/thermal.h12
2 files changed, 51 insertions, 3 deletions
diff --git a/common/thermal.c b/common/thermal.c
index 0015f5cca6..62770ec0a9 100644
--- a/common/thermal.c
+++ b/common/thermal.c
@@ -27,20 +27,56 @@
* temp_sensor_type. Threshold values for overheated action first (warning,
* prochot, power-down), followed by fan speed stepping thresholds.
*/
+
+/* DANGER WILL ROBINSON: This is an ugly hack, just for Falco & Peppy.
+ * DO NOT USE THIS AS AN EXAMPLE OF WHAT TO DO FOR ANY OTHER BOARD!!
+ */
+#ifdef BOARD_falco /* DON'T DO THIS */
test_export_static struct thermal_config_t
thermal_config[TEMP_SENSOR_TYPE_COUNT] = {
/* TEMP_SENSOR_TYPE_CPU */
{THERMAL_CONFIG_WARNING_ON_FAIL,
- {373, 378, 383, 327, 335, 343, 351, 359} } ,
+ {373, 378, 383,
+ 333, 338, 343, 348, 353, 358, 363} },
+ /* TEMP_SENSOR_TYPE_BOARD */
+ {THERMAL_CONFIG_NO_FLAG, {THERMAL_THRESHOLD_DISABLE_ALL} },
+ /* TEMP_SENSOR_TYPE_CASE */
+ {THERMAL_CONFIG_NO_FLAG, {THERMAL_THRESHOLD_DISABLE_ALL} },
+};
+test_export_static const int fan_speed[THERMAL_FAN_STEPS + 1] =
+{2700, 3000, 3300, 3600, 3900, 4200, 4500, 5000};
+#endif
+#ifdef BOARD_peppy /* DON'T DO THIS */
+test_export_static struct thermal_config_t
+ thermal_config[TEMP_SENSOR_TYPE_COUNT] = {
+ /* TEMP_SENSOR_TYPE_CPU */
+ {THERMAL_CONFIG_WARNING_ON_FAIL,
+ {373, 378, 383,
+ 327, 335, 343, 351, 359} } ,
/* TEMP_SENSOR_TYPE_BOARD */
{THERMAL_CONFIG_NO_FLAG, {THERMAL_THRESHOLD_DISABLE_ALL} },
/* TEMP_SENSOR_TYPE_CASE */
{THERMAL_CONFIG_NO_FLAG, {THERMAL_THRESHOLD_DISABLE_ALL} },
};
-
-/* Fan speed settings. Real max RPM is about 9300. */
test_export_static const int fan_speed[THERMAL_FAN_STEPS + 1] =
{0, 3000, 4575, 6150, 7725, -1};
+#endif
+#ifdef BOARD_host /* for testing */ /* DON'T DO THIS */
+test_export_static struct thermal_config_t
+ thermal_config[TEMP_SENSOR_TYPE_COUNT] = {
+ /* TEMP_SENSOR_TYPE_CPU */
+ {THERMAL_CONFIG_WARNING_ON_FAIL,
+ {373, 378, 383,
+ 327, 335, 343, 351, 359} } ,
+ /* TEMP_SENSOR_TYPE_BOARD */
+ {THERMAL_CONFIG_NO_FLAG, {THERMAL_THRESHOLD_DISABLE_ALL} },
+ /* TEMP_SENSOR_TYPE_CASE */
+ {THERMAL_CONFIG_NO_FLAG, {THERMAL_THRESHOLD_DISABLE_ALL} },
+};
+test_export_static const int fan_speed[THERMAL_FAN_STEPS + 1] =
+ {0, 3000, 4575, 6150, 7725, -1};
+#endif
+
/* Number of consecutive overheated events for each temperature sensor. */
static int8_t ot_count[TEMP_SENSOR_COUNT][THRESHOLD_COUNT + THERMAL_FAN_STEPS];
diff --git a/include/thermal.h b/include/thermal.h
index 3e43dfcd1a..5c391a6af6 100644
--- a/include/thermal.h
+++ b/include/thermal.h
@@ -17,7 +17,19 @@
* Number of steps for fan speed control. Speed of each step is defined
* in thermal.c.
*/
+
+/* DANGER WILL ROBINSON: This is an ugly hack, just for Falco & Peppy.
+ * DO NOT USE THIS AS AN EXAMPLE OF WHAT TO DO FOR ANY OTHER BOARD!!
+ */
+#ifdef BOARD_falco /* DON'T DO THIS */
+#define THERMAL_FAN_STEPS 7
+#endif
+#ifdef BOARD_peppy /* DON'T DO THIS */
+#define THERMAL_FAN_STEPS 5
+#endif
+#ifdef BOARD_host /* for testing */ /* DON'T DO THIS */
#define THERMAL_FAN_STEPS 5
+#endif
/* Set a threshold temperature to this value to disable the threshold limit. */
#define THERMAL_THRESHOLD_DISABLE 0