gpio_to_pin(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… gpio_to_pin β€” the man page, but make it group chat

okay so real quick before we dive in: this is gpio_to_pin(9), straight out of the Kernel API Manual. Yes bestie, that manual. Buckle up πŸŽ€


✨ NAME ✨

gpio_to_pin β€” the lil translator that turns a GPIO range GPIO number into an actual pin number. it's giving interpreter-for-hardware energy πŸ¦‹


🌸 SYNOPSIS 🌸

int gpio_to_pin (struct pinctrl_gpio_range *range , struct gpio_chip *gc
, unsigned int offset );

πŸ’– ARGUMENTS πŸ’–

  • range β€” the GPIO range we're using as our translation base. this is the vibe-check of the operation.
  • gc β€” the GPIO chip structure, handed to us by the GPIO subsystem itself πŸ‘‘
  • offset β€” the hardware offset of the GPIO, measured relative to the controller. like, its home address basically 🏠

πŸ”₯ DESCRIPTION πŸ”₯

so what does it actually do? it finds the pin number for a given GPIO, using the specified GPIO range as the base for translation. simple. iconic. no notes ✨

and the way it handles the two flavors β€” linear GPIO ranges vs pin list based GPIO ranges β€” is correctly managed by this function. it's not picking favorites, it just knows the difference 😌

⚠️ okay this part is important, don't scroll past: this function assumes the gpio is part of the specified GPIO range. do not just call it on vibes alone. use it only after making sure that's actually the case β€” like, for example, by calling it on the result of successful pinctrl_get_device_gpio_range calls. fr fr, check first πŸ’€

🫢 SEE ALSO 🫢

Kernel file ./drivers/pinctrl/core.c β€” and honestly the whole pinctrl friend group showed up to the party, here's the full squad:

like, the whole roster. 49 entries. literally everyone. go say hi 🧚


and that's the page!! πŸŽ€ this icon lives over in ./drivers/pinctrl, and this particular glow-up is stamped October 2026 β€” so yeah, it's dated, it's slaying, it's the pinctrl directory's finest. mwah πŸ’œβœ¨πŸŒΈ

πŸ“¦ where this page comes from