leds-gpio.yaml 2.1 KB

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