[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZUi_kWzZBMRBs3EU@smile.fi.intel.com>
Date: Mon, 6 Nov 2023 12:27:29 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: alisadariana@...il.com
Cc: Alisa-Dariana Roman <alisa.roman@...log.com>,
Alexandru Tachici <alexandru.tachici@...log.com>,
Lars-Peter Clausen <lars@...afoo.de>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Jonathan Cameron <jic23@...nel.org>,
Rob Herring <robh+dt@...nel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Maksim Kiselev <bigunclemax@...il.com>,
Arnd Bergmann <arnd@...db.de>,
Cosmin Tanislav <demonsingur@...il.com>,
Okan Sahin <okan.sahin@...log.com>,
Ibrahim Tilki <Ibrahim.Tilki@...log.com>,
Marius Cristea <marius.cristea@...rochip.com>,
ChiaEn Wu <chiaen_wu@...htek.com>,
Marcus Folkesson <marcus.folkesson@...il.com>,
Niklas Schnelle <schnelle@...ux.ibm.com>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/3] iio: adc: ad7192: Add AD7194 support
On Sun, Nov 05, 2023 at 09:31:31PM +0200, alisadariana@...il.com wrote:
> From: Alisa-Dariana Roman <alisa.roman@...log.com>
>
> 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", ®);
> + 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
Powered by blists - more mailing lists