leds-gpio.txt 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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. Valid
  15. values are "on", "off", and "keep". If the LED is already on or off
  16. and the default-state property is set the to same value, then no
  17. glitch should be produced where the LED momentarily turns off (or
  18. on). The "keep" setting will keep the LED at whatever its current
  19. state is, without producing a glitch. The default is off if this
  20. property is not present.
  21. - retain-state-suspended: (optional) The suspend state can be retained.Such
  22. as charge-led gpio.
  23. Examples:
  24. #include <dt-bindings/gpio/gpio.h>
  25. leds {
  26. compatible = "gpio-leds";
  27. hdd {
  28. label = "IDE Activity";
  29. gpios = <&mcu_pio 0 GPIO_ACTIVE_LOW>;
  30. linux,default-trigger = "ide-disk";
  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. };