public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Jan Kiszka <jan.kiszka@siemens.com>
Cc: linux-iio@vger.kernel.org, Rob Herring <robh@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor+dt@kernel.org>,
	linux-kernel@vger.kernel.org,
	Bao Cheng Su <baocheng.su@siemens.com>,
	Chao Zeng <chao.zeng@siemens.com>,
	devicetree@vger.kernel.org
Subject: Re: [PATCH 2/3] dt-bindings: iio: Add everlight pm16d17 binding
Date: Wed, 14 Aug 2024 20:10:29 +0100	[thread overview]
Message-ID: <20240814200946.59bd8435@jic23-huawei> (raw)
In-Reply-To: <f6476e06cd8d1cf3aff6563530612c536cd45716.1723527641.git.jan.kiszka@siemens.com>

On Tue, 13 Aug 2024 07:40:41 +0200
Jan Kiszka <jan.kiszka@siemens.com> wrote:

> From: Chao Zeng <chao.zeng@siemens.com>
> 
> Add the binding document for the everlight pm16d17 sensor.
> 
> Signed-off-by: Chao Zeng <chao.zeng@siemens.com>
> Co-developed-by: Baocheng Su <baocheng.su@siemens.com>
> Signed-off-by: Baocheng Su <baocheng.su@siemens.com>
hi Jan,

From a first read at least, almost everything in here
is stuff we should be controlling from the driver, not
providing as fixed values from firmware.

Specific comments inline.

Jonathan

> ---
>  .../iio/proximity/everlight,pm16d17.yaml      | 95 +++++++++++++++++++
>  1 file changed, 95 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/iio/proximity/everlight,pm16d17.yaml
> 
> diff --git a/Documentation/devicetree/bindings/iio/proximity/everlight,pm16d17.yaml b/Documentation/devicetree/bindings/iio/proximity/everlight,pm16d17.yaml
> new file mode 100644
> index 000000000000..fadc3075181a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/proximity/everlight,pm16d17.yaml
> @@ -0,0 +1,95 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/proximity/everlight,pm16d17.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Everlight PM-16D17 Ambient Light & Proximity Sensor
> +
> +maintainers:
> +  - Chao Zeng <chao.zeng@siemens.com>
> +
> +description: |
> +  This sensor uses standard I2C interface. Interrupt function is not covered.
> +  Datasheet: https://en.everlight.com/sensor/category-proximity_sensor/digital_proximity_sensor/
> +
> +properties:
> +  compatible:
> +    enum:
> +      - everlight,pm16d17
> +
> +  reg:
> +    maxItems: 1
> +
> +  ps-gain:
> +    description: Receiver gain of proximity sensor
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [1, 2, 4, 8]
> +    default: 1

This should I think be a userspace control.
Given it's not related to proximity as such, probably 
in_proximity0_hardwaregain

> +
> +  ps-itime:
> +    description: Conversion time for proximity sensor [ms]
> +    $ref: /schemas/types.yaml#/definitions/string
> +    enum:
> +      - "0.4"
> +      - "0.8"
> +      - "1.6"
> +      - "3.2"
> +      - "6.3"
> +      - "12.6"
> +      - "25.2"
> +    default: "0.4"
Definitely a userspace control.  Is this actually integration time
which we'd expect to affect the hardwaregain or is it just
1/ frequency of sampling (with fixed integration time).
Looking at datasheet it's coupled to resolution which may
make this oversampling related. Hard to tell.

> +
> +  ps-wtime:
> +    description: Waiting time for proximity sensor [ms]
I guess the above was the integration time and this sets
the sampling_frequency.  In that case definitely a userspace
thing, doesn't belong in DT.

> +    $ref: /schemas/types.yaml#/definitions/string
> +    enum:
> +      - "12.5"
> +      - "25"
> +      - "50"
> +      - "100"
> +      - "200"
> +      - "400"
> +      - "800"
> +      - "1600"
> +    default: "12.5"
> +
> +  ps-ir-led-pulse-count:
> +    description: IR LED drive pulse count

This needs more information.  Why would this be changed?
Seems from datasheet that this is effectively a different
form of gain. Why would we choose one rather than the other?
Or are they both ways of increasing the overall sensitivity?

> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    minimum: 1
> +    maximum: 256
> +    default: 1
> +
> +  ps-offset-cancel:
> +    description: |
> +      When PS offset cancel function is enabled, the result of subtracting any
> +      value specified by the PS offset cancel register from the internal PS
> +      output data is written to the PS output data register.
That sounds like a calibbias userspace control, but more info needed.

> +    $ref: /schemas/types.yaml#/definitions/uint32
> +    default: 0
> +    maximum: 65535
> +
As Conor mentioned, need to describe the hardware as fully as possible so interrupts
and power supplies (even if they are always on for your particular board)

> +required:
> +  - compatible
> +  - reg
> +
> +unevaluatedProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        lightsensor: pm16d17@44 {
> +            compatible = "everlight,pm16d17";
> +            reg = <0x44>;
> +
> +            ps-gain = <1>;
> +            ps-itime = "0.4";
> +            ps-wtime = "12.5";
> +            ps-ir-led-pulse-count = <1>;
> +            ps-offset-cancel = <280>;
> +        };
> +    };


  parent reply	other threads:[~2024-08-14 19:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-13  5:40 [PATCH 0/3] iio: Add Everlight PM16D17 proximity sensor Jan Kiszka
2024-08-13  5:40 ` [PATCH 1/3] dt-bindings: vendor-prefixes: Add EVERLIGHT Jan Kiszka
2024-08-13 15:41   ` Conor Dooley
2024-08-13 15:46     ` Krzysztof Kozlowski
2024-08-13 15:53       ` Conor Dooley
2024-08-13  5:40 ` [PATCH 2/3] dt-bindings: iio: Add everlight pm16d17 binding Jan Kiszka
2024-08-13 15:52   ` Conor Dooley
2024-08-16  1:48     ` Li, Hua Qian
2024-08-16 16:11       ` Conor Dooley
2024-08-17 13:42       ` Jonathan Cameron
2024-08-26  7:12         ` Li, Hua Qian
2024-08-26  9:49           ` Jonathan Cameron
2024-08-14 19:10   ` Jonathan Cameron [this message]
2024-08-15  8:13     ` Jan Kiszka
2024-08-13  5:40 ` [PATCH 3/3] iio: proximity: Add support for everlight pmd16d17 sensor Jan Kiszka
2024-08-15  5:51   ` kernel test robot
2024-08-15 21:54   ` kernel test robot
2024-08-17 14:02   ` Jonathan Cameron

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=20240814200946.59bd8435@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=baocheng.su@siemens.com \
    --cc=chao.zeng@siemens.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=jan.kiszka@siemens.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robh@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