summaryrefslogtreecommitdiff
path: root/driver/mag_bmm150.h
Commit message (Collapse)AuthorAgeFilesLines
* driver: BMM150: Set max frequency based on repetitions settingGwendal Grignou2017-10-301-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | 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>
* driver: sensor: tune MAX_FREQGwendal Grignou2017-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | Reduce maximum frequency of BMM150 compass to 80Hz, 800Hz is a typo. Reduce SI1141 maximum frequency to 50Hz: 100Hz is too high when polling mode is used. Fix up of CL:482703 BRANCH=eve, glados BUG=chromium:615059 TEST=On eve, check CTS test android.hardware.cts.SensorBatchingTests#testMagneticField_fastest_flush passes. Observed that dumpsys sensorservice returns compass maxRate at 80Hz instead of 200Hz. Change-Id: If4e688ab59aa53c402d34714b6bb33ccd4a4ab96 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/570482 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* common: sensors: add extra sensor attributesNick Vaccaro2017-05-181-0/+3
| | | | | | | | | | | | | | | | | | | | | | Adds min_frequency and max_frequency to struct motion_sensor_t. New attributes min_frequency and max_frequency are now returned in ectool's MOTIONSENSE_CMD_INFO response. Incremented ectool's MOTIONSENSE_CMD_INFO version to version 3. Add constants for MIN_FREQUENCY and MAX_FREQUENCY to each sensor's header file. BRANCH=none BUG=chromium:615059 TEST=build/boot and verify MOTIONSENSE_CMD_INFO response on kevin, make buildall -j passes. Change-Id: I66db9715c122ef6bb4665ad5d086a9ecc9c7c93a Signed-off-by: Nick Vaccaro <nvaccaro@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/482703 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* driver: bmm150: Use Bosch recommend repetitionGwendal Grignou2015-10-151-0/+2
| | | | | | | | | | | | | | To minimize noise, instead of using recommend preset from the documentation, use specific repetition value. BRANCH=smaug BUG=chrome-os-partner:45436 TEST=Check the noise is somewhat reduced, still not great. Change-Id: I0ed3409dd907fa1e393d1eb77b6f23ff03763e53 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/305588 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* common: Add magnetometer online calibration.Gwendal Grignou2015-10-131-4/+9
| | | | | | | | | | | | | | | | Code for hard iron calibration: Every seconds (or faster if enough samples), find a sphere that fit the compass data. Based on Android code. BRANCH=smaug BUG=chrome-os-partner:39900 TEST=Check hard-iron bias is removed. Works better outside. Change-Id: Iab479d5113b6560b4f01b0fd87373d2eecdb9b54 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/299583 Reviewed-by: Anton Staaf <robotboy@chromium.org>
* driver: bmi160: use rotation matrix to handle offsets.Gwendal Grignou2015-08-241-4/+2
| | | | | | | | | | | | | | | | Store offsets using sensors axis, not the device axis. Therefore apply rot_standard_ref to the offset vector before get and rot_standard_ref^-1 before set. BRANCH=smaug TEST=using mag sensor, check the offset are applied to the right axis and store correctly. BUG=chromium:517675 Change-Id: I95c8ef2a62603890184412674e7bde91ebecd288 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/294596 Reviewed-by: Sheng-liang Song <ssl@chromium.org>
* bmm150: add measurement repetitionGwendal Grignou2015-08-241-1/+13
| | | | | | | | | | | | | | | | To reduce noise the magnetometer measures in burst and average the data. Use "regular" presets: max frequency is limited to 100Hz. Using a more precise presets limit frequency to no more than 50Hz. BRANCH=smaug TEST=Check magnetomter still works. BUG=chrome-os-partner:39900 Change-Id: Ida6af86f6c207cc91e11378c129032f6d9e6b9ea Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/291990 Reviewed-by: Sheng-liang Song <ssl@chromium.org>
* bmm150: Add support for calibrationGwendal Grignou2015-08-221-0/+10
| | | | | | | | | | | | | Allow sending calibration information to the magnetometer. BRANCH=smaug TEST=Check from user space that calibration is taken into account. BUG=chrome-os-partner:39900 Change-Id: Ic0f595bde1afdc0b6a79e3516a42b55d1f50c17c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/291333 Reviewed-by: Sheng-liang Song <ssl@chromium.org>
* driver: bmm150 measurement compensationGwendal Grignou2015-07-221-0/+54
| | | | | | | | | | | | | | | | | | | Using Bosh reference document, compensate X,Y,Z axis based on internal registers and R HALL values. Change compass unites to 1/16 uT per LSB. Reference: https://github.com/suribi/Thunder-Kernel/blob/master/mediatek/custom/common/kernel/magnetometer/bmm150/bmm150.c BRANCH=smaug TEST=Check compass value in user space. BUG=chrome-os-partner:39900 Change-Id: I0c480521771ef6004ac6e5182cc1d27e82c5bc7c Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/285020 Reviewed-by: Alec Berg <alecaberg@chromium.org>
* driver: Add BMM150 behind BMI160 support.Gwendal Grignou2015-05-161-0/+37
Add support for Bosh Sensortec BMM160 compass. We access it through BMI150. BRANCH=none BUG=chrome-os-partner:39900 TEST=Test on a nucleo board and smaug. Change-Id: I5b959cab4f9341ba0fcd3ed9bad815fa92f80a37 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/271525 Reviewed-by: Sheng-liang Song <ssl@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Trybot-Ready: Vincent Palatin <vpalatin@chromium.org>