Re: [PATCH 3/3] iio: adc: ad7192: Add AD7194 support

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

 



On Sun, Nov 05, 2023 at 09:31:31PM +0200, alisadariana@xxxxxxxxx wrote:
> From: Alisa-Dariana Roman <alisa.roman@xxxxxxxxxx>
> 
> Unlike the other AD719Xs, AD7194 has configurable differential
> channels. The default configuration for these channels can be changed
> from the devicetree.
> 
> The default configuration is hardcoded in order to have a stable number
> of channels.

...

>  config AD7192
> -	tristate "Analog Devices AD7190 AD7192 AD7193 AD7195 ADC driver"
> +	tristate "Analog Devices AD7190 AD7192 AD7193 AD7194 AD7195 ADC driver"

This doesn't scale. Please change this and below like:

	tristate "Analog Devices AD719x ADC driver"

>  	depends on SPI
>  	select AD_SIGMA_DELTA
>  	help
>  	  Say yes here to build support for Analog Devices AD7190,
> -	  AD7192, AD7193 or AD7195 SPI analog to digital converters (ADC).
> +	  AD7192, AD7193, AD7194 or AD7195 SPI analog to digital converters (ADC).

	  Say yes here to build support for Analog Devices SPI analog to
	  digital converters (ADC):
	  - AD7190
	  - AD7192
	  - AD7193
	  - AD7194
	  - AD7195

>  	  If unsure, say N (but it's safe to say "Y").

With above change adding a new one will be just a mater of adding a single
line.

...

> +static int ad7192_parse_channel(struct iio_dev *indio_dev,
> +				struct fwnode_handle *child)
> +{
> +	u32 reg, ain[2];
> +	int ret;
> +
> +	ret = fwnode_property_read_u32(child, "reg", &reg);
> +	if (ret)
> +		return ret;

> +	if (reg < AD7194_CH_DIFF_NR_MIN || reg > AD7194_CH_DIFF_NR_MAX)
> +		return -EINVAL;

in_range()


> +	ret = fwnode_property_read_u32_array(child, "diff-channels", ain,
> +					     ARRAY_SIZE(ain));
> +	if (ret)
> +		return ret;
> +
> +	if (ain[0] < AD7194_CH_AIN_MIN || ain[0] > AD7194_CH_AIN_MAX ||
> +	    ain[1] < AD7194_CH_AIN_MIN || ain[1] > AD7194_CH_AIN_MAX)

Ditto.

> +		return -EINVAL;
> +
> +	ad7194_channels[reg].channel = ain[0];
> +	ad7194_channels[reg].channel2 = ain[1];
> +	ad7194_channels[reg].address = AD7194_CH_DIFF(ain[0], ain[1]);
> +
> +	return 0;
> +}

-- 
With Best Regards,
Andy Shevchenko






[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux