GPIO(4)
π GPIO(4) β the gpiobus system, bestie edition π
okay so welcome to the Kernel Interfaces Manual, section 4, and this whole page is literally about gpiobus β the GPIO bus system. no cap, it's giving "tiny pins run the world" energy. let's get into it π¦
β¨ NAME β¨
gpiobus β the GPIO bus system π
πΈ SYNOPSIS πΈ
so if you wanna compile these devices into your kernel and use the device hints, you gotta place these lines in your kernel configuration file, periodt:
device gpio
device gpioc
device gpioiic
device gpioled
and then, extra device entries for the ARM architecture include:
device a10_gpio
device bcm_gpio
device imx51_gpio
device lpcgpio
device mv_gpio
device ti_gpio
device gpio_avila
device gpio_cambria
device zy7_gpio
device pxagpio
additional device entries for the MIPS architecture include:
device ar71xxx_gpio
device octeon_gpio
device rt305_gpio
and additional device entries for the POWERPC architecture include:
device wiigpio
device macgpio
slay, that's the whole config list π
π DESCRIPTION π
the gpiobus system provides a simple interface to the GPIO pins that are usually available on embedded architectures, and it can provide bit banging style devices to the system. lowkey iconic.
the acronym GPIO means βGeneral-Purpose Input/Output.β there, vocabulary unlocked πβ¨
the BUS physically consists of multiple pins that can be configured for input/output, IRQ delivery, SDA/SCL iicbus use, etc. multitasking queen behavior honestly π
π§ how the bus gets discovered π§
on some embedded architectures (like MIPS), discovery of the bus and configuration of the pins is done via device.hints(5) in the platform's kernel config(5) file. yes bestie, hints file.
on some others (like ARM), where FDT(4) is used to describe the device tree, the bus discovery is done via the DTS passed to the kernel β being either statically compiled in, or by a variety of ways where the boot loader (or Open Firmware enabled system) passes the DTS blob to the kernel at boot. main character bootloader energy fr fr.
π the device.hints(5) hints π
on a device.hints(5) based system, these hints can be used to configure drivers for devices attached to gpiobus pins:
hint.driver.unit.atβ thegpiobuswhere the device is attached. for example,"gpiobus0".driverandunitare the driver name and the unit number for the device driver.hint.driver.unit.pinsβ this is a bitmask of the pins on thegpiobusthat are connected to the device. the pins will be allocated to the specified driver instance. only pins with numbers from0to31can be specified using this hint. (so, small numbers only, bestie π)hint.driver.unit.pin_listβ this is a list of pin numbers of pins on thegpiobusthat are connected to the device. the pins will be allocated to the specified driver instance. this is a more user friendly alternative to thepinshint. additionally, this hint allows specifying pin numbers greater than31. the numbers can be decimal or hexadecimal with0xprefix. any non-digit character can be used as a separator β for example, it can be a comma, a slash or a space. the separator can be followed by any number of space characters. obsessed, so flexible π
π₯ the ar71xx_gpio-only hints π₯
the following device.hints(5) are only provided by the ar71xx_gpio driver:
hint.gpio.%d.pinmaskβ this is a bitmask of pins on the GPIO board that we would like to expose for use to the host operating system. to expose pin0,4and7, use the bitmask of10010001converted to the hexadecimal value0x0091.hint.gpio.%d.pinonβ this is a bitmask of pins on the GPIO board that will be set to ON at host start. to set pin2,5and13to be set ON at boot, use the bitmask of10000000010010converted to the hexadecimal value0x2012.hint.gpio.function_sethint.gpio.function_clearβ these are bitmasks of pins that will remap a pin to handle a specific function (USB, UART TX/RX, etc) in the Atheros function registers. this is mainly used to set/clear functions that we need when they are set up or not set up by uBoot.
simply put, each pin of the GPIO interface is connected to an input/output of some device in a system. tiny pin, big job, we love to see it π«Ά
π SEE ALSO π
go read those too, iykyk πβ¨
β HISTORY β
the gpiobus manual page first appeared in FreeBSD 10.0. vintage, but make it iconic.
π AUTHORS π
this manual page was written by Sean Bruno <sbruno@FreeBSD.org>. thank you for your service, king π«‘π
and that's the whole page, bestie!! this came to you from the Debian build, dated June 27, 2019, and yes it's GPIO(4) through and through. go configure some pins, you absolute legend ππ bye!! π¦πΈ
π¦ 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, Sean Bruno <sbruno@freebsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms