From: Rob Herring <robh@kernel.org>
To: Jonas Jelonek <jelonek.jonas@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <brgl@bgdev.pl>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>, Peter Rosin <peda@axentia.se>,
Geert Uytterhoeven <geert+renesas@glider.be>,
linux-gpio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] dt-bindings: gpio: add gpio-line-mux controller
Date: Mon, 27 Oct 2025 08:32:58 -0500 [thread overview]
Message-ID: <20251027133258.GA112219-robh@kernel.org> (raw)
In-Reply-To: <20251026231754.2368904-2-jelonek.jonas@gmail.com>
On Sun, Oct 26, 2025 at 11:17:53PM +0000, Jonas Jelonek wrote:
> Add dt-schema for a gpio-line-mux controller which exposes virtual
> GPIOs for a shared GPIO controlled by a multiplexer, e.g. a gpio-mux.
>
> The gpio-line-mux 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>
> ---
> .../bindings/gpio/gpio-line-mux.yaml | 108 ++++++++++++++++++
> .../devicetree/bindings/mux/gpio-mux.yaml | 30 +++++
> 2 files changed, 138 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/gpio/gpio-line-mux.yaml
>
> diff --git a/Documentation/devicetree/bindings/gpio/gpio-line-mux.yaml b/Documentation/devicetree/bindings/gpio/gpio-line-mux.yaml
> new file mode 100644
> index 000000000000..4c907a35eb4d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/gpio/gpio-line-mux.yaml
> @@ -0,0 +1,108 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/gpio/gpio-line-mux.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: GPIO line mux
> +
> +maintainers:
> + - Jonas Jelonek <jelonek.jonas@gmail.com>
> +
> +description:
You need '>' or '|' to preserve formatting here.
> + A GPIO controller to provide virtual GPIOs for a 1-to-many mapping backed by
> + a single shared GPIO and a multiplexer. A simple illustrated example is
> +
> + +----- A
> + IN/OUT /
> + <-----o------- B
> + / |\
> + | | +----- C
> + | | \
> + | | +--- D
> + | |
> + M1 M0
> +
> + MUX CONTROL
> +
> + M1 M0 IN/OUT
> + 0 0 A
> + 0 1 B
> + 1 0 C
> + 1 1 D
> +
> + This can be used in case a real GPIO is connected to multiple inputs/outputs
> + and controlled by a multiplexer, and another subsystem/driver does not work
> + directly with the multiplexer subsystem.
> +
> +properties:
> + compatible:
> + const: gpio-line-mux
> +
> + gpio-controller: true
> +
> + "#gpio-cells":
> + const: 2
> +
> + gpio-line-mux-states:
> + description: Mux states corresponding to the virtual GPIOs.
> + minItems: 1
> + items:
> + type: string
> +
> + gpio-line-names: true
> +
> + mux-controls:
> + maxItems: 1
> + $ref: /schemas/mux/mux-controller.yaml#
> + description:
> + Phandle to the multiplexer to control access to the GPIOs.
> +
> + ngpios: false
> +
> + shared-gpio:
'-gpio' is deprecated. Use '-gpios'.
> + description:
> + GPIO which is the '1' in 1-to-many and is shared by the virtual GPIOs
> + and controlled via the mux.
> +
> +required:
> + - compatible
> + - gpio-controller
> + - gpio-line-mux-states
> + - 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 0 GPIO_ACTIVE_HIGH>,
> + <&gpio0 1 GPIO_ACTIVE_HIGH>;
> + #mux-control-cells = <0>;
> + idle-state = <MUX_IDLE_AS_IS>;
> + };
> +
> + sfp1_gpio: sfp-gpio-1 {
> + compatible = "gpio-line-mux";
> + gpio-controller;
> + #gpio-cells = <2>;
> +
> + mux-controls = <&sfp_gpio_mux>;
> + shared-gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>;
> +
> + gpio-line-names = "SFP1_LOS", "SFP1_MOD_ABS", "SFP1_TX_FAULT";
> + gpio-line-mux-states = <0>, <1>, <3>;
> + };
> +
> + sfp1: sfp-p1 {
> + compatible = "sff,sfp";
> +
> + los-gpios = <&sfp1_gpio 0 GPIO_ACTIVE_HIGH>;
> + mod-def0-gpios = <&sfp1_gpio 1 GPIO_ACTIVE_LOW>;
> + tx-fault-gpios = <&sfp1_gpio 2 GPIO_ACTIVE_HIGH>;
> + };
> diff --git a/Documentation/devicetree/bindings/mux/gpio-mux.yaml b/Documentation/devicetree/bindings/mux/gpio-mux.yaml
> index ef7e33ec85d4..57eb1e9ef4cf 100644
> --- a/Documentation/devicetree/bindings/mux/gpio-mux.yaml
> +++ b/Documentation/devicetree/bindings/mux/gpio-mux.yaml
> @@ -100,4 +100,34 @@ examples:
> };
> };
> };
> + - |
> + #include <dt-bindings/gpio/gpio.h>
> +
> + sfp_mux: mux-controller {
> + compatible = "gpio-mux";
> + #mux-control-cells = <0>;
> +
> + mux-gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>,
> + <&gpio0 1 GPIO_ACTIVE_HIGH>;
> + };
> +
> + sfp_gpio: sfp-gpio-1 {
> + compatible = "gpio-line-mux";
> + gpio-controller;
> + #gpio-cells = <2>;
> +
> + mux-controls = <&sfp_mux>;
> + shared-gpio = <&gpio0 2 GPIO_ACTIVE_HIGH>;
> +
> + gpio-line-names = "SFP_LOS", "SFP_MOD_ABS", "SFP_TX_F";
> + gpio-line-mux-states = <0>, <1>, <2>;
> + };
> +
> + sfp0: sfp-p0 {
> + compatible = "sff,sfp";
> +
> + los-gpios = <&sfp_gpio 0 GPIO_ACTIVE_HIGH>;
> + mod-def0-gpios = <&sfp_gpio 1 GPIO_ACTIVE_LOW>;
> + tx-fault-gpios = <&sfp_gpio 2 GPIO_ACTIVE_HIGH>;
Drop. We don't need the same example twice.
Rob
next prev parent reply other threads:[~2025-10-27 13:33 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-26 23:17 [PATCH v2 0/2] add gpio-line-mux Jonas Jelonek
2025-10-26 23:17 ` [PATCH v2 1/2] dt-bindings: gpio: add gpio-line-mux controller Jonas Jelonek
2025-10-27 11:39 ` Rob Herring (Arm)
2025-10-27 11:47 ` Jonas Jelonek
2025-10-27 13:32 ` Rob Herring [this message]
2025-10-26 23:17 ` [PATCH v2 2/2] gpio: add gpio-line-mux driver Jonas Jelonek
2025-10-27 7:51 ` Peter Rosin
2025-10-27 8:26 ` Jonas Jelonek
2025-10-28 9:45 ` Thomas Richard
2025-10-28 10:09 ` Peter Rosin
2025-10-28 10:22 ` Thomas Richard
2025-11-04 14:57 ` Jonas Jelonek
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=20251027133258.GA112219-robh@kernel.org \
--to=robh@kernel.org \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=geert+renesas@glider.be \
--cc=jelonek.jonas@gmail.com \
--cc=krzk+dt@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peda@axentia.se \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.