From 9a0d0aa70d483be79c71a459dfd5f5e89da2638d Mon Sep 17 00:00:00 2001 From: Nick Vaccaro Date: Tue, 25 Apr 2017 19:09:03 -0700 Subject: common: sensors: add extra sensor attributes Adds min_frequency and max_frequency to struct motion_sensor_t. New attributes min_frequency and max_frequency are now returned in ectool's MOTIONSENSE_CMD_INFO response. Incremented ectool's MOTIONSENSE_CMD_INFO version to version 3. Add constants for MIN_FREQUENCY and MAX_FREQUENCY to each sensor's header file. BRANCH=none BUG=chromium:615059 TEST=build/boot and verify MOTIONSENSE_CMD_INFO response on kevin, make buildall -j passes. Change-Id: I66db9715c122ef6bb4665ad5d086a9ecc9c7c93a Signed-off-by: Nick Vaccaro Reviewed-on: https://chromium-review.googlesource.com/482703 Reviewed-by: Aseda Aboagye --- board/elm/board.c | 4 ++++ board/eve/board.c | 10 ++++++++++ board/glados/board.c | 6 ++++++ board/kahlee/board.c | 2 ++ board/kevin/board.c | 10 ++++++++++ board/oak/board.c | 6 ++++++ board/poppy/board.c | 8 ++++++++ board/reef/board.c | 12 ++++++++++++ board/rowan/board.c | 4 ++++ board/ryu/board.c | 10 ++++++++++ board/samus/board.c | 6 ++++++ board/strago/board.c | 4 ++++ board/wheatley/board.c | 6 ++++++ 13 files changed, 88 insertions(+) (limited to 'board') diff --git a/board/elm/board.c b/board/elm/board.c index 4076979b4a..e6734bd4ad 100644 --- a/board/elm/board.c +++ b/board/elm/board.c @@ -512,6 +512,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = 1, /* SPI, device ID 0 */ .rot_standard_ref = &base_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KX022_ACCEL_MIN_FREQ, + .max_frequency = KX022_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -546,6 +548,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = 3, /* SPI, device ID 1 */ .rot_standard_ref = &lid_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KX022_ACCEL_MIN_FREQ, + .max_frequency = KX022_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { diff --git a/board/eve/board.c b/board/eve/board.c index aed81eccbb..e548baf6dd 100644 --- a/board/eve/board.c +++ b/board/eve/board.c @@ -750,6 +750,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = KXCJ9_ADDR0, .rot_standard_ref = &lid_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KXCJ9_ACCEL_MIN_FREQ, + .max_frequency = KXCJ9_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -786,6 +788,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .rot_standard_ref = NULL, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = BMI160_ACCEL_MIN_FREQ, + .max_frequency = BMI160_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -823,6 +827,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .default_range = 1000, /* dps */ .rot_standard_ref = NULL, + .min_frequency = BMI160_GYRO_MIN_FREQ, + .max_frequency = BMI160_GYRO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -860,6 +866,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .default_range = 1 << 11, /* 16LSB / uT, fixed */ .rot_standard_ref = &mag_standard_ref, + .min_frequency = BMM150_MAG_MIN_FREQ, + .max_frequency = BMM150_MAG_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -897,6 +905,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = SI114X_ADDR, .rot_standard_ref = NULL, .default_range = 9000, /* 90%: int = 0 - frac = 9000/10000 */ + .min_frequency = SI114X_LIGHT_MIN_FREQ, + .max_frequency = SI114X_LIGHT_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { diff --git a/board/glados/board.c b/board/glados/board.c index e77be19e93..dd492b17f1 100644 --- a/board/glados/board.c +++ b/board/glados/board.c @@ -497,6 +497,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .rot_standard_ref = NULL, /* Identity matrix. */ .default_range = 2, /* g, enough for laptop. */ + .min_frequency = BMI160_ACCEL_MIN_FREQ, + .max_frequency = BMI160_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -533,6 +535,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .default_range = 1000, /* dps */ .rot_standard_ref = NULL, /* Identity Matrix. */ + .min_frequency = BMI160_GYRO_MIN_FREQ, + .max_frequency = BMI160_GYRO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -569,6 +573,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = KX022_ADDR1, .rot_standard_ref = NULL, /* Identity matrix. */ .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KX022_ACCEL_MIN_FREQ, + .max_frequency = KX022_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { diff --git a/board/kahlee/board.c b/board/kahlee/board.c index 843f035f5f..9eb3e0de9f 100644 --- a/board/kahlee/board.c +++ b/board/kahlee/board.c @@ -541,6 +541,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = KXCJ9_ADDR1, .rot_standard_ref = NULL, /* Identity matrix. */ .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KXCJ9_ACCEL_MIN_FREQ, + .max_frequency = KXCJ9_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { diff --git a/board/kevin/board.c b/board/kevin/board.c index 8c183ed2bb..c733d565a6 100644 --- a/board/kevin/board.c +++ b/board/kevin/board.c @@ -536,6 +536,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT), .rot_standard_ref = &base_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = BMI160_ACCEL_MIN_FREQ, + .max_frequency = BMI160_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -576,6 +578,8 @@ struct motion_sensor_t motion_sensors[] = { #else .rot_standard_ref = NULL, /* Identity matrix. */ #endif + .min_frequency = BMI160_GYRO_MIN_FREQ, + .max_frequency = BMI160_GYRO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -613,6 +617,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMA2x2_I2C_ADDR1, .rot_standard_ref = &lid_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = BMA255_ACCEL_MIN_FREQ, + .max_frequency = BMA255_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -649,6 +655,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = KX022_ADDR0, .rot_standard_ref = &lid_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KX022_ACCEL_MIN_FREQ, + .max_frequency = KX022_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -682,6 +690,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_BARO, .addr = BMP280_I2C_ADDRESS1, .default_range = 1 << 18, /* 1bit = 4 Pa, 16bit ~= 2600 hPa */ + .min_frequency = BMP280_BARO_MIN_FREQ, + .max_frequency = BMP280_BARO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { diff --git a/board/oak/board.c b/board/oak/board.c index f22e016622..1c4ee791f7 100644 --- a/board/oak/board.c +++ b/board/oak/board.c @@ -663,6 +663,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = 1, .rot_standard_ref = &base_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = BMI160_ACCEL_MIN_FREQ, + .max_frequency = BMI160_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -699,6 +701,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = 1, .default_range = 1000, /* dps */ .rot_standard_ref = NULL, /* Identity Matrix. */ + .min_frequency = BMI160_GYRO_MIN_FREQ, + .max_frequency = BMI160_GYRO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -736,6 +740,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = KX022_ADDR1, .rot_standard_ref = NULL, /* Identity matrix. */ .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KX022_ACCEL_MIN_FREQ, + .max_frequency = KX022_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { diff --git a/board/poppy/board.c b/board/poppy/board.c index 762b2a2d2f..c2cb27390d 100644 --- a/board/poppy/board.c +++ b/board/poppy/board.c @@ -696,6 +696,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .rot_standard_ref = &lid_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = BMI160_ACCEL_MIN_FREQ, + .max_frequency = BMI160_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -733,6 +735,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .default_range = 1000, /* dps */ .rot_standard_ref = &lid_standard_ref, + .min_frequency = BMI160_GYRO_MIN_FREQ, + .max_frequency = BMI160_GYRO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -770,6 +774,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .default_range = 1 << 11, /* 16LSB / uT, fixed */ .rot_standard_ref = &mag_standard_ref, + .min_frequency = BMM150_MAG_MIN_FREQ, + .max_frequency = BMM150_MAG_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -805,6 +811,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_BARO, .addr = BMP280_I2C_ADDRESS1, .default_range = 1 << 18, /* 1bit = 4 Pa, 16bit ~= 2600 hPa */ + .min_frequency = BMP280_BARO_MIN_FREQ, + .max_frequency = BMP280_BARO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { diff --git a/board/reef/board.c b/board/reef/board.c index 1b8a27ad50..afe50feb63 100644 --- a/board/reef/board.c +++ b/board/reef/board.c @@ -845,6 +845,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = KX022_ADDR1, .rot_standard_ref = NULL, /* Identity matrix. */ .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KX022_ACCEL_MIN_FREQ, + .max_frequency = KX022_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -881,6 +883,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .rot_standard_ref = &base_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = BMI160_ACCEL_MIN_FREQ, + .max_frequency = BMI160_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -918,6 +922,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .default_range = 1000, /* dps */ .rot_standard_ref = &base_standard_ref, + .min_frequency = BMI160_GYRO_MIN_FREQ, + .max_frequency = BMI160_GYRO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -955,6 +961,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .default_range = 1 << 11, /* 16LSB / uT, fixed */ .rot_standard_ref = &mag_standard_ref, + .min_frequency = BMM150_MAG_MIN_FREQ, + .max_frequency = BMM150_MAG_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -990,6 +998,8 @@ struct motion_sensor_t motion_sensors[] = { .port = I2C_PORT_BARO, .addr = BMP280_I2C_ADDRESS1, .default_range = 1 << 18, /* 1bit = 4 Pa, 16bit ~= 2600 hPa */ + .min_frequency = BMP280_BARO_MIN_FREQ, + .max_frequency = BMP280_BARO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -1025,6 +1035,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = OPT3001_I2C_ADDR1, .rot_standard_ref = NULL, .default_range = OPT3001_RANGE_AUTOMATIC_FULL_SCALE, + .min_frequency = OPT3001_LIGHT_MIN_FREQ, + .max_frequency = OPT3001_LIGHT_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { diff --git a/board/rowan/board.c b/board/rowan/board.c index 4a63261b10..4cd8b01345 100644 --- a/board/rowan/board.c +++ b/board/rowan/board.c @@ -527,6 +527,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT), .rot_standard_ref = &lid_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = BMI160_ACCEL_MIN_FREQ, + .max_frequency = BMI160_ACCEL_MAX_FREQ, .config = { /* AP: by default use EC settings */ [SENSOR_CONFIG_AP] = { @@ -563,6 +565,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_SET_SPI_ADDRESS(CONFIG_SPI_ACCEL_PORT), .default_range = 1000, /* dps */ .rot_standard_ref = &lid_standard_ref, + .min_frequency = BMI160_GYRO_MIN_FREQ, + .max_frequency = BMI160_GYRO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { diff --git a/board/ryu/board.c b/board/ryu/board.c index 0950bc8ae0..b4455032a6 100644 --- a/board/ryu/board.c +++ b/board/ryu/board.c @@ -304,6 +304,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .rot_standard_ref = &accelgyro_standard_ref, .default_range = 8, /* g, use hifi requirements */ + .min_frequency = BMI160_ACCEL_MIN_FREQ, + .max_frequency = BMI160_ACCEL_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -339,6 +341,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .default_range = 1000, /* dps, use hifi requirement */ .rot_standard_ref = &accelgyro_standard_ref, + .min_frequency = BMI160_GYRO_MIN_FREQ, + .max_frequency = BMI160_GYRO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -374,6 +378,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .rot_standard_ref = &mag_standard_ref, .default_range = 1 << 11, /* 16LSB / uT, fixed */ + .min_frequency = BMM150_MAG_MIN_FREQ, + .max_frequency = BMM150_MAG_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -408,6 +414,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = SI114X_ADDR, .rot_standard_ref = NULL, .default_range = 9000, /* 90%: int = 0 - frac = 9000/10000 */ + .min_frequency = SI114X_LIGHT_MIN_FREQ, + .max_frequency = SI114X_LIGHT_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -443,6 +451,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = SI114X_ADDR, .rot_standard_ref = NULL, .default_range = 7630, /* Upon testing at desk */ + .min_frequency = SI114X_PROX_MIN_FREQ, + .max_frequency = SI114X_PROX_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { diff --git a/board/samus/board.c b/board/samus/board.c index d6523c57bb..62aebc32f2 100644 --- a/board/samus/board.c +++ b/board/samus/board.c @@ -316,6 +316,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = LSM6DS0_ADDR1, .rot_standard_ref = &base_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = LSM6DS0_ACCEL_MIN_FREQ, + .max_frequency = LSM6DS0_ACCEL_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -351,6 +353,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = KXCJ9_ADDR0, .rot_standard_ref = &lid_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KXCJ9_ACCEL_MIN_FREQ, + .max_frequency = KXCJ9_ACCEL_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -386,6 +390,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = LSM6DS0_ADDR1, .rot_standard_ref = NULL, .default_range = 2000, /* g, enough for laptop. */ + .min_frequency = LSM6DS0_GYRO_MIN_FREQ, + .max_frequency = LSM6DS0_GYRO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { diff --git a/board/strago/board.c b/board/strago/board.c index 67e44be830..7f45ba6661 100644 --- a/board/strago/board.c +++ b/board/strago/board.c @@ -216,6 +216,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = KXCJ9_ADDR1, .rot_standard_ref = &base_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KXCJ9_ACCEL_MIN_FREQ, + .max_frequency = KXCJ9_ACCEL_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { @@ -251,6 +253,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = KXCJ9_ADDR0, .rot_standard_ref = &lid_standard_ref, .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KXCJ9_ACCEL_MIN_FREQ, + .max_frequency = KXCJ9_ACCEL_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { diff --git a/board/wheatley/board.c b/board/wheatley/board.c index bd451c0428..5c985ea260 100644 --- a/board/wheatley/board.c +++ b/board/wheatley/board.c @@ -473,6 +473,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = KX022_ADDR1, .rot_standard_ref = NULL, /* Identity matrix. */ .default_range = 2, /* g, enough for laptop. */ + .min_frequency = KX022_ACCEL_MIN_FREQ, + .max_frequency = KX022_ACCEL_MAX_FREQ, .config = { /* AP: suspended until AP asks for data. */ [SENSOR_CONFIG_AP] = { @@ -509,6 +511,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .rot_standard_ref = NULL, /* Identity matrix. */ .default_range = 2, /* g, enough for laptop. */ + .min_frequency = BMI160_ACCEL_MIN_FREQ, + .max_frequency = BMI160_ACCEL_MAX_FREQ, .config = { /* AP: suspended until AP asks for data. */ [SENSOR_CONFIG_AP] = { @@ -546,6 +550,8 @@ struct motion_sensor_t motion_sensors[] = { .addr = BMI160_ADDR0, .default_range = 1000, /* dps */ .rot_standard_ref = NULL, /* Identity Matrix. */ + .min_frequency = BMI160_GYRO_MIN_FREQ, + .max_frequency = BMI160_GYRO_MAX_FREQ, .config = { /* AP: by default shutdown all sensors */ [SENSOR_CONFIG_AP] = { -- cgit v1.2.1