Skip to content

Commit 8f2cade

Browse files
Aswath-Govindrajugregkh
authored andcommitted
dt-bindings: mux: Document mux-states property
In some cases, it is required to provide the state to which the mux controller has to be set to, from the consumer device tree node. Document the property mux-states that can be used for adding this support. Signed-off-by: Aswath Govindraju <[email protected]> Reviewed-by: Rob Herring <[email protected]> Signed-off-by: Peter Rosin <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 04ce4a6 commit 8f2cade

File tree

3 files changed

+55
-3
lines changed

3 files changed

+55
-3
lines changed

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

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,22 @@ properties:
2626
List of gpios used to control the multiplexer, least significant bit first.
2727

2828
'#mux-control-cells':
29-
const: 0
29+
enum: [ 0, 1 ]
30+
31+
'#mux-state-cells':
32+
enum: [ 1, 2 ]
3033

3134
idle-state:
3235
default: -1
3336

3437
required:
3538
- compatible
3639
- mux-gpios
37-
- "#mux-control-cells"
40+
anyOf:
41+
- required:
42+
- "#mux-control-cells"
43+
- required:
44+
- "#mux-state-cells"
3845

3946
additionalProperties: false
4047

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,17 @@ description: |
2525
strings to label each of the mux controllers listed in the "mux-controls"
2626
property.
2727
28+
If it is required to provide the state that the mux controller needs to
29+
be set to, the property "mux-states" must be used. An optional property
30+
"mux-state-names" can be used to provide a list of strings, to label
31+
each of the multiplixer states listed in the "mux-states" property.
32+
33+
Properties "mux-controls" and "mux-states" can be used depending on how
34+
the consumers want to control the mux controller. If the consumer needs
35+
needs to set multiple states in a mux controller, then property
36+
"mux-controls" can be used. If the consumer needs to set the mux
37+
controller to a given state then property "mux-states" can be used.
38+
2839
mux-ctrl-specifier typically encodes the chip-relative mux controller number.
2940
If the mux controller chip only provides a single mux controller, the
3041
mux-ctrl-specifier can typically be left out.
@@ -35,12 +46,22 @@ properties:
3546
mux-controls:
3647
$ref: /schemas/types.yaml#/definitions/phandle-array
3748

49+
mux-states:
50+
$ref: /schemas/types.yaml#/definitions/phandle-array
51+
3852
mux-control-names:
3953
description:
4054
Devices that use more than a single mux controller can use the
4155
"mux-control-names" property to map the name of the requested mux
4256
controller to an index into the list given by the "mux-controls" property.
4357

58+
mux-state-names:
59+
description:
60+
Devices that use more than a single multiplexer state can use the
61+
"mux-state-names" property to map the name of the requested mux
62+
controller to an index into the list given by the "mux-states"
63+
property.
64+
4465
additionalProperties: true
4566

4667
...

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

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,9 @@ description: |
2525
--------------------
2626
2727
Mux controller nodes must specify the number of cells used for the
28-
specifier using the '#mux-control-cells' property.
28+
specifier using the '#mux-control-cells' or '#mux-state-cells' property.
29+
The value of '#mux-state-cells' will always be one greater than the value
30+
of '#mux-control-cells'.
2931
3032
Optionally, mux controller nodes can also specify the state the mux should
3133
have when it is idle. The idle-state property is used for this. If the
@@ -67,6 +69,8 @@ select:
6769
pattern: '^mux-controller'
6870
- required:
6971
- '#mux-control-cells'
72+
- required:
73+
- '#mux-state-cells'
7074

7175
properties:
7276
$nodename:
@@ -75,6 +79,9 @@ properties:
7579
'#mux-control-cells':
7680
enum: [ 0, 1 ]
7781

82+
'#mux-state-cells':
83+
enum: [ 1, 2 ]
84+
7885
idle-state:
7986
$ref: /schemas/types.yaml#/definitions/int32
8087
minimum: -2
@@ -179,4 +186,21 @@ examples:
179186
};
180187
};
181188
};
189+
190+
- |
191+
#include <dt-bindings/gpio/gpio.h>
192+
193+
mux1: mux-controller {
194+
compatible = "gpio-mux";
195+
#mux-state-cells = <1>;
196+
mux-gpios = <&exp_som 2 GPIO_ACTIVE_HIGH>;
197+
};
198+
199+
transceiver4: can-phy4 {
200+
compatible = "ti,tcan1042";
201+
#phy-cells = <0>;
202+
max-bitrate = <5000000>;
203+
standby-gpios = <&exp_som 7 GPIO_ACTIVE_HIGH>;
204+
mux-states = <&mux1 1>;
205+
};
182206
...

0 commit comments

Comments
 (0)