* [PATCH] iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on
@ 2024-11-13 20:25 Jean-Baptiste Maneyrol via B4 Relay
2024-11-24 12:47 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Jean-Baptiste Maneyrol via B4 Relay @ 2024-11-13 20:25 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen
Cc: Jean-Baptiste Maneyrol, Jonathan Cameron, linux-iio, linux-kernel,
stable, Jean-Baptiste Maneyrol
From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
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: ec74ae9fd37c ("iio: imu: inv_icm42600: add accurate timestamping")
Cc: stable@vger.kernel.org
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
---
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
index 93b5d7a3339ccff16b21bf6c40ed7b2311317cf4..03139e2e4eddbf37e154de2eb486549bc3bdb284 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
@@ -814,6 +814,8 @@ static int inv_icm42600_suspend(struct device *dev)
static int inv_icm42600_resume(struct device *dev)
{
struct inv_icm42600_state *st = dev_get_drvdata(dev);
+ struct inv_icm42600_sensor_state *gyro_st = iio_priv(st->indio_gyro);
+ struct inv_icm42600_sensor_state *accel_st = iio_priv(st->indio_accel);
int ret;
mutex_lock(&st->lock);
@@ -834,9 +836,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_st->ts);
+ inv_sensors_timestamp_reset(&accel_st->ts);
ret = regmap_write(st->map, INV_ICM42600_REG_FIFO_CONFIG,
INV_ICM42600_FIFO_CONFIG_STREAM);
+ }
out_unlock:
mutex_unlock(&st->lock);
---
base-commit: 9dd2270ca0b38ee16094817f4a53e7ba78e31567
change-id: 20241113-inv_icm42600-fix-timestamps-after-suspend-b7e421eaa40c
Best regards,
--
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on
2024-11-13 20:25 [PATCH] iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on Jean-Baptiste Maneyrol via B4 Relay
@ 2024-11-24 12:47 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2024-11-24 12:47 UTC (permalink / raw)
To: Jean-Baptiste Maneyrol via B4 Relay
Cc: jean-baptiste.maneyrol, Lars-Peter Clausen,
Jean-Baptiste Maneyrol, Jonathan Cameron, linux-iio, linux-kernel,
stable
On Wed, 13 Nov 2024 21:25:45 +0100
Jean-Baptiste Maneyrol via B4 Relay <devnull+jean-baptiste.maneyrol.tdk.com@kernel.org> wrote:
> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
>
> 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: ec74ae9fd37c ("iio: imu: inv_icm42600: add accurate timestamping")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Applied to the fixes-togreg branch of iio.git.
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-24 12:47 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13 20:25 [PATCH] iio: imu: inv_icm42600: fix timestamps after suspend if sensor is on Jean-Baptiste Maneyrol via B4 Relay
2024-11-24 12:47 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox