diff options
author | Bill Richardson <wfrichar@chromium.org> | 2015-01-13 13:10:26 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-01-14 03:15:41 +0000 |
commit | 754ae5a942fd17a6535376289ca9a836a418635d (patch) | |
tree | 1e11a1770be6de516e2eeabfca75967a51b254e3 | |
parent | a989f13843a3e6301262d9c7ed8d3c36141fb94d (diff) | |
download | chrome-ec-754ae5a942fd17a6535376289ca9a836a418635d.tar.gz |
Show the fan-cooling percentage for each active temp sensor
When displaying the temps, if the sensor has valid entries to
control the target fan speed, show them. This lets us see which
sensor is the main player in the cooling needed without doing a
bunch of math.
BUG=none
BRANCH=none
TEST=manual
On the EC console:
> thermalget
sensor warn high halt fan_off fan_max name
0 368 370 372 316 358 PECI
1 0 0 0 0 0 ECInternal
2 0 0 0 314 328 I2C-Charger-Die
3 0 0 0 0 0 I2C-Charger-Object
4 0 0 0 308 322 I2C-CPU-Die
5 0 0 0 0 0 I2C-CPU-Object
6 0 0 0 301 317 I2C-Left C-Die
7 0 0 0 0 0 I2C-Left C-Object
8 0 0 0 302 316 I2C-Right C-Die
9 0 0 0 0 0 I2C-Right C-Object
10 0 0 0 303 317 I2C-Right D-Die
11 0 0 0 0 0 I2C-Right D-Object
12 0 0 0 316 327 I2C-Left D-Die
13 0 0 0 0 0 I2C-Left D-Object
Then, before this CL:
> temps
PECI : 308 K = 35 C
ECInternal : 309 K = 36 C
I2C-Charger-Die : 307 K = 34 C
I2C-Charger-Object : Not calibrated
I2C-CPU-Die : 304 K = 31 C
I2C-CPU-Object : Not calibrated
I2C-Left C-Die : 302 K = 29 C
I2C-Left C-Object : Not calibrated
I2C-Right C-Die : 303 K = 30 C
I2C-Right C-Object : Not calibrated
I2C-Right D-Die : 303 K = 30 C
I2C-Right D-Object : Not calibrated
I2C-Left D-Die : 306 K = 33 C
I2C-Left D-Object : Not calibrated
After this CL:
> temps
PECI : 308 K = 35 C 0%
ECInternal : 309 K = 36 C
I2C-Charger-Die : 307 K = 34 C 0%
I2C-Charger-Object : Not calibrated
I2C-CPU-Die : 304 K = 31 C 0%
I2C-CPU-Object : Not calibrated
I2C-Left C-Die : 302 K = 29 C 6%
I2C-Left C-Object : Not calibrated
I2C-Right C-Die : 303 K = 30 C 7%
I2C-Right C-Object : Not calibrated
I2C-Right D-Die : 303 K = 30 C 0%
I2C-Right D-Object : Not calibrated
I2C-Left D-Die : 306 K = 33 C 0%
I2C-Left D-Object : Not calibrated
Change-Id: I12bca5826e8a5a3325710fa5d39cec88f1cc95b1
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/240517
-rw-r--r-- | common/temp_sensor.c | 11 | ||||
-rw-r--r-- | common/thermal.c | 8 | ||||
-rw-r--r-- | include/thermal.h | 3 |
3 files changed, 17 insertions, 5 deletions
diff --git a/common/temp_sensor.c b/common/temp_sensor.c index 9be87d9ece..4f1a8d7701 100644 --- a/common/temp_sensor.c +++ b/common/temp_sensor.c @@ -11,6 +11,7 @@ #include "host_command.h" #include "task.h" #include "temp_sensor.h" +#include "thermal.h" #include "timer.h" #include "util.h" @@ -109,7 +110,15 @@ static int command_temps(int argc, char **argv) switch (rv) { case EC_SUCCESS: - ccprintf("%d K = %d C\n", t, K_TO_C(t)); + ccprintf("%d K = %d C", t, K_TO_C(t)); + if (thermal_params[i].temp_fan_off && + thermal_params[i].temp_fan_max) + ccprintf(" %d%%", + thermal_fan_percent( + thermal_params[i].temp_fan_off, + thermal_params[i].temp_fan_max, + t)); + ccprintf("\n"); break; case EC_ERROR_NOT_POWERED: ccprintf("Not powered\n"); diff --git a/common/thermal.c b/common/thermal.c index 742430e6bb..066331275f 100644 --- a/common/thermal.c +++ b/common/thermal.c @@ -121,7 +121,7 @@ test_mockable_static void smi_sensor_failure_warning(void) host_set_single_event(EC_HOST_EVENT_THERMAL); } -static int fan_percent(int low, int high, int cur) +int thermal_fan_percent(int low, int high, int cur) { if (cur < low) return 0; @@ -181,9 +181,9 @@ static void thermal_control(void) /* figure out the max fan needed, too */ if (thermal_params[i].temp_fan_off && thermal_params[i].temp_fan_max) { - f = fan_percent(thermal_params[i].temp_fan_off, - thermal_params[i].temp_fan_max, - t); + f = thermal_fan_percent(thermal_params[i].temp_fan_off, + thermal_params[i].temp_fan_max, + t); if (f > fmax) fmax = f; } diff --git a/include/thermal.h b/include/thermal.h index d3729591a0..77b513aacc 100644 --- a/include/thermal.h +++ b/include/thermal.h @@ -16,4 +16,7 @@ */ extern struct ec_thermal_config thermal_params[]; +/* Helper function to compute percent cooling */ +int thermal_fan_percent(int low, int high, int cur); + #endif /* __CROS_EC_THERMAL_H */ |