Skip to content

Commit 8b0b864

Browse files
jmaneyrol-invnjic23
authored andcommitted
iio: imu: inv_icm42600: fix timestamp clock period by using lower value
Clock period value is used for computing periods of sampling. There is no need for it to be higher than the maximum odr, otherwise we are losing precision in the computation for nothing. Switch clock period value to maximum odr period (8kHz). Fixes: 0ecc363 ("iio: make invensense timestamp module generic") Cc: stable@vger.kernel.org Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Signed-off-by: Jonathan Cameron <jic23@kernel.org>
1 parent aa411ad commit 8b0b864

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,10 +1170,10 @@ struct iio_dev *inv_icm42600_accel_init(struct inv_icm42600_state *st)
11701170
accel_st->filter = INV_ICM42600_FILTER_AVG_16X;
11711171

11721172
/*
1173-
* clock period is 32kHz (31250ns)
1173+
* clock period is 8kHz (125000ns)
11741174
* jitter is +/- 2% (20 per mille)
11751175
*/
1176-
ts_chip.clock_period = 31250;
1176+
ts_chip.clock_period = 125000;
11771177
ts_chip.jitter = 20;
11781178
ts_chip.init_period = inv_icm42600_odr_to_period(st->conf.accel.odr);
11791179
inv_sensors_timestamp_init(&accel_st->ts, &ts_chip);

drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,10 +755,10 @@ struct iio_dev *inv_icm42600_gyro_init(struct inv_icm42600_state *st)
755755
}
756756

757757
/*
758-
* clock period is 32kHz (31250ns)
758+
* clock period is 8kHz (125000ns)
759759
* jitter is +/- 2% (20 per mille)
760760
*/
761-
ts_chip.clock_period = 31250;
761+
ts_chip.clock_period = 125000;
762762
ts_chip.jitter = 20;
763763
ts_chip.init_period = inv_icm42600_odr_to_period(st->conf.accel.odr);
764764
inv_sensors_timestamp_init(&gyro_st->ts, &ts_chip);

0 commit comments

Comments
 (0)