summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/madoo/board.c47
-rw-r--r--board/madoo/board.h4
-rw-r--r--board/madoo/gpio.inc2
3 files changed, 26 insertions, 27 deletions
diff --git a/board/madoo/board.c b/board/madoo/board.c
index 9e1766bc97..d39e6de7dd 100644
--- a/board/madoo/board.c
+++ b/board/madoo/board.c
@@ -16,6 +16,7 @@
#include "compile_time_macros.h"
#include "driver/accel_bma2x2.h"
#include "driver/accelgyro_bmi_common.h"
+#include "driver/accelgyro_lsm6dsm.h"
#include "driver/bc12/pi3usb9201.h"
#include "driver/charger/isl923x.h"
#include "driver/retimer/nb7v904m.h"
@@ -360,14 +361,8 @@ static const mat33_fp_t lid_standard_ref = {
{ 0, 0, FLOAT_TO_FP(1)}
};
-static const mat33_fp_t base_standard_ref = {
- { 0, FLOAT_TO_FP(1), 0},
- { FLOAT_TO_FP(-1), 0, 0},
- { 0, 0, FLOAT_TO_FP(1)}
-};
-
static struct accelgyro_saved_data_t g_bma253_data;
-static struct bmi_drv_data_t g_bmi160_data;
+static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA;
struct motion_sensor_t motion_sensors[] = {
[LID_ACCEL] = {
@@ -397,18 +392,21 @@ struct motion_sensor_t motion_sensors[] = {
[BASE_ACCEL] = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI160,
+ .chip = MOTIONSENSE_CHIP_LSM6DSM,
.type = MOTIONSENSE_TYPE_ACCEL,
.location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi160_drv,
+ .drv = &lsm6dsm_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi160_data,
+ .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
+ MOTIONSENSE_TYPE_ACCEL),
+ .int_signal = GPIO_BASE_SIXAXIS_INT_L,
+ .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .rot_standard_ref = &base_standard_ref,
- .default_range = 4,
- .min_frequency = BMI_ACCEL_MIN_FREQ,
- .max_frequency = BMI_ACCEL_MAX_FREQ,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
+ .rot_standard_ref = NULL,
+ .default_range = 4, /* g */
+ .min_frequency = LSM6DSM_ODR_MIN_VAL,
+ .max_frequency = LSM6DSM_ODR_MAX_VAL,
.config = {
[SENSOR_CONFIG_EC_S0] = {
.odr = 13000 | ROUND_UP_FLAG,
@@ -423,18 +421,21 @@ struct motion_sensor_t motion_sensors[] = {
[BASE_GYRO] = {
.name = "Base Gyro",
.active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI160,
+ .chip = MOTIONSENSE_CHIP_LSM6DSM,
.type = MOTIONSENSE_TYPE_GYRO,
.location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi160_drv,
+ .drv = &lsm6dsm_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi160_data,
+ .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data,
+ MOTIONSENSE_TYPE_GYRO),
+ .int_signal = GPIO_BASE_SIXAXIS_INT_L,
+ .flags = MOTIONSENSE_FLAG_INT_SIGNAL,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
- .default_range = 1000, /* dps */
- .rot_standard_ref = &base_standard_ref,
- .min_frequency = BMI_GYRO_MIN_FREQ,
- .max_frequency = BMI_GYRO_MAX_FREQ,
+ .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS,
+ .default_range = 1000 | ROUND_UP_FLAG, /* dps */
+ .rot_standard_ref = NULL,
+ .min_frequency = LSM6DSM_ODR_MIN_VAL,
+ .max_frequency = LSM6DSM_ODR_MAX_VAL,
},
[VSYNC] = {
.name = "Camera VSYNC",
diff --git a/board/madoo/board.h b/board/madoo/board.h
index 374f53a11c..7eb7e0af30 100644
--- a/board/madoo/board.h
+++ b/board/madoo/board.h
@@ -90,7 +90,7 @@
#define CONFIG_CMD_ACCEL_INFO
#define CONFIG_ACCEL_BMA255 /* Lid accel */
-#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
#define CONFIG_SYNC /* Camera VSYNC */
/* Lid operates in forced mode, base in FIFO */
@@ -100,8 +100,6 @@
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO_SIZE / 3)
#define CONFIG_ACCEL_INTERRUPTS
-#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \
- TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL)
#define CONFIG_SYNC_INT_EVENT TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC)
#define CONFIG_LID_ANGLE
diff --git a/board/madoo/gpio.inc b/board/madoo/gpio.inc
index df752c3466..14f4342c5e 100644
--- a/board/madoo/gpio.inc
+++ b/board/madoo/gpio.inc
@@ -38,7 +38,7 @@ GPIO_INT(VOLUP_BTN_ODL, PIN(7, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interr
/* Other interrupts */
GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH, lid_interrupt)
GPIO_INT(EC_WP_OD, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt)
-GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt)
+GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, lsm6dsm_interrupt)
GPIO_INT(CAM_EC_VSYNC, PIN(0, 0), GPIO_INT_FALLING | GPIO_SEL_1P8V, sync_interrupt)
GPIO_INT(LID_360_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr)