drivers/pinctrl/pinctrl-at91.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-at91.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-at91.c- Extension
.c- Size
- 53313 bytes
- Lines
- 1938
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/clk.hlinux/err.hlinux/gpio/driver.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/of.hlinux/platform_device.hlinux/pm.hlinux/property.hlinux/seq_file.hlinux/slab.hlinux/string_helpers.hlinux/pinctrl/consumer.hlinux/pinctrl/machine.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hpinctrl-at91.hcore.h
Detected Declarations
struct at91_pinctrl_mux_opsstruct at91_gpio_chipstruct at91_pmx_funcstruct at91_pmx_pinstruct at91_pin_groupstruct at91_pinctrl_mux_opsstruct at91_pinctrlenum drive_strength_bitenum slewrate_bitenum at91_muxfunction at91_get_groups_countfunction at91_get_group_pinsfunction at91_pin_dbg_showfunction at91_dt_node_to_mapfunction at91_dt_free_mapfunction pin_to_bankfunction pin_to_maskfunction two_bit_pin_value_shift_amountfunction sama5d3_get_drive_registerfunction at91sam9x5_get_drive_registerfunction at91_mux_disable_interruptfunction at91_mux_get_pullupfunction at91_mux_set_pullupfunction at91_mux_get_outputfunction at91_mux_set_outputfunction at91_mux_get_multidrivefunction at91_mux_set_multidrivefunction at91_mux_set_A_periphfunction at91_mux_set_B_periphfunction at91_mux_pio3_set_A_periphfunction at91_mux_pio3_set_B_periphfunction at91_mux_pio3_set_C_periphfunction at91_mux_pio3_set_D_periphfunction at91_mux_pio3_get_periphfunction at91_mux_get_periphfunction at91_mux_get_deglitchfunction at91_mux_set_deglitchfunction at91_mux_pio3_get_deglitchfunction at91_mux_pio3_set_deglitchfunction at91_mux_pio3_get_debouncefunction at91_mux_pio3_set_debouncefunction at91_mux_pio3_get_pulldownfunction at91_mux_pio3_set_pulldownfunction at91_mux_pio3_disable_schmitt_trigfunction at91_mux_pio3_get_schmitt_trigfunction read_drive_strengthfunction at91_mux_sama5d3_get_drivestrengthfunction at91_mux_sam9x5_get_drivestrength
Annotated Snippet
struct at91_gpio_chip {
struct gpio_chip chip;
struct pinctrl_gpio_range range;
struct at91_gpio_chip *next;
int pioc_hwirq;
int pioc_virq;
void __iomem *regbase;
struct clk *clock;
const struct at91_pinctrl_mux_ops *ops;
u32 wakeups;
u32 backups;
u32 id;
};
static struct at91_gpio_chip *gpio_chips[MAX_GPIO_BANKS];
static int gpio_banks;
#define PULL_UP (1 << 0)
#define MULTI_DRIVE (1 << 1)
#define DEGLITCH (1 << 2)
#define PULL_DOWN (1 << 3)
#define DIS_SCHMIT (1 << 4)
#define DRIVE_STRENGTH_SHIFT 5
#define DRIVE_STRENGTH_MASK 0x3
#define DRIVE_STRENGTH (DRIVE_STRENGTH_MASK << DRIVE_STRENGTH_SHIFT)
#define OUTPUT (1 << 7)
#define OUTPUT_VAL_SHIFT 8
#define OUTPUT_VAL (0x1 << OUTPUT_VAL_SHIFT)
#define SLEWRATE_SHIFT 9
#define SLEWRATE_MASK 0x1
#define SLEWRATE (SLEWRATE_MASK << SLEWRATE_SHIFT)
#define DEBOUNCE (1 << 16)
#define DEBOUNCE_VAL_SHIFT 17
#define DEBOUNCE_VAL (0x3fff << DEBOUNCE_VAL_SHIFT)
/*
* These defines will translated the dt binding settings to our internal
* settings. They are not necessarily the same value as the register setting.
* The actual drive strength current of low, medium and high must be looked up
* from the corresponding device datasheet. This value is different for pins
* that are even in the same banks. It is also dependent on VCC.
* DRIVE_STRENGTH_DEFAULT is just a placeholder to avoid changing the drive
* strength when there is no dt config for it.
*/
enum drive_strength_bit {
DRIVE_STRENGTH_BIT_DEF,
DRIVE_STRENGTH_BIT_LOW,
DRIVE_STRENGTH_BIT_MED,
DRIVE_STRENGTH_BIT_HI,
};
#define DRIVE_STRENGTH_BIT_MSK(name) (DRIVE_STRENGTH_BIT_##name << \
DRIVE_STRENGTH_SHIFT)
enum slewrate_bit {
SLEWRATE_BIT_ENA,
SLEWRATE_BIT_DIS,
};
#define SLEWRATE_BIT_MSK(name) (SLEWRATE_BIT_##name << SLEWRATE_SHIFT)
/**
* struct at91_pmx_func - describes AT91 pinmux functions
* @name: the name of this specific function
* @groups: corresponding pin groups
* @ngroups: the number of groups
*/
struct at91_pmx_func {
const char *name;
const char **groups;
unsigned ngroups;
};
enum at91_mux {
AT91_MUX_GPIO = 0,
AT91_MUX_PERIPH_A = 1,
AT91_MUX_PERIPH_B = 2,
AT91_MUX_PERIPH_C = 3,
AT91_MUX_PERIPH_D = 4,
};
/**
* struct at91_pmx_pin - describes an At91 pin mux
* @bank: the bank of the pin
* @pin: the pin number in the @bank
* @mux: the mux mode : gpio or periph_x of the pin i.e. alternate function.
* @conf: the configuration of the pin: PULL_UP, MULTIDRIVE etc...
*/
struct at91_pmx_pin {
Annotation
- Immediate include surface: `linux/clk.h`, `linux/err.h`, `linux/gpio/driver.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/of.h`, `linux/platform_device.h`.
- Detected declarations: `struct at91_pinctrl_mux_ops`, `struct at91_gpio_chip`, `struct at91_pmx_func`, `struct at91_pmx_pin`, `struct at91_pin_group`, `struct at91_pinctrl_mux_ops`, `struct at91_pinctrl`, `enum drive_strength_bit`, `enum slewrate_bit`, `enum at91_mux`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.