From: Justin Weiss <justin@justinweiss.com>
To: Jonathan Cameron <jic23@kernel.org>
Cc: "Alex Lanzano" <lanzano.alex@gmail.com>,
"Lars-Peter Clausen" <lars@metafoo.de>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
"Derek J . Clark" <derekjohn.clark@gmail.com>,
"Philip Müller" <philm@manjaro.org>
Subject: Re: [PATCH 3/3] iio: imu: Add scale and sampling frequency to BMI270 IMU
Date: Sun, 13 Oct 2024 13:55:36 -0700 [thread overview]
Message-ID: <87ttdfn2nr.fsf@justinweiss.com> (raw)
In-Reply-To: <20241013164000.19087833@jic23-huawei> (Jonathan Cameron's message of "Sun, 13 Oct 2024 16:40:00 +0100")
Jonathan Cameron <jic23@kernel.org> writes:
> On Sat, 12 Oct 2024 19:45:18 -0700
> Justin Weiss <justin@justinweiss.com> wrote:
>
>> Jonathan Cameron <jic23@kernel.org> writes:
>>
>> > On Fri, 11 Oct 2024 08:37:49 -0700
>> > Justin Weiss <justin@justinweiss.com> wrote:
>> >
>> >> Add read and write functions and create _available entries. Use
>> >> IIO_CHAN_INFO_SAMP_FREQ instead of IIO_CHAN_INFO_FREQUENCY to match
>> >> the BMI160 / BMI323 drivers.
>> >
>> > Ah. Please break dropping _FREQUENCY change out as a separate fix
>> > with fixes tag etc and drag it to start of the patch. It was never
>> > wired to anything anyway
>> >
>> > That's a straight forward ABI bug so we want that to land ahead
>> > of the rest of the series.
>>
>> Thanks, I'll pull that into its own change and make it the first patch.
>>
>> > Does this device have a data ready interrupt and if so what affect
>> > do the different ODRs for each type of sensor have on that?
>> > If there are separate data ready signals, you probably want to
>> > go with a dual buffer setup from the start as it is hard to unwind
>> > that later.
>>
>> It has data ready interrupts for both accelerometer and gyroscope and a
>> FIFO interrupt. I had held off on interrupts to keep this change
>> simpler, but if it's a better idea to get it in earlier, I can add it
>> alongside the triggered buffer change.
>
> Ok. So the challenge is that IIO buffers are only described by external
> metadata. We don't carry tags within them. Hence if you are using
> either effectively separate datastreams (the two data ready interrupts)
> or a fifo that is tagged data (how this difference of speed is normally handled
> if it's one buffer) then when we push them into IIO buffers, they have
> to go into separate buffers.
>
> In older drivers this was done via the heavy weight option of registering
> two separate IIO devices. Today we have the ability to support multiple buffers
> in one driver. I'm not sure we've yet used it for this case, so I think
> there may still be some gaps around triggering that will matter for the
> separate dataready interrupt case (fifo is fine as no trigger involved).
> Looking again at that code, it looks like there may need to be quite
> a bit more work to cover this case proeprly.
>
> We may be able to have a migration path from the simple case you have
> (where timing is an external trigger) to multiple buffers.
> It would involve:
> 1) Initial solution where the frequencies must match if the fifo is in use.
> Non fifo trigger from data ready might work but we'd need to figure out
> if they run in close enough timing.
> 2) Solution where we add a second buffer and if the channels are enabled
> in that we can allow separate timing for the two sensor types.
>
> This is one of those hardware features that seems like a good idea
> from the hardware design point of view but assumes a very specific
> sort of software model :(
>
> Jonathan
Hm, that does sound tricky. If there's an example I can follow, I can
make an attempt at it. Otherwise, if there's a change I can make now
that would help with migrating in the future, I can do that instead.
Of the devices I've looked at, only one has had the interrupts usable
and that one only had a single pin available. So if this change doesn't
make it harder to add later if it's necessary, I would still be OK going
without full support for now.
Justin
next prev parent reply other threads:[~2024-10-13 20:55 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-11 15:37 [PATCH 0/3] Add i2c driver for Bosch BMI260 IMU Justin Weiss
2024-10-11 15:37 ` [PATCH 1/3] iio: imu: Add i2c driver for bmi260 imu Justin Weiss
2024-10-12 11:08 ` Jonathan Cameron
2024-10-13 2:41 ` Justin Weiss
2024-10-13 15:14 ` Jonathan Cameron
2024-10-13 20:36 ` Justin Weiss
2024-10-14 18:50 ` Jonathan Cameron
2024-10-11 15:37 ` [PATCH 2/3] iio: imu: Add triggered buffer for Bosch BMI270 IMU Justin Weiss
2024-10-12 11:18 ` Jonathan Cameron
2024-10-13 2:43 ` Justin Weiss
2024-10-13 15:17 ` Jonathan Cameron
2024-10-13 20:54 ` Justin Weiss
2024-10-14 19:01 ` Jonathan Cameron
2024-10-11 15:37 ` [PATCH 3/3] iio: imu: Add scale and sampling frequency to " Justin Weiss
2024-10-12 11:35 ` Jonathan Cameron
2024-10-13 2:45 ` Justin Weiss
2024-10-13 15:40 ` Jonathan Cameron
2024-10-13 20:55 ` Justin Weiss [this message]
2024-10-14 19:11 ` Jonathan Cameron
2024-10-16 1:20 ` Justin Weiss
2024-10-18 18:02 ` Jonathan Cameron
2024-10-12 10:57 ` [PATCH 0/3] Add i2c driver for Bosch BMI260 IMU Jonathan Cameron
2024-10-13 2:36 ` Justin Weiss
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=87ttdfn2nr.fsf@justinweiss.com \
--to=justin@justinweiss.com \
--cc=derekjohn.clark@gmail.com \
--cc=jic23@kernel.org \
--cc=lanzano.alex@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=philm@manjaro.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 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.