From: Joe LeVeque <joe.l@reflexrobotics.com>
To: jean-baptiste.maneyrol@tdk.com, jic23@kernel.org
Cc: dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
Joe LeVeque <joe.l@reflexrobotics.com>
Subject: [PATCH 1/2] iio: imu: inv_icm42600: return -EBUSY for temperature reads when idle
Date: Thu, 19 Nov 2026 18:08:49 -0800 [thread overview]
Message-ID: <20261120020850.24318-2-joe.l@reflexrobotics.com> (raw)
In-Reply-To: <20261120020850.24318-1-joe.l@reflexrobotics.com>
The temperature sensor only measures while the accel or gyro is on.
With both off, its data register keeps the last measurement, so a
temperature read returns stale data. On an ICM-42688-P, a value held at
about 52 C was returned while the chip was at about 62 C. The data only
reads as invalid before the first measurement after power-up.
The temperature is the die temperature, used for accel and gyro
compensation, so return -EBUSY when both are off instead of stale data.
Suggested-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Signed-off-by: Joe LeVeque <joe.l@reflexrobotics.com>
---
drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c
index 7f80bda471c3..b35706bb1c8f 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_temp.c
@@ -23,6 +23,16 @@ static int inv_icm42600_temp_read(struct inv_icm42600_state *st, s16 *temp)
pm_runtime_get_sync(dev);
mutex_lock(&st->lock);
+ /*
+ * The temperature sensor only measures while the accel or gyro is
+ * on; with both off, its data register holds a stale value.
+ */
+ if (st->conf.gyro.mode == INV_ICM42600_SENSOR_MODE_OFF &&
+ st->conf.accel.mode == INV_ICM42600_SENSOR_MODE_OFF) {
+ ret = -EBUSY;
+ goto exit;
+ }
+
ret = inv_icm42600_set_temp_conf(st, true, NULL);
if (ret)
goto exit;
--
2.34.1
next prev parent reply other threads:[~2026-11-20 2:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-20 2:08 [PATCH 0/2] iio: imu: inv_icm42600: keep the temperature sensor always on Joe LeVeque
2026-11-20 2:08 ` Joe LeVeque [this message]
2026-11-20 2:08 ` [PATCH 2/2] iio: imu: inv_icm42600: remove temperature sensor enable/disable Joe LeVeque
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261120020850.24318-2-joe.l@reflexrobotics.com \
--to=joe.l@reflexrobotics.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®