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