gpio_reg_init(9)
π¦ gpio_reg_init(9) π¦
okay so this is a page from the Kernel API Manual, and the whole vibe is: you're turning one single fixed register into a whole lil gpio chip, and honestly? iconic. let's get into it bestie π
β¨ NAME β¨
gpio_reg_init β add a fixed in/out register as gpio
like literally, this is the function that says "hey, this register? it's a gpio now. periodt." π
β¨ SYNOPSIS β¨
struct gpio_chip * gpio_reg_init (struct device *dev , void __iomem *reg
, int base , int num , const char *label , u32 direction , u32 def_out ,
const char *const *names , struct irq_domain *irqdom , const int *irqs
);
look at all those args, she's serving range π but don't panic, we're going through every single one, fr fr.
β¨ ARGUMENTS β¨
devβ optionalstruct deviceassociated with this register. optional!! she doesn't need a device, she's independent like that π¦regβ the original page literally just says-- undescribed --and that's all we get, ngl π no cap, whoever wrote this left it blank. moving on before it gets awkward πbaseβ start gpio number, or-1to allocate. so you either hand her a starting number or you're like "girl, you pick" and-1makes it allocate β¨numβ number of GPIOs, maximum 32. that's the ceiling, bestie, 32 and not one more πlabelβ GPIO chip label. her name tag at the party πdirectionβ bitmask of fixed direction, one per GPIO signal,1= in. so each signal gets its own bit and1means input, iykykdef_outβ initial GPIO output value. the starting fit before she changes into anything else πnamesβ array ofnumstrings describing each GPIO signal, orNULL. one cute name per signal, or justNULLif you can't be bothered πΈirqdomβ irq domain orNULL. your interrupt domain, orNULLif there isn't one, lowkey simpleirqsβ array ofnumints describing the interrupt mapping for each GPIO signal, orNULL. and here's the important bit: ifirqdomisNULL, then this describes the Linux interrupt number; otherwise it describes the hardware interrupt number in the specified irq domain. two totally different meanings depending onirqdom, so don't mix them up bestie, I'm begging ππ₯
β¨ DESCRIPTION β¨
okay so what this actually does: it adds a single-register GPIO device containing up to 32 GPIO signals, where each GPIO has a fixed input or output configuration. fixed! she's not out here being flexible, she's committed to her configuration and honestly same π
now the important caveats, and please read these because they're the whole vibe check:
- Only input GPIOs are assumed to be readable from the register β and only then after a double-read. double-read!! that's the rule, don't skip it or you'll be out here reading nonsense π
- Output values are assumed not to be readable. so don't go reading outputs expecting answers, she's not giving them π
β οΈ these are assumptions the code makes, not suggestions β if you're counting on anything else, that's on you, bestie π
β¨ SEE ALSO β¨
- Kernel file
./drivers/gpio/gpio-reg.cβ go read the source, that's where the real lore lives πβ¨
and that's the whole page, you ate that π«Ά
source: ./drivers/gpio π β dated October 2026, signed off as gpio_reg_init(9), and that's the tea girlie, mwah πππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms