STRUCT PINCTRL_DEV(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct pinctrl_dev(9) πŸ’–

okay so real talk bestie, welcome to the Kernel API Manual β€” this page is all about struct pinctrl_dev, which is literally the pin control class device. it's giving "backstage pass to every pin on your board" energy and honestly? iconic. let's get into it πŸŽ€


✨ NAME ✨

struct pinctrl_dev β€” the pin control class device, no cap πŸ’…


🌸 SYNOPSIS 🌸

here's the whole struct, copied exactly, do not touch, do not "clean up", she is perfect as she is:

struct pinctrl_dev {
    struct list_head node;
    const struct pinctrl_desc *desc;
    struct radix_tree_root pin_desc_tree;
  #ifdef CONFIG_GENERIC_PINCTRL_GROUPS;
    struct radix_tree_root pin_group_tree;
    unsigned int num_groups;
  #endif;
  #ifdef CONFIG_GENERIC_PINMUX_FUNCTIONS;
    struct radix_tree_root pin_function_tree;
    unsigned int num_functions;
  #endif;
    struct list_head gpio_ranges;
    struct device *dev;
    struct module *owner;
    void *driver_data;
    struct pinctrl *p;
    struct pinctrl_state *hog_default;
    struct pinctrl_state *hog_sleep;
    struct mutex mutex;
  #ifdef CONFIG_DEBUG_FS;
    struct dentry *device_root;
  #endif;
 };

like. look at her. a whole pin controller in one struct. we stan 🫢


πŸ¦‹ Members πŸ¦‹

okay so this is the part where we go field by field, and honestly every single one of them matters, so pay attention:

  • node β€” the node that includes this pin controller in the global pin controller list πŸ“‹
  • desc β€” the pin controller descriptor that got supplied when this pin controller was initialized
  • pin_desc_tree β€” every pin descriptor for this pin controller lives in this radix tree 🌳
  • pin_group_tree β€” optionally, each pin group can be stored in this radix tree
  • num_groups β€” optionally, the number of groups can be kept right here
  • pin_function_tree β€” optionally, each function can be stored in this radix tree
  • num_functions β€” optionally, the number of functions can be kept right here
  • gpio_ranges β€” a list of GPIO ranges handled by this pin controller, and heads up: ranges get added to this list at runtime ⏱️
  • dev β€” the device entry for this pin controller
  • owner β€” the module providing the pin controller, used for refcounting (very much a "who's holding the tab" situation)
  • driver_data β€” driver data for drivers registering to the pin controller subsystem
  • p β€” the result of pinctrl_get for this device
  • hog_default β€” default state for pins hogged by this device 🐷
  • hog_sleep β€” sleep state for pins hogged by this device 😴
  • mutex β€” mutex taken on each pin controller specific action πŸ”’
  • device_root β€” debugfs root for this device
ngl the hog_default / hog_sleep pair is lowkey my favorite naming in all of the kernel. whoever named them ate and left zero crumbs πŸ“

πŸ‘‘ SEE ALSO πŸ‘‘

go read the Kernel file ./drivers/pinctrl/core.h and then, in no particular order, slay through these:

  • struct pinctrl(9)
  • struct pinctrl_state(9)
  • struct pinctrl_setting_mux(9)
  • struct pinctrl_setting_configs(9)
  • struct pinctrl_setting(9)
  • struct pin_desc(9)
  • struct pinctrl_maps(9)
  • struct group_desc(9)

and that's the whole page, bestie, you're officially pinctrl-pilled πŸ’€βœ¨

later, fairy 🧚 β€” this one came from ./drivers/pinctrl, dated October 2026, and it's titled struct pinctrl_dev(9) if you ever need to find it again πŸ’œ

πŸ“¦ where this page comes from