From: Andreas Klinger <ak@it-klinger.de>
To: Jonathan Cameron <jic23@kernel.org>,
Matti Vaittinen <mazziesaccount@gmail.com>
Cc: robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org,
lars@metafoo.de, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
javier.carrasco.cruz@gmail.com, subhajit.ghosh@tweaklogic.com,
muditsharma.info@gmail.com, arthur.becker@sentec.com,
ivan.orlov0322@gmail.com
Subject: Re: [PATCH 2/3] iio: light: add support for veml6046x00 RGBIR color sensor
Date: Mon, 5 May 2025 21:10:21 +0200 [thread overview]
Message-ID: <aBkNHSxU4T8j4oMT@mail.your-server.de> (raw)
In-Reply-To: <ecb2844c-feb5-47d4-b4db-12171380a9cb@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3419 bytes --]
Hi Jonathan,
hi Matti,
Matti Vaittinen <mazziesaccount@gmail.com> schrieb am Mo, 07. Apr 08:52:
> On 06/04/2025 14:08, Jonathan Cameron wrote:
> > On Sun, 6 Apr 2025 10:43:23 +0200
> > Andreas Klinger <ak@it-klinger.de> wrote:
> >
> > > Hi Jonathan,
> > >
> > > I need to pick up the meaning of scale once again for clarification.
> > >
> > > Jonathan Cameron <jic23@kernel.org> schrieb am Mo, 17. Mär 11:50:
> > > > On Sun, 16 Mar 2025 12:31:30 +0100
> > > > Andreas Klinger <ak@it-klinger.de> wrote:
> > > > > +static int veml6046x00_get_scale(struct veml6046x00_data *data,
> > > > > + int *val, int *val2)
> > > >
> > > > How is this related to integration time? I'd normally expect
> > > > to see that read in here somewhere as well as doubling integration
> > > > time tends to double scale.
> > >
> > > In the documentation file "sysfs-bus-iio" it says:
> > > "
> > > What: /sys/.../iio:deviceX/in_illuminanceY_raw
> > > [...]
> > > Description:
> > > Illuminance measurement, units after application of scale
> > > and offset are lux.
> > > "
> > >
> > > This means that the scale should be the real factor and not the gain multiplied
> > > by photodiode size (PDDIV) as i implemented it so far.
> > >
> > > This means also that doubling integration time should halve the scale. The
> > > higher raw value should lead to the same lux value.
> >
> > Sounds correct.
>
> I was CC'd due to the GTS (gain-time-scale)-helpers. The above is the beef
> of those helpers - which, attempt to aid drivers to convert the impact of
> the hardware gain + integration time into a single scale value. This
> approach has some caveats, but the goal is to fulfill the expectations of
> those user-space apps which expect only scale to change the gain, while also
> need to have the integration time controllable (for example to reduce the
> measurement time for one reason or another).
>
> Problem is that, especially when there are multiple channels with separate
> gain control but common integration time, there will be some situations
> where the integration time change _will_ cause changes to "total gain (E.g.
> scale)" too. There may also be cases where some scale values can be met only
> with certain integration times, or where a scale for a channel can't be met
> maintaining the scale for other channels etc.
>
> All in all, I am not sure if the 'unchangeable hardware gain' approach makes
> things as simple as possible - but as long as we want to have it, the GTS
> helpers may be of use :) There are couple of drivers using them - feel free
> to take a look. "git grep gts_ drivers/iio/light/" should point you the
> current users.
>
Thanks a lot for illustrating and explaining the GTS. I implemented the driver
with GTS and by this learned a lot about it. But at the end i found it in my
case to be simpler to implement it without GTS for some reasons:
- User wants to be able to set up the integration time as well as scale and the
driver should not optimize it somehow.
- There is not only a relation from the scale to the gain of the sensor but also
to the photodiode size. Because of this i need another helper table asize of
GTS for translating the scale into sensor gain and photodiode size.
I'll come up with a version 3 shortly.
Andreas
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
next prev parent reply other threads:[~2025-05-05 19:26 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-16 11:31 [PATCH 0/3] iio:light: add driver for veml6046x00 RGBIR color sensor Andreas Klinger
2025-03-16 11:31 ` [PATCH 1/3] dt-bindings: iio: light: veml6046x00: add " Andreas Klinger
2025-03-16 12:19 ` Rob Herring (Arm)
2025-03-17 11:00 ` Jonathan Cameron
2025-03-17 11:17 ` Andreas Klinger
2025-03-17 11:26 ` Krzysztof Kozlowski
2025-03-16 11:31 ` [PATCH 2/3] iio: light: add support for veml6046x00 RGBIR " Andreas Klinger
2025-03-17 11:50 ` Jonathan Cameron
2025-03-18 2:15 ` Andreas Klinger
2025-03-23 11:51 ` Jonathan Cameron
2025-04-06 8:43 ` Andreas Klinger
2025-04-06 11:08 ` Jonathan Cameron
2025-04-07 5:52 ` Matti Vaittinen
2025-05-05 19:10 ` Andreas Klinger [this message]
2025-05-06 6:03 ` Matti Vaittinen
2025-05-06 8:28 ` Andreas Klinger
2025-05-06 9:17 ` Matti Vaittinen
2025-03-16 11:31 ` [PATCH 3/3] MAINTAINER: add maintainer for veml6046x00 Andreas Klinger
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=aBkNHSxU4T8j4oMT@mail.your-server.de \
--to=ak@it-klinger.de \
--cc=arthur.becker@sentec.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=ivan.orlov0322@gmail.com \
--cc=javier.carrasco.cruz@gmail.com \
--cc=jic23@kernel.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mazziesaccount@gmail.com \
--cc=muditsharma.info@gmail.com \
--cc=robh@kernel.org \
--cc=subhajit.ghosh@tweaklogic.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.