From 4523735dc187ea5fcb4e0f8d0f79b3958077a141 Mon Sep 17 00:00:00 2001 From: Gwendal Grignou Date: Thu, 18 Aug 2016 20:04:03 -0700 Subject: kevin: Add FIFO for ARC++ support. Add Sensor FIFO, set the sensors in force mode since we haven't enabled their FIFO. BRANCH=kevin BUG=b:27849483 TEST=Check kernel load cros-ec-ring. Check ARC++ get accel info with AIDA64. Change-Id: I1c4d5c1291d2c778fdabd8b8f4e6b6a370f37b04 Signed-off-by: Gwendal Grignou Reviewed-on: https://chromium-review.googlesource.com/373140 Reviewed-by: Aseda Aboagye --- board/kevin/board.c | 28 +++++++++++++++------------- board/kevin/board.h | 10 ++++++++++ 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/board/kevin/board.c b/board/kevin/board.c index a152ea94b5..dfcfc6aa97 100644 --- a/board/kevin/board.c +++ b/board/kevin/board.c @@ -448,7 +448,8 @@ struct motion_sensor_t motion_sensors[] = { * Requirement: accelerometer sensor must init before gyro sensor * DO NOT change the order of the following table. */ - {.name = "Base Accel", + [BASE_ACCEL] = { + .name = "Base Accel", .active_mask = SENSOR_ACTIVE_S0, .chip = MOTIONSENSE_CHIP_BMI160, .type = MOTIONSENSE_TYPE_ACCEL, @@ -469,7 +470,7 @@ struct motion_sensor_t motion_sensors[] = { /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100, + .ec_rate = 0, }, /* Sensor off in S3/S5 */ [SENSOR_CONFIG_EC_S3] = { @@ -483,8 +484,8 @@ struct motion_sensor_t motion_sensors[] = { }, }, }, - - {.name = "Base Gyro", + [BASE_GYRO] = { + .name = "Base Gyro", .active_mask = SENSOR_ACTIVE_S0, .chip = MOTIONSENSE_CHIP_BMI160, .type = MOTIONSENSE_TYPE_GYRO, @@ -523,9 +524,9 @@ struct motion_sensor_t motion_sensors[] = { }, }, }, - #ifdef BOARD_KEVIN - {.name = "Lid Accel", + [LID_ACCEL] = { + .name = "Lid Accel", .active_mask = SENSOR_ACTIVE_S0, .chip = MOTIONSENSE_CHIP_BMA255, .type = MOTIONSENSE_TYPE_ACCEL, @@ -540,13 +541,13 @@ struct motion_sensor_t motion_sensors[] = { .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, + .odr = 0, + .ec_rate = 0, }, /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, + .ec_rate = 0, }, /* unused */ [SENSOR_CONFIG_EC_S3] = { @@ -560,7 +561,8 @@ struct motion_sensor_t motion_sensors[] = { }, }, #else - {.name = "Lid Accel", + [LID_ACCEL] = { + .name = "Lid Accel", .active_mask = SENSOR_ACTIVE_S0, .chip = MOTIONSENSE_CHIP_KX022, .type = MOTIONSENSE_TYPE_ACCEL, @@ -575,13 +577,13 @@ struct motion_sensor_t motion_sensors[] = { .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { - .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, + .odr = 0, + .ec_rate = 0, }, /* EC use accel for angle detection */ [SENSOR_CONFIG_EC_S0] = { .odr = 10000 | ROUND_UP_FLAG, - .ec_rate = 100 * MSEC, + .ec_rate = 0, }, /* unused */ [SENSOR_CONFIG_EC_S3] = { diff --git a/board/kevin/board.h b/board/kevin/board.h index a39ffa03f1..76464c22ef 100644 --- a/board/kevin/board.h +++ b/board/kevin/board.h @@ -80,6 +80,16 @@ #define CONFIG_LID_ANGLE #define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL #define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL +/* FIFO size is in power of 2. */ +#define CONFIG_ACCEL_FIFO 256 +#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3) + +/* + * Sensor internal FIFO are not enabled, we need to poll at + * every data point. + */ +#define CONFIG_ACCEL_FORCE_MODE_MASK \ + ((1 << BASE_ACCEL) | (1 << BASE_GYRO) | (1 << LID_ACCEL)) /* USB PD config */ #define CONFIG_CASE_CLOSED_DEBUG_EXTERNAL -- cgit v1.2.1