drivers/pinctrl/aspeed/pinctrl-aspeed.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/aspeed/pinctrl-aspeed.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/aspeed/pinctrl-aspeed.c- Extension
.c- Size
- 15978 bytes
- Lines
- 660
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mfd/syscon.hlinux/platform_device.hlinux/seq_file.hlinux/slab.hlinux/string.h../core.hpinctrl-aspeed.h
Detected Declarations
enum aspeed_pin_config_map_typefunction Copyrightfunction aspeed_pinctrl_get_group_pinsfunction aspeed_pinctrl_pin_dbg_showfunction aspeed_pinmux_get_fn_countfunction aspeed_pinmux_get_fn_groupsfunction aspeed_sig_expr_enablefunction aspeed_sig_expr_disablefunction aspeed_disable_sigfunction aspeed_pinmux_set_muxfunction aspeed_expr_is_gpiofunction aspeed_gpio_in_exprsfunction aspeed_gpio_request_enablefunction aspeed_pinctrl_probefunction pin_in_config_rangefunction aspeed_pin_config_getfunction aspeed_pin_config_setfunction aspeed_pin_config_group_getfunction aspeed_pin_config_group_set
Annotated Snippet
while ((expr = *funcs)) {
const char *str = get(expr);
size_t delta = strlen(str) + 2;
char *expanded;
expanded = krealloc(found, len + delta + 1, GFP_KERNEL);
if (!expanded) {
kfree(found);
return expanded;
}
found = expanded;
found[len] = '\0';
len += delta;
strcat(found, str);
strcat(found, ", ");
funcs++;
}
prios++;
}
if (len < 2) {
kfree(found);
return NULL;
}
found[len - 2] = '\0';
return found;
}
static const char *aspeed_sig_expr_function(const struct aspeed_sig_expr *expr)
{
return expr->function;
}
static char *get_defined_functions(const struct aspeed_pin_desc *pdesc)
{
return get_defined_attribute(pdesc, aspeed_sig_expr_function);
}
static const char *aspeed_sig_expr_signal(const struct aspeed_sig_expr *expr)
{
return expr->signal;
}
static char *get_defined_signals(const struct aspeed_pin_desc *pdesc)
{
return get_defined_attribute(pdesc, aspeed_sig_expr_signal);
}
int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function,
unsigned int group)
{
int i;
int ret;
struct aspeed_pinctrl_data *pdata = pinctrl_dev_get_drvdata(pctldev);
const struct aspeed_pin_group *pgroup = &pdata->pinmux.groups[group];
const struct aspeed_pin_function *pfunc =
&pdata->pinmux.functions[function];
for (i = 0; i < pgroup->npins; i++) {
int pin = pgroup->pins[i];
const struct aspeed_pin_desc *pdesc = pdata->pins[pin].drv_data;
const struct aspeed_sig_expr *expr = NULL;
const struct aspeed_sig_expr **funcs;
const struct aspeed_sig_expr ***prios;
if (!pdesc)
return -EINVAL;
pr_debug("Muxing pin %s for %s\n", pdesc->name, pfunc->name);
prios = pdesc->prios;
if (!prios)
continue;
/* Disable functions at a higher priority than that requested */
while ((funcs = *prios)) {
expr = aspeed_find_expr_by_name(funcs, pfunc->name);
if (expr)
break;
ret = aspeed_disable_sig(&pdata->pinmux, funcs);
if (ret)
return ret;
Annotation
- Immediate include surface: `linux/mfd/syscon.h`, `linux/platform_device.h`, `linux/seq_file.h`, `linux/slab.h`, `linux/string.h`, `../core.h`, `pinctrl-aspeed.h`.
- Detected declarations: `enum aspeed_pin_config_map_type`, `function Copyright`, `function aspeed_pinctrl_get_group_pins`, `function aspeed_pinctrl_pin_dbg_show`, `function aspeed_pinmux_get_fn_count`, `function aspeed_pinmux_get_fn_groups`, `function aspeed_sig_expr_enable`, `function aspeed_sig_expr_disable`, `function aspeed_disable_sig`, `function aspeed_pinmux_set_mux`.
- 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.