drivers/pinctrl/cix/pinctrl-sky1-base.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/cix/pinctrl-sky1-base.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/cix/pinctrl-sky1-base.c- Extension
.c- Size
- 14674 bytes
- Lines
- 588
- 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.
- 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/device.hlinux/err.hlinux/init.hlinux/io.hlinux/module.hlinux/of.hlinux/of_device.hlinux/of_address.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hlinux/platform_device.hlinux/seq_file.hlinux/slab.h../core.h../pinconf.h../pinctrl-utils.h../pinmux.hpinctrl-sky1.h
Detected Declarations
function sky1_pctrl_is_function_validfunction sky1_pctrl_dt_node_to_map_funcfunction sky1_pctrl_find_group_by_pinfunction sky1_pctrl_dt_subnode_to_mapfunction sky1_pctrl_dt_node_to_mapfunction for_each_child_of_node_scopedfunction sky1_dt_free_mapfunction sky1_pctrl_get_groups_countfunction sky1_pctrl_get_group_pinsfunction sky1_pin_dbg_showfunction sky1_pmx_set_one_pinfunction sky1_pmx_set_muxfunction sky1_pmx_get_funcs_cntfunction sky1_pmx_get_func_groupsfunction sky1_pconf_set_pull_selectfunction sky1_ds_to_indexfunction sky1_pconf_set_drivingfunction sky1_pconf_parse_conffunction sky1_pconf_group_getfunction sky1_pconf_group_setfunction sky1_pctrl_build_statefunction sky1_base_pinctrl_probeexport sky1_base_pinctrl_probe
Annotated Snippet
if (pin->pin.number == pin_num) {
if (fnum < pin->nfunc)
return true;
break;
}
}
return false;
}
static int sky1_pctrl_dt_node_to_map_func(struct sky1_pinctrl *spctl,
u32 pin, u32 fnum, struct sky1_pinctrl_group *grp,
struct pinctrl_map **map, unsigned int *reserved_maps,
unsigned int *num_maps)
{
bool ret;
if (*num_maps == *reserved_maps)
return -ENOSPC;
(*map)[*num_maps].type = PIN_MAP_TYPE_MUX_GROUP;
(*map)[*num_maps].data.mux.group = grp->name;
ret = sky1_pctrl_is_function_valid(spctl, pin, fnum);
if (!ret) {
dev_err(spctl->dev, "invalid function %d on pin %d .\n",
fnum, pin);
return -EINVAL;
}
(*map)[*num_maps].data.mux.function = sky1_gpio_functions[fnum];
(*num_maps)++;
return 0;
}
static struct sky1_pinctrl_group *
sky1_pctrl_find_group_by_pin(struct sky1_pinctrl *spctl, u32 pin)
{
int i;
for (i = 0; i < spctl->info->npins; i++) {
struct sky1_pinctrl_group *grp =
(struct sky1_pinctrl_group *)spctl->groups + i;
if (grp->pin == pin)
return grp;
}
return NULL;
}
static int sky1_pctrl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
struct device_node *node,
struct pinctrl_map **map,
unsigned int *reserved_maps,
unsigned int *num_maps)
{
struct property *pins;
u32 pinfunc, pin, func;
int num_pins, num_funcs, maps_per_pin;
unsigned long *configs;
unsigned int num_configs;
bool has_config = false;
int i, err;
unsigned int reserve = 0;
struct sky1_pinctrl_group *grp;
struct sky1_pinctrl *spctl = pinctrl_dev_get_drvdata(pctldev);
pins = of_find_property(node, "pinmux", NULL);
if (!pins) {
dev_err(spctl->dev, "missing pins property in node %pOFn .\n",
node);
return -EINVAL;
}
err = pinconf_generic_parse_dt_config(node, pctldev, &configs,
&num_configs);
if (err)
return err;
if (num_configs)
has_config = true;
num_pins = pins->length / sizeof(u32);
num_funcs = num_pins;
maps_per_pin = 0;
if (num_funcs)
maps_per_pin++;
Annotation
- Immediate include surface: `linux/device.h`, `linux/err.h`, `linux/init.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/of_device.h`, `linux/of_address.h`.
- Detected declarations: `function sky1_pctrl_is_function_valid`, `function sky1_pctrl_dt_node_to_map_func`, `function sky1_pctrl_find_group_by_pin`, `function sky1_pctrl_dt_subnode_to_map`, `function sky1_pctrl_dt_node_to_map`, `function for_each_child_of_node_scoped`, `function sky1_dt_free_map`, `function sky1_pctrl_get_groups_count`, `function sky1_pctrl_get_group_pins`, `function sky1_pin_dbg_show`.
- 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.