The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: "Alexandre Hamamdjian" <azkali.limited@gmail.com>,
	"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>,
	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 16:14:29 +0100	[thread overview]
Message-ID: <20260511161429.6cae5b7b@jic23-huawei> (raw)
In-Reply-To: <00855a46-20f9-4b4c-8bec-bb64d9d8efe6@gmail.com>

On Mon, 11 May 2026 13:43:56 +0300
Matti Vaittinen <mazziesaccount@gmail.com> wrote:

> On 11/05/2026 11:22, Matti Vaittinen wrote:
> > 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.  
> 
> // snip
> 
> >> +  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?  
> 
> One thing came to my mind. This 'window' -approach for lux calculation 
> is not too unique. For example the rohm-bu27034.c uses similar approach.
> 
> The thing is that some of the sensors have more than 2 channels. (For 
> example, the first version of BU27034 did. [That was BU27034NUC, which 
> got cancelled when BU27034_A_NUC emerged]). These ICs may still may use 
> similar approach of having light regions, determined by ratio of (2) 
> channels. BUT, they may then have more than 2 coefficients / window.
> 
> So, maybe this could be made generic enough so it could be re-used for 
> such devices if needed? I am not sure if other manufacturers but ROHM 
> does this in Lux computations - if yes, then it might be worth making 
> this more generic and not just a ROHM property? Maybe Jonathan has some 
> insight on other Lux computations.

It used to be very common to have multiple sensor / window setups for
ambient light sensors - though perhaps less so on more modern devices
(we have one on list today where they just say use the green channel
 of an RGB sensor - so there are more windows but not relevant to 
 illuminance measurement).

Sometimes the window bit isn't well enough described in the datasheet
so we only dealt with the parts on the actual sensor package and those
were handled in driver rather than being in dt.

What I'm not sure on here is how much of what is being described
is part of the 'chip' packaging - i.e. the bit that is constant for
all instances of this device and how much is part of the wider 
device - i.e. the laptop / phone etc window infront of the sensor.

The chip bit we shouldn't have dt, the other part we should and it
would indeed be interesting to work on a generalizing that description.

Jonathan


> 
> Yours,
> 	-- Matti
> 


  reply	other threads:[~2026-05-11 15:14 UTC|newest]

Thread overview: 14+ 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
2026-05-11 10:43     ` Matti Vaittinen
2026-05-11 15:14       ` Jonathan Cameron [this message]
2026-05-11 15:20   ` Jonathan Cameron
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-11 10:17   ` Matti Vaittinen
2026-05-11 15:50   ` Jonathan Cameron
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=20260511161429.6cae5b7b@jic23-huawei \
    --to=jic23@kernel.org \
    --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=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --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