From: Stefan Popa <stefan.popa@analog.com>
To: <linux-iio@vger.kernel.org>
Cc: <jic23@kernel.org>, <lars@metafoo.de>,
<Michael.Hennerich@analog.com>, <robh@kernel.org>,
<krzk+dt@kernel.org>, <conor+dt@kernel.org>, <andy@kernel.org>,
<dlechner@baylibre.com>, <nuno.sa@analog.com>,
<siratul.islam@linux.dev>, <u.kleine-koenig@baylibre.com>,
<linux@roeck-us.net>, <joshua.crofts1@gmail.com>,
<ciprian.hegbeli@analog.com>, <devicetree@vger.kernel.org>,
<linux-kernel@vger.kernel.org>,
Stefan Popa <stefan.popa@analog.com>
Subject: [PATCH v7 0/2] iio: adc: add MAX40080 current-sense amplifier driver
Date: Tue, 18 Aug 2026 17:29:26 +0300 [thread overview]
Message-ID: <20260818142928.8244-1-stefan.popa@analog.com> (raw)
This series adds support for the MAX40080, a bidirectional current-sense
amplifier with an integrated 12-bit ADC.
The driver is placed in IIO rather than hwmon because:
- IIO's scale/raw model naturally exposes the selectable gain ranges and
lets userspace apply the correct scale per range.
- Buffered capture support is planned for a follow-up series -- each
conversion returns a matched current+voltage pair, which maps cleanly
to IIO's buffered/triggered model.
Changes since v6:
- Add types.h include (Andy).
- Remove dead code: i2c_smbus_read_i2c_block_data can't return partial
reads, so remove the ret != sizeof(buf) check (David).
- Remove dead code: iv variable initialization not needed as
max40080_read_iv always writes to *iv before returning (David).
Changes since v5:
- Fix datasheet URL format in binding -- use stable link without /en/
path component (Jonathan, Siratul).
- Use 'adi' compatible prefix instead of 'maxim' -- MAX40080 is an ADI
product (Conor).
- Split MAINTAINERS into binding and driver patches (Siratul).
- Add datasheet link in driver header comment (Siratul).
- Fix comment style: capital first letter + period (Siratul).
- Fix register defines: add register name prefix (CFG_, FIFO_CFG_, IV_)
and use designated initializers for csa_gain array (Jonathan).
- Define MAX40080_ADC_RES_BITS and use BIT() for shift (Jonathan).
- Use lowercase 'mV' in defines (Siratul).
- Use C99 loop variable declarations (Siratul).
- Remove braces from single-statement if blocks (Siratul).
- Declaration and initialization in same statement (Siratul).
- Use IIO_VAL_FRACTIONAL_LOG2 for voltage scale (Jonathan).
- Remove unused i2c_set_clientdata call (Jonathan).
- Use defines instead of magic numbers for range default (Jonathan).
Changes since v4:
- Initialize tmp = 0 in max40080_read_iv() before read_poll_timeout to
avoid using potentially uninitialized value in the condition check
(Sashiko, Jonathan).
- Simplify max40080_get_oversampling_ratio() to use cached value instead
of reading from the device (Jonathan).
- Remove DMA-safe buffer from struct -- I2C layer already bounces data
internally for i2c_smbus_* calls (Jonathan).
- Make shunt-resistor-micro-ohms required in DT binding. The default
1 Ohm was arbitrary and rarely correct for real hardware (Jonathan).
- Remove PM ops entirely. Having only resume without suspend was flagged
as "papering over" possible power loss issues (Jonathan).
- Remove the {} scope around propname, declare it at function top (Andy).
- Remove mod_devicetable.h include -- i2c.h provides necessary types
(Jonathan).
Changes since v3:
- Removed all regmap usage -- regmap doesn't support SMBus PEC or Quick
Command, both required by this device (Nuno).
- Fixed locking: max40080_update_bits() now takes the lock internally,
and callers update cached state after the call returns (Nuno).
- Consistent comment style: capital first letter + period (Andy).
- Use propname variable to deduplicate "shunt-resistor-micro-ohms" (Andy).
- Return IIO_VAL_* inline instead of break + return pattern (Nuno).
Changes since v2:
- Added shunt-resistor-micro-ohms DT property with default value.
- Use single-shot mode with SMBus Quick Command trigger for correlated
current/voltage reads.
- Precompute current scale per range at probe time.
Link: https://lore.kernel.org/linux-iio/20260730131738.822405-1-stefan.popa@analog.com/ [v6]
Link: https://lore.kernel.org/linux-iio/20260723065036.2683075-1-stefan.popa@analog.com/ [v5]
Link: https://lore.kernel.org/linux-iio/20260717123852.1140893-1-stefan.popa@analog.com/ [v4]
Link: https://lore.kernel.org/linux-iio/20260715063652.368501-1-stefan.popa@analog.com/ [v3]
Link: https://lore.kernel.org/linux-iio/20260713120226.90303-1-stefan.popa@analog.com/ [v2]
Link: https://lore.kernel.org/linux-iio/20260703102941.1141341-1-stefan.popa@analog.com/ [v1]
Stefan Popa (2):
dt-bindings: iio: adc: add adi,max40080
iio: adc: add MAX40080 current-sense amplifier driver
.../bindings/iio/adc/adi,max40080.yaml | 65 ++
MAINTAINERS | 9 +
drivers/iio/adc/Kconfig | 11 +
drivers/iio/adc/Makefile | 1 +
drivers/iio/adc/max40080.c | 572 ++++++++++++++++++
5 files changed, 658 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/adc/adi,max40080.yaml
create mode 100644 drivers/iio/adc/max40080.c
--
2.53.0
next reply other threads:[~2026-08-18 14:30 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-18 14:29 Stefan Popa [this message]
2026-08-18 14:29 ` [PATCH v7 1/2] dt-bindings: iio: adc: add adi,max40080 Stefan Popa
2026-08-18 14:29 ` [PATCH v7 2/2] iio: adc: add MAX40080 current-sense amplifier driver Stefan Popa
2026-08-18 14:39 ` sashiko-bot
2026-08-18 15:44 ` Andy Shevchenko
2026-08-18 16:19 ` Jonathan Cameron
2026-08-19 6:51 ` Andy Shevchenko
2026-08-18 16:38 ` Jonathan Cameron
2026-08-19 8:00 ` Siratul Islam
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=20260818142928.8244-1-stefan.popa@analog.com \
--to=stefan.popa@analog.com \
--cc=Michael.Hennerich@analog.com \
--cc=andy@kernel.org \
--cc=ciprian.hegbeli@analog.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=joshua.crofts1@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=nuno.sa@analog.com \
--cc=robh@kernel.org \
--cc=siratul.islam@linux.dev \
--cc=u.kleine-koenig@baylibre.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.