leds-gpio.txt 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. LEDs connected to GPIO lines
  2. Required properties:
  3. - compatible : should be "gpio-leds".
  4. Each LED is represented as a sub-node of the gpio-leds device. Each
  5. node's name represents the name of the corresponding LED.
  6. LED sub-node properties:
  7. - gpios : Should specify the LED's GPIO, see "gpios property" in
  8. Documentation/devicetree/bindings/gpio/gpio.txt. Active low LEDs should be
  9. indicated using flags in the GPIO specifier.
  10. - label : (optional)
  11. see Documentation/devicetree/bindings/leds/common.txt
  12. - linux,default-trigger : (optional)
  13. see Documentation/devicetree/bindings/leds/common.txt
  14. - default-state: (optional) The initial state of the LED.
  15. see Documentation/devicetree/bindings/leds/common.txt
  16. - retain-state-suspended: (optional) The suspend state can be retained.Such
  17. as charge-led gpio.
  18. - retain-state-shutdown: (optional) Retain the state of the LED on shutdown.
  19. Useful in BMC systems, for example when the BMC is rebooted while the host
  20. remains up.
  21. - panic-indicator : (optional)
  22. see Documentation/devicetree/bindings/leds/common.txt
  23. Examples:
  24. #include <dt-bindings/gpio/gpio.h>
  25. leds {
  26. compatible = "gpio-leds";
  27. hdd {
  28. label = "Disk Activity";
  29. gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
  30. linux,default-trigger = "disk-activity";
  31. };
  32. fault {
  33. gpios = <&mcu_pio 1 GPIO_ACTIVE_HIGH>;
  34. /* Keep LED on if BIOS detected hardware fault */
  35. default-state = "keep";
  36. };
  37. };
  38. run-control {
  39. compatible = "gpio-leds";
  40. red {
  41. gpios = <&mpc8572 6 GPIO_ACTIVE_HIGH>;
  42. default-state = "off";
  43. };
  44. green {
  45. gpios = <&mpc8572 7 GPIO_ACTIVE_HIGH>;
  46. default-state = "on";
  47. };
  48. };
  49. leds {
  50. compatible = "gpio-leds";
  51. charger-led {
  52. gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
  53. linux,default-trigger = "max8903-charger-charging";
  54. retain-state-suspended;
  55. };
  56. };