public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] genirq: Add support for nested shared IRQs
@ 2017-03-07 16:28 Charles Keepax
  2017-03-11 12:01 ` [tip:irq/core] " tip-bot for Charles Keepax
  0 siblings, 1 reply; 2+ messages in thread
From: Charles Keepax @ 2017-03-07 16:28 UTC (permalink / raw)
  To: tglx; +Cc: linux-kernel, patches

I am working on a system which has an audio CODEC and two speaker amps,
each of the speaker amps have an open-drain IRQ line which are connected
together and attached to a pin on the audio CODEC, which is capable of
functioning as an IRQ chip. The audio CODEC then in turn has its own IRQ
line which heads back to the host processor.

This setup necessitates having a shared nested IRQ on the audio CODEC.
Currently however the kernel does not appear to support shared nested
IRQs.

Fortunately support is fairly easy to add, only required the
modification of handle_nested_irq to call all the IRQ handlers, rather
than just the first one associated with the IRQ.

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
---

Changes since v1:
 - Improve commit messages
 - Use for_each_action_of_desc
 - Correct handling of note_interrupt

Thanks,
Charles

 kernel/irq/chip.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index be3c34e..686be4b 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -348,7 +348,10 @@ void handle_nested_irq(unsigned int irq)
 	irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
 	raw_spin_unlock_irq(&desc->lock);
 
-	action_ret = action->thread_fn(action->irq, action->dev_id);
+	action_ret = IRQ_NONE;
+	for_each_action_of_desc(desc, action)
+		action_ret |= action->thread_fn(action->irq, action->dev_id);
+
 	if (!noirqdebug)
 		note_interrupt(desc, action_ret);
 
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* [tip:irq/core] genirq: Add support for nested shared IRQs
  2017-03-07 16:28 [PATCH v2] genirq: Add support for nested shared IRQs Charles Keepax
@ 2017-03-11 12:01 ` tip-bot for Charles Keepax
  0 siblings, 0 replies; 2+ messages in thread
From: tip-bot for Charles Keepax @ 2017-03-11 12:01 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: ckeepax, tglx, linux-kernel, mingo, hpa

Commit-ID:  45e5202213ae6541f7916bb3c64fbcd3019ec473
Gitweb:     http://git.kernel.org/tip/45e5202213ae6541f7916bb3c64fbcd3019ec473
Author:     Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
AuthorDate: Tue, 7 Mar 2017 16:28:18 +0000
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 11 Mar 2017 12:57:03 +0100

genirq: Add support for nested shared IRQs

On a specific audio system an interrupt input of an audio CODEC is used as a
shared interrupt. That interrupt input is handled by a CODEC specific irq
chip driver and triggers a CPU interrupt via the CODEC irq output line.

The CODEC interrupt handler demultiplexes the CODEC interrupt inputs and
the interrupt handlers for these demultiplexed inputs run nested in the
context of the CODEC interrupt handler.

The demultiplexed interrupts use handle_nested_irq() as their interrupt
handler, which unfortunately has no support for shared interrupts. So the
above hardware cannot be supported.

Add shared interrupt support to handle_nested_irq() by iterating over the
interrupt action chain.

[ tglx: Massaged changelog ]

Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Cc: patches@opensource.wolfsonmicro.com
Link: http://lkml.kernel.org/r/1488904098-5350-1-git-send-email-ckeepax@opensource.wolfsonmicro.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 kernel/irq/chip.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c
index be3c34e..686be4b 100644
--- a/kernel/irq/chip.c
+++ b/kernel/irq/chip.c
@@ -348,7 +348,10 @@ void handle_nested_irq(unsigned int irq)
 	irqd_set(&desc->irq_data, IRQD_IRQ_INPROGRESS);
 	raw_spin_unlock_irq(&desc->lock);
 
-	action_ret = action->thread_fn(action->irq, action->dev_id);
+	action_ret = IRQ_NONE;
+	for_each_action_of_desc(desc, action)
+		action_ret |= action->thread_fn(action->irq, action->dev_id);
+
 	if (!noirqdebug)
 		note_interrupt(desc, action_ret);
 

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-11 12:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-07 16:28 [PATCH v2] genirq: Add support for nested shared IRQs Charles Keepax
2017-03-11 12:01 ` [tip:irq/core] " tip-bot for Charles Keepax

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox