xref: /OK3568_Linux_fs/kernel/Documentation/devicetree/bindings/leds/leds-gpio.yaml (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun# SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun%YAML 1.2
3*4882a593Smuzhiyun---
4*4882a593Smuzhiyun$id: http://devicetree.org/schemas/leds/leds-gpio.yaml#
5*4882a593Smuzhiyun$schema: http://devicetree.org/meta-schemas/core.yaml#
6*4882a593Smuzhiyun
7*4882a593Smuzhiyuntitle: LEDs connected to GPIO lines
8*4882a593Smuzhiyun
9*4882a593Smuzhiyunmaintainers:
10*4882a593Smuzhiyun  - Jacek Anaszewski <jacek.anaszewski@gmail.com>
11*4882a593Smuzhiyun  - Pavel Machek <pavel@ucw.cz>
12*4882a593Smuzhiyun
13*4882a593Smuzhiyundescription:
14*4882a593Smuzhiyun  Each LED is represented as a sub-node of the gpio-leds device.  Each
15*4882a593Smuzhiyun  node's name represents the name of the corresponding LED.
16*4882a593Smuzhiyun
17*4882a593Smuzhiyunproperties:
18*4882a593Smuzhiyun  compatible:
19*4882a593Smuzhiyun    const: gpio-leds
20*4882a593Smuzhiyun
21*4882a593SmuzhiyunpatternProperties:
22*4882a593Smuzhiyun  # The first form is preferred, but fall back to just 'led' anywhere in the
23*4882a593Smuzhiyun  # node name to at least catch some child nodes.
24*4882a593Smuzhiyun  "(^led-[0-9a-f]$|led)":
25*4882a593Smuzhiyun    type: object
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun    $ref: common.yaml#
28*4882a593Smuzhiyun
29*4882a593Smuzhiyun    properties:
30*4882a593Smuzhiyun      gpios:
31*4882a593Smuzhiyun        maxItems: 1
32*4882a593Smuzhiyun
33*4882a593Smuzhiyun      retain-state-suspended:
34*4882a593Smuzhiyun        description:
35*4882a593Smuzhiyun          The suspend state can be retained.Such as charge-led gpio.
36*4882a593Smuzhiyun        type: boolean
37*4882a593Smuzhiyun
38*4882a593Smuzhiyun      retain-state-shutdown:
39*4882a593Smuzhiyun        description:
40*4882a593Smuzhiyun          Retain the state of the LED on shutdown. Useful in BMC systems, for
41*4882a593Smuzhiyun          example when the BMC is rebooted while the host remains up.
42*4882a593Smuzhiyun        type: boolean
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun    required:
45*4882a593Smuzhiyun      - gpios
46*4882a593Smuzhiyun
47*4882a593SmuzhiyunadditionalProperties: false
48*4882a593Smuzhiyun
49*4882a593Smuzhiyunexamples:
50*4882a593Smuzhiyun  - |
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun    #include <dt-bindings/gpio/gpio.h>
53*4882a593Smuzhiyun    #include <dt-bindings/leds/common.h>
54*4882a593Smuzhiyun
55*4882a593Smuzhiyun    leds {
56*4882a593Smuzhiyun        compatible = "gpio-leds";
57*4882a593Smuzhiyun        led-0 {
58*4882a593Smuzhiyun            gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
59*4882a593Smuzhiyun            linux,default-trigger = "disk-activity";
60*4882a593Smuzhiyun            function = LED_FUNCTION_DISK;
61*4882a593Smuzhiyun        };
62*4882a593Smuzhiyun
63*4882a593Smuzhiyun        led-1 {
64*4882a593Smuzhiyun            gpios = <&mcu_pio 1 GPIO_ACTIVE_HIGH>;
65*4882a593Smuzhiyun            /* Keep LED on if BIOS detected hardware fault */
66*4882a593Smuzhiyun            default-state = "keep";
67*4882a593Smuzhiyun            function = LED_FUNCTION_FAULT;
68*4882a593Smuzhiyun        };
69*4882a593Smuzhiyun    };
70*4882a593Smuzhiyun
71*4882a593Smuzhiyun    run-control {
72*4882a593Smuzhiyun        compatible = "gpio-leds";
73*4882a593Smuzhiyun        led-0 {
74*4882a593Smuzhiyun            gpios = <&mpc8572 6 GPIO_ACTIVE_HIGH>;
75*4882a593Smuzhiyun            color = <LED_COLOR_ID_RED>;
76*4882a593Smuzhiyun            default-state = "off";
77*4882a593Smuzhiyun        };
78*4882a593Smuzhiyun        led-1 {
79*4882a593Smuzhiyun            gpios = <&mpc8572 7 GPIO_ACTIVE_HIGH>;
80*4882a593Smuzhiyun            color = <LED_COLOR_ID_GREEN>;
81*4882a593Smuzhiyun            default-state = "on";
82*4882a593Smuzhiyun        };
83*4882a593Smuzhiyun    };
84*4882a593Smuzhiyun
85*4882a593Smuzhiyun...
86