Re: [PATCH v1 1/2] dt-bindings: iio: adc: adding dt-bindings for PAC193X
From: Marius.Cristea
Date: Mon Mar 06 2023 - 08:53:42 EST
Hi Jonathan,
Thank you so much! I'm happy to contribute to IIO.
I will remove some section because I agree with the propose solution.
For the rest I will comment below..
On Sat, 2023-02-25 at 17:17 +0000, Jonathan Cameron wrote:
> > > +
> > > + microchip,samp-rate:
> > > + $ref: /schemas/types.yaml#/definitions/uint32
> > > + description: Sampling rate for all device's channels.
> >
> > What are the units? rate is usually in hz, which should be
> > expressed in
> > unit suffix (property name)]
>
> It's unusual for sampling rate to be a property of the hardware and
> hence
> suitable for DT binding. Normally we make this a userspace control
> instead.
> If there is a reason for doing it from DT, that wants to be mentioned
> here.
>
Here I could change it into the datarate (as in
iio/adc/ti,ads1015.yaml). The units are samples per second. My
intention was to be alingned with the datasheet.
My intention was to let the user configure the sample rate as soon as
posile during the startup (the PAC device's own power consumtion will
increase with the sampling rate - default the chip will start with the
maximum samples per second).
>
>
> >
> > > +
> > > + microchip,bi-directional:
> > > + description: Whether the channel is bi-directional.
> >
> > Describe here what is a "bi-directional" channel for ADC... Maybe
> > it is
> > obvious, maybe not. For me it is not and none of other devices have
> > it.
> >
> From datasheet this seems to be a novel description of whether the
> ADC
> is measuring just positive or allows for negative voltage as well
> (i.e.
> the current through the shut resistor is going on the other
> direction).
> Can we relate this to a biopolar / unipolar decision on a simple
> voltage ADC?
> For that we have standard DT bindings in iio/adc/adc.yaml
>
Yes, the PAC device can measure voltages as unipolar or bipolar but
also current as unidirectional or bidirectional (we are measuring the
voltage across a shunt resistor). We are also reporting power and is
not a "usual" thing to report power as unipolar or bipolar. Bi-
directional power makes more sens if you are thinking to monitor a
charge discharge cycle for a battery pack.
Thanks,
Marius