public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* can/should a disabled irq become pending?
@ 2024-11-11 13:03 Uwe Kleine-König
  2024-11-12 19:35 ` Thomas Gleixner
  0 siblings, 1 reply; 13+ messages in thread
From: Uwe Kleine-König @ 2024-11-11 13:03 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-kernel, Nuno Sá, Jonathan Cameron

[-- Attachment #1: Type: text/plain, Size: 1743 bytes --]

Hello Thomas,

[This mail is about an issue identified in a thread on the linux-iio
mailing list, but I guess you missed that because the Subject isn't
"interesting". See
https://lore.kernel.org/linux-iio/20241030204429.70cdcf35@jic23-huawei.
So here comes a dedicated mail about only this topic in the hope it
attracts your attention.]

The ad7124 ADC and a few cousins of it have the peculiarity to report
their interrupt on the SPI MISO line. So while the SPI clock is toggling
it behaves as MISO and after a transfer it's a falling edge irq signal.

So the driver masks the irq during SPI transfers (using irq_disable()).
It also uses irq_set_status_flags(sigma_delta->irq_line,
IRQ_DISABLE_UNLAZY);

Now on some irq controllers (e.g. the rpi GPIO controller) the detection
logic is off between calls to irq_disable() and irq_enable() and so on
that platform calling irq_enable() makes the irq handler called only on
a real irq, while for other irq controllers (e.g. the Altera GPIO
controller) the SPI transfers make the irq pending and irq_enable()
results in a call of the handler immediately (but very likely before the
device actually asserted the interrupt).

I think (but please correct me) that the latter behaviour has to be
expected and the former is even broken as it might miss irq events.

My conclusions from this are:

 - the ad7124 driver needs some additional logic to check the actual
   line state in the irq handler to differentiate between "real" irqs
   and spurious ones triggered by SPI transfers[1];

 - the rpi GPIO controller should be fixed not to honor
   IRQ_DISABLE_UNLAZY.

Can you confirm these?

Best regards
Uwe

[1] it can only check the level, not a passed edge, but that seems to
    work in practise

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2024-11-25  9:03 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-11 13:03 can/should a disabled irq become pending? Uwe Kleine-König
2024-11-12 19:35 ` Thomas Gleixner
2024-11-12 22:08   ` Uwe Kleine-König
2024-11-13  3:40     ` Thomas Gleixner
2024-11-13 10:34       ` Nuno Sá
2024-11-13 15:50         ` Thomas Gleixner
2024-11-14  7:49           ` Nuno Sá
2024-11-14 10:59             ` Uwe Kleine-König
2024-11-14 12:04               ` Nuno Sá
2024-11-23 11:28                 ` Jonathan Cameron
2024-11-24 13:18                   ` Nuno Sá
2024-11-25  8:50                     ` Uwe Kleine-König
2024-11-25  9:08                       ` Nuno Sá

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