summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Chen <marcochen@google.com>2018-03-24 16:12:34 +0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2018-03-27 18:22:54 +0000
commiteb822beb97468a73f3c5dc459ea1bc2f040ce327 (patch)
treea3a9af46a6f60685be3bf10ed076616496a56ae2
parentf4fb83e3b5aeff31e04884393d70b4f5da5175ad (diff)
downloadchrome-ec-eb822beb97468a73f3c5dc459ea1bc2f040ce327.tar.gz
sensor: bmi160/bma2x2: Fix the timeout value of compensation.
CL:957872 introduced "get_time().val + 400" as the deadline to perform compensation and the comment in bma2x2.c mentioned the deadline should be 400ms. But the unit of val in timestamp_t is microsecond not milisecond so only 400us is defined not 400ms. BRANCH=none BUG=none TEST=test manually on the dut by performing calibrate. Change-Id: I7a834ef6dcb0772569d2c8d6c507803deb5d2fc1 Signed-off-by: Marco Chen <marcochen@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/979512 Commit-Ready: Gwendal Grignou <gwendal@chromium.org> Tested-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/981713 Reviewed-by: Furquan Shaikh <furquan@chromium.org> Commit-Queue: Furquan Shaikh <furquan@chromium.org> Tested-by: Furquan Shaikh <furquan@chromium.org> Trybot-Ready: Furquan Shaikh <furquan@chromium.org>
-rw-r--r--driver/accel_bma2x2.c2
-rw-r--r--driver/accelgyro_bmi160.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/driver/accel_bma2x2.c b/driver/accel_bma2x2.c
index fcb9cf478d..7548b5d3be 100644
--- a/driver/accel_bma2x2.c
+++ b/driver/accel_bma2x2.c
@@ -235,7 +235,7 @@ static int perform_calib(const struct motion_sensor_t *s)
* The sensor needs 16 samples. At 100Hz/10ms, it needs 160ms to
* complete. Set 400ms to have some margin.
*/
- deadline.val = get_time().val + 400;
+ deadline.val = get_time().val + 400 * MSEC;
do {
if (timestamp_expired(deadline, NULL)) {
ret = EC_RES_TIMEOUT;
diff --git a/driver/accelgyro_bmi160.c b/driver/accelgyro_bmi160.c
index 74689b6ae9..952c5de0d1 100644
--- a/driver/accelgyro_bmi160.c
+++ b/driver/accelgyro_bmi160.c
@@ -636,7 +636,7 @@ static int perform_calib(const struct motion_sensor_t *s)
ret = raw_write8(s->port, s->addr, BMI160_FOC_CONF, val);
ret = raw_write8(s->port, s->addr, BMI160_CMD_REG,
BMI160_CMD_START_FOC);
- deadline.val = get_time().val + 400;
+ deadline.val = get_time().val + 400 * MSEC;
do {
if (timestamp_expired(deadline, NULL)) {
ret = EC_RES_TIMEOUT;