drivers/pinctrl/mediatek/pinctrl-mtmips.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/mediatek/pinctrl-mtmips.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/mediatek/pinctrl-mtmips.c- Extension
.c- Size
- 8460 bytes
- Lines
- 352
- 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/module.hlinux/device.hlinux/io.hlinux/platform_device.hlinux/slab.hlinux/of.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinmux.hlinux/pinctrl/consumer.hlinux/pinctrl/machine.hasm/mach-ralink/ralink_regs.hasm/mach-ralink/mt7620.hpinctrl-mtmips.h../core.h../pinctrl-utils.h
Detected Declarations
struct mtmips_privfunction mtmips_get_group_countfunction mtmips_get_group_pinsfunction mtmips_pmx_func_countfunction mtmips_pmx_group_get_groupsfunction mtmips_pmx_group_enablefunction mtmips_pmx_group_gpio_request_enablefunction mtmips_pinctrl_indexfunction mtmips_pinctrl_pinsfunction mtmips_pinctrl_init
Annotated Snippet
struct mtmips_priv {
struct device *dev;
struct pinctrl_pin_desc *pads;
struct pinctrl_desc *desc;
struct mtmips_pmx_func **func;
int func_count;
struct mtmips_pmx_group *groups;
const char **group_names;
int group_count;
u8 *gpio;
int max_pins;
};
static int mtmips_get_group_count(struct pinctrl_dev *pctrldev)
{
struct mtmips_priv *p = pinctrl_dev_get_drvdata(pctrldev);
return p->group_count;
}
static const char *mtmips_get_group_name(struct pinctrl_dev *pctrldev,
unsigned int group)
{
struct mtmips_priv *p = pinctrl_dev_get_drvdata(pctrldev);
return (group >= p->group_count) ? NULL : p->group_names[group];
}
static int mtmips_get_group_pins(struct pinctrl_dev *pctrldev,
unsigned int group,
const unsigned int **pins,
unsigned int *num_pins)
{
struct mtmips_priv *p = pinctrl_dev_get_drvdata(pctrldev);
if (group >= p->group_count)
return -EINVAL;
*pins = p->groups[group].func[0].pins;
*num_pins = p->groups[group].func[0].pin_count;
return 0;
}
static const struct pinctrl_ops mtmips_pctrl_ops = {
.get_groups_count = mtmips_get_group_count,
.get_group_name = mtmips_get_group_name,
.get_group_pins = mtmips_get_group_pins,
.dt_node_to_map = pinconf_generic_dt_node_to_map_all,
.dt_free_map = pinconf_generic_dt_free_map,
};
static int mtmips_pmx_func_count(struct pinctrl_dev *pctrldev)
{
struct mtmips_priv *p = pinctrl_dev_get_drvdata(pctrldev);
return p->func_count;
}
static const char *mtmips_pmx_func_name(struct pinctrl_dev *pctrldev,
unsigned int func)
{
struct mtmips_priv *p = pinctrl_dev_get_drvdata(pctrldev);
return p->func[func]->name;
}
static int mtmips_pmx_group_get_groups(struct pinctrl_dev *pctrldev,
unsigned int func,
const char * const **groups,
unsigned int * const num_groups)
{
struct mtmips_priv *p = pinctrl_dev_get_drvdata(pctrldev);
if (p->func[func]->group_count == 1)
*groups = &p->group_names[p->func[func]->groups[0]];
else
*groups = p->group_names;
*num_groups = p->func[func]->group_count;
return 0;
}
static int mtmips_pmx_group_enable(struct pinctrl_dev *pctrldev,
unsigned int func, unsigned int group)
Annotation
- Immediate include surface: `linux/module.h`, `linux/device.h`, `linux/io.h`, `linux/platform_device.h`, `linux/slab.h`, `linux/of.h`, `linux/pinctrl/pinctrl.h`, `linux/pinctrl/pinconf.h`.
- Detected declarations: `struct mtmips_priv`, `function mtmips_get_group_count`, `function mtmips_get_group_pins`, `function mtmips_pmx_func_count`, `function mtmips_pmx_group_get_groups`, `function mtmips_pmx_group_enable`, `function mtmips_pmx_group_gpio_request_enable`, `function mtmips_pinctrl_index`, `function mtmips_pinctrl_pins`, `function mtmips_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.