drivers/gpio/gpio-ep93xx.c
Source file repositories/reference/linux-study-clean/drivers/gpio/gpio-ep93xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpio/gpio-ep93xx.c- Extension
.c- Size
- 10464 bytes
- Lines
- 399
- 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.
- 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/bitops.hlinux/gpio/driver.hlinux/gpio/generic.hlinux/init.hlinux/interrupt.hlinux/io.hlinux/irq.hlinux/module.hlinux/platform_device.hlinux/seq_file.hlinux/slab.h
Detected Declarations
struct ep93xx_gpio_irq_chipstruct ep93xx_gpio_chipfunction ep93xx_gpio_update_int_paramsfunction ep93xx_gpio_int_debouncefunction ep93xx_gpio_ab_irq_handlerfunction ep93xx_ab_irq_handlerfunction ep93xx_gpio_f_irq_handlerfunction ep93xx_gpio_irq_ackfunction ep93xx_gpio_irq_mask_ackfunction ep93xx_gpio_irq_maskfunction ep93xx_gpio_irq_unmaskfunction levelfunction ep93xx_gpio_set_configfunction ep93xx_irq_print_chipfunction ep93xx_setup_irqsfunction ep93xx_gpio_probefunction ep93xx_gpio_init
Annotated Snippet
struct ep93xx_gpio_irq_chip {
void __iomem *base;
u8 int_unmasked;
u8 int_enabled;
u8 int_type1;
u8 int_type2;
u8 int_debounce;
};
struct ep93xx_gpio_chip {
void __iomem *base;
struct gpio_generic_chip chip;
struct ep93xx_gpio_irq_chip *eic;
};
static struct ep93xx_gpio_chip *to_ep93xx_gpio_chip(struct gpio_chip *gc)
{
return container_of(to_gpio_generic_chip(gc), struct ep93xx_gpio_chip, chip);
}
static struct ep93xx_gpio_irq_chip *to_ep93xx_gpio_irq_chip(struct gpio_chip *gc)
{
struct ep93xx_gpio_chip *egc = to_ep93xx_gpio_chip(gc);
return egc->eic;
}
/*************************************************************************
* Interrupt handling for EP93xx on-chip GPIOs
*************************************************************************/
#define EP93XX_INT_TYPE1_OFFSET 0x00
#define EP93XX_INT_TYPE2_OFFSET 0x04
#define EP93XX_INT_EOI_OFFSET 0x08
#define EP93XX_INT_EN_OFFSET 0x0c
#define EP93XX_INT_STATUS_OFFSET 0x10
#define EP93XX_INT_RAW_STATUS_OFFSET 0x14
#define EP93XX_INT_DEBOUNCE_OFFSET 0x18
static void ep93xx_gpio_update_int_params(struct ep93xx_gpio_irq_chip *eic)
{
writeb_relaxed(0, eic->base + EP93XX_INT_EN_OFFSET);
writeb_relaxed(eic->int_type2,
eic->base + EP93XX_INT_TYPE2_OFFSET);
writeb_relaxed(eic->int_type1,
eic->base + EP93XX_INT_TYPE1_OFFSET);
writeb_relaxed(eic->int_unmasked & eic->int_enabled,
eic->base + EP93XX_INT_EN_OFFSET);
}
static void ep93xx_gpio_int_debounce(struct gpio_chip *gc,
unsigned int offset, bool enable)
{
struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc);
int port_mask = BIT(offset);
if (enable)
eic->int_debounce |= port_mask;
else
eic->int_debounce &= ~port_mask;
writeb(eic->int_debounce, eic->base + EP93XX_INT_DEBOUNCE_OFFSET);
}
static u32 ep93xx_gpio_ab_irq_handler(struct gpio_chip *gc)
{
struct ep93xx_gpio_irq_chip *eic = to_ep93xx_gpio_irq_chip(gc);
unsigned long stat;
int offset;
stat = readb(eic->base + EP93XX_INT_STATUS_OFFSET);
for_each_set_bit(offset, &stat, 8)
generic_handle_domain_irq(gc->irq.domain, offset);
return stat;
}
static irqreturn_t ep93xx_ab_irq_handler(int irq, void *dev_id)
{
return IRQ_RETVAL(ep93xx_gpio_ab_irq_handler(dev_id));
}
static void ep93xx_gpio_f_irq_handler(struct irq_desc *desc)
{
struct irq_chip *irqchip = irq_desc_get_chip(desc);
struct gpio_chip *gc = irq_desc_get_handler_data(desc);
struct gpio_irq_chip *gic = &gc->irq;
unsigned int parent = irq_desc_get_irq(desc);
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/gpio/driver.h`, `linux/gpio/generic.h`, `linux/init.h`, `linux/interrupt.h`, `linux/io.h`, `linux/irq.h`, `linux/module.h`.
- Detected declarations: `struct ep93xx_gpio_irq_chip`, `struct ep93xx_gpio_chip`, `function ep93xx_gpio_update_int_params`, `function ep93xx_gpio_int_debounce`, `function ep93xx_gpio_ab_irq_handler`, `function ep93xx_ab_irq_handler`, `function ep93xx_gpio_f_irq_handler`, `function ep93xx_gpio_irq_ack`, `function ep93xx_gpio_irq_mask_ack`, `function ep93xx_gpio_irq_mask`.
- Atlas domain: Driver Families / drivers/gpio.
- Implementation status: integration 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.