Re: [PATCH v6 4/4] iio: magnetometer: mmc5633: Add mount matrix support

From: Jonathan Cameron

Date: Fri Dec 04 2026 - 18:02:38 EST


On Thu, 3 Dec 2026 19:26:02 +0200
Andy Shevchenko <andriy.shevchenko@xxxxxxxxx> wrote:

> On Thu, Dec 03, 2026 at 05:56:54PM +0100, Gerard Marull-Paretas wrote:
> > Read the mount matrix from the firmware and expose it, so that user
> > space can account for how the sensor is oriented on the board.
>
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
>
> While I reviewed that, the more generic Q still stands. Can we rather use IIO
> opaque structure and move majority of this code to the IIO core as a helper for
> drivers that want it? Jonathan, what do you think?

I wasn't keen on doing this in the past because it was relatively rare
for firmware to actually provide this info so we only supported it in a
few drivers. It still only applies to a subset of IIO devices and
the ACPI side of things isn't standard, so those are a bit trickier to deal
with. So I think there is a limit to what can be in the core.

I'd be interested to see a proposal though and see what it ends up
looking like. I guess it would be put the pointer in the iio_opaque
structure and then fill it if a driver requests it. So the bit we save
on is the pointer in the iio_priv() and the helper function used
to find that. Might be worth doing.

We aren't very consistent in how we handle the scope of it either.
Mix of shared_by_all, by_type, by_dir so generating the attribute from
the core is going to be tricky. There are good reasons for some of
those variants, but with hindsight this hasn't been as controlled as
it should have been.

So, maybe?

Jonathan

>
> (It definitely does not affect this series, which is good as it go.)
>