drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/aspeed/pinctrl-aspeed-g5.c- Extension
.c- Size
- 103327 bytes
- Lines
- 2891
- 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/bitops.hlinux/init.hlinux/io.hlinux/kernel.hlinux/mfd/syscon.hlinux/mod_devicetable.hlinux/of.hlinux/platform_device.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinconf-generic.hlinux/types.h../core.h../pinctrl-utils.hpinctrl-aspeed.h
Detected Declarations
function aspeed_g5_sig_expr_evalfunction aspeed_g5_sig_expr_setfunction aspeed_g5_pinctrl_probefunction aspeed_g5_pinctrl_init
Annotated Snippet
if (node) {
map = syscon_node_to_regmap(node);
of_node_put(node);
if (IS_ERR(map))
return map;
} else
return ERR_PTR(-ENODEV);
ctx->maps[ASPEED_IP_GFX] = map;
dev_dbg(ctx->dev, "Acquired GFX regmap");
return map;
}
if (ip == ASPEED_IP_LPC) {
struct device_node *np;
struct regmap *map;
np = of_parse_phandle(ctx->dev->of_node,
"aspeed,external-nodes", 1);
if (np) {
if (!of_device_is_compatible(np->parent, "aspeed,ast2500-lpc-v2"))
return ERR_PTR(-ENODEV);
map = syscon_node_to_regmap(np->parent);
of_node_put(np);
if (IS_ERR(map))
return map;
} else
return ERR_PTR(-ENODEV);
ctx->maps[ASPEED_IP_LPC] = map;
dev_dbg(ctx->dev, "Acquired LPC regmap");
return map;
}
return ERR_PTR(-EINVAL);
}
static int aspeed_g5_sig_expr_eval(struct aspeed_pinmux_data *ctx,
const struct aspeed_sig_expr *expr,
bool enabled)
{
int ret;
int i;
for (i = 0; i < expr->ndescs; i++) {
const struct aspeed_sig_desc *desc = &expr->descs[i];
struct regmap *map;
map = aspeed_g5_acquire_regmap(ctx, desc->ip);
if (IS_ERR(map)) {
dev_err(ctx->dev,
"Failed to acquire regmap for IP block %d\n",
desc->ip);
return PTR_ERR(map);
}
ret = aspeed_sig_desc_eval(desc, enabled, ctx->maps[desc->ip]);
if (ret <= 0)
return ret;
}
return 1;
}
/**
* aspeed_g5_sig_expr_set() - Configure a pin's signal by applying an
* expression's descriptor state for all descriptors in the expression.
*
* @ctx: The pinmux context
* @expr: The expression associated with the function whose signal is to be
* configured
* @enable: true to enable an function's signal through a pin's signal
* expression, false to disable the function's signal
*
* Return: 0 if the expression is configured as requested and a negative error
* code otherwise
*/
static int aspeed_g5_sig_expr_set(struct aspeed_pinmux_data *ctx,
const struct aspeed_sig_expr *expr,
bool enable)
{
int ret;
int i;
for (i = 0; i < expr->ndescs; i++) {
const struct aspeed_sig_desc *desc = &expr->descs[i];
u32 pattern = enable ? desc->enable : desc->disable;
u32 val = (pattern << __ffs(desc->mask));
struct regmap *map;
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/init.h`, `linux/io.h`, `linux/kernel.h`, `linux/mfd/syscon.h`, `linux/mod_devicetable.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `function aspeed_g5_sig_expr_eval`, `function aspeed_g5_sig_expr_set`, `function aspeed_g5_pinctrl_probe`, `function aspeed_g5_pinctrl_init`.
- 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.