[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210210184138.GA2504266@robh.at.kernel.org>
Date: Wed, 10 Feb 2021 12:41:38 -0600
From: Rob Herring <robh@...nel.org>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: William Breathitt Gray <vilhelm.gray@...il.com>,
devicetree@...r.kernel.org, linux-kernel@...r.kernel.org,
Pengutronix Kernel Team <kernel@...gutronix.de>,
David Jander <david@...tonic.nl>,
Robin van der Gracht <robin@...tonic.nl>,
linux-iio@...r.kernel.org,
Linus Walleij <linus.walleij@...aro.org>,
Jonathan Cameron <jic23@...nel.org>
Subject: Re: [PATCH v5 1/2] dt-bindings: counter: add event-counter binding
On Mon, Feb 08, 2021 at 02:53:46PM +0100, Oleksij Rempel wrote:
> Add binding for the event counter node
>
> Signed-off-by: Oleksij Rempel <o.rempel@...gutronix.de>
> ---
> .../bindings/counter/event-counter.yaml | 56 +++++++++++++++++++
> 1 file changed, 56 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/counter/event-counter.yaml
>
> diff --git a/Documentation/devicetree/bindings/counter/event-counter.yaml b/Documentation/devicetree/bindings/counter/event-counter.yaml
> new file mode 100644
> index 000000000000..bd05c1b38f20
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/counter/event-counter.yaml
> @@ -0,0 +1,56 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/counter/event-counter.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Event counter
> +
> +maintainers:
> + - Oleksij Rempel <o.rempel@...gutronix.de>
> +
> +description: |
> + A generic event counter to measure event frequency. It was developed and used
> + for agricultural devices to measure rotation speed of wheels or other tools.
> + Since the direction of rotation is not important, only one signal line is
> + needed.
> +
> +properties:
> + compatible:
> + const: event-counter
> +
> + interrupts:
> + maxItems: 1
> +
> + gpios:
> + description: Optional diagnostic interface to measure signal level
This description seems wrong in the case of only having a GPIO.
Also, a GPIO only implies polled mode because if the GPIO is interrupt
capable, 'interrupts' should be required. For gpio-keys, we split the
compatible strings in this case. I leave it to you if you want to make
it more explicit.
> + maxItems: 1
> +
> +required:
> + - compatible
anyOf:
- required: [ interrupts ]
- required: [ gpios ]
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> +
> + #include <dt-bindings/interrupt-controller/irq.h>
> + #include <dt-bindings/gpio/gpio.h>
> +
> + counter-0 {
> + compatible = "event-counter";
> + interrupts-extended = <&gpio 0 IRQ_TYPE_EDGE_RISING>;
> + };
> +
> + counter-1 {
> + compatible = "event-counter";
> + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
> + };
> +
> + counter-2 {
> + compatible = "event-counter";
> + interrupts-extended = <&gpio 2 IRQ_TYPE_EDGE_RISING>;
> + gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
> + };
> +
> +...
> --
> 2.30.0
>
Powered by blists - more mailing lists