Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Nuno Sa <nuno.sa@analog.com>
Cc: <linux-iio@vger.kernel.org>, Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Renato Lui Geh <renatogeh@gmail.com>,
	Fabrizio Lamarque <fl.scratchpad@gmail.com>
Subject: Re: [PATCH 2/2] iio: adc: ad_sigma_delta: allow overwriting the IRQ flags
Date: Sun, 21 Jan 2024 16:22:56 +0000	[thread overview]
Message-ID: <20240121162256.08918bb4@jic23-huawei> (raw)
In-Reply-To: <20240117-dev_sigma_delta_no_irq_flags-v1-2-db39261592cf@analog.com>

On Wed, 17 Jan 2024 13:41:04 +0100
Nuno Sa <nuno.sa@analog.com> wrote:

> Make sure we can specify the IRQ trigger type from firmware and drivers
> won't ignore it. In fact, this how it should be done but since someone
> might be already depending on the driver to hardcode the trigger type
> (and not specifying it in firmware), let's do it like this so there's
> no possible breakage.
> 
> Signed-off-by: Nuno Sa <nuno.sa@analog.com>
I'm going to treat this as adding increased flexibility rather than a fix. Hence
Applied to the togreg branch of iio.git and pushed out as testing.
Will be rebased on rc1 once available.

Thanks,

Jonathan

> ---
>  drivers/iio/adc/ad_sigma_delta.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/iio/adc/ad_sigma_delta.c b/drivers/iio/adc/ad_sigma_delta.c
> index 7e2192870743..fbba3f4a1189 100644
> --- a/drivers/iio/adc/ad_sigma_delta.c
> +++ b/drivers/iio/adc/ad_sigma_delta.c
> @@ -568,6 +568,7 @@ EXPORT_SYMBOL_NS_GPL(ad_sd_validate_trigger, IIO_AD_SIGMA_DELTA);
>  static int devm_ad_sd_probe_trigger(struct device *dev, struct iio_dev *indio_dev)
>  {
>  	struct ad_sigma_delta *sigma_delta = iio_device_get_drvdata(indio_dev);
> +	unsigned long irq_flags = irq_get_trigger_type(sigma_delta->spi->irq);
>  	int ret;
>  
>  	if (dev != &sigma_delta->spi->dev) {
> @@ -588,9 +589,13 @@ static int devm_ad_sd_probe_trigger(struct device *dev, struct iio_dev *indio_de
>  	/* the IRQ core clears IRQ_DISABLE_UNLAZY flag when freeing an IRQ */
>  	irq_set_status_flags(sigma_delta->spi->irq, IRQ_DISABLE_UNLAZY);
>  
> +	/* Allow overwriting the flags from firmware */
> +	if (!irq_flags)
> +		irq_flags = sigma_delta->info->irq_flags;
> +
>  	ret = devm_request_irq(dev, sigma_delta->spi->irq,
>  			       ad_sd_data_rdy_trig_poll,
> -			       sigma_delta->info->irq_flags | IRQF_NO_AUTOEN,
> +			       irq_flags | IRQF_NO_AUTOEN,
>  			       indio_dev->name,
>  			       sigma_delta);
>  	if (ret)
> 


      reply	other threads:[~2024-01-21 16:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-17 12:41 [PATCH 0/2] iio: adc: ad_sigma_delta: misc fixes/improvements Nuno Sa
2024-01-17 12:41 ` [PATCH 1/2] iio: adc: ad_sigma_delta: ensure proper DMA alignment Nuno Sa
2024-01-21 16:19   ` Jonathan Cameron
2024-01-17 12:41 ` [PATCH 2/2] iio: adc: ad_sigma_delta: allow overwriting the IRQ flags Nuno Sa
2024-01-21 16:22   ` Jonathan Cameron [this message]

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=20240121162256.08918bb4@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=fl.scratchpad@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=renatogeh@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