Skip to content

Commit d3e2518

Browse files
jmaneyrol-invngregkh
authored andcommitted
iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on
commit 65a60a590142c54a3f3be11ff162db2d5b0e1e06 upstream. Currently suspending while sensors are one will result in timestamping continuing without gap at resume. It can work with monotonic clock but not with other clocks. Fix that by resetting timestamping. Fixes: ec74ae9 ("iio: imu: inv_icm42600: add accurate timestamping") Cc: [email protected] Signed-off-by: Jean-Baptiste Maneyrol <[email protected]> Link: https://patch.msgid.link/20241113-inv_icm42600-fix-timestamps-after-suspend-v1-1-dfc77c394173@tdk.com Signed-off-by: Jonathan Cameron <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent f2e4823 commit d3e2518

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/iio/imu/inv_icm42600/inv_icm42600_core.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,8 @@ static int __maybe_unused inv_icm42600_suspend(struct device *dev)
720720
static int __maybe_unused inv_icm42600_resume(struct device *dev)
721721
{
722722
struct inv_icm42600_state *st = dev_get_drvdata(dev);
723+
struct inv_icm42600_timestamp *gyro_ts = iio_priv(st->indio_gyro);
724+
struct inv_icm42600_timestamp *accel_ts = iio_priv(st->indio_accel);
723725
int ret;
724726

725727
mutex_lock(&st->lock);
@@ -740,9 +742,12 @@ static int __maybe_unused inv_icm42600_resume(struct device *dev)
740742
goto out_unlock;
741743

742744
/* restore FIFO data streaming */
743-
if (st->fifo.on)
745+
if (st->fifo.on) {
746+
inv_icm42600_timestamp_reset(gyro_ts);
747+
inv_icm42600_timestamp_reset(accel_ts);
744748
ret = regmap_write(st->map, INV_ICM42600_REG_FIFO_CONFIG,
745749
INV_ICM42600_FIFO_CONFIG_STREAM);
750+
}
746751

747752
out_unlock:
748753
mutex_unlock(&st->lock);

0 commit comments

Comments
 (0)