Re: [RFC] iio: magnetometer: mlx90393 - regmap vs command-based access
From: Jonathan Cameron
Date: Fri Apr 24 2026 - 06:48:33 EST
On Thu, 23 Apr 2026 20:43:55 +0300
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:
> On Thu, Apr 23, 2026 at 05:55:35PM +0530, Nikhil Gautam wrote:
> >
> > Apologies for missing a few details in the previous mail.
> >
> > The MLX90393 supports both I2C and SPI interfaces.
> >
> > Commands include, for example:
> > - SM (Start Measurement)
> > - RM (Read Measurement)
> > - RR (Read Register)
> >
> > Given this command-oriented interface over both I2C and SPI,
> > I wanted to confirm whether a custom command abstraction layer
> > would still be the preferred approach instead of regmap.
>
> I found only 4 drivers for this vendor in the kernel and they seem
> either register based or eeprom based. Perhaps the latter is the
> case here? Have you checked existing implementations?
>
If it doesn't match up with an existing case.
I took a look at the datasheet and this is a weird mix
of a register driven and command driven device. As such you could
do regmap for the registers, buy you'd need to bypass that for
the command only stuff. I don't think it's worth the mess of
creating some virtual registers to deal with the commands.
Hence I think in this particular case regmap doesn't look suitable
and a custom bus abstraction layer makes sense. Some of that is going
to look regmap like, but with some other callbacks as well.
Jonathan