of_gpio_twocell_xlate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« 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 the gpio_chip structure. 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 🌈


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