Re: [PATCH v2 2/5] iio: adc: add Versal SysMon driver
From: Salih Erim
Date: Tue May 12 2026 - 07:37:42 EST
Hi Guenter and Jonathan,
On 5/4/2026 8:26 PM, Guenter Roeck wrote:
On 5/4/26 10:32, Jonathan Cameron wrote:
On Sat, 2 May 2026 12:19:48 +0100
Salih Erim <salih.erim@xxxxxxx> wrote:
Add the AMD/Xilinx Versal System Monitor (SysMon) IIO driver.
The driver is split into a bus-agnostic core module
(versal-sysmon-core) and a memory-mapped I/O platform driver
(versal-sysmon). The core uses the regmap API so that different
bus implementations can share the same IIO logic.
The core provides:
- Static temperature channels (current max/min, peak max/min)
- Supply voltage channels parsed from DT container nodes
- Temperature satellite channels parsed from DT container nodes
- read_raw for IIO_CHAN_INFO_RAW and IIO_CHAN_INFO_PROCESSED
- read_label using the DT label property
Various comments inline. One thing to check.
Is this one strictly a hardware monitoring device? Or does it
get used for more general ADC purposes? Did you consider an HWMON driver
for it? The above sounds a lot like hwmon. So why IIO for this one?
I wasn't awake enough on v1 to raise this! Sorry about that.
+CC Guenter and linux-hwmon for that discussion.
This very much sounds like a hardware monitoring device to me.
The device is indeed used for hardware monitoring, but the hardware
characteristics push it towards IIO:
- The predecessor (Zynq UltraScale+ AMS, xilinx-ams.c) is already
in drivers/iio/adc/ upstream. This driver is the direct successor
for the Versal generation.
- The supply voltage encoding is a modified floating-point format
with per-register exponent and format bits. This non-linear
encoding doesn't map well to hwmon's linear in*_input model.
- The device has configurable threshold events with per-channel
alarm registers, hysteresis bits, and level-sensitive interrupt
masking/unmasking -- which maps directly to the IIO event
infrastructure.
- Oversampling is hardware-configurable per channel type with
per-channel averaging enable registers.
- Up to 160 voltage and 64 temperature channels are dynamically
configured from DT, which fits IIO's dynamic channel model
better than hwmon's compile-time attribute groups.
- The follow-up thermal driver uses the IIO consumer API
(iio_channel_read) to aggregate temperature data across
multiple satellites into thermal zones. The iio-hwmon bridge
then exposes the same data to hwmon userspace.
So the architecture is: IIO driver (provider) -> iio-hwmon bridge
(hwmon exposure) + IIO consumer (thermal zones). This gives both
hwmon and thermal framework access through a single IIO provider.
Guenter
Salih.