summaryrefslogtreecommitdiff
path: root/board/coral/sku.h
diff options
context:
space:
mode:
authorScott Collyer <scollyer@google.com>2017-10-10 16:14:16 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-10-12 00:09:34 -0700
commitdfe7473ed8fefe6b6bb15324fa835aafde4b0ffb (patch)
tree8fe6c9e41af8d71686e36f9a3244eb5242c27a1a /board/coral/sku.h
parentc478733f19b0de89364e996604a2ac73d1d95ea7 (diff)
downloadchrome-ec-dfe7473ed8fefe6b6bb15324fa835aafde4b0ffb.tar.gz
coral: Use SKU ID to initialize motion_sensor_count
This CL adds the config option CONFIG_DYNAMIC_MOTION_SENSOR_COUNT and SKU table which contains the form factor for all known SKUs. Once the SKU ID is known, the variable motion_sensor_count is set based on CLAMSHELL or CONVERTIBLE designation in the SKU table. If there isn't a matching SKU ID in the table then motion_sensor_count will be initialized to the ARRAY_LENGTH of motion_sensors. BUG=b:38271876 BRANCH=None TEST=Manual Tested with Robo360 (SKU ID 71) and verified the motion sensor count and that the motion senors were initialized in the EC console log. [0.088188 Motion Sensor Init: count = 3] [0.346097 Lid Accel: MS Done Init type:0x0 range:2] [0.370386 Base Accel: MS Done Init type:0x0 range:2] [0.386790 Base Gyro: MS Done Init type:0x1 range:1000] Tested with Santa EVT (SKU ID 3) and verified motion_sensor_count is 0 and no EC console messages showing sensor initialization failures. Change-Id: Ia3d60f8c8dd4435dd7cfb80a860f809de2fb931e Signed-off-by: Scott Collyer <scollyer@google.com> Reviewed-on: https://chromium-review.googlesource.com/711195 Commit-Ready: Aaron Durbin <adurbin@chromium.org> Tested-by: Scott Collyer <scollyer@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Diffstat (limited to 'board/coral/sku.h')
-rw-r--r--board/coral/sku.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/board/coral/sku.h b/board/coral/sku.h
new file mode 100644
index 0000000000..2ed66a2670
--- /dev/null
+++ b/board/coral/sku.h
@@ -0,0 +1,90 @@
+/* Copyright 2017 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* Coral SKU ID Table */
+
+#ifndef __CROS_EC_SKU_H
+#define __CROS_EC_SKU_H
+
+#define SKU_CONVERTIBLE(id) (1 << ((id) & 0x7))
+
+/*
+ * There are 256 possible SKUs for Coral. This table is used to map a given SKU
+ * ID to its form factor, which is then used to determine number of motion
+ * sensors. A bit value of 0 is for clamshell and a bit value of 1 indicates a
+ * convertible device. The assumption is all devices are defined as clamshells
+ * unless SKU_CONVERTIBLE(id) is spelled out in the initialization.
+ */
+static const uint8_t form_factor[32] = {
+ /* SKU 0 - 7 */
+ SKU_CONVERTIBLE(4) | SKU_CONVERTIBLE(5),
+ /* SKU 8 - 15 */
+ SKU_CONVERTIBLE(8) | SKU_CONVERTIBLE(9) | SKU_CONVERTIBLE(10),
+ /* SKU 16 - 23 */
+ 0x00,
+ /* SKU 24 - 31 */
+ 0x00,
+ /* SKU 32 - 39 */
+ 0x00,
+ /* SKU 40 - 47 */
+ 0x00,
+ /* SKU 48 - 55 */
+ 0x00,
+ /* SKU 56 - 63 */
+ 0x00,
+ /* SKU 64 - 71 */
+ SKU_CONVERTIBLE(71),
+ /* SKU 72 - 79 */
+ 0x00,
+ /* SKU 80 - 87 */
+ 0x00,
+ /* SKU 88 - 95 */
+ 0x00,
+ /* SKU 96 - 103 */
+ 0x00,
+ /* SKU 104 - 111 */
+ 0x00,
+ /* SKU 112 - 119 */
+ 0x00,
+ /* SKU 120 - 127 */
+ 0x00,
+ /* SKU 128 - 135 */
+ 0x00,
+ /* SKU 136 - 143 */
+ 0x00,
+ /* SKU 144 - 151 */
+ 0x00,
+ /* SKU 152 - 159 */
+ 0x00,
+ /* SKU 160 - 167 */
+ SKU_CONVERTIBLE(163) | SKU_CONVERTIBLE(164) | SKU_CONVERTIBLE(165) |
+ SKU_CONVERTIBLE(166),
+ /* SKU 168 - 175 */
+ 0x00,
+ /* SKU 176 - 183 */
+ 0x00,
+ /* SKU 184 - 191 */
+ 0x00,
+ /* SKU 192 - 199 */
+ 0x00,
+ /* SKU 200 - 207 */
+ 0x00,
+ /* SKU 208 - 215 */
+ 0x00,
+ /* SKU 216 - 223 */
+ 0x00,
+ /* SKU 224 - 231 */
+ 0x00,
+ /* SKU 232 - 239 */
+ 0x00,
+ /* SKU 240 - 247 */
+ 0x00,
+ /* SKU 248 - 255 */
+ 0x00,
+};
+
+#define SKU_IS_CONVERTIBLE(id) ((form_factor[(id) >> 3] >> ((id) & 0x7)) & 1)
+
+#endif /* __CROS_EC_SKU_H */