From: Jonathan Cameron <jic23@kernel.org>
To: Joshua Crofts <joshua.crofts1@gmail.com>
Cc: Siratul Islam <email@sirat.me>,
robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
dlechner@baylibre.com, nuno.sa@analog.com, andy@kernel.org,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/3] iio: magnetometer: add driver for QST QMC5883L Sensor
Date: Fri, 12 Jun 2026 17:35:09 +0100 [thread overview]
Message-ID: <20260612173509.2d10b77e@jic23-huawei> (raw)
In-Reply-To: <20260612154922.00003723@gmail.com>
>
> > + {
> > + /* 50ms headroom over the slowest ODR (10Hz) */
> > + ret = regmap_read_poll_timeout(data->regmap,
> > + QMC5883L_REG_STATUS1, status,
> > + (status & QMC5883L_STATUS_DRDY),
> > + 2 * USEC_PER_MSEC,
> > + 150 * USEC_PER_MSEC);
> > + if (ret)
> > + return ret;
> > +
> > + if (status & QMC5883L_STATUS_OVL)
> > + return -ERANGE;
>
> Sashiko has a remark:
>
> If we return -ERANGE here when the overflow flag (OVL) is set, does the
> sensor get permanently stuck in an overflow state?
> In typical I2C magnetometers, the Data Ready (DRDY) and Overflow (OVL)
> status bits are only cleared by reading the data registers. By returning
> early without reading the data registers via regmap_bulk_read(), the DRDY
> and OVL flags might remain set indefinitely.
> On subsequent measurement attempts, regmap_read_poll_timeout() will return
> immediately and this check will instantly fail again, potentially locking up
> the sensor until a reset.
>
I was curious so checked the datasheet.
https://www.qstcorp.com/upload/pdf/202512/13-52-04%20QMC5883L%20Datasheet%20Rev.%20B.pdf
Sashiko looses this time as overflow resets if the next value is in range.
I'm with Sashiko for explicit access being needed for data ready (or a write 1 to clear)
but overflow is more of an intermittent thing so both styles exist for devices
(with and without need for specific action to clear).
Jonathan
> > +
> > + ret = regmap_bulk_read(data->regmap, QMC5883L_REG_X_LSB, buf,
> > + sizeof(buf));
> > + if (ret)
> > + return ret;
> > +
> > + *val = (s16)le16_to_cpu(buf[index]);
> > + }
> > +
> > + return 0;
> > +}
> > +
next prev parent reply other threads:[~2026-06-12 16:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-12 12:45 [PATCH 0/3] iio: magnetometer: add driver for QST QMC5883L Sensor Siratul Islam
2026-06-12 12:45 ` [PATCH 1/3] dt-bindings: add entry for qstcorp Siratul Islam
2026-06-12 16:49 ` Conor Dooley
2026-06-12 12:45 ` [PATCH 2/3] dt-bindings: iio: magnetometer: add QST QMC5883L Sensor Siratul Islam
2026-06-12 13:13 ` Joshua Crofts
2026-06-12 13:45 ` Jonathan Cameron
2026-06-13 15:39 ` David Lechner
2026-06-12 16:30 ` Jonathan Cameron
2026-06-13 8:57 ` Sirat
2026-06-13 11:18 ` Jonathan Cameron
2026-06-12 12:45 ` [PATCH 3/3] iio: magnetometer: add driver for " Siratul Islam
2026-06-12 12:56 ` sashiko-bot
2026-06-12 13:49 ` Joshua Crofts
2026-06-12 16:35 ` Jonathan Cameron [this message]
2026-06-13 8:01 ` Sirat
2026-06-12 17:02 ` Jonathan Cameron
2026-06-13 8:47 ` Sirat
2026-06-13 11:33 ` Jonathan Cameron
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260612173509.2d10b77e@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=email@sirat.me \
--cc=joshua.crofts1@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox