diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2016-11-02 15:57:47 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-11-04 04:54:20 -0700 |
commit | cbae8f9b321f33734a34cb85c82636bbfa7663ee (patch) | |
tree | a754d8be330873cb746733423b6d615e6d44ebd9 /board/kevin/board.c | |
parent | b8c1ce6700ba9e467f4b6a42cac5ceb3aacdd1db (diff) | |
download | chrome-ec-cbae8f9b321f33734a34cb85c82636bbfa7663ee.tar.gz |
kevin: Add Sensor in S3, disable keyboard wakeup in tablet mode.
Let sensor be powered on in S3. It is useful for Android and if we want to
disable keyboard wakeup based on lid angle.
Allow EC to disable touchpad and not send keyboard events when lid angle
is greater than 180.
BUG=chrome-os-partner:57510,chromium:620633
BRANCH=gru
TEST=In S3, check the sensors are readable.
Check that when in S3 and lid angle is < 180 EC sends keyboard events.
Check that when in S3 and lid angle is > 180 EC does not send keyboard
events.
Change-Id: I4e7959ed37bc5dfdf9c105ecae94c314b253d77f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/406739
Commit-Ready: Gwendal Grignou <gwendal@google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'board/kevin/board.c')
-rw-r--r-- | board/kevin/board.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/board/kevin/board.c b/board/kevin/board.c index 940c2e4045..cc6f03bf62 100644 --- a/board/kevin/board.c +++ b/board/kevin/board.c @@ -298,7 +298,7 @@ static void board_spi_enable(void) { spi_enable(CONFIG_SPI_ACCEL_PORT, 1); } -DECLARE_HOOK(HOOK_CHIPSET_RESUME, +DECLARE_HOOK(HOOK_CHIPSET_STARTUP, board_spi_enable, MOTION_SENSE_HOOK_PRIO - 1); @@ -321,7 +321,7 @@ static void board_spi_disable(void) spi_enable(CONFIG_SPI_ACCEL_PORT, 0); } -DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, +DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, board_spi_disable, MOTION_SENSE_HOOK_PRIO + 1); @@ -517,7 +517,7 @@ struct motion_sensor_t motion_sensors[] = { */ [BASE_ACCEL] = { .name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0, + .active_mask = SENSOR_ACTIVE_S0_S3, .chip = MOTIONSENSE_CHIP_BMI160, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_BASE, @@ -539,10 +539,10 @@ struct motion_sensor_t motion_sensors[] = { .odr = 10000 | ROUND_UP_FLAG, .ec_rate = 100 * MSEC, }, - /* Sensor off in S3/S5 */ + /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S3] = { - .odr = 0, - .ec_rate = 0 + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 0, }, /* Sensor off in S3/S5 */ [SENSOR_CONFIG_EC_S5] = { @@ -553,7 +553,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, @@ -594,7 +594,7 @@ struct motion_sensor_t motion_sensors[] = { #ifdef BOARD_KEVIN [LID_ACCEL] = { .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0, + .active_mask = SENSOR_ACTIVE_S0_S3, .chip = MOTIONSENSE_CHIP_BMA255, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_LID, @@ -616,9 +616,9 @@ struct motion_sensor_t motion_sensors[] = { .odr = 10000 | ROUND_UP_FLAG, .ec_rate = 0, }, - /* unused */ + /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S3] = { - .odr = 0, + .odr = 10000 | ROUND_UP_FLAG, .ec_rate = 0, }, [SENSOR_CONFIG_EC_S5] = { @@ -630,7 +630,7 @@ struct motion_sensor_t motion_sensors[] = { #else [LID_ACCEL] = { .name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0, + .active_mask = SENSOR_ACTIVE_S0_S3, .chip = MOTIONSENSE_CHIP_KX022, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_LID, @@ -652,9 +652,9 @@ struct motion_sensor_t motion_sensors[] = { .odr = 10000 | ROUND_UP_FLAG, .ec_rate = 0, }, - /* unused */ + /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S3] = { - .odr = 0, + .odr = 10000 | ROUND_UP_FLAG, .ec_rate = 0, }, [SENSOR_CONFIG_EC_S5] = { @@ -665,7 +665,7 @@ struct motion_sensor_t motion_sensors[] = { }, [BASE_BARO] = { .name = "Base Baro", - .active_mask = SENSOR_ACTIVE_S0, + .active_mask = SENSOR_ACTIVE_S0_S3, .chip = MOTIONSENSE_CHIP_BMP280, .type = MOTIONSENSE_TYPE_BARO, .location = MOTIONSENSE_LOC_BASE, @@ -701,6 +701,16 @@ struct motion_sensor_t motion_sensors[] = { }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); +#ifndef TEST_BUILD +void lid_angle_peripheral_enable(int enable) +{ + keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); + + /* enable/disable touchpad */ + gpio_set_level(GPIO_PP3300_TRACKPAD_EN_L, !enable); +} +#endif + #ifdef BOARD_GRU static void usb_charge_resume(void) { |