iio: imu: inv_icm42600: avoid frequent timestamp jitter
authorJean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Mon, 22 May 2023 09:32:10 +0000 (09:32 +0000)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Tue, 23 May 2023 20:20:40 +0000 (21:20 +0100)
commitf3ae82534ab221f24225dbf03120462e8ae64636
tree43b54f4f511a59dba36a0f5578d51c87dfe8560d
parent6e42f3710d00bd51b02e9a19b583f6f2f9294d53
iio: imu: inv_icm42600: avoid frequent timestamp jitter

We are currently synchronizing every time the data timestamp with
the IT timestamp, leading to system jitter jamming timestamps.
To fix that and keep it simple, let's just synchronize when the
delta is bigger than the acceptable jitter, and keep
synchronization at the jitter value.

The result is much stable timestamps reflecting better the real
physical value. Example @50Hz delta timestamp,
* before: 20.123ms, 19.721ms, 20.023ms, 20.353ms, 19.821ms, ...
* after: 20.173ms, 20.173ms, 20.173ms, 20.40ms, 20.173ms, ...

Refactorize code and delete the unnecessary handling of multiple
FIFO data.

Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://lore.kernel.org/r/20230522093210.817212-1-inv.git-commit@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/inv_icm42600/inv_icm42600_timestamp.c