summaryrefslogtreecommitdiff
path: root/common/motion_sense.c
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2016-12-28 14:48:40 -0800
committerchrome-bot <chrome-bot@chromium.org>2016-12-28 21:49:33 -0800
commit03bfb6f78fd978f33faff060ce4e796d0e0880b3 (patch)
tree9e8a8445761e7ba8651c6799f1f23c1c92492af2 /common/motion_sense.c
parentd5bd0bd0f6798574ff7da1ba575753a9ce39719f (diff)
downloadchrome-ec-03bfb6f78fd978f33faff060ce4e796d0e0880b3.tar.gz
motion: Fix oversampling calculation
CL/385081 was incorrect, MAX should be used instead of MIN when calculating the oversampling factor, to be sure it can't be 0. BUG=b:27849483,chrome-os-partner:59423 BRANCH=reef TEST=Using a special firmware on Reef reporting the ALS in motionsense, check that oversampling is 1 when requested frequency is 5Hz while the maximal frequency supported is 1Hz. Check the ALS sensor reports information to ARC++. Change-Id: I3c2d447bbc3a9ca0a5963aa86d5a24ee87ca6ab6 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/424221 Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/motion_sense.c')
-rw-r--r--common/motion_sense.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c
index 8c6a8516d9..6e6c2da1f4 100644
--- a/common/motion_sense.c
+++ b/common/motion_sense.c
@@ -240,7 +240,7 @@ int motion_sense_set_data_rate(struct motion_sensor_t *sensor)
* In case the AP want to run the sensors faster than it can,
* be sure we don't see the ratio to 0.
*/
- sensor->oversampling_ratio = MIN(1,
+ sensor->oversampling_ratio = MAX(1,
sensor->drv->get_data_rate(sensor) / ap_odr_mhz);
else
sensor->oversampling_ratio = 0;