Re: [PATCH v3 2/5] iio: light: vcnl4000: clear DRDY interrupt when buffer disabled

From: Jonathan Cameron

Date: Sun Sep 06 2026 - 14:21:54 EST


On Thu, 03 Sep 2026 14:53:47 +1000
Tsz Shan Chan <tsz.chan.dev@xxxxxxxxx> wrote:

> on vcnl4010/4020, interrupt status bits are cleared by writing 1 to the
> corresponding bit in the ISR register. If data ready interrupt triggers
> when the iio buffer is disabled, the DRDY bit is never cleared and the
> interrupt line stays low.
>
> Clear the DRDY bit in the interrupt handler when the buffer is disabled.

Add something on why we might actually see this. Are we looking at a race
condition or normal operation? I.e. does this happen on sysfs reads?
I think it is just the race condition around the buffer going down
but good to have that called out in this description if that is
correct.

Thanks,

Jonathan


>
> Signed-off-by: Tsz Shan Chan <tchan@xxxxxxxxxxxxxx>
> ---
> drivers/iio/light/vcnl4000.c | 9 +++++++--
> 1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
> index cf55fe6afcba..c5f34e748e1a 100644
> --- a/drivers/iio/light/vcnl4000.c
> +++ b/drivers/iio/light/vcnl4000.c
> @@ -1545,8 +1545,13 @@ static irqreturn_t vcnl4010_irq_thread(int irq, void *p)
> isr & VCNL4010_INT_THR);
> }
>
> - if (isr & VCNL4010_INT_DRDY && iio_buffer_enabled(indio_dev))
> - iio_trigger_poll_nested(indio_dev->trig);
> + if ((isr & VCNL4010_INT_DRDY)) {
> + if (iio_buffer_enabled(indio_dev))
> + iio_trigger_poll_nested(indio_dev->trig);
> + else
> + i2c_smbus_write_byte_data(data->client, VCNL4010_ISR,
> + isr & VCNL4010_INT_DRDY);
> + }
>
> end:
> return IRQ_HANDLED;
>