diff options
author | Karthikeyan Ramasubramanian <kramasub@chromium.org> | 2018-10-01 14:28:52 -0600 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-10-19 15:07:41 -0700 |
commit | 4d4d8f06e91090336c2eb29ee00ca86fea2bb796 (patch) | |
tree | 4e3abd72c6c2eb8c35b122b6517ff5f01ddab529 /board/meep | |
parent | b1753218caff75713e8a5ddf58344bf4cec21941 (diff) | |
download | chrome-ec-4d4d8f06e91090336c2eb29ee00ca86fea2bb796.tar.gz |
board/meep: Add magnetometer config
Enable the required modules to support magnetometer module and add
magnetometer configuration.
BRANCH=none
BUG=b:115587004
TEST=Collect magnetometer readings through ectool motionsense
Change-Id: Ibe2b624716b3a9a1ffba93e0b1b7edf3b718b6f9
Signed-off-by: Karthikeyan Ramasubramanian <kramasub@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1257505
Reviewed-by: Furquan Shaikh <furquan@chromium.org>
Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'board/meep')
-rw-r--r-- | board/meep/board.c | 29 | ||||
-rw-r--r-- | board/meep/board.h | 3 |
2 files changed, 31 insertions, 1 deletions
diff --git a/board/meep/board.c b/board/meep/board.c index 29352c3924..5abf3338d6 100644 --- a/board/meep/board.c +++ b/board/meep/board.c @@ -17,6 +17,7 @@ #include "driver/accel_kionix.h" #include "driver/accelgyro_lsm6dsm.h" #include "driver/charger/bd9995x.h" +#include "driver/mag_lis2mdl.h" #include "driver/ppc/nx20p348x.h" #include "driver/tcpm/anx7447.h" #include "driver/tcpm/ps8xxx.h" @@ -127,10 +128,17 @@ const mat33_fp_t base_standard_ref = { { 0, 0, FLOAT_TO_FP(1)} }; +const mat33_fp_t mag_standard_ref = { + { FLOAT_TO_FP(-1), 0, 0}, + { 0, FLOAT_TO_FP(1), 0}, + { 0, 0, FLOAT_TO_FP(-1)} +}; + /* sensor private data */ static struct kionix_accel_data g_kx022_data; static struct lsm6dsm_data lsm6dsm_g_data; static struct lsm6dsm_data lsm6dsm_a_data; +static struct lsm6dsm_data lis2mdl_data; /* Drivers */ struct motion_sensor_t motion_sensors[] = { @@ -190,7 +198,7 @@ struct motion_sensor_t motion_sensors[] = { [BASE_GYRO] = { .name = "Base Gyro", - .active_mask = SENSOR_ACTIVE_S0, + .active_mask = SENSOR_ACTIVE_S0_S3, .chip = MOTIONSENSE_CHIP_LSM6DSM, .type = MOTIONSENSE_TYPE_GYRO, .location = MOTIONSENSE_LOC_BASE, @@ -204,6 +212,25 @@ struct motion_sensor_t motion_sensors[] = { .min_frequency = LSM6DSM_ODR_MIN_VAL, .max_frequency = LSM6DSM_ODR_MAX_VAL, }, + + [BASE_MAG] = { + .name = "Base Mag", + .active_mask = SENSOR_ACTIVE_S0_S3, + .chip = MOTIONSENSE_CHIP_LSM6DSM, + .type = MOTIONSENSE_TYPE_MAG, + .location = MOTIONSENSE_LOC_BASE, + .drv = &lis2mdl_drv, + .mutex = &g_base_mutex, + .drv_data = &lis2mdl_data, + .parent = &motion_sensors[BASE_ACCEL], + .port = I2C_PORT_SENSOR, + .addr = LIS2MDL_ADDR0, + .default_range = LIS2MDL_RANGE, + .rot_standard_ref = &mag_standard_ref, + .min_frequency = LIS2MDL_ODR_MIN_VAL, + .max_frequency = LIS2MDL_ODR_MAX_VAL, + }, + }; unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/meep/board.h b/board/meep/board.h index 19654807d4..7949fe4518 100644 --- a/board/meep/board.h +++ b/board/meep/board.h @@ -27,6 +27,8 @@ /* Sensors */ #define CONFIG_ACCEL_KX022 /* Lid accel */ #define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */ +#define CONFIG_SENSORHUB_LSM6DSM +#define CONFIG_MAG_LIS2MDL /* Sensors without hardware FIFO are in forced mode */ #define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL) #define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT @@ -89,6 +91,7 @@ enum sensor_id { LID_ACCEL, BASE_ACCEL, BASE_GYRO, + BASE_MAG, SENSOR_COUNT }; |