Devicetree
 help / color / mirror / Atom feed
* [PATCH v2 0/2] mux: gpio: Add optional enable gpio
@ 2026-08-31 10:28 Tapio Reijonen
  2026-08-31 10:28 ` [PATCH v2 1/2] dt-bindings: mux: gpio-mux: Add enable-gpios Tapio Reijonen
  2026-08-31 10:28 ` [PATCH v2 2/2] mux: gpio: Add optional enable gpio Tapio Reijonen
  0 siblings, 2 replies; 5+ messages in thread
From: Tapio Reijonen @ 2026-08-31 10:28 UTC (permalink / raw)
  To: Peter Rosin, Rob Herring, Krzysztof Kozlowski, Conor Dooley
  Cc: Greg Kroah-Hartman, devicetree, linux-kernel, Tapio Reijonen

Analog multiplexers have an enable input that puts all channels in the
high-impedance off state independent of the address inputs - the E input
of a 74HC4051, for example. gpio-mux has no way to describe it, so it can
neither reach the idle state of disconnect that the mux-controller
binding defines, nor keep the mux disabled while the address gpios are
updated one gpio controller at a time.

Add enable-gpios for that input, and use it in the driver.

Tested on an i.MX6SX board where two SFP cages share one SMBus behind
DG9411 analog switches: the address input selects the cage and the
enable input gates the bus, both driven by a PCA9501 I2C gpio expander.
With enable-gpios and an idle state of disconnect, the parent bus scans
empty between transfers while each cage stays reachable through its own
child bus. A logic analyser on the enable, address and bus lines over a
full boot shows 97 enable windows and 82 address changes, with no bus
activity outside a window and no address change inside one. Dropping
enable-gpios while keeping the disconnect idle state makes the driver
refuse to probe, as intended.

Signed-off-by: Tapio Reijonen <tapio.reijonen@vaisala.com>
---
Changes in v2:
- Describe the enable input in terms of real multiplexers (the E input of
  a 74HC4051) instead of repeating the binding text, and say what needs
  it, as requested by Krzysztof.
- Add the missing gpio-mux: prefix to the binding patch subject.
- Limit enable-gpios to one entry, and require it for an idle state of
  disconnect in both the schema and the driver: without an enable gpio
  mux_gpio_set() drove the address gpios to the bit pattern of
  MUX_IDLE_DISCONNECT instead of disconnecting.
- Deassert the enable gpio while the mux gpios are updated, not only for
  the disconnect idle state, since they are not updated atomically.
- Show enable-gpios in the binding example.
- Link to v1: https://lore.kernel.org/r/20251105-add-external-mux-enable-gpio-v1-0-e59cba6f9e47@vaisala.com

---
Tapio Reijonen (2):
      dt-bindings: mux: gpio-mux: Add enable-gpios
      mux: gpio: Add optional enable gpio

 .../devicetree/bindings/mux/gpio-mux.yaml          | 22 ++++++++++++++
 drivers/mux/gpio.c                                 | 34 ++++++++++++++++++----
 2 files changed, 50 insertions(+), 6 deletions(-)
---
base-commit: cee9395acd8043be0644b25c34bfa86623f2b935
change-id: 20250925-add-external-mux-enable-gpio-c9ba5beddd49

Best regards,
-- 
Tapio Reijonen <tapio.reijonen@vaisala.com>


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-09-04 15:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-31 10:28 [PATCH v2 0/2] mux: gpio: Add optional enable gpio Tapio Reijonen
2026-08-31 10:28 ` [PATCH v2 1/2] dt-bindings: mux: gpio-mux: Add enable-gpios Tapio Reijonen
2026-09-04 15:55   ` Conor Dooley
2026-08-31 10:28 ` [PATCH v2 2/2] mux: gpio: Add optional enable gpio Tapio Reijonen
2026-09-01  7:11   ` Peter Rosin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox