summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2023-03-14 01:59:26 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2023-03-23 17:23:48 +0000
commitc1f6b2a249250fc4aad2b5c5693b8111d75d8d38 (patch)
tree74f2622039b76713a6250e7fc1432a1d0655c9c1
parentd693ea3d4434a1c66605beb3c9e015e20b45a701 (diff)
downloadchrome-ec-c1f6b2a249250fc4aad2b5c5693b8111d75d8d38.tar.gz
common/tablet: Allow getting out of tablet mode when sensors are broken
When sensors stop working, at least one accelerometer, the EC can not calculate the lid angle anymore. Add hook to the lid opening event, to be able to get out out of tablet mode when lid close. Move scope of the variables that keep track of the lid angle deduced from the GMR sensors. BUG=b:267680317, b:270994196 BRANCH=trogdor, dedede, many more potentially. TEST=Added unit tests. Change-Id: Iaf7cc0d27fba32b3c8616a0674a47af815921ac4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/4338479 Reviewed-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
-rw-r--r--board/host/board.c5
-rw-r--r--board/host/gpio.inc1
-rw-r--r--common/tablet_mode.c92
-rw-r--r--include/config.h11
-rw-r--r--test/build.mk4
-rw-r--r--test/tablet_broken_sensor.c174
-rw-r--r--test/tablet_broken_sensor.tasklist10
-rw-r--r--test/tablet_no_sensor.c105
-rw-r--r--test/tablet_no_sensor.tasklist9
-rw-r--r--test/test_config.h10
10 files changed, 405 insertions, 16 deletions
diff --git a/board/host/board.c b/board/host/board.c
index 1be8d5c1a8..00367a5a54 100644
--- a/board/host/board.c
+++ b/board/host/board.c
@@ -17,6 +17,7 @@
#include "motion_sense.h"
#include "power_button.h"
#include "spi.h"
+#include "tablet_mode.h"
#include "temp_sensor.h"
#include "test_util.h"
#include "timer.h"
@@ -64,6 +65,10 @@ test_mockable void fps_event(enum gpio_signal signal)
{
}
+test_mockable void gmr_tablet_switch_isr(enum gpio_signal signal)
+{
+}
+
#ifdef CONFIG_I2C
/* I2C ports */
const struct i2c_port_t i2c_ports[] = {
diff --git a/board/host/gpio.inc b/board/host/gpio.inc
index ab30915881..e9855b686f 100644
--- a/board/host/gpio.inc
+++ b/board/host/gpio.inc
@@ -14,6 +14,7 @@ GPIO_INT(AC_PRESENT, PIN(0, 2), GPIO_INT_BOTH, extpower_interrupt)
GPIO_INT(VOLUME_DOWN_L, PIN(0, 3), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(VOLUME_UP_L, PIN(0, 4), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(CHARGE_DONE, PIN(0, 5), GPIO_INT_BOTH, inductive_charging_interrupt)
+GPIO_INT(TABLET_MODE_L, PIN(0, 19), GPIO_INT_BOTH, gmr_tablet_switch_isr)
/* Fingerprint */
GPIO_INT(FPS_INT, PIN(0, 14), GPIO_INT_RISING, fps_event)
diff --git a/common/tablet_mode.c b/common/tablet_mode.c
index bfdc7558ee..696d7aa523 100644
--- a/common/tablet_mode.c
+++ b/common/tablet_mode.c
@@ -9,6 +9,7 @@
#include "hooks.h"
#include "host_command.h"
#include "lid_angle.h"
+#include "lid_switch.h"
#include "stdbool.h"
#include "tablet_mode.h"
#include "timer.h"
@@ -36,8 +37,11 @@ static bool tablet_mode_forced;
*/
static uint32_t tablet_mode_store;
-/* True if GMR sensor is reporting 360 degrees. */
-static bool gmr_sensor_at_360;
+/* True if the tablet GMR sensor is reporting 360 degrees. */
+STATIC_IF(CONFIG_GMR_TABLET_MODE) bool gmr_sensor_at_360;
+
+/* True if the lid GMR sensor is reporting 0 degrees. */
+STATIC_IF(CONFIG_GMR_TABLET_MODE) bool gmr_sensor_at_0;
/*
* True: all calls to tablet_set_mode are ignored and tablet_mode if forced to 0
@@ -45,6 +49,11 @@ static bool gmr_sensor_at_360;
*/
static bool disabled;
+static const char *const tablet_mode_names[] = {
+ "clamshell",
+ "tablet",
+};
+
int tablet_get_mode(void)
{
return !!tablet_mode;
@@ -52,7 +61,7 @@ int tablet_get_mode(void)
static inline void print_tablet_mode(void)
{
- CPRINTS("tablet mode %sabled", tablet_mode ? "en" : "dis");
+ CPRINTS("%s mode", tablet_mode_names[tablet_mode]);
}
static void notify_tablet_mode_change(void)
@@ -85,15 +94,18 @@ void tablet_set_mode(int mode, uint32_t trigger)
return;
}
- if (gmr_sensor_at_360 && !mode) {
+ if (IS_ENABLED(CONFIG_GMR_TABLET_MODE) &&
+ ((gmr_sensor_at_360 && !mode) || (gmr_sensor_at_0 && mode))) {
/*
* If tablet mode is being forced by the user, then this logging
* would be misleading since the mode wouldn't change anyway, so
* skip it.
*/
if (!tablet_mode_forced)
- CPRINTS("Ignoring tablet mode exit while gmr sensor "
- "reports 360-degree tablet mode.");
+ CPRINTS("Ignoring %s mode entry while gmr sensors "
+ "reports lid %s",
+ tablet_mode_names[mode],
+ (gmr_sensor_at_360 ? "flipped" : "closed"));
return;
}
@@ -151,6 +163,14 @@ static void gmr_tablet_switch_interrupt_debounce(void)
gmr_sensor_at_360 ? DPTF_PROFILE_FLIPPED_360_MODE :
DPTF_PROFILE_CLAMSHELL);
}
+
+ /*
+ * When tablet mode is only decided by the GMR sensor (or
+ * or substitute, send the tablet_mode change request.
+ */
+ if (!IS_ENABLED(CONFIG_LID_ANGLE))
+ tablet_set_mode(gmr_sensor_at_360, TABLET_TRIGGER_LID);
+
/*
* 1. Peripherals are disabled only when lid reaches 360 position (It's
* probably already disabled by motion_sense task). We deliberately do
@@ -162,18 +182,37 @@ static void gmr_tablet_switch_interrupt_debounce(void)
* deliberately do not clear tablet mode when lid is leaving 360
* position(if motion lid driver is used). Instead, we let motion lid
* driver to clear it when lid goes into laptop zone.
+ * 3. However, there is a potential race condition with
+ * tablet_mode_lid_event() which can be triggered before this debounce
+ * function is called, with |gmr_sensor_at_360| still true.
+ * When we notice the lid is closed when the this function is called and
+ * |gmr_sensor_at_360| false, send a transition to go in clamshell mode.
+ * It would mean the user was able to transition in less than ~10ms...
*/
-
- if (!IS_ENABLED(CONFIG_LID_ANGLE) || gmr_sensor_at_360)
- tablet_set_mode(gmr_sensor_at_360, TABLET_TRIGGER_LID);
+ if (IS_ENABLED(CONFIG_LID_ANGLE)) {
+ if (gmr_sensor_at_360)
+ tablet_set_mode(1, TABLET_TRIGGER_LID);
+ else if (gmr_sensor_at_0)
+ tablet_set_mode(0, TABLET_TRIGGER_LID);
+ }
if (IS_ENABLED(CONFIG_LID_ANGLE_UPDATE) && gmr_sensor_at_360)
lid_angle_peripheral_enable(0);
}
DECLARE_DEFERRED(gmr_tablet_switch_interrupt_debounce);
-/* Debounce time for gmr sensor tablet mode interrupt */
-#define GMR_SENSOR_DEBOUNCE_US (30 * MSEC)
+/*
+ * Debounce time for gmr sensor tablet mode interrupt
+ * There could be a race between the GMR sensor for the tablet and
+ * the GMR sensor for the lid changes state at the same time.
+ * We let the lid sensor GMR debouce first. We would be able to go in tablet
+ * mode when LID_OPEN goes from low to high and TABLET_MODE_L goes from high
+ * to low.
+ * However, in the opposite case, the debouce lid angle interrupt will request
+ * the tablet_mode to be clamshell, but |gmr_sensor_at_360| will still be true,
+ * the request will be ignored.
+ */
+#define GMR_SENSOR_DEBOUNCE_US (LID_DEBOUNCE_US + 10 * MSEC)
void gmr_tablet_switch_isr(enum gpio_signal signal)
{
@@ -181,6 +220,31 @@ void gmr_tablet_switch_isr(enum gpio_signal signal)
GMR_SENSOR_DEBOUNCE_US);
}
+/*
+ * tablet gmr sensor() calls tablet_set_mode() to go in tablet mode
+ * when we know for sure the tablet is in tablet mode,
+ *
+ * It would call tablet_set_mode() to get out only when there are not
+ * accelerometer, as we want to get out at ~180 degree.
+ * But if for some reason the accelerometers are not working, we won't get
+ * out of tablet mode. Therefore, we need a similar function to go in
+ * clamshell mode when the lid is closed.
+ */
+static __maybe_unused void tablet_mode_lid_event(void)
+{
+ if (!lid_is_open()) {
+ gmr_sensor_at_0 = true;
+ tablet_set_mode(0, TABLET_TRIGGER_LID);
+ if (IS_ENABLED(CONFIG_LID_ANGLE_UPDATE))
+ lid_angle_peripheral_enable(1);
+ } else {
+ gmr_sensor_at_0 = false;
+ }
+}
+#if defined(CONFIG_LID_ANGLE) && defined(CONFIG_LID_SWITCH)
+DECLARE_HOOK(HOOK_LID_CHANGE, tablet_mode_lid_event, HOOK_PRIO_DEFAULT);
+#endif
+
static void gmr_tablet_switch_init(void)
{
/* If this sub-system was disabled before initializing, honor that. */
@@ -193,8 +257,10 @@ static void gmr_tablet_switch_init(void)
* so that the cached state reflects reality.
*/
gmr_tablet_switch_interrupt_debounce();
+ if (IS_ENABLED(CONFIG_LID_ANGLE) && IS_ENABLED(CONFIG_LID_SWITCH))
+ tablet_mode_lid_event();
}
-DECLARE_HOOK(HOOK_INIT, gmr_tablet_switch_init, HOOK_PRIO_DEFAULT);
+DECLARE_HOOK(HOOK_INIT, gmr_tablet_switch_init, HOOK_PRIO_POST_LID);
void gmr_tablet_switch_disable(void)
{
@@ -203,7 +269,7 @@ void gmr_tablet_switch_disable(void)
hook_call_deferred(&gmr_tablet_switch_interrupt_debounce_data, -1);
tablet_disable();
}
-#endif
+#endif /* CONFIG_GMR_TABLET_MODE */
static enum ec_status tablet_mode_command(struct host_cmd_handler_args *args)
{
diff --git a/include/config.h b/include/config.h
index bef08e27b0..8fc9215803 100644
--- a/include/config.h
+++ b/include/config.h
@@ -6975,11 +6975,20 @@
#define CONFIG_GESTURE_SIGMO_SENSOR 0
#endif /* CONFIG_GESTURE_SIGMO */
-#ifndef CONFIG_LID_ANGLE
+#ifdef CONFIG_LID_ANGLE
+#if !defined(CONFIG_LID_ANGLE_SENSOR_BASE) || \
+ !defined(CONFIG_LID_ANGLE_SENSOR_LID)
+#error "Sensors must be identified for calculating lid angle."
+#endif
+#else /* CONFIG_LID_ANGLE */
#define CONFIG_LID_ANGLE_SENSOR_BASE 0
#define CONFIG_LID_ANGLE_SENSOR_LID 0
#endif /* CONFIG_LID_ANGLE */
+#if defined(CONFIG_LID_ANGLE_UPDATE) && !defined(CONFIG_LID_ANGLE)
+#error "CONFIG_LID_ANGLE is needed for CONFIG_LID_ANGLE_UPDATE."
+#endif
+
#ifndef CONFIG_ALS
#define ALS_COUNT 0
#endif /* CONFIG_ALS */
diff --git a/test/build.mk b/test/build.mk
index e22563d064..923c141d33 100644
--- a/test/build.mk
+++ b/test/build.mk
@@ -102,6 +102,8 @@ test-list-host += static_if_error
test-list-host += stdlib
test-list-host += std_vector
test-list-host += system
+test-list-host += tablet_broken_sensor
+test-list-host += tablet_no_sensor
test-list-host += thermal
test-list-host += timer
test-list-host += timer_dos
@@ -262,6 +264,8 @@ stm32f_rtc-y=stm32f_rtc.o
stress-y=stress.o
system-y=system.o
system_is_locked-y=system_is_locked.o
+tablet_broken_sensor-y=tablet_broken_sensor.o
+tablet_no_sensor-y=tablet_no_sensor.o
thermal-y=thermal.o
timer_calib-y=timer_calib.o
timer_dos-y=timer_dos.o
diff --git a/test/tablet_broken_sensor.c b/test/tablet_broken_sensor.c
new file mode 100644
index 0000000000..a6577f7b80
--- /dev/null
+++ b/test/tablet_broken_sensor.c
@@ -0,0 +1,174 @@
+/* Copyright 2023 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Test clamshell/tablet when the sensors are broken.
+ */
+
+#include "accelgyro.h"
+#include "common.h"
+#include "console.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "motion_common.h"
+#include "motion_sense.h"
+#include "tablet_mode.h"
+#include "test_util.h"
+#include "timer.h"
+#include "util.h"
+
+/*****************************************************************************/
+/* Mock functions */
+static int accel_init(struct motion_sensor_t *s)
+{
+ return EC_ERROR_UNKNOWN;
+}
+
+/* Only populate _init(), sensor stack should not touch the sensors on failure.
+ */
+const struct accelgyro_drv test_motion_sense = {
+ .init = accel_init,
+};
+
+struct motion_sensor_t motion_sensors[] = {
+ [BASE] = {
+ .name = "base",
+ .active_mask = SENSOR_ACTIVE_S0_S3_S5,
+ .chip = MOTIONSENSE_CHIP_LSM6DS0,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &test_motion_sense,
+ .rot_standard_ref = NULL,
+ .default_range = 2,
+ },
+ [LID] = {
+ .name = "lid",
+ .active_mask = SENSOR_ACTIVE_S0_S3_S5,
+ .chip = MOTIONSENSE_CHIP_KXCJ9,
+ .type = MOTIONSENSE_TYPE_ACCEL,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &test_motion_sense,
+ .rot_standard_ref = NULL,
+ .default_range = 2,
+ },
+};
+const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
+
+static int tablet_hook_count;
+
+static void tablet_mode_change_hook(void)
+{
+ tablet_hook_count++;
+}
+DECLARE_HOOK(HOOK_TABLET_MODE_CHANGE, tablet_mode_change_hook,
+ HOOK_PRIO_DEFAULT);
+
+void before_test(void)
+{
+ /* Make sure the device lid is in a consistent state (close). */
+ gpio_set_level(GPIO_TABLET_MODE_L, 1);
+ msleep(50);
+ gpio_set_level(GPIO_LID_OPEN, 0);
+ msleep(50);
+ tablet_hook_count = 1;
+}
+
+/*
+ * The device is in clamshell mode from before_test(),
+ * Go through GPIO transitions and observe the table mode state.
+ */
+test_static int test_start_lid_close(void)
+{
+ TEST_ASSERT(!tablet_get_mode());
+
+ /* Opening, No change. */
+ gpio_set_level(GPIO_LID_OPEN, 1);
+ msleep(50);
+ TEST_ASSERT(tablet_hook_count == 1);
+ TEST_ASSERT(!tablet_get_mode());
+
+ /* full 360, tablet mode. */
+ gpio_set_level(GPIO_TABLET_MODE_L, 0);
+ msleep(50);
+ TEST_ASSERT(tablet_hook_count == 2);
+ TEST_ASSERT(tablet_get_mode());
+
+ /* Going out of 360 mode, no change. */
+ gpio_set_level(GPIO_TABLET_MODE_L, 1);
+ msleep(50);
+ TEST_ASSERT(tablet_hook_count == 2);
+ TEST_ASSERT(tablet_get_mode());
+
+ /* Back to close. */
+ gpio_set_level(GPIO_LID_OPEN, 0);
+ msleep(50);
+ TEST_ASSERT(tablet_hook_count == 3);
+ TEST_ASSERT(!tablet_get_mode());
+
+ return EC_SUCCESS;
+}
+
+/*
+ * Put the device in tablet mode first.
+ * Reset the EC, keep the existing GPIO level.
+ * Verify the state is not forgotten when the EC starts in tablet mode after
+ * reset.
+ */
+test_static int test_start_tablet_mode(void)
+{
+ /* Go in tablet mode */
+ gpio_set_level(GPIO_LID_OPEN, 1);
+ gpio_set_level(GPIO_TABLET_MODE_L, 0);
+ msleep(50);
+ TEST_ASSERT(tablet_hook_count == 2);
+
+ /* Shutdown device */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN);
+
+ msleep(50);
+ TEST_ASSERT(sensor_active == SENSOR_ACTIVE_S5);
+ TEST_ASSERT(tablet_hook_count == 2);
+ TEST_ASSERT(tablet_get_mode());
+
+ return EC_SUCCESS;
+}
+
+/*
+ * Put the device in tablet mode first.
+ * Do a fast transition from 0 degree to 360 degree:
+ * Observe the transition happens.
+ * then 360 degree to 0 degree.
+ * Observe the transition happens.
+ */
+test_static int test_fast_transition(void)
+{
+ TEST_ASSERT(!tablet_get_mode());
+
+ /* Go in tablet mode fast.*/
+ gpio_set_level(GPIO_LID_OPEN, 1);
+ gpio_set_level(GPIO_TABLET_MODE_L, 0);
+ msleep(50);
+ TEST_ASSERT(tablet_get_mode());
+ TEST_ASSERT(tablet_hook_count == 2);
+
+ /* Go in clamshell mode fast.*/
+ gpio_set_level(GPIO_LID_OPEN, 0);
+ gpio_set_level(GPIO_TABLET_MODE_L, 1);
+ msleep(50);
+ TEST_ASSERT(!tablet_get_mode());
+ TEST_ASSERT(tablet_hook_count == 3);
+
+ return EC_SUCCESS;
+}
+
+void run_test(int argc, const char **argv)
+{
+ test_reset();
+
+ RUN_TEST(test_start_lid_close);
+ RUN_TEST(test_start_tablet_mode);
+ RUN_TEST(test_fast_transition);
+
+ test_print_result();
+}
diff --git a/test/tablet_broken_sensor.tasklist b/test/tablet_broken_sensor.tasklist
new file mode 100644
index 0000000000..04f8e3006d
--- /dev/null
+++ b/test/tablet_broken_sensor.tasklist
@@ -0,0 +1,10 @@
+/* Copyright 2013 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * See CONFIG_TASK_LIST in config.h for details.
+ */
+#define CONFIG_TEST_TASK_LIST \
+ TASK_TEST(MOTIONSENSE, motion_sense_task, NULL, TASK_STACK_SIZE)
diff --git a/test/tablet_no_sensor.c b/test/tablet_no_sensor.c
new file mode 100644
index 0000000000..f6a3d16c11
--- /dev/null
+++ b/test/tablet_no_sensor.c
@@ -0,0 +1,105 @@
+/* Copyright 2023 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Test clamshell/tablet when Only the GMR sensor is driving the tablet mode:
+ * In that mode, tablet mode is entered only when the lid angle is 360 degree.
+ */
+
+#include "common.h"
+#include "console.h"
+#include "gpio.h"
+#include "hooks.h"
+#include "host_command.h"
+#include "tablet_mode.h"
+#include "test_util.h"
+#include "timer.h"
+#include "util.h"
+
+static int tablet_hook_count;
+
+static void tablet_mode_change_hook(void)
+{
+ tablet_hook_count++;
+}
+DECLARE_HOOK(HOOK_TABLET_MODE_CHANGE, tablet_mode_change_hook,
+ HOOK_PRIO_DEFAULT);
+
+void before_test(void)
+{
+ /* Make sure the device lid is in a consistent state (close). */
+ gpio_set_level(GPIO_TABLET_MODE_L, 1);
+ msleep(50);
+ gpio_set_level(GPIO_LID_OPEN, 0);
+ msleep(50);
+ tablet_hook_count = 1;
+}
+
+/*
+ * The device is in clamshell mode from before_test,
+ * Go through GPIO transitions and observe the table mode state.
+ */
+test_static int test_start_lid_close(void)
+{
+ TEST_ASSERT(!tablet_get_mode());
+
+ /* Opening, No change. */
+ gpio_set_level(GPIO_LID_OPEN, 1);
+ msleep(50);
+ TEST_ASSERT(tablet_hook_count == 1);
+ TEST_ASSERT(!tablet_get_mode());
+
+ /* full 360, tablet mode. */
+ gpio_set_level(GPIO_TABLET_MODE_L, 0);
+ msleep(50);
+ TEST_ASSERT(tablet_hook_count == 2);
+ TEST_ASSERT(tablet_get_mode());
+
+ /* Get out of full 360 mode, Immediately back to clamshell mode. */
+ gpio_set_level(GPIO_TABLET_MODE_L, 1);
+ msleep(50);
+ TEST_ASSERT(tablet_hook_count == 3);
+ TEST_ASSERT(!tablet_get_mode());
+
+ /* Back to close, no change. */
+ gpio_set_level(GPIO_LID_OPEN, 0);
+ msleep(50);
+ TEST_ASSERT(tablet_hook_count == 3);
+ TEST_ASSERT(!tablet_get_mode());
+
+ return EC_SUCCESS;
+}
+
+/*
+ * Put the device in tablet mode first.
+ * Reset the EC, keep the existing GPIO level.
+ * Verify the state is not forgotten when the EC starts in tablet mode after
+ * reset.
+ */
+test_static int test_start_tablet_mode(void)
+{
+ /* Go in tablet mode */
+ gpio_set_level(GPIO_LID_OPEN, 1);
+ gpio_set_level(GPIO_TABLET_MODE_L, 0);
+ msleep(50);
+ TEST_ASSERT(tablet_hook_count == 2);
+
+ /* Shutdown device */
+ hook_notify(HOOK_CHIPSET_SHUTDOWN);
+
+ /* Check we start in tablet mode */
+ msleep(50);
+ TEST_ASSERT(tablet_get_mode());
+
+ return EC_SUCCESS;
+}
+
+void run_test(int argc, const char **argv)
+{
+ test_reset();
+
+ RUN_TEST(test_start_lid_close);
+ RUN_TEST(test_start_tablet_mode);
+
+ test_print_result();
+}
diff --git a/test/tablet_no_sensor.tasklist b/test/tablet_no_sensor.tasklist
new file mode 100644
index 0000000000..47a61cc5a5
--- /dev/null
+++ b/test/tablet_no_sensor.tasklist
@@ -0,0 +1,9 @@
+/* Copyright 2013 The ChromiumOS Authors
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/**
+ * See CONFIG_TASK_LIST in config.h for details.
+ */
+#define CONFIG_TEST_TASK_LIST
diff --git a/test/test_config.h b/test/test_config.h
index 926ebba090..d683627c8a 100644
--- a/test/test_config.h
+++ b/test/test_config.h
@@ -199,7 +199,8 @@
#if defined(CONFIG_ONLINE_CALIB) || defined(TEST_BODY_DETECTION) || \
defined(TEST_MOTION_ANGLE) || defined(TEST_MOTION_ANGLE_TABLET) || \
- defined(TEST_MOTION_LID) || defined(TEST_MOTION_SENSE_FIFO)
+ defined(TEST_MOTION_LID) || defined(TEST_MOTION_SENSE_FIFO) || \
+ defined(TEST_TABLET_BROKEN_SENSOR)
enum sensor_id {
BASE,
LID,
@@ -207,7 +208,7 @@ enum sensor_id {
};
#if defined(TEST_MOTION_ANGLE) || defined(TEST_MOTION_ANGLE_TABLET) || \
- defined(TEST_MOTION_LID)
+ defined(TEST_MOTION_LID) || defined(TEST_TABLET_BROKEN_SENSOR)
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE
#define CONFIG_LID_ANGLE_SENSOR_LID LID
@@ -231,6 +232,11 @@ enum sensor_id {
(1 << CONFIG_LID_ANGLE_SENSOR_LID))
#endif
+#if defined(TEST_TABLET_BROKEN_SENSOR) || defined(TEST_TABLET_NO_SENSOR)
+#define CONFIG_TABLET_MODE
+#define CONFIG_GMR_TABLET_MODE
+#endif
+
#if defined(TEST_BODY_DETECTION)
#define CONFIG_BODY_DETECTION
#define CONFIG_BODY_DETECTION_SENSOR BASE