This adds a driver and DT binding for the QST QMC6308, a 3-axis AMR
magnetometer found e.g. in the Fairphone 6. The series is based on
iio/togreg.
The chip is a sibling of the recently added QMC5883L but is not
register compatible with it (different chip ID register and value,
data output at 0x01..0x06, and the range field lives in control
register 2), so this is a separate driver; its structure intentionally
follows qmc5883l.c. The QMC6308's 4-pin WLCSP has no DRDY/interrupt
pin at all, so there is nothing to hang a trigger off; reads are
polled from the chip's periodic measurement mode (its one-shot mode
has no specified conversion time to bound a wait on), with runtime PM
dropping the chip into its 2-3 uA suspend mode between uses. A
software-triggered buffer mode could be added later without breaking
the ABI.
Tested on a Fairphone 6, where the sensor sits on a bit-banged
i2c-gpio bus, using a byte-identical backport on that device's
7.1-based kernel; on this base the driver is build- and modpost-
verified (arm64 defconfig, W=1 clean). Testing covered the chip ID
probe, raw reads, every ODR (10/50/100/200 Hz), oversampling ratio
(8/4/2/1) and scale setting (the same ambient field reads consistently
across all four ranges), the mount matrix validated against Earth's
field by pointing the device at the cardinal directions, and runtime
PM verified at the bus level (the mode register reads back as suspend
after the autosuspend delay, wakes on read, and accepts configuration
writes while suspended). The FP6 board DTS will be submitted
separately through the qcom tree once this lands.
Jorijn van der Graaf (2):
dt-bindings: iio: magnetometer: add QST QMC6308
iio: magnetometer: add support for QST QMC6308
.../iio/magnetometer/qstcorp,qmc6308.yaml | 48 ++
MAINTAINERS | 7 +
drivers/iio/magnetometer/Kconfig | 11 +
drivers/iio/magnetometer/Makefile | 1 +
drivers/iio/magnetometer/qmc6308.c | 590 ++++++++++++++++++
5 files changed, 657 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/qstcorp,qmc6308.yaml
create mode 100644 drivers/iio/magnetometer/qmc6308.c
base-commit: 2e2f2de7532cbbc2269de8be20ec709606c6e79b
--
2.55.0