From: Chang Yu <marcus.yu.56@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Joshua Crofts" <joshua.crofts1@gmail.com>,
"Chang Yu" <marcus.yu.56@gmail.com>,
"Andy Shevchenko" <andy@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] iio: light: add AS7343 multi-spectral sensor driver
Date: Sun, 6 Sep 2026 23:36:43 -0700 [thread overview]
Message-ID: <ap5be0ipNiS5lUI5@gmail.com> (raw)
In-Reply-To: <20260906011145.4a0f4933@jic23-huawei>
Hi Jonathan and Joshua,
Thanks for the thorough review. Just adding some clarifying comments inline
for what I plan to do in v2. I should be able to send over v2 within a few
business days.
On Sun, Sep 06, 2026 at 01:11:45AM +0100, Jonathan Cameron wrote:
> On Sat, 5 Sep 2026 08:42:58 +0200
> Joshua Crofts <joshua.crofts1@gmail.com> wrote:
>
> > Hi Chang,
> >
> > Comments inline.
> >
> > Josh
> >
> > On Fri, 4 Sep 2026 22:53:26 -0700
> > Chang Yu <marcus.yu.56@gmail.com> wrote:
> >
> > > This patch adds a driver for the AMS AS7343 14-channel multi-spectral
> > > sensor with I2C interface.
>
> ...
>
> > > +
> > > + /* Set 83.4ms integration time and x64 gain for now */
> >
> > Good for an initial draft, however you'll definitely have to
> > implement the write function for this to get merged into mainline.
> > Skimming the datasheet shows that there are more integration times
> > possible, not to mention that you can also set the gain etc.
>
> If there is a sensible default / initial value that works most of the time
> (short value probably to avoid saturation) then controlling this isn't
> a requirement for merge. It's a nice to have though!
I'll defer controlling integration/gain to future patches then. x256
gain and 50.1ms integration test are the defaults recommended by the
datasheet. It is also what adafruit uses in their arduino driver
(https://github.com/adafruit/Adafruit_AS7343/blob/main/Adafruit_AS7343.cpp).
They also seem to work well enough when I was testing on hardware.
So I'll use those values in v2 for now.
>
> ...
>
> > > +
> > > +static int as7343_suspend(struct device *dev)
> > > +{
> > > + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> > > + struct as7343_data *data = iio_priv(indio_dev);
> > > +
> > > + return regmap_clear_bits(data->regmap, AS7343_REG_ENABLE,
> > > + AS7343_ENABLE_SP_EN);
> > > +}
> > > +
> > > +static int as7343_resume(struct device *dev)
> > > +{
> > > + struct iio_dev *indio_dev = i2c_get_clientdata(to_i2c_client(dev));
> > > + struct as7343_data *data = iio_priv(indio_dev);
> > > +
> > > + return regmap_set_bits(data->regmap, AS7343_REG_ENABLE,
> > > + AS7343_ENABLE_SP_EN);
> > > +}
> > > +
> >
> > You have suspend/resume functions, yet you're missing a
> > devm_pm_runtime_enable() in probe.
>
> There is not requirement to do any specific combination of power management
> for an IIO driver because what is necessary is very dependent on the usecase
> a particular developer has. So runtime pm is a nice to have only (as is the
> suspend / resume stuff we have here). May well make sense to use the same
> for both types (there are macros to ensure that).
>
> > Additionally, you could enable
> > the autosuspend function as well (note, you'll have to wake the
> > device before reading, there are macros that simplify this though,
> > see PM_RUNTIME_ACQUIRE_AUTOSUSPEND)
>
> All nice to haves indeed - but not strictly necessary. Many drivers
> don't go that far initially and it is fairly easy to retrofit this stuff
> if someone cares.
>
I'll fix up the suspend/resume stuff per Joshua's comments. But I'll
defer autosuspend to future patches. I'll mention this in the v2 patch as well.
Best,
Chang
next prev parent reply other threads:[~2026-09-07 6:36 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-05 5:53 [PATCH 0/2] Add support for AS7343 multi-spectral sensor Chang Yu
2026-09-05 5:53 ` [PATCH 1/2] dt-bindings: iio: light: add as7343 Chang Yu
2026-09-05 7:23 ` Krzysztof Kozlowski
2026-09-06 0:30 ` Jonathan Cameron
2026-09-05 5:53 ` [PATCH 2/2] iio: light: add AS7343 multi-spectral sensor driver Chang Yu
2026-09-05 6:42 ` Joshua Crofts
2026-09-06 0:11 ` Jonathan Cameron
2026-09-07 6:36 ` Chang Yu [this message]
2026-09-06 0:30 ` Jonathan Cameron
2026-09-07 6:51 ` Chang Yu
2026-09-05 7:51 ` [PATCH 0/2] Add support for AS7343 multi-spectral sensor Andy Shevchenko
2026-09-05 23:40 ` 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=ap5be0ipNiS5lUI5@gmail.com \
--to=marcus.yu.56@gmail.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=joshua.crofts1@gmail.com \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nuno.sa@analog.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
all inboxes | Powered by JetHome®