Re: [PATCH 5/5] dt-bindings: iio: Add adis16475 documentation

Sa, Nuno
2020-03-04T17:25:55Z

On Tue, 2020-03-03 at 10:34 -0600, Rob Herring wrote:
> On Tue, Mar 3, 2020 at 3:59 AM Sa, Nuno <Nuno.Sa@analog.com> wrote:
> > On Tue, 2020-03-03 at 09:43 +0000, Sa, Nuno wrote:
> > > [External]
> > >
> > > On Mon, 2020-03-02 at 16:22 -0600, Rob Herring wrote:
> > > > On Tue, Feb 25, 2020 at 01:41:52PM +0100, Nuno Sá wrote:
> > > > > Document the ADIS16475 device devicetree bindings.
> > > > >
> > > > > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> > > > > ---
> > > > > .../bindings/iio/imu/adi,adis16475.yaml | 130
> > > > > ++++++++++++++++++
> > > > > MAINTAINERS | 1 +
> > > > > 2 files changed, 131 insertions(+)
> > > > > create mode 100644
> > > > > Documentation/devicetree/bindings/iio/imu/adi,adis16475.yaml
> > > > >
> > > > > diff --git
> > > > > a/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yam
> > > > > l
> > > > > b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yam
> > > > > l
> > > > > new file mode 100644
> > > > > index 000000000000..c0f2146e000c
> > > > > --- /dev/null
> > > > > +++
> > > > > b/Documentation/devicetree/bindings/iio/imu/adi,adis16475.yam
> > > > > l
> > > > > @@ -0,0 +1,130 @@
> > > > > +# 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
> > > > > +
> > > > > + clock-names:
> > > > > + oneOf:
> > > > > + - const: sync
> > > > > + - const: direct-sync
> > > > > + - const: pulse-sync
> > > > > + - const: scaled-sync
> > > >
> > > > According to the datasheet I looked at, the input is called
> > > > 'sync'.
> > > > It
> > > > looks like you are mixing operating mode and clock connection.
> > >
> > > The sync pin is where the external clock should be connected
> > > (when
> > > available). I'm kinda of using the clock-name property as a way
> > > of
> > > selecting the mode the user wants to use as done in other devices
> > > (
> > > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/devicetree/bindings/iio/imu/adi,adis16480.txt
> > > ). In the end, what we should have in the sync pin is an external
> > > clock
> > > with the exception of the `sync` mode. I guess this one could be
> > > called
> > > output-sync and, in this case, the sync pin is actually an output
> > > pin
> > > pulsing when the internal processor collects data.
> > >
> > > I'm ok in changing it if there's a better way of doing it... Do
> > > you
> > > have any suggestion?
> > >
> > > -Nuno Sá
> >
> > So, you mean having the clock-name only as "sync" (or maybe even
> > removing it?) and having a dedicated property like clock-mode?
>
> Yes. Though it needs a vendor prefix: adi,clock-mode. Or perhaps
> adi,sync-mode?

I'm tempted to go with adi,sync-mode to respect the datasheet
terminology. Moreover, when using output-sync mode, the sync pin is an
output pin and there's no external clock. Hence, in this mode, it
actually does not make any sense in giving a clock property. This must
also be fixed in the driver.

- Nuno Sá
> Rob