drivers/pinctrl/meson/pinctrl-amlogic-a4.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/meson/pinctrl-amlogic-a4.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/meson/pinctrl-amlogic-a4.c- Extension
.c- Size
- 31086 bytes
- Lines
- 1230
- 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/err.hlinux/gpio/driver.hlinux/init.hlinux/io.hlinux/module.hlinux/of.hlinux/of_address.hlinux/platform_device.hlinux/regmap.hlinux/seq_file.hlinux/slab.hlinux/string_helpers.hlinux/pinctrl/consumer.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.hdt-bindings/pinctrl/amlogic,pinctrl.h../core.h../pinctrl-utils.h../pinconf.h
Detected Declarations
struct aml_pio_controlstruct multi_muxstruct aml_pctl_datastruct aml_pmx_funcstruct aml_pctl_groupstruct aml_gpio_bankstruct aml_pinctrlenum aml_pinconf_drvfunction aml_pmx_calc_reg_and_offsetfunction aml_pctl_set_functionfunction aml_pmx_get_funcs_countfunction aml_pmx_get_groupsfunction aml_pmx_set_muxfunction aml_pmx_request_gpiofunction aml_calc_reg_and_bitfunction aml_pinconf_get_pullfunction aml_pinconf_get_drive_strengthfunction aml_pinconf_get_gpio_bitfunction aml_pinconf_get_outputfunction aml_pinconf_get_drivefunction aml_pinconf_getfunction aml_pinconf_disable_biasfunction aml_pinconf_enable_biasfunction aml_pinconf_set_drive_strengthfunction aml_pinconf_set_gpio_bitfunction aml_pinconf_set_outputfunction aml_pinconf_set_drivefunction aml_pinconf_set_output_drivefunction aml_pinconf_setfunction aml_pinconf_group_setfunction aml_pinconf_group_getfunction aml_get_groups_countfunction aml_get_group_pinsfunction aml_pin_dbg_showfunction aml_dt_node_to_map_pinmuxfunction aml_pctl_parse_functionsfunction aml_bank_pinsfunction aml_bank_numberfunction aml_count_pinsfunction for_each_child_of_nodefunction propertyfunction for_each_child_of_nodefunction aml_gpio_calc_reg_and_bitfunction aml_gpio_get_directionfunction aml_gpio_direction_inputfunction aml_gpio_direction_outputfunction aml_gpio_setfunction aml_gpio_get
Annotated Snippet
struct aml_pio_control {
u32 gpio_offset;
u32 reg_offset[AML_NUM_REG];
u32 bit_offset[AML_NUM_REG];
};
/*
* partial bank(subordinate) pins mux config use other bank(main) mux registgers
* m_bank_id: the main bank which pin_id from 0, but register bit not from bit 0
* m_bit_offs: bit offset the main bank mux register
* s_bit_offs: start bit that subordinate bank use mux register
* sid: start pin_id of subordinate bank
* eid: end pin_id of subordinate bank
* next: subordinate bank reused multiple other bank groups.
*/
struct multi_mux {
unsigned int m_bank_id;
unsigned int m_bit_offs;
unsigned int s_bit_offs;
unsigned int sid;
unsigned int eid;
const struct multi_mux *next;
};
struct aml_pctl_data {
unsigned int number;
const struct multi_mux *p_mux;
};
struct aml_pmx_func {
const char *name;
const char **groups;
unsigned int ngroups;
};
struct aml_pctl_group {
const char *name;
unsigned int npins;
unsigned int *pins;
unsigned int *func;
};
struct aml_gpio_bank {
struct gpio_chip gpio_chip;
struct aml_pio_control pc;
u32 bank_id;
u32 mux_bit_offs;
unsigned int pin_base;
struct regmap *reg_mux;
struct regmap *reg_gpio;
struct regmap *reg_ds;
const struct multi_mux *p_mux;
};
struct aml_pinctrl {
struct device *dev;
struct pinctrl_dev *pctl;
struct aml_gpio_bank *banks;
int nbanks;
struct aml_pmx_func *functions;
int nfunctions;
struct aml_pctl_group *groups;
int ngroups;
const struct aml_pctl_data *data;
};
static const unsigned int aml_bit_strides[AML_NUM_REG] = {
1, 1, 1, 1, 1, 2
};
static const unsigned int aml_def_regoffs[AML_NUM_REG] = {
3, 4, 2, 1, 0, 7
};
static const char *aml_bank_name[31] = {
"GPIOA", "GPIOB", "GPIOC", "GPIOD", "GPIOE", "GPIOF", "GPIOG",
"GPIOH", "GPIOI", "GPIOJ", "GPIOK", "GPIOL", "GPIOM", "GPION",
"GPIOO", "GPIOP", "GPIOQ", "GPIOR", "GPIOS", "GPIOT", "GPIOU",
"GPIOV", "GPIOW", "GPIOX", "GPIOY", "GPIOZ", "GPIODV", "GPIOAO",
"GPIOCC", "TEST_N", "ANALOG"
};
static const struct multi_mux multi_mux_a9[] = {
{
.m_bank_id = AMLOGIC_GPIO_C,
.m_bit_offs = 4,
.s_bit_offs = 0,
.sid = (AMLOGIC_GPIO_D << 8) + 16,
.eid = (AMLOGIC_GPIO_D << 8) + 16,
Annotation
- Immediate include surface: `linux/err.h`, `linux/gpio/driver.h`, `linux/init.h`, `linux/io.h`, `linux/module.h`, `linux/of.h`, `linux/of_address.h`, `linux/platform_device.h`.
- Detected declarations: `struct aml_pio_control`, `struct multi_mux`, `struct aml_pctl_data`, `struct aml_pmx_func`, `struct aml_pctl_group`, `struct aml_gpio_bank`, `struct aml_pinctrl`, `enum aml_pinconf_drv`, `function aml_pmx_calc_reg_and_offset`, `function aml_pctl_set_function`.
- 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.