From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Sean Nyekjaer <sean@geanix.com>
Cc: <jic23@kernel.org>, <linux-iio@vger.kernel.org>,
<andy.shevchenko@gmail.com>, <lars@metafoo.de>,
<Nuno.Sa@analog.com>, <robh+dt@kernel.org>,
<devicetree@vger.kernel.org>
Subject: Re: [PATCH v3 1/2] iio: accel: add support for FXLS8962AF/FXLS8964AF accelerometers
Date: Wed, 28 Apr 2021 14:59:32 +0100 [thread overview]
Message-ID: <20210428145932.000022db@Huawei.com> (raw)
In-Reply-To: <9b42101e-a48e-d01e-4cd3-51f5ebfcf7d7@geanix.com>
On Wed, 28 Apr 2021 13:34:01 +0200
Sean Nyekjaer <sean@geanix.com> wrote:
> On 28/04/2021 10.01, Sean Nyekjaer wrote:
> > |static int fxls8962af_read_raw(struct iio_dev *indio_dev, + struct
> > iio_chan_spec const *chan, + int *val, int *val2, long mask) +{ +
> > struct fxls8962af_data *data = iio_priv(indio_dev); + int ret; + +
> > switch (mask) { + case IIO_CHAN_INFO_RAW: + ret =
> > iio_device_claim_direct_mode(indio_dev); + if (ret) + return ret; + +
> > switch (chan->type) { + case IIO_TEMP: + ret =
> > fxls8962af_get_temp(data, val); + break; + case IIO_ACCEL: + ret =
> > fxls8962af_get_axis(data, chan, val); + break; + default: + ret =
> > -EINVAL; + } + + iio_device_release_direct_mode(indio_dev); + return ret;|
> |Maybe I should remove iio_device_claim_direct_mode() and release(),
> there is actually nothing in the datasheet that block us from reading
> temp and raw
> axis data with streaming enabled to the internal fifo.
> We have a use-case for reading temperature data while streaming
> accelerometer data.
>
> Could I just check for ||iio_buffer_enabled||() and skip the drdy and
> power_on/off in
> ||fxls8962af_get_temp() and ||fxls8962af_get_axis()||?
Absolutely fine to have these enabled whilst doing fifo accesses as
long as they don't changing timing etc (they do on some devices).
Sounds like you'd need to reference count power_on / off rather than
basing it on whether the buffer is enabled (to avoid a race condition).
I think runtime pm should handle that for you anyway.
>
> /Sean
> |
next prev parent reply other threads:[~2021-04-28 14:01 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-28 8:01 [PATCH v3 1/2] iio: accel: add support for FXLS8962AF/FXLS8964AF accelerometers Sean Nyekjaer
2021-04-28 8:01 ` [PATCH v3 2/2] dt-bindings: iio: accel: fxls8962af: add bindings Sean Nyekjaer
2021-04-28 11:34 ` [PATCH v3 1/2] iio: accel: add support for FXLS8962AF/FXLS8964AF accelerometers Sean Nyekjaer
2021-04-28 13:59 ` Jonathan Cameron [this message]
2021-04-28 14:19 ` Jonathan Cameron
2021-04-29 5:53 ` Sean Nyekjaer
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=20210428145932.000022db@Huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=Nuno.Sa@analog.com \
--cc=andy.shevchenko@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=sean@geanix.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;
as well as URLs for NNTP newsgroup(s).