summaryrefslogtreecommitdiff
path: root/include/motion_sense.h
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2015-11-09 15:52:50 -0800
committerchrome-bot <chrome-bot@chromium.org>2015-11-13 01:00:39 -0800
commit66a72f0b6e379edc3a2a52fa2e9b0f66c557a447 (patch)
treecea7dc81e2b5b747b40af326ec0f2631976cf8f4 /include/motion_sense.h
parent0922cc81ce22204264a2b96cec4bf2195939e516 (diff)
downloadchrome-ec-66a72f0b6e379edc3a2a52fa2e9b0f66c557a447.tar.gz
motion: minium interval between motion task now a variable
On Ryu EVT2, where sensors share a 100kb i2c bus with other device, when the sensors set to their maximal frequency and sampling interval set to 5ms, the power management task would wait forever for the i2c lock. Increase the minimal amount of time the task can wait from 3ms to 8ms in that case. This is not an issue for Ryu PVT where the sensors are on a separate SPI bus. However, on EVT, when setting the accelerometer/gyro over 125Hz, EC won't be able to deliver the data in non-batched mode. BRANCH=smaug BUG=b:25510300 TEST=Without this change, an evt2 board would crash when plugging/unplugging the charger while the sensors are set with: echo 200000 > iio:device0/frequency # Accel echo 5 > iio:device0/sampling_frequency echo 200000 > iio:device1/frequency # Gyro echo 25000 > iio:device2/frequency # Mag Change-Id: Idb30da9ab8da61284388db73365c37be3a250dec Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/311755 Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'include/motion_sense.h')
-rw-r--r--include/motion_sense.h7
1 files changed, 3 insertions, 4 deletions
diff --git a/include/motion_sense.h b/include/motion_sense.h
index 26ba029c96..7dd9fd747d 100644
--- a/include/motion_sense.h
+++ b/include/motion_sense.h
@@ -42,10 +42,6 @@ enum sensor_config {
/* Next 8 events for sensor interrupt lines */
#define TASK_EVENT_MOTION_INTERRUPT_MASK (0xff << 2)
-/* Minimum time in between running motion sense task loop. */
-#define MIN_MOTION_SENSE_WAIT_TIME (3 * MSEC)
-#define MAX_MOTION_SENSE_WAIT_TIME (60000 * MSEC)
-
#define ROUND_UP_FLAG (1 << 31)
#define BASE_ODR(_odr) ((_odr) & ~ROUND_UP_FLAG)
@@ -135,6 +131,9 @@ struct motion_sensor_t {
extern struct motion_sensor_t motion_sensors[];
extern const unsigned motion_sensor_count;
+/* optionally defined at board level */
+extern unsigned int motion_min_interval;
+
/*
* Priority of the motion sense resume/suspend hooks, to be sure associated
* hooks are scheduled properly.