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