Day78 - GPIO IRQ Consumer Driver¶
Goal¶
Understand how Linux GPIO consumer drivers obtain interrupt resources and register interrupt handlers.
Topics Studied¶
GPIO Interrupt Resources¶
A GPIO line can be used as an interrupt source.
Typical flow:
GPIO to IRQ Conversion¶
Learned how a GPIO descriptor is converted into a Linux IRQ number.
Key understanding:
The GPIO controller and IRQ subsystem provide the mapping.
IRQ Registration¶
Learned the purpose of:
and:
Driver lifecycle:
Raspberry Pi Investigation¶
Inspected:
and:
Observed:
This confirms that GPIO resources and IRQ resources are different kernel objects.
Lab1 - GPIO IRQ Investigation¶
Investigated:
/proc/interrupts- GPIO controller ownership
- GPIO consumers
- Linux IRQ numbers
Key observation:
Lab2 - gpiod_to_irq() Simulation¶
Implemented:
Created GPIO-to-IRQ mapping table:
Verified descriptor conversion:
Lab3 - GPIO IRQ Consumer Driver Simulation¶
Implemented:
Created:
to simulate IRQ registration.
Implemented simulated driver lifecycle:
Validation result:
[PROBE] button irq=100
[ISR] irq=100 count=1
[ISR] irq=100 count=2
[REMOVE] free IRQ
[TEST] irq_trigger after remove ret=-2
Key Takeaways¶
GPIO interrupt consumer drivers obtain interrupt resources through GPIO descriptors.
Core flow:
The GPIO subsystem provides GPIO resources, while the IRQ subsystem provides interrupt delivery.
Both subsystems are connected through GPIO-to-IRQ mapping.
Files Added¶
Notes¶
Labs¶
Source Code¶
Next Step¶
Day79 - IRQ Subsystem Fundamentals
Topics:
- IRQ architecture
- irq_desc
- irq_action
- Edge vs Level trigger
- IRQ flow
- Top Half
- Bottom Half
- Threaded IRQ