From e8b252c738046b9426181112409e4f591fa48616 Mon Sep 17 00:00:00 2001 From: Bruce Date: Thu, 5 Jan 2017 14:40:16 +0800 Subject: pyro/snappy: enable/disable KB and TP function in S3 In S3 state, then disable KB/TP function when state switch to tablet mode from normal mode.Enable KB/TP function when state switch to nromal mode from tablet mode. BUG=none BRANCH=reef TEST=make buildall Change-Id: If759504b6d471ddc18f322aeda07ccbd6ccd636e Signed-off-by: Bruce.Wan Reviewed-on: https://chromium-review.googlesource.com/425416 Commit-Ready: Bruce Wan Tested-by: Bruce Wan Reviewed-by: Aaron Durbin --- board/pyro/board.c | 23 +++++++++++++++++------ board/snappy/board.c | 23 +++++++++++++++++------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/board/pyro/board.c b/board/pyro/board.c index 8a10409d10..da92264951 100644 --- a/board/pyro/board.c +++ b/board/pyro/board.c @@ -682,6 +682,17 @@ void lid_angle_peripheral_enable(int enable) enable = 0; keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); gpio_set_level(GPIO_EN_P3300_TRACKPAD_ODL, !enable); + + /* + * In S3 state, then disable KB/TP function + * when state switch to tablet mode from normal mode. + * Enable KB/TP function when state switch to nromal + * mode from tablet mode. + */ + if (chipset_in_state(CHIPSET_STATE_SUSPEND)) { + keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); + gpio_set_level(GPIO_EN_P3300_TRACKPAD_ODL, !enable); + } } #endif @@ -796,7 +807,7 @@ struct bmp280_drv_data_t bmp280_drv_data; struct motion_sensor_t motion_sensors[] = { [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, @@ -820,8 +831,8 @@ struct motion_sensor_t motion_sensors[] = { }, /* unused */ [SENSOR_CONFIG_EC_S3] = { - .odr = 0, - .ec_rate = 0, + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, }, [SENSOR_CONFIG_EC_S5] = { .odr = 0, @@ -832,7 +843,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, @@ -856,8 +867,8 @@ struct motion_sensor_t motion_sensors[] = { }, /* Sensor off in S3/S5 */ [SENSOR_CONFIG_EC_S3] = { - .odr = 0, - .ec_rate = 0 + .odr = 0 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, }, /* Sensor off in S3/S5 */ [SENSOR_CONFIG_EC_S5] = { diff --git a/board/snappy/board.c b/board/snappy/board.c index d2f62edf8a..5ae425f6bb 100644 --- a/board/snappy/board.c +++ b/board/snappy/board.c @@ -681,6 +681,17 @@ void lid_angle_peripheral_enable(int enable) enable = 0; keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); gpio_set_level(GPIO_EN_P3300_TRACKPAD_ODL, !enable); + + /* + * In S3 state, then disable KB/TP function + * when state switch to tablet mode from normal mode. + * Enable KB/TP function when state switch to nromal + * mode from tablet mode. + */ + if (chipset_in_state(CHIPSET_STATE_SUSPEND)) { + keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); + gpio_set_level(GPIO_EN_P3300_TRACKPAD_ODL, !enable); + } } #endif @@ -796,7 +807,7 @@ struct bmp280_drv_data_t bmp280_drv_data; struct motion_sensor_t motion_sensors[] = { [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, @@ -820,8 +831,8 @@ struct motion_sensor_t motion_sensors[] = { }, /* unused */ [SENSOR_CONFIG_EC_S3] = { - .odr = 0, - .ec_rate = 0, + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, }, [SENSOR_CONFIG_EC_S5] = { .odr = 0, @@ -832,7 +843,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, @@ -856,8 +867,8 @@ struct motion_sensor_t motion_sensors[] = { }, /* Sensor off in S3/S5 */ [SENSOR_CONFIG_EC_S3] = { - .odr = 0, - .ec_rate = 0 + .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, }, /* Sensor off in S3/S5 */ [SENSOR_CONFIG_EC_S5] = { -- cgit v1.2.1