drivers/pinctrl/pinctrl-aw9523.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-aw9523.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-aw9523.c- Extension
.c- Size
- 26880 bytes
- Lines
- 1061
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/bitfield.hlinux/errno.hlinux/gpio/consumer.hlinux/gpio/driver.hlinux/i2c.hlinux/init.hlinux/interrupt.hlinux/irq.hlinux/module.hlinux/mutex.hlinux/property.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinmux.h
Detected Declarations
struct aw9523_irqstruct aw9523function aw9523_pinctrl_get_groups_countfunction aw9523_pinctrl_get_group_pinsfunction aw9523_pmx_get_funcs_countfunction aw9523_pmx_get_groupsfunction aw9523_pmx_set_muxfunction aw9523_pcfg_param_to_regfunction aw9523_pconf_getfunction aw9523_pconf_setfunction aw9523_get_pin_directionfunction aw9523_get_port_statefunction aw9523_gpio_irq_typefunction aw9523_irq_maskfunction aw9523_irq_unmaskfunction aw9523_irq_thread_funcfunction aw9523_irq_bus_lockfunction bitsfunction aw9523_gpio_get_directionfunction aw9523_gpio_getfunction _aw9523_gpio_get_multiplefunction aw9523_gpio_get_multiplefunction aw9523_gpio_set_multiplefunction aw9523_gpio_setfunction aw9523_direction_inputfunction aw9523_direction_outputfunction aw9523_drive_reset_gpiofunction aw9523_hw_resetfunction aw9523_init_gpiochipfunction aw9523_init_irqfunction aw9523_is_reg_holefunction aw9523_readable_regfunction aw9523_volatile_regfunction aw9523_writeable_regfunction aw9523_precious_regfunction aw9523_hw_initfunction aw9523_probefunction aw9523_remove
Annotated Snippet
struct aw9523_irq {
struct mutex lock;
u16 cached_gpio;
};
/*
* struct aw9523 - Main driver structure
* @dev: device handle
* @regmap: regmap handle for current device
* @i2c_lock: Mutex lock for i2c operations
* @reset_gpio: Hardware reset (RSTN) signal GPIO
* @vio_vreg: VCC regulator (Optional)
* @pctl: pinctrl handle for current device
* @gpio: structure holding gpiochip params
* @irq: Interrupt controller structure
*/
struct aw9523 {
struct device *dev;
struct regmap *regmap;
struct mutex i2c_lock;
struct gpio_desc *reset_gpio;
int vio_vreg;
struct pinctrl_dev *pctl;
struct gpio_chip gpio;
struct aw9523_irq *irq;
};
static const struct pinctrl_pin_desc aw9523_pins[] = {
/* Port 0 */
PINCTRL_PIN(0, "gpio0"),
PINCTRL_PIN(1, "gpio1"),
PINCTRL_PIN(2, "gpio2"),
PINCTRL_PIN(3, "gpio3"),
PINCTRL_PIN(4, "gpio4"),
PINCTRL_PIN(5, "gpio5"),
PINCTRL_PIN(6, "gpio6"),
PINCTRL_PIN(7, "gpio7"),
/* Port 1 */
PINCTRL_PIN(8, "gpio8"),
PINCTRL_PIN(9, "gpio9"),
PINCTRL_PIN(10, "gpio10"),
PINCTRL_PIN(11, "gpio11"),
PINCTRL_PIN(12, "gpio12"),
PINCTRL_PIN(13, "gpio13"),
PINCTRL_PIN(14, "gpio14"),
PINCTRL_PIN(15, "gpio15"),
};
static int aw9523_pinctrl_get_groups_count(struct pinctrl_dev *pctldev)
{
return ARRAY_SIZE(aw9523_pins);
}
static const char *aw9523_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
unsigned int selector)
{
return aw9523_pins[selector].name;
}
static int aw9523_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
unsigned int selector,
const unsigned int **pins,
unsigned int *num_pins)
{
*pins = &aw9523_pins[selector].number;
*num_pins = 1;
return 0;
}
static const struct pinctrl_ops aw9523_pinctrl_ops = {
.get_groups_count = aw9523_pinctrl_get_groups_count,
.get_group_pins = aw9523_pinctrl_get_group_pins,
.get_group_name = aw9523_pinctrl_get_group_name,
.dt_node_to_map = pinconf_generic_dt_node_to_map_pin,
.dt_free_map = pinconf_generic_dt_free_map,
};
static const char * const gpio_pwm_groups[] = {
"gpio0", "gpio1", "gpio2", "gpio3", /* 0-3 */
"gpio4", "gpio5", "gpio6", "gpio7", /* 4-7 */
"gpio8", "gpio9", "gpio10", "gpio11", /* 8-11 */
"gpio12", "gpio13", "gpio14", "gpio15", /* 11-15 */
};
/* Warning: Do NOT reorder this array */
static const struct pinfunction aw9523_pmx[] = {
PINCTRL_PINFUNCTION("pwm", gpio_pwm_groups, ARRAY_SIZE(gpio_pwm_groups)),
PINCTRL_PINFUNCTION("gpio", gpio_pwm_groups, ARRAY_SIZE(gpio_pwm_groups)),
};
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/errno.h`, `linux/gpio/consumer.h`, `linux/gpio/driver.h`, `linux/i2c.h`, `linux/init.h`, `linux/interrupt.h`, `linux/irq.h`.
- Detected declarations: `struct aw9523_irq`, `struct aw9523`, `function aw9523_pinctrl_get_groups_count`, `function aw9523_pinctrl_get_group_pins`, `function aw9523_pmx_get_funcs_count`, `function aw9523_pmx_get_groups`, `function aw9523_pmx_set_mux`, `function aw9523_pcfg_param_to_reg`, `function aw9523_pconf_get`, `function aw9523_pconf_set`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- 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.