From: Jonathan Cameron <jic23@kernel.org>
To: Herve Codina <herve.codina@bootlin.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
Rob Herring <robh@kernel.org>,
Krzysztof Kozlowski <krzk+dt@kernel.org>,
Conor Dooley <conor+dt@kernel.org>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
Luca Ceresoli <luca.ceresoli@bootlin.com>,
Ian Ray <ian.ray@gehealthcare.com>,
Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH 3/4] iio: adc: Add support for the GE HealthCare PMC ADC
Date: Sun, 6 Oct 2024 12:15:06 +0100 [thread overview]
Message-ID: <20241006121506.3fcfda93@jic23-huawei> (raw)
In-Reply-To: <20241002102324.2e3600ca@bootlin.com>
On Wed, 2 Oct 2024 10:23:24 +0200
Herve Codina <herve.codina@bootlin.com> wrote:
> Hi Jonathan,
>
> On Tue, 1 Oct 2024 20:24:30 +0100
> Jonathan Cameron <jic23@kernel.org> wrote:
>
> > On Tue, 1 Oct 2024 09:46:17 +0200
> > Herve Codina <herve.codina@bootlin.com> wrote:
> >
> > > The GE HealthCare PMC Analog to Digital Converter (ADC) is a 16-Channel
> > > (voltage and current), 16-Bit ADC with an I2C Interface.
> > >
> > > Signed-off-by: Herve Codina <herve.codina@bootlin.com>
> >
> > Just one thing to add to David's review.
> >
> > I'm going to guess this isn't a general purpose ADC? Can you share any info
> > on what sort of device it is used in?
> >
> > No problem if not - I'm just curious as I've not seen GE HealthCare I2C parts
> > before!
>
> I cannot tell about the product it is used in :(
> One sure thing I can say is that the component itself is not available off
> the shelf, and is fully designed to be used in a specific product.
>
> >
> > > diff --git a/drivers/iio/adc/gehc-pmc-adc.c b/drivers/iio/adc/gehc-pmc-adc.c
> > > new file mode 100644
> > > index 000000000000..c46c2fb84d35
> > > --- /dev/null
> > > +++ b/drivers/iio/adc/gehc-pmc-adc.c
> > > @@ -0,0 +1,233 @@
> >
> >
> > > +
> > > +static int pmc_adc_read_raw(struct iio_dev *indio_dev, struct iio_chan_spec const *chan,
> > > + int *val, int *val2, long mask)
> > > +{
> > > + struct pmc_adc *pmc_adc = iio_priv(indio_dev);
> > > + int ret;
> > > +
> > > + switch (mask) {
> > > + case IIO_CHAN_INFO_RAW:
> > > + ret = pmc_adc_read_raw_ch(pmc_adc, chan->address, val);
> > > + if (ret)
> > > + return ret;
> > > + return IIO_VAL_INT;
> > > +
> > > + case IIO_CHAN_INFO_SCALE:
> > > + *val = 1; /* Raw values are directly read in mV or mA */
> >
> > Drop this scale and make the channels processed. That saves userspace even applying
>
> I thought that scale was mandatory.
>
> From the userspace, offset is clearly optional
> https://elixir.bootlin.com/linux/v6.11/source/Documentation/ABI/testing/sysfs-bus-iio#L458
> But nothing about a default value is mentioned in the scale description
> https://elixir.bootlin.com/linux/v6.11/source/Documentation/ABI/testing/sysfs-bus-iio#L515
It doesn't get applied to _PROCESSED attributes (see ABI for _input attributes which
simply doesn't say to apply anything.
There is a corner case where _OFFSET is provided but not _SCALE and hence the channel
is _RAW. In that case I'd say _SCALE is optional, but I'm not sure we've ever seen
it in reality! The more common case (though still rare) is like this one where
the reading is in the base units of the ABI so _input is the away to go.
This is fairly ancient ABI lifted from hwmon.
>
> > the *1 this indicates. Rare to find a device that outputs in our base units
> > but might as well take advantage of one that does :)
>
> Yes, the device is a custom designed device and it has a fully knowledge (by
> design) of the board it is soldered on. As I was involved in the communication
> protocol definition, units were chosen to fit well with IIO.
Nice :)
>
> >
> > > + return IIO_VAL_INT;
> > > + }
> > > +
> > > + return -EINVAL;
> > > +}
>
> Best regards,
> Hervé
next prev parent reply other threads:[~2024-10-06 11:15 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-01 7:46 [PATCH 0/4] Add support for the GE HealthCare PMC ADC Herve Codina
2024-10-01 7:46 ` [PATCH 1/4] dt-bindings: vendor-prefixes: Add an entry for GE HealthCare Herve Codina
2024-10-01 16:31 ` Conor Dooley
2024-10-01 7:46 ` [PATCH 2/4] dt-bindings: iio: adc: Add the GE HealthCare PMC ADC Herve Codina
2024-10-01 16:18 ` Conor Dooley
2024-10-01 16:46 ` Herve Codina
2024-10-01 17:03 ` Conor Dooley
2024-10-02 7:04 ` Herve Codina
2024-10-02 14:53 ` Conor Dooley
2024-10-01 7:46 ` [PATCH 3/4] iio: adc: Add support for " Herve Codina
2024-10-01 17:19 ` David Lechner
2024-10-02 7:37 ` Herve Codina
2024-10-01 19:24 ` Jonathan Cameron
2024-10-02 8:23 ` Herve Codina
2024-10-06 11:15 ` Jonathan Cameron [this message]
2024-10-01 7:46 ` [PATCH 4/4] MAINTAINERS: add the GE HealthCare PMC ADC driver entry Herve Codina
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241006121506.3fcfda93@jic23-huawei \
--to=jic23@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=herve.codina@bootlin.com \
--cc=ian.ray@gehealthcare.com \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luca.ceresoli@bootlin.com \
--cc=robh@kernel.org \
--cc=thomas.petazzoni@bootlin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox