gpio_to_pin(9)
π 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:
pinctrl_provide_dummies(9)get_pinctrl_dev_from_devname(9)pin_get_from_name(9)pin_get_name(9)pinctrl_match_gpio_range(9)pinctrl_ready_for_gpio_range(9)pinctrl_get_device_gpio_range(9)pinctrl_add_gpio_range(9)pinctrl_find_gpio_range_from_pin(9)pinctrl_remove_gpio_range(9)pinctrl_generic_get_group_count(9)pinctrl_generic_get_group_name(9)pinctrl_generic_get_group_pins(9)pinctrl_generic_get_group(9)pinctrl_generic_add_group(9)pinctrl_generic_remove_group(9)pinctrl_generic_free_groups(9)pinctrl_get_group_selector(9)pinctrl_gpio_request(9)pinctrl_gpio_free(9)pinctrl_gpio_direction_input(9)pinctrl_gpio_direction_output(9)pinctrl_gpio_set_config(9)pinctrl_gpio_get_config(9)pinctrl_get(9)pinctrl_release(9)pinctrl_put(9)pinctrl_lookup_state(9)pinctrl_commit_state(9)pinctrl_select_state(9)devm_pinctrl_get(9)devm_pinctrl_put(9)pinctrl_register_mappings(9)pinctrl_unregister_mappings(9)devm_pinctrl_register_mappings(9)pinctrl_force_sleep(9)pinctrl_force_default(9)pinctrl_init_done(9)pinctrl_select_default_state(9)pinctrl_pm_select_default_state(9)pinctrl_pm_select_init_state(9)pinctrl_pm_select_sleep_state(9)pinctrl_pm_select_idle_state(9)pinctrl_init_controller(9)pinctrl_register(9)pinctrl_register_and_init(9)pinctrl_unregister(9)devm_pinctrl_register(9)devm_pinctrl_register_and_init(9)
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
- 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