Re: [PATCH v2 05/16] iio: adc: max1027: Minimize the number of converted channels

From: Miquel Raynal
Date: Wed Sep 15 2021 - 05:46:53 EST


Hi Jonathan,

jic23@xxxxxxxxxx wrote on Sun, 5 Sep 2021 16:34:06 +0100:

> On Thu, 2 Sep 2021 23:14:26 +0200
> Miquel Raynal <miquel.raynal@xxxxxxxxxxx> wrote:
>
> > Provide a list of ->available_scan_masks which match the device's
> > capabilities. Basically, the devices is able to scan from 0 to N, N
> > being the highest voltage channel requested by the user. The temperature
> > can be included or not, but cannot be retrieved alone.
> >
> > The consequence is, instead of reading and pushing to the IIO buffers
> > all channels each time, the "minimum" number of channels will be scanned
> > and pushed based on the ->active_scan_mask.
> >
> > For example, if the user wants channels 1, 4 and 5, all channels from
> > 0 to 5 will be scanned and pushed to the IIO buffers. The core will then
> > filter out the unneeded samples based on the ->active_scan_mask that has
> > been selected and only channels 1, 4 and 5 will be available to the user
> > in the shared buffer.
>
> This explanation is excellent. If you are respinning it would be great
> to have the essence of it as a comment alongside the code.
> The bit about temp in particular was something I'd missed.

No problem, I'll add a comment inline as well.

> Nice optimization in general.

Thanks!

> Jonathan
>

Best regards,
Miquèl