0001 # SPDX-License-Identifier: GPL-2.0-only
0002 %YAML 1.2
0003 ---
0004 $id: http://devicetree.org/schemas/leds/leds-gpio.yaml#
0005 $schema: http://devicetree.org/meta-schemas/core.yaml#
0006
0007 title: LEDs connected to GPIO lines
0008
0009 maintainers:
0010 - Jacek Anaszewski <jacek.anaszewski@gmail.com>
0011 - Pavel Machek <pavel@ucw.cz>
0012
0013 description:
0014 Each LED is represented as a sub-node of the gpio-leds device. Each
0015 node's name represents the name of the corresponding LED.
0016
0017 properties:
0018 compatible:
0019 const: gpio-leds
0020
0021 patternProperties:
0022 # The first form is preferred, but fall back to just 'led' anywhere in the
0023 # node name to at least catch some child nodes.
0024 "(^led-[0-9a-f]$|led)":
0025 type: object
0026
0027 $ref: common.yaml#
0028
0029 properties:
0030 gpios:
0031 maxItems: 1
0032
0033 retain-state-suspended:
0034 description:
0035 The suspend state can be retained.Such as charge-led gpio.
0036 type: boolean
0037
0038 retain-state-shutdown:
0039 description:
0040 Retain the state of the LED on shutdown. Useful in BMC systems, for
0041 example when the BMC is rebooted while the host remains up.
0042 type: boolean
0043
0044 required:
0045 - gpios
0046
0047 additionalProperties: false
0048
0049 examples:
0050 - |
0051
0052 #include <dt-bindings/gpio/gpio.h>
0053 #include <dt-bindings/leds/common.h>
0054
0055 leds {
0056 compatible = "gpio-leds";
0057 led-0 {
0058 gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
0059 linux,default-trigger = "disk-activity";
0060 function = LED_FUNCTION_DISK;
0061 };
0062
0063 led-1 {
0064 gpios = <&mcu_pio 1 GPIO_ACTIVE_HIGH>;
0065 /* Keep LED on if BIOS detected hardware fault */
0066 default-state = "keep";
0067 function = LED_FUNCTION_FAULT;
0068 };
0069 };
0070
0071 run-control {
0072 compatible = "gpio-leds";
0073 led-0 {
0074 gpios = <&mpc8572 6 GPIO_ACTIVE_HIGH>;
0075 color = <LED_COLOR_ID_RED>;
0076 default-state = "off";
0077 };
0078 led-1 {
0079 gpios = <&mpc8572 7 GPIO_ACTIVE_HIGH>;
0080 color = <LED_COLOR_ID_GREEN>;
0081 default-state = "on";
0082 };
0083 };
0084
0085 ...