drivers/pinctrl/mediatek/mtk-eint.c
Source file repositories/reference/linux-study-clean/drivers/pinctrl/mediatek/mtk-eint.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pinctrl/mediatek/mtk-eint.c- Extension
.c- Size
- 16448 bytes
- Lines
- 628
- Domain
- Driver Families
- Bucket
- drivers/pinctrl
- 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.
- 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/err.hlinux/gpio/driver.hlinux/io.hlinux/irqchip/chained_irq.hlinux/irqdomain.hlinux/module.hlinux/of_irq.hlinux/platform_device.hmtk-eint.h
Detected Declarations
function mtk_eint_can_en_debouncefunction mtk_eint_flip_edgefunction mtk_eint_maskfunction mtk_eint_unmaskfunction mtk_eint_get_maskfunction mtk_eint_ackfunction mtk_eint_set_typefunction mtk_eint_irq_set_wakefunction mtk_eint_chip_write_maskfunction mtk_eint_irq_request_resourcesfunction mtk_eint_irq_release_resourcesfunction mtk_eint_hw_initfunction mtk_eint_debounce_processfunction mtk_eint_irq_handlerfunction wakefunction mtk_eint_do_suspendfunction mtk_eint_do_resumefunction mtk_eint_set_debouncefunction mtk_eint_find_irqfunction mtk_eint_do_initexport debounce_time_mt2701export debounce_time_mt6765export debounce_time_mt6795export debounce_time_mt6878export mtk_eint_do_suspendexport mtk_eint_do_resumeexport mtk_eint_set_debounceexport mtk_eint_find_irqexport mtk_eint_do_init
Annotated Snippet
while (status) {
shift = __ffs(status);
status &= ~BIT(shift);
mask = BIT(shift);
eint_num = eint->pin_list[i][shift + j];
/*
* If we get an interrupt on pin that was only required
* for wake (but no real interrupt requested), mask the
* interrupt (as would mtk_eint_resume do anyway later
* in the resume sequence).
*/
if (eint->wake_mask[i][port] & mask &&
!(eint->cur_mask[i][port] & mask)) {
reg = mtk_eint_get_offset(eint, eint_num,
eint->regs->mask_set);
writel_relaxed(mask, reg);
}
dual_edge = eint->pins[eint_num].dual_edge;
if (dual_edge) {
/*
* Clear soft-irq in case we raised it last
* time.
*/
reg = mtk_eint_get_offset(eint, eint_num,
eint->regs->soft_clr);
writel(mask, reg);
start_level =
eint->gpio_xlate->get_gpio_state(eint->pctl,
eint_num);
}
generic_handle_domain_irq(eint->domain, eint_num);
if (dual_edge) {
curr_level = mtk_eint_flip_edge(eint, eint_num);
/*
* If level changed, we might lost one edge
* interrupt, raised it through soft-irq.
*/
if (start_level != curr_level) {
reg = mtk_eint_get_offset(eint, eint_num,
eint->regs->soft_set);
writel(mask, reg);
}
}
if (eint->pins[eint_num].debounce)
mtk_eint_debounce_process(eint, eint_num);
}
}
}
chained_irq_exit(chip, desc);
}
int mtk_eint_do_suspend(struct mtk_eint *eint)
{
mtk_eint_chip_write_mask(eint, eint->wake_mask);
return 0;
}
EXPORT_SYMBOL_GPL(mtk_eint_do_suspend);
int mtk_eint_do_resume(struct mtk_eint *eint)
{
mtk_eint_chip_write_mask(eint, eint->cur_mask);
return 0;
}
EXPORT_SYMBOL_GPL(mtk_eint_do_resume);
int mtk_eint_set_debounce(struct mtk_eint *eint, unsigned long eint_num,
unsigned int debounce)
{
int virq, eint_offset;
unsigned int set_offset, bit, clr_bit, clr_offset, rst, i, unmask,
dbnc;
unsigned int inst = eint->pins[eint_num].instance;
unsigned int idx = eint->pins[eint_num].index;
struct irq_data *d;
if (!eint->hw->db_time)
return -EOPNOTSUPP;
virq = irq_find_mapping(eint->domain, eint_num);
eint_offset = (idx % 4) * 8;
d = irq_get_irq_data(virq);
Annotation
- Immediate include surface: `linux/delay.h`, `linux/err.h`, `linux/gpio/driver.h`, `linux/io.h`, `linux/irqchip/chained_irq.h`, `linux/irqdomain.h`, `linux/module.h`, `linux/of_irq.h`.
- Detected declarations: `function mtk_eint_can_en_debounce`, `function mtk_eint_flip_edge`, `function mtk_eint_mask`, `function mtk_eint_unmask`, `function mtk_eint_get_mask`, `function mtk_eint_ack`, `function mtk_eint_set_type`, `function mtk_eint_irq_set_wake`, `function mtk_eint_chip_write_mask`, `function mtk_eint_irq_request_resources`.
- Atlas domain: Driver Families / drivers/pinctrl.
- Implementation status: integration 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.