diff options
Diffstat (limited to 'board/akemi/board.c')
-rw-r--r-- | board/akemi/board.c | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/board/akemi/board.c b/board/akemi/board.c index 99ac93fcb2..20070d3e73 100644 --- a/board/akemi/board.c +++ b/board/akemi/board.c @@ -10,8 +10,8 @@ #include "button.h" #include "common.h" #include "cros_board_info.h" -#include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accel_lis2dw12.h" +#include "driver/accelgyro_lsm6dsm.h" #include "driver/als_tcs3400.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" @@ -174,11 +174,10 @@ const struct pi3usb9201_config_t pi3usb9201_bc12_chips[] = { static struct mutex g_base_mutex; static struct mutex g_lid_mutex; +/* Lid accel private data */ +static struct stprivate_data g_lis2dwl_data; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; - -/* BMA255 private data */ -static struct accelgyro_saved_data_t g_bma255_data; +static struct lsm6dsm_data lsm6dsm_data; /* ALS private data */ static struct als_drv_data_t g_tcs3400_data = { @@ -239,24 +238,24 @@ struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { .name = "Lid Accel", .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMA255, + .chip = MOTIONSENSE_CHIP_LIS2DWL, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_LID, - .drv = &bma2x2_accel_drv, + .drv = &lis2dw12_drv, .mutex = &g_lid_mutex, - .drv_data = &g_bma255_data, + .drv_data = &g_lis2dwl_data, .port = I2C_PORT_ACCEL, - .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS, + .i2c_spi_addr_flags = LIS2DWL_ADDR1_FLAGS, .rot_standard_ref = &lid_standard_ref, - .min_frequency = BMA255_ACCEL_MIN_FREQ, - .max_frequency = BMA255_ACCEL_MAX_FREQ, - .default_range = 2, /* g, to support tablet mode */ + .default_range = 4, /* g */ + .min_frequency = LIS2DW12_ODR_MIN_VAL, + .max_frequency = LIS2DW12_ODR_MAX_VAL, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, + .odr = 12500 | ROUND_UP_FLAG, }, - /* Sensor on in S3 */ + /* Sensor on for lid angle detection */ [SENSOR_CONFIG_EC_S3] = { .odr = 10000 | ROUND_UP_FLAG, }, @@ -266,25 +265,31 @@ 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_ACCEL, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, + .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, - .default_range = 2, /* g, to support tablet mode */ + .default_range = 4, /* g */ + .min_frequency = LSM6DSM_ODR_MIN_VAL, + .max_frequency = LSM6DSM_ODR_MAX_VAL, .config = { + /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, + .odr = 13000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, }, - /* Sensor on in S3 */ + /* Sensor on for angle detection */ [SENSOR_CONFIG_EC_S3] = { .odr = 10000 | ROUND_UP_FLAG, + .ec_rate = 100 * MSEC, }, }, }, @@ -292,18 +297,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_ACCEL, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, - .default_range = 1000, /* dps */ + .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, + .default_range = 1000 | ROUND_UP_FLAG, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = LSM6DSM_ODR_MIN_VAL, + .max_frequency = LSM6DSM_ODR_MAX_VAL, }, [CLEAR_ALS] = { |