| Message ID | 20251030163411.236672-2-ajithanandhan0406@gmail.com |
|---|---|
| State | New |
| Headers | show |
| Series | iio: adc: Add support for TI ADS1120 ADC | expand |
On Thu, 30 Oct 2025 22:04:09 +0530 Ajith Anandhan <ajithanandhan0406@gmail.com> wrote: > Add device tree binding documentation for the Texas Instruments > ADS1120. > > The binding defines required properties like compatible, reg, and > SPI configuration parameters. > > Link: https://www.ti.com/lit/gpn/ads1120 Datasheet: https://www.ti.com/lit/gpn/ads1120 Is a somewhat official tag for these. Though better to put it in the dt-binding doc itself as well or instead of here. > Signed-off-by: Ajith Anandhan <ajithanandhan0406@gmail.com> > --- > .../bindings/iio/adc/ti,ads1120.yaml | 50 +++++++++++++++++++ > 1 file changed, 50 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml > > diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml > new file mode 100644 > index 000000000..09285c981 > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml > @@ -0,0 +1,50 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/iio/adc/ti,ads1120.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Texas Instruments ADS1120 4-channel, 16-bit, 2kSPS ADC > + > +maintainers: > + - Ajith Anandhan <ajithanandhan0406@gmail.com> > + > +properties: > + compatible: > + const: ti,ads1120 > + > + reg: > + maxItems: 1 > + > + spi-max-frequency: > + maximum: 4000000 > + > + spi-cpha: true > + > + "#io-channel-cells": > + const: 1 Power supplies should be here and required (even if real boards rely on stub regulators). Looks like there is an optional reference as well - so include that but not as required (use internal ref if not supplied). There is a data ready pin as well so I'd expect an interrupt. All these should be in the binding from the start as we want it to be as complete as possible. The driver doesn't have to use everything the binding supplies. > + > +required: > + - compatible > + - reg > + > +allOf: > + - $ref: /schemas/spi/spi-peripheral-props.yaml# > + > +unevaluatedProperties: false > + > +examples: > + - | > + spi { > + #address-cells = <1>; > + #size-cells = <0>; > + > + adc@0 { > + compatible = "ti,ads1120"; > + reg = <0>; > + spi-max-frequency = <4000000>; > + spi-cpha; > + }; > + }; > +... > +
On 10/30/25 12:12 PM, Jonathan Cameron wrote: > On Thu, 30 Oct 2025 22:04:09 +0530 > Ajith Anandhan <ajithanandhan0406@gmail.com> wrote: > >> Add device tree binding documentation for the Texas Instruments >> ADS1120. >> >> The binding defines required properties like compatible, reg, and >> SPI configuration parameters. >> >> Link: https://www.ti.com/lit/gpn/ads1120 > Datasheet: https://www.ti.com/lit/gpn/ads1120 > > Is a somewhat official tag for these. Though better to put it in the dt-binding > doc itself as well or instead of here. > >> Signed-off-by: Ajith Anandhan <ajithanandhan0406@gmail.com> >> --- >> .../bindings/iio/adc/ti,ads1120.yaml | 50 +++++++++++++++++++ >> 1 file changed, 50 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml >> >> diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml >> new file mode 100644 >> index 000000000..09285c981 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml >> @@ -0,0 +1,50 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: http://devicetree.org/schemas/iio/adc/ti,ads1120.yaml# >> +$schema: http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: Texas Instruments ADS1120 4-channel, 16-bit, 2kSPS ADC >> + >> +maintainers: >> + - Ajith Anandhan <ajithanandhan0406@gmail.com> >> + >> +properties: >> + compatible: >> + const: ti,ads1120 >> + >> + reg: >> + maxItems: 1 >> + >> + spi-max-frequency: >> + maximum: 4000000 >> + >> + spi-cpha: true >> + >> + "#io-channel-cells": >> + const: 1 > > Power supplies should be here and required (even if real boards > rely on stub regulators). > > Looks like there is an optional reference as well - so include that > but not as required (use internal ref if not supplied). Actually, there are two. REF{P,N}1 is an alternative function of the AIN{0,3} pins. It is also possible that the analog power supply can be used as a reference source instead of the internal one. This came up recently and we glossed over it. However, I think it would make sense to have a flag property that means "the AVSS supply is of sufficient quality that it is better than the internal reference supply", e.g. ti,avdss-is-ref. And drivers can use this info to decide if they want to select it as the reference voltage or not. > > There is a data ready pin as well so I'd expect an interrupt. There is actually two DRDY pins. One is shared with DOUT, so we should have two interrupts and interrupt-names so we know which pin is actually wired up. > > All these should be in the binding from the start as we want it > to be as complete as possible. The driver doesn't have to use everything > the binding supplies. > Another trivial one is an optional clocks property for the external clock. It doesn't need clock-names since there is only one. Additional bindings needed when this is used with temperature sensors are not so trivial though, so we don't need to add those until someone actually needs them.
On 10/30/25 10:42 PM, Jonathan Cameron wrote: > On Thu, 30 Oct 2025 22:04:09 +0530 > Ajith Anandhan <ajithanandhan0406@gmail.com> wrote: > >> Add device tree binding documentation for the Texas Instruments >> ADS1120. >> >> The binding defines required properties like compatible, reg, and >> SPI configuration parameters. >> >> Link: https://www.ti.com/lit/gpn/ads1120 > Datasheet: https://www.ti.com/lit/gpn/ads1120 > > Is a somewhat official tag for these. Though better to put it in the dt-binding > doc itself as well or instead of here. > >> Signed-off-by: Ajith Anandhan <ajithanandhan0406@gmail.com> >> --- >> .../bindings/iio/adc/ti,ads1120.yaml | 50 +++++++++++++++++++ >> 1 file changed, 50 insertions(+) >> create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml >> >> diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml >> new file mode 100644 >> index 000000000..09285c981 >> --- /dev/null >> +++ b/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml >> @@ -0,0 +1,50 @@ >> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >> +%YAML 1.2 >> +--- >> +$id: http://devicetree.org/schemas/iio/adc/ti,ads1120.yaml# >> +$schema: http://devicetree.org/meta-schemas/core.yaml# >> + >> +title: Texas Instruments ADS1120 4-channel, 16-bit, 2kSPS ADC >> + >> +maintainers: >> + - Ajith Anandhan <ajithanandhan0406@gmail.com> >> + >> +properties: >> + compatible: >> + const: ti,ads1120 >> + >> + reg: >> + maxItems: 1 >> + >> + spi-max-frequency: >> + maximum: 4000000 >> + >> + spi-cpha: true >> + >> + "#io-channel-cells": >> + const: 1 > Power supplies should be here and required (even if real boards > rely on stub regulators). > > Looks like there is an optional reference as well - so include that > but not as required (use internal ref if not supplied). > > There is a data ready pin as well so I'd expect an interrupt. > > All these should be in the binding from the start as we want it > to be as complete as possible. The driver doesn't have to use everything > the binding supplies. > >> + >> +required: >> + - compatible >> + - reg >> + >> +allOf: >> + - $ref: /schemas/spi/spi-peripheral-props.yaml# >> + >> +unevaluatedProperties: false >> + >> +examples: >> + - | >> + spi { >> + #address-cells = <1>; >> + #size-cells = <0>; >> + >> + adc@0 { >> + compatible = "ti,ads1120"; >> + reg = <0>; >> + spi-max-frequency = <4000000>; >> + spi-cpha; >> + }; >> + }; >> +... >> + Hi Jonathan, Thank you for the detailed review and helpful suggestions. I'll update the binding to include the following: - Add required power supply property (avdd-supply) and optional vref-supply. - Add interrupt and interrupt-names for DRDY and DOUT. - Move the datasheet link into the dt-binding description. I'll incorporate these changes and resend as a V2 (non-RFC) patch series.
On 10/31/25 1:34 AM, David Lechner wrote: > On 10/30/25 12:12 PM, Jonathan Cameron wrote: >> On Thu, 30 Oct 2025 22:04:09 +0530 >> Ajith Anandhan<ajithanandhan0406@gmail.com> wrote: >> >>> Add device tree binding documentation for the Texas Instruments >>> ADS1120. >>> >>> The binding defines required properties like compatible, reg, and >>> SPI configuration parameters. >>> >>> Link:https://www.ti.com/lit/gpn/ads1120 >> Datasheet:https://www.ti.com/lit/gpn/ads1120 >> >> Is a somewhat official tag for these. Though better to put it in the dt-binding >> doc itself as well or instead of here. >> >>> Signed-off-by: Ajith Anandhan<ajithanandhan0406@gmail.com> >>> --- >>> .../bindings/iio/adc/ti,ads1120.yaml | 50 +++++++++++++++++++ >>> 1 file changed, 50 insertions(+) >>> create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml >>> >>> diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml >>> new file mode 100644 >>> index 000000000..09285c981 >>> --- /dev/null >>> +++ b/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml >>> @@ -0,0 +1,50 @@ >>> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) >>> +%YAML 1.2 >>> +--- >>> +$id:http://devicetree.org/schemas/iio/adc/ti,ads1120.yaml# >>> +$schema:http://devicetree.org/meta-schemas/core.yaml# >>> + >>> +title: Texas Instruments ADS1120 4-channel, 16-bit, 2kSPS ADC >>> + >>> +maintainers: >>> + - Ajith Anandhan<ajithanandhan0406@gmail.com> >>> + >>> +properties: >>> + compatible: >>> + const: ti,ads1120 >>> + >>> + reg: >>> + maxItems: 1 >>> + >>> + spi-max-frequency: >>> + maximum: 4000000 >>> + >>> + spi-cpha: true >>> + >>> + "#io-channel-cells": >>> + const: 1 >> Power supplies should be here and required (even if real boards >> rely on stub regulators). >> >> Looks like there is an optional reference as well - so include that >> but not as required (use internal ref if not supplied). > Actually, there are two. REF{P,N}1 is an alternative function of > the AIN{0,3} pins. I'll add avdd-supply as required and vref-supply as optional to support both external reference configurations (REFP0/REFN0 and REFP1/REFN1). > > It is also possible that the analog power supply can be used as > a reference source instead of the internal one. > > This came up recently and we glossed over it. However, I think > it would make sense to have a flag property that means "the > AVSS supply is of sufficient quality that it is better than > the internal reference supply", e.g. ti,avdss-is-ref. And > drivers can use this info to decide if they want to select it > as the reference voltage or not. I'll add the ti,avdss-is-ref boolean property to let the driver know when AVDD is suitable as a reference source. > >> There is a data ready pin as well so I'd expect an interrupt. > There is actually two DRDY pins. One is shared with DOUT, so we > should have two interrupts and interrupt-names so we know which > pin is actually wired up. Thanks for the clarification. I'll add support for up to two interrupts with interrupt-names ("drdy" and "dout") to handle both pin configurations. > >> All these should be in the binding from the start as we want it >> to be as complete as possible. The driver doesn't have to use everything >> the binding supplies. >> > Another trivial one is an optional clocks property for the external > clock. It doesn't need clock-names since there is only one. Will add the optional clocks property for external clock support. > > Additional bindings needed when this is used with temperature sensors > are not so trivial though, so we don't need to add those until someone > actually needs them. I'll incorporate all these changes in v2. Thank you both for the thorough review!
diff --git a/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml b/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml new file mode 100644 index 000000000..09285c981 --- /dev/null +++ b/Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml @@ -0,0 +1,50 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/adc/ti,ads1120.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Texas Instruments ADS1120 4-channel, 16-bit, 2kSPS ADC + +maintainers: + - Ajith Anandhan <ajithanandhan0406@gmail.com> + +properties: + compatible: + const: ti,ads1120 + + reg: + maxItems: 1 + + spi-max-frequency: + maximum: 4000000 + + spi-cpha: true + + "#io-channel-cells": + const: 1 + +required: + - compatible + - reg + +allOf: + - $ref: /schemas/spi/spi-peripheral-props.yaml# + +unevaluatedProperties: false + +examples: + - | + spi { + #address-cells = <1>; + #size-cells = <0>; + + adc@0 { + compatible = "ti,ads1120"; + reg = <0>; + spi-max-frequency = <4000000>; + spi-cpha; + }; + }; +... +
Add device tree binding documentation for the Texas Instruments ADS1120. The binding defines required properties like compatible, reg, and SPI configuration parameters. Link: https://www.ti.com/lit/gpn/ads1120 Signed-off-by: Ajith Anandhan <ajithanandhan0406@gmail.com> --- .../bindings/iio/adc/ti,ads1120.yaml | 50 +++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/adc/ti,ads1120.yaml