Linux-IIO Archive mirror
 help / color / mirror / Atom feed
From: Markus Burri <markus.burri@mt.com>
To: linux-kernel@vger.kernel.org
Cc: Markus Burri <markus.burri@mt.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	linux-iio@vger.kernel.org
Subject: [PATCH v1] iio: adc: ad_sigma_delta: Clear pending interrupts before enable
Date: Thu,  4 Apr 2024 19:51:26 +0200	[thread overview]
Message-ID: <20240404175126.110208-1-markus.burri@mt.com> (raw)

For device will enable and disable irq contiously like AD7195,
it use DOUT/RDY pin for both SPI transfer and data ready.
It will disable irq during SPI transfer, and re-eanble irq after SPI transfer.
That may cause irq status bit set to 1 during spi transfer.

When the active condition has been detected, the corresponding bit
remains set until cleared by software. Status flags are cleared
by writing a 1 to the corresponding bit position.

Signed-off-by: Markus Burri <markus.burri@mt.com>
---
 drivers/iio/adc/ad_sigma_delta.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c
index a602429cdde4..59544c39642a 100644
--- a/drivers/iio/adc/ad_sigma_delta.c
+++ b/drivers/iio/adc/ad_sigma_delta.c
@@ -515,6 +515,10 @@ static irqreturn_t ad_sd_trigger_handler(int irq, void *p)
 
 irq_handled:
 	iio_trigger_notify_done(indio_dev->trig);
+	/*
+	 * ACK pending interrupts from spi transfer.
+	 */
+	irq_gc_ack_set_bit(irq_get_irq_data(sigma_delta->spi->irq));
 	sigma_delta->irq_dis = false;
 	enable_irq(sigma_delta->spi->irq);
 
-- 
2.39.2


             reply	other threads:[~2024-04-04 17:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-04 17:51 Markus Burri [this message]
2024-04-06 16:17 ` [PATCH v1] iio: adc: ad_sigma_delta: Clear pending interrupts before enable Jonathan Cameron
2024-04-08  8:31   ` Nuno Sá
2024-04-13 15:56     ` Jonathan Cameron

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=20240404175126.110208-1-markus.burri@mt.com \
    --to=markus.burri@mt.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).