From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 EBCAE378832 for ; Sun, 28 Jun 2026 21:02:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782680577; cv=none; b=CKtcz8DQfragjuDgZlYeRZhYLmZNEBw5ll78op5qe1iIst35wbMyHyUWrXbJdm41UVJimrAr/rQrs89F0i421jmWvgj1D0gvBtVpm0lP0m5E+eN+GV35XqzDcTQ+IH0CwemqUWn9sWnVq7gQLYsjKVx/PN9616NNZHuNYWM1zrg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782680577; c=relaxed/simple; bh=EoXg8YRSGFrNb62Ri3nWJRasxX45nsi+d1TAdqBr9is=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rfrpvF35hpvaNgXD0dLEl6VcnHYV+uwxbv5zNhSgeWRIfp2t5UOjqT49FlgDRnIZ/5fdma64Xl78JhV/JKYmSvx0WfRP8aFbvo7ya3OZPvePiif6SJPTVxafysOpfDJDzQaCJDJHg2Uqqgegect40GaNXcEz+gospNlw30ay3w8= 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=DaYSadsg; arc=none smtp.client-ip=209.85.208.50 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="DaYSadsg" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-69857dc1d5eso1229924a12.3 for ; Sun, 28 Jun 2026 14:02:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1782680574; x=1783285374; 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=7vh2WKONUS0wyNpH+ymwwTp/zqPOZYSgw0F9CWH+S7A=; b=DaYSadsgOamxCWXic2oOBm66cnTzPE++vD7w6j/Du2Gzm6uIWcxZf+6HQ7z7Vo1TRP YO1N9lVRHWOHp0iyzE8UFhD9C7zDUSecv2a6qOkT10hlt5vuj28HgjqpRWlNGP0RfCqT QrPfaVrGrNxUOVe4n8hVcYwVyFumqpmHhH5s+X5dq9v4h6/cXsdvxxwcyGKvZLiRKHlC xX5QxIcrmANGWFKLR/ArWXoBr5Dar5AyuqSyzgWOPfMwAyo6sCssQh8hi8VRVYsAgVpk iZd2pfeurDZJXgZLgtVJw+QtcC9jpcY87f60U7IcCWrwPAjbfXMREEiPtVa3kEcUdKqB LuqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1782680574; x=1783285374; 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=7vh2WKONUS0wyNpH+ymwwTp/zqPOZYSgw0F9CWH+S7A=; b=NC1D20ZptNt6Lvsn4jQcuv9ZP0UpMeJikMJHQGoZQfg3oSk/UgEta69Pol+Bd8W7nu lKNipbRUHSBdU4rFqbovk1jJRPByWOd4Mbsd7wqShtYSl/vQZRvmQJZ0Si0xI/ye8VRL APLhzXtOR1uoSmO9YRTLpafa3uT97FxTWpfhUtA/xO+RyasmBrGZ4BA78fD2gpVXV76R 7r9WzgJoZaui+voFi44IBo2uOtVzcThgVTHg5WyFLD3Bw9DGVf0PyRhSHBSPtVQ0aI9P 75BJih8o3Q7PhYvEyJp5gfpmNaGOSMi7lFhynv+VstsmXDVFrHz3SBggDUcGWNdjLjTR 3jPA== X-Forwarded-Encrypted: i=1; AHgh+RqV9KzrJOWdeQO0rzeh3qOHm94UCOeoHoUpO0oFrTYyXjs38Ge+ESG9mA+EaScfDfDu9LmJPZAGqB40ZGo=@vger.kernel.org X-Gm-Message-State: AOJu0YxShV+LEmW6h4s1TAdWCtUyXHyWRBR9iEv3Ub1l7EuzYCbppf/L KPT8PwEGJYRdDVN3AfgS1yFjcH4W3xu9q5xX1U87Mvp00Qg5rKxD2kA/ X-Gm-Gg: AfdE7cnZGfBKvUng1GiyWWpJFMGukhU5401M9U3pHI3QINDYa37LPAfm8WfXxFUPUxJ Wif5gxxkB1+FN36acTfpcFiBDB+A5j8Q7xNZ+Ba2dGuh72tcb1uWSsHa1LRqAFOjPotyDGyP53n 7wcNIQNIZs4Ikih7I7nNFPeWMBLaEZYNwZsBI7Uu+VocOW//hZUii6okYsQR5T7H7KO9zarE8ks DHH6BFrcal88qZ0fAqWc8Q+iAIgc09RI/cyVqcFQ6KkMHMIKYJoUax/USFC6pNPlsLmO9D8PYdh Z+5KTrVQMaJB9QstO7v5YTej5agIEz8Z31v0K9yjcEo+tWblxATj08imACTyiEGpyS7+wPptMu0 DqONQ7OeYwrwITSVipin4rv1gPkSyLuzrIm8y4cVOIjLfDUJuWFIrJcrgxVp0CMzgBMYqIA== X-Received: by 2002:a05:6402:254e:b0:698:6f16:2290 with SMTP id 4fb4d7f45d1cf-6986f162860mr84807a12.23.1782680574152; Sun, 28 Jun 2026 14:02:54 -0700 (PDT) Received: from sefo-laptop ([2a02:8071:50c5:5c0::361b]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-69848e5ebc0sm2205656a12.3.2026.06.28.14.02.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jun 2026 14:02:53 -0700 (PDT) From: Wadim Mueller To: wbg@kernel.org Cc: krzk+dt@kernel.org, robh@kernel.org, conor+dt@kernel.org, o.rempel@pengutronix.de, linux-iio@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Wadim Mueller , kernel@pengutronix.de Subject: [PATCH v6 1/3] dt-bindings: counter: add gpio-counter binding Date: Sun, 28 Jun 2026 23:02:39 +0200 Message-ID: <20260628210241.119825-2-wafgo01@gmail.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20260628210241.119825-1-wafgo01@gmail.com> References: <20260628210241.119825-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 --- .../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..79b7afd7d --- /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 + +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). + + index-gpios: + minItems: 1 + maxItems: 2 + description: + Optional Index (Z) inputs. First entry indexes Count 1, second + (optional) indexes 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>; + index-gpios = <&gpio0 12 GPIO_ACTIVE_LOW>, + <&gpio0 13 GPIO_ACTIVE_LOW>; + }; + +... -- 2.52.0