summaryrefslogtreecommitdiff
path: root/common/motion_sense.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2016-09-01 15:01:03 -0700
committerchrome-bot <chrome-bot@chromium.org>2016-09-09 12:33:21 -0700
commit97f1475fb5bc63ba6de8f5c9379c14d1ada46ad4 (patch)
tree7c6b28fb0397c85aee2023f8c1034aa5289d0bd1 /common/motion_sense.c
parent8a3b9988683e8d2d42837daede1fbd3f220c19b5 (diff)
downloadchrome-ec-97f1475fb5bc63ba6de8f5c9379c14d1ada46ad4.tar.gz
motion: Add tablet mode flag.
User of sensor data can use tablet mode to rotate the sensor datums along the X axis. This is useful on Kevin where we gather base data. When the base is behind the lid, the datums needs to be rotated by 180 to be in the lid referential. BUG=b:27849483 BRANCH=none TEST=check the sensors changes when kevin is in tablet mode. Change-Id: I60147600f534df0770a44b5158ef8afe87d9dd9d Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/380413 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r--common/motion_sense.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index df8360229e..12e6d3ca2b 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -127,6 +127,16 @@ void motion_sense_fifo_add_unit(struct ec_response_motion_sensor_data *data,
motion_sense_insert_timestamp();
wake_up_needed = 1;
}
+#ifdef CONFIG_LID_ANGLE_TABLET_MODE
+ data->flags |= (motion_lid_in_tablet_mode() ?
+ MOTIONSENSE_SENSOR_FLAG_TABLET_MODE : 0);
+#elif defined(CONFIG_DPTF_DEVICE_ORIENTATION)
+ /*
+ * TODO(gwendal): When other method finding tablet mode are used.
+ * define them here.
+ */
+#error "Need to set we are in tablet mode"
+#endif
mutex_lock(&g_sensor_mutex);
queue_add_unit(&motion_sense_fifo, data);
mutex_unlock(&g_sensor_mutex);