From 2d926563eaf143bb641c1c187f4a45c889d94597 Mon Sep 17 00:00:00 2001 From: Aaron Zhang Date: Sat, 19 Sep 2020 15:18:37 +0800 Subject: Fennel: Change g-sensor setting for fennel Modify lid accel to LIS2DWL & config g-sensor matrixes. BUG=b:163109924 BRANCH=firmware-kukui-12573.B TEST=make -j BOARD=fennel Change-Id: I2e3143daf41ea848f0c32778f3d066aa7b0878d6 Signed-off-by: Aaron Zhang Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2423670 Reviewed-by: Zhuohao Lee Commit-Queue: Zhuohao Lee --- board/fennel/board.c | 30 +++++++++++++++++++----------- board/fennel/board.h | 2 +- 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/board/fennel/board.c b/board/fennel/board.c index 1c4470bfe4..335a1bb486 100644 --- a/board/fennel/board.c +++ b/board/fennel/board.c @@ -14,7 +14,7 @@ #include "chipset.h" #include "common.h" #include "console.h" -#include "driver/accel_kionix.h" +#include "driver/accel_lis2dw12.h" #include "driver/accelgyro_bmi160.h" #include "driver/battery/max17055.h" #include "driver/bc12/pi3usb9201.h" @@ -315,35 +315,43 @@ static struct mutex g_base_mutex; /* Rotation matrixes */ static const mat33_fp_t base_standard_ref = { - {FLOAT_TO_FP(1), 0, 0}, {0, FLOAT_TO_FP(1), 0}, + {FLOAT_TO_FP(-1), 0, 0}, {0, 0, FLOAT_TO_FP(1)} }; +static const mat33_fp_t lid_standard_ref = { + {FLOAT_TO_FP(-1), 0, 0}, + {0, FLOAT_TO_FP(1), 0}, + {0, 0, FLOAT_TO_FP(-1) } +}; + /* sensor private data */ -static struct kionix_accel_data g_kx022_data; +static struct stprivate_data g_lis2dwl_data; static struct bmi160_drv_data_t g_bmi160_data; struct motion_sensor_t motion_sensors[] = { [LID_ACCEL] = { .name = "Lid Accel", .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_KX022, + .chip = MOTIONSENSE_CHIP_LIS2DWL, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_LID, - .drv = &kionix_accel_drv, + .drv = &lis2dw12_drv, .mutex = &g_lid_mutex, - .drv_data = &g_kx022_data, + .drv_data = &g_lis2dwl_data, .port = I2C_PORT_SENSORS, - .i2c_spi_addr_flags = KX022_ADDR1_FLAGS, - .rot_standard_ref = NULL, /* Identity matrix. */ - .default_range = 2, /* g, to meet CDD 7.3.1/C-1-4 reqs */ + .i2c_spi_addr_flags = LIS2DWL_ADDR1_FLAGS, + .rot_standard_ref = &lid_standard_ref, + .default_range = 2, /* g */ + .min_frequency = LIS2DW12_ODR_MIN_VAL, + .max_frequency = LIS2DW12_ODR_MAX_VAL, .config = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { - .odr = 10000 | ROUND_UP_FLAG, + .odr = 12500 | ROUND_UP_FLAG, }, - /* Sensor on for lid angle detection */ + /* Sensor on for lid angle detection */ [SENSOR_CONFIG_EC_S3] = { .odr = 10000 | ROUND_UP_FLAG, }, diff --git a/board/fennel/board.h b/board/fennel/board.h index 86bc019611..e0f013dc0d 100644 --- a/board/fennel/board.h +++ b/board/fennel/board.h @@ -47,7 +47,7 @@ /* Motion Sensors */ #ifndef VARIANT_KUKUI_NO_SENSORS -#define CONFIG_ACCEL_KX022 /* Lid accel */ +#define CONFIG_ACCEL_LIS2DWL /* Lid accel */ #define CONFIG_ACCELGYRO_BMI160 /* Base accel */ #define CONFIG_ACCEL_INTERRUPTS #define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ -- cgit v1.2.1