From 0ae8c5584d3648c76bd8e8fca0a27ae20d1bb761 Mon Sep 17 00:00:00 2001 From: Ting Shen Date: Wed, 3 Jul 2019 03:56:32 +0000 Subject: krane: Fix g-sensor reference point for all revisions This should apply to all Kranes. BUG=b:131081336 TEST=factory accelometer test BRANCH=master Change-Id: I44313d73bf6dd484101973e153c6b5209128a789 Signed-off-by: Ting Shen Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1687832 Reviewed-by: Nicolas Boichat --- board/kukui/board.c | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/board/kukui/board.c b/board/kukui/board.c index 23261f7089..e31e6092be 100644 --- a/board/kukui/board.c +++ b/board/kukui/board.c @@ -437,21 +437,20 @@ static struct tcs3400_rgb_drv_data_t g_tcs3400_rgb_data = { }, }; -#ifdef BOARD_KRANE /* Matrix to rotate accelerometer into standard reference frame */ -static const mat33_fp_t lid_standard_ref_rev3 = { - {0, FLOAT_TO_FP(-1), 0}, +#ifdef BOARD_KUKUI +static const mat33_fp_t lid_standard_ref = { {FLOAT_TO_FP(1), 0, 0}, + {0, FLOAT_TO_FP(1), 0}, {0, 0, FLOAT_TO_FP(1)} }; -#endif /* BOARD_KRANE */ - -/* Matrix to rotate accelerometer into standard reference frame */ +#else static const mat33_fp_t lid_standard_ref = { + {0, FLOAT_TO_FP(-1), 0}, {FLOAT_TO_FP(1), 0, 0}, - {0, FLOAT_TO_FP(1), 0}, {0, 0, FLOAT_TO_FP(1)} }; +#endif /* BOARD_KUKUI */ #ifdef CONFIG_MAG_BMI160_BMM150 /* Matrix to rotate accelrator into standard reference frame */ @@ -576,24 +575,8 @@ const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); const struct motion_sensor_t *motion_als_sensors[] = { &motion_sensors[CLEAR_ALS], }; - #endif /* SECTION_IS_RW */ -#ifdef BOARD_KRANE -static void fix_krane(void) -{ - if (board_get_version() != 3) - return; - -#ifdef SECTION_IS_RW - /* Fix reference point */ - motion_sensors[LID_ACCEL].rot_standard_ref = &lid_standard_ref_rev3; - motion_sensors[LID_GYRO].rot_standard_ref = &lid_standard_ref_rev3; -#endif /* SECTION_IS_RW */ -} -DECLARE_HOOK(HOOK_INIT, fix_krane, HOOK_PRIO_INIT_ADC + 1); -#endif /* BOARD_KRANE */ - int board_allow_i2c_passthru(int port) { return (port == I2C_PORT_VIRTUAL_BATTERY); -- cgit v1.2.1