From: Chang Yu <marcus.yu.56@gmail.com>
To: "Jose A. Perez de Azpillaga" <azpijr@gmail.com>
Cc: "Chang Yu" <marcus.yu.56@gmail.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Shi Hao" <i.shihao.999@gmail.com>,
"Joshua Crofts" <joshua.crofts1@gmail.com>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 2/2] iio: light: add AS7343 multi-spectral sensor driver
Date: Thu, 24 Sep 2026 17:52:00 -0700 [thread overview]
Message-ID: <arXFsPr9gmjLXMYR@gmail.com> (raw)
In-Reply-To: <arWccqy8YlLJxeWA@gmail.com>
On Fri, Sep 25, 2026 at 12:02:34AM +0200, Jose A. Perez de Azpillaga wrote:
> On Sat, Sep 19, 2026 at 04:51:45PM -0700, Chang Yu wrote:
> > +static int as7343_read_raw(struct iio_dev *indio_dev,
> > + struct iio_chan_spec const *chan,
> > + int *val, int *val2, long mask)
> > +{
> > + struct as7343_data *data = iio_priv(indio_dev);
> > + struct regmap *map = data->regmap;
> > + struct device *dev = regmap_get_device(map);
> > + unsigned int unused;
> > + __le16 result;
> > + int ret;
> > +
> > + PM_RUNTIME_ACQUIRE_AUTOSUSPEND(dev, pm);
> > + ret = PM_RUNTIME_ACQUIRE_ERR(&pm);
> > + if (ret)
> > + return ret;
> > +
> > + switch (mask) {
> > + case IIO_CHAN_INFO_RAW: {
> > + /* Wait until integration time passes for all 3 cycles. */
> > + msleep(160);
>
> three integration periods hardcoded next to a hardcoded integration
> time, so nothing keeps them in sync. make ATIME/ASTEP writable and the
> fixed wait no longer covers a readout. as73211, which this is based on,
> computes the timeout and polls NDATA. STATUS2 (0x90) bit 6 is AVALID is
> defined and never read, does it cover all three cycles? the datasheet
> does not say.
>
Configurable ATIME/ASTEP will be added in future patches since I want to
keep the initial driver lean. I'll switch to dynamically computing wait
time in those patches. For now I'm inclined to leave the value hardcoded
just to keep things simple.
The documentation on AVALID is indeed pretty poorly worded and unclear.
I'll test on hardware when I have time and see if it covers all three.
I think it's fine even if AVALID turns out to be unreliable? Worst case
scenario the userspace reads a stale value, which is OK for my use case
at least.
prev parent reply other threads:[~2026-09-25 0:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-19 23:51 [PATCH v5 0/2] Add support for AS7343 multi-spectral sensor Chang Yu
2026-09-19 23:51 ` [PATCH v5 1/2] dt-bindings: iio: light: add as7343 Chang Yu
2026-09-20 0:26 ` Jonathan Cameron
2026-09-19 23:51 ` [PATCH v5 2/2] iio: light: add AS7343 multi-spectral sensor driver Chang Yu
2026-09-20 0:26 ` Jonathan Cameron
2026-09-21 4:21 ` Chang Yu
2026-09-24 18:22 ` Andy Shevchenko
2026-09-24 22:02 ` Jose A. Perez de Azpillaga
2026-09-25 0:52 ` Chang Yu [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=arXFsPr9gmjLXMYR@gmail.com \
--to=marcus.yu.56@gmail.com \
--cc=andy@kernel.org \
--cc=azpijr@gmail.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=i.shihao.999@gmail.com \
--cc=jic23@kernel.org \
--cc=joshua.crofts1@gmail.com \
--cc=krzk+dt@kernel.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
all inboxes | Powered by JetHome®