[PATCH v2 2/6] dt-bindings: iio: amplifiers: Add AD8366 support

Rodrigo Alencar via B4 Relay posted 6 patches 1 week, 6 days ago
There is a newer version of this series
[PATCH v2 2/6] dt-bindings: iio: amplifiers: Add AD8366 support
Posted by Rodrigo Alencar via B4 Relay 1 week, 6 days ago
From: Rodrigo Alencar <rodrigo.alencar@analog.com>

Add device tree binding documentation for amplifiers and digital
attenuators. This covers different device variants with similar
SPI control.

Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
---
 .../bindings/iio/amplifiers/adi,ad8366.yaml        | 68 ++++++++++++++++++++++
 MAINTAINERS                                        |  1 +
 2 files changed, 69 insertions(+)

diff --git a/Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml b/Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml
new file mode 100644
index 000000000000..02f790fd73d7
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml
@@ -0,0 +1,68 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/amplifiers/adi,ad8366.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: AD8366 and similar Gain Amplifiers and Digital Attenuators
+
+maintainers:
+  - Michael Hennerich <michael.hennerich@analog.com>
+  - Rodrigo Alencar <rodrigo.alencar@analog.com>
+
+description:
+  Digital Variable Gain Amplifiers (VGAs) and Digital Attenuators with
+  SPI interface.
+
+properties:
+  compatible:
+    enum:
+      - adi,ad8366
+      - adi,ada4961
+      - adi,adl5240
+      - adi,adrf5720
+      - adi,adrf5730
+      - adi,adrf5731
+      - adi,hmc271a
+      - adi,hmc792a
+      - adi,hmc1018a
+      - adi,hmc1019a
+      - adi,hmc1119
+
+  reg:
+    maxItems: 1
+
+  vcc-supply:
+    description: Regulator that provides power to the device.
+
+  reset-gpios:
+    maxItems: 1
+
+  enable-gpios:
+    maxItems: 1
+
+required:
+  - compatible
+  - reg
+  - vcc-supply
+
+allOf:
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    spi {
+      #address-cells = <1>;
+      #size-cells = <0>;
+
+      amplifier@0 {
+        compatible = "adi,ad8366";
+        reg = <0>;
+        spi-max-frequency = <1000000>;
+        vcc-supply = <&vcc_3v3>;
+      };
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 8b5bb7030fa6..c3403ae478b7 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1589,6 +1589,7 @@ M:	Rodrigo Alencar <rodrigo.alencar@analog.com>
 L:	linux-iio@vger.kernel.org
 S:	Supported
 W:	https://ez.analog.com/linux-software-drivers
+F:	Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml
 F:	drivers/iio/amplifiers/ad8366.c
 
 ANALOG DEVICES INC AD9467 DRIVER

-- 
2.43.0
Re: [PATCH v2 2/6] dt-bindings: iio: amplifiers: Add AD8366 support
Posted by David Lechner 1 week, 1 day ago
On 1/26/26 7:51 AM, Rodrigo Alencar via B4 Relay wrote:
> From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> 
> Add device tree binding documentation for amplifiers and digital
> attenuators. This covers different device variants with similar
> SPI control.
> 

...

> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>

This header isn't needed for this example.

> +    spi {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      amplifier@0 {
> +        compatible = "adi,ad8366";
> +        reg = <0>;
> +        spi-max-frequency = <1000000>;
> +        vcc-supply = <&vcc_3v3>;
> +      };
> +    };
Re: [PATCH v2 2/6] dt-bindings: iio: amplifiers: Add AD8366 support
Posted by Conor Dooley 1 week, 6 days ago
On Mon, Jan 26, 2026 at 01:51:03PM +0000, Rodrigo Alencar via B4 Relay wrote:
> From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> 
> Add device tree binding documentation for amplifiers and digital
> attenuators. This covers different device variants with similar
> SPI control.
> 
> Signed-off-by: Rodrigo Alencar <rodrigo.alencar@analog.com>
> ---
>  .../bindings/iio/amplifiers/adi,ad8366.yaml        | 68 ++++++++++++++++++++++
>  MAINTAINERS                                        |  1 +
>  2 files changed, 69 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml b/Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml
> new file mode 100644
> index 000000000000..02f790fd73d7
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml
> @@ -0,0 +1,68 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/amplifiers/adi,ad8366.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: AD8366 and similar Gain Amplifiers and Digital Attenuators
> +
> +maintainers:
> +  - Michael Hennerich <michael.hennerich@analog.com>
> +  - Rodrigo Alencar <rodrigo.alencar@analog.com>
> +
> +description:
> +  Digital Variable Gain Amplifiers (VGAs) and Digital Attenuators with
> +  SPI interface.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - adi,ad8366
> +      - adi,ada4961
> +      - adi,adl5240
> +      - adi,adrf5720
> +      - adi,adrf5730
> +      - adi,adrf5731
> +      - adi,hmc271a
> +      - adi,hmc792a
> +      - adi,hmc1018a
> +      - adi,hmc1019a
> +      - adi,hmc1119

Why do none of these devices use fallback compatibles? Please put the
rationale in the commit message.

> +
> +  reg:
> +    maxItems: 1
> +
> +  vcc-supply:
> +    description: Regulator that provides power to the device.
> +
> +  reset-gpios:
> +    maxItems: 1
> +
> +  enable-gpios:
> +    maxItems: 1

How come enable-gpios is optional? Is it optional on all devices?
Do all devices support enable-gpios and/or reset-gpios?

Cheers,
Conor.

> +
> +required:
> +  - compatible
> +  - reg
> +  - vcc-supply
> +
> +allOf:
> +  - $ref: /schemas/spi/spi-peripheral-props.yaml#
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +    spi {
> +      #address-cells = <1>;
> +      #size-cells = <0>;
> +
> +      amplifier@0 {
> +        compatible = "adi,ad8366";
> +        reg = <0>;
> +        spi-max-frequency = <1000000>;
> +        vcc-supply = <&vcc_3v3>;
> +      };
> +    };
> +...
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 8b5bb7030fa6..c3403ae478b7 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1589,6 +1589,7 @@ M:	Rodrigo Alencar <rodrigo.alencar@analog.com>
>  L:	linux-iio@vger.kernel.org
>  S:	Supported
>  W:	https://ez.analog.com/linux-software-drivers
> +F:	Documentation/devicetree/bindings/iio/amplifiers/adi,ad8366.yaml
>  F:	drivers/iio/amplifiers/ad8366.c
>  
>  ANALOG DEVICES INC AD9467 DRIVER
> 
> -- 
> 2.43.0
> 
> 
Re: [PATCH v2 2/6] dt-bindings: iio: amplifiers: Add AD8366 support
Posted by Rodrigo Alencar 1 week, 5 days ago
On 26/01/26 08:11PM, Conor Dooley wrote:
> On Mon, Jan 26, 2026 at 01:51:03PM +0000, Rodrigo Alencar via B4 Relay wrote:
> > From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> > 
> > Add device tree binding documentation for amplifiers and digital
> > attenuators. This covers different device variants with similar
> > SPI control.

...

> > +properties:
> > +  compatible:
> > +    enum:
> > +      - adi,ad8366
> > +      - adi,ada4961
> > +      - adi,adl5240
> > +      - adi,adrf5720
> > +      - adi,adrf5730
> > +      - adi,adrf5731
> > +      - adi,hmc271a
> > +      - adi,hmc792a
> > +      - adi,hmc1018a
> > +      - adi,hmc1019a
> > +      - adi,hmc1119
> 
> Why do none of these devices use fallback compatibles? Please put the
> rationale in the commit message.

Will do. Each device has their own gain range/step. 

> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  vcc-supply:
> > +    description: Regulator that provides power to the device.
> > +
> > +  reset-gpios:
> > +    maxItems: 1
> > +
> > +  enable-gpios:
> > +    maxItems: 1
> 
> How come enable-gpios is optional? Is it optional on all devices?
> Do all devices support enable-gpios and/or reset-gpios?

Board designs often hardwire powerup or serial mode enable signals
to high voltage level, so there will not be a reason to add the
enable-gpio.
I went over the device datasheets and I could not find the
reason for the reset gpio. I left it there because it was being used
in the current driver implementation, and I would not like to
invalidate designs that might be currently using it. I will ask around.

-- 
Kind regards,

Rodrigo Alencar
Re: [PATCH v2 2/6] dt-bindings: iio: amplifiers: Add AD8366 support
Posted by Conor Dooley 1 week, 5 days ago
On Tue, Jan 27, 2026 at 11:37:52AM +0000, Rodrigo Alencar wrote:
> On 26/01/26 08:11PM, Conor Dooley wrote:
> > On Mon, Jan 26, 2026 at 01:51:03PM +0000, Rodrigo Alencar via B4 Relay wrote:
> > > From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> > > 
> > > Add device tree binding documentation for amplifiers and digital
> > > attenuators. This covers different device variants with similar
> > > SPI control.
> 
> ...
> 
> > > +properties:
> > > +  compatible:
> > > +    enum:
> > > +      - adi,ad8366
> > > +      - adi,ada4961
> > > +      - adi,adl5240
> > > +      - adi,adrf5720
> > > +      - adi,adrf5730
> > > +      - adi,adrf5731
> > > +      - adi,hmc271a
> > > +      - adi,hmc792a
> > > +      - adi,hmc1018a
> > > +      - adi,hmc1019a
> > > +      - adi,hmc1119
> > 
> > Why do none of these devices use fallback compatibles? Please put the
> > rationale in the commit message.
> 
> Will do. Each device has their own gain range/step. 
> 
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  vcc-supply:
> > > +    description: Regulator that provides power to the device.
> > > +
> > > +  reset-gpios:
> > > +    maxItems: 1
> > > +
> > > +  enable-gpios:
> > > +    maxItems: 1
> > 
> > How come enable-gpios is optional? Is it optional on all devices?
> > Do all devices support enable-gpios and/or reset-gpios?
> 
> Board designs often hardwire powerup or serial mode enable signals
> to high voltage level, so there will not be a reason to add the
> enable-gpio.

I don't see anything about all devices supporting enable-gpios, adl5240
doesn't appear to have one? I'm not going to check all of the datasheets
to see about the others, but you should disallow the property on devices
that don't have an enable pin.

> I went over the device datasheets and I could not find the
> reason for the reset gpio. I left it there because it was being used
> in the current driver implementation, and I would not like to
> invalidate designs that might be currently using it. I will ask around.

If none of the devices have a reset pin, then you should delete the
property from the binding and the driver. Not like you're going to break
something if none of the supported devices even have the pin!
Re: [PATCH v2 2/6] dt-bindings: iio: amplifiers: Add AD8366 support
Posted by Rodrigo Alencar 1 week, 4 days ago
On 26/01/27 07:38PM, Conor Dooley wrote:
> On Tue, Jan 27, 2026 at 11:37:52AM +0000, Rodrigo Alencar wrote:
> > On 26/01/26 08:11PM, Conor Dooley wrote:
> > > On Mon, Jan 26, 2026 at 01:51:03PM +0000, Rodrigo Alencar via B4 Relay wrote:
> > > > From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> > > > 
> > > > Add device tree binding documentation for amplifiers and digital
> > > > attenuators. This covers different device variants with similar
> > > > SPI control.
> > 
> > ...
> > 
> > > > +properties:
> > > > +  compatible:
> > > > +    enum:
> > > > +      - adi,ad8366
> > > > +      - adi,ada4961
> > > > +      - adi,adl5240
> > > > +      - adi,adrf5720
> > > > +      - adi,adrf5730
> > > > +      - adi,adrf5731
> > > > +      - adi,hmc271a
> > > > +      - adi,hmc792a
> > > > +      - adi,hmc1018a
> > > > +      - adi,hmc1019a
> > > > +      - adi,hmc1119
> > > 
> > > Why do none of these devices use fallback compatibles? Please put the
> > > rationale in the commit message.
> > 
> > Will do. Each device has their own gain range/step. 
> > 
> > > > +
> > > > +  reg:
> > > > +    maxItems: 1
> > > > +
> > > > +  vcc-supply:
> > > > +    description: Regulator that provides power to the device.
> > > > +
> > > > +  reset-gpios:
> > > > +    maxItems: 1
> > > > +
> > > > +  enable-gpios:
> > > > +    maxItems: 1
> > > 
> > > How come enable-gpios is optional? Is it optional on all devices?
> > > Do all devices support enable-gpios and/or reset-gpios?
> > 
> > Board designs often hardwire powerup or serial mode enable signals
> > to high voltage level, so there will not be a reason to add the
> > enable-gpio.
> 
> I don't see anything about all devices supporting enable-gpios, adl5240
> doesn't appear to have one? I'm not going to check all of the datasheets
> to see about the others, but you should disallow the property on devices
> that don't have an enable pin.

Understood. I will prepare the following for v3:

allOf:
  - $ref: /schemas/spi/spi-peripheral-props.yaml#
  - if:
      properties:
        compatible:
          contains:
            const: adi,hmc271a
    then:
      properties:
        reset-gpios:
          maxItems: 1
  - if:
      properties:
        compatible:
          contains:
            anyOf:
              - const: adi,ad8366
              - const: adi,ada4961
              - const: adi,adrf5720
              - const: adi,adrf5730
              - const: adi,adrf5731
              - const: adi,hmc792a
              - const: adi,hmc1018a
              - const: adi,hmc1019a
              - const: adi,hmc1119
    then:
      properties:
        enable-gpios:
          maxItems: 1
          description: Power-up or Serial Mode Enable GPIO.

> > I went over the device datasheets and I could not find the
> > reason for the reset gpio. I left it there because it was being used
> > in the current driver implementation, and I would not like to
> > invalidate designs that might be currently using it. I will ask around.
> 
> If none of the devices have a reset pin, then you should delete the
> property from the binding and the driver. Not like you're going to break
> something if none of the supported devices even have the pin!

The pin might have been there due to an old revision of the ada4961 device
(the reset_gpio was added to the code when ada4961 support was included)
which I can't find related documentation. However, it turns out that
hmc271a contains a reset pin, as you can see above.

-- 
Kind regards,

Rodrigo Alencar
Re: [PATCH v2 2/6] dt-bindings: iio: amplifiers: Add AD8366 support
Posted by Conor Dooley 1 week, 4 days ago
On Wed, Jan 28, 2026 at 09:39:12AM +0000, Rodrigo Alencar wrote:
> On 26/01/27 07:38PM, Conor Dooley wrote:
> > On Tue, Jan 27, 2026 at 11:37:52AM +0000, Rodrigo Alencar wrote:
> > > On 26/01/26 08:11PM, Conor Dooley wrote:
> > > > On Mon, Jan 26, 2026 at 01:51:03PM +0000, Rodrigo Alencar via B4 Relay wrote:
> > > > > From: Rodrigo Alencar <rodrigo.alencar@analog.com>
> > > > > 
> > > > > Add device tree binding documentation for amplifiers and digital
> > > > > attenuators. This covers different device variants with similar
> > > > > SPI control.
> > > 
> > > ...
> > > 
> > > > > +properties:
> > > > > +  compatible:
> > > > > +    enum:
> > > > > +      - adi,ad8366
> > > > > +      - adi,ada4961
> > > > > +      - adi,adl5240
> > > > > +      - adi,adrf5720
> > > > > +      - adi,adrf5730
> > > > > +      - adi,adrf5731
> > > > > +      - adi,hmc271a
> > > > > +      - adi,hmc792a
> > > > > +      - adi,hmc1018a
> > > > > +      - adi,hmc1019a
> > > > > +      - adi,hmc1119
> > > > 
> > > > Why do none of these devices use fallback compatibles? Please put the
> > > > rationale in the commit message.
> > > 
> > > Will do. Each device has their own gain range/step. 
> > > 
> > > > > +
> > > > > +  reg:
> > > > > +    maxItems: 1
> > > > > +
> > > > > +  vcc-supply:
> > > > > +    description: Regulator that provides power to the device.
> > > > > +
> > > > > +  reset-gpios:
> > > > > +    maxItems: 1
> > > > > +
> > > > > +  enable-gpios:
> > > > > +    maxItems: 1
> > > > 
> > > > How come enable-gpios is optional? Is it optional on all devices?
> > > > Do all devices support enable-gpios and/or reset-gpios?
> > > 
> > > Board designs often hardwire powerup or serial mode enable signals
> > > to high voltage level, so there will not be a reason to add the
> > > enable-gpio.
> > 
> > I don't see anything about all devices supporting enable-gpios, adl5240
> > doesn't appear to have one? I'm not going to check all of the datasheets
> > to see about the others, but you should disallow the property on devices
> > that don't have an enable pin.
> 
> Understood. I will prepare the following for v3:
> 
> allOf:
>   - $ref: /schemas/spi/spi-peripheral-props.yaml#
>   - if:
>       properties:
>         compatible:
>           contains:
>             const: adi,hmc271a
>     then:
>       properties:
>         reset-gpios:
>           maxItems: 1

This doesn't look right. The stuff you currently have in the patch
should remain, and this should become
if:
  properties:
    compatible:
      not:
        contains:
          const: adi,hmc271a
then:
  properties:
    reset-gpios: false

>   - if:
>       properties:
>         compatible:
>           contains:
>             anyOf:
>               - const: adi,ad8366
>               - const: adi,ada4961
>               - const: adi,adrf5720
>               - const: adi,adrf5730
>               - const: adi,adrf5731
>               - const: adi,hmc792a
>               - const: adi,hmc1018a
>               - const: adi,hmc1019a
>               - const: adi,hmc1119
>     then:
>       properties:
>         enable-gpios:
>           maxItems: 1
>           description: Power-up or Serial Mode Enable GPIO.

Same for this.

Thanks,
Conor.

> 
> > > I went over the device datasheets and I could not find the
> > > reason for the reset gpio. I left it there because it was being used
> > > in the current driver implementation, and I would not like to
> > > invalidate designs that might be currently using it. I will ask around.
> > 
> > If none of the devices have a reset pin, then you should delete the
> > property from the binding and the driver. Not like you're going to break
> > something if none of the supported devices even have the pin!
> 
> The pin might have been there due to an old revision of the ada4961 device
> (the reset_gpio was added to the code when ada4961 support was included)
> which I can't find related documentation. However, it turns out that
> hmc271a contains a reset pin, as you can see above.
> 
> -- 
> Kind regards,
> 
> Rodrigo Alencar