diff options
author | jerry2.huang <jerry2.huang@lcfc.corp-partner.google.com> | 2020-11-03 13:38:28 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-11-13 10:41:56 +0000 |
commit | 2b9666556feda37e6fda9c081dd7403ea8b6ec3f (patch) | |
tree | bfaa85b4646331cee926300c679375d672735126 | |
parent | 374f9818e82f3d8285e8ffcfc6c3c6f67d60be44 (diff) | |
download | chrome-ec-2b9666556feda37e6fda9c081dd7403ea8b6ec3f.tar.gz |
boten: add motion sensor interrupt config and matrices
Add config for boten motion sensor's interrupt and matrices for rotate
BUG=b:172290264
BRANCH=none
TEST=buildall, flash ec to dut and boot to check the ectool command
motionsense work normally.
Signed-off-by: jerry2.huang <jerry2.huang@lcfc.corp-partner.google.com>
Change-Id: I89e3f5d1c5e460ed26126c5d0489afde7c7843f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2515430
Reviewed-by: Henry Sun <henrysun@google.com>
Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r-- | board/boten/board.c | 19 | ||||
-rw-r--r-- | board/boten/board.h | 2 |
2 files changed, 18 insertions, 3 deletions
diff --git a/board/boten/board.c b/board/boten/board.c index edfff35f4e..0e82934373 100644 --- a/board/boten/board.c +++ b/board/boten/board.c @@ -282,6 +282,19 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); static struct mutex g_lid_mutex; static struct mutex g_base_mutex; +/* Matrices to rotate accelerometers into the standard reference. */ +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)} +}; + +static const mat33_fp_t base_standard_ref = { + { FLOAT_TO_FP(1), 0, 0}, + { 0, FLOAT_TO_FP(1), 0}, + { 0, 0, FLOAT_TO_FP(-1)} +}; + /* Sensor Data */ static struct stprivate_data g_lis2dwl_data; static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA; @@ -299,7 +312,7 @@ struct motion_sensor_t motion_sensors[] = { .drv_data = &g_lis2dwl_data, .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = LIS2DWL_ADDR1_FLAGS, - .rot_standard_ref = NULL, + .rot_standard_ref = &lid_standard_ref, .default_range = 2, /* g */ .min_frequency = LIS2DW12_ODR_MIN_VAL, .max_frequency = LIS2DW12_ODR_MAX_VAL, @@ -326,7 +339,7 @@ struct motion_sensor_t motion_sensors[] = { .flags = MOTIONSENSE_FLAG_INT_SIGNAL, .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, - .rot_standard_ref = NULL, + .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g */ .min_frequency = LSM6DSM_ODR_MIN_VAL, .max_frequency = LSM6DSM_ODR_MAX_VAL, @@ -356,7 +369,7 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_SENSOR, .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, .default_range = 1000 | ROUND_UP_FLAG, /* dps */ - .rot_standard_ref = NULL, + .rot_standard_ref = &base_standard_ref, .min_frequency = LSM6DSM_ODR_MIN_VAL, .max_frequency = LSM6DSM_ODR_MAX_VAL, }, diff --git a/board/boten/board.h b/board/boten/board.h index f8ce11b817..f74be69f3b 100644 --- a/board/boten/board.h +++ b/board/boten/board.h @@ -41,6 +41,8 @@ /* Sensors */ #define CONFIG_ACCEL_LIS2DWL /* Lid accel */ #define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */ +#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \ + TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) /* Sensors without hardware FIFO are in forced mode */ #define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL) |