Add support for AD5706R DAC
Alexis Czezar Torreno
maintainerv8 cover Add support for AD5706R DAC
This series adds support for the Analog Devices AD5706R, a 4-channel 16-bit current output digital-to-analog converter with SPI interface.
The AD5706R features:
- 4 independent current output DAC channels
- Configurable output ranges (50mA, 150mA, 200mA, 300mA)
- Hardware and software LDAC trigger with configurable edge selection
- Toggle and dither modes per channel
- Internal or external voltage reference selection
- PWM-controlled LDAC
- Dynamic change SPI speed
The driver exposes standard IIO raw/scale/offset channel attributes for DAC output control, sampling frequency for PWM-based LDAC timing, and extended attributes for device configuration including output range selection, trigger mode, and multiplexer output.
This driver is developed and tested on the Cora Z7S platform using the AXI SPI Engine and AXI CLKGEN IP cores. The 'clocks' property enables dynamic SPI clock rate management via the CLKGEN.
Datasheet: https://www.analog.com/en/products/ad5706r.html
---
Changes in v8:
- driver:
- changed DAC_CODE from BIT(16) to GENMASK(15,0)
- removed defines for single/multi byte, replaced with number
- adjusted regmap_write to use if/else similar to read()
- reverted in_range back to open code equivalent, removed minmax.h
- Link to v7: https://lore.kernel.org/r/[email protected]
Changes in v7:
- driver:
- Moved/added size validation before data access in write()/read()
- Link to v6: https://lore.kernel.org/r/[email protected]
Changes in v6:
- driver:
- Added size validation in regmap_write()
- Used &st->tx_buf[0] consistently in _be32/be16 calls
- Added missing indent in AD5706R_CHAN
- Link to v5: https://lore.kernel.org/r/[email protected]
Changes in v5:
- dt-bindings:
- Changed out-en-gpios to enable-gpios
- driver:
- Kconfig: Added select REGMAP_SPI
- Headers: Removed device.h, errno.h, string.h; added dev_printk.h
- Use IIO_DMA_MINALIGN instead of ARCH_DMA_MINALIGN
- Replaced memcpy/memset with put_unaligned_be* for consistency
- Added struct device *dev shorthand in probe()
- other minor style edits
- Link to v4: https://lore.kernel.org/r/[email protected]
Changes in v4:
- dt-bindings:
- Reverted pwm and gpio entries.
- Added missing power supply properties
- Clocks not added back as they were driver specific, not device properties
- driver:
- Added missing includes
- Converted to use regmap with custom SPI bus implementation. spi_write_then_read not applied as suggested, prevents future
need to change SPI speed
- removed driver speciifc mutex/guards in favor of regmap internal locking
- Minor style cleanups
- Link to v3: https://lore.kernel.org/r/[email protected]
Changes in v3:
- Added MAINTAINERS entry, files added on each patch
- dt-bindings:
- Added allOf and ref to spi-peripheral-props.yaml
- Changed additionalProperties to unevaluatedProperties
- Added avdd-supply property and added it to required
- driver:
- Removed redundant includes, added respective includes of APIs used
- Simplified bit manipulation in SPI read/write, used feedback from v2
- Fixed inconsistent trailing commas in device ID tables
- Removed zero initialization in spi_device_id
- Link to v2: https://lore.kernel.org/r/[email protected]
Changes in v2:
- Stripped driver down to basic DAC functionality (read/write raw, read-only scale) as suggested.
- Removed PWM (LDAC), GPIO (reset/shutdown), clock generator,
SPI engine frequency switching, debugfs streaming, and all
custom ext_info sysfs attributes
- Removed regmap, IIO_BUFFER, and iio/sysfs.h dependencies
- Simplified SPI read/write to use standard spi_sync_transfer
without clock mode logic
- Scale reports default 50mA range as read-only using IIO_VAL_FRACTIONAL_LOG2; writable range selection deferred
to future follow-up series
- Simplified DT binding to only require compatible, reg, and spi-max-frequency
- Link to v1: https://lore.kernel.org/r/[email protected]
---
Alexis Czezar Torreno (2):
dt-bindings: iio: dac: Add ADI AD5706R
iio: dac: ad5706r: Add support for AD5706R DAC
.../devicetree/bindings/iio/dac/adi,ad5706r.yaml | 105 +++++++++ MAINTAINERS | 8 + drivers/iio/dac/Kconfig | 11 + drivers/iio/dac/Makefile | 1 + drivers/iio/dac/ad5706r.c | 253 +++++++++++++++++++++ 5 files changed, 378 insertions(+)
---
base-commit: 3674f3ca92730d9a07b42b311f1337d83c4d5605
change-id: 20260220-dev_ad5706r-2105e1dd29ab
Best regards,
Signature · 1 line
Alexis Czezar Torreno <[email protected]>
Alexis Czezar Torreno
maintainerPATCH v8 1/2 dt-bindings: iio: dac: Add ADI AD5706R
Add device tree binding documentation for the Analog Devices AD5706R 4-channel 16-bit current output digital-to-analog converter.
---
Changes in v5:
- Changed out-en-gpios to enable-gpios.
Changes in v4:
- Reverted pwm and gpio entries
- Added missing power supply properties
- Clocks not added back as they were driver specific
Changes in v3:
- Added allOf and ref to spi-peripheral-props.yaml
- Changed additionalProperties to unevaluatedProperties
- Added avdd-supply property and added it to required
Changes in v1:
- Removed clocks, clock-names, pwms, pwm-names, gpio properties
- Simplified example to use plain SPI bus
---
--- .../devicetree/bindings/iio/dac/adi,ad5706r.yaml | 105 +++++++++++++++++++++ MAINTAINERS | 7 ++ 2 files changed, 112 insertions(+)
Documentation/devicetree/bindings/iio/dac/adi,ad5706r.yaml new file +105 -0
@@ -0,0 +1,105 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/dac/adi,ad5706r.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices AD5706R 4-Channel Current Output DAC + +maintainers: + - Alexis Czezar Torreno <[email protected]> + +description: | + The AD5706R is a 4-channel, 16-bit resolution, current output + digital-to-analog converter (DAC) with programmable output current + ranges (50mA, 150mA, 200mA, 300mA), an integrated 2.5V voltage + reference, and load DAC, A/B toggle, and dither functions. + + Datasheet: + https://www.analog.com/en/products/ad5706r.html + +properties: + compatible: + enum: + - adi,ad5706r + + reg: + maxItems: 1 + + avdd-supply: + description: Analog power supply (2.9V to 3.6V). + + iovdd-supply: + description: Logic power supply (1.14V to 1.89V). + + pvdd0-supply: + description: Power supply for IDAC0 channel (1.65V to AVDD). + + pvdd1-supply: + description: Power supply for IDAC1 channel (1.65V to AVDD). + + pvdd2-supply: + description: Power supply for IDAC2 channel (1.65V to AVDD). + + pvdd3-supply: + description: Power supply for IDAC3 channel (1.65V to AVDD). + + vref-supply: + description: + Optional external 2.5V voltage reference. If not provided, the + internal 2.5V reference is used. + + pwms: + maxItems: 1 + description: + Optional PWM connected to the LDAC/TGP/DCK pin for hardware + triggered DAC updates, toggle, or dither clock generation. + + reset-gpios: + maxItems: 1 + description: + GPIO connected to the active low RESET pin. If not provided, + software reset is used. + + enable-gpios: + maxItems: 1 + description: + GPIO connected to the active low OUT_EN pin. Controls whether + the current outputs are enabled or in high-Z/ground state. + +required: + - compatible + - reg + - avdd-supply + - iovdd-supply + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false + +examples: + - | + #include <dt-bindings/gpio/gpio.h> + + spi { + #address-cells = <1>; + #size-cells = <0>; + + dac@0 { + compatible = "adi,ad5706r"; + reg = <0>; + avdd-supply = <&avdd>; + iovdd-supply = <&iovdd>; + pvdd0-supply = <&pvdd>; + pvdd1-supply = <&pvdd>; + pvdd2-supply = <&pvdd>; + pvdd3-supply = <&pvdd>; + vref-supply = <&vref>; + spi-max-frequency = <50000000>; + pwms = <&pwm0 0 1000000 0>; + reset-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>; + enable-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>; + }; + }; +...
MAINTAINERS +7 -0
@@ -1496,6 +1496,13 @@ W: https://ez.analog.com/linux-software-drivers F: Documentation/devicetree/bindings/iio/adc/adi,ad4851.yaml F: drivers/iio/adc/ad4851.c +ANALOG DEVICES INC AD5706R DRIVER +M: Alexis Czezar Torreno <[email protected]> +L: [email protected] +S: Supported +W: https://ez.analog.com/linux-software-drivers +F: Documentation/devicetree/bindings/iio/dac/adi,ad5706r.yaml + ANALOG DEVICES INC AD7091R DRIVER M: Marcelo Schmitt <[email protected]> L: [email protected]
Signature · 1 line
2.34.1
Alexis Czezar Torreno
maintainerPATCH v8 2/2 iio: dac: ad5706r: Add support for AD5706R DAC
In reply to Alexis Czezar TorrenoAdd support for the Analog Devices AD5706R, a 4-channel 16-bit current output digital-to-analog converter with SPI interface.
Features:
- 4 independent DAC channels
- Hardware and software LDAC trigger
- Configurable output range
- PWM-based LDAC control
- Dither and toggle modes
- Dynamically configurable SPI speed
---
Changes in v8:
- changed DAC_CODE from BIT(16) to GENMASK(15,0)
- removed defines for single/multi byte, replaced with number
- adjusted regmap_write to use if/else similar to read()
- reverted in_range back to open code equivalent, removed minmax.h
Changes in v7:
- Moved/added size validation before data access in write()/read()
Changes in v6:
- Added size validation in regmap_write()
- Used &st->tx_buf[0] consistently _be32/be16 calls
- Added missing indent in AD5706R_CHAN
Changes in v5:
- Kconfig: Added select REGMAP_SPI dependency
- Headers: Removed device.h, errno.h, string.h; added dev_printk.h
- Use IIO_DMA_MINALIGN instead of ARCH_DMA_MINALIGN
- Replaced memcpy/memset with put_unaligned_be* for consistency
- Added struct device *dev shorthand in probe()
- Added newline to error message
- Other minor style edits
Changes in v4:
- Added missing includes
- Converted to use regmap with custom SPI bus implementation
- Removed driver-specific mutex/guards in favor of regmap locking
- Minor style cleanups
Changes in v3:
- Removed redundant includes, added respective includes of APIs used
- Simplified bit manipulation in SPI read/write
- Fixed inconsistent trailing commas in device ID tables
- Removed zero initialization in spi_device_id
Changes in v2:
- Removed PWM, GPIO, clock generator, debugfs, regmap, IIO_BUFFER
- Removed all custom ext_info sysfs attributes
- Simplified to basic raw read/write and read-only scale
- SPI read/write can handle multibyte registers
---
--- MAINTAINERS | 1 + drivers/iio/dac/Kconfig | 11 ++ drivers/iio/dac/Makefile | 1 + drivers/iio/dac/ad5706r.c | 253 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 266 insertions(+)
MAINTAINERS +1 -0
@@ -1502,6 +1502,7 @@ L: [email protected] S: Supported W: https://ez.analog.com/linux-software-drivers F: Documentation/devicetree/bindings/iio/dac/adi,ad5706r.yaml +F: drivers/iio/dac/ad5706r.c ANALOG DEVICES INC AD7091R DRIVER M: Marcelo Schmitt <[email protected]>
drivers/iio/dac/Kconfig +11 -0
@@ -178,6 +178,17 @@ config AD5624R_SPI Say yes here to build support for Analog Devices AD5624R, AD5644R and AD5664R converters (DAC). This driver uses the common SPI interface. +config AD5706R + tristate "Analog Devices AD5706R DAC driver" + depends on SPI + select REGMAP_SPI + help + Say yes here to build support for Analog Devices AD5706R 4-channel, + 16-bit current output DAC. + + To compile this driver as a module, choose M here: the + module will be called ad5706r. + config AD9739A tristate "Analog Devices AD9739A RF DAC spi driver" depends on SPI
drivers/iio/dac/Makefile +1 -0
@@ -21,6 +21,7 @@ obj-$(CONFIG_AD5449) += ad5449.o obj-$(CONFIG_AD5592R_BASE) += ad5592r-base.o obj-$(CONFIG_AD5592R) += ad5592r.o obj-$(CONFIG_AD5593R) += ad5593r.o +obj-$(CONFIG_AD5706R) += ad5706r.o obj-$(CONFIG_AD5755) += ad5755.o obj-$(CONFIG_AD5758) += ad5758.o obj-$(CONFIG_AD5761) += ad5761.o
drivers/iio/dac/ad5706r.c new file +253 -0
253 lines not on this page · raw message
Signature · 1 line
2.34.1
Re: [PATCH v8 2/2] iio: dac: ad5706r: Add support for AD5706R DAC
Quoted 10 lines · Alexis Czezar Torreno
Add support for the Analog Devices AD5706R, a 4-channel 16-bit current output digital-to-analog converter with SPI interface.
Features:
- 4 independent DAC channels
- Hardware and software LDAC trigger
- Configurable output range
- PWM-based LDAC control
- Dither and toggle modes
- Dynamically configurable SPI speed
...
drivers/iio/dac/ad5706r.c line 29
Quoted 2 lines
drivers/iio/dac/ad5706r.c new file +2
-0+#define AD5706R_DAC_RESOLUTION 16 +#define AD5706R_DAC_MAX_CODE GENMASK(15, 0)
I know Jonathan asked for this, hence it's comment for him. I think that BIT() notation in a form of (BIT(16) - 1) is also appropriate here as it gives the relationship to the resolution of the given register / bitfield in HW.
GENMASK() works for me, but it might require an additional operation to deduce the above.
(Note, there is no request to change or resend for you, Alexis. It's just
a remark to make Jonathan to think about which one suits better. He might change that whilst applying.)
Signature · 2 lines
With Best Regards, Andy Shevchenko
Re: [PATCH v8 2/2] iio: dac: ad5706r: Add support for AD5706R DAC
Quoted 22 lines · On Fri, 17 Apr 2026 11:35:12 +0300 Andy Shevchenko…
Quoted 10 lines · Alexis Czezar Torreno
Add support for the Analog Devices AD5706R, a 4-channel 16-bit current output digital-to-analog converter with SPI interface.
Features:
- 4 independent DAC channels
- Hardware and software LDAC trigger
- Configurable output range
- PWM-based LDAC control
- Dither and toggle modes
- Dynamically configurable SPI speed...
drivers/iio/dac/ad5706r.c line 29
Quoted 2 lines
drivers/iio/dac/ad5706r.c new file +2
-0+#define AD5706R_DAC_RESOLUTION 16 +#define AD5706R_DAC_MAX_CODE GENMASK(15, 0)I know Jonathan asked for this, hence it's comment for him. I think that
BIT()notation in a form of (BIT(16) - 1) is also appropriate here as it gives the relationship to the resolution of the given register / bitfield in HW.
Quoted 7 lines
GENMASK()works for me, but it might require an additional operation to deduce the above.(Note, there is no request to change or resend for you, Alexis. It's just
a remark to make Jonathan to think about which one suits better. He might change that whilst applying.)
I'm not against that form. It was more being against bare BIT(16) as that was 1 greater than the maximum value it can take.
However making the relationship explicit would be even better.
#define AD5705_DAC_MAX_CODE (BIT(AD5706R_DAC_RESOLUTION) - 1)
I might tweak it when picking this up.
Re: [PATCH v8 2/2] iio: dac: ad5706r: Add support for AD5706R DAC
Quoted 3 lines · Jonathan Cameron
Quoted 1 line · On Fri, 17 Apr 2026 11:35:12 +0300 Andy Shevchenko…
On Fri, Apr 17, 2026 at 04:27:16PM +0800, Alexis Czezar Torreno wrote:
...
Quoted 15 lines
Quoted 8 lines
drivers/iio/dac/ad5706r.c line 29
Quoted 2 lines
drivers/iio/dac/ad5706r.c new file +2
-0+#define AD5706R_DAC_RESOLUTION 16 +#define AD5706R_DAC_MAX_CODE GENMASK(15, 0)I know Jonathan asked for this, hence it's comment for him. I think that
BIT()notation in a form of (BIT(16) - 1) is also appropriate here as it gives the relationship to the resolution of the given register / bitfield in HW.Quoted 7 lines
GENMASK()works for me, but it might require an additional operation to deduce the above.(Note, there is no request to change or resend for you, Alexis. It's just
a remark to make Jonathan to think about which one suits better. He might change that whilst applying.)
Quoted 5 lines
I'm not against that form. It was more being against bare BIT(16) as that was 1 greater than the maximum value it can take.
However making the relationship explicit would be even better.#define
AD5705_DAC_MAX_CODE(BIT(AD5706R_DAC_RESOLUTION)- 1)
While that's technically correct, I would still prefer an explicit number
#define AD5705_DAC_MAX_CODE (BIT(16) - 1)
Note, GENMASK() is also fine with me, this is really a minor difference.
Quoted 1 line
I might tweak it when picking this up.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Jonathan Cameron
maintainerRe: [PATCH v8 2/2] iio: dac: ad5706r: Add support for AD5706R DAC
Quoted 22 lines · On Fri, 17 Apr 2026 21:05:38 +0300 Andy Shevchenko…
Quoted 3 lines · Jonathan Cameron
Quoted 1 line · On Fri, 17 Apr 2026 11:35:12 +0300 Andy Shevchenko…
On Fri, Apr 17, 2026 at 04:27:16PM +0800, Alexis Czezar Torreno wrote:
...
Quoted 15 lines
Quoted 15 lines
drivers/iio/dac/ad5706r.c line 29
Quoted 2 lines
drivers/iio/dac/ad5706r.c new file +2
-0+#define AD5706R_DAC_RESOLUTION 16 +#define AD5706R_DAC_MAX_CODE GENMASK(15, 0)I know Jonathan asked for this, hence it's comment for him. I think that
BIT()notation in a form of (BIT(16) - 1) is also appropriate here as it gives the relationship to the resolution of the given register / bitfield in HW.
GENMASK()works for me, but it might require an additional operation to deduce the above.(Note, there is no request to change or resend for you, Alexis. It's just
a remark to make Jonathan to think about which one suits better. He might change that whilst applying.)
Quoted 7 lines
Quoted 5 lines
I'm not against that form. It was more being against bare BIT(16) as that was 1 greater than the maximum value it can take.
However making the relationship explicit would be even better.#define
AD5705_DAC_MAX_CODE(BIT(AD5706R_DAC_RESOLUTION)- 1)While that's technically correct, I would still prefer an explicit number
With the resolution stated on the line above I'd slightly prefer the explicit coupling that is lost with the number being repeated. Meh, I don't care that much.
Quoted 7 lines
#define
AD5705_DAC_MAX_CODE(BIT(16) - 1)Note,
GENMASK()is also fine with me, this is really a minor difference.Quoted 1 line
I might tweak it when picking this up.
Jonathan Cameron
maintainerRe: [PATCH v8 2/2] iio: dac: ad5706r: Add support for AD5706R DAC
In reply to Alexis Czezar TorrenoQuoted 10 lines · On Fri, 17 Apr 2026 16:27:16 +0800 Alexis Czezar Torreno…
Add support for the Analog Devices AD5706R, a 4-channel 16-bit current output digital-to-analog converter with SPI interface.
Features:
- 4 independent DAC channels
- Hardware and software LDAC trigger
- Configurable output range
- PWM-based LDAC control
- Dither and toggle modes
- Dynamically configurable SPI speed
https://sashiko.dev/#/patchset/20260417-dev_ad5706r-v8-0-ef87dff62b57%40analog.com
Sashiko correctly points out that the driver in v8 at least doesn't do a bunch of things in this list. It's a bit odd to list device features in a 1st driver patch if you haven't implemented them yet. So this needs a rewrite to say what is implemented.
Quoted 23 lines
MAINTAINERS | 1 + drivers/iio/dac/Kconfig | 11 ++ drivers/iio/dac/Makefile | 1 + drivers/iio/dac/ad5706r.c | 253 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 266 insertions(+)MAINTAINERS +1
-0@@ -1502,6 +1502,7 @@ L: [email protected] S: Supported W: https://ez.analog.com/linux-software-drivers F: Documentation/devicetree/bindings/iio/dac/adi,ad5706r.yaml +F: drivers/iio/dac/ad5706r.c ANALOG DEVICES INC AD7091R DRIVER M: Marcelo Schmitt <[email protected]>drivers/iio/dac/Kconfig +0
-0
drivers/iio/dac/Kconfig config AD5624R_SPI · line 184
Quoted 7 lines
drivers/iio/dac/Kconfig +4
-0@@ -178,6 +178,17 @@ config AD5624R_SPI Say yes here to build support for Analog Devices AD5624R, AD5644R and AD5664R converters (DAC). This driver uses the common SPI interface. +config AD5706R + tristate "Analog Devices AD5706R DAC driver" + depends on SPI + select REGMAP_SPI
Another catch for Sashiko. REGMAP_SPI isn't used as this now uses a custom regmap instead.
drivers/iio/dac/Kconfig config AD5624R_SPI · line 190
Quoted 6 lines
drivers/iio/dac/Kconfig +6
-0+ help + Say yes here to build support for Analog Devices AD5706R 4-channel, + 16-bit current output DAC. + + To compile this driver as a module, choose M here: the + module will be called ad5706r.
I think the other things it raised are either features still to come (like turning on the power) or wrong. My understanding of the use of buffers for SPI transfers is you can even use the same one for rx and tx and it shouldn't be a problem. More than possible I'm wrong on that however! :(
Jonathan