diff options
author | Vijay Hiremath <vijay.p.hiremath@intel.com> | 2021-01-20 22:37:30 -0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-08 18:37:13 +0000 |
commit | 2939dd85315f329f85792f6a8a6ef7db8f5546ba (patch) | |
tree | 62dc425432ce4925dca1a29566aa61beca71d711 | |
parent | 25b7400dcb42e54e27dabfba60d35f46dab41097 (diff) | |
download | chrome-ec-2939dd85315f329f85792f6a8a6ef7db8f5546ba.tar.gz |
thermal: Print temperature sensor values before shutting down AP
On a thermal shutdown print temperature sensor values before shutting
down AP so that it is easy to track which sensor is high.
BUG=none
BRANCH=none
TEST=Tested on Terrador, able to print temperature sensor values
before chipset shutdown is called.
Signed-off-by: Vijay Hiremath <vijay.p.hiremath@intel.com>
Change-Id: I02b59d0409c275809af39dee4f409774c55e4462
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2639151
Reviewed-by: Sooraj Govindan <sooraj.govindan@intel.com>
Reviewed-by: Keith Short <keithshort@chromium.org>
-rw-r--r-- | common/temp_sensor.c | 6 | ||||
-rw-r--r-- | common/thermal.c | 7 | ||||
-rw-r--r-- | include/temp_sensor.h | 10 |
3 files changed, 21 insertions, 2 deletions
diff --git a/common/temp_sensor.c b/common/temp_sensor.c index 0f687bb2a2..5428b84949 100644 --- a/common/temp_sensor.c +++ b/common/temp_sensor.c @@ -97,7 +97,8 @@ DECLARE_HOOK(HOOK_INIT, temp_sensor_init, HOOK_PRIO_DEFAULT); /*****************************************************************************/ /* Console commands */ -static int command_temps(int argc, char **argv) +#ifdef CONFIG_CMD_TEMP_SENSOR +int console_command_temps(int argc, char **argv) { int t, i; int rv, rv1 = EC_SUCCESS; @@ -135,9 +136,10 @@ static int command_temps(int argc, char **argv) return rv1; } -DECLARE_CONSOLE_COMMAND(temps, command_temps, +DECLARE_CONSOLE_COMMAND(temps, console_command_temps, NULL, "Print temp sensors"); +#endif /*****************************************************************************/ /* Host commands */ diff --git a/common/thermal.c b/common/thermal.c index d1cc47e924..821430482a 100644 --- a/common/thermal.c +++ b/common/thermal.c @@ -156,6 +156,13 @@ static void thermal_control(void) if (cond_went_true(&cond_hot[EC_TEMP_THRESH_HALT])) { CPRINTS("thermal SHUTDOWN"); + + /* Print temperature sensor values before shutting down AP */ + if (IS_ENABLED(CONFIG_CMD_TEMP_SENSOR)) { + console_command_temps(1, NULL); + cflush(); + } + chipset_force_shutdown(CHIPSET_SHUTDOWN_THERMAL); } else if (cond_went_false(&cond_hot[EC_TEMP_THRESH_HALT])) { /* We don't reboot automatically - the user has to push diff --git a/include/temp_sensor.h b/include/temp_sensor.h index f7b5371a1d..e5eff92cf1 100644 --- a/include/temp_sensor.h +++ b/include/temp_sensor.h @@ -57,4 +57,14 @@ extern const struct temp_sensor_t temp_sensors[]; */ int temp_sensor_read(enum temp_sensor_id id, int *temp_ptr); +/** + * Console command to print temperature sensor values + * + * @param argc argument count (Set argc = 1) + * @param argv argument vector (Set argv = NULL) + * + * @return EC_SUCCESS, or non-zero if error. + */ +int console_command_temps(int argc, char **argv); + #endif /* __CROS_EC_TEMP_SENSOR_H */ |