]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
iio: imu: st_lsm6dsx: deselect shub page before reading whoami
authorAndreas Kempe <andreas.kempe@actia.se>
Thu, 2 Jul 2026 10:41:23 +0000 (10:41 +0000)
committerJonathan Cameron <jic23@kernel.org>
Fri, 3 Jul 2026 18:34:47 +0000 (19:34 +0100)
commitaede83625ff5d9539508582036df30c809d51058
tree83da599f90fb00017592495c7ce6413371eec8eb
parentfd354554af1d2b33232ca6c8a3d79ed82413d715
iio: imu: st_lsm6dsx: deselect shub page before reading whoami

As part of driver initialization, e.g. st_lsm6dsx_init_shub() selects
the shub register page using st_lsm6dsx_set_page(). Selecting the shub
register page shadows the regular register space so whoami, among other
registers, is no longer accessible.

In applications where the IMU is permanently powered separately from the
processor, there is a window where a reset of the CPU leaves the IMU in
the shub register page. Once this occurs, any subsequent probe attempt
fails because of the register shadowing.

Using the ism330dlc, the error typically looks like

    st_lsm6dsx_i2c 3-006a: unsupported whoami [10]

with the unknown whoami read from a reserved register in the shub page.

The reset register is also shadowed by the page select, preventing a
reset from recovering the chip.

Unconditionally clear the shub page before the whoami readout to ensure
normal register access and allow the initialization to proceed.

Place the fix in st_lsm6dsx_check_whoami() before the whoami check
because hw->settings, which st_lsm6dsx_set_page() relies on, is first
assigned in that function.

Placing the fix in a more logical place than the whoami check would
require a bigger restructuring of the code.

Fixes: c91c1c844ebd ("iio: imu: st_lsm6dsx: add i2c embedded controller support")
Signed-off-by: Andreas Kempe <andreas.kempe@actia.se>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Cc: <Stable@vger.kernel.org>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c