]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
iio: imu: adis16550: fix swapped gyro/accel filter functions
authorAntoniu Miclaus <antoniu.miclaus@analog.com>
Fri, 27 Feb 2026 12:20:46 +0000 (14:20 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 7 Mar 2026 14:11:30 +0000 (14:11 +0000)
The low-pass filter handlers for IIO_ANGL_VEL and IIO_ACCEL call each
other's filter functions in both read_raw and write_raw. Swap them so
each channel type uses its correct filter accessor.

Fixes: bac4368fab62 ("iio: imu: adis16550: add adis16550 support")
Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Acked-by: Robert Budai <robert.budai@analog.com>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/imu/adis16550.c

index 28f0dbd0226cbea67bc6c87d892f7812f21e9304..1f2af506f4bdd5d31445af9f5d37b753c801d611 100644 (file)
@@ -643,12 +643,12 @@ static int adis16550_read_raw(struct iio_dev *indio_dev,
        case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
                switch (chan->type) {
                case IIO_ANGL_VEL:
-                       ret = adis16550_get_accl_filter_freq(st, val);
+                       ret = adis16550_get_gyro_filter_freq(st, val);
                        if (ret)
                                return ret;
                        return IIO_VAL_INT;
                case IIO_ACCEL:
-                       ret = adis16550_get_gyro_filter_freq(st, val);
+                       ret = adis16550_get_accl_filter_freq(st, val);
                        if (ret)
                                return ret;
                        return IIO_VAL_INT;
@@ -681,9 +681,9 @@ static int adis16550_write_raw(struct iio_dev *indio_dev,
        case IIO_CHAN_INFO_LOW_PASS_FILTER_3DB_FREQUENCY:
                switch (chan->type) {
                case IIO_ANGL_VEL:
-                       return adis16550_set_accl_filter_freq(st, val);
-               case IIO_ACCEL:
                        return adis16550_set_gyro_filter_freq(st, val);
+               case IIO_ACCEL:
+                       return adis16550_set_accl_filter_freq(st, val);
                default:
                        return -EINVAL;
                }