From: Jonathan Cameron <jic23@kernel.org>
To: John Erasmus Mari Geronimo <johnerasmusmari.geronimo@analog.com>
Cc: <linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>,
<krzk+dt@kernel.org>, <dlechner@baylibre.com>,
<nuno.sa@analog.com>, <Michael.Hennerich@analog.com>,
<andy@kernel.org>, <robh@kernel.org>, <conor+dt@kernel.org>,
<joshua.crofts1@gmail.com>,
Guenter Roeck <linux@sinkhole.paloaltonetworks.com>,
<linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH v7 0/2] Add support for Analog Devices MAX30210
Date: Sun, 29 Nov 2026 01:06:22 +0000 [thread overview]
Message-ID: <20261129010622.1ccb0b2e@jic23-hlaptop> (raw)
In-Reply-To: <20261125025425.1176-1-johnerasmusmari.geronimo@analog.com>
On Wed, 25 Nov 2026 10:54:23 +0800
John Erasmus Mari Geronimo <johnerasmusmari.geronimo@analog.com> wrote:
> This series adds support for the Analog Devices MAX30210 I2C
> temperature sensor.
>
> Datasheet: https://www.analog.com/media/en/technical-documentation/data-sheets/max30210.pdf
>
> The device provides a 16-bit temperature output and includes
> features such as a hardware FIFO, programmable sampling rate,
> threshold alarms, and interrupt support. The FIFO is exposed as an
> IIO buffered capture (kfifo buffer, fed from the FIFO watermark
> interrupt) and the threshold alarms as IIO events. As far as I can
> tell hwmon has no equivalent for streaming samples out of a hardware
> FIFO, and the related MAX30208 is an IIO driver as well.
>
> Although the MAX30210 belongs to the same device family as the
> MAX30208, it is implemented as a separate driver. The MAX30210 has
> a significantly different feature set, including a 64-sample hardware
> FIFO with configurable watermark interrupts, programmable sampling
> rates, and event support. These features require buffered operation
> and IRQ-driven data handling which are not present in the MAX30208
> driver (which talks to the device directly via i2c_smbus_*() calls
> with no regmap, and has no IIO buffer or event interface at all).
>
> In addition, the MAX30210 uses a different register map and a more
> flexible I2C address selection scheme. Supporting both devices in a
> single driver would introduce substantial conditional logic, so a
> separate driver keeps the implementation simpler and easier to
> maintain.
>
> Patch 1 adds the devicetree binding (unchanged since v5).
> Patch 2 adds the IIO driver implementation.
>
> Changes since v6:
> https://lore.kernel.org/all/20261110021442.410-1-johnerasmusmari.geronimo@analog.com/
> - Request the interrupt before devm_iio_device_register(), after the
> quiesce action is registered. Jonathan asked for this on v4 and I
> refused it on v5 and v6 because I believed the event interface was
> freed on unregister. That was wrong: iio_device_unregister_eventset()
> is only called from iio_dev_release(), which runs after all other
> devm actions, so the order is safe. Removal is now: unregister
> (predisable() synchronizes a live interrupt), free the interrupt,
> quiesce, power down. The interrupt handler returns IRQ_NONE while
> INT_EN is 0, so requesting it early is harmless. Sorry about that,
> and thanks to Jonathan and sashiko for not letting it go.
Great. I hadn't caught up with your v6 because I wanted to look into
what races we had around this in more detail. Now I can park this
for a while at least. I'm less than confident that we are race free
but at least seems we are ok for the case that was concerning you.
Thanks for digging into it. I'm snowed under with all the bugs
that shook out in a refactor of some of the trigger handling
(hopefully post a bunch of those in next few days) and events
was after that!
Jonathan
> - postenable(): only read STATUS to drop a stale A_FULL when no
> autonomous conversion user (threshold event) exists, and do it
> before the conversion is started. Otherwise the clear-on-read could
> swallow a pending TEMP_HI/TEMP_LO flag of an armed event (sashiko).
> With events armed a stale A_FULL may remain and fifo_read() skips
> the invalid samples.
> - Rate-limit the error messages in the interrupt handler and in
> max30210_fifo_read().
> - Style cleanups from Andy: multi-line comment in autoconv_put(), an
> index variable in max30210_fifo_read(), local regmap and
> m/v variables with field_prep() in max30210_write_raw(), clamp the
> watermark before checking it for zero, "5 µs" in the comment.
> - Rebased on the current iio togreg.
>
> Tested on real MAX30210 hardware (Raspberry Pi 4) with a 6.12 based
> vendor kernel, which has no KASAN or lockdep; this version is only
> build-tested against mainline (W=1, checkpatch --strict and
> dt_binding_check are clean). Re-run on this version: the sysfs scale
> against the raw reading, FIFO streaming with a fresh first sample, the
> watermark clamp, threshold events with the buffer off, disabled events
> staying silent while the FIFO interrupt runs, 50 buffer
> enable/disable cycles, the buffer enabled with events already armed
> and the other way round, 80 rmmod/insmod cycles (20 with interrupts
> firing and 60 timed to land within about 250 ms of live interrupt
> traffic), 60 more rmmod cycles with the buffer and events active,
> the no-interrupt and the no-powerdown-GPIO configurations, and the
> INT_EN/TEMP_CONV state the chip is left in after removal (checked
> against a driver without the quiesce action, which fails the check).
>
> Changes since v5:
> https://lore.kernel.org/all/20261023080623.1830-1-johnerasmusmari.geronimo@analog.com/
> - Fix the temperature scale: one LSB is 5 milli degrees Celsius, so
> report 5 (IIO_VAL_INT) instead of 5/1000.
> - Mask the interrupt status with the enabled interrupts, so threshold
> events and the FIFO that are not enabled are not serviced.
> - Start the FIFO interrupt and the autonomous conversion in
> postenable(), after the watermark has been set, and stop them in
> predisable() followed by synchronize_irq(). This also removes the
> goto from preenable(), which mixed a guard with a goto.
> - Read STATUS before enabling the FIFO interrupt so a stale A_FULL
> flag does not fire on the freshly flushed FIFO.
> - Clamp the hardware FIFO watermark to the FIFO size instead of
> failing.
> - Mark SYS_CONF_REG volatile (its reset bit is self-clearing).
> - Use gpiod_set_value_cansleep() for the powerdown GPIO.
> - Keep the powerdown GPIO asserted for 10 us before deasserting it,
> the datasheet lists a CVT/PDB input low-pulse width of 5 us.
> - Do not expose the threshold events when there is no interrupt.
> - Review cleanups: check the event type first, use a local regmap
> variable, regmap_test_bits(), simpler set/clear handling in
> write_event_config(), a logical split of the poll call, and rename
> the sampling frequency index to freq_idx.
> - Not changed: autoconv_put() still drops its reference when the
> register write fails (a later direct read rewrites TEMP_CONV_REG
> without AUTO, which stops it).
> - Cover letter: removed the incorrect statement about hwmon and
> interrupts, thanks to Guenter for pointing it out.
prev parent reply other threads:[~2026-11-29 1:06 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-25 2:54 [PATCH v7 0/2] Add support for Analog Devices MAX30210 John Erasmus Mari Geronimo
2026-11-25 2:54 ` [PATCH v7 1/2] dt-bindings: iio: temperature: add ADI MAX30210 John Erasmus Mari Geronimo
2026-11-25 2:54 ` [PATCH v7 2/2] iio: temperature: add support for Analog Devices MAX30210 John Erasmus Mari Geronimo
2026-11-25 3:08 ` sashiko-bot
2026-11-29 1:16 ` Jonathan Cameron
2026-11-29 1:06 ` Jonathan Cameron [this message]
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=20261129010622.1ccb0b2e@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=johnerasmusmari.geronimo@analog.com \
--cc=joshua.crofts1@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux@sinkhole.paloaltonetworks.com \
--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