sensor: icm45686: Implement AN-000364 fix for fifo corruption

When operating in streaming mode, a FIFO empty event, which
is caused by host reading the last byte of the last FIFO frame,
can cause FIFO data corruption.

During subsequent reads to the FIFO, the first  frame that arrives
after the empty condition will be corrupted. Once the issue occurs,
the internal state cannot recover and the FIFO must be flushed in
bypass mode to clear the corrupted state.

The current workaround from TDK is to read M-1 frames when M frames
are reported by fifo_count. Since M is fixed by the fifo_watermark
DT parameter, and in cases where fifo_watermark == 1, the watermark
trigger threshold is set to M + 1 frames and M frames are read out
during a watermark threshold event.

Signed-off-by: Anthony Williams <anthony289478@gmail.com>
1 file changed