summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorGwendal Grignou <gwendal@chromium.org>2021-09-09 14:42:16 -0700
committerCommit Bot <commit-bot@chromium.org>2021-09-10 22:05:17 +0000
commitb41956ce171f969721974a73d7b80a947610cbb7 (patch)
tree8a34b11a5ff7eb7d5de40ea349af51f14ad5f814 /include
parent155d8545cab4fad0718485c37fcf8eeb5948f3f2 (diff)
downloadchrome-ec-b41956ce171f969721974a73d7b80a947610cbb7.tar.gz
driver: lsm6dso: Fix FIFO processing
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>
Diffstat (limited to 'include')
0 files changed, 0 insertions, 0 deletions