mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] iio: imu: adis16550: fix swapped gyro/accel filter functions
@ 2026-02-27 12:20 Antoniu Miclaus
  2026-02-27 16:33 ` Andy Shevchenko
  2026-03-03 12:40 ` Budai, Robert
  0 siblings, 2 replies; 4+ messages in thread
From: Antoniu Miclaus @ 2026-02-27 12:20 UTC (permalink / raw)
  To: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá,
	Andy Shevchenko, Robert Budai, Antoniu Miclaus,
	Ramona Gradinariu, linux-iio, linux-kernel

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>
---
 drivers/iio/imu/adis16550.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/imu/adis16550.c b/drivers/iio/imu/adis16550.c
index 28f0dbd0226c..1f2af506f4bd 100644
--- a/drivers/iio/imu/adis16550.c
+++ b/drivers/iio/imu/adis16550.c
@@ -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;
 		}
-- 
2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: imu: adis16550: fix swapped gyro/accel filter functions
  2026-02-27 12:20 [PATCH] iio: imu: adis16550: fix swapped gyro/accel filter functions Antoniu Miclaus
@ 2026-02-27 16:33 ` Andy Shevchenko
  2026-03-07 14:12   ` Jonathan Cameron
  2026-03-03 12:40 ` Budai, Robert
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2026-02-27 16:33 UTC (permalink / raw)
  To: Antoniu Miclaus
  Cc: Lars-Peter Clausen, Michael Hennerich, Jonathan Cameron,
	David Lechner, Nuno Sá,
	Andy Shevchenko, Robert Budai, Ramona Gradinariu, linux-iio,
	linux-kernel

On Fri, Feb 27, 2026 at 02:20:46PM +0200, Antoniu Miclaus wrote:
> 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?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] iio: imu: adis16550: fix swapped gyro/accel filter functions
  2026-02-27 12:20 [PATCH] iio: imu: adis16550: fix swapped gyro/accel filter functions Antoniu Miclaus
  2026-02-27 16:33 ` Andy Shevchenko
@ 2026-03-03 12:40 ` Budai, Robert
  1 sibling, 0 replies; 4+ messages in thread
From: Budai, Robert @ 2026-03-03 12:40 UTC (permalink / raw)
  To: Miclaus, Antoniu, Lars-Peter Clausen, Hennerich, Michael,
	Jonathan Cameron, David Lechner, Sa, Nuno, Andy Shevchenko,
	Miclaus, Antoniu, Gradinariu, Ramona, linux-iio, linux-kernel



> -----Original Message-----
> From: Antoniu Miclaus <antoniu.miclaus@analog.com>
> Sent: Friday, February 27, 2026 2:21 PM
> To: Lars-Peter Clausen <lars@metafoo.de>; Hennerich, Michael
> <Michael.Hennerich@analog.com>; Jonathan Cameron <jic23@kernel.org>;
> David Lechner <dlechner@baylibre.com>; Sa, Nuno <Nuno.Sa@analog.com>;
> Andy Shevchenko <andy@kernel.org>; Budai, Robert
> <Robert.Budai@analog.com>; Miclaus, Antoniu
> <Antoniu.Miclaus@analog.com>; Gradinariu, Ramona
> <Ramona.Gradinariu@analog.com>; linux-iio@vger.kernel.org; linux-
> kernel@vger.kernel.org
> Subject: [PATCH] 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")
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---
Acked-by: Robert Budai <robert.budai@analog.com>
>  drivers/iio/imu/adis16550.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/iio/imu/adis16550.c b/drivers/iio/imu/adis16550.c
> index 28f0dbd0226c..1f2af506f4bd 100644
> --- a/drivers/iio/imu/adis16550.c
> +++ b/drivers/iio/imu/adis16550.c
> @@ -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;
>  		}
> --
> 2.43.0


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] iio: imu: adis16550: fix swapped gyro/accel filter functions
  2026-02-27 16:33 ` Andy Shevchenko
@ 2026-03-07 14:12   ` Jonathan Cameron
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Cameron @ 2026-03-07 14:12 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Antoniu Miclaus, Lars-Peter Clausen, Michael Hennerich,
	David Lechner, Nuno Sá,
	Andy Shevchenko, Robert Budai, Ramona Gradinariu, linux-iio,
	linux-kernel

On Fri, 27 Feb 2026 18:33:36 +0200
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:

> On Fri, Feb 27, 2026 at 02:20:46PM +0200, Antoniu Miclaus wrote:
> > 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-03-07 14:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-02-27 12:20 [PATCH] iio: imu: adis16550: fix swapped gyro/accel filter functions Antoniu Miclaus
2026-02-27 16:33 ` Andy Shevchenko
2026-03-07 14:12   ` Jonathan Cameron
2026-03-03 12:40 ` Budai, Robert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®