Linux-IIO Archive on lore.kernel.org
 help / color / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Rui Miguel Silva <rui.silva@linaro.org>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Rob Herring <robh+dt@kernel.org>,
	Fabio Estevam <fabio.estevam@nxp.com>,
	<linux-iio@vger.kernel.org>, <devicetree@vger.kernel.org>,
	Rui Miguel Silva <rmfrfs@gmail.com>
Subject: Re: [PATCH] dt-bindings: fxas21002c: convert bindings to yaml
Date: Tue, 13 Oct 2020 16:34:31 +0100
Message-ID: <20201013153431.000052c9@huawei.com> (raw)
In-Reply-To: <20201013131545.503434-1-rmfrfs@gmail.com>

On Tue, 13 Oct 2020 14:15:45 +0100
Rui Miguel Silva <rui.silva@linaro.org> wrote:

> Convert fxas21002c gyroscope sensor bindings documentation to
> yaml schema and remove the textual bindings document.
> 
> Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com>

Hi Rui,

Always good to see a yaml conversion.

Comments inline...

> ---
>  .../bindings/iio/gyroscope/nxp,fxas21002c.txt | 31 --------
>  .../iio/gyroscope/nxp,fxas21002c.yaml         | 77 +++++++++++++++++++
>  MAINTAINERS                                   |  2 +-
>  3 files changed, 78 insertions(+), 32 deletions(-)
>  delete mode 100644 Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt
>  create mode 100644 Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt b/Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt
> deleted file mode 100644
> index 465e104bbf14..000000000000
> --- a/Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt
> +++ /dev/null
> @@ -1,31 +0,0 @@
> -* NXP FXAS21002C Gyroscope device tree bindings
> -
> -http://www.nxp.com/products/sensors/gyroscopes/3-axis-digital-gyroscope:FXAS21002C
> -
> -Required properties:
> -  - compatible : should be "nxp,fxas21002c"
> -  - reg : the I2C address of the sensor or SPI chip select number for the
> -          device.
> -  - vdd-supply: phandle to the regulator that provides power to the sensor.
> -  - vddio-supply: phandle to the regulator that provides power to the bus.
> -
> -Optional properties:
> -  - reset-gpios : gpio used to reset the device, see gpio/gpio.txt
> -  - interrupts : device support 2 interrupts, INT1 and INT2,
> -                 the interrupts can be triggered on rising or falling edges.
> -                 See interrupt-controller/interrupts.txt
> -  - interrupt-names: should contain "INT1" or "INT2", the gyroscope interrupt
> -                     line in use.
> -  - drive-open-drain: the interrupt/data ready line will be configured
> -                      as open drain, which is useful if several sensors share
> -                      the same interrupt line. This is a boolean property.
> -                      (This binding is taken from pinctrl/pinctrl-bindings.txt)
> -
> -Example:
> -
> -gyroscope@20 {
> -	compatible = "nxp,fxas21002c";
> -	reg = <0x20>;
> -	vdd-supply = <&reg_peri_3p15v>;
> -	vddio-supply = <&reg_peri_3p15v>;
> -};
> diff --git a/Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.yaml b/Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.yaml
> new file mode 100644
> index 000000000000..7680e97cf1d9
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.yaml
> @@ -0,0 +1,77 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/gyroscope/nxp,fxas21002c.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NXP FXAS21002C Gyroscope Unit

Why Unit? Gyroscope seems fine to me.

> +
> +maintainers:
> +  - Rui Miguel Silva <rmfrfs@gmail.com>
> +
> +description: |
> +  3 axis digital gyroscope device with an I2C and SPI interface.

Can we document the SPI binding as well?  With an example.

> +  http://www.nxp.com/products/sensors/gyroscopes/3-axis-digital-gyroscope:FXAS21002C
> +
> +properties:
> +  compatible:
> +    enum:
> +      - nxp,fxas21002c

Unless we think it likely this binding is going to shortly include other options,
       const: nxp... 
(doesn't matter that much though!)

> +
> +  reg:
> +    maxItems: 1
> +    description: base address of the device

No it isn't. It is the i2c address. Also this is standard so no description needed.


> +
> +  vdd-supply:
> +    description: Regulator that provides power to the sensor
> +
> +  vddio-supply:
> +    description: Regulator that provides power to the bus
> +
> +  reset-gpios:
> +    maxItems: 1
> +    description: GPIO connected to reset
> +
> +  interrupts:
> +    minItems: 1
> +    maxItems: 2
> +    description: device support 2 interrupts,
I'd argue that's obvious from the maxItems. So no need to repeat it.


 INT1 and INT2,
This part is clear form interrupt-names so again, I wouldn't say it again.

 the interrupts can
> +                 be triggered on rising or falling edges.
This last bit is useful so I would have just this or something like

Either interrupt may be triggered on rising or falling edges.

> +
> +  interrupt-names:
> +    minItems: 1
> +    maxItems: 2
> +    items:
> +      enum:
> +        - INT1
> +        - INT2
> +    description: gyroscope interrupt line in use.

Singular with 2 interrupts.  Personally I'd just drop the description as not
adding anything.

> +
> +  drive-open-drain:
> +    type: boolean
> +    description: the interrupt/data ready line will be configured as open drain,
> +                 which is useful if several sensors share the same interrupt
> +                 line.
> +
> +required:
> +  - compatible
> +  - reg
> +  - vdd-supply

Why required?  If it's hard wired on will a stub regulator not work fine
with this device.  Do we need to read it's voltage or similar?

> +  - vddio-supply
> +
> +unevaluatedProperties: false

Why unevalutatedProperties rather than additionalProperties?
I'll confess I don't really understand when to use unevaluatedProperties.
I'm guessing issue here is we don't have the SPI bindings stuff?

> +
> +examples:
> +  - |
> +    i2c0 {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        gyroscope@20 {
> +          compatible = "nxp,fxas21002c";
> +          reg = <0x20>;
> +
> +          vdd-supply = <&reg_peri_3p15v>;
> +          vddio-supply = <&reg_peri_3p15v>;
> +        };
> +    };
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 6594f0966716..2e85e114c9c3 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -12469,7 +12469,7 @@ NXP FXAS21002C DRIVER
>  M:	Rui Miguel Silva <rmfrfs@gmail.com>
>  L:	linux-iio@vger.kernel.org
>  S:	Maintained
> -F:	Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.txt
> +F:	Documentation/devicetree/bindings/iio/gyroscope/nxp,fxas21002c.yaml
>  F:	drivers/iio/gyro/fxas21002c.h
>  F:	drivers/iio/gyro/fxas21002c_core.c
>  F:	drivers/iio/gyro/fxas21002c_i2c.c


  reply index

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-13 13:15 Rui Miguel Silva
2020-10-13 15:34 ` Jonathan Cameron [this message]
2020-10-13 20:54   ` Rui Miguel Silva
2020-10-13 21:47     ` Rui Miguel Silva

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201013153431.000052c9@huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=devicetree@vger.kernel.org \
    --cc=fabio.estevam@nxp.com \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=rmfrfs@gmail.com \
    --cc=robh+dt@kernel.org \
    --cc=rui.silva@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-IIO Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-iio/0 linux-iio/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-iio linux-iio/ https://lore.kernel.org/linux-iio \
		linux-iio@vger.kernel.org
	public-inbox-index linux-iio

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-iio


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git