Re: [PATCH v6 7/9] iio: adc: stm32-dfsdm: adopt generic channels bindings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 30 Jul 2024 10:46:37 +0200
Olivier Moysan <olivier.moysan@xxxxxxxxxxx> wrote:

> Move to generic channels binding to ease new backend framework adoption
> and prepare the convergence with MDF IP support on STM32MP2 SoC family.
> 
> Legacy binding:
> DFSDM is an IIO channel consumer.
> SD modulator is an IIO channels provider.
> The channel phandles are provided in DT through io-channels property
> and channel indexes through st,adc-channels property.
> 
> New binding:
> DFSDM is an IIO channel provider.
> The channel indexes are given by reg property in channel child node.
> 
> This new binding is intended to be used with SD modulator IIO backends.
> It does not support SD modulator legacy IIO devices.
> The st,adc-channels property presence is used to discriminate
> between legacy and backend bindings.
> 
> The support of the DFSDM legacy channels and SD modulator IIO devices
> is kept for backward compatibility.
> 
> Signed-off-by: Olivier Moysan <olivier.moysan@xxxxxxxxxxx>

One trivial thing noted inline.  If you spin a v7 for other reasons
tidy it up, if not I 'might' (if I remember and can be bothered)
tweak it whilst applying, but probably not.

Jonathan

>  
> +static int stm32_dfsdm_chan_init(struct iio_dev *indio_dev, struct iio_chan_spec *channels)
> +{
> +	int num_ch = indio_dev->num_channels;
> +	int chan_idx = 0;
> +	int ret;
> +
> +	for (chan_idx = 0; chan_idx < num_ch; chan_idx++) {
> +		channels[chan_idx].scan_index = chan_idx;
> +		ret = stm32_dfsdm_adc_chan_init_one(indio_dev, &channels[chan_idx], NULL);
> +		if (ret < 0)
> +			return dev_err_probe(&indio_dev->dev, ret, "Channels init failed\n");
> +	}
> +
> +	return 0;
> +}
> +
> +static int stm32_dfsdm_generic_chan_init(struct iio_dev *indio_dev, struct iio_chan_spec *channels)
> +{
> +	int chan_idx = 0, ret;

As in the above function, I'd have slightly preferred these on separate lines.
If that's all that comes up, I might tweak it whilst applying.

> +
> +	device_for_each_child_node_scoped(&indio_dev->dev, child) {
> +		/* Skip DAI node in DFSDM audio nodes */
> +		if (fwnode_property_present(child, "compatible"))
> +			continue;
> +
> +		channels[chan_idx].scan_index = chan_idx;
> +		ret = stm32_dfsdm_adc_chan_init_one(indio_dev, &channels[chan_idx], child);
> +		if (ret < 0)
> +			return dev_err_probe(&indio_dev->dev, ret, "Channels init failed\n");
> +
> +		chan_idx++;
> +	}
> +
> +	return chan_idx;
> +}
> +




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux