Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <marex@denx.de>
[maz: fixed missing static attribute]
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20200323235132.530550-1-marex@denx.de

authored by

Marek Vasut and committed by
Marc Zyngier
00760d3c eeaa4b24

+14 -4
+14 -4
drivers/pinctrl/stm32/pinctrl-stm32.c
··· 304 304 .get_direction = stm32_gpio_get_direction, 305 305 }; 306 306 307 - void stm32_gpio_irq_eoi(struct irq_data *d) 307 + static void stm32_gpio_irq_trigger(struct irq_data *d) 308 308 { 309 309 struct stm32_gpio_bank *bank = d->domain->host_data; 310 310 int level; 311 - 312 - irq_chip_eoi_parent(d); 313 311 314 312 /* If level interrupt type then retrig */ 315 313 level = stm32_gpio_get(&bank->gpio_chip, d->hwirq); 316 314 if ((level == 0 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_LOW) || 317 315 (level == 1 && bank->irq_type[d->hwirq] == IRQ_TYPE_LEVEL_HIGH)) 318 316 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); 319 323 }; 320 324 321 325 static int stm32_gpio_set_type(struct irq_data *d, unsigned int type) ··· 375 371 gpiochip_unlock_as_irq(&bank->gpio_chip, irq_data->hwirq); 376 372 } 377 373 374 + static void stm32_gpio_irq_unmask(struct irq_data *d) 375 + { 376 + irq_chip_unmask_parent(d); 377 + stm32_gpio_irq_trigger(d); 378 + } 379 + 378 380 static struct irq_chip stm32_gpio_irq_chip = { 379 381 .name = "stm32gpio", 380 382 .irq_eoi = stm32_gpio_irq_eoi, 381 383 .irq_ack = irq_chip_ack_parent, 382 384 .irq_mask = irq_chip_mask_parent, 383 - .irq_unmask = irq_chip_unmask_parent, 385 + .irq_unmask = stm32_gpio_irq_unmask, 384 386 .irq_set_type = stm32_gpio_set_type, 385 387 .irq_set_wake = irq_chip_set_wake_parent, 386 388 .irq_request_resources = stm32_gpio_irq_request_resources,