diff options
author | wen zhang <zhangwen6@huaqin.corp-partner.google.com> | 2021-02-03 15:37:42 +0800 |
---|---|---|
committer | Commit Bot <commit-bot@chromium.org> | 2021-02-03 09:31:34 +0000 |
commit | 514f95316006de1915a41f28e575ed8773687e3a (patch) | |
tree | 470a58bb605009ae841059481bebdd2940b2e5e0 /board/katsu | |
parent | 9b45e318e142eee21b83840716e73903733e1cee (diff) | |
download | chrome-ec-514f95316006de1915a41f28e575ed8773687e3a.tar.gz |
Katsu: change the A+G sensor to ICM40608
Change the A+G sensor from BMI160 to ICM40608
Use the driver of icm426xx to enable ICM40608
BUG=b:178339361
BRANCH=kukui
TEST=1.make BOARD=katsu
2.ectool motionsense can get the sensor data
Change-Id: If3b497914da10bcf103a3c3376c55b19d87ab81b
Signed-off-by: wen zhang <zhangwen6@huaqin.corp-partner.google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2671260
Reviewed-by: Chen-Tsung Hsieh <chentsung@chromium.org>
Reviewed-by: Ting Shen <phoenixshen@chromium.org>
Reviewed-by: Shou-Chieh Hsu <shouchieh@chromium.org>
Diffstat (limited to 'board/katsu')
-rw-r--r-- | board/katsu/board.c | 33 | ||||
-rw-r--r-- | board/katsu/board.h | 5 | ||||
-rw-r--r-- | board/katsu/gpio.inc | 2 |
3 files changed, 20 insertions, 20 deletions
diff --git a/board/katsu/board.c b/board/katsu/board.c index b45c3245b8..cc0cf6c553 100644 --- a/board/katsu/board.c +++ b/board/katsu/board.c @@ -14,7 +14,8 @@ #include "chipset.h" #include "common.h" #include "console.h" -#include "driver/accelgyro_bmi_common.h" +#include "driver/accelgyro_icm_common.h" +#include "driver/accelgyro_icm426xx.h" #include "driver/charger/rt946x.h" #include "driver/sync.h" #include "driver/tcpm/mt6370.h" @@ -258,7 +259,7 @@ static void board_init(void) gpio_enable_interrupt(GPIO_CHARGER_INT_ODL); #ifdef SECTION_IS_RW - /* Enable interrupts from BMI160 sensor. */ + /* Enable interrupts from ICM40608 sensor. */ gpio_enable_interrupt(GPIO_ACCEL_INT_ODL); /* Enable interrupt for the camera vsync. */ @@ -304,7 +305,7 @@ void sensor_board_proc_double_tap(void) #ifndef VARIANT_KUKUI_NO_SENSORS static struct mutex g_lid_mutex; -static struct bmi_drv_data_t g_bmi160_data; +static struct icm_drv_data_t g_icm426xx_data; /* Matrix to rotate accelerometer into standard reference frame */ static const mat33_fp_t lid_standard_ref = { @@ -315,25 +316,25 @@ static const mat33_fp_t lid_standard_ref = { struct motion_sensor_t motion_sensors[] = { /* - * Note: bmi160: supports accelerometer and gyro sensor + * Note: ICM40608: supports accelerometer and gyro sensor * Requirement: accelerometer sensor must init before gyro sensor * DO NOT change the order of the following table. */ [LID_ACCEL] = { .name = "Accel", .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMI160, + .chip = MOTIONSENSE_CHIP_ICM426XX, .type = MOTIONSENSE_TYPE_ACCEL, .location = MOTIONSENSE_LOC_LID, - .drv = &bmi160_drv, + .drv = &icm426xx_drv, .mutex = &g_lid_mutex, - .drv_data = &g_bmi160_data, + .drv_data = &g_icm426xx_data, .port = I2C_PORT_ACCEL, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, + .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS, .rot_standard_ref = &lid_standard_ref, .default_range = 4, /* g, to meet CDD 7.3.1/C-1-4 reqs */ - .min_frequency = BMI_ACCEL_MIN_FREQ, - .max_frequency = BMI_ACCEL_MAX_FREQ, + .min_frequency = ICM426XX_ACCEL_MIN_FREQ, + .max_frequency = ICM426XX_ACCEL_MAX_FREQ, .config = { /* Enable accel in S0 */ [SENSOR_CONFIG_EC_S0] = { @@ -350,18 +351,18 @@ struct motion_sensor_t motion_sensors[] = { [LID_GYRO] = { .name = "Gyro", .active_mask = SENSOR_ACTIVE_S0_S3, - .chip = MOTIONSENSE_CHIP_BMI160, + .chip = MOTIONSENSE_CHIP_ICM426XX, .type = MOTIONSENSE_TYPE_GYRO, .location = MOTIONSENSE_LOC_LID, - .drv = &bmi160_drv, + .drv = &icm426xx_drv, .mutex = &g_lid_mutex, - .drv_data = &g_bmi160_data, + .drv_data = &g_icm426xx_data, .port = I2C_PORT_ACCEL, - .i2c_spi_addr_flags = BMI160_ADDR0_FLAGS, + .i2c_spi_addr_flags = ICM426XX_ADDR0_FLAGS, .default_range = 1000, /* dps */ .rot_standard_ref = &lid_standard_ref, - .min_frequency = BMI_GYRO_MIN_FREQ, - .max_frequency = BMI_GYRO_MAX_FREQ, + .min_frequency = ICM426XX_GYRO_MIN_FREQ, + .max_frequency = ICM426XX_GYRO_MAX_FREQ, }, [VSYNC] = { .name = "Camera vsync", diff --git a/board/katsu/board.h b/board/katsu/board.h index 5220554eb9..99f576b727 100644 --- a/board/katsu/board.h +++ b/board/katsu/board.h @@ -33,9 +33,9 @@ /* Motion Sensors */ #ifdef SECTION_IS_RW -#define CONFIG_ACCELGYRO_BMI160 +#define CONFIG_ACCELGYRO_ICM426XX #define CONFIG_ACCEL_INTERRUPTS -#define CONFIG_ACCELGYRO_BMI160_INT_EVENT \ +#define CONFIG_ACCELGYRO_ICM426XX_INT_EVENT \ TASK_EVENT_MOTION_SENSOR_INTERRUPT(LID_ACCEL) /* Camera VSYNC */ @@ -118,7 +118,6 @@ int board_discharge_on_ac(int enable); /* Enable double tap detection */ #define CONFIG_GESTURE_DETECTION -#define CONFIG_GESTURE_HOST_DETECTION #define CONFIG_GESTURE_SENSOR_DOUBLE_TAP #define CONFIG_GESTURE_TAP_SENSOR 0 #define CONFIG_GESTURE_SENSOR_DOUBLE_TAP_FOR_HOST diff --git a/board/katsu/gpio.inc b/board/katsu/gpio.inc index 1a3e8e539c..f938153045 100644 --- a/board/katsu/gpio.inc +++ b/board/katsu/gpio.inc @@ -30,7 +30,7 @@ GPIO_INT(AP_EC_WATCHDOG_L, PIN(C, 2), GPIO_INT_FALLING, chipset_watchdog_interrupt) GPIO_INT_RW(ACCEL_INT_ODL, PIN(A, 4), GPIO_INT_FALLING | GPIO_SEL_1P8V | GPIO_PULL_UP, - bmi160_interrupt) + icm426xx_interrupt) GPIO_INT(CHARGER_INT_ODL, PIN(C, 13), GPIO_INT_FALLING | GPIO_PULL_UP, rt946x_interrupt) GPIO_INT_RO(EMMC_CMD, PIN(B, 15), GPIO_INT_FALLING, |