drivers/pinctrl/pinctrl-generic.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-generic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-generic.c- Extension
.c- Size
- 8061 bytes
- Lines
- 283
- Domain
- Driver Families
- Bucket
- drivers/pinctrl
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/array_size.hlinux/device.hlinux/module.hlinux/of.hlinux/slab.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hcore.hpinconf.hpinctrl-utils.hpinmux.h
Detected Declarations
function pinctrl_generic_to_mapfunction pinctrl_generic_pins_function_dt_subnode_to_mapfunction pinctrl_generic_pinmux_dt_subnode_to_mapfunction pinctrl_generic_dt_node_to_mapfunction pinconf_generic_dt_node_to_mapfunction pinconf_generic_dt_node_to_mapexport pinctrl_generic_to_mapexport pinctrl_generic_pins_function_dt_node_to_mapexport pinctrl_generic_pinmux_dt_node_to_map
Annotated Snippet
if (ret) {
pinctrl_utils_free_map(pctldev, *maps, *num_maps);
return dev_err_probe(dev, ret, "error figuring out mappings for %s\n",
np->name);
}
ngroups++;
}
ret = pinmux_generic_add_function(pctldev, np->name, group_names, ngroups, NULL);
if (ret < 0) {
pinctrl_utils_free_map(pctldev, *maps, *num_maps);
return dev_err_probe(dev, ret, "error adding function %s\n", np->name);
}
return 0;
}
/*
* For platforms that do not define groups or functions in the driver, but
* instead use the devicetree to describe them. This function will, unlike
* pinconf_generic_dt_node_to_map() etc which rely on driver defined groups
* and functions, create them in addition to parsing pinconf properties and
* adding mappings.
*/
int pinctrl_generic_pins_function_dt_node_to_map(struct pinctrl_dev *pctldev,
struct device_node *np,
struct pinctrl_map **maps,
unsigned int *num_maps)
{
return pinctrl_generic_dt_node_to_map(pctldev, np, maps, num_maps,
&pinctrl_generic_pins_function_dt_subnode_to_map);
}
EXPORT_SYMBOL_GPL(pinctrl_generic_pins_function_dt_node_to_map);
/*
* For platforms that do not define groups or functions in the driver, but
* instead use the devicetree to describe them. This function will, unlike
* pinconf_generic_dt_node_to_map() etc which rely on driver defined groups
* and functions, create them in addition to parsing pinconf properties and
* adding mappings.
*
* It assumes that the upper 16 bits of the pinmux items contain the pin
* and the lower 16 the mux setting.
*/
int pinctrl_generic_pinmux_dt_node_to_map(struct pinctrl_dev *pctldev,
struct device_node *np,
struct pinctrl_map **maps,
unsigned int *num_maps)
{
return pinctrl_generic_dt_node_to_map(pctldev, np, maps, num_maps,
&pinctrl_generic_pinmux_dt_subnode_to_map);
};
EXPORT_SYMBOL_GPL(pinctrl_generic_pinmux_dt_node_to_map);
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/device.h`, `linux/module.h`, `linux/of.h`, `linux/slab.h`, `linux/pinctrl/pinconf-generic.h`, `linux/pinctrl/pinconf.h`, `linux/pinctrl/pinctrl.h`.
- Detected declarations: `function pinctrl_generic_to_map`, `function pinctrl_generic_pins_function_dt_subnode_to_map`, `function pinctrl_generic_pinmux_dt_subnode_to_map`, `function pinctrl_generic_dt_node_to_map`, `function pinconf_generic_dt_node_to_map`, `function pinconf_generic_dt_node_to_map`, `export pinctrl_generic_to_map`, `export pinctrl_generic_pins_function_dt_node_to_map`, `export pinctrl_generic_pinmux_dt_node_to_map`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.