Re: [PATCH v3 5/5] iio: light: vcnl4000: add shared IRQ support

From: Andy Shevchenko

Date: Thu Sep 03 2026 - 06:08:34 EST


On Thu, Sep 03, 2026 at 02:53:50PM +1000, Tsz Shan Chan wrote:
> Change the interrupt trigger to IRQF_TRIGGER_LOW and add IRQF_SHARED to
> allow the sensor to share an interrupt line.
>
> Return IRQ_NONE from the irq handler when read fails or when none of the
> interrupt source bits handled by the driver are set. This prevents
> claiming interrupts from other devices on a shared line.
>
> The datasheets confirm that the INT pin is open drain active low, and
> the interrupts are latched:
> - vcnl4010/4020: The INT pin is open drain. It is pulled low
> while a status bit is 1, and it stays low until the driver writes
> a 1 to clear it.
> - vcnl4040/4200: The INT pin is pulled low when a flag triggers. It
> resets to high only after the driver reads the INT_Flag register.

...

> ret = devm_request_threaded_irq(dev, client->irq, NULL,
> data->chip_spec->irq_thread,
> - IRQF_TRIGGER_FALLING |
> - IRQF_ONESHOT,
> + IRQF_TRIGGER_LOW |
> + IRQF_ONESHOT | IRQF_SHARED,
> "vcnl4000_irq",
> indio_dev);

This will require to have other drivers be in the same settings to share this
interrupt line. Which means that the cases when we have active-high setting
in one device in DT and 'fake' one in another (assuming a NOT gate is added
on the PCB), this won't work. In another driver this was split to issue a warning
and use default trigger if and only if it's not provided by the firmware.


--
With Best Regards,
Andy Shevchenko