Re: [PATCH 1/2] dt-bindings: iio: addac: add AD74115

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Oct 03, 2022 at 12:45:31PM +0200, Krzysztof Kozlowski wrote:
> On 03/10/2022 12:30, Cosmin Tanislav wrote:
> > From: Cosmin Tanislav <cosmin.tanislav@xxxxxxxxxx>
> > 
> > The AD74115H is a single-channel, software-configurable, input and
> > output device for industrial control applications. The AD74115H
> > provides a wide range of use cases, integrated on a single chip.
> > 
> > These use cases include analog output, analog input, digital output,
> > digital input, resistance temperature detector (RTD), and thermocouple
> > measurement capability. The AD74115H also has an integrated HART modem.
> > 
> > A serial peripheral interface (SPI) is used to handle all communications
> > to the device, including communications with the HART modem. The digital
> > input and digital outputs can be accessed via the SPI or the
> > general-purpose input and output (GPIO) pins to support higher
> > speed data rates.
> > 
> > The device features a 16-bit, sigma-delta analog-to-digital converter
> > (ADC) and a 14-bit digital-to-analog converter (DAC).
> > The AD74115H contains a high accuracy 2.5 V on-chip reference that can
> > be used as the DAC and ADC reference.
> > 
> > Signed-off-by: Cosmin Tanislav <cosmin.tanislav@xxxxxxxxxx>
> 
> I got only this patch. Where is the cover letter?
> 
> 
> > ---
> >  .../bindings/iio/addac/adi,ad74115.yaml       | 491 ++++++++++++++++++
> >  MAINTAINERS                                   |   7 +
> >  2 files changed, 498 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/iio/addac/adi,ad74115.yaml
> > 
> > diff --git a/Documentation/devicetree/bindings/iio/addac/adi,ad74115.yaml b/Documentation/devicetree/bindings/iio/addac/adi,ad74115.yaml
> > new file mode 100644
> > index 000000000000..1f894d80b259
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/iio/addac/adi,ad74115.yaml
> 
> Filename matching compatible, so adi,ad74115h.yaml
> 
> > @@ -0,0 +1,491 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/iio/addac/adi,ad74115.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Analog Devices AD74115H device
> > +
> > +maintainers:
> > +  - Cosmin Tanislav <cosmin.tanislav@xxxxxxxxxx>
> > +
> > +description: |
> > +  The AD74115H is a single-channel software configurable input/output
> > +  device for industrial control applications. It contains functionality for
> > +  analog output, analog input, digital output, digital input, resistance
> > +  temperature detector, and thermocouple measurements integrated into a single
> > +  chip solution with an SPI interface. The device features a 16-bit ADC and a
> > +  14-bit DAC.
> > +
> > +    https://www.analog.com/en/products/ad74115h.html
> > +
> 
> Missing allOf-ref to spi properties.
> 
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - adi,ad74115h
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  '#address-cells':
> > +    const: 1
> > +
> > +  '#size-cells':
> > +    const: 0
> > +
> > +  spi-max-frequency:
> > +    maximum: 24000000
> > +
> > +  spi-cpol: true
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  avdd-supply: true
> > +  avcc-supply: true
> > +  dvcc-supply: true
> > +  aldo1v8-supply: true
> > +  dovdd-supply: true
> > +  refin-supply: true
> > +
> > +  adi,ch-func:
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    description: |
> > +      Channel function.
> > +      0 - High impedance
> > +      1 - Voltage output
> > +      2 - Current output
> > +      3 - Voltage input
> > +      4 - Current input, externally-powered
> > +      5 - Current input, loop-powered
> > +      6 - Resistance input
> > +      7 - RTD measure
> > +      8 - Digital input logic
> > +      9 - Digital input, loop-powered
> > +      10 - Current output with HART
> > +      11 - Current input, externally-powered, with HART
> > +      12 - Current input, loop-powered, with HART
> > +    minimum: 0
> > +    maximum: 12
> > +    default: 0
> > +
> > +  adi,conv2-mux:
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    description: |
> > +      Input node for ADC conversion 2.
> 
> node or mode?
> 
> > +      0 - SENSE_EXT1 to AGND_SENSE
> > +      1 - SENSE_EXT2 to AGND_SENSE
> > +      2 - SENSE_EXT2 to SENSE_EXT1
> > +      3 - AGND to AGND
> > +    minimum: 0
> > +    maximum: 3
> > +    default: 0
> > +
> > +  adi,conv2-range:
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    description: |
> > +      Conversion range for ADC conversion 2.
> > +      0 - 0V to 12V
> > +      1 - -12V to +12V
> > +      2 - -2.5V to +2.5V
> > +      3 - -2.5V to 0V
> > +      4 - 0V to 2.5V
> > +      5 - 0V to 0.625V
> > +      6 - -104mV to +104mV
> > +      7 - 0V to 12V
> > +    minimum: 0
> > +    maximum: 7
> > +    default: 0
> > +
> > +  adi,diag0-func:
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> 
> This nicely matches a string enum.

Then the driver has to do a bunch of string comparisons to get back to a 
register setting. Worth it if something common, but for a device 
specific setting, I'd just stick with register field values.

If these are diagnostic/debug, why would you want it in DT to begin 
with? Wouldn't someone want to change this at run-time? Seems like a 
debugfs feature instead.

> 
> > +    description: |
> > +      Diagnostic channel 0 function.
> > +      0 - Disabled
> > +      1 - Temperature sensor
> > +      2 - DVCC
> > +      3 - AVCC
> > +      4 - ALDO1V8
> > +      5 - DLDO1V8
> > +      6 - REFOUT
> > +      7 - AVDD
> > +      8 - AVSS
> > +      9 - LVIN
> > +      10 - SENSEL
> > +      11 - SENSE_EXT1
> > +      12 - SENSE_EXT2
> > +      13 - DO_VDD
> > +      14 - AGND
> > +      15 - Sinking current from external digital output
> > +    minimum: 0
> > +    maximum: 15
> > +    default: 0
> > +
> > +  adi,diag1-func:
> > +    $ref: /schemas/types.yaml#/definitions/uint32
> > +    description: |
> 
> Ditto



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux