diff options
author | Aseda Aboagye <aaboagye@google.com> | 2018-07-11 00:23:24 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-07-19 02:52:08 -0700 |
commit | e226adb7fd070e05a8c942007e245be46b89f9dd (patch) | |
tree | 3d23f3498f1bf0a328227849436395e0006670b6 | |
parent | e92aa3b46333ce5c81a628ae2dee75445d7931e1 (diff) | |
download | chrome-ec-e226adb7fd070e05a8c942007e245be46b89f9dd.tar.gz |
nocturne: Don't read gyro temp sensor in <= S5.
The gyro is not powered in S5 or lower, therefore we should not
return any temperature value for those power states.
BUG=none
BRANCH=master
TEST=flash nocturne, shut AP down, verify no prints are emitted about
i2c unwedging.
Change-Id: I3bcc1efca40b27ec571657274aab69dca4e414d7
Signed-off-by: Aseda Aboagye <aaboagye@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1132900
Commit-Queue: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 988468d17c8912c0f9a5345996b34f8848fdb739)
Reviewed-on: https://chromium-review.googlesource.com/1142924
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
-rw-r--r-- | board/nocturne/board.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/board/nocturne/board.c b/board/nocturne/board.c index 3011aba5b9..b0fb7e633c 100644 --- a/board/nocturne/board.c +++ b/board/nocturne/board.c @@ -10,6 +10,7 @@ #include "charge_manager.h" #include "charge_state.h" #include "charge_state_v2.h" +#include "chipset.h" #include "common.h" #include "console.h" #include "compile_time_macros.h" @@ -451,6 +452,18 @@ void board_overcurrent_event(int port) CPRINTS("C%d: overcurrent!", port); } +static int read_gyro_sensor_temp(int idx, int *temp_ptr) +{ + /* + * The gyro is only powered in S0, so don't go and read it if the AP is + * off. + */ + if (chipset_in_state(CHIPSET_STATE_ANY_OFF)) + return EC_ERROR_NOT_POWERED; + + return bmi160_get_sensor_temp(idx, temp_ptr); +} + const struct temp_sensor_t temp_sensors[] = { {"Battery", TEMP_SENSOR_TYPE_BATTERY, charge_get_battery_temp, 0, 4}, @@ -464,7 +477,7 @@ const struct temp_sensor_t temp_sensors[] = { {"eMMC", TEMP_SENSOR_TYPE_BOARD, bd99992gw_get_val, BD99992GW_ADC_CHANNEL_SYSTHERM3, 4}, /* The Gyro temperature sensor is only readable in S0. */ - {"Gyro", TEMP_SENSOR_TYPE_BOARD, bmi160_get_sensor_temp, LID_GYRO, 1} + {"Gyro", TEMP_SENSOR_TYPE_BOARD, read_gyro_sensor_temp, LID_GYRO, 1} }; BUILD_ASSERT(ARRAY_SIZE(temp_sensors) == TEMP_SENSOR_COUNT); |