From: Wadim Mueller <wafgo01@gmail.com>
To: wbg@kernel.org
Cc: krzk+dt@kernel.org, robh@kernel.org, conor+dt@kernel.org,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Wadim Mueller <wafgo01@gmail.com>
Subject: [PATCH v5 1/3] dt-bindings: counter: add gpio-counter binding
Date: Sun, 24 May 2026 21:38:44 +0200 [thread overview]
Message-ID: <20260524193846.19216-2-wafgo01@gmail.com> (raw)
In-Reply-To: <20260524193846.19216-1-wafgo01@gmail.com>
Add a binding for a generic GPIO-based counter. Two GPIOs (signal-a,
signal-b) drive the counter; an optional index GPIO loads a preset.
The counter function (quadrature, pulse-direction, increase/decrease)
is choosen at runtime through the counter sysfs interface.
Signed-off-by: Wadim Mueller <wafgo01@gmail.com>
---
.../bindings/counter/gpio-counter.yaml | 59 +++++++++++++++++++
1 file changed, 59 insertions(+)
create mode 100644 Documentation/devicetree/bindings/counter/gpio-counter.yaml
diff --git a/Documentation/devicetree/bindings/counter/gpio-counter.yaml b/Documentation/devicetree/bindings/counter/gpio-counter.yaml
new file mode 100644
index 000000000..4bd972b61
--- /dev/null
+++ b/Documentation/devicetree/bindings/counter/gpio-counter.yaml
@@ -0,0 +1,59 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/counter/gpio-counter.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: GPIO-based Counter
+
+maintainers:
+ - Wadim Mueller <wadim.mueller@cmblu.de>
+
+description:
+ GPIO-based software counter. Decodes up to two primary signals (A
+ and B) and an optional index pulse via edge-triggered GPIO interrupts
+ into a count. Supports quadrature X1/X2/X4, pulse-direction, and
+ pure increase/decrease modes; the mode is selected at runtime via
+ the counter sysfs ABI.
+
+properties:
+ compatible:
+ const: gpio-counter
+
+ signal-a-gpios:
+ maxItems: 1
+ description:
+ Signal A input (encoder phase A in quadrature modes; pulse
+ input in pulse-direction and increase/decrease modes).
+
+ signal-b-gpios:
+ maxItems: 1
+ description:
+ Signal B input (encoder phase B in quadrature modes; direction
+ input in pulse-direction mode; unused in increase/decrease).
+
+ index-gpios:
+ maxItems: 1
+ description:
+ Optional index (Z) input. When pulsed, loads the configured
+ preset into the count.
+
+required:
+ - compatible
+ - signal-a-gpios
+ - signal-b-gpios
+
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/gpio/gpio.h>
+
+ counter {
+ compatible = "gpio-counter";
+ signal-a-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;
+ signal-b-gpios = <&gpio0 11 GPIO_ACTIVE_LOW>;
+ index-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+ };
+
+...
--
2.52.0
next prev parent reply other threads:[~2026-05-24 19:39 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 20:07 [PATCH v3 0/3] counter: add GPIO-based quadrature encoder driver Wadim Mueller
2026-05-01 20:07 ` [PATCH v3 1/3] dt-bindings: counter: add gpio-quadrature-encoder binding Wadim Mueller
2026-05-01 20:07 ` [PATCH v3 2/3] counter: add GPIO-based quadrature encoder driver Wadim Mueller
2026-05-04 20:54 ` Krzysztof Kozlowski
2026-05-04 21:15 ` Wadim Mueller
2026-05-15 5:48 ` William Breathitt Gray
2026-05-15 15:28 ` Wadim Mueller
2026-05-01 20:07 ` [PATCH v3 3/3] MAINTAINERS: add entry for GPIO quadrature encoder counter driver Wadim Mueller
2026-05-04 9:36 ` [PATCH v3 0/3] counter: add GPIO-based quadrature encoder driver William Breathitt Gray
2026-05-04 19:37 ` Wadim Mueller
2026-05-06 6:50 ` Wadim Mueller
2026-05-14 13:17 ` William Breathitt Gray
2026-05-15 15:36 ` [PATCH v4 " Wadim Mueller
2026-05-15 15:36 ` [PATCH v4 1/3] dt-bindings: counter: add gpio-quadrature-encoder binding Wadim Mueller
2026-05-15 15:36 ` [PATCH v4 2/3] counter: add GPIO-based quadrature encoder driver Wadim Mueller
2026-05-15 16:14 ` sashiko-bot
2026-05-20 4:45 ` William Breathitt Gray
2026-05-21 0:26 ` William Breathitt Gray
2026-05-24 19:35 ` Wadim Mueller
2026-05-24 19:33 ` Wadim Mueller
2026-05-15 15:36 ` [PATCH v4 3/3] MAINTAINERS: add entry for GPIO quadrature encoder counter driver Wadim Mueller
2026-05-24 19:38 ` [PATCH v5 0/3] counter: add GPIO-based " Wadim Mueller
2026-05-24 19:38 ` Wadim Mueller [this message]
2026-05-24 19:38 ` [PATCH v5 2/3] " Wadim Mueller
2026-05-24 20:14 ` sashiko-bot
2026-05-24 19:38 ` [PATCH v5 3/3] MAINTAINERS: add entry for GPIO " 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=20260524193846.19216-2-wafgo01@gmail.com \
--to=wafgo01@gmail.com \
--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=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