Linux IIO development
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: "Alexandre Hamamdjian" <azkali.limited@gmail.com>,
	"Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>, CTCaer <ctcaer@gmail.com>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] dt-bindings: iio: light: Add ROHM BH1730FVC binding
Date: Mon, 11 May 2026 11:22:16 +0300	[thread overview]
Message-ID: <92e2d1ab-c973-45a2-b0c4-d7c672c610e0@gmail.com> (raw)
In-Reply-To: <20260511-bh1730-v1-1-e0df1f499135@gmail.com>

Thanks for patches Alexandre!

It's nice to see these upstreamed :)

On 10/05/2026 21:09, Alexandre Hamamdjian wrote:
> From: CTCaer <ctcaer@gmail.com>
> 
> Add a YAML binding for the ROHM BH1730FVC ambient light sensor.
> Documents the required compatible string, the als-vdd/als-vid
> regulators, and the rohm,integration-cycle, rohm,lux-multiplier,
> rohm,opt-win-coeff and rohm,gain-coeff calibration properties
> consumed by the driver.
> 
> Signed-off-by: CTCaer <ctcaer@gmail.com>
> Signed-off-by: Alexandre Hamamdjian <azkali.limited@gmail.com>
> ---
>   .../bindings/iio/light/rohm,bh1730fvc.yaml         | 95 ++++++++++++++++++++++
>   1 file changed, 95 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/iio/light/rohm,bh1730fvc.yaml b/Documentation/devicetree/bindings/iio/light/rohm,bh1730fvc.yaml
> new file mode 100644
> index 000000000000..6273b69e82ab
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/light/rohm,bh1730fvc.yaml
> @@ -0,0 +1,95 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/light/rohm,bh1730fvc.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: ROHM BH1730FVC ambient light sensor
> +
> +maintainers:
> +  - CTCaer <ctcaer@gmail.com>
> +
> +description:
> +  Digital 16-bit ambient light sensor with an I2C interface. The device has
> +  two photodiodes (visible and infrared) and supports four gain settings and
> +  programmable integration time.
> +
> +properties:
> +  compatible:
> +    const: rohm,bh1730fvc
> +
> +  reg:
> +    maxItems: 1
> +
> +  als-vdd-supply:
> +    description: Regulator for the analog/digital supply (VDD).
> +
> +  als-vid-supply:
> +    description: Regulator for the LED indicator supply (VID).
> +
> +  rohm,integration-cycle:
> +    description:
> +      Number of internal clock cycles used for the ADC integration time.
> +      Used together with rohm,lux-multiplier to calibrate the lux output.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +  rohm,lux-multiplier:
> +    description:
> +      Lux scaling multiplier applied after integration. Used together with
> +      rohm,integration-cycle to calibrate the lux output.
> +    $ref: /schemas/types.yaml#/definitions/uint32
> +
> +  rohm,opt-win-coeff:
> +    description:
> +      Optical-window calibration coefficients. Specified as a flat list of
> +      triplets <rc cv ci>, one triplet per window region, where rc is the
> +      visible/IR ratio cutoff and cv/ci are the visible and IR weighting
> +      factors used in that region.
> +    $ref: /schemas/types.yaml#/definitions/uint32-matrix
> +    items:
> +      minItems: 3
> +      maxItems: 3

I am not sure if I read the driver patch (2/2) correctly, but if I did, 
then these coefficients are used to compute Luxes out of the raw sensor 
data. I believe it would help anyone integrating (or investigating) this 
sensor, if you added the actual formula here as a comment. If I read 
this right, the formula is _somehting_ like:


Lx = (cv[win] * ch0_data - ci[win] * ch1_data) / gain / int_time

Here the cv[win] and ci[win] are selected from the opt-win-coeff -table, 
depending on the measured ch1_data/ch0_data ratio, right?

> +  rohm,gain-coeff:
> +    description:
> +      Per-gain sensitivity coefficients. Eight u32 values arranged as four
> +      <cl fl> pairs, one pair for each supported gain (1x, 2x, 64x, 128x).
> +    $ref: /schemas/types.yaml#/definitions/uint32-array
> +    minItems: 8
> +    maxItems: 8

Is the gain-coeff only used as a saturation limit for increasing or 
decreasing the gain? Are they just raw channel values?

> +
> +required:
> +  - compatible
> +  - reg

I will leave this to other reviewers, but I would guess the sensor does 
always require vdd?

> +dependencies:
> +  rohm,integration-cycle: ['rohm,lux-multiplier']
> +  rohm,lux-multiplier: ['rohm,integration-cycle']
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        light-sensor@29 {
> +            compatible = "rohm,bh1730fvc";
> +            reg = <0x29>;
> +            als-vdd-supply = <&vdd_als>;
> +            als-vid-supply = <&vid_als>;
> +            rohm,integration-cycle = <38>;
> +            rohm,lux-multiplier = <1000>;
> +            rohm,opt-win-coeff = <260 1290 2733>,
> +                                 <550 795 859>,
> +                                 <1090 510 345>,
> +                                 <2130 276 130>;
> +            rohm,gain-coeff = <3000 0xffffffff
> +                               2000 9800
> +                               15 60000
> +                               0 1300>;
> +        };
> +    };
> +
> +...
> 


-- 
---
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland

~~ When things go utterly wrong vim users can always type :help! ~~

  reply	other threads:[~2026-05-11  8:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-10 18:09 [PATCH 0/2] iio: light: Add ROHM BH1730FVC ambient light sensor driver Alexandre Hamamdjian via B4 Relay
2026-05-10 18:09 ` [PATCH 1/2] dt-bindings: iio: light: Add ROHM BH1730FVC binding Alexandre Hamamdjian via B4 Relay
2026-05-11  8:22   ` Matti Vaittinen [this message]
2026-05-10 18:09 ` [PATCH 2/2] iio: light: bh1730: Add bh1730 light sensor driver Alexandre Hamamdjian via B4 Relay
2026-05-10 18:18   ` Andy Shevchenko
2026-05-10 18:20     ` Andy Shevchenko
     [not found]       ` <CAL5cOWuXAD7+rJEKB9FjnwdCjoUJK+WNKXZXt8tfnq1WLmv5eg@mail.gmail.com>
2026-05-11  7:31         ` Andy Shevchenko
2026-05-11  8:26       ` Matti Vaittinen
2026-05-10 18:13 ` [PATCH 0/2] iio: light: Add ROHM BH1730FVC ambient " Andy Shevchenko

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=92e2d1ab-c973-45a2-b0c4-d7c672c610e0@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=andy@kernel.org \
    --cc=azkali.limited@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=ctcaer@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --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