From 8be8b1d6f832f05e76268eaba890e2120da87a54 Mon Sep 17 00:00:00 2001 From: Ben Chen Date: Thu, 3 Jun 2021 14:31:00 +0800 Subject: 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 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2935654 Reviewed-by: Aseda Aboagye --- board/magolor/board.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'board/magolor/board.c') 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 */ -- cgit v1.2.1