mirror of https://gitee.com/openkylin/linux.git
[PATCH] genirq: add SA_TRIGGER support
Enable drivers to request an IRQ with a given irq-flow (trigger/polarity) setting. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
ba9a2331ba
commit
e76de9f8eb
|
@ -225,8 +225,14 @@ int setup_irq(unsigned int irq, struct irqaction *new)
|
||||||
p = &desc->action;
|
p = &desc->action;
|
||||||
old = *p;
|
old = *p;
|
||||||
if (old) {
|
if (old) {
|
||||||
/* Can't share interrupts unless both agree to */
|
/*
|
||||||
if (!(old->flags & new->flags & SA_SHIRQ))
|
* Can't share interrupts unless both agree to and are
|
||||||
|
* the same type (level, edge, polarity). So both flag
|
||||||
|
* fields must have SA_SHIRQ set and the bits which
|
||||||
|
* set the trigger type must match.
|
||||||
|
*/
|
||||||
|
if (!((old->flags & new->flags) & SA_SHIRQ) ||
|
||||||
|
((old->flags ^ new->flags) & SA_TRIGGER_MASK))
|
||||||
goto mismatch;
|
goto mismatch;
|
||||||
|
|
||||||
#if defined(CONFIG_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
|
#if defined(CONFIG_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ)
|
||||||
|
@ -250,7 +256,22 @@ int setup_irq(unsigned int irq, struct irqaction *new)
|
||||||
#endif
|
#endif
|
||||||
if (!shared) {
|
if (!shared) {
|
||||||
irq_chip_set_defaults(desc->chip);
|
irq_chip_set_defaults(desc->chip);
|
||||||
compat_irq_chip_set_default_handler(desc);
|
|
||||||
|
/* Setup the type (level, edge polarity) if configured: */
|
||||||
|
if (new->flags & SA_TRIGGER_MASK) {
|
||||||
|
if (desc->chip && desc->chip->set_type)
|
||||||
|
desc->chip->set_type(irq,
|
||||||
|
new->flags & SA_TRIGGER_MASK);
|
||||||
|
else
|
||||||
|
/*
|
||||||
|
* SA_TRIGGER_* but the PIC does not support
|
||||||
|
* multiple flow-types?
|
||||||
|
*/
|
||||||
|
printk(KERN_WARNING "setup_irq(%d) SA_TRIGGER"
|
||||||
|
"set. No set_type function available\n",
|
||||||
|
irq);
|
||||||
|
} else
|
||||||
|
compat_irq_chip_set_default_handler(desc);
|
||||||
|
|
||||||
desc->status &= ~(IRQ_AUTODETECT | IRQ_WAITING |
|
desc->status &= ~(IRQ_AUTODETECT | IRQ_WAITING |
|
||||||
IRQ_INPROGRESS);
|
IRQ_INPROGRESS);
|
||||||
|
@ -262,7 +283,9 @@ int setup_irq(unsigned int irq, struct irqaction *new)
|
||||||
desc->chip->startup(irq);
|
desc->chip->startup(irq);
|
||||||
else
|
else
|
||||||
desc->chip->enable(irq);
|
desc->chip->enable(irq);
|
||||||
}
|
} else
|
||||||
|
/* Undo nested disables: */
|
||||||
|
desc->depth = 1;
|
||||||
}
|
}
|
||||||
spin_unlock_irqrestore(&desc->lock, flags);
|
spin_unlock_irqrestore(&desc->lock, flags);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue