From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 7BFF22DA756 for ; Tue, 14 Jul 2026 08:17:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784017042; cv=none; b=EkdxtwQT2lQJ9AU10UjZV81V8J0nyZEM71uBDCqoF99188fRS041jgUJ/ON96Gp8Se6g3oDb4MuszbeLgQiAlfKRAj+bj1uGi/5/Q7LG7zG7J96NgR5dfvodjQgWP/H/QlViKFPQchY8g0WMzzbUxLCiS+QBWrjstuL7YvRvuWg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784017042; c=relaxed/simple; bh=xEEGwX2WirNbeBAzB5AL0aELp4pmQKWtE6Dq3wSUlo0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Yb2BAlJQcfQWCQZ5gNcdV9PGXJ0ukP54bMWhYE4x4LuddNlrc9gs1OA+a+O2UDJkT3fKwZIakk5o8AOvfqQkGXlIGrz/IOlSyG3j3Wxeh4zCbtuWWatgt/VbWQ9BDOZY6sKrHBEoQ0NsD92ODLfJ1sEeLq2q/ogo9UtGqfmhaFI= 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=N4SIuYA1; arc=none smtp.client-ip=209.85.208.41 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="N4SIuYA1" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-69531108f25so6584055a12.2 for ; Tue, 14 Jul 2026 01:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784017031; x=1784621831; 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:content-type; bh=CoQnMOKpiJRr1uZ4EPacW9ACutARLVYGOVPpLwGEQDc=; b=N4SIuYA1YpE+X4zPakS58ufaufjsMyKuKHkF0PzSROVKnTh0UWN3POFbKuusvr38Zx xnXfb1JzX+PHLjWy/dT8/VxeEQkwrPqubXlkr5EXFVbi4qF3VLMMSi5Fw0u5qIjpg/tD 7ywUjcxKcLJrXaS786DpipEDrdYWlCuPAbVD6+TRR2XV5u8QZCrue7m5w9KlBbyz8L00 Uremnl/3UGhEsK2a6QwdxQucu/tVUASNfoAsgwykO7FDuqtLpvYLr2eXIaRX7rmZqKoy TOEkVcZz0E4xaturFGmYW493ntFpOYl5sURYUQMTLXC0PSzk8Zye+HaKELHQEkU1V/Q/ yfZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784017031; x=1784621831; 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:content-type; bh=CoQnMOKpiJRr1uZ4EPacW9ACutARLVYGOVPpLwGEQDc=; b=cNpieWiVbx6O9s7/WTVCu9laUPXFzH+RPA2Jb064HNCKJFl/jMHauwhW4s//OC30+g rvaSzzyTseUogMJ1kbpL4PxOfQbzshlP2Ebg9Wf7YxNtM8ZE/F92d67HEnpnHb3FwYzV cihW6FGegGnFmY/HunW5PVMGZVvjVN85MCUxX0RbO4iqxI/uthJO3cZTGBN89AJPAcWz lddvGizL4rxE2oET4IluYH1kezWDmt/I5a1RaRhSS1NWw4LdO5oc1Ev9BKmOJ+QiU5QQ vId8BL3OjTvaXn0iIa8/ym+kzbFecnaY+4zQK2XtpD2tx9HfRLM1KUySIMjLRLC8uCMO N0Eg== X-Forwarded-Encrypted: i=1; AHgh+RrgJzZqEqLhbeiTIWBbZdZsJdYsKxudkhqbzQcF+Y8S89CR6sUonX+GllXpv0q0i1RECOKLvyCl71TIVN0=@vger.kernel.org X-Gm-Message-State: AOJu0Yz8xh3YpQnCjYGrQcxS2T8MUpDDZn6EJhN4TCJvPSaSv+tywCgb A5MWqNf7kRCd5OfbvrVImchJ+ZhQi+SOO1IuTexLgpcQscrQSrQq7cyt X-Gm-Gg: AfdE7cmj8+3rkBU/rQgB3yRka+p3fYW9hN3P3vQeiGRdhqvfdNs4MMfiwsRYkgzxUPa /THzc6tqH/om3Vy0Iy7m+63snw+Ca5A6iGKfzznhsC7r/6SOkckDcoUyySNIZofGP3bm8NU9Ydl JLdmQuiksvVHLJnO7l+yuqt7BRWqZ2/l+JeX9MmOgaeDrEanH0CPr46UKkyXLC9P4zvndCKTFHF YD2NSTcKwdm87cTCnMzSI8lki/ZI3NaDurmcYbvfvpguI1+FcfDh0/wa7CflqCVN3XKiFprpCyN sm6kY/3niO3vPjRaT75y7CYOwASOOylCaVH16RFlUirkSOQWZf4LdZsdjdWXUrlazhlmAce8onF DupESXRUa9fW4vP6s1M2lImW0b30fTbwfR+tACiuCb53zjOsJIuiGSTETWJeA+k9Gtv8TTw1gBv SuQcFIKudvyWdiPn9Lww89MqyhWZBbNjDCNq8= X-Received: by 2002:a17:906:7304:b0:c16:12b6:243c with SMTP id a640c23a62f3a-c161e973a85mr554612966b.14.1784017030626; Tue, 14 Jul 2026 01:17:10 -0700 (PDT) Received: from DE-PF5B95TD.embedded.cmblu.dev ([87.129.199.250]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c15e353d2f8sm723085166b.34.2026.07.14.01.17.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Jul 2026 01:17:10 -0700 (PDT) From: Wadim Mueller To: William Breathitt Gray Cc: Krzysztof Kozlowski , Rob Herring , Conor Dooley , 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 Message-ID: <20260714081709.17846-2-wafgo01@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260714081709.17846-1-wafgo01@gmail.com> References: <20260714081709.17846-1-wafgo01@gmail.com> 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 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 --- 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 + +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 + + 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