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