| 1 |
# SPDX-License-Identifier: GPL-2.0 |
| 2 |
%YAML 1.2 |
| 3 |
--- |
| 4 |
$id: http://devicetree.org/schemas/mux/mux-controller.yaml# |
| 5 |
$schema: http://devicetree.org/meta-schemas/core.yaml# |
| 6 |
|
| 7 |
title: Common multiplexer controller provider |
| 8 |
|
| 9 |
maintainers: |
| 10 |
- Peter Rosin <[email protected]> |
| 11 |
|
| 12 |
description: | |
| 13 |
A multiplexer (or mux) controller will have one, or several, consumer devices |
| 14 |
that uses the mux controller. Thus, a mux controller can possibly control |
| 15 |
several parallel multiplexers. Presumably there will be at least one |
| 16 |
multiplexer needed by each consumer, but a single mux controller can of course |
| 17 |
control several multiplexers for a single consumer. |
| 18 |
|
| 19 |
A mux controller provides a number of states to its consumers, and the state |
| 20 |
space is a simple zero-based enumeration. I.e. 0-1 for a 2-way multiplexer, |
| 21 |
0-7 for an 8-way multiplexer, etc. |
| 22 |
|
| 23 |
Mux controller nodes |
| 24 |
-------------------- |
| 25 |
|
| 26 |
Mux controller nodes must specify the number of cells used for the |
| 27 |
specifier using the '#mux-control-cells' or '#mux-state-cells' property. |
| 28 |
The value of '#mux-state-cells' will always be one greater than the value |
| 29 |
of '#mux-control-cells'. |
| 30 |
|
| 31 |
Optionally, mux controller nodes can also specify the state the mux should |
| 32 |
have when it is idle. The idle-state property is used for this. If the |
| 33 |
idle-state is not present, the mux controller is typically left as is when |
| 34 |
it is idle. For multiplexer chips that expose several mux controllers, the |
| 35 |
idle-state property is an array with one idle state for each mux controller. |
| 36 |
|
| 37 |
The special value (-1) may be used to indicate that the mux should be left |
| 38 |
as is when it is idle. This is the default, but can still be useful for |
| 39 |
mux controller chips with more than one mux controller, particularly when |
| 40 |
there is a need to "step past" a mux controller and set some other idle |
| 41 |
state for a mux controller with a higher index. |
| 42 |
|
| 43 |
Some mux controllers have the ability to disconnect the input/output of the |
| 44 |
multiplexer. Using this disconnected high-impedance state as the idle state |
| 45 |
is indicated with idle state (-2). |
| 46 |
|
| 47 |
These constants are available in |
| 48 |
|
| 49 |
#include <dt-bindings/mux/mux.h> |
| 50 |
|
| 51 |
as MUX_IDLE_AS_IS (-1) and MUX_IDLE_DISCONNECT (-2). |
| 52 |
|
| 53 |
An example mux controller node look like this (the adg972a chip is a triple |
| 54 |
4-way multiplexer): |
| 55 |
|
| 56 |
mux: mux-controller@50 { |
| 57 |
compatible = "adi,adg792a"; |
| 58 |
reg = <0x50>; |
| 59 |
#mux-control-cells = <1>; |
| 60 |
|
| 61 |
idle-state = <MUX_IDLE_DISCONNECT MUX_IDLE_AS_IS 2>; |
| 62 |
}; |
| 63 |
|
| 64 |
select: |
| 65 |
anyOf: |
| 66 |
- properties: |
| 67 |
$nodename: |
| 68 |
pattern: '^mux-controller' |
| 69 |
- required: |
| 70 |
- '#mux-control-cells' |
| 71 |
- required: |
| 72 |
- '#mux-state-cells' |
| 73 |
|
| 74 |
properties: |
| 75 |
$nodename: |
| 76 |
pattern: '^mux-controller(@.*|-([0-9]|[1-9][0-9]+))?$' |
| 77 |
|
| 78 |
'#mux-control-cells': |
| 79 |
enum: [ 0, 1 ] |
| 80 |
|
| 81 |
'#mux-state-cells': |
| 82 |
enum: [ 1, 2 ] |
| 83 |
|
| 84 |
idle-state: |
| 85 |
$ref: /schemas/types.yaml#/definitions/int32 |
| 86 |
minimum: -2 |
| 87 |
|
| 88 |
idle-states: |
| 89 |
description: | |
| 90 |
Mux controller nodes can specify the state the mux should have when it is |
| 91 |
idle. If the idle-state is not present, the mux controller is typically |
| 92 |
left as is when it is idle. For multiplexer chips that expose several mux |
| 93 |
controllers, the idle-state property is an array with one idle state for |
| 94 |
each mux controller. |
| 95 |
|
| 96 |
The special value (-1) may be used to indicate that the mux should be left |
| 97 |
as is when it is idle. This is the default, but can still be useful for |
| 98 |
mux controller chips with more than one mux controller, particularly when |
| 99 |
there is a need to "step past" a mux controller and set some other idle |
| 100 |
state for a mux controller with a higher index. |
| 101 |
|
| 102 |
Some mux controllers have the ability to disconnect the input/output of the |
| 103 |
multiplexer. Using this disconnected high-impedance state as the idle state |
| 104 |
is indicated with idle state (-2). |
| 105 |
$ref: /schemas/types.yaml#/definitions/int32-array |
| 106 |
items: |
| 107 |
minimum: -2 |
| 108 |
|
| 109 |
additionalProperties: true |
| 110 |
|
| 111 |
examples: |
| 112 |
- | |
| 113 |
#include <dt-bindings/gpio/gpio.h> |
| 114 |
|
| 115 |
/* One consumer of a 2-way mux controller (one GPIO-line) */ |
| 116 |
mux: mux-controller { |
| 117 |
compatible = "gpio-mux"; |
| 118 |
#mux-control-cells = <0>; |
| 119 |
|
| 120 |
mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>; |
| 121 |
}; |
| 122 |
|
| 123 |
adc-mux { |
| 124 |
compatible = "io-channel-mux"; |
| 125 |
io-channels = <&adc 0>; |
| 126 |
io-channel-names = "parent"; |
| 127 |
|
| 128 |
mux-controls = <&mux>; |
| 129 |
mux-control-names = "adc"; |
| 130 |
|
| 131 |
channels = "sync", "in"; |
| 132 |
}; |
| 133 |
|
| 134 |
- | |
| 135 |
#include <dt-bindings/gpio/gpio.h> |
| 136 |
|
| 137 |
/* |
| 138 |
* Two consumers (one for an ADC line and one for an i2c bus) of |
| 139 |
* parallel 4-way multiplexers controlled by the same two GPIO-lines. |
| 140 |
*/ |
| 141 |
mux2: mux-controller { |
| 142 |
compatible = "gpio-mux"; |
| 143 |
#mux-control-cells = <0>; |
| 144 |
|
| 145 |
mux-gpios = <&pioA 0 GPIO_ACTIVE_HIGH>, |
| 146 |
<&pioA 1 GPIO_ACTIVE_HIGH>; |
| 147 |
}; |
| 148 |
|
| 149 |
adc-mux { |
| 150 |
compatible = "io-channel-mux"; |
| 151 |
io-channels = <&adc 0>; |
| 152 |
io-channel-names = "parent"; |
| 153 |
|
| 154 |
mux-controls = <&mux2>; |
| 155 |
|
| 156 |
channels = "sync-1", "in", "out", "sync-2"; |
| 157 |
}; |
| 158 |
|
| 159 |
i2c-mux { |
| 160 |
compatible = "i2c-mux"; |
| 161 |
i2c-parent = <&i2c1>; |
| 162 |
|
| 163 |
mux-controls = <&mux2>; |
| 164 |
|
| 165 |
#address-cells = <1>; |
| 166 |
#size-cells = <0>; |
| 167 |
|
| 168 |
i2c@0 { |
| 169 |
reg = <0>; |
| 170 |
#address-cells = <1>; |
| 171 |
#size-cells = <0>; |
| 172 |
|
| 173 |
ssd1307: oled@3c { |
| 174 |
reg = <0x3c>; |
| 175 |
}; |
| 176 |
}; |
| 177 |
|
| 178 |
i2c@3 { |
| 179 |
reg = <3>; |
| 180 |
#address-cells = <1>; |
| 181 |
#size-cells = <0>; |
| 182 |
|
| 183 |
pca9555: pca9555@20 { |
| 184 |
reg = <0x20>; |
| 185 |
}; |
| 186 |
}; |
| 187 |
}; |
| 188 |
|
| 189 |
- | |
| 190 |
#include <dt-bindings/gpio/gpio.h> |
| 191 |
|
| 192 |
mux1: mux-controller { |
| 193 |
compatible = "gpio-mux"; |
| 194 |
#mux-state-cells = <1>; |
| 195 |
mux-gpios = <&exp_som 2 GPIO_ACTIVE_HIGH>; |
| 196 |
}; |
| 197 |
|
| 198 |
transceiver4: can-phy4 { |
| 199 |
compatible = "ti,tcan1042"; |
| 200 |
#phy-cells = <0>; |
| 201 |
max-bitrate = <5000000>; |
| 202 |
standby-gpios = <&exp_som 7 GPIO_ACTIVE_HIGH>; |
| 203 |
mux-states = <&mux1 1>; |
| 204 |
}; |
| 205 |
... |