GPIOLED(4)
β¨ GPIOLED(4) β¨
Kernel Interfaces Manual π β like, the manual page for the gpioled driver, bestie π
π NAME
gpioled β the GPIO LED generic device driver π
πΈ SYNOPSIS
okay so to get this driver baked into your kernel, you gotta drop these lines into your kernel config file:
device gpio
device gpioled
no cap, that's it. two lines. slay β¨
π¦ DESCRIPTION
The gpioled driver is basically the glue π«Ά that attaches a led(4)-compatible device to a GPIO pin. Every LED in the system gets a name, and that name is what exports the device as /dev/led/<name>. Then you control the GPIO pin by writing to that device β exactly the way led(4) describes it. it's giving "tiny file, big power" π
π On a device.hints(5) based system (like MIPS!)
these values are configurable for gpioled:
hint.gpioled.%d.atβ thegpiobusyou're attaching to. normally it's assigned togpiobus0. like, that's its home πhint.gpioled.%d.nameβ the arbitrary name of the device in/dev/led/to create forled(4). pick something cute, iykyk πhint.gpioled.%d.pinsβ which pin on the GPIO interface gets mapped to this instance. β οΈ please note that this mask should only ever have one bit set β any other bits (i.e., pins) will just be ignored. one pin, one vibe. periodt.hint.gpioled.%d.invertβ if you set this to1, the pin gets set to0to light the LED, and1to clear it. upside-down logic, main character energy πhint.gpioled.%d.stateβ the initial state of the LED when the driver takes control over it. set it to1or0and the LED will be on or off correspondingly. set it to-1and the LED gets kept in its original state. no notes, we love a neutral option π
π On a FDT(4) based system (like ARM!)
the DTS part for a gpioled device usually looks like this:
gpio: gpio {
gpio-controller;
...
led0 {
compatible = "gpioled";
gpios = <&gpio 16 2 0>; /* GPIO pin 16. */
name = "ok";
};
led1 {
compatible = "gpioled";
gpios = <&gpio 17 2 0>; /* GPIO pin 17. */
name = "user-led1";
};
};
optionally π you can choose to combine all the LEDs under a single βgpio-ledsβ compatible node:
simplebus0 {
...
leds {
compatible = "gpio-leds";
led0 {
gpios = <&gpio 16 2 0>;
name = "ok"
};
led1 {
gpios = <&gpio 17 2 0>;
name = "user-led1"
};
};
};
both methods are equally supported π― and you can totally have the LEDs defined with any sort of mix between the two methods. the only restriction? a GPIO pin cannot be mapped by two different (gpio)leds. sharing is not caring here, bestie β pick a lane π«
for more details about the gpios property, please consult /usr/src/sys/dts/bindings-gpio.txt π (yes, actually go read it, it's right there)
the name property is the arbitrary name of the device in /dev/led/ to create for led(4). β¨
π SEE ALSO
fdt(4), gpio(4), gpioiic(4), led(4)
π HISTORY
The gpioled manual page first appeared in FreeBSD 10.1. a legend was born, fr fr π
π AUTHORS
This manual page was written by Luiz Otavio O Souza. thank you king π«Ά
Debian Β· May 23, 2019 Β· GPIOLED(4) β okay bye bestie, go blink some LEDs for me π
β¨π
π¦ where this page comes from
- debian bookworm: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- debian trixie: freebsd-manpages 12.2-2 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu jammy: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu noble: freebsd-manpages 12.2-1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu questing: freebsd-manpages 12.2-2
- ubuntu resolute: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- ubuntu stonking: freebsd-manpages 12.2-2build1 Β· BSD-2-Clause-FreeBSD AND BSD-4-Clause
- Copyright (c) 2013, Luiz Otavio O Souza <loos@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms