From: David Lechner <dlechner@baylibre.com>
To: Sean Nyekjaer <sean@geanix.com>,
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>,
Jonathan Cameron <jic23@kernel.org>
Cc: linux-iio@vger.kernel.org, Andy Shevchenko <andy@kernel.org>
Subject: Re: [BUG] iio: imu: inv_icm42600: read temperature, Invalid Argument
Date: Mon, 7 Jul 2025 10:15:30 -0500 [thread overview]
Message-ID: <214c7998-d9b6-4d18-adbc-e1a38a685572@baylibre.com> (raw)
In-Reply-To: <unmlpvhl47vjdx7qqdaabhevhj3loydft4ytwxwsgefcyhbzup@zkqulwwfg37o>
On 7/7/25 9:42 AM, Sean Nyekjaer wrote:
> Hi,
>
> I'm having some weird issues with reading the temperature of the icm42605.
> Kernel version: 6.16.0-rc5
>
> # cat /sys/bus/iio/devices/iio:device2/name
> icm42605-accel
>
> When reading the temperature I get:
> # cat /sys/bus/iio/devices/iio:device2/in_temp_raw
> cat: read error: Invalid argument
>
> But if I read from the accelerometer first, I will go better:
> # cat /sys/bus/iio/devices/iio:device2/in_accel_x_raw
> -378
> # cat /sys/bus/iio/devices/iio:device2/in_temp_raw
> 600
>
> Then after "some" time, I re-read the temperature I recieve
> "Invalid argument" again.
>
> I have traced the -EINVAL to inv_icm42600_temp_read() because I receive
> INV_ICM42600_DATA_INVALID.
>
...
>
> Will the iio core retry a read? If the -EINVAL is returned,
> inv_icm42600_accel_read_raw() is call once more.
No, the core code won't retry, it just passes the error to
userspace. But it does sound like this driver should do a retry
since the datasheet says:
Invalid Data Generation: FIFO/Sense Registers may contain
invalid data under the following conditions:
...
c) When accel and gyro are enabled with different ODRs.
In this case, the sensor with lower ODR will generate
invalid samples when it has no new data
So it could make sense to fsleep() for one ODR period before
attempting to read to ensure data is available - assuming that
is what is actually happening.
>
> One more thing...
> When I'm removing the module, the kernel prints this:
> inv-icm42600-i2c 1-0068: Runtime PM usage count underflow!
It looks like there is an extra pm_runtime_put() near the
end of inv_icm42600_core_probe().
>
> I will continue investigate this
> Br,
> Sean
next prev parent reply other threads:[~2025-07-07 15:15 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 14:42 [BUG] iio: imu: inv_icm42600: read temperature, Invalid Argument Sean Nyekjaer
2025-07-07 15:15 ` David Lechner [this message]
2025-07-07 18:13 ` Jean-Baptiste Maneyrol
2025-07-08 10:35 ` Jonathan Cameron
2025-07-08 12:21 ` Jean-Baptiste Maneyrol
2025-07-13 13:46 ` Jonathan Cameron
2025-07-14 5:29 ` Sean Nyekjaer
2025-07-27 16:53 ` Jonathan Cameron
2025-08-08 7:28 ` Jean-Baptiste Maneyrol
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=214c7998-d9b6-4d18-adbc-e1a38a685572@baylibre.com \
--to=dlechner@baylibre.com \
--cc=andy@kernel.org \
--cc=jean-baptiste.maneyrol@tdk.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=sean@geanix.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