On Sat, Apr 13, 2024 at 10:13 AM Alisa-Dariana Roman
<alisadariana@xxxxxxxxx> wrote:
Unlike the other AD719Xs, AD7194 has configurable differential
channels. The user can dynamically configure them in the devicetree.
Also modify config AD7192 description for better scaling.
Moved ad7192_chip_info struct definition to allow use of callback
function parse_channels().
It looks like this no longer needs to be moved in this revision.
Signed-off-by: Alisa-Dariana Roman <alisa.roman@xxxxxxxxxx>
---
drivers/iio/adc/Kconfig | 11 ++-
drivers/iio/adc/ad7192.c | 140 ++++++++++++++++++++++++++++++++++++---
2 files changed, 138 insertions(+), 13 deletions(-)
+ if (!ad7194_channels)
+ return -ENOMEM;
+
+ indio_dev->channels = ad7194_channels;
+ indio_dev->num_channels = num_channels;
+
+ device_for_each_child_node(dev, child) {
+ *ad7194_channels = ad7194_chan_diff;
+ ad7194_channels->scan_index = index++;
+ ret = ad7192_parse_channel(child, ad7194_channels);
+ if (ret) {
+ fwnode_handle_put(child);
+ return ret;
+ }
+ ad7194_channels++;
+ }
+
+ *ad7194_channels = ad7194_chan_temp;
+ ad7194_channels->scan_index = index++;
+ ad7194_channels->address = AD7194_CH_TEMP;
+ ad7194_channels++;
nit: It would seem more natural to have all voltage channels
altogether rather than having the temperature channel in between.