From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Vaittinen, Matti" <Matti.Vaittinen@fi.rohmeurope.com>,
Jonathan Cameron <Jonathan.Cameron@Huawei.com>,
linux-iio <linux-iio@vger.kernel.org>,
"Mutanen, Mikko" <Mikko.Mutanen@fi.rohmeurope.com>
Subject: Re: ROHM ALS, integration time
Date: Mon, 27 Feb 2023 09:22:12 +0200 [thread overview]
Message-ID: <c88c1672-badd-18ae-fcb7-bf2696319aba@gmail.com> (raw)
In-Reply-To: <20230226172958.1b4a87f2@jic23-huawei>
On 2/26/23 19:30, Jonathan Cameron wrote:
> On Sat, 18 Feb 2023 20:08:10 +0200
> Matti Vaittinen <mazziesaccount@gmail.com> wrote:
>
>> Thanks a lot Jonathan,
>>
>> You have been super helpful :) Thanks!
>>
>> On 2/18/23 19:20, Jonathan Cameron wrote:
> Hmm. There is another approach that I'd not thought of in this case because
> in my head integration time is more continuous than it is for this part and
> that is to fiddle the _raw values (we do this for oversampling or SAR ADCs
> where things tend to be powers of 2). The trick is to shift the raw value
> always so that the 'scale' due to (in this case) integration time remains
> constant. That separates the two controls completely.
Holy cow! That's a neat trick which I didn't think of!
Basically, we could do >> 1 for the data when time is 100 mS, >> 2 when
200 mS and >> 3 when 400 mS. We would want to use 19-bit channel values
then.
> However, I'm not sure that makes sense here where the thing we typically
> want to change when scaling due to saturation is integration time.
That's a bit problematic, yes. We could "fool" the user by doing the
saturation check in driver, and then just returning the max value of all
19-bits set if the saturation is detected. This, however, would yield
raw values that are slightly off. OTOH, with max sift of 3 bits that's
only 7 'raw ticks' - which I hope is acceptable. I hope the user will
then be switching to shorter integration time and start getting correct
readings.
It's slightly sad to say "good bye" to the gain-time-scale helpers but I
guess you just helped me to solve this with a _really_ simple way. We
can keep those helpers in "back pocket" for the day when we need them ;)
I will see what comes out of this idea - thanks for the help again!
>
> Jonathan
>>
>> Yours,
>> -- Matti
>>
>
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~
next prev parent reply other threads:[~2023-02-27 7:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-30 12:04 ROHM ALS, integration time Matti Vaittinen
2023-01-30 13:02 ` Jonathan Cameron
2023-01-30 13:42 ` Vaittinen, Matti
2023-01-30 17:12 ` Jonathan Cameron
2023-01-30 18:19 ` Matti Vaittinen
2023-01-30 20:19 ` Jonathan Cameron
2023-01-31 19:58 ` Jonathan Corbet
2023-02-01 5:55 ` Matti Vaittinen
2023-01-31 9:31 ` Vaittinen, Matti
2023-02-02 16:57 ` Jonathan Cameron
2023-02-06 14:34 ` Vaittinen, Matti
2023-02-18 17:20 ` Jonathan Cameron
2023-02-18 18:08 ` Matti Vaittinen
2023-02-26 17:26 ` Jonathan Cameron
2023-02-26 17:30 ` Jonathan Cameron
2023-02-27 7:22 ` Matti Vaittinen [this message]
2023-02-27 9:54 ` Matti Vaittinen
2023-03-04 18:37 ` Jonathan Cameron
2023-02-25 9:35 ` [low prio, just pondering] About the light sensor "sensitivity area" Matti Vaittinen
2023-03-04 20:26 ` 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=c88c1672-badd-18ae-fcb7-bf2696319aba@gmail.com \
--to=mazziesaccount@gmail.com \
--cc=Jonathan.Cameron@Huawei.com \
--cc=Matti.Vaittinen@fi.rohmeurope.com \
--cc=Mikko.Mutanen@fi.rohmeurope.com \
--cc=jic23@kernel.org \
--cc=linux-iio@vger.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