summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChing-Kang Yen <chingkang@chromium.org>2020-04-16 23:57:17 +0800
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-05-16 10:00:11 +0000
commit04a3ecd6b770ac01e8019881a413caa6c23940be (patch)
tree5ad4625a4688a9b9a064b142556ec4677182cc83
parent3483d6e274ab0d3b2cd17cbfa3b5483767fb423d (diff)
downloadchrome-ec-04a3ecd6b770ac01e8019881a413caa6c23940be.tar.gz
driver: Replace BMI160 to BMI in board config
Replace some macro of BMI160 to BMI version for common function of BMI series. Make board config include the accelgyro_bmi_common.h instead of accel_gyro_bmi160.h. BRANCH=None BUG=b:146144827 TEST=make buildall -j Change-Id: I043ff8a92f15295ead3fa5c1e292319e2b4fa21a Signed-off-by: Ching-Kang Yen <chingkang@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2156525 Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3637398 Tested-by: Zick Wei <zick.wei@quanta.corp-partner.google.com> Reviewed-by: Henry Sun <henrysun@google.com> Commit-Queue: Henry Sun <henrysun@google.com>
-rw-r--r--baseboard/grunt/baseboard.c14
-rw-r--r--board/aleena/board.c2
-rw-r--r--board/ampton/board.c14
-rw-r--r--board/atlas/board.c2
-rw-r--r--board/bobba/board.c14
-rw-r--r--board/cheza/board.c14
-rw-r--r--board/coral/board.c12
-rw-r--r--board/dood/board.c14
-rw-r--r--board/eve/board.c12
-rw-r--r--board/eve/board.h2
-rw-r--r--board/garg/board.c14
-rw-r--r--board/glados/board.c12
-rw-r--r--board/grunt/board.c2
-rw-r--r--board/kukui/board.c19
-rw-r--r--board/kukui/board.h2
-rw-r--r--board/mchpevb1/board.c12
-rw-r--r--board/nami/board.c12
-rw-r--r--board/nautilus/board.c12
-rw-r--r--board/nocturne/board.c14
-rw-r--r--board/nucleo-f411re/board.c12
-rw-r--r--board/oak/board.c12
-rw-r--r--board/poppy/board.c12
-rw-r--r--board/poppy/board.h2
-rw-r--r--board/rainier/board.c12
-rw-r--r--board/rammus/board.c12
-rw-r--r--board/reef/board.c12
-rw-r--r--board/reef/board.h2
-rw-r--r--board/reef_mchp/board.c12
-rw-r--r--board/reef_mchp/board.h2
-rw-r--r--board/rowan/board.c2
-rw-r--r--board/scarlet/board.c14
-rw-r--r--driver/accelgyro_bmi160.h22
-rw-r--r--include/config.h8
33 files changed, 158 insertions, 177 deletions
diff --git a/baseboard/grunt/baseboard.c b/baseboard/grunt/baseboard.c
index 1041894c5d..d523897386 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/ppc/sn5s330.h"
#include "driver/tcpm/anx74xx.h"
@@ -371,9 +371,11 @@ mat33_fp_t lid_standard_ref = {
{ 0, 0, FLOAT_TO_FP(1)}
};
+
+
/* 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[] = {
@@ -413,8 +415,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.default_range = 2, /* g, enough for laptop */
.rot_standard_ref = (const mat33_fp_t *)&grunt_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] = {
@@ -441,8 +443,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.default_range = 1000, /* dps */
.rot_standard_ref = (const mat33_fp_t *)&grunt_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/aleena/board.c b/board/aleena/board.c
index 9fda8c848e..82bf429cfa 100644
--- a/board/aleena/board.c
+++ b/board/aleena/board.c
@@ -14,7 +14,7 @@
#include "common.h"
#include "compile_time_macros.h"
#include "console.h"
-#include "driver/accelgyro_bmi160.h"
+#include "driver/accelgyro_bmi_common.h"
#include "driver/led/lm3630a.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx74xx.h"
diff --git a/board/ampton/board.c b/board/ampton/board.c
index 9f6a923033..1e20b14f30 100644
--- a/board/ampton/board.c
+++ b/board/ampton/board.c
@@ -13,7 +13,7 @@
#include "cros_board_info.h"
#include "driver/accel_bma2x2.h"
#include "driver/accel_kionix.h"
-#include "driver/accelgyro_bmi160.h"
+#include "driver/accelgyro_bmi_common.h"
#include "driver/accelgyro_icm_common.h"
#include "driver/accelgyro_icm42607.h"
#include "driver/ppc/sn5s330.h"
@@ -188,7 +188,7 @@ const mat33_fp_t lid_standard_ref_sku57 = {
};
/* 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 icm_drv_data_t g_icm42607_data;
/* BMA253 private data */
@@ -306,9 +306,9 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.addr = BMI160_ADDR0,
.rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g */
- .min_frequency = BMI160_ACCEL_MIN_FREQ,
- .max_frequency = BMI160_ACCEL_MAX_FREQ,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
.config = {
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
@@ -335,8 +335,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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/atlas/board.c b/board/atlas/board.c
index 87aa3e1c68..2e72274655 100644
--- a/board/atlas/board.c
+++ b/board/atlas/board.c
@@ -566,7 +566,7 @@ int board_get_version(void)
/* 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;
static struct opt3001_drv_data_t g_opt3001_data = {
.scale = 1,
.uscale = 0,
diff --git a/board/bobba/board.c b/board/bobba/board.c
index f21cce30fc..785241563d 100644
--- a/board/bobba/board.c
+++ b/board/bobba/board.c
@@ -15,7 +15,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/accelgyro_icm426xx.h"
#include "driver/accelgyro_icm_common.h"
#include "driver/charger/bd9995x.h"
@@ -185,7 +185,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;
static struct icm_drv_data_t g_icm426xx_data;
/* Drivers */
@@ -228,9 +228,9 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.addr = BMI160_ADDR0,
.rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g */
- .min_frequency = BMI160_ACCEL_MIN_FREQ,
- .max_frequency = BMI160_ACCEL_MAX_FREQ,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
.config = {
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
@@ -257,8 +257,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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 42f9db6059..190fb9dcff 100644
--- a/board/cheza/board.c
+++ b/board/cheza/board.c
@@ -11,7 +11,7 @@
#include "charge_state.h"
#include "chipset.h"
#include "extpower.h"
-#include "driver/accelgyro_bmi160.h"
+#include "driver/accelgyro_bmi_common.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx74xx.h"
#include "driver/tcpm/ps8xxx.h"
@@ -617,7 +617,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;
/* Matrix to rotate accelerometer into standard reference frame */
const mat33_fp_t base_standard_ref = {
@@ -644,9 +644,9 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.addr = BMI160_ADDR0,
.rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g */
- .min_frequency = BMI160_ACCEL_MIN_FREQ,
- .max_frequency = BMI160_ACCEL_MAX_FREQ,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
.config = {
[SENSOR_CONFIG_EC_S0] = {
.odr = 10000 | ROUND_UP_FLAG,
@@ -666,8 +666,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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/coral/board.c b/board/coral/board.c
index 7b0725db84..72221bd6b2 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"
@@ -728,7 +728,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[] = {
@@ -772,8 +772,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
- .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] = {
@@ -801,8 +801,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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/dood/board.c b/board/dood/board.c
index 4e09cb29c8..09c2ebcc67 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/ppc/syv682x.h"
@@ -159,7 +159,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[] = {
@@ -201,9 +201,9 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.addr = BMI160_ADDR0,
.rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g */
- .min_frequency = BMI160_ACCEL_MIN_FREQ,
- .max_frequency = BMI160_ACCEL_MAX_FREQ,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
.config = {
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
@@ -230,8 +230,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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/eve/board.c b/board/eve/board.c
index 307d0763c4..0cbb13615f 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[] = {
.addr = BMI160_ADDR0,
.rot_standard_ref = NULL,
.default_range = 2, /* g, enough for laptop. */
- .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[] = {
.addr = BMI160_ADDR0,
.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 1b12e8ce11..cee9dd33c7 100644
--- a/board/eve/board.h
+++ b/board/eve/board.h
@@ -123,7 +123,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/garg/board.c b/board/garg/board.c
index 74b7008bd4..2747bdac03 100644
--- a/board/garg/board.c
+++ b/board/garg/board.c
@@ -15,7 +15,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/accelgyro_icm426xx.h"
#include "driver/accelgyro_icm_common.h"
#include "driver/charger/bd9995x.h"
@@ -141,7 +141,7 @@ const mat33_fp_t base_icm_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 icm_drv_data_t g_icm426xx_data;
/* Drivers */
@@ -184,9 +184,9 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_SENSOR,
.addr = BMI160_ADDR0,
.rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g */
- .min_frequency = BMI160_ACCEL_MIN_FREQ,
- .max_frequency = BMI160_ACCEL_MAX_FREQ,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
.config = {
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
@@ -213,8 +213,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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 d1394a14f4..7135a77a31 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"
@@ -450,7 +450,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[] = {
/*
@@ -470,8 +470,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
- .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] = {
@@ -493,8 +493,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,
},
{.name = "Lid Accel",
diff --git a/board/grunt/board.c b/board/grunt/board.c
index f9baa71039..ce3f25b6b7 100644
--- a/board/grunt/board.c
+++ b/board/grunt/board.c
@@ -16,7 +16,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/led/lm3630a.h"
#include "driver/ppc/sn5s330.h"
#include "driver/tcpm/anx74xx.h"
diff --git a/board/kukui/board.c b/board/kukui/board.c
index 86f4c39c5a..7eeeb342b8 100644
--- a/board/kukui/board.c
+++ b/board/kukui/board.c
@@ -13,8 +13,8 @@
#include "chipset.h"
#include "common.h"
#include "console.h"
-#include "driver/accelgyro_bmi160.h"
#include "driver/battery/max17055.h"
+#include "driver/accelgyro_bmi_common.h"
#include "driver/charger/rt946x.h"
#include "driver/sync.h"
#include "driver/tcpm/mt6370.h"
@@ -334,7 +334,7 @@ int board_get_version(void)
#ifdef SECTION_IS_RW
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 = {
@@ -350,6 +350,7 @@ const mat33_fp_t mag_standard_ref = {
{ 0, 0, FLOAT_TO_FP(-1)}
};
+
struct motion_sensor_t motion_sensors[] = {
/*
* Note: bmi160: supports accelerometer and gyro sensor
@@ -367,10 +368,10 @@ struct motion_sensor_t motion_sensors[] = {
.drv_data = &g_bmi160_data,
.port = I2C_PORT_ACCEL,
.addr = BMI160_ADDR0,
- .rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g */
- .min_frequency = BMI160_ACCEL_MIN_FREQ,
- .max_frequency = BMI160_ACCEL_MAX_FREQ,
+ .rot_standard_ref = &&base_standard_ref,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
.config = {
/* Enable accel in S0 */
[SENSOR_CONFIG_EC_S0] = {
@@ -391,9 +392,9 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_ACCEL,
.addr = BMI160_ADDR0,
.default_range = 1000, /* dps */
- .rot_standard_ref = &base_standard_ref,
- .min_frequency = BMI160_GYRO_MIN_FREQ,
- .max_frequency = BMI160_GYRO_MAX_FREQ,
+ .rot_standard_ref = &&base_standard_ref,
+ .min_frequency = BMI_GYRO_MIN_FREQ,
+ .max_frequency = BMI_GYRO_MAX_FREQ,
},
[LID_MAG] = {
.name = "Lid Mag",
diff --git a/board/kukui/board.h b/board/kukui/board.h
index 4be6c40c9a..d12421f033 100644
--- a/board/kukui/board.h
+++ b/board/kukui/board.h
@@ -91,7 +91,7 @@
/* Motion Sensors */
#ifdef SECTION_IS_RW
-#define CONFIG_MAG_BMI160_BMM150
+#define CONFIG_MAG_BMI_BMM150
#define CONFIG_ACCELGYRO_SEC_ADDR BMM150_ADDR0 /* 8-bit address */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCELGYRO_BMI160
diff --git a/board/mchpevb1/board.c b/board/mchpevb1/board.c
index b8d3b8ea45..4000b4b709 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"
@@ -915,7 +915,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;
@@ -941,8 +941,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
.rot_standard_ref = NULL, /* Identity matrix. */
.default_range = 2, /* g, enough for laptop. */
- .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[] = {
.addr = BMI160_SET_SPI_ADDRESS(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
{.name = "Lid Accel",
diff --git a/board/nami/board.c b/board/nami/board.c
index c1ddf682c3..0f6553d76c 100644
--- a/board/nami/board.c
+++ b/board/nami/board.c
@@ -18,7 +18,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"
@@ -687,7 +687,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 */
@@ -780,8 +780,8 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_ACCEL,
.addr = BMI160_ADDR0,
.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 = {
/* EC use accel for angle detection */
@@ -809,8 +809,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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 e393ac288b..118a312229 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/tcpm/ps8xxx.h"
@@ -617,7 +617,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;
@@ -674,8 +674,8 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_ACCEL,
.addr = BMI160_ADDR0,
.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 = {
/* EC use accel for angle detection */
@@ -702,8 +702,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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/nocturne/board.c b/board/nocturne/board.c
index 222dffb92a..43ad77e69d 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/ppc/sn5s330.h"
#include "driver/sync.h"
@@ -163,7 +163,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,
@@ -190,9 +190,9 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_ALS_GYRO,
.addr = BMI160_ADDR0,
.rot_standard_ref = &lid_standard_ref,
- .default_range = 4, /* g */
- .min_frequency = BMI160_ACCEL_MIN_FREQ,
- .max_frequency = BMI160_ACCEL_MAX_FREQ,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
.config = {
/* EC setup accel for chrome usage */
[SENSOR_CONFIG_EC_S0] = {
@@ -214,8 +214,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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 93b5c1378c..28b60a765a 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,
.addr = BMI160_ADDR0,
.default_range = 2, /* g, enough for laptop. */
- .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,
.addr = BMI160_ADDR0,
.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/oak/board.c b/board/oak/board.c
index 97164f2242..9c83b07a4c 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/tcpm/tcpci.h"
#include "driver/temp_sensor/tmp432.h"
@@ -628,7 +628,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
@@ -649,8 +649,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = 1,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
- .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] = {
@@ -672,8 +672,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = 1,
.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 da2bbb65ba..c895bef3e8 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/tcpm/anx74xx.h"
@@ -724,7 +724,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,
@@ -773,8 +773,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.rot_standard_ref = &lid_standard_ref,
.default_range = 2, /* g, enough for laptop. */
- .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] = {
@@ -797,8 +797,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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 1ef39e2692..ca505716d9 100644
--- a/board/poppy/board.h
+++ b/board/poppy/board.h
@@ -123,7 +123,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 179ec94965..7c5cbbe41b 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"
@@ -350,7 +350,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 = {
@@ -380,8 +380,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
- .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] = {
@@ -403,8 +403,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_SET_SPI_ADDRESS(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 b47ccaa1b1..08bd48643e 100644
--- a/board/rammus/board.c
+++ b/board/rammus/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/tcpm/ps8xxx.h"
#include "driver/tcpm/tcpci.h"
@@ -551,7 +551,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;
@@ -610,8 +610,8 @@ struct motion_sensor_t motion_sensors[] = {
.port = I2C_PORT_ACCEL,
.addr = BMI160_ADDR0,
.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 = {
/* EC use accel for angle detection */
@@ -639,8 +639,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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 d524c20e12..00cb9c8226 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"
@@ -714,7 +714,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,
@@ -764,8 +764,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
- .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] = {
@@ -793,8 +793,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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 1b35d97baa..43cc61ba03 100644
--- a/board/reef/board.h
+++ b/board/reef/board.h
@@ -196,7 +196,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 BMM150_ADDR0 /* 8-bit address */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
diff --git a/board/reef_mchp/board.c b/board/reef_mchp/board.c
index fb80a316e1..8c31a996be 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"
@@ -980,7 +980,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 = {
@@ -1034,8 +1034,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.rot_standard_ref = &base_standard_ref,
.default_range = 2, /* g, enough for laptop. */
- .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] = {
@@ -1063,8 +1063,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_ADDR0,
.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 b37b2086b9..b3d13c5186 100644
--- a/board/reef_mchp/board.h
+++ b/board/reef_mchp/board.h
@@ -203,7 +203,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 BMM150_ADDR0 /* 8-bit address */
#define CONFIG_MAG_CALIBRATE
#define CONFIG_ACCEL_KX022
diff --git a/board/rowan/board.c b/board/rowan/board.c
index f5755f178d..d6b62fdd4a 100644
--- a/board/rowan/board.c
+++ b/board/rowan/board.c
@@ -443,7 +443,7 @@ const mat33_fp_t lid_standard_ref = {
{ 0, 0, FLOAT_TO_FP(1)}
};
-static struct bmi160_drv_data_t g_bmi160_data;
+static struct bmi_drv_data_t g_bmi160_data;
struct motion_sensor_t motion_sensors[] = {
/*
diff --git a/board/scarlet/board.c b/board/scarlet/board.c
index a36e450972..fcff96b40d 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"
@@ -376,7 +376,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 = {
@@ -403,9 +403,9 @@ struct motion_sensor_t motion_sensors[] = {
.port = CONFIG_SPI_ACCEL_PORT,
.addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT),
.rot_standard_ref = &base_standard_ref,
- .default_range = 4, /* g */
- .min_frequency = BMI160_ACCEL_MIN_FREQ,
- .max_frequency = BMI160_ACCEL_MAX_FREQ,
+ .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */
+ .min_frequency = BMI_ACCEL_MIN_FREQ,
+ .max_frequency = BMI_ACCEL_MAX_FREQ,
.config = {
/* Enable accel in S0 */
[SENSOR_CONFIG_EC_S0] = {
@@ -427,8 +427,8 @@ struct motion_sensor_t motion_sensors[] = {
.addr = BMI160_SET_SPI_ADDRESS(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/driver/accelgyro_bmi160.h b/driver/accelgyro_bmi160.h
index 5bf12d636e..61cf63d51e 100644
--- a/driver/accelgyro_bmi160.h
+++ b/driver/accelgyro_bmi160.h
@@ -407,34 +407,12 @@
#define BMI160_FF_DATA_LEN_MAG 8
-/* 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;
#define BMI160_FLAG_SEC_I2C_ENABLED (1 << 0)
#define BMI160_FIFO_FLAG_OFFSET 4
#define BMI160_FIFO_ALL_MASK 7
-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_BMI160_BMM150
- struct bmm150_private_data compass;
-#endif
-#ifdef CONFIG_BMI160_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_BMI160_SEC_I2C
diff --git a/include/config.h b/include/config.h
index c25e9ee578..c3b3136145 100644
--- a/include/config.h
+++ b/include/config.h
@@ -86,14 +86,14 @@
#undef CONFIG_MAG_LIS2MDL
#undef CONFIG_MAG_BMM150
-/* Presence of a Bosh Sensortec BMM150 magnetometer behind a BMI160. */
-#undef CONFIG_MAG_BMI160_BMM150
+/* Presence of a Bosh Sensortec BMM150 magnetometer behind a BMIxxx. */
+#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 BMI160. */
-#undef CONFIG_MAG_BMI160_LIS2MDL
+/* Presence of a ST LIS2MDL magnetometer behind a BMIxxx. */
+#undef CONFIG_MAG_BMI_LIS2MDL
/* Presence of a ST LIS2MDL magnetometer behind a LSM6DSM. */
#undef CONFIG_MAG_LSM6DSM_LIS2MDL