devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Liam Beguin <liambeguin@gmail.com>
Cc: peda@axentia.se, lars@metafoo.de, pmeerw@pmeerw.net,
	linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
	devicetree@vger.kernel.org, robh+dt@kernel.org
Subject: Re: [PATCH v2 8/8] dt-bindings: iio: afe: add binding for temperature-sense-amplifier
Date: Wed, 9 Jun 2021 21:52:14 +0100	[thread overview]
Message-ID: <20210609215214.7e3be504@jic23-huawei> (raw)
In-Reply-To: <20210607144718.1724413-9-liambeguin@gmail.com>

On Mon,  7 Jun 2021 10:47:18 -0400
Liam Beguin <liambeguin@gmail.com> wrote:

> From: Liam Beguin <lvb@xiphos.com>
> 
> An ADC is often used to measure other quantities indirectly. This
> binding describe such a use case, the measurement of a temperature
> through an analog front end connected to a voltage channel.
> 
> Signed-off-by: Liam Beguin <lvb@xiphos.com>
> ---
>  .../iio/afe/temperature-sense-amplifier.yaml  | 57 +++++++++++++++++++
>  MAINTAINERS                                   |  1 +
>  2 files changed, 58 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/afe/temperature-sense-amplifier.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/afe/temperature-sense-amplifier.yaml b/Documentation/devicetree/bindings/iio/afe/temperature-sense-amplifier.yaml
> new file mode 100644
> index 000000000000..08f97f052a91
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/afe/temperature-sense-amplifier.yaml
> @@ -0,0 +1,57 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/afe/temperature-sense-amplifier.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Temperature Sense Amplifier
> +
> +maintainers:
> +  - Liam Beguin <lvb@xiphos.com>
> +
> +description: |
> +  When an io-channel measures the output voltage of a temperature analog front
> +  end such as an RTD (resistance thermometer) or a temperature to current
> +  sensor, the interesting measurement is almost always the corresponding
> +  temperature, not the voltage output. This binding describes such a circuit.

Perhaps add something about this only covering the linear cases...

> +
> +properties:
> +  compatible:
> +    const: temperature-sense-amplifier
> +
> +  io-channels:
> +    maxItems: 1
> +    description: |
> +      Channel node of a voltage io-channel.
> +
> +  '#io-channel-cells':
> +    const: 1
> +
> +  sense-gain-mult:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Amplifier gain multiplier. The default is <1>.
> +
> +  sense-gain-div:
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    description: Amplifier gain divider. The default is <1>.
> +
> +  sense-offset-millicelsius:
> +    description: Amplifier offset. The default is <0>.

Whilst it may seem obvious I'd like to see a statement of
how these are used somewhere in here.

   temp_celcius = voltage * gain-mult / gain-div + offset

Mainly because those familiar with the IIO usage of offset
would expect
(voltage + offset) * gain-mult/gain-div 

which doesn't make sense for this device but might leave
people confused!

> +
> +additionalProperties: false
> +required:
> +  - compatible
> +  - io-channels
> +
> +examples:
> +  - |
> +    pt1000_1: temperature-sensor {
> +        compatible = "temperature-sense-amplifier";
> +        #io-channel-cells = <1>;
> +        io-channels = <&temp_adc 3>;
> +
> +        sense-gain-mult = <1000000>;
> +        sense-gain-div = <3908>;
> +        sense-offset-millicelsius = <(-255885)>;
> +    };
> +...
> diff --git a/MAINTAINERS b/MAINTAINERS
> index e679d422b472..4f7b4ee9f19b 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -8887,6 +8887,7 @@ L:	linux-iio@vger.kernel.org
>  S:	Maintained
>  F:	Documentation/devicetree/bindings/iio/afe/current-sense-amplifier.yaml
>  F:	Documentation/devicetree/bindings/iio/afe/current-sense-shunt.yaml
> +F:	Documentation/devicetree/bindings/iio/afe/temperature-sense-amplifier.yaml
>  F:	Documentation/devicetree/bindings/iio/afe/voltage-divider.yaml
>  F:	drivers/iio/afe/iio-rescale.c
>  


  reply	other threads:[~2021-06-09 20:50 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-07 14:47 [PATCH v2 0/8] iio: afe: add temperature rescaling support Liam Beguin
2021-06-07 14:47 ` [PATCH v2 1/8] iio: inkern: apply consumer scale on IIO_VAL_INT cases Liam Beguin
2021-06-07 14:47 ` [PATCH v2 2/8] iio: inkern: apply consumer scale when no channel scale is available Liam Beguin
2021-06-07 14:47 ` [PATCH v2 3/8] iio: inkern: error out on unsupported offset type Liam Beguin
2021-06-09 20:28   ` Jonathan Cameron
2021-06-09 21:40     ` Liam Beguin
2021-06-10  9:06       ` Jonathan Cameron
2021-06-10 20:42         ` Peter Rosin
2021-06-07 14:47 ` [PATCH v2 4/8] iio: inkern: return valid type on raw to processed conversion Liam Beguin
2021-06-09 20:32   ` Jonathan Cameron
2021-06-09 21:46     ` Liam Beguin
2021-06-10  9:08       ` Jonathan Cameron
2021-06-07 14:47 ` [PATCH v2 5/8] iio: afe: rescale: add upstream offset support Liam Beguin
2021-06-07 14:47 ` [PATCH v2 6/8] iio: afe: rescale: add " Liam Beguin
2021-06-07 14:47 ` [PATCH v2 7/8] iio: afe: rescale: add temperature sensor support Liam Beguin
2021-06-10 21:23   ` Peter Rosin
2021-06-07 14:47 ` [PATCH v2 8/8] dt-bindings: iio: afe: add binding for temperature-sense-amplifier Liam Beguin
2021-06-09 20:52   ` Jonathan Cameron [this message]
2021-06-09 21:50     ` Liam Beguin
2021-06-11  7:37   ` Peter Rosin
2021-06-11 16:12     ` Liam Beguin

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=20210609215214.7e3be504@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lars@metafoo.de \
    --cc=liambeguin@gmail.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peda@axentia.se \
    --cc=pmeerw@pmeerw.net \
    --cc=robh+dt@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).