diff options
Diffstat (limited to 'board')
-rw-r--r-- | board/meep/board.c | 39 | ||||
-rw-r--r-- | board/meep/board.h | 2 |
2 files changed, 38 insertions, 3 deletions
diff --git a/board/meep/board.c b/board/meep/board.c index a89154c126..83fe05a50f 100644 --- a/board/meep/board.c +++ b/board/meep/board.c @@ -50,6 +50,8 @@ #define USB_PD_PORT_ANX7447 0 #define USB_PD_PORT_PS8751 1 +static uint8_t sku_id; + static void ppc_interrupt(enum gpio_signal signal) { switch (signal) { @@ -205,7 +207,39 @@ 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); + +/* + * meep is convertible SKU (SKU ID is 1, 2, 3), mimrock is clamshell + * SKU (SKU ID is 17, 18) and default SKU is 255 for factory that enable + * all sensors. + */ +static int board_is_convertible(void) +{ + return sku_id == 1 || sku_id == 2 || sku_id == 3 || sku_id == 255; +} + +static void board_update_sensor_config_from_sku(void) +{ + if (board_is_convertible()) { + motion_sensor_count = ARRAY_SIZE(motion_sensors); + } else { + motion_sensor_count = 0; + tablet_disable_switch(); + } +} + +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_update_sensor_config_from_sku(); +} +DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1); /* Initialize board. */ static void board_init(void) @@ -241,6 +275,7 @@ 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/meep/board.h b/board/meep/board.h index 2ce6b39eac..2d8f06a45b 100644 --- a/board/meep/board.h +++ b/board/meep/board.h @@ -31,11 +31,11 @@ #define OCTOPUS_POWER_LED /* Sensors */ -/* TODO(b/111842131): confirm lid accelerometer matches yorp */ #define CONFIG_ACCEL_KX022 /* Lid accel */ #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 */ #undef CONFIG_USB_PD_VBUS_MEASURE_NOT_PRESENT |