12b2d4247SSakari Ailus.. SPDX-License-Identifier: GPL-2.0 22b2d4247SSakari Ailus.. include:: <isonum.txt> 32b2d4247SSakari Ailus 42b2d4247SSakari Ailus======================================== 52b2d4247SSakari AilusDescribing and referring to LEDs in ACPI 62b2d4247SSakari Ailus======================================== 72b2d4247SSakari Ailus 8*59f3f982SSakari AilusIndividual LEDs are described by hierarchical data extension [5] nodes under the 92b2d4247SSakari Ailusdevice node, the LED driver chip. The "reg" property in the LED specific nodes 102b2d4247SSakari Ailustells the numerical ID of each individual LED output to which the LEDs are 11*59f3f982SSakari Ailusconnected. [leds] The hierarchical data nodes are named "led@X", where X is the 122b2d4247SSakari Ailusnumber of the LED output. 132b2d4247SSakari Ailus 14*59f3f982SSakari AilusReferring to LEDs in Device tree is documented in [video-interfaces], in 15*59f3f982SSakari Ailus"flash-leds" property documentation. In short, LEDs are directly referred to by 16*59f3f982SSakari Ailususing phandles. 172b2d4247SSakari Ailus 18*59f3f982SSakari AilusWhile Device tree allows referring to any node in the tree [devicetree], in 19*59f3f982SSakari AilusACPI references are limited to device nodes only [acpi]. For this reason using 20*59f3f982SSakari Ailusthe same mechanism on ACPI is not possible. A mechanism to refer to non-device 21*59f3f982SSakari AilusACPI nodes is documented in [data-node-ref]. 222b2d4247SSakari Ailus 232b2d4247SSakari AilusACPI allows (as does DT) using integer arguments after the reference. A 242b2d4247SSakari Ailuscombination of the LED driver device reference and an integer argument, 252b2d4247SSakari Ailusreferring to the "reg" property of the relevant LED, is used to identify 262b2d4247SSakari Ailusindividual LEDs. The value of the "reg" property is a contract between the 272b2d4247SSakari Ailusfirmware and software, it uniquely identifies the LED driver outputs. 282b2d4247SSakari Ailus 292b2d4247SSakari AilusUnder the LED driver device, The first hierarchical data extension package list 302b2d4247SSakari Ailusentry shall contain the string "led@" followed by the number of the LED, 312b2d4247SSakari Ailusfollowed by the referred object name. That object shall be named "LED" followed 322b2d4247SSakari Ailusby the number of the LED. 332b2d4247SSakari Ailus 342b2d4247SSakari AilusExample 352b2d4247SSakari Ailus======= 362b2d4247SSakari Ailus 372b2d4247SSakari AilusAn ASL example of a camera sensor device and a LED driver device for two LEDs is 382b2d4247SSakari Ailusshow below. Objects not relevant for LEDs or the references to them have been 392b2d4247SSakari Ailusomitted. :: 402b2d4247SSakari Ailus 412b2d4247SSakari Ailus Device (LED) 422b2d4247SSakari Ailus { 432b2d4247SSakari Ailus Name (_DSD, Package () { 442b2d4247SSakari Ailus ToUUID("dbb8e3e6-5886-4ba6-8795-1319f52a966b"), 452b2d4247SSakari Ailus Package () { 462b2d4247SSakari Ailus Package () { "led@0", LED0 }, 472b2d4247SSakari Ailus Package () { "led@1", LED1 }, 482b2d4247SSakari Ailus } 492b2d4247SSakari Ailus }) 502b2d4247SSakari Ailus Name (LED0, Package () { 512b2d4247SSakari Ailus ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 522b2d4247SSakari Ailus Package () { 532b2d4247SSakari Ailus Package () { "reg", 0 }, 542b2d4247SSakari Ailus Package () { "flash-max-microamp", 1000000 }, 552b2d4247SSakari Ailus Package () { "flash-timeout-us", 200000 }, 562b2d4247SSakari Ailus Package () { "led-max-microamp", 100000 }, 572b2d4247SSakari Ailus Package () { "label", "white:flash" }, 582b2d4247SSakari Ailus } 592b2d4247SSakari Ailus }) 602b2d4247SSakari Ailus Name (LED1, Package () { 612b2d4247SSakari Ailus ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 622b2d4247SSakari Ailus Package () { 632b2d4247SSakari Ailus Package () { "reg", 1 }, 642b2d4247SSakari Ailus Package () { "led-max-microamp", 10000 }, 652b2d4247SSakari Ailus Package () { "label", "red:indicator" }, 662b2d4247SSakari Ailus } 672b2d4247SSakari Ailus }) 682b2d4247SSakari Ailus } 692b2d4247SSakari Ailus 702b2d4247SSakari Ailus Device (SEN) 712b2d4247SSakari Ailus { 722b2d4247SSakari Ailus Name (_DSD, Package () { 732b2d4247SSakari Ailus ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"), 742b2d4247SSakari Ailus Package () { 752b2d4247SSakari Ailus Package () { 762b2d4247SSakari Ailus "flash-leds", 772b2d4247SSakari Ailus Package () { ^LED, "led@0", ^LED, "led@1" }, 782b2d4247SSakari Ailus } 792b2d4247SSakari Ailus } 802b2d4247SSakari Ailus }) 812b2d4247SSakari Ailus } 822b2d4247SSakari Ailus 832b2d4247SSakari Ailuswhere 842b2d4247SSakari Ailus:: 852b2d4247SSakari Ailus 862b2d4247SSakari Ailus LED LED driver device 872b2d4247SSakari Ailus LED0 First LED 882b2d4247SSakari Ailus LED1 Second LED 892b2d4247SSakari Ailus SEN Camera sensor device (or another device the LED is related to) 902b2d4247SSakari Ailus 912b2d4247SSakari AilusReferences 922b2d4247SSakari Ailus========== 932b2d4247SSakari Ailus 94*59f3f982SSakari Ailus[acpi] Advanced Configuration and Power Interface Specification. 95*59f3f982SSakari Ailus https://uefi.org/specifications/ACPI/6.4/, referenced 2021-11-30. 962b2d4247SSakari Ailus 97*59f3f982SSakari Ailus[data-node-ref] Documentation/firmware-guide/acpi/dsd/data-node-references.rst 982b2d4247SSakari Ailus 99*59f3f982SSakari Ailus[devicetree] Devicetree. https://www.devicetree.org, referenced 2019-02-21. 1002b2d4247SSakari Ailus 101*59f3f982SSakari Ailus[dsd-guide] DSD Guide. 102*59f3f982SSakari Ailus https://github.com/UEFI/DSD-Guide/blob/main/dsd-guide.adoc, referenced 103*59f3f982SSakari Ailus 2021-11-30. 1042b2d4247SSakari Ailus 105*59f3f982SSakari Ailus[leds] Documentation/devicetree/bindings/leds/common.yaml 1062b2d4247SSakari Ailus 107*59f3f982SSakari Ailus[video-interfaces] Documentation/devicetree/bindings/media/video-interfaces.yaml 108