Message ID | 20200316125312.39178-7-nuno.sa@analog.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Support ADIS16475 and similar IMUs | expand |
On Mon, 16 Mar 2020 13:53:12 +0100 Nuno Sá <nuno.sa@analog.com> wrote: > Document the ADIS16475 device devicetree bindings. > > Signed-off-by: Nuno Sá <nuno.sa@analog.com> Hmm. A bit fiddly so definitely want a review from Rob. Thanks, Jonathan > --- > Changes in v2: > * Remove burst32 property; > * Rename clk-mode to adi,sync-mode; > * Remove clock-names; > * Add conditionals to state that clocks is only needed depending on adi,sync-mode property > > .../bindings/iio/imu/adi,adis16475.yaml | 146 ++++++++++++++++++ > MAINTAINERS | 1 + > 2 files changed, 147 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > > diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > new file mode 100644 > index 000000000000..9eeb42773edd > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > @@ -0,0 +1,146 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/iio/imu/adi,adis16475.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Analog Devices ADIS16475 and similar IMUs > + > +maintainers: > + - Nuno Sá <nuno.sa@analog.com> > + > +description: | > + Analog Devices ADIS16475 and similar IMUs > + https://www.analog.com/media/en/technical-documentation/data-sheets/ADIS16475.pdf > + > +properties: > + compatible: > + enum: > + - adi,adis16475-1 > + - adi,adis16475-2 > + - adi,adis16475-3 > + - adi,adis16477-1 > + - adi,adis16477-2 > + - adi,adis16477-3 > + - adi,adis16470 > + - adi,adis16465-1 > + - adi,adis16465-2 > + - adi,adis16465-3 > + - adi,adis16467-1 > + - adi,adis16467-2 > + - adi,adis16467-3 > + - adi,adis16500 > + - adi,adis16505-1 > + - adi,adis16505-2 > + - adi,adis16505-3 > + - adi,adis16507-1 > + - adi,adis16507-2 > + - adi,adis16507-3 > + > + reg: > + maxItems: 1 > + > + spi-cpha: true > + > + spi-cpol: true > + > + spi-max-frequency: > + maximum: 2000000 > + > + interrupts: > + maxItems: 1 > + > + clocks: > + maxItems: 1 > + > + reset-gpios: > + description: > + Must be the device tree identifier of the RESET pin. If specified, > + it will be asserted during driver probe. As the line is active low, > + it should be marked GPIO_ACTIVE_LOW. > + maxItems: 1 > + > + adi,sync-mode: > + description: > + Configures the device SYNC pin. The following modes are supported > + 0 - output_sync > + 1 - direct_sync > + 2 - scaled_sync > + 3 - pulse_sync > + allOf: > + - $ref: /schemas/types.yaml#/definitions/uint32 > + minimum: 0 > + maximum: 3 > + > + adi,scaled-output-hz: > + description: > + This property must be present if the clock mode is scaled-sync through > + clock-names property. In this mode, the input clock can have a range > + of 1Hz to 128HZ which must be scaled to originate an allowable sample > + rate. This property specifies that rate. > + minimum: 1900 > + maximum: 2100 > + > +required: > + - compatible > + - reg > + - interrupts > + - spi-cpha > + - spi-cpol > + > +if: > + properties: > + compatible: > + contains: > + enum: > + - adi,adis16500 > + - adi,adis16505-1 > + - adi,adis16505-2 > + - adi,adis16505-3 > + - adi,adis16507-1 > + - adi,adis16507-2 > + - adi,adis16507-3 > + > +then: > + properties: > + adi,sync-mode: > + minimum: 0 > + maximum: 2 > + > + if: > + properties: > + adi,sync-mode: > + enum: [1, 2] > + > + then: > + dependencies: > + adi,sync-mode: [ clocks ] > + > +else: > + if: > + properties: > + adi,sync-mode: > + enum: [1, 2, 3] > + > + then: > + dependencies: > + adi,sync-mode: [ clocks ] > + > +examples: > + - | > + #include <dt-bindings/interrupt-controller/irq.h> > + spi { > + #address-cells = <1>; > + #size-cells = <0>; > + > + adis16475: adis16475-3@0 { Generic name for nodes. imu I guess here. > + compatible = "adi,adis16475-3"; > + reg = <0>; > + spi-cpha; > + spi-cpol; > + spi-max-frequency = <2000000>; > + interrupts = <4 IRQ_TYPE_EDGE_RISING>; > + interrupt-parent = <&gpio>; > + }; > + }; > +... > diff --git a/MAINTAINERS b/MAINTAINERS > index f11262f1f3bb..f8ccc92ab378 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1015,6 +1015,7 @@ W: http://ez.analog.com/community/linux-device-drivers > S: Supported > F: drivers/iio/imu/adis16475.c > F: Documentation/ABI/testing/sysfs-bus-iio-imu-adis16475 > +F: Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > > ANALOG DEVICES INC ADM1177 DRIVER > M: Beniamin Bia <beniamin.bia@analog.com>
On Mon, Mar 16, 2020 at 01:53:12PM +0100, Nuno Sá wrote: > Document the ADIS16475 device devicetree bindings. > > Signed-off-by: Nuno Sá <nuno.sa@analog.com> > --- > Changes in v2: > * Remove burst32 property; > * Rename clk-mode to adi,sync-mode; > * Remove clock-names; > * Add conditionals to state that clocks is only needed depending on adi,sync-mode property > > .../bindings/iio/imu/adi,adis16475.yaml | 146 ++++++++++++++++++ > MAINTAINERS | 1 + > 2 files changed, 147 insertions(+) > create mode 100644 Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > > diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > new file mode 100644 > index 000000000000..9eeb42773edd > --- /dev/null > +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > @@ -0,0 +1,146 @@ > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/iio/imu/adi,adis16475.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: Analog Devices ADIS16475 and similar IMUs > + > +maintainers: > + - Nuno Sá <nuno.sa@analog.com> > + > +description: | > + Analog Devices ADIS16475 and similar IMUs > + https://www.analog.com/media/en/technical-documentation/data-sheets/ADIS16475.pdf > + > +properties: > + compatible: > + enum: > + - adi,adis16475-1 > + - adi,adis16475-2 > + - adi,adis16475-3 > + - adi,adis16477-1 > + - adi,adis16477-2 > + - adi,adis16477-3 > + - adi,adis16470 > + - adi,adis16465-1 > + - adi,adis16465-2 > + - adi,adis16465-3 > + - adi,adis16467-1 > + - adi,adis16467-2 > + - adi,adis16467-3 > + - adi,adis16500 > + - adi,adis16505-1 > + - adi,adis16505-2 > + - adi,adis16505-3 > + - adi,adis16507-1 > + - adi,adis16507-2 > + - adi,adis16507-3 > + > + reg: > + maxItems: 1 > + > + spi-cpha: true > + > + spi-cpol: true > + > + spi-max-frequency: > + maximum: 2000000 > + > + interrupts: > + maxItems: 1 > + > + clocks: > + maxItems: 1 > + > + reset-gpios: > + description: > + Must be the device tree identifier of the RESET pin. If specified, > + it will be asserted during driver probe. As the line is active low, > + it should be marked GPIO_ACTIVE_LOW. > + maxItems: 1 > + > + adi,sync-mode: > + description: > + Configures the device SYNC pin. The following modes are supported > + 0 - output_sync > + 1 - direct_sync > + 2 - scaled_sync > + 3 - pulse_sync > + allOf: > + - $ref: /schemas/types.yaml#/definitions/uint32 > + minimum: 0 > + maximum: 3 > + > + adi,scaled-output-hz: > + description: > + This property must be present if the clock mode is scaled-sync through > + clock-names property. In this mode, the input clock can have a range > + of 1Hz to 128HZ which must be scaled to originate an allowable sample > + rate. This property specifies that rate. > + minimum: 1900 > + maximum: 2100 > + > +required: > + - compatible > + - reg > + - interrupts > + - spi-cpha > + - spi-cpol > + > +if: > + properties: > + compatible: > + contains: > + enum: > + - adi,adis16500 > + - adi,adis16505-1 > + - adi,adis16505-2 > + - adi,adis16505-3 > + - adi,adis16507-1 > + - adi,adis16507-2 > + - adi,adis16507-3 > + > +then: > + properties: > + adi,sync-mode: > + minimum: 0 > + maximum: 2 > + > + if: > + properties: > + adi,sync-mode: > + enum: [1, 2] > + > + then: > + dependencies: > + adi,sync-mode: [ clocks ] You can remove this if/then if you... > + > +else: > + if: > + properties: > + adi,sync-mode: > + enum: [1, 2, 3] > + > + then: > + dependencies: > + adi,sync-mode: [ clocks ] ...put this if by itself under an 'allOf'. (And then the 1st if should go under the 'allOf' too). > + > +examples: > + - | > + #include <dt-bindings/interrupt-controller/irq.h> > + spi { > + #address-cells = <1>; > + #size-cells = <0>; > + > + adis16475: adis16475-3@0 { > + compatible = "adi,adis16475-3"; > + reg = <0>; > + spi-cpha; > + spi-cpol; > + spi-max-frequency = <2000000>; > + interrupts = <4 IRQ_TYPE_EDGE_RISING>; > + interrupt-parent = <&gpio>; > + }; > + }; > +... > diff --git a/MAINTAINERS b/MAINTAINERS > index f11262f1f3bb..f8ccc92ab378 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1015,6 +1015,7 @@ W: http://ez.analog.com/community/linux-device-drivers > S: Supported > F: drivers/iio/imu/adis16475.c > F: Documentation/ABI/testing/sysfs-bus-iio-imu-adis16475 > +F: Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > > ANALOG DEVICES INC ADM1177 DRIVER > M: Beniamin Bia <beniamin.bia@analog.com> > -- > 2.25.1 >
> From: linux-iio-owner@vger.kernel.org <linux-iio-owner@vger.kernel.org> On > Behalf Of Rob Herring > Sent: Montag, 30. März 2020 22:33 > To: Sa, Nuno <Nuno.Sa@analog.com> > Cc: linux-iio@vger.kernel.org; devicetree@vger.kernel.org; Jonathan Cameron > <jic23@kernel.org>; Hartmut Knaack <knaack.h@gmx.de>; Lars-Peter Clausen > <lars@metafoo.de>; Peter Meerwald-Stadler <pmeerw@pmeerw.net>; Mark > Rutland <mark.rutland@arm.com>; Ardelean, Alexandru > <alexandru.Ardelean@analog.com>; Hennerich, Michael > <Michael.Hennerich@analog.com> > Subject: Re: [PATCH v2 6/6] dt-bindings: iio: Add adis16475 documentation > > On Mon, Mar 16, 2020 at 01:53:12PM +0100, Nuno Sá wrote: > > Document the ADIS16475 device devicetree bindings. > > > > Signed-off-by: Nuno Sá <nuno.sa@analog.com> > > --- > > Changes in v2: > > * Remove burst32 property; > > * Rename clk-mode to adi,sync-mode; > > * Remove clock-names; > > * Add conditionals to state that clocks is only needed depending on > adi,sync-mode property > > > > .../bindings/iio/imu/adi,adis16475.yaml | 146 ++++++++++++++++++ > > MAINTAINERS | 1 + > > 2 files changed, 147 insertions(+) > > create mode 100644 > Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > > > > diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > > new file mode 100644 > > index 000000000000..9eeb42773edd > > --- /dev/null > > +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > > @@ -0,0 +1,146 @@ > > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > > +%YAML 1.2 > > +--- > > +$id: http://devicetree.org/schemas/iio/imu/adi,adis16475.yaml# > > +$schema: http://devicetree.org/meta-schemas/core.yaml# > > + > > +title: Analog Devices ADIS16475 and similar IMUs > > + > > +maintainers: > > + - Nuno Sá <nuno.sa@analog.com> > > + > > +description: | > > + Analog Devices ADIS16475 and similar IMUs > > + https://www.analog.com/media/en/technical-documentation/data- > sheets/ADIS16475.pdf > > + > > +properties: > > + compatible: > > + enum: > > + - adi,adis16475-1 > > + - adi,adis16475-2 > > + - adi,adis16475-3 > > + - adi,adis16477-1 > > + - adi,adis16477-2 > > + - adi,adis16477-3 > > + - adi,adis16470 > > + - adi,adis16465-1 > > + - adi,adis16465-2 > > + - adi,adis16465-3 > > + - adi,adis16467-1 > > + - adi,adis16467-2 > > + - adi,adis16467-3 > > + - adi,adis16500 > > + - adi,adis16505-1 > > + - adi,adis16505-2 > > + - adi,adis16505-3 > > + - adi,adis16507-1 > > + - adi,adis16507-2 > > + - adi,adis16507-3 > > + > > + reg: > > + maxItems: 1 > > + > > + spi-cpha: true > > + > > + spi-cpol: true > > + > > + spi-max-frequency: > > + maximum: 2000000 > > + > > + interrupts: > > + maxItems: 1 > > + > > + clocks: > > + maxItems: 1 > > + > > + reset-gpios: > > + description: > > + Must be the device tree identifier of the RESET pin. If specified, > > + it will be asserted during driver probe. As the line is active low, > > + it should be marked GPIO_ACTIVE_LOW. > > + maxItems: 1 > > + > > + adi,sync-mode: > > + description: > > + Configures the device SYNC pin. The following modes are supported > > + 0 - output_sync > > + 1 - direct_sync > > + 2 - scaled_sync > > + 3 - pulse_sync > > + allOf: > > + - $ref: /schemas/types.yaml#/definitions/uint32 > > + minimum: 0 > > + maximum: 3 > > + > > + adi,scaled-output-hz: > > + description: > > + This property must be present if the clock mode is scaled-sync through > > + clock-names property. In this mode, the input clock can have a range > > + of 1Hz to 128HZ which must be scaled to originate an allowable sample > > + rate. This property specifies that rate. > > + minimum: 1900 > > + maximum: 2100 > > + > > +required: > > + - compatible > > + - reg > > + - interrupts > > + - spi-cpha > > + - spi-cpol > > + > > +if: > > + properties: > > + compatible: > > + contains: > > + enum: > > + - adi,adis16500 > > + - adi,adis16505-1 > > + - adi,adis16505-2 > > + - adi,adis16505-3 > > + - adi,adis16507-1 > > + - adi,adis16507-2 > > + - adi,adis16507-3 > > + > > +then: > > + properties: > > + adi,sync-mode: > > + minimum: 0 > > + maximum: 2 > > + > > + if: > > + properties: > > + adi,sync-mode: > > + enum: [1, 2] > > + > > + then: > > + dependencies: > > + adi,sync-mode: [ clocks ] > > You can remove this if/then if you... > > > + > > +else: > > > + if: > > + properties: > > + adi,sync-mode: > > + enum: [1, 2, 3] > > + > > + then: > > + dependencies: > > + adi,sync-mode: [ clocks ] > > ...put this if by itself under an 'allOf'. (And then the 1st if should > go under the 'allOf' too). > I see. I was being a bit picky here. If I'm understanding correctly I actually tried that form and when playing with the example and setting compatible to "adis16505" and adi,sync-mode = <3> (for eg), I was getting both messages: adis16475-3@0: adi,sync-mode:0:0: 3 is greater than the maximum of 2 adis16475-3@0: 'clocks' is a dependency of 'adi,sync-mode' And in this case, I wanted to just have the first message. Either way, it should be clear that the first message needs to be fixed. I will change to allOf... - Nuno Sá > > + > > +examples: > > + - | > > + #include <dt-bindings/interrupt-controller/irq.h> > > + spi { > > + #address-cells = <1>; > > + #size-cells = <0>; > > + > > + adis16475: adis16475-3@0 { > > + compatible = "adi,adis16475-3"; > > + reg = <0>; > > + spi-cpha; > > + spi-cpol; > > + spi-max-frequency = <2000000>; > > + interrupts = <4 IRQ_TYPE_EDGE_RISING>; > > + interrupt-parent = <&gpio>; > > + }; > > + }; > > +... > > diff --git a/MAINTAINERS b/MAINTAINERS > > index f11262f1f3bb..f8ccc92ab378 100644 > > --- a/MAINTAINERS > > +++ b/MAINTAINERS > > @@ -1015,6 +1015,7 @@ W: http://ez.analog.com/community/linux- > device-drivers > > S: Supported > > F: drivers/iio/imu/adis16475.c > > F: Documentation/ABI/testing/sysfs-bus-iio-imu-adis16475 > > +F: Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml > > > > ANALOG DEVICES INC ADM1177 DRIVER > > M: Beniamin Bia <beniamin.bia@analog.com> > > -- > > 2.25.1 > >
diff --git a/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml new file mode 100644 index 000000000000..9eeb42773edd --- /dev/null +++ b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml @@ -0,0 +1,146 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/imu/adi,adis16475.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Analog Devices ADIS16475 and similar IMUs + +maintainers: + - Nuno Sá <nuno.sa@analog.com> + +description: | + Analog Devices ADIS16475 and similar IMUs + https://www.analog.com/media/en/technical-documentation/data-sheets/ADIS16475.pdf + +properties: + compatible: + enum: + - adi,adis16475-1 + - adi,adis16475-2 + - adi,adis16475-3 + - adi,adis16477-1 + - adi,adis16477-2 + - adi,adis16477-3 + - adi,adis16470 + - adi,adis16465-1 + - adi,adis16465-2 + - adi,adis16465-3 + - adi,adis16467-1 + - adi,adis16467-2 + - adi,adis16467-3 + - adi,adis16500 + - adi,adis16505-1 + - adi,adis16505-2 + - adi,adis16505-3 + - adi,adis16507-1 + - adi,adis16507-2 + - adi,adis16507-3 + + reg: + maxItems: 1 + + spi-cpha: true + + spi-cpol: true + + spi-max-frequency: + maximum: 2000000 + + interrupts: + maxItems: 1 + + clocks: + maxItems: 1 + + reset-gpios: + description: + Must be the device tree identifier of the RESET pin. If specified, + it will be asserted during driver probe. As the line is active low, + it should be marked GPIO_ACTIVE_LOW. + maxItems: 1 + + adi,sync-mode: + description: + Configures the device SYNC pin. The following modes are supported + 0 - output_sync + 1 - direct_sync + 2 - scaled_sync + 3 - pulse_sync + allOf: + - $ref: /schemas/types.yaml#/definitions/uint32 + minimum: 0 + maximum: 3 + + adi,scaled-output-hz: + description: + This property must be present if the clock mode is scaled-sync through + clock-names property. In this mode, the input clock can have a range + of 1Hz to 128HZ which must be scaled to originate an allowable sample + rate. This property specifies that rate. + minimum: 1900 + maximum: 2100 + +required: + - compatible + - reg + - interrupts + - spi-cpha + - spi-cpol + +if: + properties: + compatible: + contains: + enum: + - adi,adis16500 + - adi,adis16505-1 + - adi,adis16505-2 + - adi,adis16505-3 + - adi,adis16507-1 + - adi,adis16507-2 + - adi,adis16507-3 + +then: + properties: + adi,sync-mode: + minimum: 0 + maximum: 2 + + if: + properties: + adi,sync-mode: + enum: [1, 2] + + then: + dependencies: + adi,sync-mode: [ clocks ] + +else: + if: + properties: + adi,sync-mode: + enum: [1, 2, 3] + + then: + dependencies: + adi,sync-mode: [ clocks ] + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + spi { + #address-cells = <1>; + #size-cells = <0>; + + adis16475: adis16475-3@0 { + compatible = "adi,adis16475-3"; + reg = <0>; + spi-cpha; + spi-cpol; + spi-max-frequency = <2000000>; + interrupts = <4 IRQ_TYPE_EDGE_RISING>; + interrupt-parent = <&gpio>; + }; + }; +... diff --git a/MAINTAINERS b/MAINTAINERS index f11262f1f3bb..f8ccc92ab378 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1015,6 +1015,7 @@ W: http://ez.analog.com/community/linux-device-drivers S: Supported F: drivers/iio/imu/adis16475.c F: Documentation/ABI/testing/sysfs-bus-iio-imu-adis16475 +F: Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml ANALOG DEVICES INC ADM1177 DRIVER M: Beniamin Bia <beniamin.bia@analog.com>
Document the ADIS16475 device devicetree bindings. Signed-off-by: Nuno Sá <nuno.sa@analog.com> --- Changes in v2: * Remove burst32 property; * Rename clk-mode to adi,sync-mode; * Remove clock-names; * Add conditionals to state that clocks is only needed depending on adi,sync-mode property .../bindings/iio/imu/adi,adis16475.yaml | 146 ++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 147 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml