Re: [PATCH v6 2/2] iio: light: add AS7343 multi-spectral sensor driver
From: Chang Yu
Date: Tue Oct 13 2026 - 23:18:48 EST
On Tue, Oct 13, 2026 at 07:27:42PM +0300, Andy Shevchenko wrote:
> On Tue, Oct 13, 2026 at 07:56:39PM +0800, Chang Yu wrote:
> > Add a driver for the AMS AS7343 14-channel multi-spectral sensor.
> >
> > The AS7343 is a 14-channel spectral sensor featuring 11 visible
> > channels, 1 near-infrared channel, 1 clear channel (VIS), and 1
> > flicker detection channel.
> >
> > The driver exposes 12 spectral channels (11 visible light and 1
> > near-infrared) via sysfs. Runtime PM is implemented to stop
> > measurements when the device is suspended or torn down. Power is
> > never cut (PON=1 always) to preserve register values.
> >
> > Future patches will add configurable gain and integration time,
> > interrupt support, buffered reads, VIS channel, and flicker
> > detection.
>
> ...
>
> > +/*
> > + * Integration time is calculated as (ATIME + 1) * ((ASTEP + 1) * 2.78us).
> > + * ATIME must be between 0 and 255, inclusive
> > + * ASTEP must be between 0 and 65534, inclusive
>
> Haven't noticed before, but is it indeed 65534 and not 65535 here (or 255 and
> not 254 above)? Haven't checked datasheet, please double check.
>
Per the datasheet 0 <= ASTEP <= 65534 (65535 was explicitly marked as "do not
use"), and since ASTEP = n - 1, we have 1 <= n <= 65535. Similary
0 <= ATIME <= 255, ATIME = step - 1, so 1 <= step <= 256.
So I think the numbers here are correct.