[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250708-icm42temp-v1-1-81af60aab82a@geanix.com>
Date: Tue, 08 Jul 2025 14:09:17 +0200
From: Sean Nyekjaer <sean@...nix.com>
To: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@....com>,
Jonathan Cameron <jic23@...nel.org>, David Lechner <dlechner@...libre.com>,
Nuno Sá <nuno.sa@...log.com>,
Andy Shevchenko <andy@...nel.org>
Cc: linux-iio@...r.kernel.org, linux-kernel@...r.kernel.org,
Sean Nyekjaer <sean@...nix.com>
Subject: [PATCH] iio: imu: inv_icm42600: fix temperature reading if
accel/gyro is off
Avoid return invalid argument if one tries to read the temperature,.
if both the accelerometer and gyro are off. Power the accelerometer on
before reading the temperature.
The original state will be restored by runtine_suspend() or the next
reading of the accelerometer.
Signed-off-by: Sean Nyekjaer <sean@...nix.com>
---
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
index a4d42e7e21807f7954def431e9cf03dffaa5bd5e..f97376bc8bb3dd225236e3f5036fd58af4af35ac 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
@@ -399,9 +399,14 @@ int inv_icm42600_set_gyro_conf(struct inv_icm42600_state *st,
int inv_icm42600_set_temp_conf(struct inv_icm42600_state *st, bool enable,
unsigned int *sleep_ms)
{
- return inv_icm42600_set_pwr_mgmt0(st, st->conf.gyro.mode,
- st->conf.accel.mode, enable,
- sleep_ms);
+ enum inv_icm42600_sensor_mode accel = st->conf.accel.mode;
+
+ if (st->conf.gyro.mode == INV_ICM42600_SENSOR_MODE_OFF &&
+ st->conf.accel.mode == INV_ICM42600_SENSOR_MODE_OFF)
+ accel = INV_ICM42600_SENSOR_MODE_LOW_POWER;
+
+ return inv_icm42600_set_pwr_mgmt0(st, st->conf.gyro.mode, accel,
+ enable, sleep_ms);
}
int inv_icm42600_enable_wom(struct inv_icm42600_state *st)
---
base-commit: 3e28fa06444e7031aba0b3552cce332b776fe267
change-id: 20250708-icm42temp-6292abddb6e6
Best regards,
--
Sean Nyekjaer <sean@...nix.com>
Powered by blists - more mailing lists