Could some one elaborate irq_create_mapping, irq_find_mapping, to use request_irq

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Could some one elaborate irq_create_mapping, irq_find_mapping, to use request_irq

2,243 Views
ramakrishnakatt
Contributor II

Could some one elaborate irq_create_mapping, irq_find_mapping, to use request_irq

Thanks

Rama

1 Reply

1,181 Views
scottwood
NXP Employee
NXP Employee

Linux IRQ numbers, as used by request_irq() and similar functions, are arbitrary software tokens rather than hardware IRQ numbers.  To obtain such a token (called a virtual IRQ number, or virq) you need to create a mapping.  The most common way to do that is to either use irq_of_parse_and_map(), or get the virq from a bus-specific structure (e.g. struct pci_dev or struct platform_device).

irq_create_mapping() is the low-level function used by the above methods of translation.  It's possible to use it directly, but you normally shouldn't have to.  If you find yourself wanting to use it, it probably means that you have hardware that should be described in the device tree but isn't.

irq_find_mapping() is one method used by interrupt controller drivers to turn a hardware interrupt number into a virq using an existing mapping.  If you're not writing an interrupt controller driver or something similar, you don't need this.