diff options
-rw-r--r-- | common/motion_sense.c | 14 | ||||
-rw-r--r-- | driver/accelgyro_bmi160.c | 4 | ||||
-rw-r--r-- | include/motion_sense.h | 2 | ||||
-rw-r--r-- | test/motion_lid.c | 4 |
4 files changed, 8 insertions, 16 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c index 3bd2dfcd5c..0a2f8d11e5 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -454,19 +454,13 @@ DECLARE_HOOK(HOOK_CHIPSET_RESUME, motion_sense_resume, static void motion_sense_startup(void) { - int i; - struct motion_sensor_t *sensor; - - sensor_active = SENSOR_ACTIVE_S5; - for (i = 0; i < motion_sensor_count; ++i) { - sensor = &motion_sensors[i]; - sensor->state = SENSOR_NOT_INITIALIZED; - } - - /* If the AP is already in S0, call the resume hook now. + /* + * If the AP is already in S0, call the resume hook now. * We may initialize the sensor 2 times (once in RO, another time in * RW), but it may be necessary if the init sequence has changed. */ + if (chipset_in_state(SENSOR_ACTIVE_S0_S3_S5)) + motion_sense_shutdown(); if (chipset_in_state(SENSOR_ACTIVE_S0_S3)) motion_sense_suspend(); if (chipset_in_state(SENSOR_ACTIVE_S0)) diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c index fa759916bc..44900807cc 100644 --- a/driver/accelgyro_bmi160.c +++ b/driver/accelgyro_bmi160.c @@ -1197,10 +1197,6 @@ static int init(const struct motion_sensor_t *s) #ifdef CONFIG_ACCEL_INTERRUPTS ret = config_interrupt(s); #endif -#ifdef CONFIG_GESTURE_SENSOR_BATTERY_TAP - /* enable double tap, as soon as the chip is ready */ - manage_activity(s, MOTIONSENSE_ACTIVITY_DOUBLE_TAP, 1, NULL); -#endif } CPRINTF("[%T %s: MS Done Init type:0x%X range:%d]\n", s->name, s->type, get_range(s)); diff --git a/include/motion_sense.h b/include/motion_sense.h index aa4170b722..0c9632ca7e 100644 --- a/include/motion_sense.h +++ b/include/motion_sense.h @@ -30,7 +30,7 @@ enum sensor_config { SENSOR_CONFIG_MAX, }; -#define SENSOR_ACTIVE_S5 CHIPSET_STATE_SOFT_OFF +#define SENSOR_ACTIVE_S5 (CHIPSET_STATE_SOFT_OFF | CHIPSET_STATE_HARD_OFF) #define SENSOR_ACTIVE_S3 CHIPSET_STATE_SUSPEND #define SENSOR_ACTIVE_S0 CHIPSET_STATE_ON #define SENSOR_ACTIVE_S0_S3 (SENSOR_ACTIVE_S3 | SENSOR_ACTIVE_S0) diff --git a/test/motion_lid.c b/test/motion_lid.c index ba6a179b1c..158fcb0918 100644 --- a/test/motion_lid.c +++ b/test/motion_lid.c @@ -196,12 +196,14 @@ static int test_lid_angle(void) struct motion_sensor_t *base = &motion_sensors[0]; struct motion_sensor_t *lid = &motion_sensors[1]; - /* Go to S3 state */ + /* We don't have TASK_CHIP so simulate init ourselves */ + hook_notify(HOOK_CHIPSET_SHUTDOWN); TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S5); TEST_ASSERT(accel_get_data_rate(lid) == 0); TEST_ASSERT(motion_interval == 0); /* Go to S0 state */ + hook_notify(HOOK_CHIPSET_SUSPEND); hook_notify(HOOK_CHIPSET_RESUME); msleep(1000); TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S0); |