summaryrefslogtreecommitdiff
path: root/driver/accel_bma2x2.h
Commit message (Collapse)AuthorAgeFilesLines
* zephyr: Add BMA255 emulatorTomasz Michalec2021-06-301-140/+0
| | | | | | | | | | | | | | | | | Add BMA255 emulator which is emulated device on i2c bus. Emulated accelerometer properties are defined through device tree, but they can be changed in runtime through BMA255 emulator API. It allows to set custom handlers for write and read messages to emulate more complex scenarios or malfunctioning device. BUG=b:184855546 BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I4def7fcc54edbf9cb346fda0f21f647a5ad5f8d5 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2933301 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* driver: Fix indents in accel_bma2x2.hTomasz Michalec2021-06-161-85/+85
| | | | | | | | | | | | | | Replace spaces with tabs and align all indents in defines. BUG=none BRANCH=none TEST=none Signed-off-by: Tomasz Michalec <tm@semihalf.com> Change-Id: I4bc656f757f6d3fe62822676c6b8698e0038a3f2 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2959793 Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* Zephyr: Create public headers for bmi260, bma2x2, and tcs3400Hyungwoo Yang2021-01-201-35/+1
| | | | | | | | | | | | | | | Separate out the public part of sensor headers so it can be included from Zephyr. BUG=b:175434113 BRANCH=none TEST=make buildall -j8 build volteer on zephyr Signed-off-by: Hyungwoo Yang <hyungwoo.yang@intel.corp-partner.google.com> Change-Id: I899e9aea99d6c7d56a1b6735538b280fe0735313 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2637251 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* driver: bma2x2: Limit max frequency to 125HzGwendal Grignou2020-10-071-2/+8
| | | | | | | | | | | | | | | | Given BMA2x2 are polled (to save interrupt pin), limit ODR to 125Hz. Even if we read too early (we can be 3ms early), it prevents tast hardware.SensorRing from failing. Lid accelerometer is usually read at 10/12.5Hz. BUG=b:170155773 BRANCH=octupus,kukui,hatch TEST=hardware.SensorRing passes on volteer Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: Ic7e68402afbf1ceacb627ee732dbd609b7cb5d5f Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2451421 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: bma2x2: Fix frequency precision errorGwendal Grignou2020-03-101-8/+10
| | | | | | | | | | | | | | | | | | | | | On nautilus, the max frequency is set to 62.5Hz (the EC max frequency is set to 100Hz). However, when setting frequency to 62500 (mHz), the EC would bump up the frequency to 125Hz. The problem was in the calculation of the true frequency. By using 7.81Hz instead of 7.8125Hz as the multiplier, the driver would calculate the true frequency as 62480mHz, so it would set the accelerometer frequency to the next data rate. BUG=chromium:1059456 BRANCH=poppy TEST=On nocturne, check frequency is set right and tast run <IP> hardware.SensorRing passes. Change-Id: I743201bc8cccc7d38f39d1e370d660f4f37b4d95 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2092911 Reviewed-by: Heng-ruey Hsu <henryhsu@chromium.org>
* Waddledoo: Add sensor supportDiana Z2020-01-141-0/+1
| | | | | | | | | | | | | | Waddledoo is using the BMI160 as a base accel and the BMA253 lid accel, which is compatible with the current bma2x2 driver. BUG=b:147258603 BRANCH=none TEST=builds Change-Id: Id76e826f11154f8b687021713a2bf176bd82fef4 Signed-off-by: Diana Z <dzigterman@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1993952 Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
* Remove __7b, __8b and __7bfDenis Brockus2019-07-201-4/+4
| | | | | | | | | | | | | | | | | | | The extentions were added to make the compiler perform most of the verification that the conversion was being done correctly to remove 8bit addressing as the standard I2C/SPI address type. Now that the compiler has verified the code, the extra extentions are being removed BUG=chromium:971296 BRANCH=none TEST=make buildall -j TEST=verify sensor functionality on arcada_ish Change-Id: I36894f8bb9daefb5b31b5e91577708f6f9af2a4f Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1704792 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* Use 7bit I2C/SPI slave addresses in ECDenis Brockus2019-07-191-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Opt for 7bit slave addresses in EC code. If 8bit is expected by a driver, make it local and show this in the naming. Use __7b, __7bf and __8b as name extensions for i2c/spi addresses used in the EC codebase. __7b indicates a 7bit address by itself. __7bf indicates a 7bit address with optional flags attached. __8b indicates a 8bit address by itself. Allow space for 10bit addresses, even though this is not currently being used by any of our attached devices. These extensions are for verification purposes only and will be removed in the last pass of this ticket. I want to make sure the variable names reflect the type to help eliminate future 7/8/7-flags confusion. BUG=chromium:971296 BRANCH=none TEST=make buildall -j Change-Id: I2fc3d1b52ce76184492b2aaff3060f486ca45f45 Signed-off-by: Denis Brockus <dbrockus@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1699893 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* FIXUP: sensor: Adjust max_frequency based on EC performanceGwendal Grignou2019-05-241-1/+1
| | | | | | | | | | | | | | | | | When chaning the macro fro BMA255, the step was set to 125Hz, so it assumes the EC can support MEMS ODR set to 125Hz. This is not the case on poppy and nautilus in the poppy branch. BRANCH=poppy BUG=b:118205424,b:118851581,chromium:615059,b:131705379 TEST=Compile Change-Id: Ib60abb3919dc1ce049211d848fc4e4de2e5e51c0 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1621188 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org> Reviewed-by: Enrico Granata <egranata@chromium.org>
* sensor: Adjust max_frequency based on EC performanceGwendal Grignou2018-12-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | Put in max_frequency a value that the sensor AND the EC support. BRANCH=none BUG=b:118205424,b:118851581,chromium:615059 TEST=Compile. Check all max sensors frequencies have been altered with: for i in $(grep -rh max_frequency board | cut -d '=' -f 2 | sort | \ uniq | grep FREQ | sed 's/FREQ.*//') ; do echo -n $i ; git show | grep -q $i || break; echo check done Check on nocturne accel max frequency is still correct. Change-Id: I848396d9f150a2e94d430a8feeafc1087a6bf2c3 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1352063 Commit-Ready: Elthan Huang <elthan_huang@compal.corp-partner.google.com> Reviewed-by: Jesse Schettler <jschettler@chromium.org> Reviewed-by: Jett Rink <jettrink@chromium.org> Reviewed-by: Justin TerAvest <teravest@chromium.org>
* driver: bma2x2: Add perform_calibGwendal Grignou2018-03-161-13/+0
| | | | | | | | | | | | | | | | | | Add fast compensation automatic calibration, like bmi160. Use timestamp_expired for timeout measurement for both perform_calib functions. Remove driver offset field, remove private bma2x2 structure. BUG=b:73205042 BRANCH=master TEST=echo 1 > calibrate perform calibration. Reading in_accel_*_calibbias is within range. Check on Lami for both bma2x2 and bmi160. Change-Id: I3472865287fa4769a05e6f872b92d7c3f933cb4e Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/957872 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: bma2x2: Remove tables for range/frequencyGwendal Grignou2018-03-151-3/+16
| | | | | | | | | | | | | | | | To save space, instead of using tables, use macros to convert range/frequencies into register values. BUG=b:73205042 BRANCH=none TEST=Check we save space on Kevin. (184 bytes looking at __image_size in kevin.RO.map). Check on nami that range/bandwidth are set properly. Change-Id: I193768be1f2e7325b986e8ccff25a7809bfb4096 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/959388 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* driver: bma2x2: indent register definitionGwendal Grignou2018-03-121-93/+96
| | | | | | | | | | | BUG=none BRANCH=none TEST=compile Change-Id: I9507cbe760f886acaa4c6b432cfd8482faeb4618 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/959387 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
* common: sensors: add extra sensor attributesNick Vaccaro2017-05-181-0/+4
| | | | | | | | | | | | | | | | | | | | | | 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: bma2x2/kionix remove unused fieldsGwendal Grignou2016-10-281-4/+0
| | | | | | | | | | | | | Remove fields that are not used anymore. BRANCH=gru BUG=none TEST=make buildall Change-Id: If4128a5db05e14314bba6c1d367774f098854ac5 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/404913 Reviewed-by: Shawn N <shawnn@chromium.org>
* driver: Add support bma255 sensorWonjoon Lee2016-05-311-0/+161
BMA255 is one of BMA2x2 accel sensor series. Adding defines,driver from https://github.com/BoschSensortec/BMA2x2_driver BUG=chrome-os-partner:52877 BRANCH=none TEST="accelread 2" is working on kevin, also check accelrate, accelrange can set proper value on IC Change-Id: I99932ff75aae91a744fe18dddc010b802085a2da Signed-off-by: Wonjoon Lee <woojoo.lee@samsung.com> Reviewed-on: https://chromium-review.googlesource.com/347722 Reviewed-by: Shawn N <shawnn@chromium.org>