summaryrefslogtreecommitdiff
path: root/driver/accelgyro_lsm6dso.h
Commit message (Collapse)AuthorAgeFilesLines
* Update license boilerplate text in source code filesMike Frysinger2022-09-121-1/+1
| | | | | | | | | | | | | | | Normally we don't do this, but enough changes have accumulated that we're doing a tree-wide one-off update of the name & style. BRANCH=none BUG=chromium:1098010 TEST=`repo upload` works Change-Id: Icd3a1723c20595356af83d190b2c6a9078b3013b Signed-off-by: Mike Frysinger <vapier@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3891203 Reviewed-by: Jeremy Bettis <jbettis@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
* driver: st: Enable on/off body detection to lsm6dsmGwendal Grignou2022-08-311-2/+0
| | | | | | | | | | | | | | Remove simple macro in lsm6dso and move the code to report activities to common code. BUG=b:236799854 BRANCH=dedede TEST=Compile. Check on bugzzy the EC report on/off body detection. Change-Id: I7a1713182b4ee7807a2f681a70e664d0f4eae563 Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3860189 Reviewed-by: Diana Z <dzigterman@chromium.org>
* driver/accelgyro_lsm6dso.h: Format with clang-formatJack Rosenthal2022-06-291-71/+70
| | | | | | | | | | | BUG=b:236386294 BRANCH=none TEST=none Change-Id: Ic5ec7746ab4f0e06915b4cc24e8275d6f19158be Signed-off-by: Jack Rosenthal <jrosenth@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3729922 Reviewed-by: Jeremy Bettis <jbettis@chromium.org>
* lsm6dso: Use CONFIG_<driver>_INT_ENABLEGwendal Grignou2022-05-231-0/+17
| | | | | | | | | | | | | | | | | | | Use CONFIG_<driver>_INT_ENABLE to not include interrupt() and irq_handler() when hardware interrupt are not used. Disable call to motion_sense_fifo() with IS_ENABLED(CONFIG_ACCEL_FIFO). Other use of CONFIG_ACCEL_FIFO are removed: only when a hardware interrupt is configured we enable the sensor FIFO. Otherwise we directly read into the sensor data registers. BUG=b:230401133 BRANCH=asurada,dedede,brya TEST=Build all. Check Zephyr with herobrine. Check on bugzzy. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: Id867b00d7b5d63c5662630610a886d6ba0725189 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3609349 Reviewed-by: Yuval Peress <peress@google.com>
* zephyr: Add initial shim for lsm6dso sensorAndrew McRae2021-12-301-12/+1
| | | | | | | | | | | | | Add the initial shim for the lsm6dso accel/gyro sensor. BUG=b:212497341 TEST=zmake testall BRANCH=none Signed-off-by: Andrew McRae <amcrae@google.com> Change-Id: I01b5787f960971a637da743131ef4b74ba07885c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3360326 Reviewed-by: Yuval Peress <peress@google.com>
* driver: lsm6dso: Fix FIFO processingGwendal Grignou2021-09-101-9/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a loop in irq_handler to match datasheet documentation: """ 1. Read the FIFO_STATUS1 and FIFO_STATUS2 registers to check how many words are stored in the FIFO. This information is contained in the DIFF_FIFO_[9:0] bits. 2. For each word in FIFO, read the FIFO word (tag and output data) and interpret it on the basis of the FIFO tag. 3. Go to step 1. """ We need to read the FIFO length at the end of the IRQ handler to be sure a new item has not been put while the FIFO was being read. Otherwise, we will not get interrupt and will stop processing FIFO when the FIFO status register still shows the FIFO as not empty. However, using linux kernel st_lsm6dsx_read_tagged_fifo() as model, read only one word at a time: When reading 2 7bytes word at time, the FIFO would still claim one entry remains: The 3rd entry would be a copy of the accelerometer data, but with a corrupted z axis.That why we fail the data test, the gravity vector is not measured at 9.81m/s^2. There was a bug in the interrupt handler that would read the FIFO twice, which was presenting the data: both gyro and accel at the same ODR: [7623.475256 Base Accel FIFO status: 8002] [7623.476548 Base Gyro sending vector num: 2 raw: 0x00000007 - 0xFFFFFFF6 - 0xFFFFFFF9] [7623.477526 Base Accel sending vector num: 1 raw: 0xFFFFFFCC - 0xFFFFE275 - 0xFFFFE818] [7623.479271 Base Accel FIFO status: 8001] [7623.480333 Base Accel sending vector num: 1 raw: 0xFFFFFFCC - 0xFFFFE275 - 0x00000C18] [7623.481699 Base Accel FIFO status: 0000] We must only run the irq_hanlder for the main/accelerometer sensor. Restructure irq_hanlder to match other driver, like accelgyro_bm160.c. BUG=b:195700255,b:192219470 BRANCH=dedede TEST=Running tast run <ip> hardware.SensorIioserviceHard Check we get the right amount of samples. Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I5820dec4c7c5ccb1ebeda854398738d1af60290c Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150679 Reviewed-by: Keith Short <keithshort@chromium.org>
* driver: lsm6dso: Minor macro changesGwendal Grignou2021-09-101-2/+2
| | | | | | | | | | | | | | | | | | Rename LSM6DSO_FIFO_ODR_TO_REG into LSM6DSO_FIFO_ODR_MASK as the macro return the mask to use to set the FIFO ODR. Remove CONFIG_EC_MAX_SENSOR_FREQ_MILLIHZ in code, as already used in LSM6DSO_ODR_MAX_VAL. Simplify LSM6DSO_ST_DATA by using . instead of ->. BUG=none BRANCH=deded TEST=buildall Signed-off-by: Gwendal Grignou <gwendal@chromium.org> Change-Id: I4253368415635c858ce181f228591e8bf93eacb9 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3150678 Reviewed-by: Keith Short <keithshort@chromium.org> Reviewed-by: Yuval Peress <peress@google.com>
* Remove __7b, __8b and __7bfDenis Brockus2019-07-201-2/+2
| | | | | | | | | | | | | | | | | | | 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/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* driver: lsm6dso: Add support to LSM6DSO IMUMario Tesi2019-03-061-0/+233
Added support to LSM6DSO IMU sensor. Features included in this driver are: - Basic Sensor Read acc/gyro data - ODR and FS runtime configuration - FIFO water mark interrupt - Shared commons function with ST MEMs devices BUG=none BRANCH=master TEST=Tested on discovery target BOARD with LSM6DSO connected to EC i2c master bus and motion sense task running. Commands used to test LSM6DSO device are: - accelinit - accelrange - accelinfo All basic features tested, including: 1) ODR change: - accelrate 0 [13000:208000] - accelrate 1 [13000:208000] 2) FS Range change: - accelrange 0 [2:16] - accelrange 1 [250:2000] 3) Interrupt on FIFO water mark Signed-off-by: Mario Tesi <mario.tesi@st.com> Change-Id: If2984f7d0d30b0ef475e0525aca2bc365aa4fe21 Signed-off-by: Mario Tesi <mario.tesi@st.com> Reviewed-on: https://chromium-review.googlesource.com/1371364 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Enrico Granata <egranata@chromium.org> Reviewed-by: Enrico Granata <egranata@chromium.org>