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

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

 



On 4/14/24 3:14 PM, Alisa-Dariana Roman wrote:
> On 13.04.2024 23:05, David Lechner wrote:
>> 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.
> 
> I wrote the channels like this to match the other chips:
> 
> static const struct iio_chan_spec ad7193_channels[] = {
>     AD7193_DIFF_CHANNEL(0, 1, 2, AD7193_CH_AIN1P_AIN2M),
>     AD7193_DIFF_CHANNEL(1, 3, 4, AD7193_CH_AIN3P_AIN4M),
>     AD7193_DIFF_CHANNEL(2, 5, 6, AD7193_CH_AIN5P_AIN6M),
>     AD7193_DIFF_CHANNEL(3, 7, 8, AD7193_CH_AIN7P_AIN8M),
>     AD719x_TEMP_CHANNEL(4, AD7193_CH_TEMP),
>     AD7193_DIFF_CHANNEL(5, 2, 2, AD7193_CH_AIN2P_AIN2M),
>     AD7193_CHANNEL(6, 1, AD7193_CH_AIN1),
>     AD7193_CHANNEL(7, 2, AD7193_CH_AIN2),
>     AD7193_CHANNEL(8, 3, AD7193_CH_AIN3),
>     AD7193_CHANNEL(9, 4, AD7193_CH_AIN4),
>     AD7193_CHANNEL(10, 5, AD7193_CH_AIN5),
>     AD7193_CHANNEL(11, 6, AD7193_CH_AIN6),
>     AD7193_CHANNEL(12, 7, AD7193_CH_AIN7),
>     AD7193_CHANNEL(13, 8, AD7193_CH_AIN8),
>     IIO_CHAN_SOFT_TIMESTAMP(14),
> };
> 
> Kind regards,
> Alisa-Dariana Roman
> 

Consistency is good too. ;-)






[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