leds.rst 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. .. SPDX-License-Identifier: GPL-2.0
  2. .. include:: <isonum.txt>
  3. ========================================
  4. Describing and referring to LEDs in ACPI
  5. ========================================
  6. Individual LEDs are described by hierarchical data extension [5] nodes under the
  7. device node, the LED driver chip. The "reg" property in the LED specific nodes
  8. tells the numerical ID of each individual LED output to which the LEDs are
  9. connected. [leds] The hierarchical data nodes are named "led@X", where X is the
  10. number of the LED output.
  11. Referring to LEDs in Device tree is documented in [video-interfaces], in
  12. "flash-leds" property documentation. In short, LEDs are directly referred to by
  13. using phandles.
  14. While Device tree allows referring to any node in the tree [devicetree], in
  15. ACPI references are limited to device nodes only [acpi]. For this reason using
  16. the same mechanism on ACPI is not possible. A mechanism to refer to non-device
  17. ACPI nodes is documented in [data-node-ref].
  18. ACPI allows (as does DT) using integer arguments after the reference. A
  19. combination of the LED driver device reference and an integer argument,
  20. referring to the "reg" property of the relevant LED, is used to identify
  21. individual LEDs. The value of the "reg" property is a contract between the
  22. firmware and software, it uniquely identifies the LED driver outputs.
  23. Under the LED driver device, The first hierarchical data extension package list
  24. entry shall contain the string "led@" followed by the number of the LED,
  25. followed by the referred object name. That object shall be named "LED" followed
  26. by the number of the LED.
  27. Example
  28. =======
  29. An ASL example of a camera sensor device and a LED driver device for two LEDs is
  30. show below. Objects not relevant for LEDs or the references to them have been
  31. omitted. ::
  32. Device (LED)
  33. {
  34. Name (_DSD, Package () {
  35. ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"),
  36. Package () {
  37. Package () { "led@0", LED0 },
  38. Package () { "led@1", LED1 },
  39. }
  40. })
  41. Name (LED0, Package () {
  42. ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
  43. Package () {
  44. Package () { "reg", 0 },
  45. Package () { "flash-max-microamp", 1000000 },
  46. Package () { "flash-timeout-us", 200000 },
  47. Package () { "led-max-microamp", 100000 },
  48. Package () { "label", "white:flash" },
  49. }
  50. })
  51. Name (LED1, Package () {
  52. ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
  53. Package () {
  54. Package () { "reg", 1 },
  55. Package () { "led-max-microamp", 10000 },
  56. Package () { "label", "red:indicator" },
  57. }
  58. })
  59. }
  60. Device (SEN)
  61. {
  62. Name (_DSD, Package () {
  63. ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
  64. Package () {
  65. Package () {
  66. "flash-leds",
  67. Package () { ^LED, "led@0", ^LED, "led@1" },
  68. }
  69. }
  70. })
  71. }
  72. where
  73. ::
  74. LED LED driver device
  75. LED0 First LED
  76. LED1 Second LED
  77. SEN Camera sensor device (or another device the LED is related to)
  78. References
  79. ==========
  80. [acpi] Advanced Configuration and Power Interface Specification.
  81. https://uefi.org/specifications/ACPI/6.4/, referenced 2021-11-30.
  82. [data-node-ref] Documentation/firmware-guide/acpi/dsd/data-node-references.rst
  83. [devicetree] Devicetree. https://www.devicetree.org, referenced 2019-02-21.
  84. [dsd-guide] DSD Guide.
  85. https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.adoc, referenced
  86. 2021-11-30.
  87. [leds] Documentation/devicetree/bindings/leds/common.yaml
  88. [video-interfaces] Documentation/devicetree/bindings/media/video-interfaces.yaml