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