[RFC PATCH 0/2] iio: magnetometer: add support for Melexis MLX90393

From: Nikhil Gautam

Date: Sun May 10 2026 - 15:10:34 EST


Hi,

This series adds initial Industrial I/O subsystem support for the
Melexis MLX90393 3-axis magnetometer and temperature sensor.

The MLX90393 supports both I2C and SPI interfaces. This RFC
implements support for the I2C interface while keeping the driver
structure transport-independent to simplify future SPI support.

Currently supported features:

raw magnetic field measurements for X/Y/Z axes
raw temperature measurements
configurable gain/scale selection
configurable oversampling ratio
direct mode operation through the IIO subsystem
initially I2C support for this driver

The driver has been tested on Raspberry Pi 5 hardware using an
actual MLX90393 sensor connected over I2C. Raw magnetic field and
temperature values were verified through the IIO sysfs interface.

A custom transport abstraction was used instead of regmap due to
the MLX90393 command/response protocol semantics and repeated-start
transfer behavior. This approach was discussed previously on the
mailing list and seemed preferable for this device.
Link: https://lore.kernel.org/linux-iio/20260424114818.1290b029@jic23-huawei/

The implementation intentionally focuses on a minimal and reviewable
feature set for the initial RFC submission. Support for SPI,
buffered capture, triggers, interrupts and runtime PM can be added
incrementally in follow-up work.

The DT binding schema has been validated using dt_binding_check and
the driver has been checked using checkpatch.pl --strict.

Feedback on the overall driver structure, transport abstraction,
IIO ABI usage and DT binding would be appreciated.

Thanks,
Nikhil Gautam

Nikhil Gautam (2):
dt-bindings: iio: magnetometer: add Melexis MLX90393
iio: magnetometer: add support for Melexis MLX90393

.../iio/magnetometer/melexis,mlx90393.yaml | 39 +
drivers/iio/magnetometer/Kconfig | 10 +
drivers/iio/magnetometer/Makefile | 2 +
drivers/iio/magnetometer/mlx90393.h | 76 ++
drivers/iio/magnetometer/mlx90393_core.c | 724 ++++++++++++++++++
drivers/iio/magnetometer/mlx90393_i2c.c | 71 ++
6 files changed, 922 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/melexis,mlx90393.yaml
create mode 100644 drivers/iio/magnetometer/mlx90393.h
create mode 100644 drivers/iio/magnetometer/mlx90393_core.c
create mode 100644 drivers/iio/magnetometer/mlx90393_i2c.c

--
2.39.5