Re: [PATCH v8 6/7] iio: imu: inv_icm42607: Implement MREGx register access

From: Jonathan Cameron

Date: Fri Nov 06 2026 - 22:49:08 EST


On Thu, 5 Nov 2026 16:48:54 +0100
Kanak Shilledar <kanak.shilledar@xxxxxxxx> wrote:

> The device supports indirect register access to different banks. A
> specific routine needs to be followed when accessing the registers in
> another bank as documented in the datasheet (section 13). This is
> required for accessing registers configured via the user and
> implementing buffer support. The implementation is inspired from the
> icm45600 driver.
>
> The banks are defined based on their initial bank access code which are
> written to the BLK_SEL_* regs. However, there is a variation for MREG1
> as User Bank 0 and MREG1 both share the same 0x00, so User Bank 1 has
> 0x00 and MREG1 has 0x01. When MREG1 register is accessed, then BLK_SEL_*
> is written with 0x00 instead of 0x01. All the register access goes
> through the 16 bit virtual regmap layered on top of the 8bit bus regmap.
> Bank id in the upper byte and the register address in the lower byte.
> Bank 0 accesses are forwarded to the bus regmap with the bank field
> stripped, while MREG accesses are forwarded to bank switching sequence.
>
> Due to the specific bank switching routine, it is not possible to use
> regmap-ranges. Only User Bank 0 supports bulk read/writes whereas other
> banks can only be accessed serially. Each time some data in the other
> bank needs to be accessed, it should go through the complete bank
> switching sequence.
Does turning off bulk accesses for user bank 0 have much impact on performance
of existing features?

Otherwise looks fine to me,

Jonathan

>
> After initiating the MREGx bank access, the BLK_SEL_* should be reset to
> 0 even in case of failure. Ensure the internal clock is running before
> initiating bank access. Add extra helper functions to separate good and
> bad paths.
>
> Datasheet: https://www.invensense.tdk.com/en-us/products/3-axis/icm-42370-p
> Datasheet: https://www.lcsc.com/product-detail/C5129967.html
> Signed-off-by: Kanak Shilledar <kanak.shilledar@xxxxxxxx>