drivers/pinctrl/pinctrl-as3722.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/pinctrl-as3722.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/pinctrl-as3722.c- Extension
.c- Size
- 16582 bytes
- Lines
- 606
- 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/delay.hlinux/gpio/driver.hlinux/kernel.hlinux/mod_devicetable.hlinux/module.hlinux/mfd/as3722.hlinux/platform_device.hlinux/pm.hlinux/property.hlinux/slab.hlinux/pinctrl/consumer.hlinux/pinctrl/machine.hlinux/pinctrl/pinctrl.hlinux/pinctrl/pinconf-generic.hlinux/pinctrl/pinconf.hlinux/pinctrl/pinmux.hcore.hpinconf.hpinctrl-utils.h
Detected Declarations
struct as3722_pin_functionstruct as3722_gpio_pin_controlstruct as3722_pingroupstruct as3722_pctrl_infoenum as3722_pinmux_optionfunction as3722_pinctrl_get_groups_countfunction as3722_pinctrl_get_group_pinsfunction as3722_pinctrl_get_funcs_countfunction as3722_pinctrl_get_func_groupsfunction as3722_pinctrl_setfunction as3722_pinctrl_gpio_get_modefunction as3722_pinctrl_gpio_request_enablefunction as3722_pinctrl_gpio_set_directionfunction as3722_pinconf_getfunction as3722_pinconf_setfunction as3722_gpio_getfunction as3722_gpio_setfunction as3722_gpio_direction_outputfunction as3722_gpio_to_irqfunction as3722_pinctrl_probe
Annotated Snippet
struct as3722_pin_function {
const char *name;
const char * const *groups;
unsigned ngroups;
int mux_option;
};
struct as3722_gpio_pin_control {
unsigned mode_prop;
int io_function;
};
struct as3722_pingroup {
const char *name;
const unsigned pins[1];
unsigned npins;
};
struct as3722_pctrl_info {
struct device *dev;
struct pinctrl_dev *pctl;
struct as3722 *as3722;
struct gpio_chip gpio_chip;
int pins_current_opt[AS3722_PIN_NUM];
const struct as3722_pin_function *functions;
unsigned num_functions;
const struct as3722_pingroup *pin_groups;
int num_pin_groups;
const struct pinctrl_pin_desc *pins;
unsigned num_pins;
struct as3722_gpio_pin_control gpio_control[AS3722_PIN_NUM];
};
static const struct pinctrl_pin_desc as3722_pins_desc[] = {
PINCTRL_PIN(AS3722_PIN_GPIO0, "gpio0"),
PINCTRL_PIN(AS3722_PIN_GPIO1, "gpio1"),
PINCTRL_PIN(AS3722_PIN_GPIO2, "gpio2"),
PINCTRL_PIN(AS3722_PIN_GPIO3, "gpio3"),
PINCTRL_PIN(AS3722_PIN_GPIO4, "gpio4"),
PINCTRL_PIN(AS3722_PIN_GPIO5, "gpio5"),
PINCTRL_PIN(AS3722_PIN_GPIO6, "gpio6"),
PINCTRL_PIN(AS3722_PIN_GPIO7, "gpio7"),
};
static const char * const gpio_groups[] = {
"gpio0",
"gpio1",
"gpio2",
"gpio3",
"gpio4",
"gpio5",
"gpio6",
"gpio7",
};
enum as3722_pinmux_option {
AS3722_PINMUX_GPIO = 0,
AS3722_PINMUX_INTERRUPT_OUT = 1,
AS3722_PINMUX_VSUB_VBAT_UNDEB_LOW_OUT = 2,
AS3722_PINMUX_GPIO_INTERRUPT = 3,
AS3722_PINMUX_PWM_INPUT = 4,
AS3722_PINMUX_VOLTAGE_IN_STBY = 5,
AS3722_PINMUX_OC_PG_SD0 = 6,
AS3722_PINMUX_PG_OUT = 7,
AS3722_PINMUX_CLK32K_OUT = 8,
AS3722_PINMUX_WATCHDOG_INPUT = 9,
AS3722_PINMUX_SOFT_RESET_IN = 11,
AS3722_PINMUX_PWM_OUTPUT = 12,
AS3722_PINMUX_VSUB_VBAT_LOW_DEB_OUT = 13,
AS3722_PINMUX_OC_PG_SD6 = 14,
};
#define FUNCTION_GROUP(fname, mux) \
{ \
.name = #fname, \
.groups = gpio_groups, \
.ngroups = ARRAY_SIZE(gpio_groups), \
.mux_option = AS3722_PINMUX_##mux, \
}
static const struct as3722_pin_function as3722_pin_function[] = {
FUNCTION_GROUP(gpio, GPIO),
FUNCTION_GROUP(interrupt-out, INTERRUPT_OUT),
FUNCTION_GROUP(gpio-in-interrupt, GPIO_INTERRUPT),
FUNCTION_GROUP(vsup-vbat-low-undebounce-out, VSUB_VBAT_UNDEB_LOW_OUT),
FUNCTION_GROUP(vsup-vbat-low-debounce-out, VSUB_VBAT_LOW_DEB_OUT),
FUNCTION_GROUP(voltage-in-standby, VOLTAGE_IN_STBY),
FUNCTION_GROUP(oc-pg-sd0, OC_PG_SD0),
FUNCTION_GROUP(oc-pg-sd6, OC_PG_SD6),
FUNCTION_GROUP(powergood-out, PG_OUT),
Annotation
- Immediate include surface: `linux/delay.h`, `linux/gpio/driver.h`, `linux/kernel.h`, `linux/mod_devicetable.h`, `linux/module.h`, `linux/mfd/as3722.h`, `linux/platform_device.h`, `linux/pm.h`.
- Detected declarations: `struct as3722_pin_function`, `struct as3722_gpio_pin_control`, `struct as3722_pingroup`, `struct as3722_pctrl_info`, `enum as3722_pinmux_option`, `function as3722_pinctrl_get_groups_count`, `function as3722_pinctrl_get_group_pins`, `function as3722_pinctrl_get_funcs_count`, `function as3722_pinctrl_get_func_groups`, `function as3722_pinctrl_set`.
- 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.