kevin: change coordinates axis for sensors

BUG=chrome-os-partner:52844
BRANCH=none
TEST=check x-y-z value from base/lid accelerometer with ec console
command 'accelread'

Change-Id: I38a83f13e415504600cc6c566cf8586e1309a270
Signed-off-by: Inno Park <ih.yoo.park@samsung.com>
Reviewed-on: https://chromium-review.googlesource.com/354321
Commit-Ready: Aseda Aboagye <aaboagye@chromium.org>
Tested-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
Inno Park
2016-06-21 14:17:15 +09:00
committed by chrome-bot
parent e098622de7
commit db1b3b34c2

View File

@@ -351,6 +351,19 @@ static struct mutex g_lid_mutex;
struct bma2x2_accel_data g_bma255_data = {
.variant = BMA255,
};
/* Matrix to rotate accelrator into standard reference frame */
const matrix_3x3_t base_standard_ref = {
{ 0, FLOAT_TO_FP(-1), 0},
{ FLOAT_TO_FP(-1), 0, 0},
{ 0, 0, FLOAT_TO_FP(1)}
};
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)}
};
#endif
struct motion_sensor_t motion_sensors[] = {
@@ -369,7 +382,11 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_bmi160_data,
.port = CONFIG_SPI_ACCEL_PORT,
.addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
#ifdef BOARD_KEVIN
.rot_standard_ref = &base_standard_ref,
#else
.rot_standard_ref = NULL, /* Identity matrix. */
#endif
.default_range = 2, /* g, enough for laptop. */
.config = {
/* AP: by default use EC settings */
@@ -406,7 +423,11 @@ struct motion_sensor_t motion_sensors[] = {
.port = CONFIG_SPI_ACCEL_PORT,
.addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
.default_range = 1000, /* dps */
.rot_standard_ref = NULL, /* Identity Matrix. */
#ifdef BOARD_KEVIN
.rot_standard_ref = &base_standard_ref, /* Identity Matrix. */
#else
.rot_standard_ref = NULL, /* Identity matrix. */
#endif
.config = {
/* AP: by default shutdown all sensors */
[SENSOR_CONFIG_AP] = {
@@ -442,7 +463,7 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_bma255_data,
.port = I2C_PORT_ACCEL,
.addr = BMA2x2_I2C_ADDR1,
.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 */