drivers/pinctrl/pinctrl-at91-pio4.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-at91-pio4.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-at91-pio4.c- Extension
.c- Size
- 36827 bytes
- Lines
- 1287
- 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
dt-bindings/pinctrl/at91.hlinux/clk.hlinux/gpio/driver.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/of.hlinux/platform_device.hlinux/seq_file.hlinux/slab.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hcore.hpinconf.hpinctrl-utils.h
Detected Declarations
struct atmel_pioctrl_datastruct atmel_groupstruct atmel_pinstruct atmel_pioctrlfunction atmel_gpio_readfunction atmel_gpio_writefunction atmel_gpio_irq_ackfunction atmel_gpio_irq_maskfunction atmel_gpio_irq_unmaskfunction atmel_gpio_irq_set_wakefunction atmel_gpio_to_irqfunction atmel_gpio_irq_handlerfunction atmel_gpio_direction_inputfunction atmel_gpio_getfunction atmel_gpio_get_multiplefunction atmel_gpio_direction_outputfunction atmel_gpio_setfunction atmel_gpio_set_multiplefunction atmel_pin_config_readfunction atmel_pin_config_writefunction atmel_pctl_get_groups_countfunction atmel_pctl_get_group_pinsfunction atmel_pctl_find_group_by_pinfunction atmel_pctl_xlate_pinfuncfunction atmel_pctl_dt_subnode_to_mapfunction atmel_pctl_dt_node_to_mapfunction for_each_child_of_node_scopedfunction atmel_pmx_get_functions_countfunction atmel_pmx_get_function_groupsfunction atmel_pmx_set_muxfunction atmel_conf_pin_config_group_getfunction atmel_conf_pin_config_group_setfunction atmel_conf_pin_config_setfunction atmel_conf_pin_config_getfunction atmel_conf_pin_config_dbg_showfunction atmel_pctrl_suspendfunction atmel_pctrl_resumefunction atmel_pinctrl_probe
Annotated Snippet
struct atmel_pioctrl_data {
unsigned int nbanks;
unsigned int last_bank_count;
unsigned int slew_rate_support;
};
struct atmel_group {
const char *name;
u32 pin;
};
struct atmel_pin {
unsigned int pin_id;
unsigned int mux;
unsigned int ioset;
unsigned int bank;
unsigned int line;
const char *device;
};
/**
* struct atmel_pioctrl - Atmel PIO controller (pinmux + gpio)
* @reg_base: base address of the controller.
* @clk: clock of the controller.
* @nbanks: number of PIO groups, it can vary depending on the SoC.
* @pinctrl_dev: pinctrl device registered.
* @groups: groups table to provide group name and pin in the group to pinctrl.
* @group_names: group names table to provide all the group/pin names to
* pinctrl or gpio.
* @pins: pins table used for both pinctrl and gpio. pin_id, bank and line
* fields are set at probe time. Other ones are set when parsing dt
* pinctrl.
* @npins: number of pins.
* @gpio_chip: gpio chip registered.
* @irq_domain: irq domain for the gpio controller.
* @irqs: table containing the hw irq number of the bank. The index of the
* table is the bank id.
* @pm_wakeup_sources: bitmap of wakeup sources (lines)
* @pm_suspend_backup: backup/restore register values on suspend/resume
* @dev: device entry for the Atmel PIO controller.
* @node: node of the Atmel PIO controller.
* @slew_rate_support: slew rate support
*/
struct atmel_pioctrl {
void __iomem *reg_base;
struct clk *clk;
unsigned int nbanks;
struct pinctrl_dev *pinctrl_dev;
struct atmel_group *groups;
const char * const *group_names;
struct atmel_pin **pins;
unsigned int npins;
struct gpio_chip *gpio_chip;
struct irq_domain *irq_domain;
int *irqs;
unsigned int *pm_wakeup_sources;
struct {
u32 imr;
u32 odsr;
u32 cfgr[ATMEL_PIO_NPINS_PER_BANK];
} *pm_suspend_backup;
struct device *dev;
struct device_node *node;
unsigned int slew_rate_support;
};
static const char * const atmel_functions[] = {
"GPIO", "A", "B", "C", "D", "E", "F", "G"
};
static const struct pinconf_generic_params atmel_custom_bindings[] = {
{"atmel,drive-strength", ATMEL_PIN_CONFIG_DRIVE_STRENGTH, 0},
};
/* --- GPIO --- */
static unsigned int atmel_gpio_read(struct atmel_pioctrl *atmel_pioctrl,
unsigned int bank, unsigned int reg)
{
return readl_relaxed(atmel_pioctrl->reg_base
+ ATMEL_PIO_BANK_OFFSET * bank + reg);
}
static void atmel_gpio_write(struct atmel_pioctrl *atmel_pioctrl,
unsigned int bank, unsigned int reg,
unsigned int val)
{
writel_relaxed(val, atmel_pioctrl->reg_base
+ ATMEL_PIO_BANK_OFFSET * bank + reg);
}
Annotation
- Immediate include surface: `dt-bindings/pinctrl/at91.h`, `linux/clk.h`, `linux/gpio/driver.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `struct atmel_pioctrl_data`, `struct atmel_group`, `struct atmel_pin`, `struct atmel_pioctrl`, `function atmel_gpio_read`, `function atmel_gpio_write`, `function atmel_gpio_irq_ack`, `function atmel_gpio_irq_mask`, `function atmel_gpio_irq_unmask`, `function atmel_gpio_irq_set_wake`.
- 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.