diff options
author | Bruce <Bruce.Wan@quantatw.com> | 2015-12-28 17:16:19 +0800 |
---|---|---|
committer | ChromeOS bot <3su6n15k.default@developer.gserviceaccount.com> | 2015-12-29 22:54:51 +0000 |
commit | 64bcf00222eafc322fd5f3649fa2d8c913d57bb5 (patch) | |
tree | d122811999b2704cc19004b7d9ed4fc7bacee61b | |
parent | 12d9fe9eb8fb7b07ead123276ab047c1a1988660 (diff) | |
download | chrome-ec-64bcf00222eafc322fd5f3649fa2d8c913d57bb5.tar.gz |
Ultima: Added Clamshell/Tablet mode support
Enabled lid angle calculation. Clamshell/Tablet mode is decided by lid
angle.
Accelerometers are set to be active in S3 also.
BUG=chrome-os-partner:47942
BRANCH=firmware-strago-7287.B
TEST=Verify in clamshell mode, system can be waken up from S3 by
keyboard/trackpad;And not tablet mode.
Change-Id: Ic7143945878c38a3d2388def1bae8e734b6ada84
Signed-off-by: Bruce.Wan <Bruce.Wan@quantatw.com>
Reviewed-on: https://chromium-review.googlesource.com/319991
Reviewed-by: Shawn N <shawnn@chromium.org>
Commit-Queue: Keith Tzeng <keith.tzeng@quantatw.com>
Tested-by: Keith Tzeng <keith.tzeng@quantatw.com>
-rw-r--r-- | board/ultima/board.c | 48 | ||||
-rw-r--r-- | board/ultima/board.h | 1 |
2 files changed, 25 insertions, 24 deletions
diff --git a/board/ultima/board.c b/board/ultima/board.c index e890f6223c..96619d42b0 100644 --- a/board/ultima/board.c +++ b/board/ultima/board.c @@ -15,6 +15,7 @@ #include "hooks.h" #include "host_command.h" #include "i2c.h" +#include "keyboard_scan.h" #include "lid_switch.h" #include "math_util.h" #include "motion_lid.h" @@ -126,7 +127,7 @@ const matrix_3x3_t lid_standard_ref = { struct motion_sensor_t motion_sensors[] = { {.name = "Base Accel", - .active_mask = SENSOR_ACTIVE_S0, + .active_mask = SENSOR_ACTIVE_S0_S3, .chip = MOTIONSENSE_CHIP_KXCJ9, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_BASE, @@ -142,7 +143,7 @@ struct motion_sensor_t motion_sensors[] = { } }, {.name = "Lid Accel", - .active_mask = SENSOR_ACTIVE_S0, + .active_mask = SENSOR_ACTIVE_S0_S3, .chip = MOTIONSENSE_CHIP_KXCJ9, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_LID, @@ -176,28 +177,6 @@ const struct accel_orientation acc_orient = { .hinge_axis = {1, 0, 0}, }; -/* - * In S3, power rail for sensors (+V3p3S) goes down asynchronous to EC. We need - * to execute this routine first and set the sensor state to "Not Initialized". - * This prevents the motion_sense_suspend hook routine from communicating with - * the sensor. - */ -static void motion_sensors_pre_init(void) -{ - struct motion_sensor_t *sensor; - int i; - - for (i = 0; i < motion_sensor_count; ++i) { - sensor = &motion_sensors[i]; - sensor->state = SENSOR_NOT_INITIALIZED; - - sensor->runtime_config.odr = sensor->default_config.odr; - sensor->runtime_config.range = sensor->default_config.range; - } -} -DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, motion_sensors_pre_init, - MOTION_SENSE_HOOK_PRIO - 1); - /* init ADC ports to avoid floating state due to thermistors */ static void adc_pre_init(void) { @@ -205,3 +184,24 @@ static void adc_pre_init(void) gpio_config_module(MODULE_ADC, 1); } DECLARE_HOOK(HOOK_INIT, adc_pre_init, HOOK_PRIO_INIT_ADC - 1); + +#ifdef CONFIG_LID_ANGLE_UPDATE +static void track_pad_enable(int enable) +{ + if (enable) + gpio_set_level(GPIO_TRACKPAD_PWREN, 0); + else + gpio_set_level(GPIO_TRACKPAD_PWREN, 1); +} + +void lid_angle_peripheral_enable(int enable) +{ + if (enable) { + keyboard_scan_enable(1, KB_SCAN_DISABLE_LID_ANGLE); + track_pad_enable(0); + } else { + keyboard_scan_enable(0, KB_SCAN_DISABLE_LID_ANGLE); + track_pad_enable(1); + } +} +#endif diff --git a/board/ultima/board.h b/board/ultima/board.h index 1b5e1e4570..945efddfd0 100644 --- a/board/ultima/board.h +++ b/board/ultima/board.h @@ -73,6 +73,7 @@ #define CONFIG_LID_ANGLE #define CONFIG_LID_ANGLE_SENSOR_BASE 0 #define CONFIG_LID_ANGLE_SENSOR_LID 1 +#define CONFIG_LID_ANGLE_UPDATE /* Wireless signals */ #define WIRELESS_GPIO_WLAN GPIO_WLAN_OFF_L |