common.yaml 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301
  1. # SPDX-License-Identifier: GPL-2.0-only
  2. %YAML 1.2
  3. ---
  4. $id: http://devicetree.org/schemas/leds/common.yaml#
  5. $schema: http://devicetree.org/meta-schemas/core.yaml#
  6. title: Common leds properties
  7. maintainers:
  8. - Jacek Anaszewski <jacek.anaszewski@gmail.com>
  9. - Pavel Machek <pavel@ucw.cz>
  10. description:
  11. LED and flash LED devices provide the same basic functionality as current
  12. regulators, but extended with LED and flash LED specific features like
  13. blinking patterns, flash timeout, flash faults and external flash strobe mode.
  14. Many LED devices expose more than one current output that can be connected
  15. to one or more discrete LED component. Since the arrangement of connections
  16. can influence the way of the LED device initialization, the LED components
  17. have to be tightly coupled with the LED device binding. They are represented
  18. by child nodes of the parent LED device binding.
  19. properties:
  20. led-sources:
  21. description:
  22. List of device current outputs the LED is connected to. The outputs are
  23. identified by the numbers that must be defined in the LED device binding
  24. documentation.
  25. $ref: /schemas/types.yaml#/definitions/uint32-array
  26. function:
  27. description:
  28. LED function. Use one of the LED_FUNCTION_* prefixed definitions
  29. from the header include/dt-bindings/leds/common.h. If there is no
  30. matching LED_FUNCTION available, add a new one.
  31. $ref: /schemas/types.yaml#/definitions/string
  32. color:
  33. description:
  34. Color of the LED. Use one of the LED_COLOR_ID_* prefixed definitions from
  35. the header include/dt-bindings/leds/common.h. If there is no matching
  36. LED_COLOR_ID available, add a new one.
  37. $ref: /schemas/types.yaml#/definitions/uint32
  38. minimum: 0
  39. maximum: 14
  40. function-enumerator:
  41. description:
  42. Integer to be used when more than one instance of the same function is
  43. needed, differing only with an ordinal number.
  44. $ref: /schemas/types.yaml#/definitions/uint32
  45. label:
  46. description:
  47. The label for this LED. If omitted, the label is taken from the node name
  48. (excluding the unit address). It has to uniquely identify a device, i.e.
  49. no other LED class device can be assigned the same label. This property is
  50. deprecated - use 'function' and 'color' properties instead.
  51. function-enumerator has no effect when this property is present.
  52. default-state:
  53. description:
  54. The initial state of the LED. If the LED is already on or off and the
  55. default-state property is set the to same value, then no glitch should be
  56. produced where the LED momentarily turns off (or on). The "keep" setting
  57. will keep the LED at whatever its current state is, without producing a
  58. glitch.
  59. $ref: /schemas/types.yaml#/definitions/string
  60. enum:
  61. - on
  62. - off
  63. - keep
  64. default: off
  65. linux,default-trigger:
  66. description:
  67. This parameter, if present, is a string defining the trigger assigned to
  68. the LED.
  69. $ref: /schemas/types.yaml#/definitions/string
  70. oneOf:
  71. - enum:
  72. # LED will act as a back-light, controlled by the framebuffer system
  73. - backlight
  74. # LED will turn on (see also "default-state" property)
  75. - default-on
  76. # LED "double" flashes at a load average based rate
  77. - heartbeat
  78. # LED indicates disk activity
  79. - disk-activity
  80. # LED indicates disk read activity
  81. - disk-read
  82. # LED indicates disk write activity
  83. - disk-write
  84. # LED flashes at a fixed, configurable rate
  85. - timer
  86. # LED alters the brightness for the specified duration with one software
  87. # timer (requires "led-pattern" property)
  88. - pattern
  89. # LED indicates mic mute state
  90. - audio-micmute
  91. # LED indicates audio mute state
  92. - audio-mute
  93. # LED indicates bluetooth power state
  94. - bluetooth-power
  95. # LED indicates camera flash state
  96. - flash
  97. # LED indicated keyboard capslock
  98. - kbd-capslock
  99. # LED indicates MTD memory activity
  100. - mtd
  101. # LED indicates NAND memory activity (deprecated),
  102. # in new implementations use "mtd"
  103. - nand-disk
  104. # LED indicates network activity
  105. - netdev
  106. # No trigger assigned to the LED. This is the default mode
  107. # if trigger is absent
  108. - none
  109. # LED indicates camera torch state
  110. - torch
  111. # LED indicates USB gadget activity
  112. - usb-gadget
  113. # LED indicates USB host activity
  114. - usb-host
  115. # LED indicates USB port state
  116. - usbport
  117. # LED is triggered by CPU activity
  118. - pattern: "^cpu[0-9]*$"
  119. # LED is triggered by Bluetooth activity
  120. - pattern: "^hci[0-9]+-power$"
  121. # LED is triggered by SD/MMC activity
  122. - pattern: "^mmc[0-9]+$"
  123. # LED is triggered by WLAN activity
  124. - pattern: "^phy[0-9]+tx$"
  125. led-pattern:
  126. description: |
  127. Array of integers with default pattern for certain triggers.
  128. Each trigger may parse this property differently:
  129. - one-shot : two numbers specifying delay on and delay off (in ms),
  130. - timer : two numbers specifying delay on and delay off (in ms),
  131. - pattern : the pattern is given by a series of tuples, of
  132. brightness and duration (in ms). The exact format is
  133. described in:
  134. Documentation/devicetree/bindings/leds/leds-trigger-pattern.txt
  135. $ref: /schemas/types.yaml#/definitions/uint32-matrix
  136. items:
  137. minItems: 2
  138. maxItems: 2
  139. led-max-microamp:
  140. description:
  141. Maximum LED supply current in microamperes. This property can be made
  142. mandatory for the board configurations introducing a risk of hardware
  143. damage in case an excessive current is set.
  144. For flash LED controllers with configurable current this property is
  145. mandatory for the LEDs in the non-flash modes (e.g. torch or indicator).
  146. max-brightness:
  147. description:
  148. Normally, the maximum brightness is determined by the hardware, and this
  149. property is not required. This property is used to set a software limit.
  150. It could happen that an LED is made so bright that it gets damaged or
  151. causes damage due to restrictions in a specific system, such as mounting
  152. conditions.
  153. Note that this flag is mainly used for PWM-LEDs, where it is not possible
  154. to map brightness to current. Drivers for other controllers should use
  155. led-max-microamp.
  156. $ref: /schemas/types.yaml#/definitions/uint32
  157. panic-indicator:
  158. description:
  159. This property specifies that the LED should be used, if at all possible,
  160. as a panic indicator.
  161. type: boolean
  162. retain-state-shutdown:
  163. description:
  164. This property specifies that the LED should not be turned off or changed
  165. when the system shuts down.
  166. type: boolean
  167. trigger-sources:
  168. description: |
  169. List of devices which should be used as a source triggering this LED
  170. activity. Some LEDs can be related to a specific device and should somehow
  171. indicate its state. E.g. USB 2.0 LED may react to device(s) in a USB 2.0
  172. port(s).
  173. Another common example is switch or router with multiple Ethernet ports
  174. each of them having its own LED assigned (assuming they are not
  175. hardwired). In such cases this property should contain phandle(s) of
  176. related source device(s).
  177. Another example is a GPIO line that will be monitored and mirror the
  178. state of the line (with or without inversion flags) to the LED.
  179. In many cases LED can be related to more than one device (e.g. one USB LED
  180. vs. multiple USB ports). Each source should be represented by a node in
  181. the device tree and be referenced by a phandle and a set of phandle
  182. arguments. A length of arguments should be specified by the
  183. #trigger-source-cells property in the source node.
  184. $ref: /schemas/types.yaml#/definitions/phandle-array
  185. active-low:
  186. type: boolean
  187. description:
  188. Makes LED active low. To turn the LED ON, line needs to be
  189. set to low voltage instead of high.
  190. inactive-high-impedance:
  191. type: boolean
  192. description:
  193. Set LED to high-impedance mode to turn the LED OFF. LED might also
  194. describe this mode as tristate.
  195. # Required properties for flash LED child nodes:
  196. flash-max-microamp:
  197. description:
  198. Maximum flash LED supply current in microamperes. Required for flash LED
  199. nodes with configurable current.
  200. flash-max-timeout-us:
  201. description:
  202. Maximum timeout in microseconds after which the flash LED is turned off.
  203. Required for flash LED nodes with configurable timeout.
  204. additionalProperties: true
  205. examples:
  206. - |
  207. #include <dt-bindings/gpio/gpio.h>
  208. #include <dt-bindings/leds/common.h>
  209. led-controller {
  210. compatible = "gpio-leds";
  211. led-0 {
  212. function = LED_FUNCTION_STATUS;
  213. linux,default-trigger = "heartbeat";
  214. gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>;
  215. };
  216. led-1 {
  217. function = LED_FUNCTION_USB;
  218. gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
  219. trigger-sources = <&ohci_port1>, <&ehci_port1>;
  220. };
  221. };
  222. - |
  223. #include <dt-bindings/leds/common.h>
  224. led-controller {
  225. compatible = "maxim,max77693-led";
  226. led {
  227. function = LED_FUNCTION_FLASH;
  228. color = <LED_COLOR_ID_WHITE>;
  229. led-sources = <0>, <1>;
  230. led-max-microamp = <50000>;
  231. flash-max-microamp = <320000>;
  232. flash-max-timeout-us = <500000>;
  233. };
  234. };
  235. - |
  236. #include <dt-bindings/leds/common.h>
  237. i2c {
  238. #address-cells = <1>;
  239. #size-cells = <0>;
  240. led-controller@30 {
  241. compatible = "panasonic,an30259a";
  242. reg = <0x30>;
  243. #address-cells = <1>;
  244. #size-cells = <0>;
  245. led@1 {
  246. reg = <1>;
  247. linux,default-trigger = "heartbeat";
  248. function = LED_FUNCTION_INDICATOR;
  249. function-enumerator = <1>;
  250. };
  251. led@2 {
  252. reg = <2>;
  253. function = LED_FUNCTION_INDICATOR;
  254. function-enumerator = <2>;
  255. };
  256. led@3 {
  257. reg = <3>;
  258. function = LED_FUNCTION_INDICATOR;
  259. function-enumerator = <3>;
  260. };
  261. };
  262. };
  263. ...