summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTino Liu <tino.liu@quanta.corp-partner.google.com>2018-08-13 17:33:08 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-08-17 16:14:29 -0700
commit1dacc6d70813b22212736a7ed813315c82262dc9 (patch)
tree7f9dd85ea31818a3914957a5b38bd917f3dd4d44
parentb8a3790615d9205b23aa087a64deb9bdcc72eedb (diff)
downloadchrome-ec-1dacc6d70813b22212736a7ed813315c82262dc9.tar.gz
Bobba: Disable Base Accel/Gyro sensor for clamshells
BUG=b:112442777 BRANCH=none TEST=Verify screen will not rotate when sku id is clamshell Change-Id: I2cca78c05d52b8914018b9ea5f56918be93427f8 Signed-off-by: Tino Liu <tino.liu@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/1172306 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--board/bobba/board.c26
-rw-r--r--board/bobba/board.h1
2 files changed, 26 insertions, 1 deletions
diff --git a/board/bobba/board.c b/board/bobba/board.c
index b3db6cebc6..5754848cc8 100644
--- a/board/bobba/board.c
+++ b/board/bobba/board.c
@@ -193,7 +193,31 @@ 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 void setup_motion_sensors(uint8_t sku_id)
+{
+ /* SKU ID of Bobba360 and Sparky360: 9, 25, 26 */
+ if (sku_id != 9 && sku_id != 25 && sku_id != 26) {
+ /* Clamshell Bobba has no base accel and base gyro */
+ motion_sensor_count = ARRAY_SIZE(motion_sensors) - 2;
+ }
+}
+
+/* Read CBI from i2c eeprom and initialize variables for board variants */
+static void cbi_init(void)
+{
+ uint8_t sku_id;
+ uint32_t val;
+
+ if (cbi_get_sku_id(&val) != EC_SUCCESS || val > UINT8_MAX)
+ return;
+ sku_id = val;
+ CPRINTSUSB("SKU: %d", sku_id);
+
+ setup_motion_sensors(sku_id);
+}
+DECLARE_HOOK(HOOK_INIT, cbi_init, HOOK_PRIO_INIT_I2C + 1);
/* Initialize board. */
static void board_init(void)
diff --git a/board/bobba/board.h b/board/bobba/board.h
index 2d3dfb0f85..40cc2e48ee 100644
--- a/board/bobba/board.h
+++ b/board/bobba/board.h
@@ -25,6 +25,7 @@
/* Sensors */
#define CONFIG_ACCEL_KX022 /* Lid accel */
#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL)