drivers/pinctrl/pinconf-generic.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinconf-generic.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinconf-generic.c- Extension
.c- Size
- 16959 bytes
- Lines
- 556
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/array_size.hlinux/debugfs.hlinux/device.hlinux/init.hlinux/module.hlinux/of.hlinux/property.hlinux/slab.hlinux/seq_file.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hcore.hpinconf.hpinctrl-utils.h
Detected Declarations
function pinconf_generic_dump_onefunction pinfunction pinconf_generic_dump_configfunction parse_fw_cfgfunction pinconf_generic_parse_dt_pinmuxfunction pinconf_generic_parse_dt_configfunction pinconf_generic_dt_subnode_to_mapfunction of_property_for_each_stringfunction pinconf_generic_dt_node_to_mapfunction for_each_available_child_of_node_scopedfunction pinconf_generic_dt_free_mapexport pinconf_generic_dump_configexport pinconf_generic_parse_dt_pinmuxexport pinconf_generic_parse_dt_configexport pinconf_generic_dt_subnode_to_mapexport pinconf_generic_dt_node_to_mapexport pinconf_generic_dt_free_map
Annotated Snippet
if (ret) {
seq_printf(s, "ERROR READING CONFIG SETTING %d ", i);
continue;
}
/* comma between multiple configs */
if (*print_sep)
seq_puts(s, ", ");
*print_sep = 1;
seq_puts(s, item->display);
/* Print unit if available */
if (item->has_arg) {
u32 val = pinconf_to_config_argument(config);
if (item->format)
seq_printf(s, " (%u %s)", val, item->format);
else
seq_printf(s, " (0x%x)", val);
if (item->values && item->num_values) {
if (val < item->num_values)
seq_printf(s, " \"%s\"", item->values[val]);
else
seq_puts(s, " \"(unknown)\"");
}
}
}
}
/**
* pinconf_generic_dump_pins - Print information about pin or group of pins
* @pctldev: Pincontrol device
* @s: File to print to
* @gname: Group name specifying pins
* @pin: Pin number specifying pin
*
* Print the pinconf configuration for the requested pin(s) to @s. Pins can be
* specified either by pin using @pin or by group using @gname. Only one needs
* to be specified the other can be NULL/0.
*/
void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev, struct seq_file *s,
const char *gname, unsigned int pin)
{
const struct pinconf_ops *ops = pctldev->desc->confops;
int print_sep = 0;
if (!ops->is_generic)
return;
/* generic parameters */
pinconf_generic_dump_one(pctldev, s, gname, pin, conf_items,
ARRAY_SIZE(conf_items), &print_sep);
/* driver-specific parameters */
if (pctldev->desc->num_custom_params &&
pctldev->desc->custom_conf_items)
pinconf_generic_dump_one(pctldev, s, gname, pin,
pctldev->desc->custom_conf_items,
pctldev->desc->num_custom_params,
&print_sep);
}
void pinconf_generic_dump_config(struct pinctrl_dev *pctldev,
struct seq_file *s, unsigned long config)
{
int i;
for (i = 0; i < ARRAY_SIZE(conf_items); i++) {
if (pinconf_to_config_param(config) != conf_items[i].param)
continue;
seq_printf(s, "%s: 0x%x", conf_items[i].display,
pinconf_to_config_argument(config));
}
if (!pctldev->desc->num_custom_params ||
!pctldev->desc->custom_conf_items)
return;
for (i = 0; i < pctldev->desc->num_custom_params; i++) {
if (pinconf_to_config_param(config) !=
pctldev->desc->custom_conf_items[i].param)
continue;
seq_printf(s, "%s: 0x%x",
pctldev->desc->custom_conf_items[i].display,
pinconf_to_config_argument(config));
}
}
EXPORT_SYMBOL_GPL(pinconf_generic_dump_config);
#endif
#ifdef CONFIG_OF
static const struct pinconf_generic_params dt_params[] = {
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/debugfs.h`, `linux/device.h`, `linux/init.h`, `linux/module.h`, `linux/of.h`, `linux/property.h`, `linux/slab.h`.
- Detected declarations: `function pinconf_generic_dump_one`, `function pin`, `function pinconf_generic_dump_config`, `function parse_fw_cfg`, `function pinconf_generic_parse_dt_pinmux`, `function pinconf_generic_parse_dt_config`, `function pinconf_generic_dt_subnode_to_map`, `function of_property_for_each_string`, `function pinconf_generic_dt_node_to_map`, `function for_each_available_child_of_node_scoped`.
- 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.