diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2015-11-20 10:25:19 -0800 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2017-05-01 21:19:56 +0000 |
commit | 0f2dfc7fdfbb0e83cc955dcf618af03c72208a62 (patch) | |
tree | 283389b12bf4fe296e9df76dc34c77f9252a02ac | |
parent | b4f98e5736b88a0fa3e675c29e6b271ca0d3ecfb (diff) | |
download | chrome-ec-0f2dfc7fdfbb0e83cc955dcf618af03c72208a62.tar.gz |
UPSTREAM: motion: fix ec_rate to be more accurate
In case the actual ODR rate is way higher that the AP asked for,
we don't have to settle to a slower EC rate if
EC rate == AP requested ODR rate.
BRANCH=smau, cyan, ultima
BUG=b:27849483, b:36973851
TEST=Run android.hardware.cts.SingleSensorTests
Reviewed-on: https://chromium-review.googlesource.com/313641
Reviewed-by: Alec Berg <alecaberg@chromium.org>
(cherry picked from commit 68502864c7db47b0dae250600dec5531c5f35619)
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/359402
Reviewed-on: https://chromium-review.googlesource.com/409489
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
(cherry picked from commit 21aab34e529726e3e7cd4c630420e94f59d125f3)
Change-Id: I437f47bd942a16694c7efcdbc00201352f0480a6
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/489762
-rw-r--r-- | common/motion_sense.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/common/motion_sense.c b/common/motion_sense.c index d493a5bd1d..5a6588bedb 100644 --- a/common/motion_sense.c +++ b/common/motion_sense.c @@ -249,7 +249,7 @@ static int motion_sense_set_ec_rate_from_ap( const struct motion_sensor_t *sensor, unsigned int new_rate_us) { - int ap_odr_mhz = BASE_ODR(sensor->config[SENSOR_CONFIG_AP].odr); + int odr_mhz = sensor->drv->get_data_rate(sensor); if (new_rate_us == 0) return 0; @@ -257,7 +257,7 @@ static int motion_sense_set_ec_rate_from_ap( if (CONFIG_ACCEL_FORCE_MODE_MASK & (1 << (sensor - motion_sensors))) goto end_set_ec_rate_from_ap; #endif - if (ap_odr_mhz == 0) + if (odr_mhz == 0) goto end_set_ec_rate_from_ap; /* @@ -271,7 +271,7 @@ static int motion_sense_set_ec_rate_from_ap( * We wll apply that correction only if the ec rate is within 10% of * the data rate. */ - if (SECOND * 1100 / ap_odr_mhz > new_rate_us) + if (SECOND * 1100 / odr_mhz > new_rate_us) new_rate_us = new_rate_us / 100 * 105; end_set_ec_rate_from_ap: |