drivers/pinctrl/pinctrl-pef2256.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-pef2256.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-pef2256.c- Extension
.c- Size
- 14609 bytes
- Lines
- 359
- 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
linux/bitfield.hlinux/framer/pef2256.hlinux/module.hlinux/of.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinmux.hlinux/platform_device.hlinux/regmap.hlinux/slab.h
Detected Declarations
struct pef2256_pinreg_descstruct pef2256_function_descstruct pef2256_pinctrlfunction pef2256_get_groups_countfunction pef2256_get_group_pinsfunction pef2256_get_functions_countfunction pef2256_get_function_groupsfunction pef2256_set_muxfunction pef2256_register_pinctrlfunction pef2256_reset_pinmuxfunction pef2256_pinctrl_probe
Annotated Snippet
struct pef2256_pinreg_desc {
int offset;
u8 mask;
};
struct pef2256_function_desc {
const char *name;
const char * const*groups;
unsigned int ngroups;
u8 func_val;
};
struct pef2256_pinctrl {
struct device *dev;
struct regmap *regmap;
enum pef2256_version version;
struct pinctrl_desc pctrl_desc;
const struct pef2256_function_desc *functions;
unsigned int nfunctions;
};
static int pef2256_get_groups_count(struct pinctrl_dev *pctldev)
{
struct pef2256_pinctrl *pef2256 = pinctrl_dev_get_drvdata(pctldev);
/* We map 1 group <-> 1 pin */
return pef2256->pctrl_desc.npins;
}
static const char *pef2256_get_group_name(struct pinctrl_dev *pctldev,
unsigned int selector)
{
struct pef2256_pinctrl *pef2256 = pinctrl_dev_get_drvdata(pctldev);
/* We map 1 group <-> 1 pin */
return pef2256->pctrl_desc.pins[selector].name;
}
static int pef2256_get_group_pins(struct pinctrl_dev *pctldev, unsigned int selector,
const unsigned int **pins,
unsigned int *num_pins)
{
struct pef2256_pinctrl *pef2256 = pinctrl_dev_get_drvdata(pctldev);
/* We map 1 group <-> 1 pin */
*pins = &pef2256->pctrl_desc.pins[selector].number;
*num_pins = 1;
return 0;
}
static const struct pinctrl_ops pef2256_pctlops = {
.get_groups_count = pef2256_get_groups_count,
.get_group_name = pef2256_get_group_name,
.get_group_pins = pef2256_get_group_pins,
.dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
.dt_free_map = pinconf_generic_dt_free_map,
};
static int pef2256_get_functions_count(struct pinctrl_dev *pctldev)
{
struct pef2256_pinctrl *pef2256 = pinctrl_dev_get_drvdata(pctldev);
return pef2256->nfunctions;
}
static const char *pef2256_get_function_name(struct pinctrl_dev *pctldev,
unsigned int selector)
{
struct pef2256_pinctrl *pef2256 = pinctrl_dev_get_drvdata(pctldev);
return pef2256->functions[selector].name;
}
static int pef2256_get_function_groups(struct pinctrl_dev *pctldev, unsigned int selector,
const char * const **groups,
unsigned * const num_groups)
{
struct pef2256_pinctrl *pef2256 = pinctrl_dev_get_drvdata(pctldev);
*groups = pef2256->functions[selector].groups;
*num_groups = pef2256->functions[selector].ngroups;
return 0;
}
static int pef2256_set_mux(struct pinctrl_dev *pctldev, unsigned int func_selector,
unsigned int group_selector)
{
struct pef2256_pinctrl *pef2256 = pinctrl_dev_get_drvdata(pctldev);
const struct pef2256_pinreg_desc *pinreg_desc;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/framer/pef2256.h`, `linux/module.h`, `linux/of.h`, `linux/pinctrl/pinctrl.h`, `linux/pinctrl/pinconf-generic.h`, `linux/pinctrl/pinmux.h`, `linux/platform_device.h`.
- Detected declarations: `struct pef2256_pinreg_desc`, `struct pef2256_function_desc`, `struct pef2256_pinctrl`, `function pef2256_get_groups_count`, `function pef2256_get_group_pins`, `function pef2256_get_functions_count`, `function pef2256_get_function_groups`, `function pef2256_set_mux`, `function pef2256_register_pinctrl`, `function pef2256_reset_pinmux`.
- 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.