From: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
To: linux-kernel@vger.kernel.org, jic23@kernel.org,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
conor+dt@kernel.org, krzysztof.kozlowski+dt@linaro.org,
robh@kernel.org, nuno.sa@analog.com
Cc: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
Subject: [PATCH v3 7/9] iio: imu: adis_trigger: Allow level interrupts
Date: Fri, 17 May 2024 10:47:48 +0300 [thread overview]
Message-ID: <20240517074750.87376-8-ramona.bolboaca13@gmail.com> (raw)
In-Reply-To: <20240517074750.87376-1-ramona.bolboaca13@gmail.com>
Currently, adis library allows configuration only for edge interrupts,
needed for data ready sampling.
This patch removes the restriction for level interrupts, which are
needed to handle FIFO watermark interrupts.
Furthermore, in case of level interrupts, devm_request_threaded_irq is
used for interrupt allocation, to avoid blocking the processor while
retrieving the FIFO samples.
Signed-off-by: Ramona Gradinariu <ramona.bolboaca13@gmail.com>
---
changes in v3:
- new patch
drivers/iio/imu/adis_trigger.c | 39 ++++++++++++++++++----------------
1 file changed, 21 insertions(+), 18 deletions(-)
diff --git a/drivers/iio/imu/adis_trigger.c b/drivers/iio/imu/adis_trigger.c
index f890bf842db8..becf1f558b4e 100644
--- a/drivers/iio/imu/adis_trigger.c
+++ b/drivers/iio/imu/adis_trigger.c
@@ -34,21 +34,16 @@ static int adis_validate_irq_flag(struct adis *adis)
if (adis->data->unmasked_drdy)
adis->irq_flag |= IRQF_NO_AUTOEN;
/*
- * Typically this devices have data ready either on the rising edge or
- * on the falling edge of the data ready pin. This checks enforces that
- * one of those is set in the drivers... It defaults to
- * IRQF_TRIGGER_RISING for backward compatibility with devices that
- * don't support changing the pin polarity.
+ * Typically adis devices without fifo have data ready either on the
+ * rising edge or on the falling edge of the data ready pin.
+ * IMU devices with fifo support have the watermark pin level driven
+ * either high or low when the fifo is filled with the desired number
+ * of samples.
+ * It defaults to IRQF_TRIGGER_RISING for backward compatibility with
+ * devices that don't support changing the pin polarity.
*/
- if (direction == IRQF_TRIGGER_NONE) {
+ if (direction == IRQF_TRIGGER_NONE)
adis->irq_flag |= IRQF_TRIGGER_RISING;
- return 0;
- } else if (direction != IRQF_TRIGGER_RISING &&
- direction != IRQF_TRIGGER_FALLING) {
- dev_err(&adis->spi->dev, "Invalid IRQ mask: %08lx\n",
- adis->irq_flag);
- return -EINVAL;
- }
return 0;
}
@@ -77,11 +72,19 @@ int devm_adis_probe_trigger(struct adis *adis, struct iio_dev *indio_dev)
if (ret)
return ret;
- ret = devm_request_irq(&adis->spi->dev, adis->spi->irq,
- &iio_trigger_generic_data_rdy_poll,
- adis->irq_flag,
- indio_dev->name,
- adis->trig);
+ if (adis->irq_flag & (IRQF_TRIGGER_HIGH | IRQF_TRIGGER_LOW))
+ ret = devm_request_threaded_irq(&adis->spi->dev, adis->spi->irq,
+ NULL,
+ &iio_trigger_generic_data_rdy_poll,
+ adis->irq_flag | IRQF_ONESHOT,
+ indio_dev->name,
+ adis->trig);
+ else
+ ret = devm_request_irq(&adis->spi->dev, adis->spi->irq,
+ &iio_trigger_generic_data_rdy_poll,
+ adis->irq_flag,
+ indio_dev->name,
+ adis->trig);
if (ret)
return ret;
--
2.34.1
next prev parent reply other threads:[~2024-05-17 7:48 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-17 7:47 [PATCH v3 0/9] adis16501 and adis1657x support Ramona Gradinariu
2024-05-17 7:47 ` [PATCH v3 1/9] dt-bindings: iio: imu: Add ADIS16501 compatibles Ramona Gradinariu
2024-05-17 7:47 ` [PATCH v3 2/9] drivers: iio: imu: Add support for ADIS16501 Ramona Gradinariu
2024-05-17 7:47 ` [PATCH v3 3/9] iio: imu: adis16475: Re-define ADIS16475_DATA Ramona Gradinariu
2024-05-17 7:47 ` [PATCH v3 4/9] iio: imu: adis_buffer: Add buffer setup API with buffer attributes Ramona Gradinariu
2024-05-17 7:47 ` [PATCH v3 5/9] iio: imu: adis16475: Create push single sample API Ramona Gradinariu
2024-05-17 7:47 ` [PATCH v3 6/9] drivers: iio: imu: adis16475: generic computation for sample rate Ramona Gradinariu
2024-05-17 7:47 ` Ramona Gradinariu [this message]
2024-05-19 18:35 ` [PATCH v3 7/9] iio: imu: adis_trigger: Allow level interrupts Jonathan Cameron
2024-05-21 10:56 ` Nuno Sá
2024-05-17 7:47 ` [PATCH v3 8/9] dt-bindings: iio: imu: Add ADIS1657X family devices compatibles Ramona Gradinariu
2024-05-17 7:47 ` [PATCH v3 9/9] drivers: iio: imu: Add support for adis1657x family Ramona Gradinariu
2024-05-18 6:47 ` kernel test robot
2024-05-19 18:38 ` Jonathan Cameron
2024-05-18 11:00 ` kernel test robot
2024-05-19 18:57 ` Jonathan Cameron
2024-05-21 7:01 ` Nuno Sá
2024-05-22 9:51 ` Ramona Gradinariu
2024-05-23 17:11 ` 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=20240517074750.87376-8-ramona.bolboaca13@gmail.com \
--to=ramona.bolboaca13@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.com \
--cc=robh@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