diff options
56 files changed, 265 insertions, 309 deletions
diff --git a/baseboard/grunt/baseboard.c b/baseboard/grunt/baseboard.c index 88b223a0fa..acc9d19855 100644 --- a/baseboard/grunt/baseboard.c +++ b/baseboard/grunt/baseboard.c @@ -17,7 +17,7 @@ #include "cros_board_info.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/bc12/max14637.h" #include "driver/charger/isl923x.h" #include "driver/ppc/sn5s330.h" @@ -565,7 +565,7 @@ static struct mutex g_base_mutex; /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */ struct motion_sensor_t motion_sensors[] = { @@ -610,8 +610,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 2, /* g, enough for laptop */ .rot_standard_ref = NULL, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -638,8 +638,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = NULL, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; diff --git a/baseboard/zork/baseboard.c b/baseboard/zork/baseboard.c index 06cf28df43..9816209f91 100644 --- a/baseboard/zork/baseboard.c +++ b/baseboard/zork/baseboard.c @@ -16,7 +16,7 @@ #include "compile_time_macros.h" #include "console.h" #include "cros_board_info.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/isl9241.h" #include "driver/ppc/aoz1380.h" diff --git a/board/aleena/board.c b/board/aleena/board.c index 51c5143474..102115ef7f 100644 --- a/board/aleena/board.c +++ b/board/aleena/board.c @@ -6,7 +6,7 @@ /* Aleena board-specific configuration */ #include "button.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/led/lm3630a.h" #include "extpower.h" #include "hooks.h" diff --git a/board/ampton/board.c b/board/ampton/board.c index 7646ab3c85..d6dc3fa258 100644 --- a/board/ampton/board.c +++ b/board/ampton/board.c @@ -12,7 +12,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_kionix.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/ppc/sn5s330.h" #include "driver/sync.h" #include "driver/tcpm/it83xx_pd.h" @@ -173,7 +173,7 @@ const mat33_fp_t gyro_standard_ref = { /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* Drivers */ struct motion_sensor_t motion_sensors[] = { @@ -216,8 +216,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -244,8 +244,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &gyro_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [VSYNC] = { .name = "Camera VSYNC", diff --git a/board/bobba/board.c b/board/bobba/board.c index ac2d16c79e..be2da463cc 100644 --- a/board/bobba/board.c +++ b/board/bobba/board.c @@ -14,7 +14,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_kionix.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/charger/bd9995x.h" #include "driver/ppc/nx20p348x.h" #include "driver/sync.h" @@ -151,7 +151,7 @@ const mat33_fp_t base_ar_cam_ref = { /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* Drivers */ struct motion_sensor_t motion_sensors[] = { @@ -194,8 +194,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -222,8 +222,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [VSYNC] = { .name = "Camera VSYNC", diff --git a/board/cheza/board.c b/board/cheza/board.c index 855451049d..e4abd22d2f 100644 --- a/board/cheza/board.c +++ b/board/cheza/board.c @@ -12,7 +12,7 @@ #include "charge_state.h" #include "chipset.h" #include "extpower.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_opt3001.h" #include "driver/charger/isl923x.h" #include "driver/ppc/sn5s330.h" @@ -627,7 +627,7 @@ uint16_t tcpc_get_alert_status(void) /* Mutexes */ static struct mutex g_lid_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; static struct opt3001_drv_data_t g_opt3001_data = { .scale = 1, .uscale = 0, @@ -660,8 +660,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { [SENSOR_CONFIG_EC_S0] = { .odr = 10000 | ROUND_UP_FLAG, @@ -681,8 +681,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [LID_ALS] = { .name = "Light", diff --git a/board/coral/board.c b/board/coral/board.c index 3af03d6e0d..5fcb40d603 100644 --- a/board/coral/board.c +++ b/board/coral/board.c @@ -17,7 +17,7 @@ #include "driver/als_opt3001.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/charger/bd9995x.h" #include "driver/tcpm/anx74xx.h" #include "driver/tcpm/ps8xxx.h" @@ -718,7 +718,7 @@ const mat33_fp_t mag_standard_ref = { /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* FIXME(dhendrix): Copied from Amenia, probably need to tweak for Coral */ struct motion_sensor_t motion_sensors[] = { @@ -762,8 +762,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -791,8 +791,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/damu/board.c b/board/damu/board.c index 19d3dbed00..4f5ce743b4 100644 --- a/board/damu/board.c +++ b/board/damu/board.c @@ -15,7 +15,7 @@ #include "common.h" #include "console.h" #include "driver/accel_lis2dh.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/battery/max17055.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/isl923x.h" @@ -352,7 +352,7 @@ static const mat33_fp_t lid_standard_ref = { /* Lid accel private data */ static struct stprivate_data g_lis2dh_data; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { @@ -399,8 +399,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT), .rot_standard_ref = &base_standard_ref, .default_range = 2, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -427,8 +427,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT), .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/dood/board.c b/board/dood/board.c index ae2785b786..407faa8d53 100644 --- a/board/dood/board.c +++ b/board/dood/board.c @@ -14,7 +14,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_kionix.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/charger/bd9995x.h" #include "driver/ppc/nx20p348x.h" #include "driver/sync.h" @@ -134,7 +134,7 @@ const mat33_fp_t base_standard_ref = { /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* Drivers */ struct motion_sensor_t motion_sensors[] = { @@ -177,8 +177,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -205,8 +205,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; diff --git a/board/dratini/board.c b/board/dratini/board.c index 7c46a421ed..83aa24de7c 100644 --- a/board/dratini/board.c +++ b/board/dratini/board.c @@ -11,7 +11,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_tcs3400.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" @@ -196,7 +196,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -254,8 +254,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { [SENSOR_CONFIG_EC_S0] = { @@ -281,8 +281,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/eve/board.c b/board/eve/board.c index ef5699e2df..c703619e71 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -19,7 +19,7 @@ #include "device_event.h" #include "driver/accel_kionix.h" #include "driver/accel_kxcj9.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_si114x.h" #include "driver/charger/bd9995x.h" #include "driver/tcpm/anx74xx.h" @@ -783,7 +783,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; static struct kionix_accel_data g_kxcj9_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; static struct si114x_drv_data_t g_si114x_data = { .state = SI114X_NOT_READY, @@ -856,8 +856,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = NULL, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -890,8 +890,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = NULL, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [BASE_MAG] = { diff --git a/board/eve/board.h b/board/eve/board.h index e271570a47..d6d20267c6 100644 --- a/board/eve/board.h +++ b/board/eve/board.h @@ -124,7 +124,7 @@ #define CONFIG_TEMP_SENSOR_BD99992GW #define CONFIG_THERMISTOR_NCP15WB #define CONFIG_ACCELGYRO_BMI160 -#define CONFIG_MAG_BMI160_BMM150 +#define CONFIG_MAG_BMI_BMM150 #define CONFIG_ACCEL_INTERRUPTS #define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) diff --git a/board/ezkinil/board.c b/board/ezkinil/board.c index 5ff02886fd..78534e2191 100644 --- a/board/ezkinil/board.c +++ b/board/ezkinil/board.c @@ -6,7 +6,7 @@ /* Trembyle board configuration */ #include "button.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" #include "driver/retimer/tusb544.h" @@ -38,7 +38,7 @@ static struct mutex g_base_mutex; /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* Matrix to rotate accelrator into standard reference frame */ const mat33_fp_t base_standard_ref = { @@ -95,8 +95,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 2, /* g, enough for laptop */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -123,8 +123,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; diff --git a/board/flapjack/board.c b/board/flapjack/board.c index 3d0e08afe5..e0aed97417 100644 --- a/board/flapjack/board.c +++ b/board/flapjack/board.c @@ -15,7 +15,7 @@ #include "common.h" #include "console.h" #include "cros_board_info.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_tcs3400.h" #include "driver/battery/max17055.h" #include "driver/charger/rt946x.h" @@ -464,7 +464,7 @@ void board_config_pre_init(void) #ifdef SECTION_IS_RW static struct mutex g_lid_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; static struct als_drv_data_t g_tcs3400_data = { .als_cal.scale = 1, @@ -541,8 +541,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &lid_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* Enable accel in S0 */ [SENSOR_CONFIG_EC_S0] = { @@ -564,8 +564,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &lid_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [CLEAR_ALS] = { .name = "Clear Light", diff --git a/board/garg/board.c b/board/garg/board.c index 6329daa7c9..7337ce0137 100644 --- a/board/garg/board.c +++ b/board/garg/board.c @@ -14,7 +14,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_kionix.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/charger/bd9995x.h" #include "driver/ppc/nx20p348x.h" #include "driver/tcpm/anx7447.h" @@ -129,7 +129,7 @@ const mat33_fp_t base_standard_ref = { /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* Drivers */ struct motion_sensor_t motion_sensors[] = { @@ -172,8 +172,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -200,8 +200,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; diff --git a/board/glados/board.c b/board/glados/board.c index 73b8e3ed86..43cfad06cf 100644 --- a/board/glados/board.c +++ b/board/glados/board.c @@ -17,7 +17,7 @@ #include "driver/als_opt3001.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/tcpm/tcpci.h" #include "extpower.h" #include "gpio.h" @@ -444,7 +444,7 @@ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; struct motion_sensor_t motion_sensors[] = { /* @@ -465,8 +465,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .rot_standard_ref = NULL, /* Identity matrix. */ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -489,8 +489,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .default_range = 1000, /* dps */ .rot_standard_ref = NULL, /* Identity Matrix. */ - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [LID_ACCEL] = { diff --git a/board/grunt/board.c b/board/grunt/board.c index f57b86af2e..45aa4f4421 100644 --- a/board/grunt/board.c +++ b/board/grunt/board.c @@ -6,7 +6,7 @@ /* Grunt board-specific configuration */ #include "button.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/led/lm3630a.h" #include "extpower.h" #include "hooks.h" diff --git a/board/hatch/board.c b/board/hatch/board.c index 8060de471e..704014d65f 100644 --- a/board/hatch/board.c +++ b/board/hatch/board.c @@ -11,7 +11,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_tcs3400.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" @@ -177,7 +177,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -278,8 +278,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { [SENSOR_CONFIG_EC_S0] = { @@ -305,8 +305,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [CLEAR_ALS] = { diff --git a/board/helios/board.c b/board/helios/board.c index 7ab13d5734..ac7bfb1d7e 100644 --- a/board/helios/board.c +++ b/board/helios/board.c @@ -11,7 +11,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_opt3001.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" @@ -199,7 +199,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -257,8 +257,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { [SENSOR_CONFIG_EC_S0] = { @@ -284,8 +284,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/jacuzzi/board.c b/board/jacuzzi/board.c index 761f0cb3e2..186b6ae934 100644 --- a/board/jacuzzi/board.c +++ b/board/jacuzzi/board.c @@ -15,7 +15,7 @@ #include "common.h" #include "console.h" #include "driver/accel_kionix.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/battery/max17055.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/isl923x.h" @@ -346,7 +346,7 @@ static const mat33_fp_t base_standard_ref = { /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { @@ -391,8 +391,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT), .rot_standard_ref = &base_standard_ref, .default_range = 2, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -419,8 +419,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT), .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/jinlon/board.c b/board/jinlon/board.c index d1b1fc93bc..c20e5cc65f 100644 --- a/board/jinlon/board.c +++ b/board/jinlon/board.c @@ -11,7 +11,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_tcs3400.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" @@ -180,7 +180,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -238,8 +238,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { [SENSOR_CONFIG_EC_S0] = { @@ -265,8 +265,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/kappa/board.c b/board/kappa/board.c index b4f37975ae..810b572a67 100644 --- a/board/kappa/board.c +++ b/board/kappa/board.c @@ -14,7 +14,7 @@ #include "chipset.h" #include "common.h" #include "console.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/battery/max17055.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/isl923x.h" diff --git a/board/kappa/board.h b/board/kappa/board.h index fec2da63fa..cab495c42c 100644 --- a/board/kappa/board.h +++ b/board/kappa/board.h @@ -45,7 +45,7 @@ /* Motion Sensors */ #ifdef SECTION_IS_RW -#define CONFIG_MAG_BMI160_BMM150 +#define CONFIG_MAG_BMI_BMM150 #define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS #define CONFIG_MAG_CALIBRATE #define CONFIG_ACCELGYRO_BMI160 diff --git a/board/kindred/board.c b/board/kindred/board.c index fa5b064016..c573822851 100644 --- a/board/kindred/board.c +++ b/board/kindred/board.c @@ -11,7 +11,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/anx7447.h" @@ -200,7 +200,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -258,8 +258,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { [SENSOR_CONFIG_EC_S0] = { @@ -285,8 +285,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/kohaku/board.c b/board/kohaku/board.c index 6e350a9d13..4893359d56 100644 --- a/board/kohaku/board.c +++ b/board/kohaku/board.c @@ -11,7 +11,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_bh1730.h" #include "driver/als_tcs3400.h" #include "driver/ppc/sn5s330.h" @@ -165,7 +165,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -270,8 +270,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { [SENSOR_CONFIG_EC_S0] = { @@ -297,8 +297,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [BASE_ALS] = { diff --git a/board/kukui/board.c b/board/kukui/board.c index 5476030130..2f71e46c89 100644 --- a/board/kukui/board.c +++ b/board/kukui/board.c @@ -14,7 +14,7 @@ #include "chipset.h" #include "common.h" #include "console.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_tcs3400.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/rt946x.h" @@ -359,7 +359,7 @@ void sensor_board_proc_double_tap(void) #ifndef VARIANT_KUKUI_NO_SENSORS static struct mutex g_lid_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* TCS3400 private data */ static struct als_drv_data_t g_tcs3400_data = { @@ -430,14 +430,14 @@ static const mat33_fp_t lid_standard_ref = { }; #endif /* BOARD_KUKUI */ -#ifdef CONFIG_MAG_BMI160_BMM150 +#ifdef CONFIG_MAG_BMI_BMM150 /* Matrix to rotate accelrator into standard reference frame */ static const mat33_fp_t mag_standard_ref = { {0, FLOAT_TO_FP(-1), 0}, {FLOAT_TO_FP(-1), 0, 0}, {0, 0, FLOAT_TO_FP(-1)} }; -#endif /* CONFIG_MAG_BMI160_BMM150 */ +#endif /* CONFIG_MAG_BMI_BMM150 */ struct motion_sensor_t motion_sensors[] = { /* @@ -458,8 +458,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &lid_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* Enable accel in S0 */ [SENSOR_CONFIG_EC_S0] = { @@ -486,10 +486,10 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &lid_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, -#ifdef CONFIG_MAG_BMI160_BMM150 +#ifdef CONFIG_MAG_BMI_BMM150 [LID_MAG] = { .name = "Lid Mag", .active_mask = SENSOR_ACTIVE_S0_S3, @@ -506,7 +506,7 @@ struct motion_sensor_t motion_sensors[] = { .min_frequency = BMM150_MAG_MIN_FREQ, .max_frequency = BMM150_MAG_MAX_FREQ(SPECIAL), }, -#endif /* CONFIG_MAG_BMI160_BMM150 */ +#endif /* CONFIG_MAG_BMI_BMM150 */ [CLEAR_ALS] = { .name = "Clear Light", .active_mask = SENSOR_ACTIVE_S0_S3, diff --git a/board/kukui/board.h b/board/kukui/board.h index 2057ab191a..9624837a14 100644 --- a/board/kukui/board.h +++ b/board/kukui/board.h @@ -49,7 +49,7 @@ /* Motion Sensors */ #ifdef SECTION_IS_RW #ifndef BOARD_KRANE -#define CONFIG_MAG_BMI160_BMM150 +#define CONFIG_MAG_BMI_BMM150 #define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS #define CONFIG_MAG_CALIBRATE #endif /* !BOARD_KRANE */ @@ -122,9 +122,9 @@ enum power_signal { enum sensor_id { LID_ACCEL = 0, LID_GYRO, -#ifdef CONFIG_MAG_BMI160_BMM150 +#ifdef CONFIG_MAG_BMI_BMM150 LID_MAG, -#endif /* CONFIG_MAG_BMI160_BMM150 */ +#endif /* CONFIG_MAG_BMI_BMM150 */ CLEAR_ALS, RGB_ALS, VSYNC, diff --git a/board/lazor/board.c b/board/lazor/board.c index ab2cda5cb4..636c1dc80a 100644 --- a/board/lazor/board.c +++ b/board/lazor/board.c @@ -11,7 +11,7 @@ #include "charge_state.h" #include "extpower.h" #include "driver/accel_kionix.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/ps8xxx.h" #include "driver/tcpm/tcpci.h" @@ -419,7 +419,7 @@ uint16_t tcpc_get_alert_status(void) static struct mutex g_base_mutex; static struct mutex g_lid_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; static struct kionix_accel_data g_kx022_data; /* Matrix to rotate accelerometer into standard reference frame */ @@ -480,8 +480,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { [SENSOR_CONFIG_EC_S0] = { .odr = 10000 | ROUND_UP_FLAG, @@ -501,8 +501,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/mchpevb1/board.c b/board/mchpevb1/board.c index 519107a929..c8dc130821 100644 --- a/board/mchpevb1/board.c +++ b/board/mchpevb1/board.c @@ -23,7 +23,7 @@ #include "driver/als_opt3001.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/tcpm/tcpci.h" #include "extpower.h" #include "gpio_chip.h" @@ -911,7 +911,7 @@ DECLARE_HOOK(HOOK_SECOND, board_one_sec, HOOK_PRIO_DEFAULT); static struct mutex g_base_mutex; /* BMI160 private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; #ifdef CONFIG_ACCEL_KX022 static struct mutex g_lid_mutex; @@ -939,8 +939,8 @@ struct motion_sensor_t motion_sensors[] = { CONFIG_SPI_ACCEL_PORT), .rot_standard_ref = NULL, /* Identity matrix. */ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -964,8 +964,8 @@ struct motion_sensor_t motion_sensors[] = { CONFIG_SPI_ACCEL_PORT), .default_range = 1000, /* dps */ .rot_standard_ref = NULL, /* Identity Matrix. */ - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, #ifdef CONFIG_ACCEL_KX022 [LID_ACCEL] = { diff --git a/board/morphius/board.c b/board/morphius/board.c index ef9fb58a63..9119ba7902 100644 --- a/board/morphius/board.c +++ b/board/morphius/board.c @@ -7,7 +7,7 @@ #include "battery_smart.h" #include "button.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" #include "driver/retimer/pi3dpx1207.h" @@ -42,7 +42,7 @@ static struct mutex g_base_mutex; /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */ struct motion_sensor_t motion_sensors[] = { @@ -87,8 +87,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 2, /* g, enough for laptop */ .rot_standard_ref = NULL, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -115,8 +115,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = NULL, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; diff --git a/board/mushu/board.c b/board/mushu/board.c index 371be81a54..f472da50f7 100644 --- a/board/mushu/board.c +++ b/board/mushu/board.c @@ -11,7 +11,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_tcs3400.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" @@ -180,7 +180,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -281,8 +281,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 2, /* g, to support tablet mode */ .config = { [SENSOR_CONFIG_EC_S0] = { @@ -308,8 +308,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [CLEAR_ALS] = { diff --git a/board/nami/board.c b/board/nami/board.c index a5d38bd0d8..b3aa7f91cd 100644 --- a/board/nami/board.c +++ b/board/nami/board.c @@ -19,7 +19,7 @@ #include "console.h" #include "cros_board_info.h" #include "driver/pmic_tps650x30.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/accel_bma2x2.h" #include "driver/accel_kionix.h" #include "driver/baro_bmp280.h" @@ -725,7 +725,7 @@ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; /* Lid accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; static struct kionix_accel_data g_kx022_data; /* BMA255 private data */ @@ -818,8 +818,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { /* EC use accel for angle detection */ @@ -847,8 +847,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/nautilus/board.c b/board/nautilus/board.c index 3f01a70f6c..30fc388e57 100644 --- a/board/nautilus/board.c +++ b/board/nautilus/board.c @@ -17,7 +17,7 @@ #include "charger.h" #include "chipset.h" #include "console.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/accel_bma2x2.h" #include "driver/baro_bmp280.h" #include "driver/charger/isl923x.h" @@ -591,7 +591,7 @@ int board_get_version(void) static struct mutex g_lid_mutex; static struct mutex g_base_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -648,8 +648,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { /* EC use accel for angle detection */ @@ -676,8 +676,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/nightfury/board.c b/board/nightfury/board.c index 264d0c6fc5..022aa21670 100644 --- a/board/nightfury/board.c +++ b/board/nightfury/board.c @@ -11,7 +11,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_lis2ds.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_opt3001.h" #include "driver/als_tcs3400.h" #include "driver/ppc/sn5s330.h" @@ -173,7 +173,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* Base light sensor private data */ static struct opt3001_drv_data_t g_opt3001_data = { @@ -243,8 +243,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { [SENSOR_CONFIG_EC_S0] = { @@ -270,8 +270,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [BASE_ALS] = { diff --git a/board/nocturne/board.c b/board/nocturne/board.c index 3184b6293b..f9e4602340 100644 --- a/board/nocturne/board.c +++ b/board/nocturne/board.c @@ -14,7 +14,7 @@ #include "common.h" #include "console.h" #include "compile_time_macros.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_opt3001.h" #include "driver/charger/isl923x.h" #include "driver/ppc/sn5s330.h" @@ -166,7 +166,7 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); static struct mutex g_lid_mutex; /* Sensor driver data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; static struct opt3001_drv_data_t g_opt3001_data = { .scale = 1, .uscale = 0, @@ -194,8 +194,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &lid_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC setup accel for chrome usage */ [SENSOR_CONFIG_EC_S0] = { @@ -217,8 +217,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &lid_standard_ref, .default_range = 1000, /* dps */ - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [LID_ALS] = { diff --git a/board/nucleo-f411re/board.c b/board/nucleo-f411re/board.c index b203ea4884..97f5a8a8d3 100644 --- a/board/nucleo-f411re/board.c +++ b/board/nucleo-f411re/board.c @@ -8,7 +8,7 @@ #include "adc_chip.h" #include "common.h" #include "console.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "ec_version.h" #include "gpio.h" #include "hooks.h" @@ -62,7 +62,7 @@ const unsigned int i2c_ports_used = ARRAY_SIZE(i2c_ports); /* Base Sensor mutex */ static struct mutex g_base_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; struct motion_sensor_t motion_sensors[] = { [BASE_ACCEL] = { @@ -77,8 +77,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -105,8 +105,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/nuwani/board.c b/board/nuwani/board.c index 444cfdb651..3b64396976 100644 --- a/board/nuwani/board.c +++ b/board/nuwani/board.c @@ -7,7 +7,7 @@ #include "button.h" #include "driver/accel_lis2dw12.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/accelgyro_lsm6dsm.h" #include "extpower.h" #include "i2c.h" diff --git a/board/oak/board.c b/board/oak/board.c index fcde44a0cd..05f030f89e 100644 --- a/board/oak/board.c +++ b/board/oak/board.c @@ -18,7 +18,7 @@ #include "console.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_opt3001.h" #include "driver/charger/isl923x.h" #include "driver/tcpm/tcpci.h" @@ -651,7 +651,7 @@ const mat33_fp_t base_standard_ref = { #endif static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; struct motion_sensor_t motion_sensors[] = { #ifdef CONFIG_ACCELGYRO_BMI160 @@ -673,8 +673,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(0), .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -697,8 +697,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(0), .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, #endif #ifdef CONFIG_ACCEL_KX022 diff --git a/board/poppy/board.c b/board/poppy/board.c index 80bcf98433..ddd0721591 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -17,7 +17,7 @@ #include "charger.h" #include "chipset.h" #include "console.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_opt3001.h" #include "driver/baro_bmp280.h" #include "driver/charger/isl923x.h" @@ -717,7 +717,7 @@ int board_get_version(void) /* Lid Sensor mutex */ static struct mutex g_lid_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; static struct opt3001_drv_data_t g_opt3001_data = { .scale = 1, .uscale = 0, @@ -766,8 +766,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &lid_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -790,8 +790,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &lid_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [LID_MAG] = { diff --git a/board/poppy/board.h b/board/poppy/board.h index e1f839b65b..d9f8cbc6e1 100644 --- a/board/poppy/board.h +++ b/board/poppy/board.h @@ -124,7 +124,7 @@ #define CONFIG_MKBP_EVENT #define CONFIG_MKBP_USE_HOST_EVENT #define CONFIG_ACCELGYRO_BMI160 -#define CONFIG_MAG_BMI160_BMM150 +#define CONFIG_MAG_BMI_BMM150 #define CONFIG_ACCEL_INTERRUPTS #define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL) diff --git a/board/rainier/board.c b/board/rainier/board.c index a2592bd54d..88f334c827 100644 --- a/board/rainier/board.c +++ b/board/rainier/board.c @@ -13,7 +13,7 @@ #include "common.h" #include "console.h" #include "ec_commands.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/baro_bmp280.h" #include "driver/tcpm/fusb302.h" #include "driver/temp_sensor/tmp432.h" @@ -351,7 +351,7 @@ int board_get_version(void) /* Mutexes */ static struct mutex g_base_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* Matrix to rotate accelerometer into standard reference frame */ const mat33_fp_t base_standard_ref = { @@ -381,8 +381,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT), .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* Enable accel in S0 */ [SENSOR_CONFIG_EC_S0] = { @@ -404,8 +404,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT), .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, .config = { /* Enable gyro in S0 */ [SENSOR_CONFIG_EC_S0] = { diff --git a/board/rammus/board.c b/board/rammus/board.c index 6f6d175959..ea6751032a 100644 --- a/board/rammus/board.c +++ b/board/rammus/board.c @@ -18,7 +18,7 @@ #include "chipset.h" #include "console.h" #include "cros_board_info.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/accel_bma2x2.h" #include "driver/charger/isl923x.h" #include "driver/tcpm/ps8xxx.h" @@ -584,7 +584,7 @@ BUILD_ASSERT(ARRAY_SIZE(pwm_channels) == PWM_CH_COUNT); static struct mutex g_lid_mutex; static struct mutex g_base_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -643,8 +643,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { /* EC use accel for angle detection */ @@ -672,8 +672,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/reef/board.c b/board/reef/board.c index 30b3058161..29b6ca0bdc 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -17,7 +17,7 @@ #include "driver/als_opt3001.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/baro_bmp280.h" #include "driver/charger/bd9995x.h" #include "driver/tcpm/anx74xx.h" @@ -704,7 +704,7 @@ const mat33_fp_t mag_standard_ref = { /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; static struct bmp280_drv_data_t bmp280_drv_data; static struct opt3001_drv_data_t g_opt3001_data = { .scale = 1, @@ -754,8 +754,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -783,8 +783,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [BASE_MAG] = { .name = "Base Mag", diff --git a/board/reef/board.h b/board/reef/board.h index 7e782646ed..349944c26f 100644 --- a/board/reef/board.h +++ b/board/reef/board.h @@ -195,7 +195,7 @@ #define CONFIG_ACCEL_INTERRUPTS #define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) -#define CONFIG_MAG_BMI160_BMM150 +#define CONFIG_MAG_BMI_BMM150 #define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS #define CONFIG_MAG_CALIBRATE #define CONFIG_ACCEL_KX022 diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c index b9927976ab..3540cf334c 100644 --- a/board/reef_mchp/board.c +++ b/board/reef_mchp/board.c @@ -18,7 +18,7 @@ #include "driver/als_opt3001.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/baro_bmp280.h" #include "driver/charger/bd9995x.h" #include "driver/tcpm/anx74xx.h" @@ -949,7 +949,7 @@ const mat33_fp_t mag_standard_ref = { /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; static struct bmp280_drv_data_t bmp280_drv_data; /* MCHP: struct not present in firmware-reef-9042.B */ static struct opt3001_drv_data_t g_opt3001_data = { @@ -1003,8 +1003,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -1032,8 +1032,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [BASE_MAG] = { .name = "Base Mag", diff --git a/board/reef_mchp/board.h b/board/reef_mchp/board.h index 32f826453d..c516b0eb5b 100644 --- a/board/reef_mchp/board.h +++ b/board/reef_mchp/board.h @@ -202,7 +202,7 @@ #define CONFIG_ACCEL_INTERRUPTS #define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) -#define CONFIG_MAG_BMI160_BMM150 +#define CONFIG_MAG_BMI_BMM150 #define CONFIG_ACCELGYRO_SEC_ADDR_FLAGS BMM150_ADDR0_FLAGS #define CONFIG_MAG_CALIBRATE #define CONFIG_ACCEL_KX022 diff --git a/board/scarlet/board.c b/board/scarlet/board.c index 8de3de4bf5..b84062153c 100644 --- a/board/scarlet/board.c +++ b/board/scarlet/board.c @@ -15,7 +15,7 @@ #include "common.h" #include "console.h" #include "ec_commands.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/charger/rt946x.h" #include "driver/sync.h" #include "driver/tcpm/fusb302.h" @@ -388,7 +388,7 @@ int board_get_version(void) /* Mutexes */ static struct mutex g_base_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* Matrix to rotate accelerometer into standard reference frame */ const mat33_fp_t base_standard_ref = { @@ -416,8 +416,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT), .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* Enable accel in S0 */ [SENSOR_CONFIG_EC_S0] = { @@ -439,8 +439,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = SLAVE_MK_SPI_ADDR_FLAGS(CONFIG_SPI_ACCEL_PORT), .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [VSYNC] = { .name = "Camera vsync", diff --git a/board/stryke/board.c b/board/stryke/board.c index 5f74ea26f6..a60f11699f 100644 --- a/board/stryke/board.c +++ b/board/stryke/board.c @@ -11,7 +11,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/anx7447.h" @@ -176,7 +176,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -239,8 +239,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { [SENSOR_CONFIG_EC_S0] = { @@ -266,8 +266,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; diff --git a/board/sushi/board.c b/board/sushi/board.c index ae1fe7a3e7..36d312f330 100644 --- a/board/sushi/board.c +++ b/board/sushi/board.c @@ -11,7 +11,7 @@ #include "common.h" #include "cros_board_info.h" #include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/als_tcs3400.h" #include "driver/bc12/pi3usb9201.h" #include "driver/ppc/sn5s330.h" @@ -177,7 +177,7 @@ static struct mutex g_base_mutex; static struct mutex g_lid_mutex; /* Base accel private data */ -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* BMA255 private data */ static struct accelgyro_saved_data_t g_bma255_data; @@ -278,8 +278,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_ACCEL, .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ .config = { [SENSOR_CONFIG_EC_S0] = { @@ -305,8 +305,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [CLEAR_ALS] = { diff --git a/board/treeya/board.c b/board/treeya/board.c index 69e91b3103..c796bf43a0 100644 --- a/board/treeya/board.c +++ b/board/treeya/board.c @@ -7,7 +7,7 @@ #include "button.h" #include "driver/accel_lis2dw12.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/accelgyro_lsm6dsm.h" #include "extpower.h" #include "i2c.h" diff --git a/board/trembyle/board.c b/board/trembyle/board.c index 18c40a46ab..c2be9d2b88 100644 --- a/board/trembyle/board.c +++ b/board/trembyle/board.c @@ -7,7 +7,7 @@ #include "button.h" #include "cbi_ec_fw_config.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/accel_kionix.h" #include "driver/accel_kx022.h" #include "driver/retimer/pi3dpx1207.h" @@ -42,7 +42,7 @@ static struct mutex g_base_mutex; /* sensor private data */ static struct kionix_accel_data g_kx022_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* TODO(gcc >= 5.0) Remove the casts to const pointer at rot_standard_ref */ struct motion_sensor_t motion_sensors[] = { @@ -87,8 +87,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 2, /* g, enough for laptop */ .rot_standard_ref = NULL, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { @@ -115,8 +115,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = NULL, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; diff --git a/board/trogdor/board.c b/board/trogdor/board.c index 45621582b8..bdbf4cb809 100644 --- a/board/trogdor/board.c +++ b/board/trogdor/board.c @@ -10,7 +10,7 @@ #include "charge_manager.h" #include "charge_state.h" #include "extpower.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/ppc/sn5s330.h" #include "driver/tcpm/ps8xxx.h" #include "driver/tcpm/tcpci.h" @@ -433,7 +433,7 @@ uint16_t tcpc_get_alert_status(void) /* Mutexes */ static struct mutex g_base_mutex; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; /* Matrix to rotate accelerometer into standard reference frame */ const mat33_fp_t base_standard_ref = { @@ -461,8 +461,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { [SENSOR_CONFIG_EC_S0] = { .odr = 10000 | ROUND_UP_FLAG, @@ -482,8 +482,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, }; const unsigned int motion_sensor_count = ARRAY_SIZE(motion_sensors); diff --git a/board/volteer_ish/board.c b/board/volteer_ish/board.c index 7882708653..76c127056b 100644 --- a/board/volteer_ish/board.c +++ b/board/volteer_ish/board.c @@ -6,7 +6,7 @@ /* Volteer ISH board-specific configuration */ #include "console.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/accel_bma2x2.h" #include "gpio.h" #include "hooks.h" diff --git a/board/waddledoo/board.c b/board/waddledoo/board.c index ae55f95050..3f1f9fd53d 100644 --- a/board/waddledoo/board.c +++ b/board/waddledoo/board.c @@ -14,7 +14,7 @@ #include "common.h" #include "compile_time_macros.h" #include "driver/accel_bma2x2.h" -#include "driver/accelgyro_bmi160.h" +#include "driver/accelgyro_bmi_common.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/isl923x.h" #include "driver/retimer/nb7v904m.h" @@ -231,7 +231,7 @@ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; static struct accelgyro_saved_data_t g_bma253_data; -static struct bmi160_drv_data_t g_bmi160_data; +static struct bmi_drv_data_t g_bmi160_data; struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { @@ -271,8 +271,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .rot_standard_ref = NULL, .default_range = 4, - .min_frequency = BMI160_ACCEL_MIN_FREQ, - .max_frequency = BMI160_ACCEL_MAX_FREQ, + .min_frequency = BMI_ACCEL_MIN_FREQ, + .max_frequency = BMI_ACCEL_MAX_FREQ, .config = { [SENSOR_CONFIG_EC_S0] = { .odr = 13000 | ROUND_UP_FLAG, @@ -297,8 +297,8 @@ struct motion_sensor_t motion_sensors[] = { .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = NULL, - .min_frequency = BMI160_GYRO_MIN_FREQ, - .max_frequency = BMI160_GYRO_MAX_FREQ, + .min_frequency = BMI_GYRO_MIN_FREQ, + .max_frequency = BMI_GYRO_MAX_FREQ, }, [VSYNC] = { .name = "Camera VSYNC", diff --git a/driver/accelgyro_bmi160.h b/driver/accelgyro_bmi160.h index c1b4b47359..e93d0c28c7 100644 --- a/driver/accelgyro_bmi160.h +++ b/driver/accelgyro_bmi160.h @@ -379,38 +379,8 @@ #define BMI160_FF_DATA_LEN_GYR 6 #define BMI160_FF_DATA_LEN_MAG 8 -/* - * TODO(chingkang): Replace following in some board config to - * bmi version. Then, remove this definition(s). - */ -/* Min and Max sampling frequency in mHz */ -#define BMI160_ACCEL_MIN_FREQ 12500 -#define BMI160_ACCEL_MAX_FREQ MOTION_MAX_SENSOR_FREQUENCY(1600000, 100000) -#define BMI160_GYRO_MIN_FREQ 25000 -#define BMI160_GYRO_MAX_FREQ MOTION_MAX_SENSOR_FREQUENCY(3200000, 100000) - extern const struct accelgyro_drv bmi160_drv; -/* - * TODO(chingkang): Replace bmi160_drv_data_t in some board config to - * bmi_drv_data_t. Then, remove this definition. - */ -struct bmi160_drv_data_t { - struct accelgyro_saved_data_t saved_data[3]; - uint8_t flags; - uint8_t enabled_activities; - uint8_t disabled_activities; -#ifdef CONFIG_MAG_BMI_BMM150 - struct bmm150_private_data compass; -#endif -#ifdef CONFIG_BMI_ORIENTATION_SENSOR - uint8_t raw_orientation; - enum motionsensor_orientation orientation; - enum motionsensor_orientation last_orientation; -#endif - -}; - void bmi160_interrupt(enum gpio_signal signal); #ifdef CONFIG_BMI_SEC_I2C diff --git a/include/config.h b/include/config.h index 2665ae5e01..1ac15ed5fb 100644 --- a/include/config.h +++ b/include/config.h @@ -134,14 +134,12 @@ #undef CONFIG_MAG_BMM150 /* Presence of a Bosh Sensortec BMM150 magnetometer behind a BMIxxx. */ -#undef CONFIG_MAG_BMI160_BMM150 #undef CONFIG_MAG_BMI_BMM150 /* Presence of a Bosh Sensortec BMM150 magnetometer behind a LSM6DSM. */ #undef CONFIG_MAG_LSM6DSM_BMM150 /* Presence of a ST LIS2MDL magnetometer behind a BMIxxx. */ -#undef CONFIG_MAG_BMI160_LIS2MDL #undef CONFIG_MAG_BMI_LIS2MDL /* Presence of a ST LIS2MDL magnetometer behind a LSM6DSM. */ @@ -4544,18 +4542,6 @@ #include "board.h" /* - * Define BMI macro when BMI160 is defined - * TODO(chingkang): replace all BMI160 macro by BMI. - */ -#ifdef CONFIG_MAG_BMI160_BMM150 -#define CONFIG_MAG_BMI_BMM150 -#endif - -#ifdef CONFIG_MAG_BMI160_LIS2MDL -#define CONFIG_MAG_BMI_LIS2MDL -#endif - -/* * Define CONFIG_HOST_ESPI_VW_POWER_SIGNAL if any power signals from the host * are configured as virtual wires. */ |