From: Jonathan Cameron <jic23@kernel.org>
To: Tsz Shan Chan <tsz.chan.dev@gmail.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"Tsz Shan Chan" <tchan@jacques.com.au>
Subject: Re: [PATCH v3 2/5] iio: light: vcnl4000: clear DRDY interrupt when buffer disabled
Date: Sun, 6 Sep 2026 19:18:39 +0100 [thread overview]
Message-ID: <20260906191839.406f435c@jic23-huawei> (raw)
In-Reply-To: <20260903-vcnl4000-v3-2-5e69c2e715a8@jacques.com.au>
On Thu, 03 Sep 2026 14:53:47 +1000
Tsz Shan Chan <tsz.chan.dev@gmail.com> 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@jacques.com.au>
> ---
> 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;
>
next prev parent reply other threads:[~2026-09-06 18:18 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-03 4:53 [PATCH v3 0/5] iio: light: vcnl4000: support shared IRQs Tsz Shan Chan
2026-09-03 4:53 ` [PATCH v3 1/5] iio: light: vcnl4000: use correct channel array size Tsz Shan Chan
2026-09-03 7:55 ` Andy Shevchenko
2026-09-03 4:53 ` [PATCH v3 2/5] iio: light: vcnl4000: clear DRDY interrupt when buffer disabled Tsz Shan Chan
2026-09-03 7:55 ` Andy Shevchenko
2026-09-06 18:18 ` Jonathan Cameron [this message]
2026-09-03 4:53 ` [PATCH v3 3/5] iio: light: vcnl4000: refactor interrupt config functions Tsz Shan Chan
2026-09-03 4:53 ` [PATCH v3 4/5] iio: light: vcnl4000: Add IRQ disable callback on cleanup Tsz Shan Chan
2026-09-03 8:03 ` Andy Shevchenko
2026-09-06 18:41 ` Jonathan Cameron
2026-09-03 4:53 ` [PATCH v3 5/5] iio: light: vcnl4000: add shared IRQ support Tsz Shan Chan
2026-09-03 8:07 ` Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260906191839.406f435c@jic23-huawei \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=tchan@jacques.com.au \
--cc=tsz.chan.dev@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®