summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2021-09-20 22:44:18 -0700
committerCommit Bot <commit-bot@chromium.org>2021-09-23 03:17:59 +0000
commitfd8c1e4ee56b721975a5ac7b76e75a088b0c861d (patch)
treee78e18b4d0dae0bc46c2a04dd5452158cc19ae1d
parent62ce4fb60fb0c0bf390d296f85e4ed347cc4272a (diff)
downloadchrome-ec-fd8c1e4ee56b721975a5ac7b76e75a088b0c861d.tar.gz
board/guybrush-dewat: Minor cleanup
Remove g_bmi323 static variable, use same structure as bmi160. Fill motion_sensors array with index in order. BUG=b:195264765 BRANCH=none TEST=compile Change-Id: I2c16fa64db7786bf5ff977cd6626c3d9de9b66b4 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3172268 Reviewed-by: Rob Barnes <robbarnes@google.com> Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r--baseboard/guybrush/baseboard.h3
-rw-r--r--board/dewatt/board.c11
-rw-r--r--board/guybrush/board.c57
3 files changed, 35 insertions, 36 deletions
diff --git a/baseboard/guybrush/baseboard.h b/baseboard/guybrush/baseboard.h
index 25268d5ade..ef1338c5d5 100644
--- a/baseboard/guybrush/baseboard.h
+++ b/baseboard/guybrush/baseboard.h
@@ -113,6 +113,7 @@
/* Sensors */
#ifdef HAS_TASK_MOTIONSENSE
+
#define CONFIG_TABLET_MODE
#define CONFIG_GMR_TABLET_MODE
#define GMR_TABLET_MODE_GPIO_L GPIO_TABLET_MODE
@@ -131,7 +132,7 @@
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL)
-#endif
+#endif /* HAS_TASK_MOTIONSENSE */
/* Backlight config */
#define CONFIG_BACKLIGHT_LID
diff --git a/board/dewatt/board.c b/board/dewatt/board.c
index 72e803d100..53180d39cb 100644
--- a/board/dewatt/board.c
+++ b/board/dewatt/board.c
@@ -41,8 +41,7 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Motion sensor private data */
-static struct bmi_drv_data_t g_bmi160_data;
-static struct bmi3xx_drv_data g_bmi323_data;
+static struct bmi_drv_data_t g_bmi_data;
static struct accelgyro_saved_data_t g_bma422_data;
/* Matrix to rotate accelrator into standard reference frame */
@@ -84,7 +83,7 @@ struct motion_sensor_t motion_sensors[] = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &bmi3xx_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi323_data,
+ .drv_data = &g_bmi_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM,
.rot_standard_ref = &base_standard_ref,
@@ -140,7 +139,7 @@ struct motion_sensor_t motion_sensors[] = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &bmi3xx_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi323_data,
+ .drv_data = &g_bmi_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM,
.default_range = 1000, /* dps */
@@ -159,7 +158,7 @@ struct motion_sensor_t bmi160_base_accel = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &bmi160_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi160_data,
+ .drv_data = &g_bmi_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -188,7 +187,7 @@ struct motion_sensor_t bmi160_base_gyro = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &bmi160_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi160_data,
+ .drv_data = &g_bmi_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */
diff --git a/board/guybrush/board.c b/board/guybrush/board.c
index 04aa9e8777..75fb5a8607 100644
--- a/board/guybrush/board.c
+++ b/board/guybrush/board.c
@@ -41,8 +41,7 @@ static struct mutex g_lid_mutex;
static struct mutex g_base_mutex;
/* Motion sensor private data */
-static struct bmi_drv_data_t g_bmi160_data;
-static struct bmi3xx_drv_data g_bmi323_data;
+static struct bmi_drv_data_t g_bmi_data;
static struct accelgyro_saved_data_t g_bma422_data;
/* Matrix to rotate accelrator into standard reference frame */
@@ -76,21 +75,21 @@ const int keyboard_factory_scan_pins_used =
ARRAY_SIZE(keyboard_factory_scan_pins);
struct motion_sensor_t motion_sensors[] = {
- [BASE_ACCEL] = {
- .name = "Base Accel",
+ [LID_ACCEL] = {
+ .name = "Lid Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMI323,
+ .chip = MOTIONSENSE_CHIP_BMA422,
.type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_BASE,
- .drv = &bmi3xx_drv,
- .mutex = &g_base_mutex,
- .drv_data = &g_bmi323_data,
+ .location = MOTIONSENSE_LOC_LID,
+ .drv = &bma4_accel_drv,
+ .mutex = &g_lid_mutex,
+ .drv_data = &g_bma422_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM,
- .rot_standard_ref = &base_standard_ref,
- .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 */
+ .i2c_spi_addr_flags = BMA4_I2C_ADDR_PRIMARY,
+ .rot_standard_ref = &lid_standard_ref,
+ .min_frequency = BMA4_ACCEL_MIN_FREQ,
+ .max_frequency = BMA4_ACCEL_MAX_FREQ,
+ .default_range = 2, /* g, enough for laptop. */
.config = {
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
@@ -104,21 +103,21 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
- [LID_ACCEL] = {
- .name = "Lid Accel",
+ [BASE_ACCEL] = {
+ .name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3,
- .chip = MOTIONSENSE_CHIP_BMA422,
+ .chip = MOTIONSENSE_CHIP_BMI323,
.type = MOTIONSENSE_TYPE_ACCEL,
- .location = MOTIONSENSE_LOC_LID,
- .drv = &bma4_accel_drv,
- .mutex = &g_lid_mutex,
- .drv_data = &g_bma422_data,
+ .location = MOTIONSENSE_LOC_BASE,
+ .drv = &bmi3xx_drv,
+ .mutex = &g_base_mutex,
+ .drv_data = &g_bmi_data,
.port = I2C_PORT_SENSOR,
- .i2c_spi_addr_flags = BMA4_I2C_ADDR_PRIMARY,
- .rot_standard_ref = &lid_standard_ref,
- .min_frequency = BMA4_ACCEL_MIN_FREQ,
- .max_frequency = BMA4_ACCEL_MAX_FREQ,
- .default_range = 2, /* g, enough for laptop. */
+ .i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM,
+ .rot_standard_ref = &base_standard_ref,
+ .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 */
[SENSOR_CONFIG_EC_S0] = {
@@ -140,7 +139,7 @@ struct motion_sensor_t motion_sensors[] = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &bmi3xx_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi323_data,
+ .drv_data = &g_bmi_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI3_ADDR_I2C_PRIM,
.default_range = 1000, /* dps */
@@ -159,7 +158,7 @@ struct motion_sensor_t bmi160_base_accel = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &bmi160_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi160_data,
+ .drv_data = &g_bmi_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.rot_standard_ref = &base_standard_ref,
@@ -188,7 +187,7 @@ struct motion_sensor_t bmi160_base_gyro = {
.location = MOTIONSENSE_LOC_BASE,
.drv = &bmi160_drv,
.mutex = &g_base_mutex,
- .drv_data = &g_bmi160_data,
+ .drv_data = &g_bmi_data,
.port = I2C_PORT_SENSOR,
.i2c_spi_addr_flags = BMI160_ADDR0_FLAGS,
.default_range = 1000, /* dps */