Documentation / devicetree / bindings / mux / mux-controller.yaml


Based on kernel version 6.11. Page generated on 2024-09-24 08:21 EST.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/mux/mux-controller.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Common multiplexer controller provider

maintainers:
  - Peter Rosin <peda@axentia.se>

description: |
  A multiplexer (or mux) controller will have one, or several, consumer devices
  that uses the mux controller. Thus, a mux controller can possibly control
  several parallel multiplexers. Presumably there will be at least one
  multiplexer needed by each consumer, but a single mux controller can of course
  control several multiplexers for a single consumer.
 
  A mux controller provides a number of states to its consumers, and the state
  space is a simple zero-based enumeration. I.e. 0-1 for a 2-way multiplexer,
  0-7 for an 8-way multiplexer, etc.
 
 
  Mux controller nodes
  --------------------
 
  Mux controller nodes must specify the number of cells used for the
  specifier using the '#mux-control-cells' or '#mux-state-cells' property.
  The value of '#mux-state-cells' will always be one greater than the value
  of '#mux-control-cells'.
 
  Optionally, mux controller nodes can also specify the state the mux should
  have when it is idle. The idle-state property is used for this. If the
  idle-state is not present, the mux controller is typically left as is when
  it is idle. For multiplexer chips that expose several mux controllers, the
  idle-state property is an array with one idle state for each mux controller.
 
  The special value (-1) may be used to indicate that the mux should be left
  as is when it is idle. This is the default, but can still be useful for
  mux controller chips with more than one mux controller, particularly when
  there is a need to "step past" a mux controller and set some other idle
  state for a mux controller with a higher index.
 
  Some mux controllers have the ability to disconnect the input/output of the
  multiplexer. Using this disconnected high-impedance state as the idle state
  is indicated with idle state (-2).
 
  These constants are available in
 
        #include <dt-bindings/mux/mux.h>
 
  as MUX_IDLE_AS_IS (-1) and MUX_IDLE_DISCONNECT (-2).
 
  An example mux controller node look like this (the adg972a chip is a triple
  4-way multiplexer):
 
    mux: mux-controller@50 {
      compatible = "adi,adg792a";
      reg = <0x50>;
      #mux-control-cells = <1>;
 
      idle-state = <MUX_IDLE_DISCONNECT MUX_IDLE_AS_IS 2>;
    };

select:
  anyOf:
    - properties:
        $nodename:
          pattern: '^mux-controller'
    - required:
        - '#mux-control-cells'
    - required:
        - '#mux-state-cells'

properties:
  $nodename:
    pattern: '^mux-controller(@.*|-([0-9]|[1-9][0-9]+))?$'
 
  '#mux-control-cells':
    enum: [ 0, 1 ]
 
  '#mux-state-cells':
    enum: [ 1, 2 ]

  idle-state:
    $ref: /schemas/types.yaml#/definitions/int32
    minimum: -2

  idle-states:
    description: |
      Mux controller nodes can specify the state the mux should have when it is
      idle. If the idle-state is not present, the mux controller is typically
      left as is when it is idle. For multiplexer chips that expose several mux
      controllers, the idle-state property is an array with one idle state for
      each mux controller.
 
      The special value (-1) may be used to indicate that the mux should be left
      as is when it is idle. This is the default, but can still be useful for
      mux controller chips with more than one mux controller, particularly when
      there is a need to "step past" a mux controller and set some other idle
      state for a mux controller with a higher index.
 
      Some mux controllers have the ability to disconnect the input/output of the
      multiplexer. Using this disconnected high-impedance state as the idle state
      is indicated with idle state (-2).
    $ref: /schemas/types.yaml#/definitions/int32-array
    items:
      minimum: -2

additionalProperties: true

examples:
  - |
    #include <dt-bindings/gpio/gpio.h>
 
    /* One consumer of a 2-way mux controller (one GPIO-line) */
    mux: mux-controller {
        compatible = "gpio-mux";
        #mux-control-cells = <0>;
 
        mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>;
    };
 
    adc-mux {
        compatible = "io-channel-mux";
        io-channels = <&adc 0>;
        io-channel-names = "parent";
 
        mux-controls = <&mux>;
        mux-control-names = "adc";
 
        channels = "sync", "in";
    };

  - |
    #include <dt-bindings/gpio/gpio.h>
 
    /*
     * Two consumers (one for an ADC line and one for an i2c bus) of
     * parallel 4-way multiplexers controlled by the same two GPIO-lines.
     */
    mux2: mux-controller {
        compatible = "gpio-mux";
        #mux-control-cells = <0>;
 
        mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>,
              <&pioA 1 GPIO_ACTIVE_HIGH>;
    };
 
    adc-mux {
        compatible = "io-channel-mux";
        io-channels = <&adc 0>;
        io-channel-names = "parent";
 
        mux-controls = <&mux2>;
 
        channels = "sync-1", "in", "out", "sync-2";
    };
 
    i2c-mux {
        compatible = "i2c-mux";
        i2c-parent = <&i2c1>;
 
        mux-controls = <&mux2>;
 
        #address-cells = <1>;
        #size-cells = <0>;
 
        i2c@0 {
            reg = <0>;
            #address-cells = <1>;
            #size-cells = <0>;
 
            ssd1307: oled@3c {
                reg = <0x3c>;
            };
        };
 
        i2c@3 {
            reg = <3>;
            #address-cells = <1>;
            #size-cells = <0>;
 
            pca9555: pca9555@20 {
                reg = <0x20>;
            };
        };
    };

  - |
    #include <dt-bindings/gpio/gpio.h>
 
    mux1: mux-controller {
        compatible = "gpio-mux";
        #mux-state-cells = <1>;
        mux-gpios = <&exp_som 2 GPIO_ACTIVE_HIGH>;
    };
 
    transceiver4: can-phy4 {
        compatible = "ti,tcan1042";
        #phy-cells = <0>;
        max-bitrate = <5000000>;
        standby-gpios = <&exp_som 7 GPIO_ACTIVE_HIGH>;
        mux-states = <&mux1 1>;
    };
...