Skip to content

Commit 00760d3

Browse files
Marek VasutMarc Zyngier
authored andcommitted
irqchip/stm32: Retrigger both in eoi and unmask callbacks
Sampling the IRQ line state in EOI and retriggering the interrupt to work around missing level-triggered interrupt support only works for non-threaded interrupts. Threaded interrupts must be retriggered the same way in unmask callback. Signed-off-by: Marek Vasut <[email protected]> [maz: fixed missing static attribute] Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent eeaa4b2 commit 00760d3

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

drivers/pinctrl/stm32/pinctrl-stm32.c

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -304,18 +304,22 @@ static const struct gpio_chip stm32_gpio_template = {
304304
.get_direction = stm32_gpio_get_direction,
305305
};
306306

307-
void stm32_gpio_irq_eoi(struct irq_data *d)
307+
static void stm32_gpio_irq_trigger(struct irq_data *d)
308308
{
309309
struct stm32_gpio_bank *bank = d->domain->host_data;
310310
int level;
311311

312-
irq_chip_eoi_parent(d);
313-
314312
/* If level interrupt type then retrig */
315313
level = stm32_gpio_get(&bank->gpio_chip, d->hwirq);
316314
if ((level == 0 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_LOW) ||
317315
(level == 1 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_HIGH))
318316
irq_chip_retrigger_hierarchy(d);
317+
}
318+
319+
static void stm32_gpio_irq_eoi(struct irq_data *d)
320+
{
321+
irq_chip_eoi_parent(d);
322+
stm32_gpio_irq_trigger(d);
319323
};
320324

321325
static int stm32_gpio_set_type(struct irq_data *d, unsigned int type)
@@ -371,12 +375,18 @@ static void stm32_gpio_irq_release_resources(struct irq_data *irq_data)
371375
gpiochip_unlock_as_irq(&bank->gpio_chip, irq_data->hwirq);
372376
}
373377

378+
static void stm32_gpio_irq_unmask(struct irq_data *d)
379+
{
380+
irq_chip_unmask_parent(d);
381+
stm32_gpio_irq_trigger(d);
382+
}
383+
374384
static struct irq_chip stm32_gpio_irq_chip = {
375385
.name = "stm32gpio",
376386
.irq_eoi = stm32_gpio_irq_eoi,
377387
.irq_ack = irq_chip_ack_parent,
378388
.irq_mask = irq_chip_mask_parent,
379-
.irq_unmask = irq_chip_unmask_parent,
389+
.irq_unmask = stm32_gpio_irq_unmask,
380390
.irq_set_type = stm32_gpio_set_type,
381391
.irq_set_wake = irq_chip_set_wake_parent,
382392
.irq_request_resources = stm32_gpio_irq_request_resources,

0 commit comments

Comments
 (0)