mux-controller.yaml 5.9 KB

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