summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin TerAvest <teravest@chromium.org>2018-08-29 08:49:50 -0600
committerchrome-bot <chrome-bot@chromium.org>2018-08-30 14:42:10 -0700
commit260907bf15752cef85fd89d8d5e3d2f61d4b4a8d (patch)
tree67f58244be93eff9af9b9d3485c2c7701a1c539e
parentdfb04c7b51b2c467736932a24d811a2e3e43b6d2 (diff)
downloadchrome-ec-stabilize-11020.B.tar.gz
bobba: Add support for BMI160 base sensorsstabilize-11020.B
Starting with board_version 2, Bobba uses BMI160 instead of LSM6DSM for base sensor support. All Bobba boards with board_version < 2 should have SKU id set to 255, and thus only have the lid sensor enabled. This change replaces the LSM6DSM support with BMI160 support. BUG=b:113369413 TEST=compile BRANCH=none Change-Id: Ib307e9c279162b445fb5fb8cae39b94bc401ecdb Signed-off-by: Justin TerAvest <teravest@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1194880 Reviewed-by: Tino Liu <tino.liu@quanta.corp-partner.google.com> Reviewed-by: Paris Yeh <pyeh@chromium.org>
-rw-r--r--board/bobba/board.c31
-rw-r--r--board/bobba/board.h8
-rw-r--r--board/bobba/gpio.inc2
3 files changed, 21 insertions, 20 deletions
diff --git a/board/bobba/board.c b/board/bobba/board.c
index 7525cfefb8..3be6443893 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_lsm6dsm.h"
+#include "driver/accelgyro_bmi160.h"
#include "driver/bc12/bq24392.h"
#include "driver/charger/bd9995x.h"
#include "driver/ppc/nx20p348x.h"
@@ -117,8 +117,7 @@ const matrix_3x3_t base_standard_ref = {
/* sensor private data */
static struct kionix_accel_data g_kx022_data;
-static struct lsm6dsm_data lsm6dsm_g_data;
-static struct lsm6dsm_data lsm6dsm_a_data;
+static struct bmi160_drv_data_t g_bmi160_data;
/* Drivers */
struct motion_sensor_t motion_sensors[] = {
@@ -146,22 +145,21 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
-
[BASE_ACCEL] = {
.name = "Base Accel",
.active_mask = SENSOR_ACTIVE_S0_S3_S5,
- .chip = MOTIONSENSE_CHIP_LSM6DSM,
+ .chip = MOTIONSENSE_CHIP_BMI160,
.type = MOTIONSENSE_TYPE_ACCEL,
.location = MOTIONSENSE_LOC_BASE,
- .drv = &lsm6dsm_drv,
+ .drv = &bmi160_drv,
.mutex = &g_base_mutex,
- .drv_data = &lsm6dsm_a_data,
+ .drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .addr = BMI160_ADDR0,
.rot_standard_ref = &base_standard_ref,
.default_range = 4, /* g */
- .min_frequency = LSM6DSM_ODR_MIN_VAL,
- .max_frequency = LSM6DSM_ODR_MAX_VAL,
+ .min_frequency = BMI160_ACCEL_MIN_FREQ,
+ .max_frequency = BMI160_ACCEL_MAX_FREQ,
.config = {
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
@@ -175,22 +173,21 @@ struct motion_sensor_t motion_sensors[] = {
},
},
},
-
[BASE_GYRO] = {
.name = "Base Gyro",
.active_mask = SENSOR_ACTIVE_S0,
- .chip = MOTIONSENSE_CHIP_LSM6DSM,
+ .chip = MOTIONSENSE_CHIP_BMI160,
.type = MOTIONSENSE_TYPE_GYRO,
.location = MOTIONSENSE_LOC_BASE,
- .drv = &lsm6dsm_drv,
+ .drv = &bmi160_drv,
.mutex = &g_base_mutex,
- .drv_data = &lsm6dsm_g_data,
+ .drv_data = &g_bmi160_data,
.port = I2C_PORT_SENSOR,
- .addr = LSM6DSM_ADDR0,
+ .addr = BMI160_ADDR0,
.default_range = 1000, /* dps */
.rot_standard_ref = &base_standard_ref,
- .min_frequency = LSM6DSM_ODR_MIN_VAL,
- .max_frequency = LSM6DSM_ODR_MAX_VAL,
+ .min_frequency = BMI160_GYRO_MIN_FREQ,
+ .max_frequency = BMI160_GYRO_MAX_FREQ,
},
};
diff --git a/board/bobba/board.h b/board/bobba/board.h
index fdc401b7ff..d09aba88e2 100644
--- a/board/bobba/board.h
+++ b/board/bobba/board.h
@@ -13,6 +13,9 @@
#define VARIANT_OCTOPUS_CHARGER_ISL9238
#include "baseboard.h"
+/* I2C bus configuraiton */
+#define I2C_PORT_ACCEL I2C_PORT_SENSOR
+
/* Optional features */
#define CONFIG_SYSTEM_UNLOCKED /* Allow dangerous commands while in dev. */
@@ -24,7 +27,8 @@
/* Sensors */
#define CONFIG_ACCEL_KX022 /* Lid accel */
-#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */
+#define CONFIG_ACCELGYRO_BMI160 /* Base accel */
+
#define CONFIG_DYNAMIC_MOTION_SENSOR_COUNT
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK (1 << LID_ACCEL)
@@ -58,7 +62,7 @@
#define CONFIG_MKBP_EVENT
#define CONFIG_MKBP_USE_HOST_EVENT
-#define CONFIG_ACCEL_LSM6DSM_INT_EVENT TASK_EVENT_CUSTOM(4)
+#define CONFIG_ACCELGYRO_BMI160_INT_EVENT TASK_EVENT_CUSTOM(4)
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
diff --git a/board/bobba/gpio.inc b/board/bobba/gpio.inc
index 551b231648..7cfb5e897b 100644
--- a/board/bobba/gpio.inc
+++ b/board/bobba/gpio.inc
@@ -37,7 +37,7 @@ GPIO_INT(TABLET_MODE_L, PIN(8, 6), GPIO_INT_BOTH, tablet_mode_isr)
GPIO_INT(EC_VOLUP_BTN_ODL, PIN(7, 5), GPIO_INT_BOTH, button_interrupt)
GPIO_INT(EC_VOLDN_BTN_ODL, PIN(4, 0), GPIO_INT_BOTH, button_interrupt)
-GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, lsm6dsm_interrupt)
+GPIO_INT(BASE_SIXAXIS_INT_L, PIN(5, 6), GPIO_INT_FALLING | GPIO_SEL_1P8V, bmi160_interrupt)
GPIO(LID_ACCEL_INT_L, PIN(5, 0), GPIO_INPUT | GPIO_SEL_1P8V)
/* Define PCH_SLP_S0_L after all interrupts if CONFIG_POWER_S0IX not defined. */