From: Wadim Mueller <wafgo01@gmail.com>
To: William Breathitt Gray <wbg@kernel.org>
Cc: Krzysztof Kozlowski <krzk+dt@kernel.org>,
Rob Herring <robh@kernel.org>, Conor Dooley <conor+dt@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH v7 1/3] dt-bindings: counter: add gpio-counter binding
Date: Tue, 14 Jul 2026 10:17:07 +0200 [thread overview]
Message-ID: <20260714081709.17846-2-wafgo01@gmail.com> (raw)
In-Reply-To: <20260714081709.17846-1-wafgo01@gmail.com>
Add a binding for a generic GPIO-based counter. Two GPIOs (signal-a,
signal-b) drive two Counts; optional index GPIOs load a preset. The
counter function (quadrature, pulse-direction, increase/decrease) is
selected at runtime via the counter sysfs interface.
Signed-off-by: Wadim Mueller <wafgo01@gmail.com>
---
v7:
- index-gpios split into seperate index1-gpios/index2-gpios, so
Count 2 can have an index line without a dummy entry for Count 1
- dropped Conors Ack since the binding changed
---
.../bindings/counter/gpio-counter.yaml | 60 +++++++++++++++++++
1 file changed, 60 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 000000000000..782cb177ed0b
--- /dev/null
+++ b/Documentation/devicetree/bindings/counter/gpio-counter.yaml
@@ -0,0 +1,60 @@
+# 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 <wafgo01@gmail.com>
+
+description: |
+ GPIO-based software counter with two Counts:
+ * Count 1: A + B. Quadrature X1/X2/X4, pulse-direction, inc/dec.
+ * Count 2: B. Inc / dec.
+ The function is selected at runtime via the counter sysfs ABI. Each
+ Count has an optional Index (Z) that loads its preset on rising edge.
+
+properties:
+ compatible:
+ const: gpio-counter
+
+ signal-a-gpios:
+ maxItems: 1
+ description: Signal A (phase A; pulse input in pulse-direction/inc/dec).
+
+ signal-b-gpios:
+ maxItems: 1
+ description:
+ Signal B (phase B; direction in pulse-direction; pulse input for
+ Count 2).
+
+ index1-gpios:
+ maxItems: 1
+ description: Optional Index (Z) input for Count 1.
+
+ index2-gpios:
+ maxItems: 1
+ description: Optional Index (Z) input for Count 2.
+
+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>;
+ index1-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>;
+ index2-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
+ };
+
+...
--
2.43.0
next prev parent reply other threads:[~2026-07-14 8:17 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 8:17 [PATCH v7 0/3] counter: add GPIO-based counter driver Wadim Mueller
2026-07-14 8:17 ` Wadim Mueller [this message]
2026-07-14 8:17 ` [PATCH v7 2/3] " Wadim Mueller
2026-07-14 8:27 ` sashiko-bot
2026-07-14 12:20 ` Uwe Kleine-König
2026-07-14 8:17 ` [PATCH v7 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=20260714081709.17846-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