Re: [PATCH v3 0/5] iio: magnetometer: add driver for QST QMC5883P

From: Jonathan Cameron

Date: Mon Apr 20 2026 - 11:42:44 EST


On Sun, 19 Apr 2026 22:32:09 +0000
Hardik Phalet <hardik.phalet@xxxxx> wrote:

> This series adds an IIO driver for the QST QMC5883P, a 3-axis
> anisotropic magneto-resistive (AMR) magnetometer with a 16-bit ADC,
> communicating over I2C. To my knowledge there is no existing
> upstream driver for this device (see "Prior-art register-map check"
> below).
>
> The driver supports:
> - Raw magnetic field readings on X, Y and Z axes
> - Four full-scale ranges (+/-2 G, +/-8 G, +/-12 G, +/-30 G),
> selectable via IIO_CHAN_INFO_SCALE
> - Four output data rates (10, 50, 100, 200 Hz), selectable via
> IIO_CHAN_INFO_SAMP_FREQ
> - Four oversampling ratios (1, 2, 4, 8), selectable via
> IIO_CHAN_INFO_OVERSAMPLING_RATIO

I'm suspicious about this one based on a very quick read of the datasheet.
Conventional oversampling would involve running the internal sampling
engine at a multiple of the sampling frequency, and then averaging the
results. The datasheet describes this as:
"Over sample Rate (OSR1) registers are used to control bandwidth of an
internal digital filter. Larger OSR value leads to smaller filter bandwidth,
less in-band noise and higher power consumption. It could be used to reach a
good balance between noise and power. Four over sample ratios can be selected,
8,4,2 or 1."

That sounds like a boxcar filter to me not oversampling (which would be
a combination of box car and reducing the output data rate).

If possible, can you enable the data ready output and put a scope on it
to see if that changes frequency when OSR or OSR2 are modified.

Trickier to do would be looking at the noise levels whilst playing with
these filters and see if they at least match with standard filter types.

If we can't figure these out, then it may be a case of picking something
that works well and hard coding that rather than letting userspace
change things in a fashion that might not match the ABI.

> - Runtime PM with a 2 s autosuspend delay
> - System suspend/resume delegated to the runtime callbacks