diff options
Diffstat (limited to 'board/fleex/board.c')
-rw-r--r-- | board/fleex/board.c | 33 |
1 files changed, 30 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 |