Complete Communications Engineering

If an embedded system has indicator LEDs, they are usually connected to output GPIOs.  An output GPIO is any signal controlled by a microchip that can have either a high or low voltage.  It might be a pin on the main CPU itself, or on an external chip that communicates with the CPU through a bus.  In either case, output GPIOs should be controllable through the standard Linux GPIO drivers.  Using the GPIO drivers directly is one way to control indicator LEDs, but Linux has another software layer on top of its GPIO drivers specifically for indicator LEDs.  This is the ‘gpio-leds’ driver, and it allows each indicator LED to be tied to a specific function that is controlled by the Linux kernel.

Setting up indicator LEDs is usually done through the Linux device tree.  The tree will contain a node compatible with the ‘gpio-leds’ driver.  Children of this node represent actual LEDs.  Each one can be connected to a GPIO, and their indicator function can be assigned.  Linux supports a number of ready to use indicator modes including CPU activity and disk activity.  Software control of the LEDs is usually not required when using the pre-defined LED functions.  If software control is needed, each LED is available to user space applications through the ‘/sys/class/leds’ folder.