drivers/pinctrl/pinctrl-zynqmp.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-zynqmp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-zynqmp.c- Extension
.c- Size
- 25577 bytes
- Lines
- 1011
- Domain
- Driver Families
- Bucket
- drivers/pinctrl
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
dt-bindings/pinctrl/pinctrl-zynqmp.hlinux/bitfield.hlinux/bitmap.hlinux/init.hlinux/module.hlinux/of_address.hlinux/platform_device.hlinux/firmware/xlnx-zynqmp.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hcore.hpinctrl-utils.h
Detected Declarations
struct zynqmp_pmux_functionstruct zynqmp_pinctrlstruct zynqmp_pctrl_groupfunction zynqmp_pctrl_get_groups_countfunction zynqmp_pctrl_get_group_pinsfunction zynqmp_pinmux_request_pinfunction zynqmp_pmux_get_functions_countfunction zynqmp_pmux_get_function_groupsfunction zynqmp_pinmux_set_muxfunction zynqmp_pinmux_release_pinfunction zynqmp_pinconf_cfg_getfunction zynqmp_pinconf_cfg_setfunction zynqmp_pinconf_group_setfunction zynqmp_pinctrl_get_function_groupsfunction zynqmp_pinctrl_get_func_num_groupsfunction zynqmp_pinctrl_prepare_func_groupsfunction zynqmp_pinctrl_get_function_namefunction zynqmp_pinctrl_get_num_functionsfunction zynqmp_pinctrl_get_pin_groupsfunction zynqmp_pinctrl_group_add_pinfunction zynqmp_pinctrl_create_pin_groupsfunction zynqmp_pinctrl_prepare_group_pinsfunction zynqmp_pinctrl_prepare_function_infofunction zynqmp_pinctrl_get_num_pinsfunction zynqmp_pinctrl_prepare_pin_descfunction versal_pinctrl_get_attributesfunction versal_pinctrl_prepare_pin_descfunction zynqmp_pinctrl_probe
Annotated Snippet
struct zynqmp_pmux_function {
char name[MAX_FUNC_NAME_LEN];
const char * const *groups;
unsigned int ngroups;
};
/**
* struct zynqmp_pinctrl - driver data
* @pctrl: Pin control device
* @groups: Pin groups
* @ngroups: Number of @groups
* @funcs: Pin mux functions
* @nfuncs: Number of @funcs
*
* This struct is stored as driver data and used to retrieve
* information regarding pin control functions, groups and
* group pins.
*/
struct zynqmp_pinctrl {
struct pinctrl_dev *pctrl;
const struct zynqmp_pctrl_group *groups;
unsigned int ngroups;
const struct zynqmp_pmux_function *funcs;
unsigned int nfuncs;
};
/**
* struct zynqmp_pctrl_group - Pin control group info
* @name: Group name
* @pins: Group pin numbers
* @npins: Number of pins in the group
*/
struct zynqmp_pctrl_group {
const char *name;
unsigned int pins[MAX_GROUP_PIN];
unsigned int npins;
};
static struct pinctrl_desc zynqmp_desc;
static u32 family_code;
static int zynqmp_pctrl_get_groups_count(struct pinctrl_dev *pctldev)
{
struct zynqmp_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
return pctrl->ngroups + zynqmp_desc.npins;
}
static const char *zynqmp_pctrl_get_group_name(struct pinctrl_dev *pctldev,
unsigned int selector)
{
struct zynqmp_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
if (selector < pctrl->ngroups)
return pctrl->groups[selector].name;
return zynqmp_desc.pins[selector - pctrl->ngroups].name;
}
static int zynqmp_pctrl_get_group_pins(struct pinctrl_dev *pctldev,
unsigned int selector,
const unsigned int **pins,
unsigned int *npins)
{
struct zynqmp_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
if (selector < pctrl->ngroups) {
*pins = pctrl->groups[selector].pins;
*npins = pctrl->groups[selector].npins;
} else {
*pins = &zynqmp_desc.pins[selector - pctrl->ngroups].number;
*npins = 1;
}
return 0;
}
static const struct pinctrl_ops zynqmp_pctrl_ops = {
.get_groups_count = zynqmp_pctrl_get_groups_count,
.get_group_name = zynqmp_pctrl_get_group_name,
.get_group_pins = zynqmp_pctrl_get_group_pins,
.dt_node_to_map = pinconf_generic_dt_node_to_map_all,
.dt_free_map = pinctrl_utils_free_map,
};
static int zynqmp_pinmux_request_pin(struct pinctrl_dev *pctldev,
unsigned int pin)
{
int ret;
Annotation
- Immediate include surface: `dt-bindings/pinctrl/pinctrl-zynqmp.h`, `linux/bitfield.h`, `linux/bitmap.h`, `linux/init.h`, `linux/module.h`, `linux/of_address.h`, `linux/platform_device.h`, `linux/firmware/xlnx-zynqmp.h`.
- Detected declarations: `struct zynqmp_pmux_function`, `struct zynqmp_pinctrl`, `struct zynqmp_pctrl_group`, `function zynqmp_pctrl_get_groups_count`, `function zynqmp_pctrl_get_group_pins`, `function zynqmp_pinmux_request_pin`, `function zynqmp_pmux_get_functions_count`, `function zynqmp_pmux_get_function_groups`, `function zynqmp_pinmux_set_mux`, `function zynqmp_pinmux_release_pin`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: source 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.