From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E63A335DA4C for ; Thu, 16 Apr 2026 20:48:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776372533; cv=none; b=bQstVGxlqgwFJVyO0S3f0xxHiEQRYim9hwzdleRqZd30UxnOvxy90L9tVDxinIszQLXws9KUrF2nXCYVlM9RubZ9M7hil8d5E67eTdzVTZDN//4xrTIJJ9USAaORn5tJz4kd7xF+mB5TLihdjRIW+v35lImmKCJEkDGuFkINpWo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776372533; c=relaxed/simple; bh=v1vfoqnG7mr3y+oTV1y9cm3RZIb9k31IsXz4+V/BCFA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e0Wteh2xDodPFUNq36GjSjicvq0p9OdSZrHRJkNl6cgwZRLg89+YcVFLC+2MFuGshaa/HzxTi2Z019c7VMCuxro+KFfH4HIddHDqy2nA6gfiL08RgJoMUyPqXvWMgP//v333kAXFheWYAtEeo5vbqLVrGcvSEY/7WKAyVmdIIRs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=bh9vYMR9; arc=none smtp.client-ip=209.85.208.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="bh9vYMR9" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-672a360ab3cso982146a12.2 for ; Thu, 16 Apr 2026 13:48:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1776372530; x=1776977330; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mhNecU+tmFElmowxJNTJwmYaqHoa2Fb9XKIuMgIj0n4=; b=bh9vYMR9pjvLIFcNxYrcj01P7qICcSCaMeF7xiDJO3/helVPlXEJsPyodTf1x07Cu5 ULZrMOPeuXEYvRdhQf7Myhdx+WslZvKIhV+6owAI7qi0ADgECSGcuQWQM1skxD6Dr/6J g5q0Ej6BkD3xFAUwt5i6vN8FPv+o5m1ar6fnnfgVjrFqLAbvRznrgKJtqKYMeqQWGxM2 Y2NRcJ9curNmPq0CEsNtiP2qBDy37FtkX9TB7DKBL5CQUECxUQ86VDMVQOcs8FP9+68m 28VbK7uN6oiyzHxbYSWwAZycp9l1olFEX47FGK/Xg4YQV0RVgOQ+SOgQDcrBjHScA0M5 OZuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776372530; x=1776977330; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=mhNecU+tmFElmowxJNTJwmYaqHoa2Fb9XKIuMgIj0n4=; b=fRxk+eAfdTl5T/6QIiA9X2ypqysnd4gLdAAUUKY6TTr1eI4z/Nnu6wj4XhBDHedJBn /fBmVi1Apoox0PaBQopTJyYXYgWxGtZb1ILNQIiBB53YT891+Ewdalhjz0CC5NUb3Msb GYhO4BdjAH66XbKSAmdmrkZAJ5p+7qQzRJ2h4AFyh3OiE5x4c0RoeeJPzWUcz/HC7SCJ +dLu7bAia2b+okwLwfzpduyP222kL+m6SEf+YLYu4NznJXpHcO2D66Vi8G9e7PziTIFl UADzsyNg/oSpeAPc7CqVgDQdBJJ7jqXI49rCYM93C+fuDEJVx7VrQpDZc2R33poL3BSi avYQ== X-Forwarded-Encrypted: i=1; AFNElJ+2j5IpYhmZQwwRSk7RhvILKpNk5nfnef2YOlBjARrvGRJfbFTxY3Vypz0ZiGbvrpIGDJb9WS0Bp5tEELg=@vger.kernel.org X-Gm-Message-State: AOJu0YzGOu2tupsKxQGor0mYmMWE76aMMI2AZyHT3bGYipYg23oO75zJ YHwxixvH3ymys4QlFemCGx8BBctEwO/ni/bN1F4wUiDHAfwxLpCxCy92 X-Gm-Gg: AeBDieujP0AULceamM2aAbmZQes+dF5vUZ2/FH+kmNZqgYITseLgHfYR+zRL1WEXRbW xS27j5Ki78h2rT/AG+k60wLqabPduF/pJz6LjKqt3z0VCD8cE9mSrDWreKkkNSdgWzVbacQw0EH AkeVIxB8Uu8mZ4P5XVtu6gww19B2rhCLh/87VIw6QVD+veEYtVgjL+lZTCA1tecILfkNXcA7OHF wSKEGWk0GxyyQitd8C4AiONk7Ed+S01vv8a6BxQ6RzkVQSWB4rZ2vnHbvd/V8rHpy10nmfFtGxC Oqp8r+mFXjalqRgH8mGyL/nHtbaEBui5Tg4wkk7Lpq3Gr7PrVZwPicCNNO0kpizuPGpBZKSU8aq gyG4JOPv1MHPFAFPrgCa8IjZI02Xkpen/ebiaHyHCBAHLo4afVSmONcBUZJCWEHRKwy3hz3MD0G ckjBISYeaq X-Received: by 2002:a05:6402:3048:10b0:670:8d21:dcb with SMTP id 4fb4d7f45d1cf-672bfdd8356mr78643a12.19.1776372530217; Thu, 16 Apr 2026 13:48:50 -0700 (PDT) Received: from fedora ([2a02:8071:50c5:5c0::d908]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-6723800b6f1sm1437962a12.26.2026.04.16.13.48.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Apr 2026 13:48:49 -0700 (PDT) From: Wadim Mueller To: wbg@kernel.org Cc: 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, Wadim Mueller Subject: [PATCH 1/3] dt-bindings: counter: add gpio-quadrature-encoder binding Date: Thu, 16 Apr 2026 22:48:17 +0200 Message-ID: <1663eb2f4bf4c826cd190fa9974fb55c321e7073.1776372319.git.wafgo01@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- .../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 + +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. + +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. + +required: + - compatible + - encoder-a-gpios + - encoder-b-gpios + +additionalProperties: false + +examples: + - | + #include + + quadrature-encoder-0 { + compatible = "gpio-quadrature-encoder"; + encoder-a-gpios = <&gpio0 10 GPIO_ACTIVE_HIGH>; + encoder-b-gpios = <&gpio0 11 GPIO_ACTIVE_HIGH>; + }; + + - | + #include + + 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>; + }; + +... -- 2.52.0