From: Jonathan Cameron <jic23@kernel.org>
To: Lothar Rubusch <l.rubusch@gmail.com>
Cc: lars@metafoo.de, Michael.Hennerich@analog.com,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
eraretuya@gmail.com
Subject: Re: [PATCH v1 00/12] iio: accel: adxl345: add interrupt based sensor events
Date: Sat, 8 Feb 2025 12:57:32 +0000 [thread overview]
Message-ID: <20250208125732.2a41961a@jic23-huawei> (raw)
In-Reply-To: <CAFXKEHbuJkG1Ptjz03-ZhfLQB6PuYk47BMKKPTN9mFnXsnF3kw@mail.gmail.com>
On Tue, 4 Feb 2025 14:40:17 +0100
Lothar Rubusch <l.rubusch@gmail.com> wrote:
> Hi Jonathan, please find my answers below.
>
> On Sat, Feb 1, 2025 at 6:48 PM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > On Tue, 28 Jan 2025 12:00:48 +0000
> > Lothar Rubusch <l.rubusch@gmail.com> wrote:
> >
> > > Add several interrupt based sensor detection events:
> > > - single tap
> > > - double tap
> > > - free fall
> > > - activity
> > > - inactivity
> > >
> > > All the needed parameters for each and methods of adjusting them, and
> > > forward a resulting IIO event for each to the IIO channel.
> >
> > So my main feedback here is to be much more reluctant to add new ABI.
> > Anything you add is unused by all existing code and if it is unique
> > to a driver probably never going to be used by anyone other than you.
> >
> > We have a bunch of accelerometers in tree and as they go wrt to events
> > this one isn't even particularly complex. The existing ABI covers
> > their events reasonably well so take a look at how they do it. Often
> > it's a case of mapping names for the application of an event (free fall
> > detection, activity detection etc) to what what they are actually detecting.
> > Those generalize a lot better across different sensor types. It's almost
> > always a threshold of some type. The tap / double tap are more complex
> > but we put quite a lot of effort into coming up with a general
> > description a year or so back. There may new things but most of the
> > ABI is already there.
> >
> Please, understand my patches in "v1" rather as a huge set of questions,
> than a proposal of reinventing the IIO ABI :)
> My intention is actually not to extend/rewrite the ABI. It rather shows my lack
> of knowledge combined with the curiosity of how to actually use the
> (IIO) APIs for
> such implementation. I know this is still tedious, but I'm sure it will become
> better.
>
> My dilemma was/is the following: I did an initial implementation more similar
> to e.g. ADXL380 for such events, and the sca3000.c for the freefall event.
> IMHO the names for the sysfs handles were not at all intuitively mappable to the
> fields I liked to operate, such as tap duration, window, latent, etc.
> The other alternative I saw, was setting up sysfs myself, IMHO clearer naming
> but actually not really using IIO's event_config/event_value.
>
> Personally, I don't have any preference. If there really is no way to change
> naming of the sysfs handles, then it's probably a question of
> documentation. If I
> can make it more intuitive for a user who knows the sensor, but not
> the internals
> of IIO, then I'd prefer to use the names referred and documented in the sensor's
> datasheet.
ABI has to be consistent across lots of different device types. Things
that on accelerometers mean freefall are totally different for ADCs etc.
That's one of the challenges of an ABI that is meant to cover many devices.
There is also the challenge that one devices idea of how to detect what seems
like a common thing can be totally different to another with controls
that don't line up at all. By targetting what is actually being measured
rather than what the device datasheet says it is for, we tend to get better
generalisation and more meaningful control parameters. It gets fiddly
around things that are sort of dumb classifiers like tap detectors
or more complex activity classifiers as we don't always get useful
documentation on what the controls are doing.
Many users will make use of userspace libraries. If they are focused on
just accelerometers they get to present an interface to the next layer
up that is accelerometer specific.
>
> In summary, I see your point. So, I redo this patch set as I did in the initial
> approach to show better what I mean. Probably I'm just using it in a wrong way.
> Thank you for the feedback so far, I'll try to use it where it still applies.
Feel free to send out an ABI RFC in cases where it's not obvious. That
can save some time by getting at least outline agreement on the direction
before code is ready.
Jonathan
prev parent reply other threads:[~2025-02-08 12:57 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-28 12:00 [PATCH v1 00/12] iio: accel: adxl345: add interrupt based sensor events Lothar Rubusch
2025-01-28 12:00 ` [PATCH v1 01/12] iio: accel: adxl345: migrate constants to core Lothar Rubusch
2025-02-01 16:35 ` Jonathan Cameron
2025-02-04 14:13 ` Lothar Rubusch
2025-02-04 14:46 ` Jonathan Cameron
2025-01-28 12:00 ` [PATCH v1 02/12] iio: accel: adxl345: reorganize measurement enable Lothar Rubusch
2025-02-01 16:37 ` Jonathan Cameron
2025-01-28 12:00 ` [PATCH v1 03/12] iio: accel: adxl345: add debug register access Lothar Rubusch
2025-01-28 12:00 ` [PATCH v1 04/12] iio: accel: adxl345: reorganize irq handler Lothar Rubusch
2025-02-01 16:43 ` Jonathan Cameron
2025-01-28 12:00 ` [PATCH v1 05/12] iio: accel: adxl345: improve access to the interrupt enable register Lothar Rubusch
2025-02-01 16:49 ` Jonathan Cameron
2025-01-28 12:00 ` [PATCH v1 06/12] iio: accel: adxl345: add single tap feature Lothar Rubusch
2025-02-01 17:02 ` Jonathan Cameron
2025-01-28 12:00 ` [PATCH v1 07/12] iio: accel: adxl345: show tap status and direction Lothar Rubusch
2025-02-01 17:09 ` Jonathan Cameron
2025-01-28 12:00 ` [PATCH v1 08/12] iio: accel: adxl345: add double tap feature Lothar Rubusch
2025-02-01 17:15 ` Jonathan Cameron
2025-01-28 12:00 ` [PATCH v1 09/12] iio: accel: adxl345: add double tap suppress bit Lothar Rubusch
2025-02-01 17:17 ` Jonathan Cameron
2025-01-28 12:00 ` [PATCH v1 10/12] iio: accel: adxl345: add freefall feature Lothar Rubusch
2025-02-01 17:22 ` Jonathan Cameron
2025-01-28 12:00 ` [PATCH v1 11/12] iio: accel: adxl345: add activity feature Lothar Rubusch
2025-02-01 17:27 ` Jonathan Cameron
2025-02-04 13:48 ` Lothar Rubusch
2025-01-28 12:01 ` [PATCH v1 12/12] iio: accel: adxl345: add inactivity feature Lothar Rubusch
2025-02-01 17:41 ` Jonathan Cameron
2025-02-01 17:48 ` [PATCH v1 00/12] iio: accel: adxl345: add interrupt based sensor events Jonathan Cameron
2025-02-04 13:40 ` Lothar Rubusch
2025-02-08 12:57 ` Jonathan Cameron [this message]
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=20250208125732.2a41961a@jic23-huawei \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=eraretuya@gmail.com \
--cc=l.rubusch@gmail.com \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@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