Re: [PATCH v6 2/2] iio: light: add AS7343 multi-spectral sensor driver
From: Andy Shevchenko
Date: Tue Oct 13 2026 - 15:24:26 EST
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.
> + */
...
> +static int as7343_read_label(struct iio_dev *indio_dev,
> + struct iio_chan_spec const *chan, char *label)
> +{
> + int channel;
> +
> + channel = chan->channel;
> + if (channel < 0 || channel >= ARRAY_SIZE(as7343_channel_labels))
in_range()?
> + return -EINVAL;
-ECHRNG ?
> + return sysfs_emit(label, "%s\n", as7343_channel_labels[channel]);
> +}
...
> + /*
> + * Setting a 600 * 2.78us * 30 = 50ms integration time as the default
> + * for now.
Where magic 600 came from? Please, elaborate in the comment.
> + */
> + ret = as7343_astep_x2780ns(600, &astep);
> + if (ret)
> + return ret;
--
With Best Regards,
Andy Shevchenko