public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor@kernel.org>
To: Wadim Mueller <wafgo01@gmail.com>
Cc: wbg@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] dt-bindings: counter: add gpio-quadrature-encoder binding
Date: Fri, 17 Apr 2026 17:13:26 +0100	[thread overview]
Message-ID: <20260417-banjo-uncross-fbec3af75617@spud> (raw)
In-Reply-To: <1663eb2f4bf4c826cd190fa9974fb55c321e7073.1776372319.git.wafgo01@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3543 bytes --]

On Thu, Apr 16, 2026 at 10:48:17PM +0200, Wadim Mueller wrote:
> Add devicetree binding documentation for the GPIO-based quadrature
> encoder counter driver. The driver reads A/B quadrature signals and
> an optional index pulse via edge-triggered GPIO interrupts, supporting
> X1, X2, X4 quadrature decoding and pulse-direction mode.
> 
> This is useful on SoCs that lack a dedicated hardware quadrature
> decoder or where the encoder is wired to generic GPIO pins.
> 
> Signed-off-by: Wadim Mueller <wafgo01@gmail.com>
> ---
>  .../counter/gpio-quadrature-encoder.yaml      | 69 +++++++++++++++++++
>  1 file changed, 69 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/counter/gpio-quadrature-encoder.yaml
> 
> diff --git a/Documentation/devicetree/bindings/counter/gpio-quadrature-encoder.yaml b/Documentation/devicetree/bindings/counter/gpio-quadrature-encoder.yaml
> new file mode 100644
> index 000000000..a52deaab6
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/counter/gpio-quadrature-encoder.yaml
> @@ -0,0 +1,69 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/counter/gpio-quadrature-encoder.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: GPIO-based Quadrature Encoder
> +
> +maintainers:
> +  - Wadim Mueller <wadim.mueller@cmblu.de>
> +
> +description: |
> +  A generic GPIO-based quadrature encoder counter.  Reads A/B quadrature
> +  signals and an optional index pulse via edge-triggered GPIO interrupts.
> +  Supports X1, X2, X4 quadrature decoding and pulse-direction mode.
> +

> +  This driver is useful on SoCs that lack a dedicated hardware quadrature
> +  decoder (eQEP, QEI, etc.) or where the encoder is wired to generic GPIO
> +  pins rather than to a dedicated peripheral.

Idea seems okay to me. Please rephrase this section to avoid talking
about drivers...

> +
> +properties:
> +  compatible:
> +    const: gpio-quadrature-encoder
> +
> +  encoder-a-gpios:
> +    maxItems: 1
> +    description:
> +      GPIO connected to the encoder's A (phase A) output.
> +
> +  encoder-b-gpios:
> +    maxItems: 1
> +    description:
> +      GPIO connected to the encoder's B (phase B) output.
> +
> +  encoder-index-gpios:
> +    maxItems: 1
> +    description:
> +      Optional GPIO connected to the encoder's index (Z) output.
> +      When the index input is enabled via sysfs, the count resets
> +      to zero on each index pulse.

...and this to stop talking about sysfs and driver behaviour though.
Bindings are about hardware.
pw-bot: changes-requested

> +
> +required:
> +  - compatible
> +  - encoder-a-gpios
> +  - encoder-b-gpios
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    quadrature-encoder-0 {
> +        compatible = "gpio-quadrature-encoder";
> +        encoder-a-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>;
> +        encoder-b-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>;
> +    };
> +
> +  - |
> +    #include <dt-bindings/gpio/gpio.h>
> +
> +    quadrature-encoder-1 {
> +        compatible = "gpio-quadrature-encoder";
> +        encoder-a-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
> +        encoder-b-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
> +        encoder-index-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
> +    };

I think this example alone is sufficient btw.

Cheers,
Conor.
> +
> +...
> -- 
> 2.52.0
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2026-04-17 16:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-16 20:48 [PATCH 0/3] counter: add GPIO-based quadrature encoder driver Wadim Mueller
2026-04-16 20:48 ` [PATCH 1/3] dt-bindings: counter: add gpio-quadrature-encoder binding Wadim Mueller
2026-04-17 16:13   ` Conor Dooley [this message]
2026-04-16 20:48 ` [PATCH 2/3] counter: add GPIO-based quadrature encoder driver Wadim Mueller
2026-04-16 20:48 ` [PATCH 3/3] MAINTAINERS: add entry for GPIO quadrature encoder counter driver Wadim Mueller

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=20260417-banjo-uncross-fbec3af75617@spud \
    --to=conor@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@kernel.org \
    --cc=wafgo01@gmail.com \
    --cc=wbg@kernel.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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox