summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2017-01-13 14:16:31 -0800
committerchrome-bot <chrome-bot@chromium.org>2017-02-10 12:11:47 -0800
commitca99f3803dc09eb4fda0b3b7e2fa8d8cf96185ee (patch)
treee7afe4699800682f59fb60351b3e02657f824e3b /board
parent9ca2b4c7754cd3e8e27b5f40f1383949da0e4d97 (diff)
downloadchrome-ec-ca99f3803dc09eb4fda0b3b7e2fa8d8cf96185ee.tar.gz
snappy: BMI160 is powered down on board v3 and older in S3
Take in account that sensors are down in S3, reinit them back when moving from S3 to S0. Do this only for board version 3 and older. board v4 will have sensors powered in S3. BUG=chrome-os-partner:61502 BRANCH=reef TEST=Check EC power sensors up coming from S3 to S0: [1.627437 power state 6 = S3->S0, in 0x00cf] [1.627994 Port 80: 0x1001][1.628600 chipset -> S0] [1.637391 TCPC p1 Low Power Mode] [1.645020 Lid Accel: Done Init type:0x0 range:2] [1.647733 Lid Accel ODR: 10000 - roundup 1 from config 1 [AP 0]] [1.649015 TCPC p1 Low Power Mode] [1.662231 TCPC p1 Low Power Mode] [1.670560 Base Accel: MS Done Init type:0x0 range:2] C0 st15 [1.679813 PB task 6 = released] [1.680783 PB PCH pwrbtn=HIGH] [1.681108 PB task 0 = idle, wait -1] [1.683463 Base Accel ODR: 10000 - roundup 1 from config 1 [AP 0]] [1.686275 Base Gyro: MS Done Init type:0x1 range:1000] [1.697973 Base Gyro ODR: 0 - roundup 0 from config 0 [AP 0]] [1.776627 Base Mag: MS Done Init type:0x2 range:2048] [1.786490 Base Mag ODR: 0 - roundup 0 from config 0 [AP 0]] ... Change-Id: Icb9961a0f3ce1b478c47057716211e6e14c13674 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/428125 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> (cherry picked from commit 37e6fb246495ac972e0bc4ff6fcc16b9bf2eee7b) Reviewed-on: https://chromium-review.googlesource.com/440511 Commit-Ready: Ravi Chandra Sadineni <ravisadineni@chromium.org> Tested-by: Ravi Chandra Sadineni <ravisadineni@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/snappy/board.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/board/snappy/board.c b/board/snappy/board.c
index 1d4ae01583..872c886f73 100644
--- a/board/snappy/board.c
+++ b/board/snappy/board.c
@@ -522,6 +522,14 @@ static void board_init(void)
/* Enable Gyro interrupts */
gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
+
+ /* Set the sensors in the right powermode */
+ if (system_get_board_version() <= BOARD_VERSION_3) {
+ int i;
+
+ for (i = BASE_ACCEL; i <= BASE_MAG; ++i)
+ motion_sensors[i].active_mask = SENSOR_ACTIVE_S0;
+ }
}
/* PP3300 needs to be enabled before TCPC init hooks */
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_FIRST);
@@ -887,7 +895,7 @@ struct motion_sensor_t motion_sensors[] = {
[BASE_GYRO] = {
.name = "Base Gyro",
- .active_mask = SENSOR_ACTIVE_S0,
+ .active_mask = SENSOR_ACTIVE_S0_S3,
.chip = MOTIONSENSE_CHIP_BMI160,
.type = MOTIONSENSE_TYPE_GYRO,
.location = MOTIONSENSE_LOC_BASE,
@@ -924,7 +932,7 @@ struct motion_sensor_t motion_sensors[] = {
[BASE_MAG] = {
.name = "Base Mag",
- .active_mask = SENSOR_ACTIVE_S0,
+ .active_mask = SENSOR_ACTIVE_S0_S3,
.chip = MOTIONSENSE_CHIP_BMI160,
.type = MOTIONSENSE_TYPE_MAG,
.location = MOTIONSENSE_LOC_BASE,