Re: [PATCH 2/2] iio: accel: mma8452: Allow open drain interrupt pin configuration

From: Andy Shevchenko

Date: Wed Jul 15 2026 - 09:58:57 EST


On Wed, Jul 15, 2026 at 01:35:41PM +0200, Esben Haabendal wrote:
> "Andy Shevchenko" <andriy.shevchenko@xxxxxxxxx> writes:
> > On Wed, Jul 15, 2026 at 10:07:39AM +0200, Esben Haabendal wrote:

...

> >> if (client->irq) {
> >> ret = request_threaded_irq(client->irq, NULL, mma8452_interrupt,
> >> - IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> >> + IRQF_TRIGGER_LOW | IRQF_ONESHOT |
> >> + data->open_drain ? IRQF_SHARED : 0,
> >> client->name, indio_dev);
> >
> > Why do we care?
>
> Care about what exactly?

About exclusivity of the interrupt.

> We need to add IRQF_SHARED flag in order to allow shared interrupt, and
> we should not add it when using (the default) push-pull mode.

Why not? How would it make any difference from SW perspective?
Yes, I understand the HW case.

> > The (hidden) problem this will have in the future is that the IRQ core
> > will splat a warning in case that other shared IRQs might be
> > configured with different flags. Putting that flag conditionally makes
> > it a mine field for the users. Instead just unconditionally add that
> > flag and we will get reports as soon as there will be a user that
> > shares the same interrupt pin with some other devices which drivers do
> > not use the same settings.
>
> If we add the IRQF_SHARED flag unconditionally, it will be set also when
> push-pull mode is enabled. I don't see how the kernel will be able to
> notice that that is not going to work. If you have another device that
> uses IRQF_TRIGGER_LOW|IRF_ONESHOT|IRQF_SHARED, it will not work with the
> MMA8452 device when configured as push-pull.

Right, and why do we care (again)? It's pure DT/FW/HW issue, not an SW issue.
Otherwise it will become a carefully placed mine for the poor user who will
use these flags and try to share an interrupt with the mma8452 device which
has no set property and uses push-pull mode.

Did I miss anything?

--
With Best Regards,
Andy Shevchenko