From 19007dd5773dbba6b599c3a01b92b493510af58c 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=master TEST=make -j BOARD=fennel Change-Id: I2e3143daf41ea848f0c32778f3d066aa7b0878d6 Signed-off-by: Aaron Zhang Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2419733 Reviewed-by: Zhuohao Lee Commit-Queue: Zhuohao Lee --- board/fennel/board.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) (limited to 'board/fennel/board.c') diff --git a/board/fennel/board.c b/board/fennel/board.c index 7a68dfbb1a..43d3e30bad 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_bmi_common.h" #include "driver/battery/max17055.h" #include "driver/bc12/pi3usb9201.h" @@ -334,35 +334,45 @@ 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; +/* Lid accel private data */ +static struct stprivate_data g_lis2dwl_data; +/* Base accel private data */ static struct bmi_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, }, -- cgit v1.2.1