[PATCH v3 0/5] iio: dac: ad5504: bindings, cleanups, and scale fixes

From: Taha Ed-Dafili

Date: Sat May 09 2026 - 10:22:45 EST


Hi everyone,

First, I want to sincerely apologize for the long delay between v2 and v3.
I had to step away to focus on finishing my last year studies, but I am
back now to get this series over the finish line!

This v3 series addresses the feedbacks from the v2 review,
specifically focusing on strict DT validation, dropping unnecessary
driver code, and making sure the driver works perfectly at every
individual commit.

Testing & Hardware Proof:
The series has been physically verified on an ARM64 Raspberry Pi 5 using
a custom Device Tree overlay.

The AD5504 is a 12-bit DAC. The hardware scale outputs
now perfectly match the DT inputs:

Testing the 60V path (output-range-microvolt = <0 60000000>):
$ cat /sys/bus/iio/devices/iio:device0/out_voltage_scale
14.648437500 (60000mV / 4096)

Testing the 30V path (output-range-microvolt = <0 30000000>):
$ cat /sys/bus/iio/devices/iio:device0/out_voltage_scale
7.324218750 (30000mV / 4096)

Additionally, providing invalid DT configurations (e.g., 70V) successfully
triggers the strict bounds checking and cleanly aborts the probe with
-EINVAL.

Changes in v3:

* Dropped the patch adding GPIO control for /CLR and /LDAC. As pointed out
by Nuno Sá, since the driver does not actively handle or toggle these
pins, requesting them in the driver is dead code. They remain documented
in the bindings.
* Combined the pdata removal, regulator _enable swap, and DT parsing into
a single atomic commit (Patch 5) so the driver compiles and runs cleanly
at every step of the git history.
* Restored the -ENODEV check for the regulator to maintain ACPI
compatibility.
* Implemented strict min/max array bounds validation for the
'output-range-microvolt' property.
* Included missing <linux/array_size.h>, <asm/byteorder.h>, and
<linux/kstrtox.h> headers for full IWYU compliance.
* Reordered commits to group cleanups before functional changes.
* Dropped Suggested-by tags for standard review feedback.

Changes in v2:

* Replaced vendor-specific adi,output-range-volts with the standard
output-range-microvolt property array.
* Replaced adi,output-range-gpios with standard range-sel-gpios.
* Split header updates into two patches: alphabetical sorting and IWYU
compliance.
* Used MILLI and MICRO macros to replace hardcoded values.
* Introduced a local dev pointer to respect the 80-character limit and
realigned function arguments.

Previous versions:
v2: https://lore.kernel.org/linux-iio/20260310174835.24209-1-0rayn.dev@xxxxxxxxx/
v1: https://lore.kernel.org/linux-iio/20260212181955.42724-1-0rayn.dev@xxxxxxxxx/
RFC: https://lore.kernel.org/linux-iio/20260210121032.4630-1-0rayn.dev@xxxxxxxxx/

Thank you to Jonathan Cameron, Krzysztof Kozlowski, Andy Shevchenko,
Nuno Sá, and David Lechner for the extensive reviews, schema guidance,
and C optimizations throughout this series.

Taha Ed-Dafili

Taha Ed-Dafili (5):
dt-bindings: iio: dac: ad5504: add output-range and missing gpios
iio: dac: ad5504: sort headers alphabetically
iio: dac: ad5504: Align headers with IWYU principle
iio: dac: ad5504: introduce local dev pointer
iio: dac: ad5504: fix scale via output-range-microvolt

.../bindings/iio/dac/adi,ad5504.yaml | 39 +++++++++++-
drivers/iio/dac/ad5504.c | 63 +++++++++++--------
2 files changed, 74 insertions(+), 28 deletions(-)

--
2.47.3