Skip to content

Commit b2acfd4

Browse files
jmaneyrol-invnmehmetb0
authored andcommitted
iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on
BugLink: https://bugs.launchpad.net/bugs/2106770 commit 65a60a5 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]> Signed-off-by: Manuel Diewald <[email protected]> Signed-off-by: Mehmet Basaran <[email protected]>
1 parent 22a49a1 commit b2acfd4

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

drivers/iio/imu/inv_icm42600/inv_icm42600_core.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#include <linux/regmap.h>
1818

1919
#include <linux/iio/iio.h>
20+
#include <linux/iio/common/inv_sensors_timestamp.h>
2021

2122
#include "inv_icm42600.h"
2223
#include "inv_icm42600_buffer.h"
@@ -725,6 +726,8 @@ static int inv_icm42600_suspend(struct device *dev)
725726
static int inv_icm42600_resume(struct device *dev)
726727
{
727728
struct inv_icm42600_state *st = dev_get_drvdata(dev);
729+
struct inv_sensors_timestamp *gyro_ts = iio_priv(st->indio_gyro);
730+
struct inv_sensors_timestamp *accel_ts = iio_priv(st->indio_accel);
728731
int ret;
729732

730733
mutex_lock(&st->lock);
@@ -745,9 +748,12 @@ static int inv_icm42600_resume(struct device *dev)
745748
goto out_unlock;
746749

747750
/* restore FIFO data streaming */
748-
if (st->fifo.on)
751+
if (st->fifo.on) {
752+
inv_sensors_timestamp_reset(gyro_ts);
753+
inv_sensors_timestamp_reset(accel_ts);
749754
ret = regmap_write(st->map, INV_ICM42600_REG_FIFO_CONFIG,
750755
INV_ICM42600_FIFO_CONFIG_STREAM);
756+
}
751757

752758
out_unlock:
753759
mutex_unlock(&st->lock);

0 commit comments

Comments
 (0)