Add LEDs to the Device Tree

Linux Drivers

Release Date
2023-07-22

The leds-gpio driver enables many LED control schemes (via the "default-trigger" option) and allows them to be modified from user space; these drivers are suitable for any output-only GPIO application. Under the AXI interconnect, create a node named “leds-gpio”, like in the example below:

gpio-leds {
    compatible = "gpio-leds";
    led-ds23 {
        label = "led-ds23";
        gpios = <&ps7_gpio_0 10 0>;
        default-state = "on";
        linux,default-trigger = "heartbeat";
    };
};

Multiple LEDs can be nested at the same level as led-ds23 within gpio-leds. In this example, the LED is named led-ds23 to match the label ("DS23") on the ZC702 board, but this does not have any technical impact. The string <&ps7_gpio_0 10 0> references the GPIO controller and states that this device is on the GPIO pin/bit of 10; the 0 states that the device is active high. The default-trigger property dictates that the control scheme for the LED is “heartbeat” mode; in this mode the LED will double-pulse with a frequency relative to the CPU load.