diff options
author | Devin Lu <Devin.Lu@quantatw.com> | 2020-07-27 15:50:37 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2020-07-31 04:25:37 +0000 |
commit | 7e36bc92e96b9bf7a64f1b0abb51c67cf967ad54 (patch) | |
tree | d12c3852886044f59f49dcc05085586bd7a01e18 | |
parent | a806f260be783c888d582b91f3b02a01ce03bdee (diff) | |
download | chrome-ec-7e36bc92e96b9bf7a64f1b0abb51c67cf967ad54.tar.gz |
drawcia: enable accelerometers
Drawcia is using lsm6dsl on base, bma 253 on lid. This patch is
enabling sensors.
BUG=none
BRANCH=none
TEST=ectool motionsense
Motion sensing active
Sensor 0: -3408 14368 -6240
Sensor 1: -89 -213 8341
Sensor 2: 0 0 0
Sensor 3: 0 0 0
Signed-off-by: Devin Lu <Devin.Lu@quantatw.com>
Change-Id: I0234ba7ba5f211c213ff8ee0b2eab58be6bd28ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2325490
Reviewed-by: Diana Z <dzigterman@chromium.org>
-rw-r--r-- | board/drawcia/board.c | 19 | ||||
-rw-r--r-- | board/drawcia/board.h | 5 |
2 files changed, 13 insertions, 11 deletions
diff --git a/board/drawcia/board.c b/board/drawcia/board.c index 03c55da24d..797f0ddce3 100644 --- a/board/drawcia/board.c +++ b/board/drawcia/board.c @@ -11,7 +11,7 @@ #include "charge_manager.h" #include "charge_state_v2.h" #include "charger.h" -#include "driver/accel_lis2dh.h" +#include "driver/accel_bma2x2.h" #include "driver/accelgyro_lsm6dsm.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/sm5803.h" @@ -443,7 +443,7 @@ static struct mutex g_lid_mutex; static struct mutex g_base_mutex; /* Sensor Data */ -static struct stprivate_data g_lis2dh_data; +static struct accelgyro_saved_data_t g_bma253_data; static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA; /* Drivers */ @@ -451,19 +451,18 @@ struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { .name = "Lid Accel", .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_LIS2DE, + .chip = MOTIONSENSE_CHIP_BMA255, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_LID, - .drv = &lis2dh_drv, + .drv = &bma2x2_accel_drv, .mutex = &g_lid_mutex, - .drv_data = &g_lis2dh_data, + .drv_data = &g_bma253_data, .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = LIS2DH_ADDR1_FLAGS, + .i2c_spi_addr_flags = BMA2x2_I2C_ADDR1_FLAGS, .rot_standard_ref = NULL, - .default_range = 2, /* g */ - /* We only use 2g because its resolution is only 8-bits */ - .min_frequency = LIS2DH_ODR_MIN_VAL, - .max_frequency = LIS2DH_ODR_MAX_VAL, + .default_range = 2, + .min_frequency = BMA255_ACCEL_MIN_FREQ, + .max_frequency = BMA255_ACCEL_MAX_FREQ, .config = { [SENSOR_CONFIG_EC_S0] = { .odr = 10000 | ROUND_UP_FLAG, diff --git a/board/drawcia/board.h b/board/drawcia/board.h index 76e6cb6c8e..82a9b68cfb 100644 --- a/board/drawcia/board.h +++ b/board/drawcia/board.h @@ -32,7 +32,7 @@ #undef CONFIG_CHARGER_SINGLE_CHIP /* Sensors */ -#define CONFIG_ACCEL_LIS2DE /* Lid accel */ +#define CONFIG_ACCEL_BMA255 /* Lid accel */ #define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */ #define CONFIG_SYNC /* Camera VSYNC */ /* Sensors without hardware FIFO are in forced mode */ @@ -50,6 +50,9 @@ #define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL #define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL +#define CONFIG_ACCEL_LSM6DSM_INT_EVENT \ + TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) + #define CONFIG_SYNC_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(VSYNC) |