summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2018-11-23 23:27:59 -0800
committerchrome-bot <chrome-bot@chromium.org>2018-11-29 04:31:50 -0800
commitf3c205e9b4bcd391c7eeb633e424f06c20aed99e (patch)
tree7796d068f7cf7eea5a71fee3906631a590080b2f
parent625a4d856d767c3226e6869f5d38ca3c70b2b95c (diff)
downloadchrome-ec-f3c205e9b4bcd391c7eeb633e424f06c20aed99e.tar.gz
motion_lid: Use CONFIG_TABLET_MODE
This change updates motion_lid driver to use CONFIG_TABLET_MODE to decide if device requires reporting of tablet mode. This basically makes the config options CONFIG_LID_ANGLE_INVALID_CHECK and CONFIG_LID_ANGLE_TABLET_MODE obsolete. Now that EC will always report tablet mode aligned with Chrome (at 180 degree), any device that supports tablet mode and uses motion lid driver will require this by default and should not require boards to individually select any special config options. Thus, it also gets rid of unused CONFIG_LID_ANGLE_TABLET_MODE and CONFIG_LID_ANGLE_INVALID_CHECK. BUG=b:120050761 BRANCH=octopus TEST=make -j buildall Change-Id: Ib73af66ca1c17d4033cf54f0b4b86bf41793f3a3 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://chromium-review.googlesource.com/1350470 Commit-Ready: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org>
-rw-r--r--board/grunt/board.h2
-rw-r--r--board/meep/board.h2
-rw-r--r--board/nami/board.h2
-rw-r--r--board/nautilus/board.h2
-rw-r--r--board/phaser/board.h2
-rw-r--r--board/rammus/board.h2
-rw-r--r--board/yorp/board.h2
-rw-r--r--common/motion_lid.c17
-rw-r--r--common/motion_sense.c2
-rw-r--r--include/config.h11
-rw-r--r--test/test_config.h2
11 files changed, 6 insertions, 40 deletions
diff --git a/board/grunt/board.h b/board/grunt/board.h
index 08ce881a12..c4a27ad4d9 100644
--- a/board/grunt/board.h
+++ b/board/grunt/board.h
@@ -52,8 +52,6 @@
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_TABLET_MODE
#define CONFIG_LID_ANGLE
-#define CONFIG_LID_ANGLE_TABLET_MODE
-#define CONFIG_LID_ANGLE_INVALID_CHECK
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
diff --git a/board/meep/board.h b/board/meep/board.h
index c68dce6f53..029e833d2e 100644
--- a/board/meep/board.h
+++ b/board/meep/board.h
@@ -37,8 +37,6 @@
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
-#define CONFIG_LID_ANGLE_TABLET_MODE
-#define CONFIG_LID_ANGLE_INVALID_CHECK
#define CONFIG_TEMP_SENSOR
#define CONFIG_THERMISTOR
diff --git a/board/nami/board.h b/board/nami/board.h
index c68fd5834f..69b26ca524 100644
--- a/board/nami/board.h
+++ b/board/nami/board.h
@@ -141,8 +141,6 @@
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_TABLET_MODE
-#define CONFIG_LID_ANGLE_INVALID_CHECK
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* KB backlight driver */
diff --git a/board/nautilus/board.h b/board/nautilus/board.h
index 221435c5bb..c64a33a724 100644
--- a/board/nautilus/board.h
+++ b/board/nautilus/board.h
@@ -121,8 +121,6 @@
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_TABLET_MODE
-#define CONFIG_LID_ANGLE_INVALID_CHECK
/* FIFO size is in power of 2. */
#define CONFIG_ACCEL_FIFO 512
diff --git a/board/phaser/board.h b/board/phaser/board.h
index f507d6a949..d86b93dc84 100644
--- a/board/phaser/board.h
+++ b/board/phaser/board.h
@@ -38,8 +38,6 @@
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
-#define CONFIG_LID_ANGLE_TABLET_MODE
-#define CONFIG_LID_ANGLE_INVALID_CHECK
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Interrupt and fifo are only used for base accelerometer
diff --git a/board/rammus/board.h b/board/rammus/board.h
index 22686ba34e..dec50b87d1 100644
--- a/board/rammus/board.h
+++ b/board/rammus/board.h
@@ -122,8 +122,6 @@
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
#define CONFIG_LID_ANGLE_UPDATE
-#define CONFIG_LID_ANGLE_TABLET_MODE
-#define CONFIG_LID_ANGLE_INVALID_CHECK
/* FIFO size is in power of 2. */
#define CONFIG_ACCEL_FIFO 512
diff --git a/board/yorp/board.h b/board/yorp/board.h
index cad984afe4..d0200ce6f2 100644
--- a/board/yorp/board.h
+++ b/board/yorp/board.h
@@ -33,8 +33,6 @@
#define CONFIG_LID_ANGLE_UPDATE
#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
-#define CONFIG_LID_ANGLE_TABLET_MODE
-#define CONFIG_LID_ANGLE_INVALID_CHECK
#define CONFIG_TEMP_SENSOR
#define CONFIG_THERMISTOR
diff --git a/common/motion_lid.c b/common/motion_lid.c
index 87af23c435..8d150e3b65 100644
--- a/common/motion_lid.c
+++ b/common/motion_lid.c
@@ -29,7 +29,7 @@
#define CPRINTS(format, args...) cprints(CC_MOTION_LID, format, ## args)
#define CPRINTF(format, args...) cprintf(CC_MOTION_LID, format, ## args)
-#ifdef CONFIG_LID_ANGLE_INVALID_CHECK
+#ifdef CONFIG_TABLET_MODE
/* Previous lid_angle. */
static fp_t last_lid_angle_fp = FLOAT_TO_FP(-1);
@@ -116,19 +116,12 @@ const struct motion_sensor_t * const accel_base =
const struct motion_sensor_t * const accel_lid =
&motion_sensors[CONFIG_LID_ANGLE_SENSOR_LID];
+#ifdef CONFIG_TABLET_MODE
__attribute__((weak)) int board_is_lid_angle_tablet_mode(void)
{
-#ifdef CONFIG_LID_ANGLE_TABLET_MODE
return 1;
-#else
- return 0;
-#endif
}
-#ifdef CONFIG_LID_ANGLE_TABLET_MODE
-#ifndef CONFIG_LID_ANGLE_INVALID_CHECK
-#error "Check for invalid transition needed"
-#endif
/*
* We are in tablet mode when the lid angle has been calculated
* to be large.
@@ -202,7 +195,7 @@ static void motion_lid_set_tablet_mode(int reliable)
tablet_mode_debounce_cnt = TABLET_MODE_DEBOUNCE_COUNT;
}
-#endif /* CONFIG_LID_ANGLE_TABLET_MODE */
+#endif /* CONFIG_TABLET_MODE */
#if defined(CONFIG_DPTF_MULTI_PROFILE) && \
defined(CONFIG_DPTF_MOTION_LID_NO_HALL_SENSOR)
@@ -405,7 +398,7 @@ static int calculate_lid_angle(const intv3_t base, const intv3_t lid,
(2 * 10 * NOISY_MAGNITUDE_DEVIATION))
reliable = 0;
-#ifdef CONFIG_LID_ANGLE_INVALID_CHECK
+#ifdef CONFIG_TABLET_MODE
/* Ignore large angles when the lid is closed. */
if (!lid_is_open() &&
(lid_to_base_fp > FLOAT_TO_FP(SMALL_LID_ANGLE_RANGE)))
@@ -464,7 +457,7 @@ static int calculate_lid_angle(const intv3_t base, const intv3_t lid,
motion_lid_set_dptf_profile(reliable);
#endif /* CONFIG_DPTF_MULTI_PROFILE && CONFIG_DPTF_MOTION_LID_NO_HALL_SENSOR */
-#else /* CONFIG_LID_ANGLE_INVALID_CHECK */
+#else /* CONFIG_TABLET_MODE */
*lid_angle = FP_TO_INT(lid_to_base_fp + FLOAT_TO_FP(0.5));
#endif
return reliable;
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 8e1fe4e35b..e5afb3e142 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -501,7 +501,7 @@ static void motion_sense_switch_sensor_rate(void)
if (ret != EC_SUCCESS) {
CPRINTS("%s: %d: init failed: %d",
sensor->name, i, ret);
-#ifdef CONFIG_LID_ANGLE_TABLET_MODE
+#if defined(CONFIG_TABLET_MODE) && defined(CONFIG_LID_ANGLE)
/*
* No tablet mode allowed if an accel
* is not working.
diff --git a/include/config.h b/include/config.h
index 1e7b9b3a09..85f6204388 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1732,17 +1732,6 @@
/* Do we want to detect the lid angle? */
#undef CONFIG_LID_ANGLE
-/*
- * Add code for preventing 0 and 360 degree transition. Needed when
- * Device supports tablet mode.
- */
-#undef CONFIG_LID_ANGLE_INVALID_CHECK
-
-/*
- * Use lid angle to detect tablet mode.
- */
-#undef CONFIG_LID_ANGLE_TABLET_MODE
-
/* Which sensor is located on the base? */
#undef CONFIG_LID_ANGLE_SENSOR_BASE
/* Which sensor is located on the lid? */
diff --git a/test/test_config.h b/test/test_config.h
index a53ea87656..1dfe0a2ffd 100644
--- a/test/test_config.h
+++ b/test/test_config.h
@@ -66,8 +66,6 @@
#ifdef TEST_MOTION_LID
#define CONFIG_LID_ANGLE
-#define CONFIG_LID_ANGLE_INVALID_CHECK
-#define CONFIG_LID_ANGLE_TABLET_MODE
#define CONFIG_LID_ANGLE_SENSOR_BASE 0
#define CONFIG_LID_ANGLE_SENSOR_LID 1
#define CONFIG_TABLET_MODE