summaryrefslogtreecommitdiff
path: root/board/dratini
diff options
context:
space:
mode:
authorDevin Lu <devin.lu@quantatw.com>2019-10-17 16:53:53 +0800
committerCommit Bot <commit-bot@chromium.org>2019-10-21 03:23:42 +0000
commitddc3ecad7999e77256f5915d7fb36f42bd725d1a (patch)
treed9eb739149b726771b885a779d662ba9906e6116 /board/dratini
parentc40a6814ff463f1557dbaeb594bf2c33cb21cfbd (diff)
downloadchrome-ec-ddc3ecad7999e77256f5915d7fb36f42bd725d1a.tar.gz
dratini: disable accel, gyro sensors and tablet mode switch for clamshells
dratini and dragonair use the same PCB with BOM changes. Dratini uses a hall sensor instead of GMR, and does not stuff the accelerometer and gryo sensors. Disable initialization of those sensors on Dratini. Dratini is a clamshell that does not support tablet mode, so disable that, too. BUG=none BRANCH=none TEST=make buildall -j. make sure no initial event occurs with dratini. make sure tablet mode was disabled with dragonair. Change-Id: If65183f458d62f0b74e21233900d86102c4cc88d Signed-off-by: Devin Lu <Devin.Lu@quantatw.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1866220 Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'board/dratini')
-rw-r--r--board/dratini/board.c31
-rw-r--r--board/dratini/board.h1
2 files changed, 30 insertions, 2 deletions
diff --git a/board/dratini/board.c b/board/dratini/board.c
index eb56991d39..d967784222 100644
--- a/board/dratini/board.c
+++ b/board/dratini/board.c
@@ -348,14 +348,41 @@ static void setup_fans(void)
thermal_params[TEMP_SENSOR_2] = thermal_a;
}
+/*
+ * Returns true for boards that are convertible into tablet mode, and
+ * false for clamshells.
+ */
+static bool board_is_convertible(void)
+{
+ uint8_t sku_id = get_board_sku();
+
+ /* Dragonair (SKU 21 and 22) is a convertible. Dratini is not. */
+ return sku_id == 21 || sku_id == 22;
+}
+
+static void board_update_sensor_config_from_sku(void)
+{
+ if (board_is_convertible()) {
+ motion_sensor_count = ARRAY_SIZE(motion_sensors);
+ /* Enable gpio interrupt for base accelgyro sensor */
+ gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
+ } else {
+ motion_sensor_count = 0;
+ gmr_tablet_switch_disable();
+ /* Base accel is not stuffed, don't allow line to float */
+ gpio_set_flags(GPIO_BASE_SIXAXIS_INT_L,
+ GPIO_INPUT | GPIO_PULL_DOWN);
+ }
+}
+
static void board_init(void)
{
/* Initialize Fans */
setup_fans();
- /* Enable gpio interrupt for base accelgyro sensor */
- gpio_enable_interrupt(GPIO_BASE_SIXAXIS_INT_L);
/* Enable HDMI HPD interrupt. */
gpio_enable_interrupt(GPIO_HDMI_CONN_HPD);
+
+ board_update_sensor_config_from_sku();
}
DECLARE_HOOK(HOOK_INIT, board_init, HOOK_PRIO_DEFAULT);
diff --git a/board/dratini/board.h b/board/dratini/board.h
index a7da73edae..96ac04021c 100644
--- a/board/dratini/board.h
+++ b/board/dratini/board.h
@@ -37,6 +37,7 @@
/* BMA253 Lid accel */
#define CONFIG_ACCEL_BMA255
#define CONFIG_ACCEL_FORCE_MODE_MASK (BIT(LID_ACCEL) | BIT(CLEAR_ALS))
+#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL