summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKoro Chen <koro.chen@mediatek.com>2016-05-09 19:48:30 +0800
committerchrome-bot <chrome-bot@chromium.org>2016-05-16 20:58:13 -0700
commit73f2b710e1784b2d8bc219105d550c4c8ad55f27 (patch)
tree1d500667c7f490904851f0eb13bda583e5640b5f
parent238775109520bc685fa982c9155a2a7ef9775a0d (diff)
downloadchrome-ec-73f2b710e1784b2d8bc219105d550c4c8ad55f27.tar.gz
elm: set up rotation matrices for EVT
Some axes of base and lid accelerometers on EVT needs to be reversed to match the standard reference frame. BUG=chrome-os-partner:52776 BRANCH=none TEST=accelinfo on and check the lidangle reported is correct when I am changing the lid angle Change-Id: Id340d28a740d00c7ff4508f5f804fe90fd8ba18c Signed-off-by: Koro Chen <koro.chen@mediatek.com> Signed-off-by: Ricky Liang <jcliang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/343490
-rw-r--r--board/elm/board.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/board/elm/board.c b/board/elm/board.c
index 9394acea09..809680931d 100644
--- a/board/elm/board.c
+++ b/board/elm/board.c
@@ -411,12 +411,17 @@ DECLARE_HOOK(HOOK_CHIPSET_SUSPEND, board_chipset_suspend, HOOK_PRIO_DEFAULT);
/* Mutexes */
static struct mutex g_kx022_mutex[2];
-/* TODO: check if we need this rotation or not */
-/* Matrix to rotate accelrator into standard reference frame */
+/* Matrix to rotate accelerometer into standard reference frame */
const matrix_3x3_t base_standard_ref = {
{ FLOAT_TO_FP(-1), 0, 0},
+ { 0, FLOAT_TO_FP(1), 0},
+ { 0, 0, FLOAT_TO_FP(-1)}
+};
+
+const matrix_3x3_t lid_standard_ref = {
+ { FLOAT_TO_FP(1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
- { 0, 0, FLOAT_TO_FP(1)}
+ { 0, 0, FLOAT_TO_FP(-1)}
};
/* KX022 private data */
@@ -435,7 +440,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_kx022_mutex[0],
.drv_data = &g_kx022_data[0],
.addr = 1, /* SPI, device ID 0 */
- .rot_standard_ref = NULL, /* Identity matrix. */
+ .rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.config = {
/* AP: by default use EC settings */
@@ -469,7 +474,7 @@ struct motion_sensor_t motion_sensors[] = {
.mutex = &g_kx022_mutex[1],
.drv_data = &g_kx022_data[1],
.addr = 3, /* SPI, device ID 1 */
- .rot_standard_ref = NULL, /* Identity matrix. */
+ .rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
.config = {
/* AP: by default use EC settings */