soraka: Update reference matrix for soraka rev >=4

BRANCH=none
BUG=b:64193765
TEST=Matrix orientation is correct on soraka rev3 and rev4.

Change-Id: Ibd71ee980665f88c7494a4c215804a36ae5ae02c
Signed-off-by: Nicolas Boichat <drinkcat@google.com>
Reviewed-on: https://chromium-review.googlesource.com/593530
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Kitty Liu <kitty.liu@intel.corp-partner.google.com>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Kitty Liu <kitty.liu@intel.corp-partner.google.com>
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
This commit is contained in:
Nicolas Boichat
2017-07-31 16:08:24 +08:00
committed by chrome-bot
parent d67e76fb42
commit c493763c34

View File

@@ -749,11 +749,26 @@ const matrix_3x3_t mag_standard_ref = {
{ 0, 0, FLOAT_TO_FP(-1)}
};
#ifdef BOARD_SORAKA
const matrix_3x3_t lid_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0},
{FLOAT_TO_FP(1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
/* For rev3 and older */
const matrix_3x3_t lid_standard_ref_old = {
{FLOAT_TO_FP(-1), 0, 0},
{ 0, FLOAT_TO_FP(-1), 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
#else
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)}
};
#endif
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -875,6 +890,20 @@ struct motion_sensor_t motion_sensors[] = {
};
const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors);
#ifdef BOARD_SORAKA
static void board_sensor_init(void)
{
/* Old soraka use a different reference matrix */
if (system_get_board_version() <= 3) {
motion_sensors[LID_ACCEL].rot_standard_ref =
&lid_standard_ref_old;
motion_sensors[LID_GYRO].rot_standard_ref =
&lid_standard_ref_old;
}
}
DECLARE_HOOK(HOOK_INIT, board_sensor_init, HOOK_PRIO_DEFAULT);
#endif
/* Called on AP S3 -> S0 transition */
static void board_chipset_resume(void)
{