summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2016-08-11 16:47:57 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2017-05-01 21:20:18 +0000
commitc69931b1c1b87152ed175d0f8cf0e8f0afc8dd75 (patch)
treeb5d02bfb7370d34dfb7eec1a7e3560454753c035
parent79c3fec20ea34b04c7acd2486d93dc256eb0afa5 (diff)
downloadchrome-ec-c69931b1c1b87152ed175d0f8cf0e8f0afc8dd75.tar.gz
UPSTREAM: cyan: Enable Force mode for accelerometer
Given we do not enble FIFO on these, we must ask the EC to collect samples as soon as they are available. Reduce sampling rate when measuring lid angle, EC will collect when needed. BRANCH=cyan, ultima BUG=b:27849483, b:36973851 TEST=Pass CTS, check lid angle with ectool motionsense lid_angle Reviewed-on: https://chromium-review.googlesource.com/372404 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/409502 (cherry picked from commit 044f44a4fdf3f7bb90ca048a5013ee7ccbaf2cd7) Change-Id: Icb703f8e5a63c27b704d907804838edd287e0226 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/489775
-rw-r--r--board/cyan/board.c14
-rw-r--r--board/cyan/board.h20
2 files changed, 25 insertions, 9 deletions
diff --git a/board/cyan/board.c b/board/cyan/board.c
index 2d3ac8f7a7..cdb2116b50 100644
--- a/board/cyan/board.c
+++ b/board/cyan/board.c
@@ -113,7 +113,8 @@ const matrix_3x3_t lid_standard_ref = {
};
struct motion_sensor_t motion_sensors[] = {
- {.name = "Base",
+ [BASE_ACCEL] = {
+ .name = "Base",
.active_mask = SENSOR_ACTIVE_S0_S3,
.chip = MOTIONSENSE_CHIP_KXCJ9,
.type = MOTIONSENSE_TYPE_ACCEL,
@@ -133,8 +134,8 @@ struct motion_sensor_t motion_sensors[] = {
},
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
- .odr = 100000 | ROUND_UP_FLAG,
- .ec_rate = 10 * MSEC,
+ .odr = 10000 | ROUND_UP_FLAG,
+ .ec_rate = 0,
},
/* Sensor off in S3/S5 */
[SENSOR_CONFIG_EC_S3] = {
@@ -148,7 +149,8 @@ struct motion_sensor_t motion_sensors[] = {
},
}
},
- {.name = "Lid",
+ [LID_ACCEL] = {
+ .name = "Lid",
.active_mask = SENSOR_ACTIVE_S0_S3,
.chip = MOTIONSENSE_CHIP_KXCJ9,
.type = MOTIONSENSE_TYPE_ACCEL,
@@ -168,8 +170,8 @@ struct motion_sensor_t motion_sensors[] = {
},
/* EC use accel for angle detection */
[SENSOR_CONFIG_EC_S0] = {
- .odr = 100000 | ROUND_UP_FLAG,
- .ec_rate = 10 * MSEC,
+ .odr = 10000 | ROUND_UP_FLAG,
+ .ec_rate = 0,
},
/* Sensor off in S3/S5 */
[SENSOR_CONFIG_EC_S3] = {
diff --git a/board/cyan/board.h b/board/cyan/board.h
index aa1b5a53b6..4e9a26bd90 100644
--- a/board/cyan/board.h
+++ b/board/cyan/board.h
@@ -73,13 +73,11 @@
#define CONFIG_ACCEL_KXCJ9
#define CONFIG_CMD_ACCELS
#define CONFIG_CMD_ACCEL_INFO
-#define CONFIG_ACCEL_FIFO 512
/* Depends on how fast the AP boots and typical ODRs */
+#define CONFIG_ACCEL_FIFO 512
#define CONFIG_ACCEL_FIFO_THRES (CONFIG_ACCEL_FIFO / 3)
-#define CONFIG_LID_ANGLE_SENSOR_BASE 0
-#define CONFIG_LID_ANGLE_SENSOR_LID 1
#define CONFIG_LID_ANGLE
#define CONFIG_LID_ANGLE_UPDATE
@@ -107,6 +105,22 @@
#undef CONFIG_I2C_NACK_RETRY_COUNT
#define CONFIG_I2C_NACK_RETRY_COUNT 2
+/* Sensor index definition */
+enum sensor_id {
+ BASE_ACCEL = 0,
+ LID_ACCEL = 1,
+};
+
+/*
+ * We have not enabled the sensor FIFO on the accels, so we force the EC
+ * to collect at every sample.
+ */
+#define CONFIG_ACCEL_FORCE_MODE_MASK \
+ ((1 << BASE_ACCEL) | (1 << LID_ACCEL))
+
+#define CONFIG_LID_ANGLE_SENSOR_BASE BASE_ACCEL
+#define CONFIG_LID_ANGLE_SENSOR_LID LID_ACCEL
+
/* power signal definitions */
enum power_signal {
X86_ALL_SYS_PWRGD = 0,