drivers/irqchip/irq-lpc32xx.c
Source file repositories/reference/linux-study-clean/drivers/irqchip/irq-lpc32xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/irqchip/irq-lpc32xx.c- Extension
.c- Size
- 5920 bytes
- Lines
- 243
- Domain
- Driver Families
- Bucket
- drivers/irqchip
- 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/io.hlinux/irqchip.hlinux/irqchip/chained_irq.hlinux/of_address.hlinux/of_irq.hlinux/of_platform.hlinux/seq_file.hlinux/slab.hasm/exception.h
Detected Declarations
struct lpc32xx_irq_chipfunction lpc32xx_ic_readfunction lpc32xx_ic_writefunction lpc32xx_irq_maskfunction lpc32xx_irq_unmaskfunction lpc32xx_irq_ackfunction lpc32xx_irq_set_typefunction lpc32xx_irq_print_chipfunction lpc32xx_handle_irqfunction lpc32xx_sic_handlerfunction lpc32xx_irq_domain_mapfunction lpc32xx_irq_domain_unmapfunction lpc32xx_of_ic_init
Annotated Snippet
struct lpc32xx_irq_chip {
void __iomem *base;
phys_addr_t addr;
struct irq_domain *domain;
};
static struct lpc32xx_irq_chip *lpc32xx_mic_irqc;
static inline u32 lpc32xx_ic_read(struct lpc32xx_irq_chip *ic, u32 reg)
{
return readl_relaxed(ic->base + reg);
}
static inline void lpc32xx_ic_write(struct lpc32xx_irq_chip *ic,
u32 reg, u32 val)
{
writel_relaxed(val, ic->base + reg);
}
static void lpc32xx_irq_mask(struct irq_data *d)
{
struct lpc32xx_irq_chip *ic = irq_data_get_irq_chip_data(d);
u32 val, mask = BIT(d->hwirq);
val = lpc32xx_ic_read(ic, LPC32XX_INTC_MASK) & ~mask;
lpc32xx_ic_write(ic, LPC32XX_INTC_MASK, val);
}
static void lpc32xx_irq_unmask(struct irq_data *d)
{
struct lpc32xx_irq_chip *ic = irq_data_get_irq_chip_data(d);
u32 val, mask = BIT(d->hwirq);
val = lpc32xx_ic_read(ic, LPC32XX_INTC_MASK) | mask;
lpc32xx_ic_write(ic, LPC32XX_INTC_MASK, val);
}
static void lpc32xx_irq_ack(struct irq_data *d)
{
struct lpc32xx_irq_chip *ic = irq_data_get_irq_chip_data(d);
u32 mask = BIT(d->hwirq);
lpc32xx_ic_write(ic, LPC32XX_INTC_RAW, mask);
}
static int lpc32xx_irq_set_type(struct irq_data *d, unsigned int type)
{
struct lpc32xx_irq_chip *ic = irq_data_get_irq_chip_data(d);
u32 val, mask = BIT(d->hwirq);
bool high, edge;
switch (type) {
case IRQ_TYPE_EDGE_RISING:
edge = true;
high = true;
break;
case IRQ_TYPE_EDGE_FALLING:
edge = true;
high = false;
break;
case IRQ_TYPE_LEVEL_HIGH:
edge = false;
high = true;
break;
case IRQ_TYPE_LEVEL_LOW:
edge = false;
high = false;
break;
default:
pr_info("unsupported irq type %d\n", type);
return -EINVAL;
}
irqd_set_trigger_type(d, type);
val = lpc32xx_ic_read(ic, LPC32XX_INTC_POL);
if (high)
val |= mask;
else
val &= ~mask;
lpc32xx_ic_write(ic, LPC32XX_INTC_POL, val);
val = lpc32xx_ic_read(ic, LPC32XX_INTC_TYPE);
if (edge) {
val |= mask;
irq_set_handler_locked(d, handle_edge_irq);
} else {
val &= ~mask;
irq_set_handler_locked(d, handle_level_irq);
}
Annotation
- Immediate include surface: `linux/io.h`, `linux/irqchip.h`, `linux/irqchip/chained_irq.h`, `linux/of_address.h`, `linux/of_irq.h`, `linux/of_platform.h`, `linux/seq_file.h`, `linux/slab.h`.
- Detected declarations: `struct lpc32xx_irq_chip`, `function lpc32xx_ic_read`, `function lpc32xx_ic_write`, `function lpc32xx_irq_mask`, `function lpc32xx_irq_unmask`, `function lpc32xx_irq_ack`, `function lpc32xx_irq_set_type`, `function lpc32xx_irq_print_chip`, `function lpc32xx_handle_irq`, `function lpc32xx_sic_handler`.
- Atlas domain: Driver Families / drivers/irqchip.
- 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.