linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonas Jelonek <jelonek.jonas@gmail.com>
To: Linus Walleij <linus.walleij@linaro.org>,
	Bartosz Golaszewski <brgl@bgdev.pl>,
	Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>
Cc: linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Jonas Jelonek <jelonek.jonas@gmail.com>
Subject: [RFC PATCH v1 1/2] dt-bindings: gpio: add gpio-split controller
Date: Thu,  9 Oct 2025 22:35:00 +0000	[thread overview]
Message-ID: <20251009223501.570949-2-jelonek.jonas@gmail.com> (raw)
In-Reply-To: <20251009223501.570949-1-jelonek.jonas@gmail.com>

Add dt-schema for a virtual gpio-split controller which exposes virtual
GPIOs for a shared GPIO controlled by a multiplexer, e.g. a gpio-mux.

The gpio-split controller is a gpio-controller, thus has mostly the same
semantics. However, it requires a mux-control to be specified upon which
it will operate.

Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
---
 .../devicetree/bindings/gpio/gpio-split.yaml  | 77 +++++++++++++++++++
 1 file changed, 77 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/gpio/gpio-split.yaml

diff --git a/Documentation/devicetree/bindings/gpio/gpio-split.yaml b/Documentation/devicetree/bindings/gpio/gpio-split.yaml
new file mode 100644
index 000000000000..9a58c81da4fa
--- /dev/null
+++ b/Documentation/devicetree/bindings/gpio/gpio-split.yaml
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/gpio/gpio-split.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: GPIO split
+
+maintainers:
+  - Jonas Jelonek <jelonek.jonas@gmail.com>
+
+description:
+  A virtual GPIO controller to provide virtual GPIOs backed by a single real
+  GPIO and a multiplexer. This controller may be used in case a real GPIO is
+  connected to multiple inputs/outputs and controlled by a multiplexer, and
+  another subsystem/driver is not able to work with multiplexer subsystem.
+
+properties:
+  compatible:
+    const: gpio-split
+
+  gpio-controller: true
+
+  "#gpio-cells":
+    const: 2
+
+  gpio-line-names: true
+
+  mux-controls:
+    maxItems: 1
+
+  ngpios: false
+
+  shared-gpio:
+    description:
+      GPIO that is shared by the virtual GPIOs and controlled via the mux.
+
+required:
+  - compatible
+  - gpio-controller
+  - mux-controls
+  - shared-gpio
+
+additionalProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    #include <dt-bindings/mux/mux.h>
+
+    sfp_gpio_mux: gpio-mux {
+        compatible = "gpio-mux";
+        mux-gpios = <&gpio0 12 GPIO_ACTIVE_HIGH>,
+                    <&gpio0 14 GPIO_ACTIVE_HIGH>;
+        #mux-control-cells = <0>;
+        idle-state = <MUX_IDLE_AS_IS>;
+    };
+
+    sfp1_gpio: sfp-gpio-1 {
+        compatible = "gpio-split";
+        gpio-controller;
+        #gpio-cells = <2>;
+
+        mux-controls = <&sfp_gpio_mux>;
+        shared-gpio = <&gpio0 19 GPIO_ACTIVE_HIGH>;
+
+        gpio-line-names = "SFP1_LOS", "SFP1_MOD_ABS", "SFP1_TX_FAULT";
+        gpio-0 {
+            mux-state = <0>;
+        };
+        gpio-1 {
+            mux-state = <1>;
+        };
+        gpio-2 {
+            mux-state = <3>;
+        };
+    };
-- 
2.48.1


  reply	other threads:[~2025-10-09 22:35 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-09 22:34 [RFC PATCH v1 0/2] add support for splitting GPIOs Jonas Jelonek
2025-10-09 22:35 ` Jonas Jelonek [this message]
2025-10-10  1:12   ` [RFC PATCH v1 1/2] dt-bindings: gpio: add gpio-split controller Krzysztof Kozlowski
2025-10-10  8:27     ` Jonas Jelonek
2025-10-14  8:23   ` Linus Walleij
2025-10-16 15:36     ` Jonas Jelonek
2025-10-09 22:35 ` [RFC PATCH v1 2/2] gpio: add gpio-split driver Jonas Jelonek
2025-10-14  8:37   ` Linus Walleij
2025-10-16 15:37     ` Jonas Jelonek
2025-10-16 22:12       ` Linus Walleij

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=20251009223501.570949-2-jelonek.jonas@gmail.com \
    --to=jelonek.jonas@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@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;
as well as URLs for NNTP newsgroup(s).