drivers/pinctrl/pinctrl-ocelot.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-ocelot.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-ocelot.c- Extension
.c- Size
- 78848 bytes
- Lines
- 2523
- 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/gpio/driver.hlinux/interrupt.hlinux/io.hlinux/mfd/ocelot.hlinux/of.hlinux/platform_device.hlinux/regmap.hlinux/reset.hlinux/slab.hlinux/pinctrl/consumer.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hcore.hpinconf.hpinmux.h
Detected Declarations
struct ocelot_pmx_funcstruct ocelot_pin_capsstruct ocelot_pincfg_datastruct ocelot_pinctrlstruct ocelot_match_datastruct ocelot_irq_workfunction ocelot_get_functions_countfunction ocelot_get_function_groupsfunction ocelot_pin_function_idxfunction ocelot_pinmux_set_muxfunction lan966x_pinmux_set_muxfunction ocelot_gpio_set_directionfunction ocelot_gpio_request_enablefunction lan966x_gpio_request_enablefunction lan9645x_gpio_request_enablefunction ocelot_pctl_get_groups_countfunction ocelot_pctl_get_group_pinsfunction ocelot_hw_get_valuefunction ocelot_pincfg_clrsetbitsfunction ocelot_hw_set_valuefunction ocelot_pinconf_getfunction ocelot_pinconf_setfunction ocelot_create_group_func_mapfunction ocelot_pinctrl_registerfunction ocelot_gpio_getfunction ocelot_gpio_setfunction ocelot_gpio_get_directionfunction ocelot_gpio_direction_outputfunction ocelot_irq_maskfunction ocelot_irq_workfunction ocelot_irq_unmask_levelfunction ocelot_irq_unmaskfunction ocelot_irq_ackfunction ocelot_irq_set_typefunction ocelot_irq_handlerfunction ocelot_gpiochip_registerfunction ocelot_destroy_workqueuefunction ocelot_pinctrl_probe
Annotated Snippet
struct ocelot_pmx_func {
const char **groups;
unsigned int ngroups;
};
struct ocelot_pin_caps {
unsigned int pin;
unsigned char functions[OCELOT_FUNC_PER_PIN];
unsigned char a_functions[OCELOT_FUNC_PER_PIN]; /* Additional functions */
};
struct ocelot_pincfg_data {
u8 pd_bit;
u8 pu_bit;
u8 drive_bits;
u8 schmitt_bit;
};
struct ocelot_pinctrl {
struct device *dev;
struct pinctrl_dev *pctl;
struct gpio_chip gpio_chip;
struct regmap *map;
struct regmap *pincfg;
struct pinctrl_desc *desc;
const struct ocelot_pincfg_data *pincfg_data;
struct ocelot_pmx_func func[FUNC_MAX];
u8 stride;
u8 altm_stride;
struct workqueue_struct *wq;
};
struct ocelot_match_data {
struct pinctrl_desc desc;
struct ocelot_pincfg_data pincfg_data;
unsigned int n_alt_modes;
};
struct ocelot_irq_work {
struct work_struct irq_work;
struct irq_desc *irq_desc;
};
#define LUTON_P(p, f0, f1) \
static struct ocelot_pin_caps luton_pin_##p = { \
.pin = p, \
.functions = { \
FUNC_GPIO, FUNC_##f0, FUNC_##f1, FUNC_NONE, \
}, \
}
LUTON_P(0, SG0, NONE);
LUTON_P(1, SG0, NONE);
LUTON_P(2, SG0, NONE);
LUTON_P(3, SG0, NONE);
LUTON_P(4, TACHO, NONE);
LUTON_P(5, TWI, PHY_LED);
LUTON_P(6, TWI, PHY_LED);
LUTON_P(7, NONE, PHY_LED);
LUTON_P(8, EXT_IRQ, PHY_LED);
LUTON_P(9, EXT_IRQ, PHY_LED);
LUTON_P(10, SFP, PHY_LED);
LUTON_P(11, SFP, PHY_LED);
LUTON_P(12, SFP, PHY_LED);
LUTON_P(13, SFP, PHY_LED);
LUTON_P(14, SI, PHY_LED);
LUTON_P(15, SI, PHY_LED);
LUTON_P(16, SI, PHY_LED);
LUTON_P(17, SFP, PHY_LED);
LUTON_P(18, SFP, PHY_LED);
LUTON_P(19, SFP, PHY_LED);
LUTON_P(20, SFP, PHY_LED);
LUTON_P(21, SFP, PHY_LED);
LUTON_P(22, SFP, PHY_LED);
LUTON_P(23, SFP, PHY_LED);
LUTON_P(24, SFP, PHY_LED);
LUTON_P(25, SFP, PHY_LED);
LUTON_P(26, SFP, PHY_LED);
LUTON_P(27, SFP, PHY_LED);
LUTON_P(28, SFP, PHY_LED);
LUTON_P(29, PWM, NONE);
LUTON_P(30, UART, NONE);
LUTON_P(31, UART, NONE);
#define LUTON_PIN(n) { \
.number = n, \
.name = "GPIO_"#n, \
.drv_data = &luton_pin_##n \
}
Annotation
- Immediate include surface: `linux/gpio/driver.h`, `linux/interrupt.h`, `linux/io.h`, `linux/mfd/ocelot.h`, `linux/of.h`, `linux/platform_device.h`, `linux/regmap.h`, `linux/reset.h`.
- Detected declarations: `struct ocelot_pmx_func`, `struct ocelot_pin_caps`, `struct ocelot_pincfg_data`, `struct ocelot_pinctrl`, `struct ocelot_match_data`, `struct ocelot_irq_work`, `function ocelot_get_functions_count`, `function ocelot_get_function_groups`, `function ocelot_pin_function_idx`, `function ocelot_pinmux_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.