[PATCH v2 1/5] dt-bindings: iio: dac: ad5504: add output-range and missing gpios

Taha Ed-Dafili posted 5 patches 4 weeks ago
[PATCH v2 1/5] dt-bindings: iio: dac: ad5504: add output-range and missing gpios
Posted by Taha Ed-Dafili 4 weeks ago
The AD5504 output range (0-30V or 0-60V) is determined by the R_SEL pin.

Use standard output-range-microvolt and range-sel-gpios properties to
describe the hardware configuration of the R_SEL pin. Ensure mutual
exclusivity using the not/required logic. Additionally, add missing
vlogic-supply, clear-gpios, ldac-gpios and datasheet links, and provide
a complete usage example.

Suggested-by: David Lechner <dlechner@baylibre.com>
Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>
Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
---
 .../bindings/iio/dac/adi,ad5504.yaml          | 40 ++++++++++++++++++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
index 9c2c038683b4..c0b2d470949a 100644
--- a/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
+++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
@@ -10,8 +10,10 @@ maintainers:
   - Lars-Peter Clausen <lars@metafoo.de>
   - Jonathan Cameron <jic23@kernel.org>
 
-description:
+description: |
   High voltage (up to 60V) DACs with temperature sensor alarm function
+  https://www.analog.com/media/en/technical-documentation/data-sheets/ad5504.pdf
+  https://www.analog.com/media/en/technical-documentation/data-sheets/ad5501.pdf
 
 properties:
   compatible:
@@ -27,16 +29,48 @@ properties:
     maxItems: 1
 
   vcc-supply: true
+  vlogic-supply: true
+
+  output-range-microvolt:
+    description: |
+      Specify the channel output full scale range. The R_SEL pin
+      determines if the range is 0-30V or 0-60V.
+    items:
+      - const: 0
+      - enum: [30000000, 60000000]
+    default: [0, 60000000]
+
+  range-sel-gpios:
+    description:
+      GPIO connected to the R_SEL pin to select the output voltage range.
+    maxItems: 1
+
+  clear-gpios:
+    description: GPIO that controls the /CLR pin (active low).
+    maxItems: 1
+
+  ldac-gpios:
+    description: GPIO that controls the /LDAC pin (active low).
+    maxItems: 1
 
 additionalProperties: false
 
 required:
   - compatible
   - reg
+  - vcc-supply
+
+allOf:
+  - not:
+      required:
+        - range-sel-gpios
+        - output-range-microvolt
 
 examples:
   - |
     #include <dt-bindings/interrupt-controller/irq.h>
+    #include <dt-bindings/gpio/gpio.h>
+
     spi {
         #address-cells = <1>;
         #size-cells = <0>;
@@ -45,6 +79,10 @@ examples:
             compatible = "adi,ad5504";
             vcc-supply = <&dac_vcc>;
             interrupts = <55 IRQ_TYPE_EDGE_FALLING>;
+
+            output-range-microvolt = <0 60000000>;
+            clear-gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
+            ldac-gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
         };
     };
 ...
