diff options
author | elthanhuang <elthan_huang@compal.corp-partner.google.com> | 2018-08-28 16:01:05 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-08-29 01:37:56 -0700 |
commit | 303e1bdb2cbfb9f3c19958d96a8cfb09aa4e01b2 (patch) | |
tree | 594199a97871268e6f82b4a4cfe8a1c3cbe85fc0 /board | |
parent | 2c520a2a424bf57e7e626273d0c5b5dfc6acd1d6 (diff) | |
download | chrome-ec-303e1bdb2cbfb9f3c19958d96a8cfb09aa4e01b2.tar.gz |
Fleex: Enable dynamic motion sensor count and
change disable the keyboard for convertible
Get the motion sensor count by SKU
motion_sensor_count on clamshells is 0.
motion_sensor_count on convertibles is 2.
lid_angle_peripheral_enable() function disable
the keyboard for convertible systems.
BUG=b:112286331
BRANCH=none
TEST=Manual
change SKUID to 0x21 for convertible and verified the motion sensor
count and that the motion senors were initialized in the EC console log.
change SKUID to 0x01 for clamshell and the motion senors were
not initialized in the EC console log.
Change-Id: Ic9d6c910c9e56479414d30f1e2c53d73515842af
Signed-off-by: elthanhuang <elthan_huang@compal.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/1192903
Commit-Ready: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Tested-by: Elthan Huang <elthan_huang@compal.corp-partner.google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/fleex/board.c | 33 | ||||
-rw-r--r-- | board/fleex/board.h | 1 |
2 files changed, 31 insertions, 3 deletions
diff --git a/board/fleex/board.c b/board/fleex/board.c index 11564aa73d..697d072f45 100644 --- a/board/fleex/board.c +++ b/board/fleex/board.c @@ -12,6 +12,7 @@ #include "charge_manager.h" #include "charge_state.h" #include "common.h" +#include "console.h" #include "cros_board_info.h" #include "driver/accel_lis2dh.h" #include "driver/accelgyro_lsm6dsm.h" @@ -141,6 +142,7 @@ static struct stprivate_data g_lis2dh_data; static struct lsm6dsm_data lsm6dsm_g_data; static struct lsm6dsm_data lsm6dsm_a_data; +static uint16_t sku_id; /* Drivers */ struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { @@ -218,7 +220,32 @@ struct motion_sensor_t motion_sensors[] = { }, }; -const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); +unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); + +static int board_is_convertible(void) +{ + return sku_id == 0x21 || sku_id == 0x22 || sku_id == 0xff; +} + +static void board_set_motion_sensor_count(void) +{ + if (board_is_convertible()) + motion_sensor_count = ARRAY_SIZE(motion_sensors); + else + motion_sensor_count = 0; +} + +static void cbi_init(void) +{ + uint32_t val; + + if (cbi_get_sku_id(&val) == EC_SUCCESS) + sku_id = val; + ccprints("SKU: 0x%04x", sku_id); + + board_set_motion_sensor_count(); +} +DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1); /* Initialize board. */ static void board_init(void) @@ -239,8 +266,8 @@ void lid_angle_peripheral_enable(int enable) */ if (tablet_get_mode()) enable = 0; - - keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); + if (board_is_convertible()) + keyboard_scan_enable(enable, KB_SCAN_DISABLE_LID_ANGLE); } #endif diff --git a/board/fleex/board.h b/board/fleex/board.h index 1d3dee6fd5..b4e9d6e21b 100644 --- a/board/fleex/board.h +++ b/board/fleex/board.h @@ -27,6 +27,7 @@ #define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */ /* Sensors without hardware FIFO are in forced mode */ #define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL) +#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT /* USB PD */ #define CONFIG_USB_PD_VBUS_MEASURE_ADC_EACH_PORT |