drivers/pinctrl/pinctrl-max7360.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-max7360.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-max7360.c- Extension
.c- Size
- 6419 bytes
- Lines
- 216
- 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/array_size.hlinux/dev_printk.hlinux/device.hlinux/device/devres.hlinux/err.hlinux/init.hlinux/mfd/max7360.hlinux/module.hlinux/platform_device.hlinux/regmap.hlinux/stddef.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinmux.hcore.hpinmux.h
Detected Declarations
struct max7360_pinctrlfunction max7360_pinctrl_get_groups_countfunction max7360_pinctrl_get_group_pinsfunction max7360_get_functions_countfunction max7360_get_function_groupsfunction max7360_set_muxfunction max7360_pinctrl_probe
Annotated Snippet
struct max7360_pinctrl {
struct pinctrl_dev *pctldev;
struct pinctrl_desc pinctrl_desc;
};
static const struct pinctrl_pin_desc max7360_pins[] = {
PINCTRL_PIN(0, "PORT0"),
PINCTRL_PIN(1, "PORT1"),
PINCTRL_PIN(2, "PORT2"),
PINCTRL_PIN(3, "PORT3"),
PINCTRL_PIN(4, "PORT4"),
PINCTRL_PIN(5, "PORT5"),
PINCTRL_PIN(6, "PORT6"),
PINCTRL_PIN(7, "PORT7"),
};
static const unsigned int port0_pins[] = {0};
static const unsigned int port1_pins[] = {1};
static const unsigned int port2_pins[] = {2};
static const unsigned int port3_pins[] = {3};
static const unsigned int port4_pins[] = {4};
static const unsigned int port5_pins[] = {5};
static const unsigned int port6_pins[] = {6};
static const unsigned int port7_pins[] = {7};
static const unsigned int rotary_pins[] = {6, 7};
static const struct pingroup max7360_groups[] = {
PINCTRL_PINGROUP("PORT0", port0_pins, ARRAY_SIZE(port0_pins)),
PINCTRL_PINGROUP("PORT1", port1_pins, ARRAY_SIZE(port1_pins)),
PINCTRL_PINGROUP("PORT2", port2_pins, ARRAY_SIZE(port2_pins)),
PINCTRL_PINGROUP("PORT3", port3_pins, ARRAY_SIZE(port3_pins)),
PINCTRL_PINGROUP("PORT4", port4_pins, ARRAY_SIZE(port4_pins)),
PINCTRL_PINGROUP("PORT5", port5_pins, ARRAY_SIZE(port5_pins)),
PINCTRL_PINGROUP("PORT6", port6_pins, ARRAY_SIZE(port6_pins)),
PINCTRL_PINGROUP("PORT7", port7_pins, ARRAY_SIZE(port7_pins)),
PINCTRL_PINGROUP("ROTARY", rotary_pins, ARRAY_SIZE(rotary_pins)),
};
static int max7360_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
{
return ARRAY_SIZE(max7360_groups);
}
static const char *max7360_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
unsigned int group)
{
return max7360_groups[group].name;
}
static int max7360_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
unsigned int group,
const unsigned int **pins,
unsigned int *num_pins)
{
*pins = max7360_groups[group].pins;
*num_pins = max7360_groups[group].npins;
return 0;
}
static const struct pinctrl_ops max7360_pinctrl_ops = {
.get_groups_count = max7360_pinctrl_get_groups_count,
.get_group_name = max7360_pinctrl_get_group_name,
.get_group_pins = max7360_pinctrl_get_group_pins,
#ifdef CONFIG_OF
.dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
.dt_free_map = pinconf_generic_dt_free_map,
#endif
};
static const char * const simple_groups[] = {
"PORT0", "PORT1", "PORT2", "PORT3",
"PORT4", "PORT5", "PORT6", "PORT7",
};
static const char * const rotary_groups[] = { "ROTARY" };
#define MAX7360_PINCTRL_FN_GPIO 0
#define MAX7360_PINCTRL_FN_PWM 1
#define MAX7360_PINCTRL_FN_ROTARY 2
static const struct pinfunction max7360_functions[] = {
[MAX7360_PINCTRL_FN_GPIO] = PINCTRL_PINFUNCTION("gpio", simple_groups,
ARRAY_SIZE(simple_groups)),
[MAX7360_PINCTRL_FN_PWM] = PINCTRL_PINFUNCTION("pwm", simple_groups,
ARRAY_SIZE(simple_groups)),
[MAX7360_PINCTRL_FN_ROTARY] = PINCTRL_PINFUNCTION("rotary", rotary_groups,
ARRAY_SIZE(rotary_groups)),
};
static int max7360_get_functions_count(struct pinctrl_dev *pctldev)
{
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/dev_printk.h`, `linux/device.h`, `linux/device/devres.h`, `linux/err.h`, `linux/init.h`, `linux/mfd/max7360.h`, `linux/module.h`.
- Detected declarations: `struct max7360_pinctrl`, `function max7360_pinctrl_get_groups_count`, `function max7360_pinctrl_get_group_pins`, `function max7360_get_functions_count`, `function max7360_get_function_groups`, `function max7360_set_mux`, `function max7360_pinctrl_probe`.
- 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.