drivers/gpio/gpio-pxa.c
Source file repositories/reference/linux-study-clean/drivers/gpio/gpio-pxa.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpio/gpio-pxa.c- Extension
.c- Size
- 20412 bytes
- Lines
- 810
- Domain
- Driver Families
- Bucket
- drivers/gpio
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/module.hlinux/clk.hlinux/err.hlinux/gpio/driver.hlinux/gpio-pxa.hlinux/init.hlinux/interrupt.hlinux/irq.hlinux/irqdomain.hlinux/irqchip/chained_irq.hlinux/io.hlinux/of.hlinux/pinctrl/consumer.hlinux/platform_device.hlinux/syscore_ops.hlinux/slab.h
Detected Declarations
struct pxa_gpio_bankstruct pxa_gpio_chipstruct pxa_gpio_idenum pxa_gpio_typefunction gpio_is_mmp_typefunction __gpio_is_invertedfunction __gpio_is_occupiedfunction pxa_irq_to_gpiofunction pxa_gpio_has_pinctrlfunction pxa_gpio_to_irqfunction pxa_gpio_direction_inputfunction pxa_gpio_direction_outputfunction pxa_gpio_getfunction pxa_gpio_setfunction pxa_gpio_of_xlatefunction pxa_init_gpio_chipfunction update_edge_detectfunction pxa_gpio_irq_typefunction pxa_gpio_demux_handlerfunction for_each_gpio_bankfunction for_each_set_bitfunction pxa_gpio_direct_handlerfunction pxa_ack_muxed_gpiofunction pxa_mask_muxed_gpiofunction pxa_gpio_set_wakefunction pxa_unmask_muxed_gpiofunction pxa_gpio_numsfunction pxa_irq_domain_mapfunction pxa_gpio_probe_dtfunction pxa_gpio_probefunction pxa_gpio_legacy_initfunction pxa_gpio_dt_initfunction pxa_gpio_suspendfunction for_each_gpio_bankfunction pxa_gpio_resumefunction for_each_gpio_bankfunction pxa_gpio_sysinitmodule init pxa_gpio_dt_init
Annotated Snippet
device_initcall(pxa_gpio_dt_init);
#ifdef CONFIG_PM
static int pxa_gpio_suspend(void *data)
{
struct pxa_gpio_chip *pchip = pxa_gpio_chip;
struct pxa_gpio_bank *c;
int gpio;
if (!pchip)
return 0;
for_each_gpio_bank(gpio, c, pchip) {
c->saved_gplr = readl_relaxed(c->regbase + GPLR_OFFSET);
c->saved_gpdr = readl_relaxed(c->regbase + GPDR_OFFSET);
c->saved_grer = readl_relaxed(c->regbase + GRER_OFFSET);
c->saved_gfer = readl_relaxed(c->regbase + GFER_OFFSET);
/* Clear GPIO transition detect bits */
writel_relaxed(0xffffffff, c->regbase + GEDR_OFFSET);
}
return 0;
}
static void pxa_gpio_resume(void *data)
{
struct pxa_gpio_chip *pchip = pxa_gpio_chip;
struct pxa_gpio_bank *c;
int gpio;
if (!pchip)
return;
for_each_gpio_bank(gpio, c, pchip) {
/* restore level with set/clear */
writel_relaxed(c->saved_gplr, c->regbase + GPSR_OFFSET);
writel_relaxed(~c->saved_gplr, c->regbase + GPCR_OFFSET);
writel_relaxed(c->saved_grer, c->regbase + GRER_OFFSET);
writel_relaxed(c->saved_gfer, c->regbase + GFER_OFFSET);
writel_relaxed(c->saved_gpdr, c->regbase + GPDR_OFFSET);
}
}
#else
#define pxa_gpio_suspend NULL
#define pxa_gpio_resume NULL
#endif
static const struct syscore_ops pxa_gpio_syscore_ops = {
.suspend = pxa_gpio_suspend,
.resume = pxa_gpio_resume,
};
static struct syscore pxa_gpio_syscore = {
.ops = &pxa_gpio_syscore_ops,
};
static int __init pxa_gpio_sysinit(void)
{
register_syscore(&pxa_gpio_syscore);
return 0;
}
postcore_initcall(pxa_gpio_sysinit);
Annotation
- Immediate include surface: `linux/module.h`, `linux/clk.h`, `linux/err.h`, `linux/gpio/driver.h`, `linux/gpio-pxa.h`, `linux/init.h`, `linux/interrupt.h`, `linux/irq.h`.
- Detected declarations: `struct pxa_gpio_bank`, `struct pxa_gpio_chip`, `struct pxa_gpio_id`, `enum pxa_gpio_type`, `function gpio_is_mmp_type`, `function __gpio_is_inverted`, `function __gpio_is_occupied`, `function pxa_irq_to_gpio`, `function pxa_gpio_has_pinctrl`, `function pxa_gpio_to_irq`.
- Atlas domain: Driver Families / drivers/gpio.
- Implementation status: integration 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.