Re: [PATCH v10 8/8] iio: adc: ad4851: add ad485x driver

From: David Lechner
Date: Sat Jan 18 2025 - 12:09:25 EST


On 1/18/25 10:57 AM, Jonathan Cameron wrote:
> On Fri, 17 Jan 2025 15:45:35 -0600
> David Lechner <dlechner@xxxxxxxxxxxx> wrote:
>
>> On 1/17/25 7:07 AM, Antoniu Miclaus wrote:

...

>>> + if (fwnode_property_present(child, "diff-channels")) {
>>> + *channels = ad4851_chan_diff;
>>> + channels->scan_index = index++;
>>> + channels->channel = reg;
>>> + channels->channel2 = reg;
>>
>> Typically we don't set channel == channel2 for differential channels.
> So i guess this is tripping up on these being dedicated pairs labelled
> +IN1,-IN1 on the datasheet. The binding documents those as matching
> the diff-channels - hence both channels and reg are the same.
> So maybe best bet is to enforce that in the driver by checking it is
> true.

Are you saying that in_voltage0-voltage0_raw in userspace is OK?

>
> It is a slightly weird description but only alternative would be to
> invent some more channel numbers for the negative sides which is
> less than ideal. We could go that way though.
>
> Some comments alongside a sanity check is probably the best way to
> handle this and no surprise us in the future.
>