summaryrefslogtreecommitdiff
path: root/include/motion_sense.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-09-03 16:28:29 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-07 15:16:47 -0700
commit84ed699ac98f7aab6556b806092bc6f8b501453f (patch)
tree6f89cf2913995c7cf76709a64f28dad566005a42 /include/motion_sense.h
parentefa83d23c76fcaee32254cd01ef9d44997622e9a (diff)
downloadchrome-ec-84ed699ac98f7aab6556b806092bc6f8b501453f.tar.gz
driver: bmi160: Prevent crash when FIFO is not valid
When all BMI160 sensors are suspended, FIFO is invalid. Put the test to check if all sensors are disable within the processing loop: otherwise, the FIFO can become invalid while we are processing it. Add printf to be sure we are not processing invalid FIFO. Add a macro around ODR to really check the ODR rate, excluding the roundup flag. BRANCH=smaug BUG=chrome-os-partner:44381 TEST=Using a special patch (see 44381#14) add delay to simulate a loaded EC (like at resume). Using a script flip-flop sensors frequency (to simulate suspend/resume). Check that: - we are not crashing anymore (we were before this patch) - the driver is not hitting invalid FIFO content. Change-Id: I7c9e86f5dcfc231ab89472a6ea03af22e2c2ac32 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/297178 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include/motion_sense.h')
-rw-r--r--include/motion_sense.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h
index d01c2b907e..4185573b41 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -47,6 +47,7 @@ enum sensor_config {
#define MAX_MOTION_SENSE_WAIT_TIME (60000 * MSEC)
#define ROUND_UP_FLAG (1 << 31)
+#define BASE_ODR(_odr) ((_odr) & ~ROUND_UP_FLAG)
struct motion_data_t {
/*