Re: [PATCH 2/2] iio: accel: mma8452: Allow open drain interrupt pin configuration
From: Esben Haabendal
Date: Wed Jul 15 2026 - 07:38:20 EST
"Andy Shevchenko" <andriy.shevchenko@xxxxxxxxx> writes:
> On Wed, Jul 15, 2026 at 10:07:39AM +0200, Esben Haabendal wrote:
>> When sharing interrupt line with other chips, the interrupt pin most
>> likely needs to be configured in open-drain mode instead of push-pull.
>> If this is needed, you must add drive-open-drain property to the
>> device-tree.
>
> ...
>
>> 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?
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.
> 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.
> Also setting to _LOW in the flags unconditionally is a (historic) bug.
> The problem is that we might not fix it without breaking the existing
> users which omit that flag in DT.
Ok. So let's leave that as is for now.
/Esben