summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevin Lu <devin.lu@quantatw.com>2018-08-28 17:35:51 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-09-11 00:40:55 -0700
commitfce5adebd020a14443b4c9a3ff4d6817fde353f7 (patch)
tree64cb5e757a59ec0e119228b7939e337f85797dc7
parent7e30bb00d6974bf10022d112c07788fb62e24581 (diff)
downloadchrome-ec-stabilize-jetstream-11056.B.tar.gz
meep: Disable accel, gyro sensors and tablet mode switch for clamshellsstabilize-jetstream-11056.B
meep and mimrock both share with the same board, but mimrock is unstuff accel, gyro sensors and using hall sensor instead of GMR, so we don't need to initial those sensors and disable tablet mode. BUG=b:111823716,b:113962628 BRANCH=none TEST=make buildall -j. make sure no initial event occurs with mimrock. make sure tablet mode was disabled with mimrock. Change-Id: I8141ad8160807288d7a886488b98e93ed9a257b9 Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/1193103 Commit-Ready: Zick Wei <zick.wei@quanta.corp-partner.google.com> Tested-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--board/meep/board.c39
-rw-r--r--board/meep/board.h2
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