Re: [PATCH v5 4/4] iio: adc: update ad7779 to use IIO backend

From: Andy Shevchenko
Date: Mon Aug 25 2025 - 09:58:41 EST


On Mon, Aug 25, 2025 at 01:51:19PM +0300, Ioana Risteiu wrote:
> Add a new functionality to ad7779 driver that streams data through data
> output interface using IIO backend interface.

...

> +static int ad7779_set_data_lines(struct iio_dev *indio_dev, u32 num_lanes)
> +{
> + struct ad7779_state *st = iio_priv(indio_dev);
> + int ret;
> +
> + if (num_lanes != AD7779_1LINE &&
> + num_lanes != AD7779_2LINES &&
> + num_lanes != AD7779_4LINES)

Wrong indentation.

> + return -EINVAL;
> +
> + ret = ad7779_set_sampling_frequency(st, num_lanes * AD7779_DEFAULT_SAMPLING_1LINE);
> + if (ret)
> + return ret;
> +
> + ret = iio_backend_num_lanes_set(st->back, num_lanes);
> + if (ret)
> + return ret;
> +
> + return ad7779_spi_write_mask(st, AD7779_REG_DOUT_FORMAT,
> + AD7779_DOUT_FORMAT_MSK,
> + FIELD_PREP(AD7779_DOUT_FORMAT_MSK, 2 - ilog2(num_lanes)));
> +}

...

> +static int ad7779_setup_channels(struct iio_dev *indio_dev, const struct ad7779_state *st)
> +{
> + struct iio_chan_spec *channels;
> + struct device *dev = &st->spi->dev;
> +
> + channels = devm_kmemdup_array(dev, st->chip_info->channels,
> + ARRAY_SIZE(ad7779_channels),
> + sizeof(*channels), GFP_KERNEL);
> + if (!channels)
> + return -ENOMEM;
> +
> + for (unsigned int i = 0; i < ARRAY_SIZE(ad7779_channels); i++)
> + channels[i].scan_type.endianness = IIO_CPU;
> +
> + indio_dev->channels = channels;

So, here I expect to see num_channels assignment as well as near to any other
channels assignment.

> +
> + return 0;
> +}

Otherwise LGTM.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>

--
With Best Regards,
Andy Shevchenko