From: Wadim Mueller <wafgo01@gmail.com>
To: linux-iio@vger.kernel.org, devicetree@vger.kernel.org
Cc: wbg@kernel.org, conor+dt@kernel.org, krzk+dt@kernel.org,
robh@kernel.org, linux-kernel@vger.kernel.org,
Wadim Mueller <wafgo01@gmail.com>
Subject: [PATCH v2 0/3] counter: add GPIO-based quadrature encoder driver
Date: Sun, 19 Apr 2026 21:59:05 +0200 [thread overview]
Message-ID: <20260419195908.12202-1-wafgo01@gmail.com> (raw)
This series adds a new counter subsystem driver that implements
quadrature encoder position tracking using plain GPIO pins with
edge-triggered interrupts.
The driver is intended for low to medium speed rotary encoders where
hardware counter peripherals (eQEP, FTM, etc.) are unavailable or
already in use. It targets the same use-cases as interrupt-cnt.c but
provides full quadrature decoding instead of simple pulse counting.
Features:
- X1, X2, X4 quadrature decoding and pulse-direction mode
- Optional index signal for zero-reset
- Configurable ceiling (position clamping)
- Standard counter subsystem sysfs + chrdev interface
- Enable/disable via sysfs with IRQ gating
Tested on TI AM64x (Cortex-A53) with a motor-driven rotary encoder
at up to 2 kHz quadrature edge rate.
Changes in v2:
- DT binding: rephrase description to describe hardware, not
driver/sysfs behaviour (Conor Dooley)
- DT binding: drop redundant example without index GPIO (Conor Dooley)
Wadim Mueller (3):
dt-bindings: counter: add gpio-quadrature-encoder binding
counter: add GPIO-based quadrature encoder driver
MAINTAINERS: add entry for GPIO quadrature encoder counter driver
.../counter/gpio-quadrature-encoder.yaml | 60 ++
MAINTAINERS | 7 +
drivers/counter/Kconfig | 15 +
drivers/counter/Makefile | 1 +
drivers/counter/gpio-quadrature-encoder.c | 710 ++++++++++++++++++
5 files changed, 793 insertions(+)
create mode 100644 Documentation/devicetree/bindings/counter/gpio-quadrature-encoder.yaml
create mode 100644 drivers/counter/gpio-quadrature-encoder.c
--
2.52.0
next reply other threads:[~2026-04-19 19:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-19 19:59 Wadim Mueller [this message]
2026-04-19 19:59 ` [PATCH v2 1/3] dt-bindings: counter: add gpio-quadrature-encoder binding Wadim Mueller
2026-04-20 15:37 ` Conor Dooley
2026-04-19 19:59 ` [PATCH v2 2/3] counter: add GPIO-based quadrature encoder driver Wadim Mueller
2026-04-19 19:59 ` [PATCH v2 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=20260419195908.12202-1-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