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:15:40 +0000
commitb1ffd2dfaaeb54ed07d70366769a23507ff7fd54 (patch)
treef09048d4ef6726a7a6d280df9d7a8288fd4c301f
parent8ce0f7fe36fa834fff88931dee135e1e122ed341 (diff)
downloadchrome-ec-b1ffd2dfaaeb54ed07d70366769a23507ff7fd54.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/+/2482345
-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 f76ff99d75..d14e8fdade 100644
--- a/driver/accel_bma2x2.h
+++ b/driver/accel_bma2x2.h
@@ -160,8 +160,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 */