Re: [PATCH v7 09/17] iio: adc: ad7768: Configure channel sampling profiles
From: Andy Shevchenko
Date: Fri Sep 11 2026 - 12:49:42 EST
On Thu, Sep 10, 2026 at 07:36:27PM +0200, Janani Sunil wrote:
> At buffered capture setup, select the fastest compatible power mode for
> the enabled channel rates. Group channels into the two hardware mode
> profiles and program their decimation, mode selection, and data clock.
...
> + /*
> + * The output data rate ranges overlap between the power modes. At a
> + * common ODR, the faster mode has lower noise, so prefer the fastest
> + * mode that supports every enabled channel.
> + */
> + while (mode_idx--) {
> + bool supported = true;
Unneeded.
> + unsigned int channel;
> + for_each_set_bit(channel, scan_mask,
> + st->chip_info->num_channels) {
Make it a single line (83 characters, yes).
> + if (!ad7768_find_freq_config(st, mode_idx,
> + st->ch_freq[channel])) {
> + supported = false;
> + break;
> + }
> + }
> + if (supported)
> + return ad7768_set_power_mode(st, mode_idx);
/* No channel found with the requested frequency configuration */
if (channel == st->chip_info->num_channels)
> + }
--
With Best Regards,
Andy Shevchenko