Skip to content

Commit 9410ae0

Browse files
jmaneyrol-invngregkh
authored andcommitted
iio: imu: inv_icm42600: fix odr switch to the same value
commit c9f3a59 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 to the same odr value, we end up waiting for a FIFO ODR flag that is never happening. Fix the issue by doing nothing and exiting properly when we are switching to the same ODR value. 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 714c951 commit 9410ae0

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,8 @@ static int inv_icm42600_accel_write_odr(struct iio_dev *indio_dev,
651651
return -EINVAL;
652652

653653
conf.odr = inv_icm42600_accel_odr_conv[idx / 2];
654+
if (conf.odr == st->conf.accel.odr)
655+
return 0;
654656

655657
pm_runtime_get_sync(dev);
656658
mutex_lock(&st->lock);

drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,8 @@ static int inv_icm42600_gyro_write_odr(struct iio_dev *indio_dev,
358358
return -EINVAL;
359359

360360
conf.odr = inv_icm42600_gyro_odr_conv[idx / 2];
361+
if (conf.odr == st->conf.gyro.odr)
362+
return 0;
361363

362364
pm_runtime_get_sync(dev);
363365
mutex_lock(&st->lock);

0 commit comments

Comments
 (0)