Messages in this thread |  | | From | Salih Erim <> | | Subject | [PATCH v2 0/5] iio: adc: add AMD/Xilinx Versal SysMon driver | | Date | Sat, 2 May 2026 12:19:46 +0100 |
| |
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
|  |