mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 10:00:51 +00:00
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>
This commit is contained in:
committed by
chrome-bot
parent
a0f43d59d0
commit
8a2d0a5de6
@@ -903,7 +903,7 @@ struct motion_sensor_t motion_sensors[] = {
|
||||
.default_range = 1 << 11, /* 16LSB / uT, fixed */
|
||||
.rot_standard_ref = &mag_standard_ref,
|
||||
.min_frequency = BMM150_MAG_MIN_FREQ,
|
||||
.max_frequency = BMM150_MAG_MAX_FREQ,
|
||||
.max_frequency = BMM150_MAG_MAX_FREQ(SPECIAL),
|
||||
.config = {
|
||||
/* AP: by default shutdown all sensors */
|
||||
[SENSOR_CONFIG_AP] = {
|
||||
|
||||
@@ -976,7 +976,7 @@ struct motion_sensor_t motion_sensors[] = {
|
||||
.default_range = 1 << 11, /* 16LSB / uT, fixed */
|
||||
.rot_standard_ref = &mag_standard_ref,
|
||||
.min_frequency = BMM150_MAG_MIN_FREQ,
|
||||
.max_frequency = BMM150_MAG_MAX_FREQ,
|
||||
.max_frequency = BMM150_MAG_MAX_FREQ(SPECIAL),
|
||||
.config = {
|
||||
/* AP: by default shutdown all sensors */
|
||||
[SENSOR_CONFIG_AP] = {
|
||||
|
||||
@@ -998,7 +998,7 @@ struct motion_sensor_t motion_sensors[] = {
|
||||
.default_range = 1 << 11, /* 16LSB / uT, fixed */
|
||||
.rot_standard_ref = &mag_standard_ref,
|
||||
.min_frequency = BMM150_MAG_MIN_FREQ,
|
||||
.max_frequency = BMM150_MAG_MAX_FREQ,
|
||||
.max_frequency = BMM150_MAG_MAX_FREQ(SPECIAL),
|
||||
.config = {
|
||||
/* AP: by default shutdown all sensors */
|
||||
[SENSOR_CONFIG_AP] = {
|
||||
|
||||
@@ -956,7 +956,7 @@ struct motion_sensor_t motion_sensors[] = {
|
||||
.default_range = 1 << 11, /* 16LSB / uT, fixed */
|
||||
.rot_standard_ref = &mag_standard_ref,
|
||||
.min_frequency = BMM150_MAG_MIN_FREQ,
|
||||
.max_frequency = BMM150_MAG_MAX_FREQ,
|
||||
.max_frequency = BMM150_MAG_MAX_FREQ(SPECIAL),
|
||||
.config = {
|
||||
/* AP: by default shutdown all sensors */
|
||||
[SENSOR_CONFIG_AP] = {
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in New Issue
Block a user