summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorFurquan Shaikh <furquan@google.com>2018-11-23 23:27:59 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-12-26 03:17:52 +0000
commitd3c8b0b538c9e960f5ac1644d8d16b498d16c9ef (patch)
tree4733465581fcd6d713f74b2f47cc158fcf5ceed0 /common
parent72074a86ffc4c2768bfef71bc40f4603d2a17bf9 (diff)
downloadchrome-ec-d3c8b0b538c9e960f5ac1644d8d16b498d16c9ef.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> Reviewed-on: https://chromium-review.googlesource.com/c/1379414 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Tested-by: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com> Commit-Queue: Michael5 Chen <michael5_chen1@pegatron.corp-partner.google.com>
Diffstat (limited to 'common')
-rw-r--r--common/motion_lid.c17
-rw-r--r--common/motion_sense.c2
2 files changed, 6 insertions, 13 deletions
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.