From 5931e6edfdd01c97b4cf8354e68f74df97580e49 Mon Sep 17 00:00:00 2001 From: Andy Shevchenko Date: Fri, 22 Nov 2019 16:50:05 +0200 Subject: [PATCH] pinctrl: lynxpoint: Implement ->irq_ack() callback Instead of playing tricks with registers in the interrupt handler, utilize the IRQ chip core for ACKing interrupts properly. Reviewed-by: Linus Walleij Signed-off-by: Andy Shevchenko Acked-by: Mika Westerberg --- drivers/pinctrl/intel/pinctrl-lynxpoint.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c index ddb201e5d78f..3b0dfe9a51ba 100644 --- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c +++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c @@ -218,9 +218,6 @@ static void lp_gpio_irq_handler(struct irq_desc *desc) for_each_set_bit(pin, &pending, 32) { unsigned int irq; - /* Clear before handling so we don't lose an edge */ - iowrite32(BIT(pin), reg); - irq = irq_find_mapping(lg->chip.irq.domain, base + pin); generic_handle_irq(irq); } @@ -228,6 +225,19 @@ static void lp_gpio_irq_handler(struct irq_desc *desc) chip->irq_eoi(data); } +static void lp_irq_ack(struct irq_data *d) +{ + struct gpio_chip *gc = irq_data_get_irq_chip_data(d); + struct lp_gpio *lg = gpiochip_get_data(gc); + u32 hwirq = irqd_to_hwirq(d); + void __iomem *reg = lp_gpio_reg(&lg->chip, hwirq, LP_INT_STAT); + unsigned long flags; + + raw_spin_lock_irqsave(&lg->lock, flags); + iowrite32(BIT(hwirq % 32), reg); + raw_spin_unlock_irqrestore(&lg->lock, flags); +} + static void lp_irq_unmask(struct irq_data *d) { } @@ -313,6 +323,7 @@ static int lp_irq_set_type(struct irq_data *d, unsigned int type) static struct irq_chip lp_irqchip = { .name = "LP-GPIO", + .irq_ack = lp_irq_ack, .irq_mask = lp_irq_mask, .irq_unmask = lp_irq_unmask, .irq_enable = lp_irq_enable,