mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 11:50:43 +09:00
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: ec74ae9fd3 ("iio: imu: inv_icm42600: add accurate timestamping")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Link: https://patch.msgid.link/20241113-inv_icm42600-fix-timestamps-after-suspend-v1-1-dfc77c394173@tdk.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e026530e20
commit
281855205a
@@ -17,6 +17,7 @@
|
||||
#include <linux/regmap.h>
|
||||
|
||||
#include <linux/iio/iio.h>
|
||||
#include <linux/iio/common/inv_sensors_timestamp.h>
|
||||
|
||||
#include "inv_icm42600.h"
|
||||
#include "inv_icm42600_buffer.h"
|
||||
@@ -725,6 +726,8 @@ out_unlock:
|
||||
static int inv_icm42600_resume(struct device *dev)
|
||||
{
|
||||
struct inv_icm42600_state *st = dev_get_drvdata(dev);
|
||||
struct inv_sensors_timestamp *gyro_ts = iio_priv(st->indio_gyro);
|
||||
struct inv_sensors_timestamp *accel_ts = iio_priv(st->indio_accel);
|
||||
int ret;
|
||||
|
||||
mutex_lock(&st->lock);
|
||||
@@ -745,9 +748,12 @@ static int inv_icm42600_resume(struct device *dev)
|
||||
goto out_unlock;
|
||||
|
||||
/* restore FIFO data streaming */
|
||||
if (st->fifo.on)
|
||||
if (st->fifo.on) {
|
||||
inv_sensors_timestamp_reset(gyro_ts);
|
||||
inv_sensors_timestamp_reset(accel_ts);
|
||||
ret = regmap_write(st->map, INV_ICM42600_REG_FIFO_CONFIG,
|
||||
INV_ICM42600_FIFO_CONFIG_STREAM);
|
||||
}
|
||||
|
||||
out_unlock:
|
||||
mutex_unlock(&st->lock);
|
||||
|
||||
Reference in New Issue
Block a user