Skip to contentSkip to conversation

iio: imu: adis16550: fix swapped gyro/accel filter functions

PATCH Applied Antoniu Miclaus 4 participants 4 messages Feb 27 – Mar 7

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iio: imu: adis16550: fix swapped gyro/accel filter functions

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")
---
 drivers/iio/imu/adis16550.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/imu/adis16550.c +4 -4
index 28f0dbd0226c..1f2af506f4bd 100644
@@ -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;
 		}
Signature · 1 line
2.43.0
#1 lore raw
Quoted 3 lines · Antoniu Miclaus

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.

Hmm...
Would it be just a naming issue? How do we know that the code is now correct?

Signature · 2 lines
With Best Regards,
Andy Shevchenko
maintainer Applied
#2 lore raw
Quoted 8 lines · On Fri, 27 Feb 2026 18:33:36 +0200 Andy Shevchenko…
Quoted 3 lines · Antoniu Miclaus

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.

Hmm...
Would it be just a naming issue? How do we know that the code is now correct?

I had a dig and it goes all the way down so looks correct to me and not a naming issue. With the tag from Robert, I'm going to take the view we are sure enough this is correct and apply it.

Applied to the fixes-togreg branch of iio.git and marked for stable.

Thanks,

Jonathan

Acked-by on v1 1/1
#3 lore raw
In reply to Antoniu Miclaus
Quoted 15 lines

-----Original Message-----
From: Antoniu Miclaus <[email protected]>
Sent: Friday, February 27, 2026 2:21 PM
To: Lars-Peter Clausen <[email protected]>; Hennerich, Michael <[email protected]>; Jonathan Cameron <[email protected]>; David Lechner <[email protected]>; Sa, Nuno <[email protected]>; Andy Shevchenko <[email protected]>; Budai, Robert <[email protected]>; Miclaus, Antoniu <[email protected]>; Gradinariu, Ramona <[email protected]>; [email protected]; linux- [email protected]
Subject: [PATCH] iio: imu: adis16550: fix swapped gyro/accel filter functions

Quoted 7 lines

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")

---

Quoted 38 lines
 drivers/iio/imu/adis16550.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/imu/adis16550.c +2 -2
index 28f0dbd0226c..1f2af506f4bd 100644
@@ -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;
drivers/iio/imu/adis16550.c +2 -2
 			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;

}
--
2.43.0