gpio-mux

Description

GPIO-based multiplexer.

A set of GPIO lines drive a MUX select bus. The state value is encoded
on the GPIOs as a binary pattern: bit N of state goes to mux-gpios[N].

Single-channel by design: the controller has no addressing, so
#mux-control-cells is 0 and #mux-state-cells is 1 (state value only).

Examples

#include <zephyr/dt-bindings/gpio/gpio.h>

mux0: mux-controller {
        compatible = "gpio-mux";
        #mux-control-cells = <0>;
        #mux-state-cells = <1>;
        mux-gpios = <&gpio0 5 GPIO_ACTIVE_HIGH>,
                    <&gpio0 6 GPIO_ACTIVE_HIGH>;
};

consumer {
        mux-controls = <&mux0>;          /* runtime state */
        mux-states   = <&mux0 2>;        /* static default state = 2 */
};

Properties

Properties not inherited from the base binding file.

Name

Type

Details

mux-gpios

phandle-array

GPIO lines driving the MUX select bus, in LSB-first order. Bit 0 of
the state value is written to mux-gpios[0], bit 1 to mux-gpios[1],
and so on.

This property is required.

Length range: 1 to 32

enable-gpios

phandle-array

Optional enable/disable lines gating the whole mux. Absent means the
mux cannot be disconnected and the select lines always drive a route.

#mux-control-cells

int

Number of cells in a "mux-controls" specifier. These cells form the
addressing portion only (which output line) and do NOT include the
target state value. Drivers receive the addressing cells in the
"cells" field of struct mux_control.

This property is required.

Constant value: 0

#mux-state-cells

int

Number of cells in a "mux-states" specifier. Equals
#mux-control-cells + 1: the trailing cell carries the default state
value. Backends may name the trailing cell whatever best describes
the hardware (e.g. "state" for a generic mux, "input" for an
XBAR, "source" for a TRGMUX).

This property is required.

Constant value: 1

Specifier cell names

  • mux-state cells: state