-- 
2.47.3
Re: [PATCH v2 1/5] dt-bindings: iio: dac: ad5504: add output-range and missing gpios
Posted by Nuno Sá 3 weeks, 6 days ago
On Tue, 2026-03-10 at 17:48 +0000, Taha Ed-Dafili wrote:
> The AD5504 output range (0-30V or 0-60V) is determined by the R_SEL pin.
> 
> Use standard output-range-microvolt and range-sel-gpios properties to
> describe the hardware configuration of the R_SEL pin. Ensure mutual
> exclusivity using the not/required logic. Additionally, add missing
> vlogic-supply, clear-gpios, ldac-gpios and datasheet links, and provide
> a complete usage example.
> 
> Suggested-by: David Lechner <dlechner@baylibre.com>
> Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>
> Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
> ---
>  .../bindings/iio/dac/adi,ad5504.yaml          | 40 ++++++++++++++++++-
>  1 file changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
> b/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
> index 9c2c038683b4..c0b2d470949a 100644
> --- a/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
> +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
> @@ -10,8 +10,10 @@ maintainers:
>    - Lars-Peter Clausen <lars@metafoo.de>
>    - Jonathan Cameron <jic23@kernel.org>
>  
> -description:
> +description: |
>    High voltage (up to 60V) DACs with temperature sensor alarm function
> +  https://www.analog.com/media/en/technical-documentation/data-sheets/ad5504.pdf
> +  https://www.analog.com/media/en/technical-documentation/data-sheets/ad5501.pdf
>  
>  properties:
>    compatible:
> @@ -27,16 +29,48 @@ properties:
>      maxItems: 1
>  
>    vcc-supply: true
> +  vlogic-supply: true
> +
> +  output-range-microvolt:
> +    description: |
> +      Specify the channel output full scale range. The R_SEL pin
> +      determines if the range is 0-30V or 0-60V.
> +    items:
> +      - const: 0
> +      - enum: [30000000, 60000000]
> +    default: [0, 60000000]
> +
> +  range-sel-gpios:
> +    description:
> +      GPIO connected to the R_SEL pin to select the output voltage range.
> +    maxItems: 1
> +
> +  clear-gpios:

I would match the datasheet name. So clr.

- Nuno Sá
> +    description: GPIO that controls the /CLR pin (active low).
> +    maxItems: 1
> +
> +  ldac-gpios:
> +    description: GPIO that controls the /LDAC pin (active low).
> +    maxItems: 1
>  
>  additionalProperties: false
>  
>  required:
>    - compatible
>    - reg
> +  - vcc-supply
> +
> +allOf:
> +  - not:
> +      required:
> +        - range-sel-gpios
> +        - output-range-microvolt
>  
>  examples:
>    - |
>      #include <dt-bindings/interrupt-controller/irq.h>
> +    #include <dt-bindings/gpio/gpio.h>
> +
>      spi {
>          #address-cells = <1>;
>          #size-cells = <0>;
> @@ -45,6 +79,10 @@ examples:
>              compatible = "adi,ad5504";
>              vcc-supply = <&dac_vcc>;
>              interrupts = <55 IRQ_TYPE_EDGE_FALLING>;
> +
> +            output-range-microvolt = <0 60000000>;
> +            clear-gpios = <&gpio 4 GPIO_ACTIVE_LOW>;
> +            ldac-gpios = <&gpio 5 GPIO_ACTIVE_LOW>;
>          };
>      };
>  ...
Re: [PATCH v2 1/5] dt-bindings: iio: dac: ad5504: add output-range and missing gpios
Posted by Krzysztof Kozlowski 4 weeks ago
On 10/03/2026 18:48, Taha Ed-Dafili wrote:
> The AD5504 output range (0-30V or 0-60V) is determined by the R_SEL pin.
> 
> Use standard output-range-microvolt and range-sel-gpios properties to
> describe the hardware configuration of the R_SEL pin. Ensure mutual
> exclusivity using the not/required logic. Additionally, add missing
> vlogic-supply, clear-gpios, ldac-gpios and datasheet links, and provide
> a complete usage example.
> 
> Suggested-by: David Lechner <dlechner@baylibre.com>
> Suggested-by: Krzysztof Kozlowski <krzk@kernel.org>

Hm? Where did I suggest writing such patch?

Are you mixing terms here? I gave you review, no?

> Signed-off-by: Taha Ed-Dafili <0rayn.dev@gmail.com>
> ---
>  .../bindings/iio/dac/adi,ad5504.yaml          | 40 ++++++++++++++++++-
>  1 file changed, 39 insertions(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml b/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
> index 9c2c038683b4..c0b2d470949a 100644
> --- a/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
> +++ b/Documentation/devicetree/bindings/iio/dac/adi,ad5504.yaml
> @@ -10,8 +10,10 @@ maintainers:
>    - Lars-Peter Clausen <lars@metafoo.de>
>    - Jonathan Cameron <jic23@kernel.org>
>  
> -description:
> +description: |
>    High voltage (up to 60V) DACs with temperature sensor alarm function
> +  https://www.analog.com/media/en/technical-documentation/data-sheets/ad5504.pdf
> +  https://www.analog.com/media/en/technical-documentation/data-sheets/ad5501.pdf
>  
>  properties:
>    compatible:
> @@ -27,16 +29,48 @@ properties:
>      maxItems: 1
>  
>    vcc-supply: true
> +  vlogic-supply: true
> +
> +  output-range-microvolt:
> +    description: |
> +      Specify the channel output full scale range. The R_SEL pin
> +      determines if the range is 0-30V or 0-60V.
> +    items:
> +      - const: 0
> +      - enum: [30000000, 60000000]
> +    default: [0, 60000000]
> +
> +  range-sel-gpios:
> +    description:
> +      GPIO connected to the R_SEL pin to select the output voltage range.
> +    maxItems: 1
> +
> +  clear-gpios:
> +    description: GPIO that controls the /CLR pin (active low).
> +    maxItems: 1
> +
> +  ldac-gpios:
> +    description: GPIO that controls the /LDAC pin (active low).
> +    maxItems: 1
>  
>  additionalProperties: false
>  
>  required:
>    - compatible
>    - reg
> +  - vcc-supply

This is technically ABI break and nothing in the commit msg explained
why you are doing this, why this was not required before etc. Changes
you make must come with proper background.

> +
> +allOf:
> +  - not:
> +      required:
> +        - range-sel-gpios
> +        - output-range-microvolt


Best regards,
Krzysztof
Re: [PATCH v2 1/5] dt-bindings: iio: dac: ad5504: add output-range and missing gpios
Posted by Taha Ed-Dafili 3 weeks, 6 days ago
Hi Krzysztof,

I misunderstood how the Suggested-by tag is used. Since
Andy explicitly asked me to sort the headers, and the DT properties were
provided during the v1 review, I thought I should credit those direct
suggestions. My reasoning was simply that those specific patches and
changes wouldn't exist in this series without that feedback.

I now realize this tag is meant for original feature ideas, not standard
review feedback. I will drop the tags across the entire series in v3.

Regarding vcc-supply: I made it required because the driver currently
fails to probe without it. I understand now that this causes an ABI break,
so I will revert it back to optional in v3.

Thank you for the clarification.

Best regards,
Taha
Re: [PATCH v2 1/5] dt-bindings: iio: dac: ad5504: add output-range and missing gpios
Posted by Jonathan Cameron 3 weeks, 2 days ago
On Wed, 11 Mar 2026 09:49:02 +0000
Taha Ed-Dafili <0rayn.dev@gmail.com> wrote:

> Hi Krzysztof,
> 
> I misunderstood how the Suggested-by tag is used. Since
> Andy explicitly asked me to sort the headers, and the DT properties were
> provided during the v1 review, I thought I should credit those direct
> suggestions. My reasoning was simply that those specific patches and
> changes wouldn't exist in this series without that feedback.
> 
> I now realize this tag is meant for original feature ideas, not standard
> review feedback. I will drop the tags across the entire series in v3.
> 
> Regarding vcc-supply: I made it required because the driver currently
> fails to probe without it. I understand now that this causes an ABI break,
> so I will revert it back to optional in v3.
Are you sure it fails to probe?

	ret = devm_regulator_get_enable_read_voltage(&spi->dev, "vcc");
	if (ret < 0 && ret != -ENODEV)
		return ret;
	if (ret == -ENODEV) {
		if (pdata->vref_mv)
			st->vref_mv = pdata->vref_mv;
		else
			dev_warn(&spi->dev, "reference voltage unspecified\n");
	} else {
		st->vref_mv = ret / 1000;
	}

If it's not provided we should get ret == -ENODEV then fall through
to the other paths to either get it or warn if it's not there.

Logically it is required, but we have been papering over the DT
binding not listing that for a while.

Jonathan


> 
> Thank you for the clarification.
> 
> Best regards,
> Taha