From: Salih Erim <salih.erim@amd.com>
To: <jic23@kernel.org>, <robh@kernel.org>, <krzk+dt@kernel.org>,
<conor+dt@kernel.org>, <git@amd.com>
Cc: <nuno.sa@analog.com>, <andy@kernel.org>, <dlechner@baylibre.com>,
<michal.simek@amd.com>, <conall.ogriofa@amd.com>,
<erimsalih@gmail.com>, <linux-iio@vger.kernel.org>,
<devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Salih Erim <salih.erim@amd.com>
Subject: [PATCH v2 0/5] iio: adc: add AMD/Xilinx Versal SysMon driver
Date: Sat, 2 May 2026 12:19:46 +0100 [thread overview]
Message-ID: <20260502111951.538488-1-salih.erim@amd.com> (raw)
This series adds a new IIO driver for the AMD/Xilinx Versal System
Monitor (SysMon), providing on-chip voltage and temperature monitoring.
The Versal SysMon measures up to 160 supply voltages and reads up to
64 temperature satellites distributed across the SoC. The hardware
also provides aggregated device temperature registers: the current
max and min across all active satellites, and peak/trough values
recorded since last hardware reset. The device can be accessed via
memory-mapped I/O or via an I2C interface.
The driver is split into a bus-agnostic core module using the regmap
API, an MMIO platform driver, and an I2C driver. This allows the
same IIO logic to be shared across different bus transports.
Previous submission:
https://lore.kernel.org/all/cover.1757061697.git.michal.simek@amd.com/
Changes in v2:
- Driver restructured into core/MMIO/I2C split (3 modules) using
regmap API instead of direct readl/writel or custom ops
- DT binding restructured: container nodes (supply-channels,
temperature-channels) with channel@N children referencing adc.yaml,
replacing flat supply@N/temp@N with vendor-specific properties
- Added I2C compatible (xlnx,versal-sysmon-i2c) to binding
- Binding: reg required for both MMIO and I2C, interrupts optional
- Binding: hex unit-addresses (channel@a not channel@10) per DTSpec
- Binding: example trimmed to minimal variants
- API modernized: read_label instead of extend_name, guard/scoped_guard
locking, fwnode property API, devm managed resources, per-type
sequential channel numbering, IRQ_NONE for spurious interrupts
- MMIO uses custom regmap callbacks with NPI unlock in write path
- Bounds validation on DT reg values
- Oversampling exposes actual sample counts (1,2,4,8,16) to
userspace with internal HW register translation
- write_raw_get_fmt returns IIO_VAL_INT for oversampling ratio
to reject fractional input at parse time
- EN_AVG per-channel bitmask registers correctly set to all-ones
when oversampling is enabled, with error propagation
- Event channels only created when IRQ is available (I2C path has
no events since regmap cannot be called from atomic context)
- Group alarm interrupt kept active while any channel in the group
has an alarm enabled
- Hysteresis input validated to single-bit range before HW write
- Supply voltage conversion uses proper two's complement sign
extension (s16 cast) matching the hardware specification
- Named constants replace magic numbers throughout (SYSMON_REG_STRIDE,
SYSMON_SUPPLY_MANTISSA_BITS, SYSMON_ALARM_BITS_PER_REG,
SYSMON_ALARM_OFFSET, SYSMON_MILLI, BIT() for shift expressions)
- Each patch introduces only the defines, struct fields, and
includes it uses; register offsets sorted by address
- kernel-doc for exported sysmon_core_probe() and sysmon_parse_fw()
- regmap_write return values checked in probe and event config paths
- devm cleanup ordering: cancel_work registered before request_irq
so LIFO teardown frees IRQ first
- Removed cross-instance global state and region-based event
callback API (zero consumers upstream)
- MAINTAINERS entry folded into driver patch with wildcard pattern
- Thermal driver and binding deferred to follow-up series
- Secure firmware access deferred to follow-up series
- HBM SLR and I2C remote support deferred to follow-up series
Tested on VCK190 (single SLR, MMIO path, 7 supplies, 10 temperature
satellites) and VPK180 (System Controller, I2C path, 7 supplies).
A follow-up series will add thermal zone integration, secure firmware
access, and I2C remote monitoring.
Salih Erim (5):
dt-bindings: iio: adc: add xlnx,versal-sysmon binding
iio: adc: add Versal SysMon driver
iio: adc: versal-sysmon: add I2C driver
iio: adc: versal-sysmon: add threshold event support
iio: adc: versal-sysmon: add oversampling support
.../bindings/iio/adc/xlnx,versal-sysmon.yaml | 172 +++
MAINTAINERS | 7 +
drivers/iio/adc/Kconfig | 33 +
drivers/iio/adc/Makefile | 3 +
drivers/iio/adc/versal-sysmon-core.c | 994 ++++++++++++++++++
drivers/iio/adc/versal-sysmon-i2c.c | 166 +++
drivers/iio/adc/versal-sysmon.c | 94 ++
drivers/iio/adc/versal-sysmon.h | 122 +++
8 files changed, 1591 insertions(+)
create mode 100644 Documentation/devicetree/bindings/iio/adc/xlnx,versal-sysmon.yaml
create mode 100644 drivers/iio/adc/versal-sysmon-core.c
create mode 100644 drivers/iio/adc/versal-sysmon-i2c.c
create mode 100644 drivers/iio/adc/versal-sysmon.c
create mode 100644 drivers/iio/adc/versal-sysmon.h
--
2.48.1
next reply other threads:[~2026-05-02 11:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-02 11:19 Salih Erim [this message]
2026-05-02 11:19 ` [PATCH v2 1/5] dt-bindings: iio: adc: add xlnx,versal-sysmon binding Salih Erim
2026-05-02 11:19 ` [PATCH v2 2/5] iio: adc: add Versal SysMon driver Salih Erim
2026-05-02 11:19 ` [PATCH v2 3/5] iio: adc: versal-sysmon: add I2C driver Salih Erim
2026-05-02 11:19 ` [PATCH v2 4/5] iio: adc: versal-sysmon: add threshold event support Salih Erim
2026-05-02 11:19 ` [PATCH v2 5/5] iio: adc: versal-sysmon: add oversampling support Salih Erim
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=20260502111951.538488-1-salih.erim@amd.com \
--to=salih.erim@amd.com \
--cc=andy@kernel.org \
--cc=conall.ogriofa@amd.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=erimsalih@gmail.com \
--cc=git@amd.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=michal.simek@amd.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