GPIOLED(4)
π GPIOLED(4) β bestie edition π
okay so this is the Kernel Interfaces Manual page for gpioled, and i'm literally about to make your whole kernel-dev career slay β¨ grab a boba and let's go π§π
β¨ NAME β¨
gpioled β the GPIO LED generic device driver π (yes it's giving "i make lights blink on pins" and it does it flawlessly, no cap)
πΈ SYNOPSIS πΈ
so to compile this icon into the kernel, you literally just drop these lines into your kernel configuration file, periodt:
device gpio
device gpioled
that's it. that's the whole vibe check. you got this bestie π«Ά
π DESCRIPTION π
bestie listen β gpioled is the glue that attaches a led(4)-compatible device to a GPIO pin π₯ it's the matchmaker, the middleman, the main character of the wiring world ngl.
every LED in the system has a name, and that name is what's used to export a device as /dev/led/<name> π¦ then you can control that GPIO pin by writing to this device, exactly the way led(4) describes. iykyk π
now, on a device.hints(5) based system β think MIPS vibes β these values are configurable for gpioled:
hint.gpioled.%d.atβ thegpiobusyou're attaching to π normally it's assigned togpiobus0.hint.gpioled.%d.nameβ the arbitrary name of the device in/dev/led/to create forled(4). you name it, you own it πhint.gpioled.%d.pinsβ which pin on the GPIO interface gets mapped to this instance β¨ but bestie, please note: this mask should only ever have one bit set β any other bits (i.e., pins) will be flat-out ignored π okurrr.hint.gpioled.%d.invertβ if you set this to1, the pin gets set to0to light the LED, and1to clear it π (yes, the logic flips, it's that girl π€Έ)hint.gpioled.%d.stateβ the initial state of the LED when the driver takes control over it π if it's1or0, the LED is on or off correspondingly. if it's-1, the LED stays in its original state, no touching, no drama π
π FDT(4) vibes (ARM girls, this one's for you) π
on a FDT(4) based system, like ARM, the DTS part for a gpioled device usually looks like this, and yes it's giving art π:
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 β and this is lowkey the aesthetic upgrade β you can choose to combine all the LEDs under a single "gpio-leds" compatible node π like so:
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 it's totally possible to have LEDs defined with any sort of mix between the two methods. mix and match, it's your world πβ¨
the only restriction (and this is the important part, bestie, don't skip it π): a GPIO pin cannot be mapped by two different (gpio)leds. no double-booking, no sharing, we don't do that here π periodt.
for more details about the gpios property, please consult /usr/src/sys/dts/bindings-gpio.txt π (yes, go read it, it's giving homework but make it cute).
the property name is the arbitrary name of the device in /dev/led/ to create for led(4) π§ that's how you name your little light babies.
π₯ SEE ALSO π₯
go read them, they're all iconic in their own way π
β HISTORY β
the gpioled manual page first appeared in FreeBSD 10.1 π a legend was born.
πΈ AUTHORS πΈ
this manual page was written by Luiz Otavio O Souza β thank you for your service king π«Άβ¨
and that's the whole page bestie π written with love, Debian, May 23, 2019, for GPIOLED(4) β you're gonna do amazing things with those LEDs, i can feel it ππ
π
π¦ where this page comes from
- freebsd 14.5: base 14.5
- freebsd 15.1: base 15.1
- nixpkgs unstable: source
- Copyright (c) 2013, Luiz Otavio O Souza <loos@FreeBSD.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms