reef: Add FIFO support

Add FIFO to allow ARC++ sensors.

BUG=b:27849483
BRANCH=reef
TEST=Check cros_ec_sensor_ring is loaded.

Change-Id: Idca3a324530a29f33face8784dcf260fdafce83f
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/382322
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
This commit is contained in:
Gwendal Grignou
2016-09-07 10:18:39 -07:00
committed by chrome-bot
parent e54af6574a
commit bcd2872e78
2 changed files with 51 additions and 45 deletions

View File

@@ -134,7 +134,7 @@ const struct i2c_port_t i2c_ports[] = {
GPIO_EC_I2C_USB_C0_PD_SCL, GPIO_EC_I2C_USB_C0_PD_SDA},
{"tcpc1", NPCX_I2C_PORT0_1, 400,
GPIO_EC_I2C_USB_C1_PD_SCL, GPIO_EC_I2C_USB_C1_PD_SDA},
{"gyro", I2C_PORT_GYRO, 400,
{"accelgyro", I2C_PORT_GYRO, 400,
GPIO_EC_I2C_GYRO_SCL, GPIO_EC_I2C_GYRO_SDA},
{"sensors", NPCX_I2C_PORT2, 400,
GPIO_EC_I2C_SENSOR_SCL, GPIO_EC_I2C_SENSOR_SDA},
@@ -734,23 +734,23 @@ 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,
.odr = 10000 | ROUND_UP_FLAG,
.ec_rate = 100 * MSEC,
},
/* Sensor off in S3/S5 */
[SENSOR_CONFIG_EC_S3] = {
.odr = 0,
.ec_rate = 0
.odr = 0,
.ec_rate = 0
},
/* Sensor off in S3/S5 */
[SENSOR_CONFIG_EC_S5] = {
.odr = 0,
.ec_rate = 0
.odr = 0,
.ec_rate = 0
},
},
},
@@ -771,23 +771,23 @@ struct motion_sensor_t motion_sensors[] = {
.config = {
/* AP: by default shutdown all sensors */
[SENSOR_CONFIG_AP] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
/* EC does not need in S0 */
[SENSOR_CONFIG_EC_S0] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
/* Sensor off in S3/S5 */
[SENSOR_CONFIG_EC_S3] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
/* Sensor off in S3/S5 */
[SENSOR_CONFIG_EC_S5] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
},
},
@@ -808,18 +808,18 @@ struct motion_sensor_t motion_sensors[] = {
.config = {
/* AP: by default shutdown all sensors */
[SENSOR_CONFIG_AP] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
/* EC does not need in S0 */
[SENSOR_CONFIG_EC_S0] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
/* Sensor off in S3/S5 */
[SENSOR_CONFIG_EC_S3] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
/* Sensor off in S3/S5 */
[SENSOR_CONFIG_EC_S5] = {
@@ -845,8 +845,8 @@ 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] = {
@@ -879,23 +879,23 @@ struct motion_sensor_t motion_sensors[] = {
.config = {
/* AP: by default shutdown all sensors */
[SENSOR_CONFIG_AP] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
/* EC does not need in S0 */
[SENSOR_CONFIG_EC_S0] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
/* Sensor off in S3/S5 */
[SENSOR_CONFIG_EC_S3] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
/* Sensor off in S3/S5 */
[SENSOR_CONFIG_EC_S5] = {
.odr = 0,
.ec_rate = 0,
.odr = 0,
.ec_rate = 0,
},
},
},

View File

@@ -142,18 +142,13 @@
#define NPCX_TACH_SEL2 0 /* 0:GPIO40/A4 1:GPIO93/D3 as TACH */
/* I2C ports */
#define I2C_PORT_GYRO NPCX_I2C_PORT1
#define I2C_PORT_LID_ACCEL NPCX_I2C_PORT2
#define I2C_PORT_ALS NPCX_I2C_PORT2
#define I2C_PORT_BARO NPCX_I2C_PORT2
#define I2C_PORT_BATTERY NPCX_I2C_PORT3
#define I2C_PORT_CHARGER NPCX_I2C_PORT3
/*
* FIXME: This #define is necessary for the BMI160 driver. The driver doesn't
* actually use the value, so we should eventually re-factor the driver to
* be less confusing.
*/
#define I2C_PORT_GYRO NPCX_I2C_PORT1
#define I2C_PORT_LID_ACCEL NPCX_I2C_PORT2
#define I2C_PORT_ALS NPCX_I2C_PORT2
#define I2C_PORT_BARO NPCX_I2C_PORT2
#define I2C_PORT_BATTERY NPCX_I2C_PORT3
#define I2C_PORT_CHARGER NPCX_I2C_PORT3
/* Accelerometer and Gyroscope are the same device. */
#define I2C_PORT_ACCEL I2C_PORT_GYRO
/* Sensors */
@@ -170,6 +165,13 @@
/* #define CONFIG_LID_ANGLE_SENSOR_BASE 0 */ /* FIXME(dhendrix): maybe? */
/* #define CONFIG_LID_ANGLE_SENSOR_LID 2 */ /* FIXME(dhendrix): maybe? */
/* FIFO size is in power of 2. */
#define CONFIG_ACCEL_FIFO 1024
/* Depends on how fast the AP boots and typical ODRs */
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3)
#ifndef __ASSEMBLER__
#include "gpio_signal.h"
@@ -269,6 +271,10 @@ int board_get_version(void);
void board_set_tcpc_power_mode(int port, int mode);
/* Sensors without hardware FIFO are in forced mode */
#define CONFIG_ACCEL_FORCE_MODE_MASK \
((1 << LID_ACCEL) | (1 << BASE_BARO))
#endif /* !__ASSEMBLER__ */
#endif /* __CROS_EC_BOARD_H */