devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Sa, Nuno" <Nuno.Sa@analog.com>
To: "jic23@kernel.org" <jic23@kernel.org>
Cc: "linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
	"mark.rutland@arm.com" <mark.rutland@arm.com>,
	"Ardelean, Alexandru" <alexandru.Ardelean@analog.com>,
	"pmeerw@pmeerw.net" <pmeerw@pmeerw.net>,
	"lars@metafoo.de" <lars@metafoo.de>,
	"knaack.h@gmx.de" <knaack.h@gmx.de>,
	"Hennerich, Michael" <Michael.Hennerich@analog.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>
Subject: Re: [PATCH 2/5] iio: imu: adis: Add irq mask variable
Date: Wed, 4 Mar 2020 17:29:24 +0000	[thread overview]
Message-ID: <0eb6b0373b13457ee6db321369c1d6217b6a6142.camel@analog.com> (raw)
In-Reply-To: <20200303204041.36a1bc6a@archlinux>

On Tue, 2020-03-03 at 20:40 +0000, Jonathan Cameron wrote:
> On Tue, 25 Feb 2020 13:41:49 +0100
> Nuno Sá <nuno.sa@analog.com> wrote:
> 
> > There are some ADIS devices that can configure the data ready pin
> > polarity. Hence, we cannot hardcode our IRQ mask as
> > IRQF_TRIGGER_RISING
> > since we might want to have it as IRQF_TRIGGER_FALLING.
> > 
> > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> 
> Missing docs for the addition to struct adis.
> 
> Otherwise, looks good to me.

Got it.

- Nuno Sá
> thanks,
> 
> Jonathan
> 
> > ---
> >  drivers/iio/imu/adis_trigger.c | 26 ++++++++++++++++++++++++--
> >  include/linux/iio/imu/adis.h   |  1 +
> >  2 files changed, 25 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/iio/imu/adis_trigger.c
> > b/drivers/iio/imu/adis_trigger.c
> > index a07dcc365c18..ae5a4f66752f 100644
> > --- a/drivers/iio/imu/adis_trigger.c
> > +++ b/drivers/iio/imu/adis_trigger.c
> > @@ -34,6 +34,20 @@ static inline void adis_trigger_setup(struct
> > adis *adis)
> >  	iio_trigger_set_drvdata(adis->trig, adis);
> >  }
> >  
> > +static inline int __adis_validate_irq_mask(struct adis *adis)
> > +{
> > +	if (!adis->irq_mask) {
> > +		adis->irq_mask = IRQF_TRIGGER_RISING;
> > +		return 0;
> > +	} else if (adis->irq_mask != IRQF_TRIGGER_RISING &&
> > +		   adis->irq_mask != IRQF_TRIGGER_FALLING) {
> > +		dev_err(&adis->spi->dev, "Invalid IRQ mask:%08lx\n",
> > +			adis->irq_mask);
> > +		return -EINVAL;
> > +	}
> > +
> > +	return 0;
> > +}
> >  /**
> >   * adis_probe_trigger() - Sets up trigger for a adis device
> >   * @adis: The adis device
> > @@ -54,9 +68,13 @@ int adis_probe_trigger(struct adis *adis, struct
> > iio_dev *indio_dev)
> >  
> >  	adis_trigger_setup(adis);
> >  
> > +	ret = __adis_validate_irq_mask(adis);
> > +	if (ret)
> > +		return ret;
> > +
> >  	ret = request_irq(adis->spi->irq,
> >  			  &iio_trigger_generic_data_rdy_poll,
> > -			  IRQF_TRIGGER_RISING,
> > +			  adis->irq_mask,
> >  			  indio_dev->name,
> >  			  adis->trig);
> >  	if (ret)
> > @@ -95,9 +113,13 @@ int devm_adis_probe_trigger(struct adis *adis,
> > struct iio_dev *indio_dev)
> >  
> >  	adis_trigger_setup(adis);
> >  
> > +	ret = __adis_validate_irq_mask(adis);
> > +	if (ret)
> > +		return ret;
> > +
> >  	ret = devm_request_irq(&adis->spi->dev, adis->spi->irq,
> >  			       &iio_trigger_generic_data_rdy_poll,
> > -			       IRQF_TRIGGER_RISING,
> > +			       adis->irq_mask,
> >  			       indio_dev->name,
> >  			       adis->trig);
> >  	if (ret)
> > diff --git a/include/linux/iio/imu/adis.h
> > b/include/linux/iio/imu/adis.h
> > index 741512b28aaa..b4c35d137e2a 100644
> > --- a/include/linux/iio/imu/adis.h
> > +++ b/include/linux/iio/imu/adis.h
> > @@ -84,6 +84,7 @@ struct adis {
> >  	struct spi_message	msg;
> >  	struct spi_transfer	*xfer;
> >  	unsigned int		current_page;
> > +	unsigned long		irq_mask;
> 
> This structure has kernel-doc. Please add this new element.
> 
> >  	void			*buffer;
> >  
> >  	uint8_t			tx[10] ____cacheline_aligned;


  reply	other threads:[~2020-03-04 17:29 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 12:41 [PATCH 0/5] Support ADIS16475 and similar IMUs Nuno Sá
2020-02-25 12:41 ` [PATCH 1/5] iio: imu: adis: Add Managed device functions Nuno Sá
2020-03-03 20:38   ` Jonathan Cameron
2020-03-04 17:28     ` Sa, Nuno
2020-02-25 12:41 ` [PATCH 2/5] iio: imu: adis: Add irq mask variable Nuno Sá
2020-03-03 20:40   ` Jonathan Cameron
2020-03-04 17:29     ` Sa, Nuno [this message]
2020-02-25 12:41 ` [PATCH 3/5] iio: adis: Add adis_update_bits() APIs Nuno Sá
2020-03-03 20:48   ` Jonathan Cameron
2020-03-04 17:32     ` Sa, Nuno
2020-02-25 12:41 ` [PATCH 4/5] iio: imu: Add support for adis16475 Nuno Sá
2020-03-03 21:08   ` Jonathan Cameron
2020-03-04 17:59     ` Sa, Nuno
2020-03-05  9:58       ` Sa, Nuno
2020-03-05 10:39         ` Lars-Peter Clausen
2020-03-07 11:25           ` Jonathan Cameron
2020-03-07 11:27         ` Jonathan Cameron
2020-02-25 12:41 ` [PATCH 5/5] dt-bindings: iio: Add adis16475 documentation Nuno Sá
2020-03-02 22:22   ` Rob Herring
2020-03-03  9:43     ` Sa, Nuno
2020-03-03  9:59       ` Sa, Nuno
2020-03-03 16:34         ` Rob Herring
2020-03-04 17:25           ` Sa, Nuno
2020-03-03 21:10   ` Jonathan Cameron
2020-03-04 18:00     ` Sa, Nuno
2020-03-05 10:34       ` Lars-Peter Clausen
2020-03-05 12:27         ` Sa, Nuno
2020-03-05 12:43           ` Lars-Peter Clausen
2020-03-05 13:04             ` Sa, Nuno
2020-03-07 11:33               ` Jonathan Cameron
2020-03-07 20:47                 ` nunojsa

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=0eb6b0373b13457ee6db321369c1d6217b6a6142.camel@analog.com \
    --to=nuno.sa@analog.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=alexandru.Ardelean@analog.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@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 NNTP newsgroup(s).