Skip to content

Commit 1657b99

Browse files
jmaneyrol-invngregkh
authored andcommitted
iio: imu: inv_icm42600: fix odr switch when turning buffer off
commit ffd32db upstream. ODR switch is done in 2 steps when FIFO is on : change the ODR register value and acknowledge change when reading the FIFO ODR change flag. When we are switching odr and turning buffer off just afterward, we are losing the FIFO ODR change flag and ODR switch is blocked. Fix the issue by force applying any waiting ODR change when turning buffer off. Fixes: ec74ae9 ("iio: imu: inv_icm42600: add accurate timestamping") Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com> Cc: stable@vger.kernel.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 9410ae0 commit 1657b99

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,8 @@ static int inv_icm42600_buffer_predisable(struct iio_dev *indio_dev)
371371
static int inv_icm42600_buffer_postdisable(struct iio_dev *indio_dev)
372372
{
373373
struct inv_icm42600_state *st = iio_device_get_drvdata(indio_dev);
374+
struct inv_icm42600_sensor_state *sensor_st = iio_priv(indio_dev);
375+
struct inv_sensors_timestamp *ts = &sensor_st->ts;
374376
struct device *dev = regmap_get_device(st->map);
375377
unsigned int sensor;
376378
unsigned int *watermark;
@@ -392,6 +394,8 @@ static int inv_icm42600_buffer_postdisable(struct iio_dev *indio_dev)
392394

393395
mutex_lock(&st->lock);
394396

397+
inv_sensors_timestamp_apply_odr(ts, 0, 0, 0);
398+
395399
ret = inv_icm42600_buffer_set_fifo_en(st, st->fifo.en & ~sensor);
396400
if (ret)
397401
goto out_unlock;

0 commit comments

Comments
 (0)