of_gpio_threecell_xlate(9)
π of_gpio_threecell_xlate(9) β the Kernel API Manual, bestie edition π
okay so first things first, we're in the Kernel API Manual today, and the star of the show is of_gpio_threecell_xlate(9). yes the name is a mouthful. no we're not abbreviating it. it's iconic and we respect it. β¨
β¨ NAME β¨
of_gpio_threecell_xlate β literally translates a threecell gpiospec into the GPIO number and flags π¦
that's it. that's the whole job. she takes your spec and hands you back a number and some flags. slay.
πΈ SYNOPSIS πΈ
int of_gpio_threecell_xlate (struct gpio_chip *gc , const struct
of_phandle_args *gpiospec , u32 *flags );
look at her go. three arguments, one int return, no drama. π
π ARGUMENTS π
gcβ pointer to thegpio_chipstructure. like, the actual chip we're talking about here. π«Άgpiospecβ the GPIO specifier as found in the device tree. this is the info she's gonna chew on and translate. πflagsβ a flags pointer to fill in. she writes into it, you read out of it. teamwork, fr fr. β¨
π DESCRIPTION π
okay so this is a simple translation function β and I mean simple in the best way, not the shady way. it's suitable for the most 1:n mapped GPIO chips, i.e. when you've got several GPIO chip instances coming from one device tree node. one node, many chips, and she keeps them all straight. main character energy honestly. π
in that case, the following binding is implied:
foo-gpios = <gpio instance offset flags>;
three cells. hence threecell. the way the name actually makes sense once you see it ππ
π₯ RETURN π₯
- GPIO number (
>= 0) on success β we love a win π - negative
errnoon failure β she's not mad, she's just disappointed π
π¦ SEE ALSO π¦
- Kernel file
./drivers/gpio/gpiolib-of.c 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_twocell_xlate(9)
(the twocell one is her sibling btw. less cells, same vibe. iykyk π§)
bestie reminder: this page lives in ./drivers/gpio, and it's stamped October 2026 β so go read it again next year, it'll still be here, still serving πΈ
k bye, go translate some gpiospecs, you're gonna ate π πβ
π¦ 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