* [PATCH v2 00/12] New features for the AD5686 IIO driver
@ 2026-06-09 10:12 Rodrigo Alencar via B4 Relay
2026-06-09 10:12 ` [PATCH v2 01/12] dt-bindings: iio: dac: ad5696: add reset/ldac/gain gpio support Rodrigo Alencar via B4 Relay
` (11 more replies)
0 siblings, 12 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:12 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar,
Conor Dooley
This is the second series of three on updating the AD5686 driver.
Initially, a big patch series was sent:
https://lore.kernel.org/r/20260422-ad5313r-iio-support-v1-0-ed7dca001d1b@analog.com
Then, the first patch series added fixes and cleanups:
https://lore.kernel.org/linux-iio/20260524-ad5686-fixes-v7-0-b6bf395d08bd@analog.com/
This one is introducing new features:
- Consume optional reset and correct power supplies;
- LDAC GPIO handling (active-low, held low when unused);
- SPI bus sync() implementation for batching multiple transfers;
- Triggered buffer support, leveraging LDAC and sync() to flush
all channel writes atomically;
- Gain control support through the scale property.
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
Changes in v2:
- Get reset control deasserted.
- Update entire spi_transfer struct rather than individual fields.
- Replace udelay() for fsleep() in probe().
- Minor changes addressing further feedback.
- Link to v1: https://lore.kernel.org/r/20260602-ad5686-new-features-v1-0-691e01883d27@analog.com
---
Rodrigo Alencar (12):
dt-bindings: iio: dac: ad5696: add reset/ldac/gain gpio support
dt-bindings: iio: dac: ad5696: rework on power supplies
dt-bindings: iio: dac: ad5686: add reset/ldac/gain gpio support
dt-bindings: iio: dac: ad5686: rework on power supplies
iio: dac: ad5686: add support for missing power supplies
iio: dac: ad5686: consume optional reset signal
iio: dac: ad5686: add ldac gpio
iio: dac: ad5686: introduce sync operation
iio: dac: ad5686: implement new sync() op for the spi bus
iio: dac: ad5686: add triggered buffer support
iio: dac: ad5686: write_raw: use guard(mutex)()
iio: dac: ad5686: add gain control support
.../devicetree/bindings/iio/dac/adi,ad5686.yaml | 62 +++++-
.../devicetree/bindings/iio/dac/adi,ad5696.yaml | 65 +++++-
drivers/iio/dac/Kconfig | 2 +
drivers/iio/dac/ad5686-spi.c | 122 +++++++++---
drivers/iio/dac/ad5686.c | 219 +++++++++++++++++++--
drivers/iio/dac/ad5686.h | 33 +++-
drivers/iio/dac/ad5696-i2c.c | 2 +-
7 files changed, 444 insertions(+), 61 deletions(-)
---
base-commit: ae696dfa47c30016cd429b9db5e70b259b8f509e
change-id: 20260602-ad5686-new-features-e116c04bddb9
Best regards,
--
Rodrigo Alencar <rodrigo.alencar@analog.com>
^ permalink raw reply [flat|nested] 23+ messages in thread
* [PATCH v2 01/12] dt-bindings: iio: dac: ad5696: add reset/ldac/gain gpio support
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:12 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:12 ` [PATCH v2 02/12] dt-bindings: iio: dac: ad5696: rework on power supplies Rodrigo Alencar via B4 Relay
` (10 subsequent siblings)
11 siblings, 0 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:12 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar,
Conor Dooley
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add GPIO property for RESET, LDAC and GAIN pin. RESET is active-low, LDAC
is used to load DAC channels with values from input registers and GAIN
can double the voltage in output channels. The gain-gpios property is
not available to all supported parts.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
.../devicetree/bindings/iio/dac/adi,ad5696.yaml | 34 +++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
index b5a88b03dc2f..2dcc049f30e9 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
@@ -37,14 +37,45 @@ properties:
description: |
The regulator supply for DAC reference voltage.
+ reset-gpios:
+ description: Active-low RESET pin to reset the device.
+ maxItems: 1
+
+ ldac-gpios:
+ description:
+ Active-low LDAC pin used to asynchronously update the DAC channels.
+ maxItems: 1
+
+ gain-gpios:
+ description:
+ GAIN pin that sets a multiplier for the DAC output voltage. When high,
+ the DAC output voltage is multiplied by 2, otherwise it is unchanged.
+ maxItems: 1
+
required:
- compatible
- reg
-additionalProperties: false
+allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ anyOf:
+ - const: adi,ad5311r
+ - const: adi,ad5691r
+ - const: adi,ad5692r
+ - const: adi,ad5693
+ - const: adi,ad5693r
+ then:
+ properties:
+ gain-gpios: false
+
+unevaluatedProperties: false
examples:
- |
+ #include <dt-bindings/gpio/gpio.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
@@ -53,6 +84,7 @@ examples:
compatible = "adi,ad5696";
reg = <0>;
vcc-supply = <&dac_vref>;
+ ldac-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
};
};
...
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 02/12] dt-bindings: iio: dac: ad5696: rework on power supplies
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
2026-06-09 10:12 ` [PATCH v2 01/12] dt-bindings: iio: dac: ad5696: add reset/ldac/gain gpio support Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:12 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:28 ` sashiko-bot
2026-06-09 11:40 ` Rodrigo Alencar
2026-06-09 10:12 ` [PATCH v2 03/12] dt-bindings: iio: dac: ad5686: add reset/ldac/gain gpio support Rodrigo Alencar via B4 Relay
` (9 subsequent siblings)
11 siblings, 2 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:12 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar,
Conor Dooley
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add supplies for VDD, VLOGIC and VREF input voltage pins. The vcc-supply
property is deprecated, once it does not really exist as none of the
devices describe any power input with that name. VCC is also misleading as
it sounds like the input power supply, but it is being used as an external
voltage reference, which should be called VREF. Certain devices require
vref-supply to be available once an internal reference voltage is absent.
For correct operation vdd and vlogic supplies are required.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
.../devicetree/bindings/iio/dac/adi,ad5696.yaml | 31 +++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
index 2dcc049f30e9..e5fbaec4adf7 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
@@ -33,9 +33,19 @@ properties:
reg:
maxItems: 1
+ vdd-supply:
+ description: Input power supply.
+
+ vlogic-supply:
+ description: Digital power supply.
+
+ vref-supply:
+ description:
+ Reference voltage supply. If not supplied the internal reference is used.
+
vcc-supply:
- description: |
- The regulator supply for DAC reference voltage.
+ deprecated: true
+ description: Use vref-supply instead.
reset-gpios:
description: Active-low RESET pin to reset the device.
@@ -55,8 +65,21 @@ properties:
required:
- compatible
- reg
+ - vdd-supply
+ - vlogic-supply
allOf:
+ - if:
+ properties:
+ compatible:
+ contains:
+ anyOf:
+ - const: adi,ad5693
+ - const: adi,ad5694
+ - const: adi,ad5696
+ then:
+ required:
+ - vref-supply
- if:
properties:
compatible:
@@ -83,7 +106,9 @@ examples:
ad5696: dac@0 {
compatible = "adi,ad5696";
reg = <0>;
- vcc-supply = <&dac_vref>;
+ vdd-supply = <&dac_vdd>;
+ vlogic-supply = <&dac_vlogic>;
+ vref-supply = <&dac_vref>;
ldac-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
};
};
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 03/12] dt-bindings: iio: dac: ad5686: add reset/ldac/gain gpio support
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
2026-06-09 10:12 ` [PATCH v2 01/12] dt-bindings: iio: dac: ad5696: add reset/ldac/gain gpio support Rodrigo Alencar via B4 Relay
2026-06-09 10:12 ` [PATCH v2 02/12] dt-bindings: iio: dac: ad5696: rework on power supplies Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:12 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:12 ` [PATCH v2 04/12] dt-bindings: iio: dac: ad5686: rework on power supplies Rodrigo Alencar via B4 Relay
` (8 subsequent siblings)
11 siblings, 0 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:12 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar,
Conor Dooley
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add GPIO property for RESET, LDAC and GAIN pin. RESET is active-low, LDAC
is used to load DAC channels with values from input registers and GAIN
can double the voltage in output channels. The gain-gpios property is
not available to all supported parts.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
.../devicetree/bindings/iio/dac/adi,ad5686.yaml | 31 ++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
index 713f535bb33a..4680d4753dd4 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
@@ -35,17 +35,46 @@ properties:
vcc-supply:
description: If not supplied the internal reference is used.
+ reset-gpios:
+ description: Active-low RESET pin to reset the device.
+ maxItems: 1
+
+ ldac-gpios:
+ description:
+ Active-low LDAC pin used to asynchronously update the DAC channels.
+ maxItems: 1
+
+ gain-gpios:
+ description:
+ GAIN pin that sets a multiplier for the DAC output voltage. When high,
+ the DAC output voltage is multiplied by 2, otherwise it is unchanged.
+ maxItems: 1
+
required:
- compatible
- reg
allOf:
- $ref: /schemas/spi/spi-peripheral-props.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ anyOf:
+ - const: adi,ad5310r
+ - const: adi,ad5681r
+ - const: adi,ad5682r
+ - const: adi,ad5683
+ - const: adi,ad5683r
+ then:
+ properties:
+ gain-gpios: false
unevaluatedProperties: false
examples:
- |
+ #include <dt-bindings/gpio/gpio.h>
spi {
#address-cells = <1>;
#size-cells = <0>;
@@ -53,6 +82,8 @@ examples:
reg = <0>;
compatible = "adi,ad5310r";
vcc-supply = <&dac_vref0>;
+ reset-gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
+ ldac-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
};
};
...
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 04/12] dt-bindings: iio: dac: ad5686: rework on power supplies
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
` (2 preceding siblings ...)
2026-06-09 10:12 ` [PATCH v2 03/12] dt-bindings: iio: dac: ad5686: add reset/ldac/gain gpio support Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:12 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:22 ` sashiko-bot
2026-06-09 10:13 ` [PATCH v2 05/12] iio: dac: ad5686: add support for missing " Rodrigo Alencar via B4 Relay
` (7 subsequent siblings)
11 siblings, 1 reply; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:12 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar,
Conor Dooley
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add supplies for VDD, VLOGIC and VREF input voltage pins. The vcc-supply
property is deprecated, once it does not really exist as none of the
devices describe any power input with that name. VCC is also misleading as
it sounds like the input power supply, but it is being used as an external
voltage reference, which should be called VREF. Certain devices require
vref-supply to be available once an internal reference voltage is absent.
For correct operation vdd and vlogic supplies are required.
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
.../devicetree/bindings/iio/dac/adi,ad5686.yaml | 31 ++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
index 4680d4753dd4..2abdbf325392 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
@@ -32,8 +32,19 @@ properties:
reg:
maxItems: 1
+ vdd-supply:
+ description: Input power supply.
+
+ vlogic-supply:
+ description: Digital power supply.
+
+ vref-supply:
+ description:
+ Reference voltage supply. If not supplied the internal reference is used.
+
vcc-supply:
- description: If not supplied the internal reference is used.
+ deprecated: true
+ description: Use vref-supply instead.
reset-gpios:
description: Active-low RESET pin to reset the device.
@@ -53,9 +64,23 @@ properties:
required:
- compatible
- reg
+ - vdd-supply
+ - vlogic-supply
allOf:
- $ref: /schemas/spi/spi-peripheral-props.yaml#
+ - if:
+ properties:
+ compatible:
+ contains:
+ anyOf:
+ - const: adi,ad5676
+ - const: adi,ad5683
+ - const: adi,ad5684
+ - const: adi,ad5686
+ then:
+ required:
+ - vref-supply
- if:
properties:
compatible:
@@ -81,7 +106,9 @@ examples:
dac@0 {
reg = <0>;
compatible = "adi,ad5310r";
- vcc-supply = <&dac_vref0>;
+ vdd-supply = <&dac_vdd>;
+ vlogic-supply = <&dac_vlogic>;
+ vref-supply = <&dac_vref>;
reset-gpios = <&gpio0 0 GPIO_ACTIVE_LOW>;
ldac-gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
};
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 05/12] iio: dac: ad5686: add support for missing power supplies
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
` (3 preceding siblings ...)
2026-06-09 10:12 ` [PATCH v2 04/12] dt-bindings: iio: dac: ad5686: rework on power supplies Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:13 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 06/12] iio: dac: ad5686: consume optional reset signal Rodrigo Alencar via B4 Relay
` (6 subsequent siblings)
11 siblings, 0 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:13 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Get and enable regulators for vdd, vlogic and vref input power pins. Vdd
is the input power supply, while vlogic powers the digital side. vref is
replacing vcc, which is being deprecated, but still supported. The value
of vref_mv is checked so that a device without internal voltage reference
cannot proceed without an explicit supply. For correct operation, vdd and
vlogic are required, then devm_regulator_get_enable() is used so the
driver can still work without them by using the stub/dummy regulators.
Error report uses dev_err_probe(), which helps debugging an init issue.
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/dac/ad5686.c | 21 +++++++++++++++++++--
1 file changed, 19 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index 5840fda4b011..fc3863274b29 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -8,6 +8,8 @@
#include <linux/array_size.h>
#include <linux/bitfield.h>
#include <linux/bitops.h>
+#include <linux/delay.h>
+#include <linux/dev_printk.h>
#include <linux/errno.h>
#include <linux/export.h>
#include <linux/kstrtox.h>
@@ -484,12 +486,27 @@ int ad5686_probe(struct device *dev,
st->ops = ops;
st->chip_info = chip_info;
- ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
+ ret = devm_regulator_get_enable(dev, "vdd");
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to enable vdd supply\n");
+
+ ret = devm_regulator_get_enable(dev, "vlogic");
+ if (ret)
+ return dev_err_probe(dev, ret, "failed to enable vlogic supply\n");
+
+ ret = devm_regulator_get_enable_read_voltage(dev, "vref");
+ if (ret == -ENODEV) /* vcc-supply is deprecated, but supported still */
+ ret = devm_regulator_get_enable_read_voltage(dev, "vcc");
if (ret < 0 && ret != -ENODEV)
- return ret;
+ return dev_err_probe(dev, ret, "failed to read vref voltage\n");
st->use_internal_vref = ret == -ENODEV;
st->vref_mv = st->use_internal_vref ? st->chip_info->int_vref_mv : ret / 1000;
+ if (!st->vref_mv)
+ return dev_err_probe(dev, -EINVAL,
+ "invalid or not provided vref voltage\n");
+
+ fsleep(5); /* power-up time */
/* Initialize masks to all ones */
st->pwr_down_mask = ~0;
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 06/12] iio: dac: ad5686: consume optional reset signal
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
` (4 preceding siblings ...)
2026-06-09 10:13 ` [PATCH v2 05/12] iio: dac: ad5686: add support for missing " Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:13 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:29 ` sashiko-bot
2026-06-09 11:17 ` Rodrigo Alencar
2026-06-09 10:13 ` [PATCH v2 07/12] iio: dac: ad5686: add ldac gpio Rodrigo Alencar via B4 Relay
` (5 subsequent siblings)
11 siblings, 2 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:13 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add RESET pin GPIO support through an optional reset control, which is
local to the probe function. Also, include delay for the required reset
pulse width.
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/dac/ad5686.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index fc3863274b29..700798b80f04 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -15,6 +15,7 @@
#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/regulator/consumer.h>
+#include <linux/reset.h>
#include <linux/sysfs.h>
#include <linux/wordpart.h>
@@ -472,6 +473,7 @@ int ad5686_probe(struct device *dev,
const struct ad5686_chip_info *chip_info,
const char *name, const struct ad5686_bus_ops *ops)
{
+ struct reset_control *rstc;
struct ad5686_state *st;
struct iio_dev *indio_dev;
int ret, i;
@@ -506,7 +508,15 @@ int ad5686_probe(struct device *dev,
return dev_err_probe(dev, -EINVAL,
"invalid or not provided vref voltage\n");
+ rstc = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
+ if (IS_ERR(rstc))
+ return dev_err_probe(dev, PTR_ERR(rstc),
+ "Failed to get reset control\n");
+
fsleep(5); /* power-up time */
+ reset_control_assert(rstc);
+ fsleep(1); /* reset pulse: comfortably bigger than the spec */
+ reset_control_deassert(rstc);
/* Initialize masks to all ones */
st->pwr_down_mask = ~0;
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 07/12] iio: dac: ad5686: add ldac gpio
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
` (5 preceding siblings ...)
2026-06-09 10:13 ` [PATCH v2 06/12] iio: dac: ad5686: consume optional reset signal Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:13 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 08/12] iio: dac: ad5686: introduce sync operation Rodrigo Alencar via B4 Relay
` (4 subsequent siblings)
11 siblings, 0 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:13 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
If wired LDAC, should be held low when unused (pin is active-low), which
allows for synchronous DAC updates. This will be used to update all the
channels at the same time when adding buffer support.
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/dac/ad5686.c | 6 ++++++
drivers/iio/dac/ad5686.h | 3 +++
2 files changed, 9 insertions(+)
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index 700798b80f04..db37c3e50389 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -12,6 +12,7 @@
#include <linux/dev_printk.h>
#include <linux/errno.h>
#include <linux/export.h>
+#include <linux/gpio/consumer.h>
#include <linux/kstrtox.h>
#include <linux/module.h>
#include <linux/regulator/consumer.h>
@@ -513,6 +514,11 @@ int ad5686_probe(struct device *dev,
return dev_err_probe(dev, PTR_ERR(rstc),
"Failed to get reset control\n");
+ st->ldac_gpio = devm_gpiod_get_optional(dev, "ldac", GPIOD_OUT_HIGH);
+ if (IS_ERR(st->ldac_gpio))
+ return dev_err_probe(dev, PTR_ERR(st->ldac_gpio),
+ "Failed to get LDAC GPIO\n");
+
fsleep(5); /* power-up time */
reset_control_assert(rstc);
fsleep(1); /* reset pulse: comfortably bigger than the spec */
diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
index a06fe7d89305..f3110410d89b 100644
--- a/drivers/iio/dac/ad5686.h
+++ b/drivers/iio/dac/ad5686.h
@@ -60,6 +60,7 @@ enum ad5686_regmap_type {
AD5686_REGMAP,
};
+struct gpio_desc;
struct ad5686_state;
/**
@@ -119,6 +120,7 @@ extern const struct ad5686_chip_info ad5679r_chip_info;
* @dev: device instance
* @chip_info: chip model specific constants, available modes etc
* @ops: bus specific operations
+ * @ldac_gpio: LDAC pin GPIO descriptor
* @vref_mv: actual reference voltage used
* @pwr_down_mask: power down mask
* @pwr_down_mode: current power down mode
@@ -131,6 +133,7 @@ struct ad5686_state {
struct device *dev;
const struct ad5686_chip_info *chip_info;
const struct ad5686_bus_ops *ops;
+ struct gpio_desc *ldac_gpio;
unsigned short vref_mv;
unsigned int pwr_down_mask;
unsigned int pwr_down_mode;
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 08/12] iio: dac: ad5686: introduce sync operation
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
` (6 preceding siblings ...)
2026-06-09 10:13 ` [PATCH v2 07/12] iio: dac: ad5686: add ldac gpio Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:13 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 09/12] iio: dac: ad5686: implement new sync() op for the spi bus Rodrigo Alencar via B4 Relay
` (3 subsequent siblings)
11 siblings, 0 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:13 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Add sync() to operation to ad5686_bus_ops, which can be used to flush
multiple pending data transfers at once. This is going to be used when
implementing triggered buffer support.
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/dac/ad5686.h | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
index f3110410d89b..1da5f1b4d52a 100644
--- a/drivers/iio/dac/ad5686.h
+++ b/drivers/iio/dac/ad5686.h
@@ -67,10 +67,12 @@ struct ad5686_state;
* struct ad5686_bus_ops - bus specific read/write operations
* @read: read a register value at the given address
* @write: write a command, address and value to the device
+ * @sync: ensure the completion of the write operation (optional)
*/
struct ad5686_bus_ops {
int (*read)(struct ad5686_state *st, u8 addr);
int (*write)(struct ad5686_state *st, u8 cmd, u8 addr, u16 val);
+ int (*sync)(struct ad5686_state *st);
};
/**
@@ -159,7 +161,13 @@ int ad5686_probe(struct device *dev,
static inline int ad5686_write(struct ad5686_state *st, u8 cmd, u8 addr, u16 val)
{
- return st->ops->write(st, cmd, addr, val);
+ int ret;
+
+ ret = st->ops->write(st, cmd, addr, val);
+ if (ret)
+ return ret;
+
+ return st->ops->sync ? st->ops->sync(st) : 0;
}
static inline int ad5686_read(struct ad5686_state *st, u8 addr)
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 09/12] iio: dac: ad5686: implement new sync() op for the spi bus
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
` (7 preceding siblings ...)
2026-06-09 10:13 ` [PATCH v2 08/12] iio: dac: ad5686: introduce sync operation Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:13 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 10/12] iio: dac: ad5686: add triggered buffer support Rodrigo Alencar via B4 Relay
` (2 subsequent siblings)
11 siblings, 0 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:13 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Use of local SPI bus data to manage a collection of SPI transfers and
flush them to the SPI platform driver with the sync() operation. This
allows for faster handling of multiple channel DAC writes, avoiding kernel
overhead per spi_sync() call, which will be helpful when enabling
triggered buffer support.
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/dac/ad5686-spi.c | 122 ++++++++++++++++++++++++++++++++-----------
drivers/iio/dac/ad5686.c | 4 +-
drivers/iio/dac/ad5686.h | 8 ++-
drivers/iio/dac/ad5696-i2c.c | 2 +-
4 files changed, 101 insertions(+), 35 deletions(-)
diff --git a/drivers/iio/dac/ad5686-spi.c b/drivers/iio/dac/ad5686-spi.c
index 6b6ef1d7071f..6f6809031880 100644
--- a/drivers/iio/dac/ad5686-spi.c
+++ b/drivers/iio/dac/ad5686-spi.c
@@ -12,59 +12,91 @@
#include <linux/errno.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
+#include <linux/overflow.h>
#include <linux/spi/spi.h>
#include <asm/byteorder.h>
#include "ad5686.h"
+/**
+ * struct ad5686_spi_data - SPI bus specific data
+ * @msg: SPI message used for transfers
+ * @size: number of transfers currently in the message
+ * @capacity: maximum number of transfers that can be added to the message
+ * @xfers: array of SPI transfers, allocated with the provided capacity
+ */
+struct ad5686_spi_data {
+ struct spi_message msg;
+ unsigned int size;
+ unsigned int capacity;
+ struct spi_transfer xfers[] __counted_by(capacity);
+};
+
static int ad5686_spi_write(struct ad5686_state *st,
u8 cmd, u8 addr, u16 val)
{
- struct spi_device *spi = to_spi_device(st->dev);
- u8 tx_len, *buf;
+ struct ad5686_spi_data *bus_data = st->bus_data;
+ struct spi_transfer *xfer;
+ if (bus_data->size >= bus_data->capacity)
+ return -E2BIG;
+
+ if (bus_data->size)
+ bus_data->xfers[bus_data->size - 1].cs_change = 1;
+ else
+ spi_message_init(&bus_data->msg);
+
+ xfer = &bus_data->xfers[bus_data->size];
switch (st->chip_info->regmap_type) {
case AD5310_REGMAP:
- st->data[0].d16 = cpu_to_be16(AD5310_CMD(cmd) |
- val);
- buf = &st->data[0].d8[0];
- tx_len = 2;
+ st->data[bus_data->size].d16 =
+ cpu_to_be16(AD5310_CMD(cmd) | val);
+ *xfer = (struct spi_transfer) {
+ .tx_buf = &st->data[bus_data->size].d16,
+ .len = sizeof(st->data[bus_data->size].d16),
+ };
break;
case AD5683_REGMAP:
- st->data[0].d32 = cpu_to_be32(AD5686_CMD(cmd) |
- AD5683_DATA(val));
- buf = &st->data[0].d8[1];
- tx_len = 3;
+ st->data[bus_data->size].d32 =
+ cpu_to_be32(AD5686_CMD(cmd) | AD5683_DATA(val));
+ *xfer = (struct spi_transfer) {
+ .tx_buf = &st->data[bus_data->size].d8[1],
+ .len = sizeof(st->data[bus_data->size].d32) - 1,
+ };
break;
case AD5686_REGMAP:
- st->data[0].d32 = cpu_to_be32(AD5686_CMD(cmd) |
- AD5686_ADDR(addr) |
- val);
- buf = &st->data[0].d8[1];
- tx_len = 3;
+ st->data[bus_data->size].d32 =
+ cpu_to_be32(AD5686_CMD(cmd) | AD5686_ADDR(addr) | val);
+ *xfer = (struct spi_transfer) {
+ .tx_buf = &st->data[bus_data->size].d8[1],
+ .len = sizeof(st->data[bus_data->size].d32) - 1,
+ };
break;
default:
return -EINVAL;
}
- return spi_write(spi, buf, tx_len);
+ spi_message_add_tail(xfer, &bus_data->msg);
+ bus_data->size++;
+
+ return 0;
+}
+
+static int ad5686_spi_sync(struct ad5686_state *st)
+{
+ struct spi_device *spi = to_spi_device(st->dev);
+ struct ad5686_spi_data *bus_data = st->bus_data;
+
+ bus_data->size = 0; /* always reset, even on sync failure */
+ return spi_sync(spi, &bus_data->msg);
}
static int ad5686_spi_read(struct ad5686_state *st, u8 addr)
{
- struct spi_transfer t[] = {
- {
- .tx_buf = &st->data[0].d8[1],
- .len = 3,
- .cs_change = 1,
- }, {
- .tx_buf = &st->data[1].d8[1],
- .rx_buf = &st->data[2].d8[1],
- .len = 3,
- },
- };
struct spi_device *spi = to_spi_device(st->dev);
+ struct ad5686_spi_data *bus_data = st->bus_data;
+ struct spi_transfer *xfer = &bus_data->xfers[0];
u8 cmd = 0;
int ret;
@@ -85,8 +117,21 @@ static int ad5686_spi_read(struct ad5686_state *st, u8 addr)
AD5686_ADDR(addr));
st->data[1].d32 = cpu_to_be32(AD5686_CMD(AD5686_CMD_NOOP));
- ret = spi_sync_transfer(spi, t, ARRAY_SIZE(t));
- if (ret < 0)
+ xfer[0] = (struct spi_transfer) {
+ .tx_buf = &st->data[0].d8[1],
+ .len = sizeof(st->data[0].d32) - 1,
+ .cs_change = 1,
+ };
+ xfer[1] = (struct spi_transfer) {
+ .tx_buf = &st->data[1].d8[1],
+ .rx_buf = &st->data[2].d8[1],
+ .len = sizeof(st->data[1].d32) - 1,
+ };
+
+ spi_message_init_with_transfers(&bus_data->msg, xfer, 2);
+
+ ret = spi_sync(spi, &bus_data->msg);
+ if (ret)
return ret;
return be32_to_cpu(st->data[2].d32);
@@ -95,12 +140,27 @@ static int ad5686_spi_read(struct ad5686_state *st, u8 addr)
static const struct ad5686_bus_ops ad5686_spi_ops = {
.write = ad5686_spi_write,
.read = ad5686_spi_read,
+ .sync = ad5686_spi_sync,
};
static int ad5686_spi_probe(struct spi_device *spi)
{
- return ad5686_probe(&spi->dev, spi_get_device_match_data(spi),
- spi->modalias, &ad5686_spi_ops);
+ const struct ad5686_chip_info *info = spi_get_device_match_data(spi);
+ struct ad5686_spi_data *bus_data;
+ unsigned int capacity;
+
+ /* read operation requires at least 2 transfers */
+ capacity = max(info->num_channels, 2);
+ bus_data = devm_kzalloc(&spi->dev,
+ struct_size(bus_data, xfers, capacity),
+ GFP_KERNEL);
+ if (!bus_data)
+ return -ENOMEM;
+
+ bus_data->capacity = capacity;
+
+ return ad5686_probe(&spi->dev, info, spi->modalias, &ad5686_spi_ops,
+ bus_data);
}
static const struct spi_device_id ad5686_spi_id[] = {
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index db37c3e50389..4243d8052550 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -472,7 +472,8 @@ EXPORT_SYMBOL_NS_GPL(ad5679r_chip_info, "IIO_AD5686");
int ad5686_probe(struct device *dev,
const struct ad5686_chip_info *chip_info,
- const char *name, const struct ad5686_bus_ops *ops)
+ const char *name, const struct ad5686_bus_ops *ops,
+ void *bus_data)
{
struct reset_control *rstc;
struct ad5686_state *st;
@@ -487,6 +488,7 @@ int ad5686_probe(struct device *dev,
st->dev = dev;
st->ops = ops;
+ st->bus_data = bus_data;
st->chip_info = chip_info;
ret = devm_regulator_get_enable(dev, "vdd");
diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
index 1da5f1b4d52a..6f47493906d4 100644
--- a/drivers/iio/dac/ad5686.h
+++ b/drivers/iio/dac/ad5686.h
@@ -23,6 +23,7 @@
#define AD5686_ADDR_DAC(chan) (0x1 << (chan))
#define AD5686_ADDR_ALL_DAC 0xF
+#define AD5686_MAX_CHANNELS 16
#define AD5686_CMD_NOOP 0x0
#define AD5686_CMD_WRITE_INPUT_N 0x1
@@ -129,6 +130,7 @@ extern const struct ad5686_chip_info ad5679r_chip_info;
* @use_internal_vref: set to true if the internal reference voltage is used
* @lock: lock to protect access to state fields, which includes
* the data buffer during regmap ops
+ * @bus_data: bus specific data
* @data: transfer buffers
*/
struct ad5686_state {
@@ -141,6 +143,7 @@ struct ad5686_state {
unsigned int pwr_down_mode;
bool use_internal_vref;
struct mutex lock;
+ void *bus_data;
/*
* DMA (thus cache coherency maintenance) may require the
@@ -151,13 +154,14 @@ struct ad5686_state {
__be32 d32;
__be16 d16;
u8 d8[4];
- } data[3] __aligned(IIO_DMA_MINALIGN);
+ } data[AD5686_MAX_CHANNELS] __aligned(IIO_DMA_MINALIGN);
};
int ad5686_probe(struct device *dev,
const struct ad5686_chip_info *chip_info,
- const char *name, const struct ad5686_bus_ops *ops);
+ const char *name, const struct ad5686_bus_ops *ops,
+ void *bus_data);
static inline int ad5686_write(struct ad5686_state *st, u8 cmd, u8 addr, u16 val)
{
diff --git a/drivers/iio/dac/ad5696-i2c.c b/drivers/iio/dac/ad5696-i2c.c
index 279309329b64..28c97ded43ce 100644
--- a/drivers/iio/dac/ad5696-i2c.c
+++ b/drivers/iio/dac/ad5696-i2c.c
@@ -70,7 +70,7 @@ static const struct ad5686_bus_ops ad5686_i2c_ops = {
static int ad5686_i2c_probe(struct i2c_client *i2c)
{
return ad5686_probe(&i2c->dev, i2c_get_match_data(i2c),
- i2c->name, &ad5686_i2c_ops);
+ i2c->name, &ad5686_i2c_ops, NULL);
}
static const struct i2c_device_id ad5686_i2c_id[] = {
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 10/12] iio: dac: ad5686: add triggered buffer support
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
` (8 preceding siblings ...)
2026-06-09 10:13 ` [PATCH v2 09/12] iio: dac: ad5686: implement new sync() op for the spi bus Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:13 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 11/12] iio: dac: ad5686: write_raw: use guard(mutex)() Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 12/12] iio: dac: ad5686: add gain control support Rodrigo Alencar via B4 Relay
11 siblings, 0 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:13 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Implement trigger handler by leveraging the LDAC gpio to update all DAC
channels at once when it is available. Also, the multiple channel writes
can be flushed at once with the sync() operation.
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/dac/Kconfig | 2 ++
drivers/iio/dac/ad5686.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 68 insertions(+)
diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
index 657c68e75542..5f14fcd780e2 100644
--- a/drivers/iio/dac/Kconfig
+++ b/drivers/iio/dac/Kconfig
@@ -240,6 +240,8 @@ config LTC2688
config AD5686
tristate
+ select IIO_BUFFER
+ select IIO_TRIGGERED_BUFFER
config AD5686_SPI
tristate "Analog Devices AD5686 and similar multi-channel DACs (SPI)"
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index 4243d8052550..487c61fbe5ab 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -20,7 +20,11 @@
#include <linux/sysfs.h>
#include <linux/wordpart.h>
+#include <linux/iio/buffer.h>
#include <linux/iio/iio.h>
+#include <linux/iio/trigger.h>
+#include <linux/iio/trigger_consumer.h>
+#include <linux/iio/triggered_buffer.h>
#include "ad5686.h"
@@ -246,6 +250,7 @@ static const struct iio_chan_spec_ext_info ad5686_ext_info[] = {
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),\
.address = addr, \
+ .scan_index = chan, \
.scan_type = { \
.sign = 'u', \
.realbits = (bits), \
@@ -470,6 +475,60 @@ const struct ad5686_chip_info ad5679r_chip_info = {
};
EXPORT_SYMBOL_NS_GPL(ad5679r_chip_info, "IIO_AD5686");
+static irqreturn_t ad5686_trigger_handler(int irq, void *p)
+{
+ struct iio_poll_func *pf = p;
+ struct iio_dev *indio_dev = pf->indio_dev;
+ struct iio_buffer *buffer = indio_dev->buffer;
+ struct ad5686_state *st = iio_priv(indio_dev);
+ u16 val[AD5686_MAX_CHANNELS] = { };
+ unsigned int scan_count;
+ int ret, ch, i = 0;
+ bool async_update;
+ u8 cmd;
+
+ ret = iio_pop_from_buffer(buffer, val);
+ if (ret)
+ goto out_notify_done;
+
+ mutex_lock(&st->lock);
+
+ scan_count = bitmap_weight(indio_dev->active_scan_mask,
+ iio_get_masklength(indio_dev));
+ async_update = st->ldac_gpio && scan_count > 1;
+ if (async_update) {
+ /* use LDAC to update all channels simultaneously */
+ cmd = AD5686_CMD_WRITE_INPUT_N;
+ gpiod_set_value_cansleep(st->ldac_gpio, 0);
+ } else {
+ cmd = AD5686_CMD_WRITE_INPUT_N_UPDATE_N;
+ }
+
+ iio_for_each_active_channel(indio_dev, ch) {
+ ret = st->ops->write(st, cmd, indio_dev->channels[ch].address, val[i++]);
+ if (ret)
+ break;
+ }
+
+ /*
+ * If sync() is available, it is called here regardless of write
+ * failure to allow bus implementation to reset. In that case, partial
+ * writes are unlikely as the write operations would just queue up
+ * the transfers.
+ */
+ if (st->ops->sync)
+ ret = st->ops->sync(st); /* flush all pending transfers */
+
+ if (async_update)
+ gpiod_set_value_cansleep(st->ldac_gpio, 1);
+
+ mutex_unlock(&st->lock);
+out_notify_done:
+ iio_trigger_notify_done(indio_dev->trig);
+
+ return IRQ_HANDLED;
+}
+
int ad5686_probe(struct device *dev,
const struct ad5686_chip_info *chip_info,
const char *name, const struct ad5686_bus_ops *ops,
@@ -569,6 +628,13 @@ int ad5686_probe(struct device *dev,
return -EINVAL;
}
+ ret = devm_iio_triggered_buffer_setup_ext(dev, indio_dev, NULL,
+ &ad5686_trigger_handler,
+ IIO_BUFFER_DIRECTION_OUT,
+ NULL, NULL);
+ if (ret)
+ return ret;
+
return devm_iio_device_register(dev, indio_dev);
}
EXPORT_SYMBOL_NS_GPL(ad5686_probe, "IIO_AD5686");
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 11/12] iio: dac: ad5686: write_raw: use guard(mutex)()
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
` (9 preceding siblings ...)
2026-06-09 10:13 ` [PATCH v2 10/12] iio: dac: ad5686: add triggered buffer support Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:13 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:26 ` Joshua Crofts
2026-06-09 10:13 ` [PATCH v2 12/12] iio: dac: ad5686: add gain control support Rodrigo Alencar via B4 Relay
11 siblings, 1 reply; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:13 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Use guarded mutex lock to facilitate code review when adding new
attributes. This will allow for early returns, avoiding error-prone
locking and unlocking in error paths. Gain-control support will add
the scale attribute.
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/dac/ad5686.c | 14 +++++---------
1 file changed, 5 insertions(+), 9 deletions(-)
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index 487c61fbe5ab..d9022c6a3201 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -206,23 +206,19 @@ static int ad5686_write_raw(struct iio_dev *indio_dev,
long mask)
{
struct ad5686_state *st = iio_priv(indio_dev);
- int ret;
+
+ guard(mutex)(&st->lock);
switch (mask) {
case IIO_CHAN_INFO_RAW:
if (val >= (1 << chan->scan_type.realbits) || val < 0)
return -EINVAL;
- mutex_lock(&st->lock);
- ret = ad5686_write(st, AD5686_CMD_WRITE_INPUT_N_UPDATE_N,
- chan->address, val << chan->scan_type.shift);
- mutex_unlock(&st->lock);
- break;
+ return ad5686_write(st, AD5686_CMD_WRITE_INPUT_N_UPDATE_N,
+ chan->address, val << chan->scan_type.shift);
default:
- ret = -EINVAL;
+ return -EINVAL;
}
-
- return ret;
}
static const struct iio_info ad5686_info = {
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* [PATCH v2 12/12] iio: dac: ad5686: add gain control support
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
` (10 preceding siblings ...)
2026-06-09 10:13 ` [PATCH v2 11/12] iio: dac: ad5686: write_raw: use guard(mutex)() Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:13 ` Rodrigo Alencar via B4 Relay
2026-06-09 10:37 ` sashiko-bot
2026-06-09 11:10 ` Rodrigo Alencar
11 siblings, 2 replies; 23+ messages in thread
From: Rodrigo Alencar via B4 Relay @ 2026-06-09 10:13 UTC (permalink / raw)
To: Michael Auchter, linux, linux-iio, devicetree, linux-kernel,
linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Rodrigo Alencar
From: Rodrigo Alencar <rodrigo.alencar@analog.com>
Most of the supported devices rely on a GAIN pin to control a 2x
multiplier applied to the output voltage. Other devices, e.g. the
single-channel ones, provides a gain control through a bit field in the
control register. Some designs might have the GAIN pin hardwired to
VDD/VLOGIC or GND, which would still be fine for this patch, that allows
the scale property to be configurable with two available options.
vref_mv field is moved down in the ad5686_state struct, so that
overall size increase is reduced.
Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
drivers/iio/dac/ad5686.c | 96 +++++++++++++++++++++++++++++++++++++++++++++---
drivers/iio/dac/ad5686.h | 12 +++++-
2 files changed, 101 insertions(+), 7 deletions(-)
diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
index d9022c6a3201..d49390af71f9 100644
--- a/drivers/iio/dac/ad5686.c
+++ b/drivers/iio/dac/ad5686.c
@@ -14,10 +14,12 @@
#include <linux/export.h>
#include <linux/gpio/consumer.h>
#include <linux/kstrtox.h>
+#include <linux/math64.h>
#include <linux/module.h>
#include <linux/regulator/consumer.h>
#include <linux/reset.h>
#include <linux/sysfs.h>
+#include <linux/units.h>
#include <linux/wordpart.h>
#include <linux/iio/buffer.h>
@@ -40,7 +42,8 @@ static int ad5310_control_sync(struct ad5686_state *st)
return ad5686_write(st, AD5686_CMD_CONTROL_REG, 0,
FIELD_PREP(AD5310_PD_MSK, pd_val & AD5686_PD_MSK) |
- FIELD_PREP(AD5310_REF_BIT_MSK, st->use_internal_vref ? 0 : 1));
+ FIELD_PREP(AD5310_REF_BIT_MSK, st->use_internal_vref ? 0 : 1) |
+ FIELD_PREP(AD5310_GAIN_BIT_MSK, st->double_scale ? 1 : 0));
}
static int ad5683_control_sync(struct ad5686_state *st)
@@ -49,7 +52,8 @@ static int ad5683_control_sync(struct ad5686_state *st)
return ad5686_write(st, AD5686_CMD_CONTROL_REG, 0,
FIELD_PREP(AD5683_PD_MSK, pd_val & AD5686_PD_MSK) |
- FIELD_PREP(AD5683_REF_BIT_MSK, st->use_internal_vref ? 0 : 1));
+ FIELD_PREP(AD5683_REF_BIT_MSK, st->use_internal_vref ? 0 : 1) |
+ FIELD_PREP(AD5683_GAIN_BIT_MSK, st->double_scale ? 1 : 0));
}
static inline unsigned int ad5686_pd_mask_shift(const struct iio_chan_spec *chan)
@@ -192,9 +196,14 @@ static int ad5686_read_raw(struct iio_dev *indio_dev,
GENMASK(chan->scan_type.realbits - 1, 0);
return IIO_VAL_INT;
case IIO_CHAN_INFO_SCALE:
- *val = st->vref_mv;
- *val2 = chan->scan_type.realbits;
- return IIO_VAL_FRACTIONAL_LOG2;
+ if (st->double_scale) {
+ *val = st->scale_avail[2];
+ *val2 = st->scale_avail[3];
+ } else {
+ *val = st->scale_avail[0];
+ *val2 = st->scale_avail[1];
+ }
+ return IIO_VAL_INT_PLUS_NANO;
}
return -EINVAL;
}
@@ -216,6 +225,63 @@ static int ad5686_write_raw(struct iio_dev *indio_dev,
return ad5686_write(st, AD5686_CMD_WRITE_INPUT_N_UPDATE_N,
chan->address, val << chan->scan_type.shift);
+ case IIO_CHAN_INFO_SCALE:
+ if (val == st->scale_avail[0] && val2 == st->scale_avail[1])
+ st->double_scale = false;
+ else if (val == st->scale_avail[2] && val2 == st->scale_avail[3])
+ st->double_scale = true;
+ else
+ return -EINVAL;
+
+ switch (st->chip_info->regmap_type) {
+ case AD5310_REGMAP:
+ return ad5310_control_sync(st);
+ case AD5683_REGMAP:
+ return ad5683_control_sync(st);
+ case AD5686_REGMAP:
+ /*
+ * Even if the gain pin is hardwired on the board, the
+ * user is able to control the scale such that it
+ * matches the actual gain setting.
+ */
+ gpiod_set_value_cansleep(st->gain_gpio,
+ st->double_scale ? 1 : 0);
+ return 0;
+ default:
+ return -EINVAL;
+ }
+ default:
+ return -EINVAL;
+ }
+}
+
+static int ad5686_write_raw_get_fmt(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ long mask)
+{
+ switch (mask) {
+ case IIO_CHAN_INFO_RAW:
+ return IIO_VAL_INT;
+ case IIO_CHAN_INFO_SCALE:
+ return IIO_VAL_INT_PLUS_NANO;
+ default:
+ return -EINVAL;
+ }
+}
+
+static int ad5686_read_avail(struct iio_dev *indio_dev,
+ struct iio_chan_spec const *chan,
+ const int **vals, int *type, int *length,
+ long mask)
+{
+ struct ad5686_state *st = iio_priv(indio_dev);
+
+ switch (mask) {
+ case IIO_CHAN_INFO_SCALE:
+ *type = IIO_VAL_INT_PLUS_NANO;
+ *vals = st->scale_avail;
+ *length = ARRAY_SIZE(st->scale_avail);
+ return IIO_AVAIL_LIST;
default:
return -EINVAL;
}
@@ -224,6 +290,8 @@ static int ad5686_write_raw(struct iio_dev *indio_dev,
static const struct iio_info ad5686_info = {
.read_raw = ad5686_read_raw,
.write_raw = ad5686_write_raw,
+ .write_raw_get_fmt = ad5686_write_raw_get_fmt,
+ .read_avail = ad5686_read_avail,
};
static const struct iio_chan_spec_ext_info ad5686_ext_info[] = {
@@ -245,6 +313,7 @@ static const struct iio_chan_spec_ext_info ad5686_ext_info[] = {
.channel = chan, \
.info_mask_separate = BIT(IIO_CHAN_INFO_RAW), \
.info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),\
+ .info_mask_shared_by_type_available = BIT(IIO_CHAN_INFO_SCALE),\
.address = addr, \
.scan_index = chan, \
.scan_type = { \
@@ -471,6 +540,16 @@ const struct ad5686_chip_info ad5679r_chip_info = {
};
EXPORT_SYMBOL_NS_GPL(ad5679r_chip_info, "IIO_AD5686");
+static void ad5686_init_scale_avail(struct ad5686_state *st)
+{
+ int realbits = st->chip_info->channels[0].scan_type.realbits;
+ s64 tmp;
+
+ tmp = 2ULL * st->vref_mv * NANO >> realbits;
+ st->scale_avail[2] = div_s64_rem(tmp, NANO, &st->scale_avail[3]);
+ st->scale_avail[0] = div_s64_rem(tmp >> 1, NANO, &st->scale_avail[1]);
+}
+
static irqreturn_t ad5686_trigger_handler(int irq, void *p)
{
struct iio_poll_func *pf = p;
@@ -576,6 +655,13 @@ int ad5686_probe(struct device *dev,
return dev_err_probe(dev, PTR_ERR(st->ldac_gpio),
"Failed to get LDAC GPIO\n");
+ st->gain_gpio = devm_gpiod_get_optional(dev, "gain", GPIOD_OUT_LOW);
+ if (IS_ERR(st->gain_gpio))
+ return dev_err_probe(dev, PTR_ERR(st->gain_gpio),
+ "Failed to get GAIN GPIO\n");
+
+ ad5686_init_scale_avail(st);
+
fsleep(5); /* power-up time */
reset_control_assert(rstc);
fsleep(1); /* reset pulse: comfortably bigger than the spec */
diff --git a/drivers/iio/dac/ad5686.h b/drivers/iio/dac/ad5686.h
index 6f47493906d4..b74a641d8fa4 100644
--- a/drivers/iio/dac/ad5686.h
+++ b/drivers/iio/dac/ad5686.h
@@ -39,9 +39,11 @@
#define AD5686_CMD_CONTROL_REG 0x4
#define AD5686_CMD_READBACK_ENABLE_V2 0x5
+#define AD5310_GAIN_BIT_MSK BIT(7)
#define AD5310_REF_BIT_MSK BIT(8)
#define AD5310_PD_MSK GENMASK(10, 9)
+#define AD5683_GAIN_BIT_MSK BIT(11)
#define AD5683_REF_BIT_MSK BIT(12)
#define AD5683_PD_MSK GENMASK(14, 13)
@@ -124,9 +126,12 @@ extern const struct ad5686_chip_info ad5679r_chip_info;
* @chip_info: chip model specific constants, available modes etc
* @ops: bus specific operations
* @ldac_gpio: LDAC pin GPIO descriptor
- * @vref_mv: actual reference voltage used
+ * @gain_gpio: GAIN pin GPIO descriptor
* @pwr_down_mask: power down mask
* @pwr_down_mode: current power down mode
+ * @scale_avail: pre-calculated available scale values
+ * @vref_mv: actual reference voltage used
+ * @double_scale: flag to indicate the gain multiplier is applied
* @use_internal_vref: set to true if the internal reference voltage is used
* @lock: lock to protect access to state fields, which includes
* the data buffer during regmap ops
@@ -138,9 +143,12 @@ struct ad5686_state {
const struct ad5686_chip_info *chip_info;
const struct ad5686_bus_ops *ops;
struct gpio_desc *ldac_gpio;
- unsigned short vref_mv;
+ struct gpio_desc *gain_gpio;
unsigned int pwr_down_mask;
unsigned int pwr_down_mode;
+ int scale_avail[4];
+ unsigned short vref_mv;
+ bool double_scale;
bool use_internal_vref;
struct mutex lock;
void *bus_data;
--
2.43.0
^ permalink raw reply related [flat|nested] 23+ messages in thread
* Re: [PATCH v2 04/12] dt-bindings: iio: dac: ad5686: rework on power supplies
2026-06-09 10:12 ` [PATCH v2 04/12] dt-bindings: iio: dac: ad5686: rework on power supplies Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:22 ` sashiko-bot
0 siblings, 0 replies; 23+ messages in thread
From: sashiko-bot @ 2026-06-09 10:22 UTC (permalink / raw)
To: Rodrigo Alencar via B4 Relay; +Cc: robh, devicetree, conor+dt
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Critical] Device Tree binding ABI breakage due to newly required properties without fallback.
--
commit b368aecb172cba4ed369348bc821f626012fd870
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
dt-bindings: iio: dac: ad5686: rework on power supplies
This commit adds supplies for VDD, VLOGIC and VREF input voltage pins,
deprecates vcc-supply in favor of vref-supply, and updates the required
properties.
> diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
> index 4680d4753dd4d..2abdbf325392d 100644
> --- a/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
> +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5686.yaml
[ ... ]
> @@ -53,9 +64,23 @@ properties:
> required:
> - compatible
> - reg
> + - vdd-supply
> + - vlogic-supply
[Severity: Critical]
Does unconditionally adding vdd-supply and vlogic-supply to the global
required list break backward compatibility? Old device trees that did not
specify these supplies will now fail schema validation.
>
> allOf:
> - $ref: /schemas/spi/spi-peripheral-props.yaml#
> + - if:
> + properties:
> + compatible:
> + contains:
> + anyOf:
> + - const: adi,ad5676
> + - const: adi,ad5683
> + - const: adi,ad5684
> + - const: adi,ad5686
> + then:
> + required:
> + - vref-supply
[Severity: Critical]
Does strictly mandating vref-supply break validation for older device trees
that used the now-deprecated vcc-supply?
While the driver is updated later in the series to gracefully handle missing
supplies and check both vcc and vref, the binding schema itself incorrectly
rejects existing valid DTs.
Should the schema use an anyOf block to permit either vcc-supply or
vref-supply for backward compatibility, and avoid making new supply
properties strictly required if they weren't in the original schema?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260609-ad5686-new-features-v2-0-70b423f5c76d@analog.com?part=4
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 11/12] iio: dac: ad5686: write_raw: use guard(mutex)()
2026-06-09 10:13 ` [PATCH v2 11/12] iio: dac: ad5686: write_raw: use guard(mutex)() Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:26 ` Joshua Crofts
2026-06-09 11:46 ` Nuno Sá
0 siblings, 1 reply; 23+ messages in thread
From: Joshua Crofts @ 2026-06-09 10:26 UTC (permalink / raw)
To: Rodrigo Alencar via B4 Relay
Cc: rodrigo.alencar, Michael Auchter, linux, linux-iio, devicetree,
linux-kernel, linux-hardening, Michael Hennerich,
Jonathan Cameron, David Lechner, Andy Shevchenko, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel, Kees Cook,
Gustavo A. R. Silva
On Tue, 09 Jun 2026 11:13:06 +0100
Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@kernel.org> wrote:
> From: Rodrigo Alencar <rodrigo.alencar@analog.com>
>
> Use guarded mutex lock to facilitate code review when adding new
> attributes. This will allow for early returns, avoiding error-prone
> locking and unlocking in error paths. Gain-control support will add
> the scale attribute.
>
> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
Althoug <linux/cleanup.h> is included in <linux/device.h>, it's better
to explicitly add the include for it as IIO drivers are currently being
moved away from these catch-all headers.
With that fixed,
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
--
Kind regards
CJD
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 02/12] dt-bindings: iio: dac: ad5696: rework on power supplies
2026-06-09 10:12 ` [PATCH v2 02/12] dt-bindings: iio: dac: ad5696: rework on power supplies Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:28 ` sashiko-bot
2026-06-09 11:40 ` Rodrigo Alencar
1 sibling, 0 replies; 23+ messages in thread
From: sashiko-bot @ 2026-06-09 10:28 UTC (permalink / raw)
To: Rodrigo Alencar via B4 Relay; +Cc: conor+dt, robh, devicetree
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Adding `vdd-supply`, `vlogic-supply`, and unconditionally requiring `vref-supply` breaks backward compatibility for existing device trees.
- [Medium] Making `vlogic-supply` unconditionally required forces device trees to document a non-existent hardware connection for single-channel devices.
--
commit 8357cd3efa5f819678f24f0cbf0a39208f4078bc
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
Subject: dt-bindings: iio: dac: ad5696: rework on power supplies
This commit reworks the power supply bindings for the ad5696 DAC series. It
adds vdd-supply, vlogic-supply, and vref-supply, deprecates vcc-supply, and
updates the required properties.
> diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
> index 2dcc049f30e91..e5fbaec4adf71 100644
> --- a/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
> +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
[ ... ]
> @@ -55,8 +65,21 @@ properties:
> required:
> - compatible
> - reg
> + - vdd-supply
> + - vlogic-supply
[Severity: High]
Does adding vdd-supply and vlogic-supply to the global required list break
backward compatibility for existing device trees? Older device trees that
omitted these will now fail dtbs_check.
[Severity: Medium]
Does making vlogic-supply unconditionally required force device trees to
document a non-existent hardware connection? Single-channel devices in this
family (such as adi,ad5693, adi,ad5693r, and adi,ad5311r) physically do not
have a dedicated VLOGIC pin.
>
> allOf:
> + - if:
> + properties:
> + compatible:
> + contains:
> + anyOf:
> + - const: adi,ad5693
> + - const: adi,ad5694
> + - const: adi,ad5696
> + then:
> + required:
> + - vref-supply
[Severity: High]
Does unconditionally requiring vref-supply break older device trees that
correctly utilized the formerly valid vcc-supply?
To preserve DT ABI compatibility, should the schema allow either vcc-supply or
vref-supply to satisfy the reference voltage requirement?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260609-ad5686-new-features-v2-0-70b423f5c76d@analog.com?part=2
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 06/12] iio: dac: ad5686: consume optional reset signal
2026-06-09 10:13 ` [PATCH v2 06/12] iio: dac: ad5686: consume optional reset signal Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:29 ` sashiko-bot
2026-06-09 11:17 ` Rodrigo Alencar
1 sibling, 0 replies; 23+ messages in thread
From: sashiko-bot @ 2026-06-09 10:29 UTC (permalink / raw)
To: Rodrigo Alencar via B4 Relay; +Cc: robh, conor+dt, devicetree
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] Premature reset line deassertion during power ramp-up due to the use of '_deasserted' combined with a manual pulse.
--
commit 61717352bc99739a9f89195c3320a934e033ad38
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
iio: dac: ad5686: consume optional reset signal
Add RESET pin GPIO support through an optional reset control, which is local
to the probe function, and include a delay for the required reset pulse width.
> diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
> index fc3863274b291..700798b80f044 100644
> --- a/drivers/iio/dac/ad5686.c
> +++ b/drivers/iio/dac/ad5686.c
[ ... ]
> @@ -506,7 +508,15 @@ int ad5686_probe(struct device *dev,
> return dev_err_probe(dev, -EINVAL,
> "invalid or not provided vref voltage\n");
>
> + rstc = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
[Severity: Medium]
Does this prematurely deassert the reset line during power ramp-up?
Because devm_reset_control_get_optional_exclusive_deasserted() automatically
and immediately deasserts the reset line upon acquisition, the reset line is
driven high while the power supply is still stabilizing, before the 5 us
power-up delay has elapsed.
This creates an unwanted rising edge on the reset pin during power ramp-up,
which could cause the device to enter an unknown state or latch up.
Should this use devm_reset_control_get_optional_exclusive() instead, which
does not modify the line state during acquisition, allowing the manual toggle
sequence below to safely reset the device after power is stable?
> + if (IS_ERR(rstc))
> + return dev_err_probe(dev, PTR_ERR(rstc),
> + "Failed to get reset control\n");
> +
> fsleep(5); /* power-up time */
> + reset_control_assert(rstc);
> + fsleep(1); /* reset pulse: comfortably bigger than the spec */
> + reset_control_deassert(rstc);
>
> /* Initialize masks to all ones */
> st->pwr_down_mask = ~0;
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260609-ad5686-new-features-v2-0-70b423f5c76d@analog.com?part=6
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 12/12] iio: dac: ad5686: add gain control support
2026-06-09 10:13 ` [PATCH v2 12/12] iio: dac: ad5686: add gain control support Rodrigo Alencar via B4 Relay
@ 2026-06-09 10:37 ` sashiko-bot
2026-06-09 11:10 ` Rodrigo Alencar
1 sibling, 0 replies; 23+ messages in thread
From: sashiko-bot @ 2026-06-09 10:37 UTC (permalink / raw)
To: Rodrigo Alencar via B4 Relay; +Cc: devicetree, robh, conor+dt
Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [Medium] ABI Violation: Exposing a writable sysfs attribute to fix a static hardware configuration.
- [Medium] State Inconsistency: `st->double_scale` is not rolled back if hardware synchronization fails.
- [Low] Data Race: Lockless read of `st->double_scale` can race with concurrent writes.
--
commit 7fefd2fd08838a6ee5a81a3a819607e02af9d85d
Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
iio: dac: ad5686: add gain control support
This commit adds support for a 2x gain multiplier applied to the output
voltage. This provides a gain control through a bit field in the control
register or a dedicated GAIN pin, exposing the scale property as configurable.
> diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
> index d9022c6a32016..d49390af71f90 100644
> --- a/drivers/iio/dac/ad5686.c
> +++ b/drivers/iio/dac/ad5686.c
[ ... ]
> @@ -192,9 +196,14 @@ static int ad5686_read_raw(struct iio_dev *indio_dev,
> GENMASK(chan->scan_type.realbits - 1, 0);
> return IIO_VAL_INT;
> case IIO_CHAN_INFO_SCALE:
> - *val = st->vref_mv;
> - *val2 = chan->scan_type.realbits;
> - return IIO_VAL_FRACTIONAL_LOG2;
> + if (st->double_scale) {
> + *val = st->scale_avail[2];
> + *val2 = st->scale_avail[3];
> + } else {
> + *val = st->scale_avail[0];
> + *val2 = st->scale_avail[1];
> + }
> + return IIO_VAL_INT_PLUS_NANO;
[Severity: Low]
Is it possible for a data race to occur here?
In ad5686_read_raw(), the mutable software state st->double_scale is read
to determine the returned scale values without holding the st->lock mutex.
Because st->double_scale can be concurrently modified by ad5686_write_raw()
(which properly acquires st->lock), this can lead to reading a prematurely
updated state before the hardware configuration has actually completed.
> }
> return -EINVAL;
> }
[ ... ]
> @@ -216,6 +225,63 @@ static int ad5686_write_raw(struct iio_dev *indio_dev,
>
> return ad5686_write(st, AD5686_CMD_WRITE_INPUT_N_UPDATE_N,
> chan->address, val << chan->scan_type.shift);
> + case IIO_CHAN_INFO_SCALE:
> + if (val == st->scale_avail[0] && val2 == st->scale_avail[1])
> + st->double_scale = false;
> + else if (val == st->scale_avail[2] && val2 == st->scale_avail[3])
> + st->double_scale = true;
> + else
> + return -EINVAL;
> +
> + switch (st->chip_info->regmap_type) {
> + case AD5310_REGMAP:
> + return ad5310_control_sync(st);
> + case AD5683_REGMAP:
> + return ad5683_control_sync(st);
[Severity: Medium]
Should st->double_scale be restored to its previous value if the hardware
synchronization fails?
In ad5686_write_raw(), st->double_scale is updated before the driver attempts
to push the change to the DAC via ad5310_control_sync(st) or
ad5683_control_sync(st).
If the underlying SPI/I2C write fails, the function immediately returns the
error code without rolling back st->double_scale.
This could cause the driver's cached state to diverge from the actual
hardware configuration, causing future reads of the scale to return the
incorrect updated value.
> + case AD5686_REGMAP:
> + /*
> + * Even if the gain pin is hardwired on the board, the
> + * user is able to control the scale such that it
> + * matches the actual gain setting.
> + */
> + gpiod_set_value_cansleep(st->gain_gpio,
> + st->double_scale ? 1 : 0);
> + return 0;
[Severity: Medium]
Does this expose a writable sysfs attribute to fix a static hardware
configuration?
The commit introduces a writable scale sysfs attribute to allow users to manually
match the software scale to a hardwired gain pin. Static hardware properties
should typically be described via firmware properties (e.g., Device Tree) so
the driver can expose the correct, immutable scale at initialization.
If the GAIN GPIO is absent, writing to the scale attribute returns success but
does not change the physical hardware state, leading to a silent desynchronization
between the reported scale and the actual physical DAC output.
Could this mislead generic IIO clients by presenting multiple available scales
that they believe they can dynamically toggle?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260609-ad5686-new-features-v2-0-70b423f5c76d@analog.com?part=12
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 12/12] iio: dac: ad5686: add gain control support
2026-06-09 10:13 ` [PATCH v2 12/12] iio: dac: ad5686: add gain control support Rodrigo Alencar via B4 Relay
2026-06-09 10:37 ` sashiko-bot
@ 2026-06-09 11:10 ` Rodrigo Alencar
1 sibling, 0 replies; 23+ messages in thread
From: Rodrigo Alencar @ 2026-06-09 11:10 UTC (permalink / raw)
To: rodrigo.alencar, Michael Auchter, linux, linux-iio, devicetree,
linux-kernel, linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva
On 09/06/26 10:37, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
> - [Medium] ABI Violation: Exposing a writable sysfs attribute to fix a static hardware configuration.
> - [Medium] State Inconsistency: `st->double_scale` is not rolled back if hardware synchronization fails.
> - [Low] Data Race: Lockless read of `st->double_scale` can race with concurrent writes.
> --
>
> commit 7fefd2fd08838a6ee5a81a3a819607e02af9d85d
> Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
>
> iio: dac: ad5686: add gain control support
>
> This commit adds support for a 2x gain multiplier applied to the output
> voltage. This provides a gain control through a bit field in the control
> register or a dedicated GAIN pin, exposing the scale property as configurable.
>
> > diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
> > index d9022c6a32016..d49390af71f90 100644
> > --- a/drivers/iio/dac/ad5686.c
> > +++ b/drivers/iio/dac/ad5686.c
>
> [ ... ]
>
> > @@ -192,9 +196,14 @@ static int ad5686_read_raw(struct iio_dev *indio_dev,
> > GENMASK(chan->scan_type.realbits - 1, 0);
> > return IIO_VAL_INT;
> > case IIO_CHAN_INFO_SCALE:
> > - *val = st->vref_mv;
> > - *val2 = chan->scan_type.realbits;
> > - return IIO_VAL_FRACTIONAL_LOG2;
> > + if (st->double_scale) {
> > + *val = st->scale_avail[2];
> > + *val2 = st->scale_avail[3];
> > + } else {
> > + *val = st->scale_avail[0];
> > + *val2 = st->scale_avail[1];
> > + }
> > + return IIO_VAL_INT_PLUS_NANO;
>
> [Severity: Low]
> Is it possible for a data race to occur here?
>
> In ad5686_read_raw(), the mutable software state st->double_scale is read
> to determine the returned scale values without holding the st->lock mutex.
>
> Because st->double_scale can be concurrently modified by ad5686_write_raw()
> (which properly acquires st->lock), this can lead to reading a prematurely
> updated state before the hardware configuration has actually completed.
Valid concern, will add guarded mutex lock in read_raw to the previous patch.
> > }
> > return -EINVAL;
> > }
>
> [ ... ]
>
> > @@ -216,6 +225,63 @@ static int ad5686_write_raw(struct iio_dev *indio_dev,
> >
> > return ad5686_write(st, AD5686_CMD_WRITE_INPUT_N_UPDATE_N,
> > chan->address, val << chan->scan_type.shift);
> > + case IIO_CHAN_INFO_SCALE:
> > + if (val == st->scale_avail[0] && val2 == st->scale_avail[1])
> > + st->double_scale = false;
> > + else if (val == st->scale_avail[2] && val2 == st->scale_avail[3])
> > + st->double_scale = true;
> > + else
> > + return -EINVAL;
> > +
> > + switch (st->chip_info->regmap_type) {
> > + case AD5310_REGMAP:
> > + return ad5310_control_sync(st);
> > + case AD5683_REGMAP:
> > + return ad5683_control_sync(st);
>
> [Severity: Medium]
> Should st->double_scale be restored to its previous value if the hardware
> synchronization fails?
>
> In ad5686_write_raw(), st->double_scale is updated before the driver attempts
> to push the change to the DAC via ad5310_control_sync(st) or
> ad5683_control_sync(st).
>
> If the underlying SPI/I2C write fails, the function immediately returns the
> error code without rolling back st->double_scale.
>
> This could cause the driver's cached state to diverge from the actual
> hardware configuration, causing future reads of the scale to return the
> incorrect updated value.
Will ignore that and assume that SPI write error is a platform problem.
At another attempt the cached value can take effect.
>
> > + case AD5686_REGMAP:
> > + /*
> > + * Even if the gain pin is hardwired on the board, the
> > + * user is able to control the scale such that it
> > + * matches the actual gain setting.
> > + */
> > + gpiod_set_value_cansleep(st->gain_gpio,
> > + st->double_scale ? 1 : 0);
> > + return 0;
>
> [Severity: Medium]
> Does this expose a writable sysfs attribute to fix a static hardware
> configuration?
>
> The commit introduces a writable scale sysfs attribute to allow users to manually
> match the software scale to a hardwired gain pin. Static hardware properties
> should typically be described via firmware properties (e.g., Device Tree) so
> the driver can expose the correct, immutable scale at initialization.
>
> If the GAIN GPIO is absent, writing to the scale attribute returns success but
> does not change the physical hardware state, leading to a silent desynchronization
> between the reported scale and the actual physical DAC output.
>
> Could this mislead generic IIO clients by presenting multiple available scales
> that they believe they can dynamically toggle?
No sure if this is a big concern (assuming that the user has knowledge of the hardware).
An option is to add another dt property to indicate that the gain is doubled in hardware.
Such property cannot be defined alongside the ldac-gpios property.
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260609-ad5686-new-features-v2-0-70b423f5c76d@analog.com?part=12
--
Kind regards,
Rodrigo Alencar
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 06/12] iio: dac: ad5686: consume optional reset signal
2026-06-09 10:13 ` [PATCH v2 06/12] iio: dac: ad5686: consume optional reset signal Rodrigo Alencar via B4 Relay
2026-06-09 10:29 ` sashiko-bot
@ 2026-06-09 11:17 ` Rodrigo Alencar
1 sibling, 0 replies; 23+ messages in thread
From: Rodrigo Alencar @ 2026-06-09 11:17 UTC (permalink / raw)
To: rodrigo.alencar, Michael Auchter, linux, linux-iio, devicetree,
linux-kernel, linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva
On 09/06/26 10:29, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] Premature reset line deassertion during power ramp-up due to the use of '_deasserted' combined with a manual pulse.
> --
>
> commit 61717352bc99739a9f89195c3320a934e033ad38
> Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
>
> iio: dac: ad5686: consume optional reset signal
>
> Add RESET pin GPIO support through an optional reset control, which is local
> to the probe function, and include a delay for the required reset pulse width.
>
> > diff --git a/drivers/iio/dac/ad5686.c b/drivers/iio/dac/ad5686.c
> > index fc3863274b291..700798b80f044 100644
> > --- a/drivers/iio/dac/ad5686.c
> > +++ b/drivers/iio/dac/ad5686.c
> [ ... ]
> > @@ -506,7 +508,15 @@ int ad5686_probe(struct device *dev,
> > return dev_err_probe(dev, -EINVAL,
> > "invalid or not provided vref voltage\n");
> >
> > + rstc = devm_reset_control_get_optional_exclusive_deasserted(dev, NULL);
>
> [Severity: Medium]
> Does this prematurely deassert the reset line during power ramp-up?
>
> Because devm_reset_control_get_optional_exclusive_deasserted() automatically
> and immediately deasserts the reset line upon acquisition, the reset line is
> driven high while the power supply is still stabilizing, before the 5 us
> power-up delay has elapsed.
>
> This creates an unwanted rising edge on the reset pin during power ramp-up,
> which could cause the device to enter an unknown state or latch up.
>
> Should this use devm_reset_control_get_optional_exclusive() instead, which
> does not modify the line state during acquisition, allowing the manual toggle
> sequence below to safely reset the device after power is stable?
It has been discussed that it is better to get deasserted and manually create
the reset pulse. Will move this down (after the fsleep(5) power-up time). Or
better move this up (before the regulator enable)...
> > + if (IS_ERR(rstc))
> > + return dev_err_probe(dev, PTR_ERR(rstc),
> > + "Failed to get reset control\n");
> > +
> > fsleep(5); /* power-up time */
> > + reset_control_assert(rstc);
> > + fsleep(1); /* reset pulse: comfortably bigger than the spec */
> > + reset_control_deassert(rstc);
> >
> > /* Initialize masks to all ones */
> > st->pwr_down_mask = ~0;
>
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260609-ad5686-new-features-v2-0-70b423f5c76d@analog.com?part=6
--
Kind regards,
Rodrigo Alencar
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 02/12] dt-bindings: iio: dac: ad5696: rework on power supplies
2026-06-09 10:12 ` [PATCH v2 02/12] dt-bindings: iio: dac: ad5696: rework on power supplies Rodrigo Alencar via B4 Relay
2026-06-09 10:28 ` sashiko-bot
@ 2026-06-09 11:40 ` Rodrigo Alencar
2026-06-09 16:12 ` Conor Dooley
1 sibling, 1 reply; 23+ messages in thread
From: Rodrigo Alencar @ 2026-06-09 11:40 UTC (permalink / raw)
To: rodrigo.alencar, Michael Auchter, linux, linux-iio, devicetree,
linux-kernel, linux-hardening
Cc: Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva, Conor Dooley
On 09/06/26 10:28, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> - [High] Adding `vdd-supply`, `vlogic-supply`, and unconditionally requiring `vref-supply` breaks backward compatibility for existing device trees.
> - [Medium] Making `vlogic-supply` unconditionally required forces device trees to document a non-existent hardware connection for single-channel devices.
> --
>
> commit 8357cd3efa5f819678f24f0cbf0a39208f4078bc
> Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
> Subject: dt-bindings: iio: dac: ad5696: rework on power supplies
>
> This commit reworks the power supply bindings for the ad5696 DAC series. It
> adds vdd-supply, vlogic-supply, and vref-supply, deprecates vcc-supply, and
> updates the required properties.
>
> > diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
> > index 2dcc049f30e91..e5fbaec4adf71 100644
> > --- a/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
> > +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
>
> [ ... ]
>
> > @@ -55,8 +65,21 @@ properties:
> > required:
> > - compatible
> > - reg
> > + - vdd-supply
> > + - vlogic-supply
>
> [Severity: High]
> Does adding vdd-supply and vlogic-supply to the global required list break
> backward compatibility for existing device trees? Older device trees that
> omitted these will now fail dtbs_check.
Yes, for correctness, it breaks the dtbs_check. In the driver side
we would rely on the dummy/stub regulator in case those are not declared.
> [Severity: Medium]
> Does making vlogic-supply unconditionally required force device trees to
> document a non-existent hardware connection? Single-channel devices in this
> family (such as adi,ad5693, adi,ad5693r, and adi,ad5311r) physically do not
> have a dedicated VLOGIC pin.
VLOGIC does exist for those parts. However, as mentioned before, for some
tiny packages it is internally connected to VDD:
- 10-Lead MSOP package for AD5693R/AD5691R exposes the VLOGIC pin
- 8-Lead LFCSP package for AD5693R/AD5692R/AD5691R/AD5693 does NOT expose the VLOGIC pin
I think we agreed to make it required and user can just repeat the vdd-supply
value or not have it at all. Driver would rely on the dummy/stub regulator.
> >
> > allOf:
> > + - if:
> > + properties:
> > + compatible:
> > + contains:
> > + anyOf:
> > + - const: adi,ad5693
> > + - const: adi,ad5694
> > + - const: adi,ad5696
> > + then:
> > + required:
> > + - vref-supply
>
> [Severity: High]
> Does unconditionally requiring vref-supply break older device trees that
> correctly utilized the formerly valid vcc-supply?
>
> To preserve DT ABI compatibility, should the schema allow either vcc-supply or
> vref-supply to satisfy the reference voltage requirement?
Same here. For correctness, it breaks DT ABI.
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260609-ad5686-new-features-v2-0-70b423f5c76d@analog.com?part=2
--
Kind regards,
Rodrigo Alencar
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 11/12] iio: dac: ad5686: write_raw: use guard(mutex)()
2026-06-09 10:26 ` Joshua Crofts
@ 2026-06-09 11:46 ` Nuno Sá
0 siblings, 0 replies; 23+ messages in thread
From: Nuno Sá @ 2026-06-09 11:46 UTC (permalink / raw)
To: Joshua Crofts
Cc: Rodrigo Alencar via B4 Relay, rodrigo.alencar, Michael Auchter,
linux, linux-iio, devicetree, linux-kernel, linux-hardening,
Michael Hennerich, Jonathan Cameron, David Lechner,
Andy Shevchenko, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
Philipp Zabel, Kees Cook, Gustavo A. R. Silva
On Tue, Jun 09, 2026 at 12:26:05PM +0200, Joshua Crofts wrote:
> On Tue, 09 Jun 2026 11:13:06 +0100
> Rodrigo Alencar via B4 Relay <devnull+rodrigo.alencar.analog.com@kernel.org> wrote:
>
> > From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> >
> > Use guarded mutex lock to facilitate code review when adding new
> > attributes. This will allow for early returns, avoiding error-prone
> > locking and unlocking in error paths. Gain-control support will add
> > the scale attribute.
> >
> > Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
>
> Althoug <linux/cleanup.h> is included in <linux/device.h>, it's better
> to explicitly add the include for it as IIO drivers are currently being
> moved away from these catch-all headers.
Also we wanna use the IWYU principle (which should not be only an IIO
thing :)).
- Nuno Sá
>
> With that fixed,
>
> Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
>
> --
> Kind regards
>
> CJD
^ permalink raw reply [flat|nested] 23+ messages in thread
* Re: [PATCH v2 02/12] dt-bindings: iio: dac: ad5696: rework on power supplies
2026-06-09 11:40 ` Rodrigo Alencar
@ 2026-06-09 16:12 ` Conor Dooley
0 siblings, 0 replies; 23+ messages in thread
From: Conor Dooley @ 2026-06-09 16:12 UTC (permalink / raw)
To: Rodrigo Alencar
Cc: rodrigo.alencar, Michael Auchter, linux, linux-iio, devicetree,
linux-kernel, linux-hardening, Michael Hennerich,
Jonathan Cameron, David Lechner, Andy Shevchenko, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Philipp Zabel, Kees Cook,
Gustavo A. R. Silva, Conor Dooley
[-- Attachment #1: Type: text/plain, Size: 3716 bytes --]
On Tue, Jun 09, 2026 at 12:40:08PM +0100, Rodrigo Alencar wrote:
> On 09/06/26 10:28, sashiko-bot@kernel.org wrote:
> > Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
> > - [High] Adding `vdd-supply`, `vlogic-supply`, and unconditionally requiring `vref-supply` breaks backward compatibility for existing device trees.
> > - [Medium] Making `vlogic-supply` unconditionally required forces device trees to document a non-existent hardware connection for single-channel devices.
> > --
> >
> > commit 8357cd3efa5f819678f24f0cbf0a39208f4078bc
> > Author: Rodrigo Alencar <rodrigo.alencar@analog.com>
> > Subject: dt-bindings: iio: dac: ad5696: rework on power supplies
> >
> > This commit reworks the power supply bindings for the ad5696 DAC series. It
> > adds vdd-supply, vlogic-supply, and vref-supply, deprecates vcc-supply, and
> > updates the required properties.
> >
> > > diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
> > > index 2dcc049f30e91..e5fbaec4adf71 100644
> > > --- a/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
> > > +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5696.yaml
> >
> > [ ... ]
> >
> > > @@ -55,8 +65,21 @@ properties:
> > > required:
> > > - compatible
> > > - reg
> > > + - vdd-supply
> > > + - vlogic-supply
> >
> > [Severity: High]
> > Does adding vdd-supply and vlogic-supply to the global required list break
> > backward compatibility for existing device trees? Older device trees that
> > omitted these will now fail dtbs_check.
>
> Yes, for correctness, it breaks the dtbs_check. In the driver side
> we would rely on the dummy/stub regulator in case those are not declared.
Ye I wouldn't be overly worried here. Sashiko has particular difficulty
with these kinds of changes.
>
> > [Severity: Medium]
> > Does making vlogic-supply unconditionally required force device trees to
> > document a non-existent hardware connection? Single-channel devices in this
> > family (such as adi,ad5693, adi,ad5693r, and adi,ad5311r) physically do not
> > have a dedicated VLOGIC pin.
>
> VLOGIC does exist for those parts. However, as mentioned before, for some
> tiny packages it is internally connected to VDD:
>
> - 10-Lead MSOP package for AD5693R/AD5691R exposes the VLOGIC pin
> - 8-Lead LFCSP package for AD5693R/AD5692R/AD5691R/AD5693 does NOT expose the VLOGIC pin
>
> I think we agreed to make it required and user can just repeat the vdd-supply
> value or not have it at all. Driver would rely on the dummy/stub regulator.
Yeah, I dunno. I think this is just a judgement call, and maybe worth
having a comment in the binding for to explain it.
>
> > >
> > > allOf:
> > > + - if:
> > > + properties:
> > > + compatible:
> > > + contains:
> > > + anyOf:
> > > + - const: adi,ad5693
> > > + - const: adi,ad5694
> > > + - const: adi,ad5696
> > > + then:
> > > + required:
> > > + - vref-supply
> >
> > [Severity: High]
> > Does unconditionally requiring vref-supply break older device trees that
> > correctly utilized the formerly valid vcc-supply?
> >
> > To preserve DT ABI compatibility, should the schema allow either vcc-supply or
> > vref-supply to satisfy the reference voltage requirement?
>
> Same here. For correctness, it breaks DT ABI.
>
> > --
> > Sashiko AI review · https://sashiko.dev/#/patchset/20260609-ad5686-new-features-v2-0-70b423f5c76d@analog.com?part=2
>
> --
> Kind regards,
>
> Rodrigo Alencar
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 23+ messages in thread
end of thread, other threads:[~2026-06-09 16:12 UTC | newest]
Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09 10:12 [PATCH v2 00/12] New features for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
2026-06-09 10:12 ` [PATCH v2 01/12] dt-bindings: iio: dac: ad5696: add reset/ldac/gain gpio support Rodrigo Alencar via B4 Relay
2026-06-09 10:12 ` [PATCH v2 02/12] dt-bindings: iio: dac: ad5696: rework on power supplies Rodrigo Alencar via B4 Relay
2026-06-09 10:28 ` sashiko-bot
2026-06-09 11:40 ` Rodrigo Alencar
2026-06-09 16:12 ` Conor Dooley
2026-06-09 10:12 ` [PATCH v2 03/12] dt-bindings: iio: dac: ad5686: add reset/ldac/gain gpio support Rodrigo Alencar via B4 Relay
2026-06-09 10:12 ` [PATCH v2 04/12] dt-bindings: iio: dac: ad5686: rework on power supplies Rodrigo Alencar via B4 Relay
2026-06-09 10:22 ` sashiko-bot
2026-06-09 10:13 ` [PATCH v2 05/12] iio: dac: ad5686: add support for missing " Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 06/12] iio: dac: ad5686: consume optional reset signal Rodrigo Alencar via B4 Relay
2026-06-09 10:29 ` sashiko-bot
2026-06-09 11:17 ` Rodrigo Alencar
2026-06-09 10:13 ` [PATCH v2 07/12] iio: dac: ad5686: add ldac gpio Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 08/12] iio: dac: ad5686: introduce sync operation Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 09/12] iio: dac: ad5686: implement new sync() op for the spi bus Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 10/12] iio: dac: ad5686: add triggered buffer support Rodrigo Alencar via B4 Relay
2026-06-09 10:13 ` [PATCH v2 11/12] iio: dac: ad5686: write_raw: use guard(mutex)() Rodrigo Alencar via B4 Relay
2026-06-09 10:26 ` Joshua Crofts
2026-06-09 11:46 ` Nuno Sá
2026-06-09 10:13 ` [PATCH v2 12/12] iio: dac: ad5686: add gain control support Rodrigo Alencar via B4 Relay
2026-06-09 10:37 ` sashiko-bot
2026-06-09 11:10 ` Rodrigo Alencar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox