Devicetree
 help / color / mirror / Atom feed
* [PATCH v3 0/2] iio: magnetometer: add MEMSIC MMC5983MA driver
@ 2026-05-11 19:11 Vladislav Kulikov
  2026-05-11 19:11 ` [PATCH v3 1/2] dt-bindings: iio: magnetometer: add MEMSIC MMC5983MA Vladislav Kulikov
  2026-05-11 19:11 ` [PATCH v3 2/2] iio: magnetometer: add driver for " Vladislav Kulikov
  0 siblings, 2 replies; 3+ messages in thread
From: Vladislav Kulikov @ 2026-05-11 19:11 UTC (permalink / raw)
  To: jic23, krzk+dt, robh, conor+dt
  Cc: dlechner, nuno.sa, andy, andriy.shevchenko, linux-iio, devicetree,
	linux-kernel, Vladislav Kulikov

Add an IIO driver for the MEMSIC MMC5983MA 3-axis magnetometer over
I2C. The driver provides raw magnetic field readings with
per-measurement SET/RESET offset cancellation, giving 18-bit output
with a full-scale range of +/-8 Gauss.

MMC5983MA is not register-compatible with the existing MEMSIC
magnetometer drivers. It has a different register map, 18-bit output
data format, and I2C/SPI transport support.

Tested on a Raspberry Pi 2B with the sensor on I2C-1 at 0x30.

The initial driver implements the validated I2C single-measurement path.
Other chip features are left for future work:

- SPI transport: the binding describes SPI wiring, but driver support is
  left for follow-up validation of the SPI command and SET/RESET
  sequencing.
- Temperature channel: left until the temperature output behavior is
  better validated.
- Continuous measurement mode and Auto SET/RESET: left until the
  interaction between CMM, TM_M, Meas_M_Done, and SET/RESET sequencing
  is better understood.
- Saturation/self-test bits and BW/decimation tuning: not exposed until
  their behavior can be described reliably through stable IIO ABI.

The driver uses a conservative 500 us post-SET/RESET delay before
starting the following measurement. The datasheet describes a 500 ns
SET/RESET coil pulse, but testing showed that a longer software delay is
needed before taking the next measurement.

Changes since v2:
- Driver:
  - refactored SET/RESET coil pulse into mmc5983_pulse_coil() helper
  - used USEC_PER_MSEC for regmap_read_poll_timeout and fsleep constants
- DT binding:
  - removed redundant comments from examples
- Cover letter:
  - added "why a new driver" explanation
- Collected Reviewed-by and Acked-by tags

Changes since v1:
- DT binding:
  - added SPI bus support, interrupts, and vddio-supply
  - made vdd-supply required
  - switched to unevaluatedProperties with spi-peripheral-props ref
- Driver:
  - replaced scoped_guard() with guard(mutex) in a case block
  - added datasheet page references for timing values
  - changed product ID mismatch from probe failure to dev_info()
  - hardcoded the IIO device name
  - added trailing commas
  - added local struct device and regmap pointers in mmc5983_init()
- MAINTAINERS:
  - split binding and driver F: entries across the relevant patches

Vladislav Kulikov (2):
  dt-bindings: iio: magnetometer: add MEMSIC MMC5983MA
  iio: magnetometer: add driver for MEMSIC MMC5983MA

 .../iio/magnetometer/memsic,mmc5983.yaml      |  63 ++++
 MAINTAINERS                                   |   7 +
 drivers/iio/magnetometer/Kconfig              |  11 +
 drivers/iio/magnetometer/Makefile             |   1 +
 drivers/iio/magnetometer/mmc5983.c            | 345 ++++++++++++++++++
 5 files changed, 427 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/memsic,mmc5983.yaml
 create mode 100644 drivers/iio/magnetometer/mmc5983.c


base-commit: 7fd2df204f342fc17d1a0bfcd474b24232fb0f32
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-05-11 19:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11 19:11 [PATCH v3 0/2] iio: magnetometer: add MEMSIC MMC5983MA driver Vladislav Kulikov
2026-05-11 19:11 ` [PATCH v3 1/2] dt-bindings: iio: magnetometer: add MEMSIC MMC5983MA Vladislav Kulikov
2026-05-11 19:11 ` [PATCH v3 2/2] iio: magnetometer: add driver for " Vladislav Kulikov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox