Skip to content

Commit e71374c

Browse files
mkshahcMarc Zyngier
authored andcommitted
irqchip/qcom-pdc: Add irqchip set/get state calls
Add irqchip calls to set/get interrupt state from the parent interrupt controller. When GPIOs are renabled as interrupt lines, it is desirable to clear the interrupt state at the GIC. This avoids any unwanted interrupt as a result of stale pending state recorded when the line was used as a GPIO. Signed-off-by: Maulik Shah <[email protected]> [Lina: updated commit text, rearranged code] Signed-off-by: Lina Iyer <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Reviewed-by: Stephen Boyd <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 81ef8bf commit e71374c

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

drivers/irqchip/qcom-pdc.c

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <linux/err.h>
77
#include <linux/init.h>
8+
#include <linux/interrupt.h>
89
#include <linux/irq.h>
910
#include <linux/irqchip.h>
1011
#include <linux/irqdomain.h>
@@ -50,6 +51,26 @@ static u32 pdc_reg_read(int reg, u32 i)
5051
return readl_relaxed(pdc_base + reg + i * sizeof(u32));
5152
}
5253

54+
static int qcom_pdc_gic_get_irqchip_state(struct irq_data *d,
55+
enum irqchip_irq_state which,
56+
bool *state)
57+
{
58+
if (d->hwirq == GPIO_NO_WAKE_IRQ)
59+
return 0;
60+
61+
return irq_chip_get_parent_state(d, which, state);
62+
}
63+
64+
static int qcom_pdc_gic_set_irqchip_state(struct irq_data *d,
65+
enum irqchip_irq_state which,
66+
bool value)
67+
{
68+
if (d->hwirq == GPIO_NO_WAKE_IRQ)
69+
return 0;
70+
71+
return irq_chip_set_parent_state(d, which, value);
72+
}
73+
5374
static void pdc_enable_intr(struct irq_data *d, bool on)
5475
{
5576
int pin_out = d->hwirq;
@@ -178,6 +199,8 @@ static struct irq_chip qcom_pdc_gic_chip = {
178199
.irq_unmask = qcom_pdc_gic_unmask,
179200
.irq_disable = qcom_pdc_gic_disable,
180201
.irq_enable = qcom_pdc_gic_enable,
202+
.irq_get_irqchip_state = qcom_pdc_gic_get_irqchip_state,
203+
.irq_set_irqchip_state = qcom_pdc_gic_set_irqchip_state,
181204
.irq_retrigger = irq_chip_retrigger_hierarchy,
182205
.irq_set_type = qcom_pdc_gic_set_type,
183206
.flags = IRQCHIP_MASK_ON_SUSPEND |

0 commit comments

Comments
 (0)