[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aEdGhYOJ36IcZFW7@debian-BULLSEYE-live-builder-AMD64>
Date: Mon, 9 Jun 2025 17:39:33 -0300
From: Marcelo Schmitt <marcelo.schmitt1@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: Marcelo Schmitt <marcelo.schmitt@...log.com>, linux-iio@...r.kernel.org,
devicetree@...r.kernel.org, linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org, lars@...afoo.de,
Michael.Hennerich@...log.com, dlechner@...libre.com,
nuno.sa@...log.com, andy@...nel.org, robh@...nel.org,
krzk+dt@...nel.org, conor+dt@...nel.org, linus.walleij@...aro.org,
brgl@...ev.pl
Subject: Re: [PATCH v4 06/11] iio: adc: ad4170: Add support for buffered data
capture
...
> > diff --git a/drivers/iio/adc/ad4170.c b/drivers/iio/adc/ad4170.c
> > index 3d83c3ace569..86ef70acbf21 100644
> > --- a/drivers/iio/adc/ad4170.c
> > +++ b/drivers/iio/adc/ad4170.c
> > @@ -13,7 +13,11 @@
>
> > +static bool ad4170_validate_scan_mask(struct iio_dev *indio_dev,
> > + const unsigned long *scan_mask)
> > +{
> > + unsigned int masklength = iio_get_masklength(indio_dev);
>
> If this becomes a useability issue we could probably generative appropriate
> available_scan_masks entries and let the demuxer in the IIO core deal with
> dropping the unwanted first channel. That might be preferable to just
> failing if the channel isn't enabled.
Yes, we can do that. I also think that would probably be the preferred way from
the user's perspective. Though, that tinkering may result in a few more tens of
lines of code, which I'm reluctant to add, given the size of this set.
>
> As a general rule, I think we've always used validate_scan_mask
> to prevent too many channels being turned on, or incompatible sets of channels
> rather than to prevent too few being enabled.
>
> Anyhow that would be a relaxation of constraints so can be done if it
> turns out to be needed later.
>
Added to my list of patch ideas :)
> > +
> > + /*
> > + * The channel sequencer cycles through the enabled channels in
> > + * sequential order, from channel 0 to channel 15, bypassing disabled
> > + * channels. When more than one channel is enabled, channel 0 must
> > + * always be enabled. See datasheet channel_en register description at
> > + * page 95.
> > + */
> > + if (bitmap_weight(scan_mask, masklength) > 1)
> > + return test_bit(0, scan_mask);
> > +
> > + return bitmap_weight(scan_mask, masklength) == 1;
> > +}
Powered by blists - more mailing lists