From 1bf17065d757a4de89691fe44900eb9ac20e1c63 Mon Sep 17 00:00:00 2001 From: johnwc_yeh Date: Mon, 19 Apr 2021 17:01:12 +0800 Subject: cret: Implement motion sensor setting MB LSM6DSO Implement motion sensor setting on MB side and sensor board side. Change MB LSM6DSM to LSM6DSO. The sensor of model: 1.MB: LSM6DSOTR 2.Sensor board: LIS2DE12TR BUG=b:184504094 BRANCH=dedede TEST=make BOARD=cret Signed-off-by: johnwc_yeh Change-Id: I002feb39026c132834a7e18af67348f5a1082c08 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2835260 Reviewed-by: Elthan Huang Reviewed-by: Aseda Aboagye Commit-Queue: Aseda Aboagye --- board/cret/board.c | 30 ++++++++++++++---------------- board/cret/board.h | 4 +++- board/cret/gpio.inc | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/board/cret/board.c b/board/cret/board.c index 6fe4fa0147..bb7fc16f93 100644 --- a/board/cret/board.c +++ b/board/cret/board.c @@ -15,7 +15,7 @@ #include "common.h" #include "compile_time_macros.h" #include "driver/accel_lis2dh.h" -#include "driver/accelgyro_lsm6dsm.h" +#include "driver/accelgyro_lsm6dso.h" #include "driver/bc12/pi3usb9201.h" #include "driver/charger/isl923x.h" #include "driver/tcpm/raa489000.h" @@ -338,7 +338,7 @@ static const mat33_fp_t base_standard_ref = { }; static struct stprivate_data g_lis2dh_data; -static struct lsm6dsm_data lsm6dsm_data = LSM6DSM_DATA; +static struct lsm6dso_data lsm6dso_data; struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { @@ -368,21 +368,20 @@ struct motion_sensor_t motion_sensors[] = { [BASE_ACCEL] = { .name = "Base Accel", .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_LSM6DSM, + .chip = MOTIONSENSE_CHIP_LSM6DSO, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_BASE, - .drv = &lsm6dsm_drv, + .drv = &lsm6dso_drv, .mutex = &g_base_mutex, - .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, - MOTIONSENSE_TYPE_ACCEL), + .drv_data = &lsm6dso_data, .int_signal = GPIO_BASE_SIXAXIS_INT_L, .flags = MOTIONSENSE_FLAG_INT_SIGNAL, .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, + .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS, .rot_standard_ref = &base_standard_ref, .default_range = 4, - .min_frequency = LSM6DSM_ODR_MIN_VAL, - .max_frequency = LSM6DSM_ODR_MAX_VAL, + .min_frequency = LSM6DSO_ODR_MIN_VAL, + .max_frequency = LSM6DSO_ODR_MAX_VAL, .config = { [SENSOR_CONFIG_EC_S0] = { .odr = 13000 | ROUND_UP_FLAG, @@ -397,21 +396,20 @@ struct motion_sensor_t motion_sensors[] = { [BASE_GYRO] = { .name = "Base Gyro", .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_LSM6DSM, + .chip = MOTIONSENSE_CHIP_LSM6DSO, .type = MOTIONSENSE_TYPE_GYRO, .location = MOTIONSENSE_LOC_BASE, - .drv = &lsm6dsm_drv, + .drv = &lsm6dso_drv, .mutex = &g_base_mutex, - .drv_data = LSM6DSM_ST_DATA(lsm6dsm_data, - MOTIONSENSE_TYPE_GYRO), + .drv_data = &lsm6dso_data, .int_signal = GPIO_BASE_SIXAXIS_INT_L, .flags = MOTIONSENSE_FLAG_INT_SIGNAL, .port = I2C_PORT_SENSOR, - .i2c_spi_addr_flags = LSM6DSM_ADDR0_FLAGS, + .i2c_spi_addr_flags = LSM6DSO_ADDR0_FLAGS, .default_range = 1000 | ROUND_UP_FLAG, /* dps */ .rot_standard_ref = &base_standard_ref, - .min_frequency = LSM6DSM_ODR_MIN_VAL, - .max_frequency = LSM6DSM_ODR_MAX_VAL, + .min_frequency = LSM6DSO_ODR_MIN_VAL, + .max_frequency = LSM6DSO_ODR_MAX_VAL, }, }; diff --git a/board/cret/board.h b/board/cret/board.h index a2deef2e99..b5892582ab 100644 --- a/board/cret/board.h +++ b/board/cret/board.h @@ -105,7 +105,9 @@ #define CONFIG_CMD_ACCEL_INFO #define CONFIG_ACCEL_LIS2DE /* Lid accel */ -#define CONFIG_ACCELGYRO_LSM6DSM /* Base accel */ +#define CONFIG_ACCELGYRO_LSM6DSO /* Base accel */ +#define CONFIG_ACCEL_LSM6DSO_INT_EVENT \ + TASK_EVENT_MOTION_SENSOR_INTERRUPT(BASE_ACCEL) /* Lid operates in forced mode, base in FIFO */ #define CONFIG_ACCEL_FORCE_MODE_MASK BIT(LID_ACCEL) diff --git a/board/cret/gpio.inc b/board/cret/gpio.inc index 11efceb32f..385012e390 100644 --- a/board/cret/gpio.inc +++ b/board/cret/gpio.inc @@ -38,7 +38,7 @@ GPIO_INT(VOLUP_BTN_ODL, PIN(7, 3), GPIO_INT_BOTH | GPIO_PULL_UP, button_interr GPIO_INT(LID_OPEN, PIN(D, 2), GPIO_INT_BOTH, lid_interrupt) GPIO_INT(EC_WP_OD, PIN(A, 1), GPIO_INT_BOTH, switch_interrupt) GPIO_INT(LID_360_L, PIN(9, 5), GPIO_INT_BOTH, gmr_tablet_switch_isr) -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, lsm6dso_interrupt) GPIO(LID_ACCEL_INT_L, PIN(5, 0), GPIO_INPUT | GPIO_SEL_1P8V) /* I2C Ports */ -- cgit v1.2.1