From: Jonathan Cameron <jic23@kernel.org>
To: "Vaittinen, Matti" <Matti.Vaittinen@fi.rohmeurope.com>
Cc: Matti Vaittinen <mazziesaccount@gmail.com>,
Lars-Peter Clausen <lars@metafoo.de>,
"linux-iio@vger.kernel.org" <linux-iio@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC PATCH 5/6] iio: light: ROHM BU27034 Ambient Light Sensor
Date: Sat, 4 Mar 2023 18:53:18 +0000 [thread overview]
Message-ID: <20230304185318.117f9e48@jic23-huawei> (raw)
In-Reply-To: <ec0d0f3a-c10a-4d55-486f-7b90db90a427@fi.rohmeurope.com>
On Tue, 28 Feb 2023 08:43:28 +0000
"Vaittinen, Matti" <Matti.Vaittinen@fi.rohmeurope.com> wrote:
> On 2/26/23 15:52, Jonathan Cameron wrote:
> > On Fri, 24 Feb 2023 12:41:46 +0200
> > Matti Vaittinen <mazziesaccount@gmail.com> wrote:
> >
> >> On 2/22/23 18:15, Matti Vaittinen wrote:
> >>
> >> Well, this "works on my machine" - but I am slightly unhappy with this.
> >> I have a feeling I am effectively making a poor, reduced version of data
> >> buffering here. I am starting to think that I should
> >>
> >> a) Not start measurement at chip init. (saves power)
> >> b) Start measurement at raw-read and just block for damn long for each
> >> raw-read. Yep, it probably means that users who want to raw-read all
> >> channels will be blocking 4 * measurement time when they are reading all
> >> channels one after another. Yes, this is in worst case 4 * 400 mS.
> >> Horrible. But see (c) below.
> >
> > Hmm. Light sensors tend to be slow in some modes, but rarely do people actually
> > have such low light levels that they are using them with 400mS integration times.
> >
> >> c) Implement triggered_buffer mode. Here my lack of IIO-experience shows
> >> up again. I have no idea if there is - or what is - the "de facto" way
> >> for implementing this when our device has no IRQ? I could cook-up some
> >> 'tiny bit shorter than the measurement time' period timer which would
> >> kick the driver to poll the VALID-bit - or, because we need anyways to
> >> poll the valid bit from process context - just a kthread which polls the
> >> VALID-bit. Naturally the thread/timer should be only activated when the
> >> trigger is enabled.
> >
> > Firstly you don't have to have a trigger. In a case where it's a bit hacky
> > and unlikely to be particularly useful for other devices, you can just implement
> > a buffer directly.
>
> This is the approach I took for the next attempt. I just used the
> iio_kfifo_buffer.
>
> > There are various options that exist..
> > 1) iio-trig-loop - this is nasty but occasionally useful approach. You then
> > make the iio_poll_func wait on the flag.
>
> I actually did take a look at this. The loop trigger had pretty much
> everything I would have needed - except configurability from the driver.
It's purpose was a originally a bit different, so I'm not surprised it
didn't really fit. The target was a sensor that needed explicit triggering
but then took a while to get the data. Aim was to grab data as quick as we
could. So there were no problems with alignment.
> It had the enable/disable with protected start of the thread and the
> thread stopping all in place. Really, as you said, the only thing that
> was missing was "hinting the timing". For a moment I was playing with a
> thought of trying to implement a simple generic thread-loop code which
> could take the sleep-time + callback for 'ensuring we slept long enough'
> + a callback for code to execute (collect data + push to buffers) - but
> it felt like re-implementing existing mechanisms. Besides, as you said,
> I don't probably need a trigger
>
> I'll do some clean-ups and look through the feedback and try to get the
> v2 out still during this week.
>
> Yours,
> -- Matti
>
next prev parent reply other threads:[~2023-03-04 18:53 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-22 16:13 [RFC PATCH 0/6] Support ROHM BU27034 ALS sensor Matti Vaittinen
2023-02-22 16:14 ` [RFC PATCH 1/6] dt-bindings: iio: light: Support ROHM BU27034 Matti Vaittinen
2023-02-22 18:57 ` Krzysztof Kozlowski
2023-02-23 6:20 ` Vaittinen, Matti
2023-02-23 9:26 ` Krzysztof Kozlowski
2023-02-23 10:59 ` Matti Vaittinen
2023-02-26 13:39 ` Jonathan Cameron
2023-02-22 16:14 ` [RFC PATCH 2/6] iio: light: Add gain-time-scale helpers Matti Vaittinen
2023-02-26 16:21 ` Jonathan Cameron
2023-02-28 9:09 ` Vaittinen, Matti
2023-02-28 11:13 ` Vaittinen, Matti
2023-02-22 16:15 ` [RFC PATCH 3/6] iio: test: test " Matti Vaittinen
2023-02-22 16:15 ` [RFC PATCH 4/6] MAINTAINERS: Add IIO " Matti Vaittinen
2023-02-22 16:15 ` [RFC PATCH 5/6] iio: light: ROHM BU27034 Ambient Light Sensor Matti Vaittinen
2023-02-24 10:41 ` Matti Vaittinen
2023-02-26 13:52 ` Jonathan Cameron
2023-02-28 8:43 ` Vaittinen, Matti
2023-03-04 18:53 ` Jonathan Cameron [this message]
2023-02-26 17:13 ` Jonathan Cameron
2023-03-02 7:35 ` Vaittinen, Matti
2023-03-04 19:11 ` Jonathan Cameron
2023-02-22 16:16 ` [RFC PATCH 6/6] MAINTAINERS: Add ROHM BU27034 Matti Vaittinen
2023-02-26 13:42 ` Jonathan Cameron
2023-02-27 5:51 ` Matti Vaittinen
2023-02-26 16:28 ` [RFC PATCH 0/6] Support ROHM BU27034 ALS sensor 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=20230304185318.117f9e48@jic23-huawei \
--to=jic23@kernel.org \
--cc=Matti.Vaittinen@fi.rohmeurope.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mazziesaccount@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox