]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
iio: imu: inv_icm42600: fix odr switch to the same value
authorJean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Fri, 30 Jan 2026 15:38:47 +0000 (16:38 +0100)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 23 Feb 2026 08:24:37 +0000 (08:24 +0000)
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: ec74ae9fd37c ("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>
drivers/iio/imu/inv_icm42600/inv_icm42600_accel.c
drivers/iio/imu/inv_icm42600/inv_icm42600_gyro.c

index 54760d8f92a279334338fd09e3ab74b2d939a46d..0ab6eddf0543feeb51170271d766a732d1e45544 100644 (file)
@@ -651,6 +651,8 @@ static int inv_icm42600_accel_write_odr(struct iio_dev *indio_dev,
                return -EINVAL;
 
        conf.odr = inv_icm42600_accel_odr_conv[idx / 2];
+       if (conf.odr == st->conf.accel.odr)
+               return 0;
 
        pm_runtime_get_sync(dev);
        mutex_lock(&st->lock);
index 7ef0a25ec74f6b005ca6e86058d67d0be67327df..11339ddf1da36c85e56de6c4a95486713cbd182a 100644 (file)
@@ -358,6 +358,8 @@ static int inv_icm42600_gyro_write_odr(struct iio_dev *indio_dev,
                return -EINVAL;
 
        conf.odr = inv_icm42600_gyro_odr_conv[idx / 2];
+       if (conf.odr == st->conf.gyro.odr)
+               return 0;
 
        pm_runtime_get_sync(dev);
        mutex_lock(&st->lock);