drivers/pinctrl/freescale/pinctrl-mxs.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/freescale/pinctrl-mxs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/freescale/pinctrl-mxs.c- Extension
.c- Size
- 13406 bytes
- Lines
- 567
- 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/err.hlinux/init.hlinux/io.hlinux/of.hlinux/of_address.hlinux/platform_device.hlinux/seq_file.hlinux/slab.hlinux/pinctrl/machine.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.h../core.hpinctrl-mxs.h
Detected Declarations
struct mxs_pinctrl_datafunction mxs_get_groups_countfunction mxs_get_group_pinsfunction mxs_pin_dbg_showfunction mxs_dt_node_to_mapfunction mxs_dt_free_mapfunction mxs_pinctrl_get_funcs_countfunction mxs_pinctrl_get_func_groupsfunction mxs_pinctrl_rmwlfunction mxs_pinctrl_set_muxfunction mxs_pinconf_getfunction mxs_pinconf_setfunction mxs_pinconf_group_getfunction mxs_pinconf_group_setfunction mxs_pinconf_dbg_showfunction mxs_pinctrl_parse_groupfunction is_mxs_gpiofunction mxs_pinctrl_probe_dtfunction mxs_pinctrl_probe
Annotated Snippet
struct mxs_pinctrl_data {
struct device *dev;
struct pinctrl_dev *pctl;
void __iomem *base;
struct mxs_pinctrl_soc_data *soc;
};
static int mxs_get_groups_count(struct pinctrl_dev *pctldev)
{
struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
return d->soc->ngroups;
}
static const char *mxs_get_group_name(struct pinctrl_dev *pctldev,
unsigned group)
{
struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
return d->soc->groups[group].name;
}
static int mxs_get_group_pins(struct pinctrl_dev *pctldev, unsigned group,
const unsigned **pins, unsigned *num_pins)
{
struct mxs_pinctrl_data *d = pinctrl_dev_get_drvdata(pctldev);
*pins = d->soc->groups[group].pins;
*num_pins = d->soc->groups[group].npins;
return 0;
}
static void mxs_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
unsigned offset)
{
seq_printf(s, " %s", dev_name(pctldev->dev));
}
static int mxs_dt_node_to_map(struct pinctrl_dev *pctldev,
struct device_node *np,
struct pinctrl_map **map, unsigned *num_maps)
{
struct pinctrl_map *new_map;
char *group = NULL;
unsigned new_num = 1;
unsigned long config = 0;
unsigned long *pconfig;
int length = strlen(np->name) + SUFFIX_LEN;
bool purecfg = false;
u32 val, reg;
int ret, i = 0;
/* Check for pin config node which has no 'reg' property */
if (of_property_read_u32(np, "reg", ®))
purecfg = true;
ret = of_property_read_u32(np, "fsl,drive-strength", &val);
if (!ret)
config = val | MA_PRESENT;
ret = of_property_read_u32(np, "fsl,voltage", &val);
if (!ret)
config |= val << VOL_SHIFT | VOL_PRESENT;
ret = of_property_read_u32(np, "fsl,pull-up", &val);
if (!ret)
config |= val << PULL_SHIFT | PULL_PRESENT;
/* Check for group node which has both mux and config settings */
if (!purecfg && config)
new_num = 2;
new_map = kzalloc_objs(*new_map, new_num);
if (!new_map)
return -ENOMEM;
if (!purecfg) {
new_map[i].type = PIN_MAP_TYPE_MUX_GROUP;
new_map[i].data.mux.function = np->name;
/* Compose group name */
group = kzalloc(length, GFP_KERNEL);
if (!group) {
ret = -ENOMEM;
goto free;
}
snprintf(group, length, "%s.%d", np->name, reg);
new_map[i].data.mux.group = group;
i++;
}
Annotation
- Immediate include surface: `linux/err.h`, `linux/init.h`, `linux/io.h`, `linux/of.h`, `linux/of_address.h`, `linux/platform_device.h`, `linux/seq_file.h`, `linux/slab.h`.
- Detected declarations: `struct mxs_pinctrl_data`, `function mxs_get_groups_count`, `function mxs_get_group_pins`, `function mxs_pin_dbg_show`, `function mxs_dt_node_to_map`, `function mxs_dt_free_map`, `function mxs_pinctrl_get_funcs_count`, `function mxs_pinctrl_get_func_groups`, `function mxs_pinctrl_rmwl`, `function mxs_pinctrl_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.