Skip to contentSkip to conversation

iio: imu: inv_icm42600: fix parsing of all FIFO frames for odr change

PATCH Applied Jean-Baptiste Maneyrol 2 participants 2 messages Oct 19 – Oct 26

Subsystems (3)
lore
Share & tools
lore

Jean-Baptiste Maneyrol

author maintainer
#0 lore raw

PATCH v2 1/1 iio: imu: inv_icm42600: fix parsing of all FIFO frames for odr change

For getting all odr change events, we need to parse all FIFO frames in each iio device. Fix this correctly by sending effectively all frames to all iio devices.

Previously only batches of frames containing a matching sensor event were sent to the corresponding iio device.

Fixes f670d4d34773 ("iio: imu: inv_icm42600: fix odr change not caught in certain cases")

---
Changes in v2:
- Add blank line and direct return at end of functions.
- Link to v1: https://patch.msgid.link/20261016-iio-imu-inv-icm42600-fix-odr-change-event-in-all-frames-v1-1-b2bb168a0551@tdk.com

To: Jean-Baptiste Maneyrol <[email protected]>
To: Jonathan Cameron <[email protected]>
To: David Lechner <[email protected]>
To: Nuno Sá <[email protected]>
To: Andy Shevchenko <[email protected]>
Cc: Jonathan Cameron <[email protected]>
Cc: [email protected]
Cc: [email protected]

---
 drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c | 24 +++++++++-------------
 1 file changed, 10 insertions(+), 14 deletions(-)
drivers/iio/imu/inv_icm42600/inv_icm42600_buffer.c +10 -14
index 2bf9fc29d7d2..5bff2a3a44bc 100644
@@ -532,22 +532,20 @@ int inv_icm42600_buffer_fifo_parse(struct inv_icm42600_state *st)
 		ts = &gyro_st->ts;
 		inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_gyro,
 						st->timestamp.gyro);
-		ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro);
-		if (ret)
-			return ret;
 	}
 
+	ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro);
+	if (ret)
+		return ret;
+
 	/* handle accelerometer timestamp and FIFO data parsing */
 	if (st->fifo.nb.accel > 0) {
 		ts = &accel_st->ts;
 		inv_sensors_timestamp_interrupt(ts, st->fifo.watermark.eff_accel,
 						st->timestamp.accel);
-		ret = inv_icm42600_accel_parse_fifo(st->indio_accel);
-		if (ret)
-			return ret;
 	}
 
-	return 0;
+	return inv_icm42600_accel_parse_fifo(st->indio_accel);
 }
 
 int inv_icm42600_buffer_hwfifo_flush(struct inv_icm42600_state *st,
@@ -572,20 +570,18 @@ int inv_icm42600_buffer_hwfifo_flush(struct inv_icm42600_state *st,
 	if (st->fifo.nb.gyro > 0) {
 		ts = &gyro_st->ts;
 		inv_sensors_timestamp_interrupt(ts, st->fifo.nb.gyro, gyro_ts);
-		ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro);
-		if (ret)
-			return ret;
 	}
 
+	ret = inv_icm42600_gyro_parse_fifo(st->indio_gyro);
+	if (ret)
+		return ret;
+
 	if (st->fifo.nb.accel > 0) {
 		ts = &accel_st->ts;
 		inv_sensors_timestamp_interrupt(ts, st->fifo.nb.accel, accel_ts);
-		ret = inv_icm42600_accel_parse_fifo(st->indio_accel);
-		if (ret)
-			return ret;
 	}
 
-	return 0;
+	return inv_icm42600_accel_parse_fifo(st->indio_accel);
 }
 
 int inv_icm42600_buffer_init(struct inv_icm42600_state *st)

---
base-commit: a22dc7ebb21a6bd4c8b63bc2c1dd46a24945aae7
change-id: 20261016-iio-imu-inv-icm42600-fix-odr-change-event-in-all-frames-74a91cb28a2b

Best regards,

Signature · 1 line
Jean-Baptiste Maneyrol <[email protected]>
maintainer Applied
#1 lore raw
Quoted 6 lines · On Mon, 19 Oct 2026 15:37:33 +0200 Jean-Baptiste Maneyrol via B4 Relay…

From: Jean-Baptiste Maneyrol <[email protected]>

For getting all odr change events, we need to parse all FIFO frames in each iio device. Fix this correctly by sending effectively all frames to all iio devices.

Quoted 6 lines

Previously only batches of frames containing a matching sensor event were sent to the corresponding iio device.

Fixes f670d4d34773 ("iio: imu: inv_icm42600: fix odr change not caught in certain cases")

Applied to the fixes-togreg branch of iio.git.

thanks,
Jonathan