of_gpio_twocell_xlate(9)
π« of_gpio_twocell_xlate β the kernel API manual, but make it make sense π«
okay so bestie, welcome to the manual page for of_gpio_twocell_xlate(9) β this is a Kernel API Manual situation, and honestly? it's a short one. we love a low-commitment read. π
πΈ NAME πΈ
of_gpio_twocell_xlate β translate twocell gpiospec to the GPIO number and flags
like, it takes your twocell gpiospec and hands you back the GPIO number and the flags. both. at once. multitasking icon behavior. β¨
π¦ SYNOPSIS π¦
int of_gpio_twocell_xlate (struct gpio_chip *gc , const struct
of_phandle_args *gpiospec , u32 *flags );
π ARGUMENTS π
gcβ pointer to thegpio_chipstructure. it's giving "here's my chip, pls look at it". πgpiospecβ the GPIO specifier as found in the device tree. straight out of the device tree, no cap. π³flagsβ a flags pointer to fill in. you hand it an empty cup and this function pours flags into it. π
π DESCRIPTION π
so like β this is a simple translation function, and i mean that lovingly. it's suitable for the most 1:1 mapped GPIO chips, aka the ones where the mapping is just... the mapping. no glow-up required. π¦
and check this: this function performs only one sanity check β whether the GPIO is less than ngpios (which is specified in the gpio_chip). that's it. that's the whole vibe check. one check. not me being like "is that enough??" and the answer is: for 1:1 mapped chips? yeah bestie, it ate. π₯
lowkey important: only that one check happens here. if you were expecting more validation, this is not that function. π
β RETURN β
- GPIO number (
>= 0) on success π - negative errno on failure π
like, if the number is zero or above, she slayed. if it's negative, that's an errno and something went sideways. periodt. π
π SEE ALSO π
- Kernel file
./drivers/gpio/gpiolib-of.cβ yes, the whole file, it's in the see-also and it's iconic for it π of_gpio_named_count(9)of_gpio_spi_cs_get_count(9)of_get_named_gpiod_flags(9)of_gpiochip_remove_hog(9)of_gpio_threecell_xlate(9)β yes, the threecell one. two's company, three's a trilogy. π§
okay that's the page!! π«Ά and for the cute sign-off: this one lives over in ./drivers/gpio, dated October 2026, and it's the of_gpio_twocell_xlate(9) page from the Kernel API Manual. go read the threecell one next, iykyk. ππΈβ¨
π¦ 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