summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2020-10-05 15:28:51 -0700
committerCommit Bot <commit-bot@chromium.org>2020-10-18 00:16:20 +0000
commit2f27508b0d24fb41c743db336faccc3511952ac4 (patch)
treea5b7ac1b0d86d4be029d94e6afc6de1c6f52ca2f
parentde1f888f157fc1c7d28d260b3e3eb7151ad58818 (diff)
downloadchrome-ec-2f27508b0d24fb41c743db336faccc3511952ac4.tar.gz
driver: bma2x2: Limit max frequency to 125Hz
Given BMA2x2 are polled (to save interrupt pin), limit ODR to 125Hz. Even if we read too early (we can be 3ms early), it prevents tast hardware.SensorRing from failing. Lid accelerometer is usually read at 10/12.5Hz. BUG=b:170155773 BRANCH=octupus,kukui,hatch TEST=hardware.SensorRing passes on volteer Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: Ic7e68402afbf1ceacb627ee732dbd609b7cb5d5f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2451421 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org> (cherry picked from commit befbf85be57f99dccb9b61ec6481726afc27eea5) Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2482174
-rw-r--r--driver/accel_bma2x2.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/driver/accel_bma2x2.h b/driver/accel_bma2x2.h
index 4b86161dd2..ef5eafe0f8 100644
--- a/driver/accel_bma2x2.h
+++ b/driver/accel_bma2x2.h
@@ -158,8 +158,14 @@ extern const struct accelgyro_drv bma2x2_accel_drv;
/* Sensor resolution in number of bits. This sensor has fixed resolution. */
#define BMA2x2_RESOLUTION 12
-/* Min and Max sampling frequency in mHz */
+/*
+ * Min and Max sampling frequency in mHz.
+ * Given BMA255 is polled, we limit max frequency to 125Hz.
+ * If set to 250Hz, given we can read up to 3ms before the due time
+ * (see CONFIG_MOTION_MIN_SENSE_WAIT_TIME), we may read too early when
+ * other sensors are active.
+ */
#define BMA255_ACCEL_MIN_FREQ 7810
#define BMA255_ACCEL_MAX_FREQ \
- MOTION_MAX_SENSOR_FREQUENCY(1000000, 15625)
+ MOTION_MAX_SENSOR_FREQUENCY(125000, 15625)
#endif /* __CROS_EC_ACCEL_BMA2x2_H */