.../bindings/iio/adc/maxim,max40080.yaml | 62 ++ MAINTAINERS | 9 + drivers/iio/adc/Kconfig | 11 + drivers/iio/adc/Makefile | 1 + drivers/iio/adc/max40080.c | 627 ++++++++++++++++++ 5 files changed, 710 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/maxim,max40080.yaml create mode 100644 drivers/iio/adc/max40080.c
This series adds support for the Maxim MAX40080, a bidirectional
current-sense amplifier with an integrated 12-bit ADC and an I2C/SMBus
interface. It measures the voltage across an external shunt resistor and
the input bus voltage.
Why a new driver (Andy): No existing IIO driver covers this device or a
register-compatible part. The closest relatives (max9611, max34408) target
different silicon with incompatible register maps. The MAX40080 has a
unique combination of bidirectional 13-bit current, 64-entry FIFO, mandatory
PEC, single-measurement mode triggered by SMBus Quick Command, and two
selectable input ranges. See the driver commit message for the full
rationale.
The datasheet link is in the binding YAML description.
The driver operates in direct (INDIO_DIRECT_MODE) mode. Each raw read
triggers a single on-demand conversion (SMBus Quick Command) and reads
back the matched current/voltage pair, so results are always fresh. It
exposes the current and voltage channels with raw and scale attributes,
a configurable oversampling (digital averaging) ratio, and PEC-protected
register access. The two selectable current-sense ranges are exposed
through scale/scale_available (the range is chosen by writing the
desired scale); the current scale is derived from the
shunt-resistor-micro-ohms device-tree property.
Continuous FIFO buffering, threshold events and the alert interrupt are
intentionally left out of this initial submission and may be added
later.
Tested on hardware with four MAX40080 devices on an I2C bus.
Changes in v2:
- Add vdd-supply and interrupts properties to the binding (David)
- Add types.h and time.h includes (Andy)
- Use USEC_PER_MSEC for poll timeout readability (Andy)
- Use 1 * MICRO for default shunt resistor (Andy)
- Rename field macros to include register name, e.g. MAX40080_CFG_MODE_MSK
(Jonathan, David)
- Add indexed defines for RANGE field values and use in gain array
(Jonathan)
- Use array lookup in get_oversampling_ratio instead of formula (Andy)
- Use switch statement for chan->type in read_raw (David)
- Simplify update_bits: one-liner RMW, return write directly (Andy)
- Add local client variable in trigger_measurement (Andy)
- Add braces to for loops and use C99 loop variables (Siratul, Andy)
- Flip if/else in reg_access, separate declaration from assignment (Andy)
- Add .name= in i2c_device_id (David, Siratul)
- Remove unused i2c_set_clientdata call (Andy)
- Reorder declarations to reverse christmas tree (Siratul)
- Return directly from oversampling case in write_raw (Andy)
- Add blank lines before return in read_avail (Siratul)
- Add Co-developed-by tag for Ciprian (Andy)
- Use Link: tag for datasheet URL in commit message
Regarding mod_devicetable.h (Uwe): kept for now as the replacement
headers (linux/device-id/*.h) are not yet available in mainline.
Stefan Popa (2):
dt-bindings: iio: adc: add maxim,max40080
iio: adc: add MAX40080 current-sense amplifier driver
.../bindings/iio/adc/maxim,max40080.yaml | 62 ++
MAINTAINERS | 9 +
drivers/iio/adc/Kconfig | 11 +
drivers/iio/adc/Makefile | 1 +
drivers/iio/adc/max40080.c | 627 ++++++++++++++++++
5 files changed, 710 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/adc/maxim,max40080.yaml
create mode 100644 drivers/iio/adc/max40080.c
--
2.53.0
On Mon, Jul 13, 2026 at 03:02:24PM +0300, Stefan Popa wrote: > Regarding mod_devicetable.h (Uwe): kept for now as the replacement > headers (linux/device-id/*.h) are not yet available in mainline. You can (and should) rely on <linux/i2c.h> to provide of_device_id. Best regards Uwe
On Mon, 13 Jul 2026 15:02:24 +0300 Stefan Popa <stefan.popa@analog.com> wrote: > This series adds support for the Maxim MAX40080, a bidirectional > current-sense amplifier with an integrated 12-bit ADC and an I2C/SMBus > interface. It measures the voltage across an external shunt resistor and > the input bus voltage. > > Why a new driver (Andy): No existing IIO driver covers this device or a > register-compatible part. The closest relatives (max9611, max34408) target > different silicon with incompatible register maps. The MAX40080 has a > unique combination of bidirectional 13-bit current, 64-entry FIFO, mandatory > PEC, single-measurement mode triggered by SMBus Quick Command, and two > selectable input ranges. See the driver commit message for the full > rationale. > > The datasheet link is in the binding YAML description. > > The driver operates in direct (INDIO_DIRECT_MODE) mode. Each raw read > triggers a single on-demand conversion (SMBus Quick Command) and reads > back the matched current/voltage pair, so results are always fresh. It > exposes the current and voltage channels with raw and scale attributes, > a configurable oversampling (digital averaging) ratio, and PEC-protected > register access. The two selectable current-sense ranges are exposed > through scale/scale_available (the range is chosen by writing the > desired scale); the current scale is derived from the > shunt-resistor-micro-ohms device-tree property. > > Continuous FIFO buffering, threshold events and the alert interrupt are > intentionally left out of this initial submission and may be added > later. > > Tested on hardware with four MAX40080 devices on an I2C bus. > > Changes in v2: Please don't send a new version as a reply to the previous version, it breaks people's workflow and tooling! (tools like b4 may get confused by this). -- Kind regards CJD
© 2016 - 2026 Red Hat, Inc.