diff options
| author | Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> | 2026-07-20 12:38:34 +0200 |
|---|---|---|
| committer | Jonathan Cameron <jonathan.cameron@oss.qualcomm.com> | 2026-07-24 01:01:01 +0100 |
| commit | 82bd09ce4fd3b15680735eaeafe2e688901e3b00 (patch) | |
| tree | 86b2ffde945dd5b8212f949294fd68d47a52b920 /include/linux | |
| parent | 8f4b627656fa1767d8337a95849fe7c895b6f68a (diff) | |
iio: inv_sensors: improve period measurement by using a longer delay
Period measurement can be difficult when using high sampling
frequency where the jitter criteria is hard to meet because of the
system jitter.
This new version is using the delta time between 2 distant interrupts
to measure an interval of at least 20ms. 20ms is a good compromise
between the mitigation of system jitter and the delay to update
period. This way we decorrelate the period measurement from the
interrupt timestamps syncing using only the 2 last interrupts.
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Signed-off-by: Jonathan Cameron <jonathan.cameron@oss.qualcomm.com>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/iio/common/inv_sensors_timestamp.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/include/linux/iio/common/inv_sensors_timestamp.h b/include/linux/iio/common/inv_sensors_timestamp.h index e4e720e6f4b7..4f08204ede3b 100644 --- a/include/linux/iio/common/inv_sensors_timestamp.h +++ b/include/linux/iio/common/inv_sensors_timestamp.h @@ -46,6 +46,8 @@ struct inv_sensors_timestamp_acc { * @min_period: minimal acceptable clock period * @max_period: maximal acceptable clock period * @it: interrupts interval timestamps + * @delta: interval timestamps between several interrupts + * @delta_counter: number of data samples in the delta interval * @timestamp: store last timestamp for computing next data timestamp * @mult: current internal period multiplier * @new_mult: new set internal period multiplier (not yet effective) @@ -57,6 +59,8 @@ struct inv_sensors_timestamp { u32 min_period; u32 max_period; struct inv_sensors_timestamp_interval it; + struct inv_sensors_timestamp_interval delta; + u32 delta_counter; s64 timestamp; u32 mult; u32 new_mult; @@ -88,6 +92,8 @@ static inline void inv_sensors_timestamp_reset(struct inv_sensors_timestamp *ts) const struct inv_sensors_timestamp_interval interval_init = {0LL, 0LL}; ts->it = interval_init; + ts->delta = interval_init; + ts->delta_counter = 0; ts->timestamp = 0; } |
