Re: [PATCH 1/2] dt-bindings: Document TI OPT4001 light sensor bindings

From: Jonathan Cameron
Date: Fri Apr 07 2023 - 13:43:48 EST


On Tue, 4 Apr 2023 11:07:42 +0200
Stefan Windfeldt-Prytz <stefan.windfeldt-prytz@xxxxxxxx> wrote:

> Add devicetree bindings for opt4001 ambient light sensor.
>
> Signed-off-by: Stefan Windfeldt-Prytz <stefan.windfeldt-prytz@xxxxxxxx>

Hi Stefan,

Please add the VDD regulator and interrupt pin to the DT binding.
Whilst the driver might not use them, the binding should describe the device
fully anyway both so that we can potentially enable control of the regulator
and use of interrupt in Linux and because other software picks up these
bindings and might need them.

The regulator is easy to handle in the driver now we have
devm_regulator_get_enable() so that probably is worth supporting from the start
even if your board has it hard wired on.

Thanks,

Jonathan

> ---
> .../devicetree/bindings/iio/light/ti,opt4001.yaml | 42 ++++++++++++++++++++++
> 1 file changed, 42 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iio/light/ti,opt4001.yaml b/Documentation/devicetree/bindings/iio/light/ti,opt4001.yaml
> new file mode 100644
> index 000000000000..cfd6b8b92c17
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/light/ti,opt4001.yaml
> @@ -0,0 +1,42 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/light/ti,opt4001.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Texas Instruments OPT4001 Ambient Light Sensor
> +
> +maintainers:
> + - Stefan Windfeldt-Prytz <stefan.windfeldt-prytz@xxxxxxxx>
> +
> +description: |
> + Ambient light sensor with an i2c interface.
> + https://www.ti.com/lit/gpn/opt4001
> +
> +properties:
> + compatible:
> + enum:
> + - ti,opt4001-picostar
> + - ti,opt4001-sot-5x3
> +
> + reg:
> + maxItems: 1
> +
> +additionalProperties: false
> +
> +required:
> + - compatible
> + - reg
> +
> +examples:
> + - |
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + light-sensor@44 {
> + compatible = "ti,opt4001-picostar";
> + reg = <0x44>;
> + };
> + };
> +...
>