diff options
author | Gwendal Grignou <gwendal@chromium.org> | 2017-10-27 15:07:19 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-10-30 14:03:10 -0700 |
commit | 8a2d0a5de6fc03eeea79a65469b361ae0ca694c9 (patch) | |
tree | 3e1c1825a8e3c054097fa8f4ce5b8b036ef25846 /driver/mag_bmm150.h | |
parent | a0f43d59d0b58390b22b7e9b58e2b7a799db4070 (diff) | |
download | chrome-ec-8a2d0a5de6fc03eeea79a65469b361ae0ca694c9.tar.gz |
driver: BMM150: Set max frequency based on repetitions setting
The compass uses oversampling to produce accurate values.
MAX_ODR is functions of the repetitions setting.
80Hz is too high, calculate the frequency based on preset setting.
Currently, we use 'SPECIAL' that was calculated for Ryu.
BUG=b:68394559
BRANCH=eve,reef,poppy
TEST=Check with ectool motionsense info 3 the frequency is around 30Hz.
Before:
Min Frequency: 781 mHz
Max Frequency: 80000 mHz
After:
Min Frequency: 781 mHz
Max Frequency: 29579 mHz
Check with AIDA64 the compass is not stuck and return changing values.
Fixup of CL/570482
Change-Id: Idcfed1418f59e755e5647d018351c6a7397ffe1b
Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/742146
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'driver/mag_bmm150.h')
-rw-r--r-- | driver/mag_bmm150.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/driver/mag_bmm150.h b/driver/mag_bmm150.h index 51b2926e8a..d3c07db11b 100644 --- a/driver/mag_bmm150.h +++ b/driver/mag_bmm150.h @@ -76,7 +76,16 @@ /* Min and Max sampling frequency in mHz */ #define BMM150_MAG_MIN_FREQ 781 -#define BMM150_MAG_MAX_FREQ 80000 + +/* + * From Section 4.2.4, max frequency depends on the preset. + * + * Fmax ~= 1 / (145us * nXY + 500us * nZ + 980us) + * + * To be safe, declare only 75% of the value. + */ +#define BMM150_MAG_MAX_FREQ(_preset) (750000000 / \ + (145 * BMM150_REP(_preset, XY) + 500 * BMM150_REP(_preset, Z) + 980)) struct bmm150_comp_registers { /* Local copy of the compensation registers. */ |