Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1LEDs connected to GPIO lines
2
3Required properties:
4- compatible : should be "gpio-leds".
5
6Each LED is represented as a sub-node of the gpio-leds device. Each
7node's name represents the name of the corresponding LED.
8
9LED sub-node properties:
10- gpios : Should specify the LED's GPIO, see "gpios property" in
11 Documentation/devicetree/bindings/gpio/gpio.txt. Active low LEDs should be
12 indicated using flags in the GPIO specifier.
13- label : (optional)
14 see Documentation/devicetree/bindings/leds/common.txt
15- linux,default-trigger : (optional)
16 see Documentation/devicetree/bindings/leds/common.txt
17- default-state: (optional) The initial state of the LED.
18 see Documentation/devicetree/bindings/leds/common.txt
19- retain-state-suspended: (optional) The suspend state can be retained.Such
20 as charge-led gpio.
21- retain-state-shutdown: (optional) Retain the state of the LED on shutdown.
22 Useful in BMC systems, for example when the BMC is rebooted while the host
23 remains up.
24- panic-indicator : (optional)
25 see Documentation/devicetree/bindings/leds/common.txt
26
27Examples:
28
29#include <dt-bindings/gpio/gpio.h>
30
31leds {
32 compatible = "gpio-leds";
33 hdd {
34 label = "Disk Activity";
35 gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
36 linux,default-trigger = "disk-activity";
37 };
38
39 fault {
40 gpios = <&mcu_pio 1 GPIO_ACTIVE_HIGH>;
41 /* Keep LED on if BIOS detected hardware fault */
42 default-state = "keep";
43 };
44};
45
46run-control {
47 compatible = "gpio-leds";
48 red {
49 gpios = <&mpc8572 6 GPIO_ACTIVE_HIGH>;
50 default-state = "off";
51 };
52 green {
53 gpios = <&mpc8572 7 GPIO_ACTIVE_HIGH>;
54 default-state = "on";
55 };
56};
57
58leds {
59 compatible = "gpio-leds";
60
61 charger-led {
62 gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
63 linux,default-trigger = "max8903-charger-charging";
64 retain-state-suspended;
65 };
66};