summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Chen <ben.chen2@quanta.corp-partner.google.com>2021-06-03 14:31:00 +0800
committerCommit Bot <commit-bot@chromium.org>2021-06-08 04:34:21 +0000
commit8be8b1d6f832f05e76268eaba890e2120da87a54 (patch)
treeac724b0f368c0c3d621716b08fd422ff0c8b4fb1
parent02a797239371262fa47865cf31a6ec322a87db27 (diff)
downloadchrome-ec-8be8b1d6f832f05e76268eaba890e2120da87a54.tar.gz
magister: modify motionse lid sensor matrix
Change rotations matrices of lid accel by board version. magister board version define >= 5. other reserved. BUG=b:189909945 BRANCH=dedede TEST=Using ectool 'motionsense' verified lid angle now goes from 0 to 360 and swtiches to tablet mode after crossing 200 threshold. Change-Id: I9670c8602814041503c512618c68fb3feb273f40 Signed-off-by: Ben Chen <ben.chen2@quanta.corp-partner.google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2935654 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
-rw-r--r--board/magolor/board.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/board/magolor/board.c b/board/magolor/board.c
index d8002c49ab..5b3c5b0c4d 100644
--- a/board/magolor/board.c
+++ b/board/magolor/board.c
@@ -548,6 +548,13 @@ static const mat33_fp_t lid_standard_ref = {
{ 0, 0, FLOAT_TO_FP(-1)}
};
+/* Matrices to rotate accelerometers into the magister reference. */
+static const mat33_fp_t lid_magister_ref = {
+ { FLOAT_TO_FP(-1), 0, 0},
+ { 0, FLOAT_TO_FP(-1), 0},
+ { 0, 0, FLOAT_TO_FP(1)}
+};
+
static const mat33_fp_t base_standard_ref = {
{ 0, FLOAT_TO_FP(1), 0},
{ FLOAT_TO_FP(1), 0, 0},
@@ -768,8 +775,13 @@ void board_init(void)
if (get_cbi_ssfc_lid_sensor() == SSFC_SENSOR_KX022) {
motion_sensors[LID_ACCEL] = kx022_lid_accel;
ccprints("LID_ACCEL is KX022");
- } else
+ } else {
+ if (system_get_board_version() >= 5) {
+ motion_sensors[LID_ACCEL]
+ .rot_standard_ref = &lid_magister_ref;
+ }
ccprints("LID_ACCEL is BMA253");
+ }
#endif
motion_sensor_count = ARRAY_SIZE(motion_sensors);
/* Enable gpio interrupt for base accelgyro sensor */